summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsubhash kumar singh <subhash.kumar.singh@huawei.com>2018-05-31 16:52:11 +0800
committersubhash kumar singh <subhash.kumar.singh@huawei.com>2018-05-31 16:55:25 +0800
commitc8981f10b0332aa30a3d1861409b3e9e5296cabe (patch)
treea2639387ddbff0262eee77fde7e86f0f1ec6a3e1
parent97c02aa6319b112ba45b55f16d2de96b783eac2b (diff)
Throw exception if resource receipe is not avail
Throw exception if resource receipe is not available for the resource in service. Change-Id: Ic6110a1f03d9a0f22d963812eab99e571191140d Issue-ID: SO-422 Signed-off-by: subhash kumar singh <subhash.kumar.singh@huawei.com>
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy17
1 files changed, 13 insertions, 4 deletions
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy
index ae75d54afe..9cdbdfde1c 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy
@@ -245,10 +245,19 @@ public class DoCreateResources extends AbstractServiceTaskProcessor
//String requestAction = resourceInput.getOperationType()
String requestAction = "createInstance"
JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceInput.getResourceModelInfo().getModelUuid(), requestAction)
- String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + resourceRecipe.getString("orchestrationUri")
- int recipeTimeOut = resourceRecipe.getInt("recipeTimeout")
- String recipeParamXsd = resourceRecipe.get("paramXSD")
- HttpResponse resp = BpmnRestClient.post(recipeURL, requestId, recipeTimeOut, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd)
+
+ if (resourceRecipe != null) {
+ String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + resourceRecipe.getString("orchestrationUri")
+ int recipeTimeOut = resourceRecipe.getInt("recipeTimeout")
+ String recipeParamXsd = resourceRecipe.get("paramXSD")
+ HttpResponse resp = BpmnRestClient.post(recipeURL, requestId, recipeTimeOut, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd)
+ } else {
+ String exceptionMessage = "Resource receipe is not found for resource modeluuid: " +
+ resourceInput.getResourceModelInfo().getModelUuid()
+ utils.log("ERROR", exceptionMessage, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, exceptionMessage)
+ }
+
utils.log("INFO", "======== end executeResourceRecipe Process ======== ", isDebugEnabled)
}