From ef4f0b94f8087f38a7511f6a45dbdfa1878b5739 Mon Sep 17 00:00:00 2001 From: subhash kumar singh Date: Thu, 15 Nov 2018 21:15:06 +0530 Subject: Fix invocation of resource receipe Fix invocation of resource receipe. Change-Id: I4ab14fa4924d7480b167138091de33f657286dde Issue-ID: SO-689 Signed-off-by: subhash kumar singh (cherry picked from commit 9600bc37864e33e503001a4740fd5628a1069678) --- .../onap/so/bpmn/common/resource/ResourceRequestBuilder.java | 2 +- .../so/bpmn/infrastructure/scripts/DoCreateResources.groovy | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) 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 0cce8b3f94..1989ca8cf9 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 @@ -266,7 +266,7 @@ public class ResourceRequestBuilder { HashMap map = new Gson().fromJson(value, new TypeToken>() {}.getType()); - String filePath = System.getProperty("mso.config.path") + "ASDC/" + map.get("version") + "/" + map.get("name"); + String filePath = System.getProperty("mso.config.path") + "/ASDC/" + map.get("version") + "/" + map.get("name"); File csarFile = new File(filePath); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy index 2167025e18..7707903391 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy @@ -242,7 +242,8 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ String resourceParameters = ResourceRequestBuilder.buildResourceRequestParameters(execution, serviceModelUuid, resourceCustomizationUuid, serviceParameters) resourceInput.setResourceParameters(resourceParameters) resourceInput.setRequestsInputs(incomingRequest) - execution.setVariable("resourceInput", resourceInput) + execution.setVariable("resourceInput", resourceInput.toString()) + execution.setVariable("resourceModelUUID", resourceInput.getResourceModelInfo().getModelUuid()) msoLogger.trace("COMPLETED prepareResourceRecipeRequest Process ") } @@ -253,18 +254,21 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ String requestId = execution.getVariable("msoRequestId") String serviceInstanceId = execution.getVariable("serviceInstanceId") String serviceType = execution.getVariable("serviceType") - ResourceInput resourceInput = execution.getVariable("resourceInput") + String resourceInput = execution.getVariable("resourceInput") + String resourceModelUUID = execution.getVariable("resourceModelUUID") // requestAction is action, not opertiontype //String requestAction = resourceInput.getOperationType() String requestAction = "createInstance" - JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceInput.getResourceModelInfo().getModelUuid(), requestAction) + JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceModelUUID, requestAction) 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) + + BpmnRestClient bpmnRestClient = new BpmnRestClient() + HttpResponse resp = bpmnRestClient.post(recipeURL, requestId, recipeTimeOut, requestAction, serviceInstanceId, serviceType, resourceInput, recipeParamXsd) } else { String exceptionMessage = "Resource receipe is not found for resource modeluuid: " + resourceInput.getResourceModelInfo().getModelUuid() -- cgit 1.2.3-korg