diff options
8 files changed, 62 insertions, 59 deletions
diff --git a/adapters/so-appc-orchestrator/pom.xml b/adapters/so-appc-orchestrator/pom.xml index 874fc4d59f..f2639fc664 100644 --- a/adapters/so-appc-orchestrator/pom.xml +++ b/adapters/so-appc-orchestrator/pom.xml @@ -145,10 +145,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - </dependency> - <dependency> <groupId>org.camunda.bpm</groupId> <artifactId>camunda-external-task-client</artifactId> </dependency> diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml index 1c2a417c23..6ef3b95f2b 100644 --- a/bpmn/MSOCommonBPMN/pom.xml +++ b/bpmn/MSOCommonBPMN/pom.xml @@ -161,10 +161,6 @@ <artifactId>camunda-connect-connectors-all</artifactId> </dependency> <dependency> - <groupId>commons-beanutils</groupId> - <artifactId>commons-beanutils</artifactId> - </dependency> - <dependency> <!-- Needed for InMemoryH2Test --> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> diff --git a/bpmn/so-bpmn-infrastructure-common/pom.xml b/bpmn/so-bpmn-infrastructure-common/pom.xml index 740f256213..205791970b 100644 --- a/bpmn/so-bpmn-infrastructure-common/pom.xml +++ b/bpmn/so-bpmn-infrastructure-common/pom.xml @@ -143,10 +143,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - </dependency> - <dependency> <groupId>com.fasterxml.uuid</groupId> <artifactId>java-uuid-generator</artifactId> </dependency> diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfInstantiateTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfInstantiateTask.java index c7f3310391..b9fb235e99 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfInstantiateTask.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfInstantiateTask.java @@ -23,27 +23,28 @@ package org.onap.so.bpmn.infrastructure.adapter.cnfm.tasks; import static java.util.Objects.isNull; 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.RESOURCE_ID_KEY; import static org.onap.so.cnfm.lcm.model.utils.AdditionalParamsConstants.SERVICE_INSTANCE_ID_PARAM_KEY; import static org.onap.so.cnfm.lcm.model.utils.AdditionalParamsConstants.SERVICE_INSTANCE_NAME_PARAM_KEY; import static org.onap.so.cnfm.lcm.model.utils.AdditionalParamsConstants.TENANT_ID_PARAM_KEY; import java.net.URI; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Map; import java.util.NoSuchElementException; import java.util.Optional; -import org.apache.groovy.util.Maps; import org.onap.logging.filter.base.ONAPComponents; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.cnfm.lcm.model.AsInfoModificationRequestDeploymentItems; import org.onap.so.cnfm.lcm.model.AsInstance; import org.onap.so.cnfm.lcm.model.CreateAsRequest; import org.onap.so.cnfm.lcm.model.InstantiateAsRequest; -import org.onap.so.cnfm.lcm.model.AsInfoModificationRequestDeploymentItems; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.RequestDetails; @@ -62,6 +63,7 @@ import org.springframework.stereotype.Component; */ @Component public class CnfInstantiateTask { + private static final String DEPLOYMENT_ITEMS_KEY = "deploymentItems"; private static final String CREATE_AS_REQUEST_OBJECT = "CreateAsRequestObject"; private static final String INSTANTIATE_AS_REQUEST_OBJECT = "InstantiateAsRequest"; private static final String CNFM_REQUEST_STATUS_CHECK_URL = "CnfmStatusCheckUrl"; @@ -105,11 +107,19 @@ public class CnfInstantiateTask { final CreateAsRequest createAsRequest = new CreateAsRequest().asdId(modelInfo.getModelVersionId()) .asInstanceName(requestDetails.getRequestInfo().getInstanceName()) - .additionalParams(Maps.of(CLOUD_OWNER_PARAM_KEY, cloudConfiguration.getCloudOwner(), - CLOUD_REGION_PARAM_KEY, cloudConfiguration.getLcpCloudRegionId(), TENANT_ID_PARAM_KEY, - cloudConfiguration.getTenantId(), SERVICE_INSTANCE_ID_PARAM_KEY, - serviceInstance.getServiceInstanceId(), SERVICE_INSTANCE_NAME_PARAM_KEY, - serviceInstance.getServiceInstanceName(), RESOURCE_ID_KEY, resourceId)); + .putAdditionalParamsItem(CLOUD_OWNER_PARAM_KEY, cloudConfiguration.getCloudOwner()) + .putAdditionalParamsItem(CLOUD_REGION_PARAM_KEY, cloudConfiguration.getLcpCloudRegionId()) + .putAdditionalParamsItem(TENANT_ID_PARAM_KEY, cloudConfiguration.getTenantId()) + .putAdditionalParamsItem(SERVICE_INSTANCE_ID_PARAM_KEY, serviceInstance.getServiceInstanceId()) + .putAdditionalParamsItem(SERVICE_INSTANCE_NAME_PARAM_KEY, serviceInstance.getServiceInstanceName()) + .putAdditionalParamsItem(RESOURCE_ID_KEY, resourceId); + + final List<Map<String, Object>> userParams = requestDetails.getRequestParameters().getUserParams(); + if (userParams != null) { + userParams.stream().filter(entry -> entry.containsKey(NAMESPACE_KEY)).findAny() + .ifPresent(userParam -> createAsRequest.putAdditionalParamsItem(NAMESPACE_KEY, + userParam.get(NAMESPACE_KEY))); + } LOGGER.debug("Adding CreateAsRequest to execution {}", createAsRequest); @@ -152,20 +162,16 @@ public class CnfInstantiateTask { (ExecuteBuildingBlock) execution.getVariable("buildingBlock"); final RequestDetails requestDetails = executeBuildingBlock.getRequestDetails(); final InstantiateAsRequest instantiateAsRequest = new InstantiateAsRequest(); + if (requestDetails != null && requestDetails.getRequestParameters() != null) { - List<Map<String, Object>> userParams = requestDetails.getRequestParameters().getUserParams(); + final List<Map<String, Object>> userParams = requestDetails.getRequestParameters().getUserParams(); if (userParams != null && !userParams.isEmpty()) { - List<Object> deploymentItems = new ArrayList<>(); - List<AsInfoModificationRequestDeploymentItems> deploymentItemsReq = new ArrayList<>(); - for (Map<String, Object> userParam : userParams) { - if (userParam.containsKey("deploymentItems")) { - deploymentItems = (ArrayList<Object>) userParam.get("deploymentItems"); - break; - } - } - for (Object deploymentItem : deploymentItems) { - Map<String, Object> deploymentItemMap = (Map<String, Object>) deploymentItem; - AsInfoModificationRequestDeploymentItems item = new AsInfoModificationRequestDeploymentItems(); + final List<Object> deploymentItems = getDeploymentItems(userParams); + final List<AsInfoModificationRequestDeploymentItems> deploymentItemsReq = new ArrayList<>(); + for (final Object deploymentItem : deploymentItems) { + final Map<String, Object> deploymentItemMap = (Map<String, Object>) deploymentItem; + final AsInfoModificationRequestDeploymentItems item = + new AsInfoModificationRequestDeploymentItems(); item.setDeploymentItemsId(deploymentItemMap.get("deploymentItemsId").toString()); item.setLifecycleParameterKeyValues(deploymentItemMap.get("lifecycleParameterKeyValues")); deploymentItemsReq.add(item); @@ -188,7 +194,7 @@ public class CnfInstantiateTask { try { final InstantiateAsRequest instantiateAsRequest = execution.getVariable(INSTANTIATE_AS_REQUEST_OBJECT); final String asInstanceId = execution.getVariable(AS_INSTANCE_ID); - Optional<URI> cnfStatusCheckURL = + final Optional<URI> cnfStatusCheckURL = cnfmHttpServiceProvider.invokeInstantiateAsRequest(instantiateAsRequest, asInstanceId); execution.setVariable(CNFM_REQUEST_STATUS_CHECK_URL, cnfStatusCheckURL.orElseThrow()); execution.setVariable(MONITOR_JOB_NAME, "Instantiate"); @@ -199,4 +205,12 @@ public class CnfInstantiateTask { } } + private List<Object> getDeploymentItems(final List<Map<String, Object>> userParams) { + for (final Map<String, Object> userParam : userParams) { + if (userParam.containsKey(DEPLOYMENT_ITEMS_KEY)) { + return (ArrayList<Object>) userParam.get(DEPLOYMENT_ITEMS_KEY); + } + } + return Collections.emptyList(); + } } 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<AsInstance> 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<String, Object> userParamsMap = new HashMap<>(); userParamsMap.put("deploymentItems", deploymentItems); - userParamsMap.put("namespace", "Namespace"); + userParamsMap.put("namespace", "default"); List<Map<String, Object>> userParams = new ArrayList<>(); userParams.add(userParamsMap); RequestParameters requestParameters = new RequestParameters(); diff --git a/common/pom.xml b/common/pom.xml index d6328b4596..e5ab0ff58f 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -12,7 +12,7 @@ <description>MSO Common classes:- Logger</description> <properties> <grpc.version>1.25.0</grpc.version> - <protobuf.version>3.10.0</protobuf.version> + <protobuf.version>3.22.2</protobuf.version> <grpc.netty.version>4.1.30.Final</grpc.netty.version> <ccsdk.version>1.1.5</ccsdk.version> <spring-cloud-sleuth.version>2.0.2.RELEASE</spring-cloud-sleuth.version> @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.oparent</groupId> <artifactId>oparent</artifactId> - <version>2.1.0</version> + <version>3.0.2</version> <relativePath /> </parent> <groupId>org.onap.so</groupId> @@ -49,7 +49,7 @@ <sonar.projectVersion>${project.version}</sonar.projectVersion> <sonar.cpd.exclusions>**/*</sonar.cpd.exclusions> <org.apache.maven.user-settings /> - <openstack.version>1.7.1</openstack.version> + <openstack.version>1.12.0</openstack.version> <maven.build.timestamp.format>yyyyMMdd'T'HHmm</maven.build.timestamp.format> <originalClassifier>original</originalClassifier> <docker.skip>true</docker.skip> @@ -76,6 +76,7 @@ <aaf.cadi.version>2.1.15</aaf.cadi.version> <so-etsi-sol003-adapter-version>1.9.0-SNAPSHOT</so-etsi-sol003-adapter-version> <onap-logging-version>1.6.9</onap-logging-version> + <jackson.version>2.14.2</jackson.version> </properties> <distributionManagement> <repository> @@ -488,7 +489,7 @@ <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> - <version>2.12.1</version> + <version>2.14.2</version> </dependency> </dependencies> </plugin> @@ -611,7 +612,14 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> - <version>2.22.2</version> + <version>3.0.0-M9</version> + <dependencies> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-engine</artifactId> + <version>5.5.2</version> + </dependency> + </dependencies> <configuration> <systemPropertyVariables> <so.log.level>DEBUG</so.log.level> @@ -716,26 +724,32 @@ <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> + <version>${jackson.version}</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.module</groupId> <artifactId>jackson-module-jaxb-annotations</artifactId> + <version>${jackson.version}</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> + <version>${jackson.version}</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> + <version>${jackson.version}</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.jaxrs</groupId> <artifactId>jackson-jaxrs-base</artifactId> + <version>${jackson.version}</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.jaxrs</groupId> <artifactId>jackson-jaxrs-json-provider</artifactId> + <version>${jackson.version}</version> </dependency> <dependency> <groupId>javax.ws.rs</groupId> @@ -960,7 +974,7 @@ <dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> - <version>20140107</version> + <version>20220924</version> </dependency> <dependency> <groupId>org.onap.aai.schema-service</groupId> |