From c41c04b7b53bce7354d8cd1d47db3144e267a599 Mon Sep 17 00:00:00 2001 From: "waqas.ikram" Date: Tue, 11 Apr 2023 13:57:39 +0100 Subject: Adding namespace support Change-Id: Iac15ae319f335dd67a660c2cf7ac051cf1c9077e Issue-ID: SO-4097 Signed-off-by: waqas.ikram --- .../adapter/cnfm/tasks/CnfInstantiateTaskTest.java | 25 ++++++---------------- .../cnfm/tasks/StubbedBuildingBlockExecution.java | 4 +--- 2 files changed, 8 insertions(+), 21 deletions(-) (limited to 'bpmn/so-bpmn-tasks/src/test') diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfInstantiateTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfInstantiateTaskTest.java index 79b47776f2..1268828a20 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfInstantiateTaskTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfInstantiateTaskTest.java @@ -21,6 +21,7 @@ package org.onap.so.bpmn.infrastructure.adapter.cnfm.tasks; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.mockito.ArgumentMatchers.any; @@ -32,6 +33,7 @@ import static org.mockito.Mockito.when; import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.INPUT_PARAMETER; import static org.onap.so.cnfm.lcm.model.utils.AdditionalParamsConstants.CLOUD_OWNER_PARAM_KEY; import static org.onap.so.cnfm.lcm.model.utils.AdditionalParamsConstants.CLOUD_REGION_PARAM_KEY; +import static org.onap.so.cnfm.lcm.model.utils.AdditionalParamsConstants.NAMESPACE_KEY; import static org.onap.so.cnfm.lcm.model.utils.AdditionalParamsConstants.TENANT_ID_PARAM_KEY; import java.util.Collections; import java.util.Optional; @@ -43,9 +45,7 @@ import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParameter; -import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; -import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.cnfm.lcm.model.AsInstance; import org.onap.so.cnfm.lcm.model.CreateAsRequest; @@ -66,8 +66,7 @@ public class CnfInstantiateTaskTest { private static final String AS_INSTANCE_ID = "asInstanceid"; private static final String CLOUD_OWNER = "CloudOwner"; private static final String LCP_CLOUD_REGION_ID = "RegionOne"; - private static final String CNF_ID = UUID.randomUUID().toString(); - private static final String CNF_NAME = "CNF_NAME"; + private static final String NAME_SPACE = "default"; private static final String JOB_ID = UUID.randomUUID().toString(); @Mock @@ -92,6 +91,8 @@ public class CnfInstantiateTaskTest { assertEquals(LCP_CLOUD_REGION_ID, actual.getAdditionalParams().get(CLOUD_REGION_PARAM_KEY).toString()); assertEquals(StubbedBuildingBlockExecution.getTenantId(), actual.getAdditionalParams().get(TENANT_ID_PARAM_KEY).toString()); + assertEquals(NAME_SPACE, actual.getAdditionalParams().get(NAMESPACE_KEY).toString()); + } @Test @@ -157,6 +158,8 @@ public class CnfInstantiateTaskTest { final InstantiateAsRequest actual = stubbedExecution.getVariable(INSTANTIATE_AS_REQUEST_OBJECT); assertNotNull(actual); assertNotNull(actual.getDeploymentItems()); + assertEquals(1, actual.getDeploymentItems().size()); + assertFalse(actual.getDeploymentItems().get(0).getDeploymentItemsId().isBlank()); } private Optional getAsInstance() { @@ -165,20 +168,6 @@ public class CnfInstantiateTaskTest { return Optional.of(response); } - private GenericVnf getGenericVnf() { - final GenericVnf genericVnf = new GenericVnf(); - genericVnf.setVnfId(CNF_ID); - genericVnf.setModelInfoGenericVnf(getModelInfoGenericVnf()); - genericVnf.setVnfName(CNF_NAME); - return genericVnf; - } - - private ModelInfoGenericVnf getModelInfoGenericVnf() { - final ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); - modelInfoGenericVnf.setModelInstanceName(MODEL_INSTANCE_NAME); - return modelInfoGenericVnf; - } - private CnfInstantiateTask getCnfInstantiateTask() { return new CnfInstantiateTask(mockedCnfmHttpServiceProvider, exceptionUtil); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/StubbedBuildingBlockExecution.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/StubbedBuildingBlockExecution.java index 3b16feda18..d4474f292d 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/StubbedBuildingBlockExecution.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/StubbedBuildingBlockExecution.java @@ -27,10 +27,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; -import org.jetbrains.kotlin.codegen.intrinsics.LateinitIsInitialized; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.common.exceptions.RequiredExecutionVariableExeception; -import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; @@ -154,7 +152,7 @@ public class StubbedBuildingBlockExecution implements BuildingBlockExecution { deploymentItems.add(deploymentItemMap); Map userParamsMap = new HashMap<>(); userParamsMap.put("deploymentItems", deploymentItems); - userParamsMap.put("namespace", "Namespace"); + userParamsMap.put("namespace", "default"); List> userParams = new ArrayList<>(); userParams.add(userParamsMap); RequestParameters requestParameters = new RequestParameters(); -- cgit 1.2.3-korg