diff options
author | Smokowski, Steven <steve.smokowski@att.com> | 2019-09-24 14:57:51 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2019-09-24 17:24:25 -0400 |
commit | 4891eedd15cff1e582d052843eb8c11a14c5d836 (patch) | |
tree | 5f014cdd42f99eef78bd7cd4d3eae80be8d32a02 /mso-api-handlers/mso-api-handler-common | |
parent | 96231b3365d378a86b71d93b8a7d64aef8be531c (diff) |
Update Resume Logic and Add Workflow Listeners
Updated with the error log messages
Changed the code to do string compare for eventName
update workflowaction to only persist if not resume
Issue-ID: SO-2363
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: I139f2427ae0f0253a15cc51003318686568cb514
Diffstat (limited to 'mso-api-handlers/mso-api-handler-common')
6 files changed, 138 insertions, 7 deletions
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java index 3880bd43b1..0f51341a61 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java @@ -116,6 +116,9 @@ public class CamundaVIDRequest { return serviceInput; } + @JsonProperty(CommonConstants.GENERATE_IDS) + private CamundaBooleanInput generateIds; + @JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT) public void setServiceInput(CamundaInput serviceInput) { this.serviceInput = serviceInput; @@ -347,6 +350,12 @@ public class CamundaVIDRequest { return "CamundaRequest"; } + public CamundaBooleanInput getGenerateIds() { + return generateIds; + } + public void setGenerateIds(CamundaBooleanInput generateIds) { + this.generateIds = generateIds; + } } diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java index 5dd99f51cd..bc8af6e690 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java @@ -99,6 +99,7 @@ public class CamundaClient extends RequestClient { return response; } + @Override public HttpResponse post(RequestClientParameter parameterObject) throws IOException { HttpPost post = new HttpPost(url); logger.debug(CAMUNDA_URL_MESAGE + url); @@ -110,7 +111,7 @@ public class CamundaClient extends RequestClient { parameterObject.getVnfType(), parameterObject.getVfModuleType(), parameterObject.getNetworkType(), parameterObject.getRequestDetails(), parameterObject.getApiVersion(), parameterObject.isaLaCarte(), parameterObject.getRequestUri(), parameterObject.getRecipeParamXsd(), - parameterObject.getInstanceGroupId()); + parameterObject.getInstanceGroupId(), parameterObject.isGenerateIdsOnly()); StringEntity input = new StringEntity(jsonReq); input.setContentType(CommonConstants.CONTENT_TYPE_JSON); @@ -169,7 +170,7 @@ public class CamundaClient extends RequestClient { String serviceInstanceId, String pnfCorrelationId, String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId, String serviceType, String vnfType, String vfModuleType, String networkType, String requestDetails, String apiVersion, boolean aLaCarte, String requestUri, - String paramXsd, String instanceGroupId) { + String paramXsd, String instanceGroupId, boolean generateIdsOnly) { String jsonReq = null; try { @@ -196,6 +197,8 @@ public class CamundaClient extends RequestClient { CamundaInput requestUriInput = new CamundaInput(); CamundaInput recipeParamsInput = new CamundaInput(); CamundaInput instanceGroupIdInput = new CamundaInput(); + CamundaBooleanInput generateIds = new CamundaBooleanInput(); + requestIdInput.setValue(StringUtils.defaultString(requestId)); isBaseVfModuleInput.setValue(isBaseVfModule); @@ -217,6 +220,7 @@ public class CamundaClient extends RequestClient { requestUriInput.setValue(StringUtils.defaultString(requestUri)); recipeParamsInput.setValue(paramXsd); instanceGroupIdInput.setValue(StringUtils.defaultString(instanceGroupId)); + generateIds.setValue(generateIdsOnly); serviceInput.setValue(requestDetails); camundaRequest.setServiceInput(serviceInput); @@ -242,6 +246,7 @@ public class CamundaClient extends RequestClient { camundaRequest.setRequestUri(requestUriInput); camundaRequest.setRecipeParams(recipeParamsInput); camundaRequest.setInstanceGroupId(instanceGroupIdInput); + camundaRequest.setGenerateIds(generateIds); ObjectMapper mapper = new ObjectMapper(); mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java index e48c98a395..6d2bbfc613 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java @@ -81,6 +81,7 @@ public final class CommonConstants { public static final String X_LATEST_VERSION = "X-LatestVersion"; public static final String INSTANCE_GROUP_ID = "instanceGroupId"; public static final String INSTANCE_GROUP_INSTANCE_ID = "instanceGroupInstanceId"; + public static final String GENERATE_IDS = "generateIdsOnly"; private CommonConstants() { // prevent creating an instance of this class diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java index 20c512af37..e098ea4354 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java @@ -44,6 +44,7 @@ public class RequestClientParameter { private String recipeParamXsd; private String requestUri; private String instanceGroupId; + private boolean generateIdsOnly; private RequestClientParameter(Builder builder) { requestId = builder.requestId; @@ -67,7 +68,7 @@ public class RequestClientParameter { aLaCarte = builder.aLaCarte; requestUri = builder.requestUri; instanceGroupId = builder.instanceGroupId; - + generateIdsOnly = builder.generateIdsOnly; } public String getRequestId() { @@ -154,6 +155,14 @@ public class RequestClientParameter { return instanceGroupId; } + public boolean isGenerateIdsOnly() { + return generateIdsOnly; + } + + public void setGenerateIdsOnly(boolean generateIdsOnly) { + this.generateIdsOnly = generateIdsOnly; + } + public static class Builder { private String requestId; private boolean isBaseVfModule = false; @@ -176,6 +185,7 @@ public class RequestClientParameter { private String recipeParamXsd; private String requestUri; private String instanceGroupId; + private boolean generateIdsOnly; public Builder setRequestId(String requestId) { this.requestId = requestId; @@ -282,6 +292,11 @@ public class RequestClientParameter { return this; } + public Builder setGenerateIds(boolean generateIdsOnly) { + this.generateIdsOnly = generateIdsOnly; + return this; + } + public RequestClientParameter build() { return new RequestClientParameter(this); } diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java index 36d004e87d..94c62a9689 100644 --- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java @@ -47,11 +47,11 @@ import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; +import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.mock.env.MockEnvironment; import com.fasterxml.jackson.core.JsonGenerationException; import com.fasterxml.jackson.databind.JsonMappingException; - /** * This class implements test methods of Camunda Beans. * @@ -164,10 +164,10 @@ public class CamundaClientTest { String testResult = testClient.wrapVIDRequest(requestId, isBaseVfModule, recipeTimeout, requestAction, serviceInstanceId, pnfCorrelationId, vnfId, vfModuleId, volumeGroupId, networkId, configurationId, serviceType, vnfType, vfModuleType, networkType, requestDetails, apiVersion, aLaCarte, requestUri, "", - instanceGroupId); + instanceGroupId, false); String expected = inputStream("/WrappedVIDRequest.json"); - assertEquals(expected, testResult); + JSONAssert.assertEquals(expected, testResult, false); } @Test diff --git a/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json b/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json index b9d0a8c3c6..3353f8c7ce 100644 --- a/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json +++ b/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json @@ -1 +1,102 @@ -{"variables":{"bpmnRequest":{"value":"{requestDetails: }","type":"String"},"requestId":{"value":"f7ce78bb-423b-11e7-93f8-0050569a796","type":"String"},"mso-request-id":{"value":"f7ce78bb-423b-11e7-93f8-0050569a796","type":"String"},"isBaseVfModule":{"value":true,"type":"Boolean"},"recipeTimeout":{"value":10000,"type":"Integer"},"requestAction":{"value":"createInstance","type":"String"},"serviceInstanceId":{"value":"12345679","type":"String"},"pnfCorrelationId":{"value":"12345679","type":"String"},"vnfId":{"value":"234567891","type":"String"},"vfModuleId":{"value":"345678912","type":"String"},"volumeGroupId":{"value":"456789123","type":"String"},"networkId":{"value":"567891234","type":"String"},"configurationId":{"value":"678912345","type":"String"},"serviceType":{"value":"testService","type":"String"},"vnfType":{"value":"testVnf","type":"String"},"vfModuleType":{"value":"vfModuleType","type":"String"},"networkType":{"value":"networkType","type":"String"},"recipeParams":{"value":"","type":"String"},"host":{"value":null,"type":"String"},"apiVersion":{"value":"6","type":"String"},"aLaCarte":{"value":true,"type":"Boolean"},"requestUri":{"value":"v7/serviceInstances/assign","type":"String"},"instanceGroupId":{"value":"ff305d54-75b4-431b-adb2-eb6b9e5ff000","type":"String"}}}
\ No newline at end of file +{ + "variables": { + "bpmnRequest": { + "value": "{requestDetails: }", + "type": "String" + }, + "requestId": { + "value": "f7ce78bb-423b-11e7-93f8-0050569a796", + "type": "String" + }, + "mso-request-id": { + "value": "f7ce78bb-423b-11e7-93f8-0050569a796", + "type": "String" + }, + "isBaseVfModule": { + "value": true, + "type": "Boolean" + }, + "recipeTimeout": { + "value": 10000, + "type": "Integer" + }, + "requestAction": { + "value": "createInstance", + "type": "String" + }, + "serviceInstanceId": { + "value": "12345679", + "type": "String" + }, + "pnfCorrelationId": { + "value": "12345679", + "type": "String" + }, + "vnfId": { + "value": "234567891", + "type": "String" + }, + "vfModuleId": { + "value": "345678912", + "type": "String" + }, + "volumeGroupId": { + "value": "456789123", + "type": "String" + }, + "networkId": { + "value": "567891234", + "type": "String" + }, + "configurationId": { + "value": "678912345", + "type": "String" + }, + "serviceType": { + "value": "testService", + "type": "String" + }, + "vnfType": { + "value": "testVnf", + "type": "String" + }, + "vfModuleType": { + "value": "vfModuleType", + "type": "String" + }, + "networkType": { + "value": "networkType", + "type": "String" + }, + "recipeParams": { + "value": "", + "type": "String" + }, + "host": { + "value": null, + "type": "String" + }, + "apiVersion": { + "value": "6", + "type": "String" + }, + "aLaCarte": { + "value": true, + "type": "Boolean" + }, + "requestUri": { + "value": "v7/serviceInstances/assign", + "type": "String" + }, + "instanceGroupId": { + "value": "ff305d54-75b4-431b-adb2-eb6b9e5ff000", + "type": "String" + }, + "generateIdsOnly": { + "value": false, + "type": "Boolean" + } + } +} + + |