aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2018-09-04 11:21:02 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2018-09-08 22:33:28 -0400
commit69455a268648881f4b5a0c4547d769c2e6ecc2c1 (patch)
tree8ea753e5282e91316d842522c8873fd51572344c /bpmn/MSOCommonBPMN/src
parent3e9ee0977d0c8643f81e720bbf23e5a40864a0d8 (diff)
added generic fabric support to SO
Fix Autoincrement of ID field in table Fix accidental removal of method Update usage of requestdb client removed unused imports in common tasks and test Fix broken branch, have unit tests pass references the Epic branch Fix broken branch from compiling committing classpath for vfc adapter cause its not going away added in the fail case for when there are no profiles removed second set of adapters in application test yml removed double adapters in request db application test added jpa repo dependency to the so bpmn folder pom add creation timestamp column to the table added in null checks for Config returned from policy switched to string in requestprocess with jenerate switched to string in requestprocess with jenerate updated aai version in common pom to 605 from 591 renamed the db scripts for flyway sync to register added endpoint to application test yml for failing test ... Change-Id: I800f837ea75d7cdff740dc3a387e4d7654cfd085 Issue-ID: SO-972 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/MSOCommonBPMN/src')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java72
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java20
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java55
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java7
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java8
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java64
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java5
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java3
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/db/request/RequestsDbClient.java86
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java20
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java23
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/NonSpringSuite.java35
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplication.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java67
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java11
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java48
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java11
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/test/categories/SpringAware.java25
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml2
26 files changed, 451 insertions, 147 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java
index f1c2c8dda6..deae46ce98 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java
@@ -21,8 +21,10 @@
package org.onap.so.bpmn.common;
import org.onap.so.client.aai.AAICommonObjectMapperProvider;
+import org.onap.so.client.aai.AAIQueryClient;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.policy.PolicyClientImpl;
import org.onap.so.client.sdno.SDNOValidator;
import org.onap.so.client.sdno.SDNOValidatorImpl;
import org.springframework.stereotype.Component;
@@ -46,6 +48,10 @@ public class InjectionHelper {
return new AAIResourcesClient();
}
+ public AAIQueryClient getAaiQueryClient() {
+ return new AAIQueryClient();
+ }
+
public SDNOValidator getSdnoValidator() {
return new SDNOValidatorImpl();
}
@@ -57,4 +63,8 @@ public class InjectionHelper {
public AAIResultWrapper getAaiResultWrapper(String json) {
return new AAIResultWrapper(json);
}
+
+ public PolicyClientImpl getPolicyClient() {
+ return new PolicyClientImpl();
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java
new file mode 100644
index 0000000000..c3511e69a4
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java
@@ -0,0 +1,72 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.baseclient;
+
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.http.client.BufferingClientHttpRequestFactory;
+import org.springframework.http.client.SimpleClientHttpRequestFactory;
+import org.springframework.web.client.RestClientException;
+import org.springframework.web.client.RestTemplate;
+
+//TODO move to common location
+public class BaseClient<I,O> {
+
+ private HttpHeaders httpHeader;
+ private String targetUrl;
+
+ public HttpHeaders getHttpHeader() {
+ return httpHeader;
+ }
+
+ public void setHttpHeader(HttpHeaders httpHeader) {
+ this.httpHeader = httpHeader;
+ }
+
+ public String getTargetUrl() {
+ return targetUrl;
+ }
+
+ public void setTargetUrl(String targetUrl) {
+ this.targetUrl = targetUrl;
+ }
+
+ public O get(I data, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException {
+ return run(data, HttpMethod.GET, typeRef, uriVariables);
+ }
+
+ public O post(I data, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException {
+ return run(data, HttpMethod.POST, typeRef, uriVariables);
+ }
+
+ public O run(I data, HttpMethod method, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException {
+ HttpEntity<I> requestEntity = new HttpEntity<I>(data, getHttpHeader());
+ RestTemplate restTemplate = new RestTemplate();
+ restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory()));
+ ResponseEntity<O> responseEntity = restTemplate.exchange(getTargetUrl(), method, requestEntity, typeRef,
+ uriVariables);
+ return responseEntity.getBody();
+ }
+
+} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
index ca2da772fb..fe6b0f8b4e 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
@@ -57,7 +57,7 @@ public class ResourceRequestBuilder {
public static String CUSTOMIZATION_UUID = "customizationUUID";
- public static String SERVICE_URL_TOSCA_CSAR = "/v3/serviceToscaCsar?serviceModelUuid=";
+ public static String SERVICE_URL_TOSCA_CSAR = "/v3/serviceToscaCsar";
private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, ResourceRequestBuilder.class);
@@ -184,7 +184,7 @@ public class ResourceRequestBuilder {
private static String getCsarFromUuid(String uuid) throws Exception {
String catalogEndPoint = UrnPropertiesReader.getVariable("mso.catalog.db.endpoint");
- HttpClient client = new HttpClient(UriBuilder.fromUri(catalogEndPoint + SERVICE_URL_TOSCA_CSAR + uuid).build().toURL(), "application/json", TargetEntity.CATALOG_DB);
+ HttpClient client = new HttpClient(UriBuilder.fromUri(catalogEndPoint).path(SERVICE_URL_TOSCA_CSAR).queryParam("serviceModelUuid", uuid).build().toURL(), "application/json", TargetEntity.CATALOG_DB);
Response response = client.get();
String value = response.readEntity(String.class);
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java
index 17bd4f545b..ba3ab7f315 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java
@@ -139,8 +139,28 @@ public class GenericVnf implements Serializable, ShallowCopy<GenericVnf> {
private List<InstanceGroup> instanceGroups = new ArrayList<InstanceGroup>();
@JsonProperty("call-homing")
private Boolean callHoming;
+ @JsonProperty("nf-function")
+ private String nfFunction;
+ @JsonProperty("nf-role")
+ private String nfRole;
+ public String getNfFunction() {
+ return nfFunction;
+ }
+
+ public void setNfFunction(String nfFunction) {
+ this.nfFunction = nfFunction;
+ }
+
+ public String getNfRole() {
+ return nfRole;
+ }
+
+ public void setNfRole(String nfRole) {
+ this.nfRole = nfRole;
+ }
+
public List<InstanceGroup> getInstanceGroups() {
return instanceGroups;
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java
new file mode 100644
index 0000000000..8f0ced955c
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.servicedecomposition.entities;
+
+import java.io.Serializable;
+
+public class ConfigurationResourceKeys implements Serializable{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private String vfModuleCustomizationUUID;
+ private String vnfResourceCustomizationUUID;
+ private String cvnfcCustomizationUUID;
+
+ public String getVfModuleCustomizationUUID() {
+ return vfModuleCustomizationUUID;
+ }
+ public void setVfModuleCustomizationUUID(String vfModuleCustomizationUUID) {
+ this.vfModuleCustomizationUUID = vfModuleCustomizationUUID;
+ }
+ public String getVnfResourceCustomizationUUID() {
+ return vnfResourceCustomizationUUID;
+ }
+ public void setVnfResourceCustomizationUUID(String vnfResourceCustomizationUUID) {
+ this.vnfResourceCustomizationUUID = vnfResourceCustomizationUUID;
+ }
+ public String getCvnfcCustomizationUUID() {
+ return cvnfcCustomizationUUID;
+ }
+ public void setCvnfcCustomizationUUID(String cvnfcCustomizationUUID) {
+ this.cvnfcCustomizationUUID = cvnfcCustomizationUUID;
+ }
+
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java
index 0d04b5e7a1..be73b37f85 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java
@@ -39,6 +39,7 @@ public class ExecuteBuildingBlock implements Serializable{
private Boolean homing;
private WorkflowResourceIds workflowResourceIds;
private RequestDetails requestDetails;
+ private ConfigurationResourceKeys configurationResourceKeys;
public BuildingBlock getBuildingBlock() {
return buildingBlock;
@@ -100,4 +101,10 @@ public class ExecuteBuildingBlock implements Serializable{
public void setRequestDetails(RequestDetails requestDetails) {
this.requestDetails = requestDetails;
}
+ public ConfigurationResourceKeys getConfigurationResourceKeys() {
+ return configurationResourceKeys;
+ }
+ public void setConfigurationResourceKeys(ConfigurationResourceKeys configurationResourceKeys) {
+ this.configurationResourceKeys = configurationResourceKeys;
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java
index 9d3aa5934b..87168107e1 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java
@@ -34,6 +34,8 @@ public class ModelInfoConfiguration implements Serializable{
private String modelVersionId;
@JsonProperty("model-customization-id")
private String modelCustomizationId;
+ @JsonProperty("policy-name")
+ private String policyName;
public String getModelInvariantId() {
return modelInvariantId;
@@ -53,4 +55,10 @@ public class ModelInfoConfiguration implements Serializable{
public void setModelCustomizationId(String modelCustomizationId) {
this.modelCustomizationId = modelCustomizationId;
}
+ public String getPolicyName() {
+ return policyName;
+ }
+ public void setPolicyName(String policyName) {
+ this.policyName = policyName;
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
index e8e1982911..8e36cc5f8c 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
@@ -49,6 +49,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
@@ -71,6 +72,7 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.logger.MsoLogger;
@@ -267,32 +269,24 @@ public class BBInputSetup implements JavaDelegate {
}
protected void populateConfiguration(ModelInfo modelInfo, Service service, String bbName,
- ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, String instanceName) {
- boolean foundByName = false;
- boolean foundById = false;
- for (Configuration configuration : serviceInstance.getConfigurations()) {
+ ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, String instanceName, ConfigurationResourceKeys configurationResourceKeys) {
+ Configuration configuration = null;
+ for (Configuration configurationTemp : serviceInstance.getConfigurations()) {
if (lookupKeyMap.get(ResourceKey.CONFIGURATION_ID) != null
- && configuration.getConfigurationId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID))) {
- foundById = true;
+ && configurationTemp.getConfigurationId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID))) {
+ configuration = configurationTemp;
org.onap.aai.domain.yang.Configuration aaiConfiguration = bbInputSetupUtils.getAAIConfiguration(configuration.getConfigurationId());
if(aaiConfiguration!=null){
modelInfo.setModelCustomizationUuid(aaiConfiguration.getModelCustomizationId());
}
- this.mapCatalogConfiguration(configuration, modelInfo, service);
- } else if (instanceName != null && configuration.getConfigurationName().equalsIgnoreCase(instanceName)) {
- foundByName = true;
- lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, configuration.getConfigurationId());
- org.onap.aai.domain.yang.Configuration aaiConfiguration = bbInputSetupUtils.getAAIConfiguration(configuration.getConfigurationId());
- if(aaiConfiguration!=null){
- modelInfo.setModelCustomizationUuid(aaiConfiguration.getModelCustomizationId());
- }
- this.mapCatalogConfiguration(configuration, modelInfo, service);
}
}
- if (!foundByName && !foundById && bbName.equalsIgnoreCase(AssignFlows.FABRIC_CONFIGURATION.toString())) {
- Configuration configuration = this.createConfiguration(lookupKeyMap, instanceName, resourceId);
+ if (configuration == null && bbName.equalsIgnoreCase(AssignFlows.FABRIC_CONFIGURATION.toString())) {
+ configuration = this.createConfiguration(lookupKeyMap, instanceName, resourceId);
serviceInstance.getConfigurations().add(configuration);
- this.mapCatalogConfiguration(configuration, modelInfo, service);
+ }
+ if(configuration != null) {
+ this.mapCatalogConfiguration(configuration, modelInfo, service, configurationResourceKeys);
}
}
@@ -306,11 +300,28 @@ public class BBInputSetup implements JavaDelegate {
return configuration;
}
- protected void mapCatalogConfiguration(Configuration configuration, ModelInfo modelInfo, Service service) {
+ protected void mapCatalogConfiguration(Configuration configuration, ModelInfo modelInfo, Service service, ConfigurationResourceKeys configurationResourceKeys) {
ConfigurationResourceCustomization configurationResourceCustomization = findConfigurationResourceCustomization(modelInfo, service);
- if (configurationResourceCustomization != null) {
- configuration.setModelInfoConfiguration(this.mapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization));
+ VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization =
+ findVnfVfmoduleCvnfcConfigurationCustomization(configurationResourceKeys.getVfModuleCustomizationUUID(),
+ configurationResourceKeys.getVnfResourceCustomizationUUID(), configurationResourceKeys.getCvnfcCustomizationUUID(), configurationResourceCustomization);
+ if (configurationResourceCustomization != null && vnfVfmoduleCvnfcConfigurationCustomization != null) {
+ configuration.setModelInfoConfiguration(this.mapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization
+ , vnfVfmoduleCvnfcConfigurationCustomization));
+ }
+ }
+
+ protected VnfVfmoduleCvnfcConfigurationCustomization findVnfVfmoduleCvnfcConfigurationCustomization(String vfModuleCustomizationUUID,
+ String vnfResourceCustomizationUUID, String cvnfcCustomizationUUID, ConfigurationResourceCustomization configurationResourceCustomization) {
+ for(VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization :
+ configurationResourceCustomization.getConfigurationResource().getVnfVfmoduleCvnfcConfigurationCustomization()) {
+ if(vnfVfmoduleCvnfcConfigurationCustomization.getVfModuleCustomization().getModelCustomizationUUID().equalsIgnoreCase(vfModuleCustomizationUUID)
+ && vnfVfmoduleCvnfcConfigurationCustomization.getVnfResourceCustomization().getModelCustomizationUUID().equalsIgnoreCase(vnfResourceCustomizationUUID)
+ && vnfVfmoduleCvnfcConfigurationCustomization.getCvnfcCustomization().getModelCustomizationUUID().equalsIgnoreCase(cvnfcCustomizationUUID)) {
+ return vnfVfmoduleCvnfcConfigurationCustomization;
+ }
}
+ return null;
}
protected ConfigurationResourceCustomization findConfigurationResourceCustomization(ModelInfo modelInfo, Service service) {
@@ -896,12 +907,7 @@ public class BBInputSetup implements JavaDelegate {
String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID);
ModelInfo configurationModelInfo = new ModelInfo();
configurationModelInfo.setModelCustomizationUuid(key);
- ConfigurationResourceCustomization configurationCust = findConfigurationResourceCustomization(configurationModelInfo, service);
- if(configurationCust != null) {
- this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, configurationId, null);
- } else {
- msoLogger.debug("Could not find a configuration customization with key: " + key);
- }
+ this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, configurationId, null, executeBB.getConfigurationResourceKeys());
}
if (executeBB.getWorkflowResourceIds() != null) {
this.populateNetworkCollectionAndInstanceGroupAssign(service, bbName, serviceInstance,
@@ -1019,7 +1025,7 @@ public class BBInputSetup implements JavaDelegate {
.getModelCustomizationId();
ModelInfo modelInfo = new ModelInfo();
modelInfo.setModelCustomizationUuid(configurationCustUUID);
- this.mapCatalogConfiguration(configuration, modelInfo, service);
+ this.mapCatalogConfiguration(configuration, modelInfo, service, executeBB.getConfigurationResourceKeys());
break;
}
}
@@ -1087,7 +1093,7 @@ public class BBInputSetup implements JavaDelegate {
configurationModelInfo.setModelCustomizationUuid(key);
ConfigurationResourceCustomization configurationCust = findConfigurationResourceCustomization(configurationModelInfo, service);
if(configurationCust != null) {
- this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, configurationId, null);
+ this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, configurationId, null, executeBB.getConfigurationResourceKeys());
} else {
msoLogger.debug("Could not find a configuration customization with key: " + key);
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
index c2161a4fee..877d5bb88f 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
@@ -76,6 +76,7 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.RequestDetails;
@@ -454,11 +455,13 @@ public class BBInputSetupMapperLayer {
}
protected ModelInfoConfiguration mapCatalogConfigurationToConfiguration(
- ConfigurationResourceCustomization configurationResourceCustomization) {
+ ConfigurationResourceCustomization configurationResourceCustomization,
+ VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization) {
ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration();
modelInfoConfiguration.setModelVersionId(configurationResourceCustomization.getConfigurationResource().getModelUUID());
modelInfoConfiguration.setModelCustomizationId(configurationResourceCustomization.getModelCustomizationUUID());
modelInfoConfiguration.setModelInvariantId(configurationResourceCustomization.getConfigurationResource().getModelInvariantUUID());
+ modelInfoConfiguration.setPolicyName(vnfVfmoduleCvnfcConfigurationCustomization.getPolicyName());
return modelInfoConfiguration;
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
index 4b85538428..84ecfc7576 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
@@ -45,7 +45,7 @@ import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.client.db.request.RequestsDbClient;
+
import org.onap.so.client.graphinventory.entities.uri.Depth;
import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
@@ -54,6 +54,7 @@ import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.RequestDetails;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/db/request/RequestsDbClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/db/request/RequestsDbClient.java
deleted file mode 100644
index 61869ca322..0000000000
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/db/request/RequestsDbClient.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.db.request;
-
-import java.io.IOException;
-import java.net.URI;
-
-import org.onap.so.db.request.beans.InfraActiveRequests;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.HttpRequest;
-import org.springframework.http.client.ClientHttpRequestExecution;
-import org.springframework.http.client.ClientHttpRequestInterceptor;
-import org.springframework.http.client.ClientHttpResponse;
-import org.springframework.stereotype.Component;
-import org.springframework.web.client.RestTemplate;
-
-import uk.co.blackpepper.bowman.Client;
-import uk.co.blackpepper.bowman.ClientFactory;
-import uk.co.blackpepper.bowman.Configuration;
-import uk.co.blackpepper.bowman.RestTemplateConfigurer;
-
-@Component("RequestDbClient")
-public class RequestsDbClient {
-
- private Client<InfraActiveRequests> infraActiveRequestClient;
-
- @Value("${mso.adapters.db.spring.endpoint}")
- private String endpoint;
-
- @Value("${mso.db.auth}")
- private String msoAdaptersAuth;
-
- public RequestsDbClient() {
- ClientFactory clientFactory = Configuration.builder().setRestTemplateConfigurer(new RestTemplateConfigurer() {
-
- public void configure(RestTemplate restTemplate) {
-
- restTemplate.getInterceptors().add(new ClientHttpRequestInterceptor() {
-
- public ClientHttpResponse intercept(HttpRequest request, byte[] body,
- ClientHttpRequestExecution execution) throws IOException {
-
- request.getHeaders().add("Authorization", msoAdaptersAuth);
- return execution.execute(request, body);
- }
- });
- }
- }).build().buildClientFactory();
- infraActiveRequestClient = clientFactory.create(InfraActiveRequests.class);
-
- }
-
- public InfraActiveRequests getInfraActiveRequestbyRequestId(String requestId) {
- return this.getSingleInfraActiveRequests(this.getUri(endpoint + "/infraActiveRequests/" + requestId));
- }
-
- protected InfraActiveRequests getSingleInfraActiveRequests(URI uri) {
- return infraActiveRequestClient.get(uri);
- }
-
- public void updateInfraActiveRequests(InfraActiveRequests request) {
- infraActiveRequestClient.put(request);
- }
-
- protected URI getUri(String uri) {
- return URI.create(uri);
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java
index 768bee578c..64283d78ca 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.openecomp.mso.bpmn.common.workflow.service;
import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java
index d2f1186ad0..119d3b1e2d 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java
@@ -32,6 +32,7 @@ import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.model.bpmn.Bpmn;
import org.camunda.bpm.model.bpmn.BpmnModelInstance;
import org.junit.Before;
+import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.common.MockLoggerDelegate;
@@ -40,6 +41,7 @@ import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupMapperLayer;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.test.categories.SpringAware;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.embedded.LocalServerPort;
@@ -62,6 +64,7 @@ import com.github.tomakehurst.wiremock.client.WireMock;
@ActiveProfiles("test")
@ContextConfiguration
@AutoConfigureWireMock(port = 0)
+@Category(SpringAware.class)
public abstract class BaseTest extends BuildingBlockTestDataSetup {
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
index a983193ca3..5be879560f 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
@@ -665,4 +665,27 @@ public class BuildingBlockTestDataSetup{
return ar;
}
+
+ public Configuration setConfiguration () {
+ Configuration config = new Configuration();
+ config.setConfigurationId("testConfigurationId");
+ ModelInfoConfiguration modelInfoConfig = new ModelInfoConfiguration();
+ modelInfoConfig.setModelCustomizationId("modelCustomizationId");
+ modelInfoConfig.setModelVersionId("modelVersionId");
+ modelInfoConfig.setModelInvariantId("modelInvariantId");
+ modelInfoConfig.setPolicyName("policyName");
+ config.setModelInfoConfiguration(modelInfoConfig);
+
+ List<Configuration> configurations = new ArrayList<>();
+ configurations.add(config);
+ ServiceInstance serviceInstance = new ServiceInstance();
+ try {
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ } catch(BBObjectNotFoundException e) {
+ serviceInstance = setServiceInstance();
+ }
+ lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "testConfigurationId");
+ serviceInstance.setConfigurations(configurations);
+ return config;
+ }
} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/NonSpringSuite.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/NonSpringSuite.java
new file mode 100644
index 0000000000..ee2848cf3a
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/NonSpringSuite.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so;
+
+import org.junit.runner.RunWith;
+import org.onap.so.test.categories.SpringAware;
+
+import com.googlecode.junittoolbox.ExcludeCategories;
+import com.googlecode.junittoolbox.SuiteClasses;
+import com.googlecode.junittoolbox.WildcardPatternSuite;
+
+@RunWith(WildcardPatternSuite.class)
+@ExcludeCategories({SpringAware.class})
+@SuiteClasses({"**/*Test.class", "!**/bpmn/common/scripts/**/*Test.class"})
+public class NonSpringSuite {
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplication.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplication.java
index ba8caee058..d1559c2ed1 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplication.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplication.java
@@ -22,8 +22,6 @@ package org.onap.so;
import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication;
import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator;
-import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl;
-import org.onap.so.requestsdb.RequestsDBHelper;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
@@ -35,9 +33,7 @@ import org.springframework.context.annotation.Profile;
@Profile("test")
@EnableProcessApplication("MSO CommonBPMN Test Application")
@ComponentScan(basePackages = {"org.onap.so"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = {
- @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class),
- @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class),
- @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) })
+ @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)})
public class TestApplication {
public static void main(String... args) {
SpringApplication.run(TestApplication.class, args);
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java
index 514d93bdf8..45bbe9e5d8 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java
@@ -29,9 +29,7 @@ import org.camunda.bpm.application.ProcessApplicationInfo;
import org.camunda.bpm.engine.ProcessEngine;
import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication;
import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator;
-import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl;
import org.onap.so.logger.MsoLogger;
-import org.onap.so.requestsdb.RequestsDBHelper;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -51,9 +49,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
@EnableProcessApplication("MSO Common Application")
@EnableAsync
@ComponentScan(basePackages = { "org.onap" }, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = {
- @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class),
- @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class),
- @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) })
+ @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)})
public class MSOCommonApplication {
private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java
new file mode 100644
index 0000000000..f84a76468f
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.baseclient;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertThat;
+
+import java.util.Map;
+
+import javax.ws.rs.core.UriBuilder;
+
+import org.junit.Test;
+import org.onap.so.BaseTest;
+import org.springframework.core.ParameterizedTypeReference;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+
+import wiremock.org.apache.http.entity.ContentType;
+
+
+public class BaseClientTest extends BaseTest {
+
+ @Test
+ public void verifyString() {
+ BaseClient<String, String> client = new BaseClient<>();
+ String response = "{\"hello\" : \"world\"}";
+ client.setTargetUrl(UriBuilder.fromUri("http://localhost/test").port(Integer.parseInt(wireMockPort)).build().toString());
+ stubFor(get(urlEqualTo("/test"))
+ .willReturn(aResponse().withStatus(200).withBody(response).withHeader("Content-Type", ContentType.APPLICATION_JSON.toString())));
+
+ String result = client.get("", new ParameterizedTypeReference<String>() {});
+ assertThat(result, equalTo(response));
+ }
+
+ @Test
+ public void verifyMap() {
+ BaseClient<String, Map<String, Object>> client = new BaseClient<>();
+ String response = "{\"hello\" : \"world\"}";
+ client.setTargetUrl(UriBuilder.fromUri("http://localhost/test").port(Integer.parseInt(wireMockPort)).build().toString());
+ stubFor(get(urlEqualTo("/test"))
+ .willReturn(aResponse().withStatus(200).withBody(response).withHeader("Content-Type", ContentType.APPLICATION_JSON.toString())));
+
+ Map<String, Object> result = client.get("", new ParameterizedTypeReference<Map<String, Object>>() {});
+ assertThat("world", equalTo(result.get("hello")));
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java
index c18dcf5cfa..33e1390b9c 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java
@@ -65,12 +65,15 @@ import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
import org.onap.so.db.catalog.beans.ConfigurationResource;
import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
+import org.onap.so.db.catalog.beans.CvnfcCustomization;
import org.onap.so.db.catalog.beans.InstanceGroup;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
+import org.onap.so.db.catalog.beans.VnfcCustomization;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.RequestDetails;
@@ -613,17 +616,23 @@ public class BBInputSetupMapperLayerTest {
String modelCustUUID = "modelCustomizationUUID";
String modelInvariantUUID = "modelInvariantUUID";
String modelVersionUUID = "modelUUID";
+ String policyName = "policyName";
ModelInfoConfiguration expected = new ModelInfoConfiguration();
expected.setModelCustomizationId(modelCustUUID);
expected.setModelInvariantId(modelInvariantUUID);
expected.setModelVersionId(modelVersionUUID);
+ expected.setPolicyName(policyName);
ConfigurationResourceCustomization configurationResourceCustomization = new ConfigurationResourceCustomization();
configurationResourceCustomization.setModelCustomizationUUID(modelCustUUID);
configurationResourceCustomization.setConfigurationResource(new ConfigurationResource());
configurationResourceCustomization.getConfigurationResource().setModelInvariantUUID(modelInvariantUUID);
configurationResourceCustomization.getConfigurationResource().setModelUUID(modelVersionUUID);
+ VnfVfmoduleCvnfcConfigurationCustomization policyNameTable = new VnfVfmoduleCvnfcConfigurationCustomization();
+ policyNameTable.setCvnfcCustomization(new CvnfcCustomization());
+ policyNameTable.getCvnfcCustomization().setVnfcCustomization(new VnfcCustomization());
+ policyNameTable.setPolicyName(policyName);
- ModelInfoConfiguration actual = bbInputSetupMapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization );
+ ModelInfoConfiguration actual = bbInputSetupMapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization, policyNameTable);
assertThat(actual, sameBeanAs(expected));
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
index 489163b23a..a5795f923c 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
@@ -66,6 +66,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
@@ -1074,28 +1075,32 @@ public class BBInputSetupTest {
Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId");
String bbName = AssignFlows.FABRIC_CONFIGURATION.toString();
+ ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys();
+ configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID");
+ configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID");
+ configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID");
- doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration, modelInfo, service);
+ doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration, modelInfo, service, configResourceKeys);
SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
- instanceName);
- verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service);
+ instanceName, configResourceKeys);
+ verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service, configResourceKeys);
lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, null);
SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
- instanceName);
- verify(SPY_bbInputSetup, times(2)).mapCatalogConfiguration(configuration, modelInfo, service);
+ instanceName, configResourceKeys);
+ verify(SPY_bbInputSetup, times(2)).mapCatalogConfiguration(configuration, modelInfo, service, configResourceKeys);
instanceName = "configurationName2";
resourceId = "resourceId2";
lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId2");
Configuration configuration2 = SPY_bbInputSetup.createConfiguration(lookupKeyMap, instanceName, resourceId);
doReturn(configuration2).when(SPY_bbInputSetup).createConfiguration(lookupKeyMap, instanceName, resourceId);
- doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration2, modelInfo, service);
+ doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration2, modelInfo, service, configResourceKeys);
SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
- instanceName);
- verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration2, modelInfo, service);
+ instanceName, configResourceKeys);
+ verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration2, modelInfo, service, configResourceKeys);
}
@Test
@@ -1666,6 +1671,12 @@ public class BBInputSetupTest {
String vnfType = "vnfType";
Service service = Mockito.mock(Service.class);
String requestAction = "createInstance";
+
+ ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys();
+ configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID");
+ configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID");
+ configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID");
+ executeBB.setConfigurationResourceKeys(configResourceKeys);
doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap,
requestAction, resourceId);
doReturn(request).when(SPY_bbInputSetupUtils).getInfraActiveRequest(executeBB.getRequestId());
@@ -1714,13 +1725,13 @@ public class BBInputSetupTest {
doReturn(configurationCustList).when(service).getConfigurationCustomizations();
configurationCustList.add(configurationCust);
doNothing().when(SPY_bbInputSetup).populateConfiguration(isA(ModelInfo.class), isA(Service.class),
- any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(String.class));
+ any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(String.class), isA(ConfigurationResourceKeys.class));
executeBB.getBuildingBlock().setBpmnFlowName("AssignFabricConfigurationBB");
executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
verify(SPY_bbInputSetup, times(1)).populateConfiguration(isA(ModelInfo.class), isA(Service.class),
- any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(String.class));
+ any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(String.class), isA(ConfigurationResourceKeys.class));
}
@Test
@@ -1998,6 +2009,13 @@ public class BBInputSetupTest {
lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId");
lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "serviceInstanceId");
lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId");
+
+ ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys();
+ configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID");
+ configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID");
+ configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID");
+ executeBB.setConfigurationResourceKeys(configResourceKeys);
+
String resourceId = "123";
String vnfType = "vnfType";
Service service = Mockito.mock(Service.class);
@@ -2037,6 +2055,7 @@ public class BBInputSetupTest {
executeBB.getBuildingBlock().getBpmnFlowName(), "ab153b6e-c364-44c0-bef6-1f2982117f04", gBB, service);
executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.FABRIC_CONFIGURATION.toString());
executeBB.getBuildingBlock().setKey("modelCustId");
+ doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(isA(Configuration.class), isA(ModelInfo.class), isA(Service.class), isA(ConfigurationResourceKeys.class));
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
verify(SPY_bbInputSetup, times(1)).getGBBMacroNoUserParamsCreate(executeBB, lookupKeyMap,
executeBB.getBuildingBlock().getBpmnFlowName(), "modelCustId", gBB, service);
@@ -2167,6 +2186,12 @@ public class BBInputSetupTest {
cloudConfiguration.setLcpCloudRegionId("cloudRegionId");
String requestAction = "unassignInstance";
+ ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys();
+ configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID");
+ configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID");
+ configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID");
+ executeBB.setConfigurationResourceKeys(configResourceKeys);
+
L3Network network = new L3Network();
network.setNetworkId("networkId");
gBB.getServiceInstance().getNetworks().add(network);
@@ -2241,13 +2266,14 @@ public class BBInputSetupTest {
org.onap.aai.domain.yang.Configuration aaiConfiguration = new org.onap.aai.domain.yang.Configuration();
aaiConfiguration.setModelCustomizationId("modelCustId");
doReturn(aaiConfiguration).when(SPY_bbInputSetupUtils).getAAIConfiguration(configuration.getConfigurationId());
+ doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(isA(Configuration.class), isA(ModelInfo.class), isA(Service.class), isA(ConfigurationResourceKeys.class));
executeBB.getBuildingBlock().setBpmnFlowName("ActivateFabricConfigurationBB");
executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap,
executeBB.getBuildingBlock().getBpmnFlowName(), gBB, service, requestAction, cloudConfiguration);
verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(any(Configuration.class), any(ModelInfo.class),
- any(Service.class));
+ any(Service.class), isA(ConfigurationResourceKeys.class));
}
@Test
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
index aa883b67a2..eb74ab804e 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
@@ -64,12 +64,13 @@ import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.entities.uri.Depth;
-import org.onap.so.client.db.request.RequestsDbClient;
+
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.RequestDetails;
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
index 79cb33b7c4..2144f1c69a 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
@@ -20,12 +20,18 @@
package org.onap.so.bpmn.servicedecomposition.tasks;
+import static org.hamcrest.CoreMatchers.any;
import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
import static org.mockito.Matchers.isA;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.junit.Before;
import org.junit.Test;
import org.onap.so.bpmn.core.WorkflowException;
@@ -76,8 +82,9 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
@Test
public void setRetryTimerExceptionTest() {
expectedException.expect(BpmnError.class);
-
- executeBuildingBlockRainyDay.setRetryTimer(null);
+ DelegateExecution execution = mock(DelegateExecution.class);
+ when(execution.getVariable(eq("retryCount"))).thenThrow(Exception.class);
+ executeBuildingBlockRainyDay.setRetryTimer(execution);
}
@Test
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java
index 0992b59267..47e05831ad 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java
@@ -34,7 +34,7 @@ public class GlobalDmaapPublisherTest extends BaseTest{
@Test
public void testGetters() {
assertEquals("dmaapUsername", globalDmaapPublisher.getUserName());
- assertEquals("dmaapPassword", globalDmaapPublisher.getPassword());
+ assertEquals("ZG1hYXBQYXNzd29yZA==", globalDmaapPublisher.getPassword());
assertEquals("com.att.mso.asyncStatusUpdate", globalDmaapPublisher.getTopic());
assertEquals("http://localhost:" + wireMockPort, globalDmaapPublisher.getHost().get());
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/test/categories/SpringAware.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/test/categories/SpringAware.java
new file mode 100644
index 0000000000..21035fcd4d
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/test/categories/SpringAware.java
@@ -0,0 +1,25 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.test.categories;
+
+public interface SpringAware {
+ /* category marker */
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml
index f039441738..236d435cb7 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml
+++ b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml
@@ -162,7 +162,7 @@ mso:
global:
dmaap:
username: dmaapUsername
- password: dmaapPassword
+ password: ZG1hYXBQYXNzd29yZA==
host: http://localhost:${wiremock.server.port}
publisher:
topic: com.att.mso.asyncStatusUpdate
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml b/bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml
index d8f6ba3930..9088d1a844 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml
+++ b/bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml
@@ -25,6 +25,6 @@
<appender-ref ref="STDOUT" />
</root>
- <logger name="wiremock.org" level="DEBUG" />
+ <logger name="wiremock.org" level="ERROR" />
</configuration> \ No newline at end of file