aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2018-05-24 17:49:57 +0000
committerGerrit Code Review <gerrit@onap.org>2018-05-24 17:49:57 +0000
commit903d435483d30ec75aa46e68b63bdc513d56f695 (patch)
tree07536cb81b27ef9bb3960374aefd727e4e3bac7b /bpmn/MSOCommonBPMN
parent155f10aee25fc1f89929e13a4a62a8335ee33279 (diff)
parent9cbec08a54c14fa3ce991163b6203906e465c7e5 (diff)
Merge "Fix serviceInstanceName in Homing"
Diffstat (limited to 'bpmn/MSOCommonBPMN')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofUtils.groovy20
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/OofHomingTest.java15
2 files changed, 22 insertions, 13 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofUtils.groovy
index 79134fe757..f07a477bb3 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofUtils.groovy
@@ -60,13 +60,19 @@ class OofUtils {
ServiceInstance serviceInstance = decomposition.getServiceInstance()
def serviceInstanceId = ""
def serviceInstanceName = ""
- if (serviceInstance == null) {
- utils.log("DEBUG", "Unable to obtain Service Instance Id, ServiceInstance Object is null", isDebugEnabled)
+
+ serviceInstanceId = execution.getVariable("serviceInstanceId")
+ serviceInstanceName = execution.getVariable("serviceInstanceName")
+
+ if (serviceInstanceId == null || serviceInstanceId == "null") {
+ utils.log("DEBUG", "Unable to obtain Service Instance Id", isDebugEnabled)
exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to " +
- "obtain Service Instance Id, ServiceInstance Object is null")
- } else {
- serviceInstanceId = serviceInstance.getInstanceId()
- serviceInstanceName = serviceInstance.getInstanceName()
+ "obtain Service Instance Id, execution.getVariable(\"serviceInstanceName\") is null")
+ }
+ if (serviceInstanceName == null || serviceInstanceName == "null") {
+ utils.log("DEBUG", "Unable to obtain Service Instance Name", isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to " +
+ "obtain Service Instance Name, execution.getVariable(\"serviceInstanceName\") is null")
}
//Model Info
ModelInfo model = decomposition.getModelInfo()
@@ -115,7 +121,7 @@ class OofUtils {
def resouceModelVersion = resourceModelInfo.getModelVersion()
def resouceModelVersionId = resourceModelInfo.getModelUuid()
def resouceModelType = resourceModelInfo.getModelType()
- def tenantId = execution.getTenantId()
+ def tenantId = "" //Optional
def requiredCandidatesJson = ""
requiredCandidatesJson = createCandidateJson(
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/OofHomingTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/OofHomingTest.java
index 9020701ed3..283f3c6116 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/OofHomingTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/OofHomingTest.java
@@ -549,7 +549,8 @@ public class OofHomingTest extends WorkflowTest {
variables.put("isDebugLogEnabled", "true");
// variables.put("mso-request-id", "testRequestId");
variables.put("msoRequestId", "testRequestId");
- variables.put("serviceInstanceId", "testServiceInstanceId");
+ variables.put("serviceInstanceId", "testServiceInstanceId123");
+ variables.put("serviceInstanceName", "testServiceName");
variables.put("serviceDecomposition", serviceDecomposition);
variables.put("subscriberInfo", subscriber2);
}
@@ -590,7 +591,8 @@ public class OofHomingTest extends WorkflowTest {
variables.put("cloudRegionId", "TNZED");
variables.put("isDebugLogEnabled", "true");
variables.put("msoRequestId", "testRequestId");
- variables.put("serviceInstanceId", "testServiceInstanceId");
+ variables.put("serviceInstanceId", "testServiceInstanceId123");
+ variables.put("serviceInstanceName", "testServiceName");
variables.put("serviceDecomposition", serviceDecomposition);
variables.put("subscriberInfo", subscriber2);
}
@@ -610,7 +612,8 @@ public class OofHomingTest extends WorkflowTest {
variables.put("isDebugLogEnabled", "true");
// variables.put("mso-request-id", "testRequestId");
variables.put("msoRequestId", "testRequestId");
- variables.put("serviceInstanceId", "testServiceInstanceId");
+ variables.put("serviceInstanceId", "testServiceInstanceId123");
+ variables.put("serviceInstanceName", "testServiceName");
variables.put("serviceDecomposition", null);
variables.put("subscriberInfo", subscriber2);
}
@@ -719,16 +722,16 @@ public class OofHomingTest extends WorkflowTest {
"{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\"," +
"\"subscriberCommonSiteId\":\"\"},\"placementDemands\":[{\"resourceModuleName\":\"ALLOTTED_RESOURCE\"" +
",\"serviceResourceId\":\"testResourceIdAR\",\"tenantId\":" +
- "\"null\",\"resourceModelInfo\":{\"modelInvariantId\":\"testModelInvariantIdAR\"," +
+ "\"\",\"resourceModelInfo\":{\"modelInvariantId\":\"testModelInvariantIdAR\"," +
"\"modelVersionId\":\"testARModelUuid\",\"modelName\":\"testModelNameAR\",\"modelType\":" +
"\"testModelTypeAR\",\"modelVersion\":\"testModelVersionAR\",\"modelCustomizationName\":\"\"}}," +
"{\"resourceModuleName\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\"," +
- "\"tenantId\":\"null\",\"resourceModelInfo\":{\"modelInvariantId\":\"testModelInvariantIdAR2\"," +
+ "\"tenantId\":\"\",\"resourceModelInfo\":{\"modelInvariantId\":\"testModelInvariantIdAR2\"," +
"\"modelVersionId\":\"testAr2ModelUuid\",\"modelName\":\"testModelNameAR2\"," +
"\"modelType\":\"testModelTypeAR2\",\"modelVersion\":\"testModelVersionAR2\"," +
"\"modelCustomizationName\":\"\"}}]},\"serviceInfo\":" +
"{\"serviceInstanceId\":\"testServiceInstanceId123\"," +
- "\"serviceName\":\"null\",\"modelInfo\":{\"modelType\":\"\",\"modelInvariantId\":" +
+ "\"serviceName\":\"testServiceName\",\"modelInfo\":{\"modelType\":\"\",\"modelInvariantId\":" +
"\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\"," +
"\"modelVersion\":\"testModelVersion\",\"modelCustomizationName\":\"" +
"\"}}}";