diff options
author | Priyadharshini <priyadharshini.b96@wipro.com> | 2020-08-23 04:48:42 -0700 |
---|---|---|
committer | Priyadharshini <priyadharshini.b96@wipro.com> | 2020-08-24 01:05:50 -0700 |
commit | 1bc42e219ad96e8c61483b99d0f98e67909649b6 (patch) | |
tree | b3ec7c5cb358455d885f42be1af5232269a7b317 /src/test/java/org | |
parent | ac2672f417dabb4d097e485457089a0945ab8a71 (diff) |
Implement E2EService activation/deactivation for NetworkSlicing
Issue-ID: EXTAPI-502
Signed-off-by: Priyadharshini <priyadharshini.b96@wipro.com>
Change-Id: I0fa7221bfdeaa0c8c94c10719adbbf4b4605504f
Diffstat (limited to 'src/test/java/org')
-rw-r--r-- | src/test/java/org/onap/nbi/apis/assertions/ServiceOrderExecutionTaskAssertions.java | 23 | ||||
-rw-r--r-- | src/test/java/org/onap/nbi/test/ExecutionTaskTest.java | 35 |
2 files changed, 47 insertions, 11 deletions
diff --git a/src/test/java/org/onap/nbi/apis/assertions/ServiceOrderExecutionTaskAssertions.java b/src/test/java/org/onap/nbi/apis/assertions/ServiceOrderExecutionTaskAssertions.java index 621a938..1f0e62c 100644 --- a/src/test/java/org/onap/nbi/apis/assertions/ServiceOrderExecutionTaskAssertions.java +++ b/src/test/java/org/onap/nbi/apis/assertions/ServiceOrderExecutionTaskAssertions.java @@ -30,6 +30,7 @@ import org.onap.nbi.apis.serviceorder.model.ServiceOrder; import org.onap.nbi.apis.serviceorder.model.ServiceOrderItem; import org.onap.nbi.apis.serviceorder.model.ServiceSpecificationRef; import org.onap.nbi.apis.serviceorder.model.StateType; +import org.onap.nbi.apis.serviceorder.model.ServiceStateType; import org.onap.nbi.apis.serviceorder.model.Value; import org.onap.nbi.apis.serviceorder.model.consumer.SubscriberInfo; import org.onap.nbi.apis.serviceorder.model.orchestrator.ExecutionTask; @@ -65,8 +66,8 @@ public class ServiceOrderExecutionTaskAssertions { itemA.id("A"); itemA.action(ActionType.ADD); Service serviceA = new Service(); - serviceA.setServiceState("active"); - ServiceSpecificationRef serviceSpecificationRefA = new ServiceSpecificationRef(); + serviceA.setServiceState(ServiceStateType.ACTIVE); + ServiceSpecificationRef serviceSpecificationRefA = new ServiceSpecificationRef(); serviceSpecificationRefA.setId("333"); serviceA.setServiceSpecification(serviceSpecificationRefA); itemA.setService(serviceA); @@ -76,8 +77,8 @@ public class ServiceOrderExecutionTaskAssertions { itemB.id("B"); itemB.action(ActionType.ADD); Service serviceB = new Service(); - serviceB.setServiceState("active"); - ServiceSpecificationRef serviceSpecificationRefB = new ServiceSpecificationRef(); + serviceB.setServiceState(ServiceStateType.ACTIVE); + ServiceSpecificationRef serviceSpecificationRefB = new ServiceSpecificationRef(); serviceSpecificationRefB.setId("1e3feeb0-8e36-46c6-862c-236d9c626439"); serviceB.setServiceSpecification(serviceSpecificationRefB); itemB.setService(serviceB); @@ -131,8 +132,8 @@ public class ServiceOrderExecutionTaskAssertions { if (actionType != ActionType.ADD) { serviceA.setId("e4688e5f-61a0-4f8b-ae02-a2fbde623bcb"); } - serviceA.setServiceState("active"); - ServiceSpecificationRef serviceSpecificationRefA = new ServiceSpecificationRef(); + serviceA.setServiceState(ServiceStateType.ACTIVE); + ServiceSpecificationRef serviceSpecificationRefA = new ServiceSpecificationRef(); serviceSpecificationRefA.setId("1e3feeb0-8e36-46c6-862c-236d9c626439"); serviceA.setServiceSpecification(serviceSpecificationRefA); itemA.setService(serviceA); @@ -145,8 +146,8 @@ public class ServiceOrderExecutionTaskAssertions { if (actionType != ActionType.ADD) { serviceB.setId("e4688e5f-61a0-4f8b-ae02-a2fbde623bcb"); } - serviceB.setServiceState("active"); - ServiceSpecificationRef serviceSpecificationRefB = new ServiceSpecificationRef(); + serviceB.setServiceState(ServiceStateType.ACTIVE); + ServiceSpecificationRef serviceSpecificationRefB = new ServiceSpecificationRef(); serviceSpecificationRefB.setId("1e3feeb0-8e36-46c6-862c-236d9c626439"); serviceB.setServiceSpecification(serviceSpecificationRefB); itemB.setService(serviceB); @@ -201,7 +202,7 @@ public class ServiceOrderExecutionTaskAssertions { if (actionType != ActionType.ADD) { serviceA.setId("e4688e5f-61a0-4f8b-ae02-a2fbde623bcb"); } - serviceA.setServiceState("active"); + serviceA.setServiceState(ServiceStateType.ACTIVE); ServiceSpecificationRef serviceSpecificationRefA = new ServiceSpecificationRef(); serviceSpecificationRefA.setId("82c9fbb4-656c-4973-8c7f-172b22b5fa8f"); serviceA.setServiceSpecification(serviceSpecificationRefA); @@ -215,7 +216,7 @@ public class ServiceOrderExecutionTaskAssertions { if (actionType != ActionType.ADD) { serviceB.setId("e4688e5f-61a0-4f8b-ae02-a2fbde623bcb"); } - serviceB.setServiceState("active"); + serviceB.setServiceState(ServiceStateType.ACTIVE); ServiceSpecificationRef serviceSpecificationRefB = new ServiceSpecificationRef(); serviceSpecificationRefB.setId("82c9fbb4-656c-4973-8c7f-172b22b5fa8f"); serviceB.setServiceSpecification(serviceSpecificationRefB); @@ -738,4 +739,4 @@ public class ServiceOrderExecutionTaskAssertions { executionTaskRepository.save(executionTaskB); return executionTaskA; } -}
\ No newline at end of file +} diff --git a/src/test/java/org/onap/nbi/test/ExecutionTaskTest.java b/src/test/java/org/onap/nbi/test/ExecutionTaskTest.java index 2b28eff..5e6c97c 100644 --- a/src/test/java/org/onap/nbi/test/ExecutionTaskTest.java +++ b/src/test/java/org/onap/nbi/test/ExecutionTaskTest.java @@ -295,6 +295,41 @@ public class ExecutionTaskTest { assertThat(executionTaskRepository.count()).isEqualTo(0); } + @Test + public void testE2EExecutionTaskActivationSuccess() throws Exception { + + ExecutionTask executionTaskA = ServiceOrderExecutionTaskAssertions + .setUpBddForE2EExecutionTaskSucess(serviceOrderRepository, executionTaskRepository, ActionType.MODIFY); + ExecutionTask executionTaskB; + + SoTaskProcessor.processOrderItem(executionTaskA); + ServiceOrder serviceOrderChecked = getServiceOrder("test"); + assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS); + for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) { + if (serviceOrderItem.getId().equals("A")) { + assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED); + } else { + assertThat(serviceOrderItem.getState()).isEqualTo(StateType.ACKNOWLEDGED); + } + } + + executionTaskB = getExecutionTask("B"); + assertThat(executionTaskB.getReliedTasks()).isNullOrEmpty(); + executionTaskA = getExecutionTask("A"); + assertThat(executionTaskA).isNull(); + + SoTaskProcessor.processOrderItem(executionTaskB); + serviceOrderChecked = getServiceOrder("test"); + assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.COMPLETED); + for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) { + assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED); + + } + + assertThat(executionTaskRepository.count()).isEqualTo(0); + + } + @Test public void testE2EExecutionTaskDeleteSuccess() throws Exception { |