aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/test
diff options
context:
space:
mode:
authorMarcin Rzepecki <marcin.rzepecki@nokia.com>2021-03-29 15:24:42 +0200
committerMarcin Rzepecki <marcin.rzepecki@nokia.com>2021-03-29 15:24:42 +0200
commitedd8f30798d42f26ca6f23d7883f88f2c246760b (patch)
tree7c05f90037e1044e8ef3e9462e0ef5e2116f2d32 /bpmn/so-bpmn-tasks/src/test
parentddf1a56a6ea6c8cfc40836f0bcf00afdd151c702 (diff)
SO refactor - extract Workflow type Service
Issue-ID: SO-3581 Signed-off-by: Marcin Rzepecki <marcin.rzepecki@nokia.com> Change-Id: I5bbe63371045333213542c275e763ac7305369a1
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/test')
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java30
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java (renamed from bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversalTest.java)4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/VrfValidationTest.java (renamed from bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidationTest.java)3
3 files changed, 24 insertions, 13 deletions
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
index 55529b5bf0..31f37f4ac3 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
@@ -78,6 +78,8 @@ import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.ebb.loader.ServiceEBBLoader;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.ebb.loader.UserParamsServiceTraversal;
import org.onap.so.bpmn.infrastructure.workflow.tasks.ebb.loader.VnfEBBLoader;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
@@ -141,6 +143,10 @@ public class WorkflowActionTest extends BaseTaskTest {
@Spy
protected VnfEBBLoader vnfEBBLoaderSpy;
+ @InjectMocks
+ @Spy
+ protected ServiceEBBLoader serviceEBBLoader;
+
@Rule
public ExpectedException thrown = ExpectedException.none();
@@ -2094,7 +2100,7 @@ public class WorkflowActionTest extends BaseTaskTest {
List<Resource> resourceCounter = new ArrayList<>();
thrown.expect(BpmnError.class);
List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>();
- workflowAction.traverseCatalogDbService(execution, sIRequest, resourceCounter, aaiResourceIds);
+ serviceEBBLoader.traverseCatalogDbService(execution, sIRequest, resourceCounter, aaiResourceIds);
}
@@ -2106,7 +2112,8 @@ public class WorkflowActionTest extends BaseTaskTest {
networkCustomization.setModelCustomizationUUID("123");
service.getCollectionResourceCustomizations().add(networkCustomization);
doReturn(networkCustomization).when(catalogDbClient).getNetworkCollectionResourceCustomizationByID("123");
- CollectionResourceCustomization customization = workflowAction.findCatalogNetworkCollection(execution, service);
+ CollectionResourceCustomization customization =
+ serviceEBBLoader.findCatalogNetworkCollection(execution, service);
assertNotNull(customization);
}
@@ -2116,7 +2123,8 @@ public class WorkflowActionTest extends BaseTaskTest {
NetworkCollectionResourceCustomization networkCustomization = new NetworkCollectionResourceCustomization();
networkCustomization.setModelCustomizationUUID("123");
service.getCollectionResourceCustomizations().add(networkCustomization);
- CollectionResourceCustomization customization = workflowAction.findCatalogNetworkCollection(execution, service);
+ CollectionResourceCustomization customization =
+ serviceEBBLoader.findCatalogNetworkCollection(execution, service);
assertNull(customization);
}
@@ -2131,7 +2139,7 @@ public class WorkflowActionTest extends BaseTaskTest {
service.getCollectionResourceCustomizations().add(networkCustomization2);
doReturn(networkCustomization1).when(catalogDbClient).getNetworkCollectionResourceCustomizationByID("123");
doReturn(networkCustomization2).when(catalogDbClient).getNetworkCollectionResourceCustomizationByID("321");
- workflowAction.findCatalogNetworkCollection(execution, service);
+ serviceEBBLoader.findCatalogNetworkCollection(execution, service);
assertEquals("Found multiple Network Collections in the Service model, only one per Service is supported.",
execution.getVariable("WorkflowActionErrorMessage"));
}
@@ -2183,7 +2191,7 @@ public class WorkflowActionTest extends BaseTaskTest {
.getConfiguration("testConfigurationId");
doReturn(Optional.of(aaiConfiguration2)).when(aaiConfigurationResources)
.getConfiguration("testConfigurationId2");
- workflowAction.traverseAAIService(execution, resourceCounter, resourceId, aaiResourceIds);
+ serviceEBBLoader.traverseAAIService(execution, resourceCounter, resourceId, aaiResourceIds);
assertEquals(8, resourceCounter.size());
assertTrue(resourceCounter.get(2).isBaseVfModule());
assertThat(aaiResourceIds, sameBeanAs(getExpectedResourceIds()));
@@ -2200,7 +2208,7 @@ public class WorkflowActionTest extends BaseTaskTest {
resourceList.add(new Resource(WorkflowType.NETWORK, "model customization id", false));
resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION, "model customization id", false));
- assertEquals(workflowAction.foundRelated(resourceList), true);
+ assertEquals(serviceEBBLoader.foundRelated(resourceList), true);
}
@Test
@@ -2211,11 +2219,11 @@ public class WorkflowActionTest extends BaseTaskTest {
resourceList.add(new Resource(WorkflowType.NETWORK, "model customization id", false));
resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION, "model customization id", false));
- assertEquals(workflowAction.containsWorkflowType(resourceList, WorkflowType.PNF), true);
- assertEquals(workflowAction.containsWorkflowType(resourceList, WorkflowType.VNF), true);
- assertEquals(workflowAction.containsWorkflowType(resourceList, WorkflowType.NETWORK), true);
- assertEquals(workflowAction.containsWorkflowType(resourceList, WorkflowType.NETWORKCOLLECTION), true);
- assertEquals(workflowAction.containsWorkflowType(resourceList, WorkflowType.CONFIGURATION), false);
+ assertEquals(serviceEBBLoader.containsWorkflowType(resourceList, WorkflowType.PNF), true);
+ assertEquals(serviceEBBLoader.containsWorkflowType(resourceList, WorkflowType.VNF), true);
+ assertEquals(serviceEBBLoader.containsWorkflowType(resourceList, WorkflowType.NETWORK), true);
+ assertEquals(serviceEBBLoader.containsWorkflowType(resourceList, WorkflowType.NETWORKCOLLECTION), true);
+ assertEquals(serviceEBBLoader.containsWorkflowType(resourceList, WorkflowType.CONFIGURATION), false);
}
private List<Pair<WorkflowType, String>> getExpectedResourceIds() {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversalTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java
index 99f17a3628..75514b15d7 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversalTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.infrastructure.workflow.tasks;
+package org.onap.so.bpmn.infrastructure.workflow.tasks.ebb.loader;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.camunda.bpm.engine.delegate.DelegateExecution;
@@ -28,6 +28,8 @@ import org.junit.Test;
import org.mockito.Mockito;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.common.BBConstants;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.Resource;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowType;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.catalog.beans.ConfigurationResource;
import org.onap.so.db.catalog.beans.CvnfcCustomization;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidationTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/VrfValidationTest.java
index 7f9f0417ea..dcccb74f58 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidationTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/VrfValidationTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.infrastructure.workflow.tasks;
+package org.onap.so.bpmn.infrastructure.workflow.tasks.ebb.loader;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.doReturn;
@@ -45,6 +45,7 @@ import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.VrfBondingServiceException;
import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization;