X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=rapp-manager-models%2Fsrc%2Ftest%2Fjava%2Fcom%2Foransc%2Frappmanager%2Fmodels%2Fstatemachine%2FRappInstanceStateMachineConfigTest.java;h=4657c763b078aba54f0609328eccc9667a757691;hb=77a08f7b9a97e0c6fcce5729cdcc3c18ea90c002;hp=59d5c949d928a3195d07fd9453f2111915abe0ca;hpb=77d91d4af1b3845fc8a3ef20cd6e54e9e6ff5a37;p=nonrtric%2Fplt%2Frappmanager.git diff --git a/rapp-manager-models/src/test/java/com/oransc/rappmanager/models/statemachine/RappInstanceStateMachineConfigTest.java b/rapp-manager-models/src/test/java/com/oransc/rappmanager/models/statemachine/RappInstanceStateMachineConfigTest.java index 59d5c94..4657c76 100755 --- a/rapp-manager-models/src/test/java/com/oransc/rappmanager/models/statemachine/RappInstanceStateMachineConfigTest.java +++ b/rapp-manager-models/src/test/java/com/oransc/rappmanager/models/statemachine/RappInstanceStateMachineConfigTest.java @@ -75,7 +75,7 @@ class RappInstanceStateMachineConfigTest { } @ParameterizedTest - @EnumSource(value = RappEvent.class, names = {"ACMDEPLOYED", "SMEDEPLOYED"}) + @EnumSource(value = RappEvent.class, names = {"ACMDEPLOYED", "SMEDEPLOYED", "DMEDEPLOYED" }) void testIndividualDeployedState(RappEvent rappEvent) throws Exception { StateMachineTestPlan plan = StateMachineTestPlanBuilder.builder().stateMachine(stateMachine).step() @@ -92,23 +92,51 @@ class RappInstanceStateMachineConfigTest { .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.DEPLOYED).expectStateChanged(1) + .sendEvent(RappEvent.SMEDEPLOYED).expectState(RappInstanceState.DEPLOYING).and().step() + .sendEvent(RappEvent.DMEDEPLOYED).expectState(RappInstanceState.DEPLOYED).expectStateChanged(1) .and().build(); plan.test(); } @Test - void testDeployFailedState() throws Exception { + void testAcmDeployFailedState() throws Exception { + StateMachineTestPlan plan = + StateMachineTestPlanBuilder.builder().stateMachine(stateMachine).step() + .expectState(RappInstanceState.UNDEPLOYED).and().step().sendEvent(RappEvent.DEPLOYING) + .expectState(RappInstanceState.DEPLOYING).expectStateChanged(1).and().step() + .sendEvent(RappEvent.SMEDEPLOYED).expectState(RappInstanceState.DEPLOYING).and().step() + .sendEvent(RappEvent.DMEDEPLOYED).expectState(RappInstanceState.DEPLOYING).and().step() + .sendEvent(RappEvent.ACMDEPLOYFAILED).expectState(RappInstanceState.UNDEPLOYED) + .expectStateChanged(1).and().build(); + plan.test(); + } + + @Test + void testSmeDeployFailedState() throws Exception { StateMachineTestPlan plan = StateMachineTestPlanBuilder.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.DEPLOYING).and().step() .sendEvent(RappEvent.SMEDEPLOYFAILED).expectState(RappInstanceState.UNDEPLOYED) .expectStateChanged(1).and().build(); plan.test(); } + @Test + void testDmeDeployFailedState() throws Exception { + StateMachineTestPlan plan = + StateMachineTestPlanBuilder.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.DMEDEPLOYFAILED).expectState(RappInstanceState.UNDEPLOYED) + .expectStateChanged(1).and().build(); + plan.test(); + } + @Test void testUndeployingState() throws Exception { StateMachineTestPlan plan = @@ -116,21 +144,23 @@ class RappInstanceStateMachineConfigTest { .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.DEPLOYED).expectStateChanged(1) + .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().build(); plan.test(); } @ParameterizedTest - @EnumSource(value = RappEvent.class, names = {"ACMUNDEPLOYED", "SMEUNDEPLOYED"}) + @EnumSource(value = RappEvent.class, names = {"ACMUNDEPLOYED", "SMEUNDEPLOYED", "DMEUNDEPLOYED" }) void testIndividualUndeployedState(RappEvent rappEvent) throws Exception { StateMachineTestPlan plan = StateMachineTestPlanBuilder.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.DEPLOYED).expectStateChanged(1) + .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) .expectState(RappInstanceState.UNDEPLOYING).and().build(); @@ -144,26 +174,64 @@ class RappInstanceStateMachineConfigTest { .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.DEPLOYED).expectStateChanged(1) + .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.SMEUNDEPLOYED) - .expectState(RappInstanceState.UNDEPLOYED).expectStateChanged(1).and().build(); + .expectState(RappInstanceState.UNDEPLOYING).and().step().sendEvent(RappEvent.DMEUNDEPLOYED) + .expectStateChanged(1).and().build(); + plan.test(); + } + + @Test + void testUndeployAcmFailedState() throws Exception { + StateMachineTestPlan plan = + StateMachineTestPlanBuilder.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 testUndeployFailedState() throws Exception { + void testUndeploySmeFailedState() throws Exception { StateMachineTestPlan plan = StateMachineTestPlanBuilder.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.DEPLOYED).expectStateChanged(1) + .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) .expectState(RappInstanceState.UNDEPLOYING).and().step().sendEvent(RappEvent.SMEUNDEPLOYFAILED) .expectState(RappInstanceState.DEPLOYED).expectStateChanged(1).and().build(); plan.test(); } + + @Test + void testUndeployDmeFailedState() throws Exception { + StateMachineTestPlan plan = + StateMachineTestPlanBuilder.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.SMEUNDEPLOYED) + .expectState(RappInstanceState.UNDEPLOYING).and().step().sendEvent(RappEvent.DMEUNDEPLOYFAILED) + .expectState(RappInstanceState.DEPLOYED).expectStateChanged(1).and().build(); + plan.test(); + } }