+ .expectState(RappInstanceState.UNDEPLOYING).and().step().sendEvent(RappEvent.SMEUNDEPLOYED)
+ .expectState(RappInstanceState.UNDEPLOYED).expectStateChanged(1).and().build();
+ plan.test();
+ }
+
+ @Test
+ void testUndeployedStateAcmAndDmeOnly() throws Exception {
+ stateMachine.getExtendedState().getVariables().put("sme", false);
+ StateMachineTestPlan<RappInstanceState, RappEvent> plan =
+ StateMachineTestPlanBuilder.<RappInstanceState, RappEvent>builder().stateMachine(stateMachine).step()
+ .expectState(RappInstanceState.UNDEPLOYED).and().step().sendEvent(RappEvent.DEPLOYING)
+ .expectState(RappInstanceState.DEPLOYING).expectStateChanged(1).and().step()
+ .sendEvent(RappEvent.ACMDEPLOYED).expectState(RappInstanceState.DEPLOYING).and().step()
+ .sendEvent(RappEvent.DMEDEPLOYED).expectState(RappInstanceState.DEPLOYED).expectStateChanged(1)
+ .and().step().sendEvent(RappEvent.UNDEPLOYING).expectState(RappInstanceState.UNDEPLOYING)
+ .expectStateChanged(1).and().step().sendEvent(RappEvent.ACMUNDEPLOYED)
+ .expectState(RappInstanceState.UNDEPLOYING).and().step().sendEvent(RappEvent.DMEUNDEPLOYED)
+ .expectState(RappInstanceState.UNDEPLOYED).expectStateChanged(1).and().build();
+ plan.test();
+ }
+
+ @Test
+ void testUndeployAcmFailedState() throws Exception {
+ StateMachineTestPlan<RappInstanceState, RappEvent> plan =
+ StateMachineTestPlanBuilder.<RappInstanceState, RappEvent>builder().stateMachine(stateMachine).step()
+ .expectState(RappInstanceState.UNDEPLOYED).and().step().sendEvent(RappEvent.DEPLOYING)
+ .expectState(RappInstanceState.DEPLOYING).expectStateChanged(1).and().step()
+ .sendEvent(RappEvent.ACMDEPLOYED).expectState(RappInstanceState.DEPLOYING).and().step()
+ .sendEvent(RappEvent.SMEDEPLOYED).expectState(RappInstanceState.DEPLOYING).and().step()
+ .sendEvent(RappEvent.DMEDEPLOYED).expectState(RappInstanceState.DEPLOYED).expectStateChanged(1)
+ .and().step().sendEvent(RappEvent.UNDEPLOYING).expectState(RappInstanceState.UNDEPLOYING)
+ .expectStateChanged(1).and().step().sendEvent(RappEvent.SMEUNDEPLOYED)
+ .expectState(RappInstanceState.UNDEPLOYING).and().step().sendEvent(RappEvent.DMEUNDEPLOYED)
+ .expectState(RappInstanceState.UNDEPLOYING).and().step().sendEvent(RappEvent.ACMUNDEPLOYFAILED)
+ .expectState(RappInstanceState.DEPLOYED).expectStateChanged(1).and().build();
+ plan.test();
+ }
+
+ @Test
+ void testUndeploySmeFailedState() throws Exception {
+ StateMachineTestPlan<RappInstanceState, RappEvent> plan =
+ StateMachineTestPlanBuilder.<RappInstanceState, RappEvent>builder().stateMachine(stateMachine).step()
+ .expectState(RappInstanceState.UNDEPLOYED).and().step().sendEvent(RappEvent.DEPLOYING)
+ .expectState(RappInstanceState.DEPLOYING).expectStateChanged(1).and().step()
+ .sendEvent(RappEvent.ACMDEPLOYED).expectState(RappInstanceState.DEPLOYING).and().step()
+ .sendEvent(RappEvent.SMEDEPLOYED).expectState(RappInstanceState.DEPLOYING).and().step()
+ .sendEvent(RappEvent.DMEDEPLOYED).expectState(RappInstanceState.DEPLOYED).expectStateChanged(1)
+ .and().step().sendEvent(RappEvent.UNDEPLOYING).expectState(RappInstanceState.UNDEPLOYING)
+ .expectStateChanged(1).and().step().sendEvent(RappEvent.ACMUNDEPLOYED)
+ .expectState(RappInstanceState.UNDEPLOYING).and().step().sendEvent(RappEvent.DMEUNDEPLOYED)