diff options
Diffstat (limited to 'mso-api-handlers')
8 files changed, 67 insertions, 32 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 829f8ce30c..7e9eed32b1 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 @@ -35,7 +35,7 @@ import com.fasterxml.jackson.annotation.JsonRootName; CommonConstants.REQUEST_ID_HEADER, CommonConstants.IS_BASE_VF_MODULE_VARIABLE, CommonConstants.RECIPE_TIMEOUT_VARIABLE, CommonConstants.REQUEST_ACTION_VARIABLE, CommonConstants.SERVICE_INSTANCE_ID_VARIABLE, - CommonConstants.CORRELATION_ID, CommonConstants.VNF_ID_VARIABLE, CommonConstants.VF_MODULE_ID_VARIABLE, + CommonConstants.PNF_CORRELATION_ID, CommonConstants.VNF_ID_VARIABLE, CommonConstants.VF_MODULE_ID_VARIABLE, CommonConstants.VOLUME_GROUP_ID_VARIABLE, CommonConstants.NETWORK_ID_VARIABLE, CommonConstants.CONFIGURATION_ID_VARIABLE, CommonConstants.SERVICE_TYPE_VARIABLE, CommonConstants.VNF_TYPE_VARIABLE, CommonConstants.VF_MODULE_TYPE_VARIABLE, @@ -68,8 +68,8 @@ public class CamundaVIDRequest { @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE) private CamundaInput serviceInstanceId; - @JsonProperty(CommonConstants.CORRELATION_ID) - private CamundaInput correlationId; + @JsonProperty(CommonConstants.PNF_CORRELATION_ID) + private CamundaInput pnfCorrelationId; @JsonProperty(CommonConstants.VNF_ID_VARIABLE) private CamundaInput vnfId; @@ -192,14 +192,14 @@ public class CamundaVIDRequest { this.serviceInstanceId = serviceInstanceId; } - @JsonProperty(CommonConstants.CORRELATION_ID) - public CamundaInput getCorrelationId() { - return correlationId; + @JsonProperty(CommonConstants.PNF_CORRELATION_ID) + public CamundaInput getPnfCorrelationId() { + return pnfCorrelationId; } - @JsonProperty(CommonConstants.CORRELATION_ID) - public void setCorrelationId(CamundaInput correlationId) { - this.correlationId = correlationId; + @JsonProperty(CommonConstants.PNF_CORRELATION_ID) + public void setPnfCorrelationId(CamundaInput pnfCorrelationId) { + this.pnfCorrelationId = pnfCorrelationId; } @JsonProperty(CommonConstants.VNF_ID_VARIABLE) 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 34cfe18508..0ca85f0a06 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 @@ -128,7 +128,7 @@ public class CamundaClient extends RequestClient{ HttpPost post = new HttpPost(url); msoLogger.debug(CAMUNDA_URL_MESAGE+ url); String jsonReq = wrapVIDRequest(parameterObject.getRequestId(), parameterObject.isBaseVfModule(), parameterObject.getRecipeTimeout(), parameterObject.getRequestAction(), - parameterObject.getServiceInstanceId(), parameterObject.getCorrelationId(), parameterObject.getVnfId(), parameterObject.getVfModuleId(), parameterObject.getVolumeGroupId(), parameterObject.getNetworkId(), parameterObject.getConfigurationId(), + parameterObject.getServiceInstanceId(), parameterObject.getPnfCorrelationId(), parameterObject.getVnfId(), parameterObject.getVfModuleId(), parameterObject.getVolumeGroupId(), parameterObject.getNetworkId(), parameterObject.getConfigurationId(), parameterObject.getServiceType(), parameterObject.getVnfType(), parameterObject.getVfModuleType(), parameterObject.getNetworkType(), parameterObject.getRequestDetails(), parameterObject.getApiVersion(), parameterObject.isaLaCarte(), parameterObject.getRequestUri(), parameterObject.getRecipeParamXsd(), parameterObject.getInstanceGroupId()); @@ -198,7 +198,7 @@ public class CamundaClient extends RequestClient{ protected String wrapVIDRequest(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, String serviceInstanceId, String correlationId, + int recipeTimeout, String requestAction, 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, @@ -214,7 +214,7 @@ public class CamundaClient extends RequestClient{ CamundaIntegerInput recipeTimeoutInput = new CamundaIntegerInput(); CamundaInput requestActionInput = new CamundaInput(); CamundaInput serviceInstanceIdInput = new CamundaInput(); - CamundaInput correlationIdInput = new CamundaInput(); + CamundaInput pnfCorrelationIdInput = new CamundaInput(); CamundaInput vnfIdInput = new CamundaInput(); CamundaInput vfModuleIdInput = new CamundaInput(); CamundaInput volumeGroupIdInput = new CamundaInput(); @@ -236,7 +236,7 @@ public class CamundaClient extends RequestClient{ recipeTimeoutInput.setValue(recipeTimeout); requestActionInput.setValue(StringUtils.defaultString(requestAction)); serviceInstanceIdInput.setValue(StringUtils.defaultString(serviceInstanceId)); - correlationIdInput.setValue(StringUtils.defaultString(correlationId)); + pnfCorrelationIdInput.setValue(StringUtils.defaultString(pnfCorrelationId)); vnfIdInput.setValue(StringUtils.defaultString(vnfId)); vfModuleIdInput.setValue(StringUtils.defaultString(vfModuleId)); volumeGroupIdInput.setValue(StringUtils.defaultString(volumeGroupId)); @@ -261,7 +261,7 @@ public class CamundaClient extends RequestClient{ camundaRequest.setRecipeTimeout(recipeTimeoutInput); camundaRequest.setRequestAction(requestActionInput); camundaRequest.setServiceInstanceId(serviceInstanceIdInput); - camundaRequest.setCorrelationId(correlationIdInput); + camundaRequest.setPnfCorrelationId(pnfCorrelationIdInput); camundaRequest.setVnfId(vnfIdInput); camundaRequest.setVfModuleId(vfModuleIdInput); camundaRequest.setVolumeGroupId(volumeGroupIdInput); 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 b75ad9e415..24fb0e0d20 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 @@ -54,7 +54,7 @@ public final class CommonConstants { public static final String RECIPE_TIMEOUT_VARIABLE = "recipeTimeout"; public static final String REQUEST_ACTION_VARIABLE = "requestAction"; public static final String SERVICE_INSTANCE_ID_VARIABLE = "serviceInstanceId"; - public static final String CORRELATION_ID = "correlationId"; + public static final String PNF_CORRELATION_ID = "pnfCorrelationId"; public static final String VNF_ID_VARIABLE = "vnfId"; public static final String VF_MODULE_ID_VARIABLE = "vfModuleId"; public static final String VOLUME_GROUP_ID_VARIABLE = "volumeGroupId"; 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 1d18e2b02c..209f337a1e 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 @@ -28,7 +28,7 @@ public class RequestClientParameter { private int recipeTimeout; private String requestAction; private String serviceInstanceId; - private String correlationId; + private String pnfCorrelationId; private String vnfId; private String vfModuleId; private String volumeGroupId; @@ -51,7 +51,7 @@ public class RequestClientParameter { recipeTimeout = builder.recipeTimeout; requestAction = builder.requestAction; serviceInstanceId = builder.serviceInstanceId; - correlationId = builder.correlationId; + pnfCorrelationId = builder.pnfCorrelationId; vnfId = builder.vnfId; vfModuleId = builder.vfModuleId; volumeGroupId = builder.volumeGroupId; @@ -90,8 +90,8 @@ public class RequestClientParameter { return serviceInstanceId; } - public String getCorrelationId() { - return correlationId; + public String getPnfCorrelationId() { + return pnfCorrelationId; } public String getVnfId() { @@ -160,7 +160,7 @@ public class RequestClientParameter { private int recipeTimeout; private String requestAction; private String serviceInstanceId; - private String correlationId; + private String pnfCorrelationId; private String vnfId; private String vfModuleId; private String volumeGroupId; @@ -202,8 +202,8 @@ public class RequestClientParameter { return this; } - public Builder setCorrelationId(String correlationId) { - this.correlationId = correlationId; + public Builder setPnfCorrelationId(String pnfCorrelationId) { + this.pnfCorrelationId = pnfCorrelationId; return 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 7a03ce0542..0958905720 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 @@ -148,7 +148,7 @@ public class CamundaClientTest{ int recipeTimeout = 10000; String requestAction = "createInstance"; String serviceInstanceId = "12345679"; - String correlationId = "12345679"; + String pnfCorrelationId = "12345679"; String vnfId = "234567891"; String vfModuleId = "345678912"; String volumeGroupId = "456789123"; @@ -164,7 +164,7 @@ public class CamundaClientTest{ String requestUri = "v7/serviceInstances/assign"; String instanceGroupId = "ff305d54-75b4-431b-adb2-eb6b9e5ff000"; - String testResult = testClient.wrapVIDRequest(requestId, isBaseVfModule, recipeTimeout, requestAction, serviceInstanceId, correlationId, + String testResult = testClient.wrapVIDRequest(requestId, isBaseVfModule, recipeTimeout, requestAction, serviceInstanceId, pnfCorrelationId, vnfId, vfModuleId, volumeGroupId, networkId, configurationId, serviceType, vnfType, vfModuleType, networkType, requestDetails, apiVersion, aLaCarte, requestUri, "", instanceGroupId); String expected = inputStream("/WrappedVIDRequest.json"); 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 4c716c2ae3..b9d0a8c3c6 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 @@ -{"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"},"correlationId":{"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"}}}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java index e3b218b90a..a473b0939e 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java @@ -809,7 +809,7 @@ public class ServiceInstances { String vfModuleId = ""; String volumeGroupId = ""; String networkId = ""; - String correlationId = ""; + String pnfCorrelationId = ""; String instanceGroupId = null; if(sir.getServiceInstanceId () != null){ serviceInstanceId = sir.getServiceInstanceId (); @@ -834,7 +834,7 @@ public class ServiceInstances { instanceGroupId = sir.getInstanceGroupId(); } - correlationId = getCorrelationId(sir); + pnfCorrelationId = getPnfCorrelationId(sir); try{ infraActiveRequestsClient.save(currentActiveReq); @@ -858,7 +858,7 @@ public class ServiceInstances { .setRecipeTimeout(recipeLookupResult.getRecipeTimeout()) .setRequestAction(action.toString()) .setServiceInstanceId(serviceInstanceId) - .setCorrelationId(correlationId) + .setPnfCorrelationId(pnfCorrelationId) .setVnfId(vnfId) .setVfModuleId(vfModuleId) .setVolumeGroupId(volumeGroupId) @@ -944,7 +944,7 @@ public class ServiceInstances { return postBPELRequest(currentActiveReq, requestClientParameter, recipeLookupResult.getOrchestrationURI(), requestScope); } - private String getCorrelationId(ServiceInstancesRequest sir) { + private String getPnfCorrelationId(ServiceInstancesRequest sir) { return Optional.of(sir) .map(ServiceInstancesRequest::getRequestDetails) .map(RequestDetails::getRequestParameters) @@ -1860,7 +1860,7 @@ public class ServiceInstances { serviceInstanceId = ""; String configurationId = ""; - String correlationId = ""; + String pnfCorrelationId = ""; if(sir.getServiceInstanceId () != null){ serviceInstanceId = sir.getServiceInstanceId (); @@ -1870,7 +1870,7 @@ public class ServiceInstances { configurationId = sir.getConfigurationId(); } - correlationId = getCorrelationId(sir); + pnfCorrelationId = getPnfCorrelationId(sir); try{ infraActiveRequestsClient.save(currentActiveReq); @@ -1893,7 +1893,7 @@ public class ServiceInstances { .setRecipeTimeout(Integer.parseInt(timeOut)) .setRequestAction(action.toString()) .setServiceInstanceId(serviceInstanceId) - .setCorrelationId(correlationId) + .setPnfCorrelationId(pnfCorrelationId) .setConfigurationId(configurationId) .setRequestDetails(mapJSONtoMSOStyle(requestJSON, sir, aLaCarte, action)) .setApiVersion(apiVersion) diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/AAIClientCallFailedTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/AAIClientCallFailedTest.java new file mode 100644 index 0000000000..2cb02e9666 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/AAIClientCallFailedTest.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 IBM. + * ================================================================================ + * 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.apihandlerinfra.tenantisolation.exceptions; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.onap.so.apihandlerinfra.BaseTest; + +public class AAIClientCallFailedTest extends BaseTest { + + @Test + public void testAAIClientCallFailedException() { + AAIClientCallFailed aAIClientCallFailed = new AAIClientCallFailed("failed", new Throwable("throwable")); + assertEquals("failed", aAIClientCallFailed.getMessage()); + assertEquals("throwable", aAIClientCallFailed.getCause().getMessage()); + } +} |