aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/test/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/test/java/org')
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java25
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtilsTest.java9
2 files changed, 34 insertions, 0 deletions
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java
index cac7f872b3..cf6588e113 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java
@@ -66,6 +66,7 @@ public class UserParamsServiceTraversalTest extends BaseTaskTest {
private static final String MACRO_CREATE_WITHOUT_RESOURCES_JSON = "Macro/ServiceMacroCreateWithoutResources.json";
private static final String MACRO_CREATE_SVC_SAME_MODEL_VNF_VFMODULE =
"Macro/ServiceMacroCreateMultipleSameModelVnfsAndVfModules.json";
+ private static final String MACRO_CREATE_SVC_SAME_MODEL_PNF = "Macro/ServiceMacroCreateMultipleSameModelPnfs.json";
private static final String serviceInstanceId = "123";
private DelegateExecution execution;
private CatalogDbClient mockCatalogDbClient;
@@ -149,6 +150,30 @@ public class UserParamsServiceTraversalTest extends BaseTaskTest {
}
@Test
+ public void getResourceListFromUserParamsMultiplePnfs() throws Exception {
+ initExecution("createInstance", readBpmnRequestFromFile(MACRO_CREATE_SVC_SAME_MODEL_PNF), false);
+
+ List<Resource> resourceListFromUserParams = userParamsServiceTraversal.getResourceListFromUserParams(execution,
+ getUserParams(), serviceInstanceId, requestAction);
+
+ assertEquals(3, resourceListFromUserParams.size());
+
+ Resource service = resourceListFromUserParams.get(0);
+ assertTrue(service.getResourceType() == WorkflowType.SERVICE);
+ assertEquals(2, service.getChildren().size());
+
+ Resource pnf1 = service.getChildren().get(0);
+ assertEquals(service, pnf1.getParent());
+ assertEquals("ORAN_SIM1_2106_pnf_01", pnf1.getInstanceName());
+ assertEquals("88a3096a-af87-4853-99f6-7256a9ab6c3e", pnf1.getResourceId());
+
+ Resource pnf2 = service.getChildren().get(1);
+ assertEquals(service, pnf2.getParent());
+ assertEquals("ORAN_SIM1_2106_pnf_02", pnf2.getInstanceName());
+ assertEquals("88a3096a-af87-4853-99f6-7256a9ab6c3e", pnf2.getResourceId());
+ }
+
+ @Test
public void getResourceListFromUserParamsForVnfs() throws Exception {
initExecution(requestAction, readBpmnRequestFromFile(MACRO_ASSIGN_JSON), false);
Mockito.doReturn(getVfModuleCustomization("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f", true))
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtilsTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtilsTest.java
index 996c0c07e1..f8bd963c49 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtilsTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtilsTest.java
@@ -42,6 +42,7 @@ public class WorkflowResourceIdsUtilsTest {
private static final String CONFIGURATION_ID = "configurationId";
private static final String VNF_INSTANCE_NAME = "vnfInstanceNameId";
private static final String VF_MODULE_INSTANCE_NAME = "vfModuleInstanceNameId";
+ private static final String PNF_INSTANCE_NAME = "pnfInstanceNameId";
private WorkflowResourceIds workflowResourceIds;
@Before
@@ -60,6 +61,7 @@ public class WorkflowResourceIdsUtilsTest {
execution.setVariable("instanceGroupId", INSTANCE_GROUP_ID);
execution.setVariable("vnfInstanceName", VNF_INSTANCE_NAME);
execution.setVariable("vfModuleInstanceName", VF_MODULE_INSTANCE_NAME);
+ execution.setVariable("pnfInstanceName", PNF_INSTANCE_NAME);
workflowResourceIds = WorkflowResourceIdsUtils.getWorkflowResourceIdsFromExecution(execution);
@@ -71,6 +73,7 @@ public class WorkflowResourceIdsUtilsTest {
assertEquals(INSTANCE_GROUP_ID, workflowResourceIds.getInstanceGroupId());
assertEquals(VNF_INSTANCE_NAME, workflowResourceIds.getVnfInstanceName());
assertEquals(VF_MODULE_INSTANCE_NAME, workflowResourceIds.getVfModuleInstanceName());
+ assertEquals(PNF_INSTANCE_NAME, workflowResourceIds.getPnfInstanceName());
}
@Test
@@ -149,6 +152,12 @@ public class WorkflowResourceIdsUtilsTest {
workflowResourceIds::getVfModuleInstanceName);
}
+ @Test
+ public void shouldPropertySetPnfInstanceName() {
+ assertFieldSetProperlyInstanceName(WorkflowType.PNF, PNF_INSTANCE_NAME,
+ workflowResourceIds::getPnfInstanceName);
+ }
+
private void assertFieldSetProperly(WorkflowType workflowType, String expectedId,
Supplier<String> testedObjectField) {
WorkflowResourceIdsUtils.setResourceIdByWorkflowType(workflowResourceIds, workflowType, expectedId);