summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-common
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers/mso-api-handler-common')
-rw-r--r--mso-api-handlers/mso-api-handler-common/pom.xml6
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/BpmnRequest.java435
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaBooleanInput.java19
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaBpmnRequestInput.java16
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaInput.java79
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaIntegerInput.java23
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequest.java7
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequestSerializer.java9
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaRequest.java193
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaResponse.java128
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java625
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/Track.java36
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java513
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java110
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java104
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ErrorNumbers.java9
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/LSInputImpl.java33
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java29
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java131
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientFactory.java59
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java74
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java371
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java45
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/RequestIdFilter.java58
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java30
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java28
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java39
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Messages.java57
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/ModelType.java8
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/MsoException.java3
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Status.java11
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiException.java28
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java70
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/BPMNFailureException.java4
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ClientConnectionException.java12
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ContactCamundaException.java8
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestException.java11
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/RequestDbFailureException.java4
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ValidateException.java4
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/VfModuleNotFoundException.java13
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java30
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/camundabeans/BeansTest.java60
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/camundabeans/BpmnRequestTest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequestSerializerTest.java6
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/AllTestsTestSuite.java5
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java122
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaTaskClientTest.java24
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java103
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/filters/RequestIdFilterTest.java66
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandlerTest.java101
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java32
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/TestAppender.java12
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapperTest.java107
53 files changed, 2102 insertions, 2010 deletions
diff --git a/mso-api-handlers/mso-api-handler-common/pom.xml b/mso-api-handlers/mso-api-handler-common/pom.xml
index d35db00478..7adb7d1131 100644
--- a/mso-api-handlers/mso-api-handler-common/pom.xml
+++ b/mso-api-handlers/mso-api-handler-common/pom.xml
@@ -38,6 +38,12 @@
</dependencies>
</dependencyManagement>
<dependencies>
+ <!-- Dependencies on other MSO Projects -->
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>mso-requests-db</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jersey</artifactId>
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/BpmnRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/BpmnRequest.java
index bc2e5b1893..c67613534b 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/BpmnRequest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/BpmnRequest.java
@@ -21,232 +21,229 @@
package org.onap.so.apihandler.camundabeans;
import org.onap.so.apihandler.common.CommonConstants;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonRootName;
/**
- * JavaBean JSON class for a "bpmnRequest" which contains the JSON payload that
- * will be passed to the Camunda process
+ * JavaBean JSON class for a "bpmnRequest" which contains the JSON payload that will be passed to the Camunda process
*/
-@JsonPropertyOrder({CommonConstants.REQUEST_ID_VARIABLE,
- CommonConstants.IS_BASE_VF_MODULE_VARIABLE, CommonConstants.RECIPE_TIMEOUT_VARIABLE,
- CommonConstants.REQUEST_ACTION_VARIABLE, CommonConstants.SERVICE_INSTANCE_ID_VARIABLE,
- CommonConstants.VNF_ID_VARIABLE, CommonConstants.VF_MODULE_ID_VARIABLE,
- CommonConstants.VOLUME_GROUP_ID_VARIABLE, CommonConstants.NETWORK_ID_VARIABLE,
- CommonConstants.SERVICE_TYPE_VARIABLE, CommonConstants.VNF_TYPE_VARIABLE,
- CommonConstants.VF_MODULE_TYPE_VARIABLE, CommonConstants.NETWORK_TYPE_VARIABLE,
- CommonConstants.REQUEST_DETAILS_VARIABLE})
+@JsonPropertyOrder({CommonConstants.REQUEST_ID_VARIABLE, CommonConstants.IS_BASE_VF_MODULE_VARIABLE,
+ CommonConstants.RECIPE_TIMEOUT_VARIABLE, CommonConstants.REQUEST_ACTION_VARIABLE,
+ CommonConstants.SERVICE_INSTANCE_ID_VARIABLE, CommonConstants.VNF_ID_VARIABLE,
+ CommonConstants.VF_MODULE_ID_VARIABLE, CommonConstants.VOLUME_GROUP_ID_VARIABLE,
+ CommonConstants.NETWORK_ID_VARIABLE, CommonConstants.SERVICE_TYPE_VARIABLE, CommonConstants.VNF_TYPE_VARIABLE,
+ CommonConstants.VF_MODULE_TYPE_VARIABLE, CommonConstants.NETWORK_TYPE_VARIABLE,
+ CommonConstants.REQUEST_DETAILS_VARIABLE})
@JsonRootName(CommonConstants.CAMUNDA_ROOT_INPUT)
public class BpmnRequest {
- @JsonProperty(CommonConstants.CAMUNDA_HOST)
- private CamundaInput host;
-
- @JsonProperty(CommonConstants.REQUEST_ID_VARIABLE)
- private CamundaInput requestId;
-
- @JsonProperty(CommonConstants.IS_BASE_VF_MODULE_VARIABLE)
- private CamundaBooleanInput isBaseVfModule;
-
- @JsonProperty(CommonConstants.RECIPE_TIMEOUT_VARIABLE)
- private CamundaIntegerInput recipeTimeout;
-
- @JsonProperty(CommonConstants.REQUEST_ACTION_VARIABLE)
- private CamundaInput requestAction;
-
- @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE)
- private CamundaInput serviceInstanceId;
-
- @JsonProperty(CommonConstants.VNF_ID_VARIABLE)
- private CamundaInput vnfId;
-
- @JsonProperty(CommonConstants.VF_MODULE_ID_VARIABLE)
- private CamundaInput vfModuleId;
-
- @JsonProperty(CommonConstants.VOLUME_GROUP_ID_VARIABLE)
- private CamundaInput volumeGroupId;
-
- @JsonProperty(CommonConstants.NETWORK_ID_VARIABLE)
- private CamundaInput networkId;
-
- @JsonProperty(CommonConstants.SERVICE_TYPE_VARIABLE)
- private CamundaInput serviceType;
-
- @JsonProperty(CommonConstants.VNF_TYPE_VARIABLE)
- private CamundaInput vnfType;
-
- @JsonProperty(CommonConstants.VF_MODULE_TYPE_VARIABLE)
- private CamundaInput vfModuleType;
-
- @JsonProperty(CommonConstants.NETWORK_TYPE_VARIABLE)
- private CamundaInput networkType;
-
- @JsonProperty(CommonConstants.REQUEST_DETAILS_VARIABLE)
- private CamundaInput requestDetails;
-
- public BpmnRequest() {
- /* Empty constructor */
-
- }
-
- @JsonProperty(CommonConstants.CAMUNDA_HOST)
- public CamundaInput getHost() {
- return host;
- }
-
- @JsonProperty(CommonConstants.CAMUNDA_HOST)
- public void setHost(CamundaInput host) {
- this.host = host;
- }
-
- @JsonProperty(CommonConstants.REQUEST_ID_VARIABLE)
- public CamundaInput getRequestId() {
- return requestId;
- }
-
- @JsonProperty(CommonConstants.REQUEST_ID_VARIABLE)
- public void setRequestId(CamundaInput requestId) {
- this.requestId = requestId;
- }
-
- @JsonProperty(CommonConstants.IS_BASE_VF_MODULE_VARIABLE)
- public CamundaBooleanInput getIsBaseVfModule() {
- return isBaseVfModule;
- }
-
- @JsonProperty(CommonConstants.IS_BASE_VF_MODULE_VARIABLE)
- public void setIsBaseVfModule(CamundaBooleanInput isBaseVfModule) {
- this.isBaseVfModule = isBaseVfModule;
- }
-
- @JsonProperty(CommonConstants.RECIPE_TIMEOUT_VARIABLE)
- public CamundaIntegerInput getRecipeTimeout() {
- return recipeTimeout;
- }
-
- @JsonProperty(CommonConstants.RECIPE_TIMEOUT_VARIABLE)
- public void setRecipeTimeout(CamundaIntegerInput recipeTimeout) {
- this.recipeTimeout = recipeTimeout;
- }
-
- @JsonProperty(CommonConstants.REQUEST_ACTION_VARIABLE)
- public CamundaInput getRequestAction() {
- return requestAction;
- }
-
- @JsonProperty(CommonConstants.REQUEST_ACTION_VARIABLE)
- public void setRequestAction(CamundaInput requestAction) {
- this.requestAction = requestAction;
- }
- @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE)
- public CamundaInput getServiceInstanceId() {
- return serviceInstanceId;
- }
-
- @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE)
- public void setServiceInstanceId(CamundaInput serviceInstanceId) {
- this.serviceInstanceId = serviceInstanceId;
- }
-
- @JsonProperty(CommonConstants.VNF_ID_VARIABLE)
- public CamundaInput getVnfId() {
- return vnfId;
- }
-
- @JsonProperty(CommonConstants.VNF_ID_VARIABLE)
- public void setVnfId(CamundaInput vnfId) {
- this.vnfId = vnfId;
- }
-
- @JsonProperty(CommonConstants.VF_MODULE_ID_VARIABLE)
- public CamundaInput getVfModuleId() {
- return vfModuleId;
- }
-
- @JsonProperty(CommonConstants.VF_MODULE_ID_VARIABLE)
- public void setVfModuleId(CamundaInput vfModuleId) {
- this.vfModuleId = vfModuleId;
- }
-
- @JsonProperty(CommonConstants.VOLUME_GROUP_ID_VARIABLE)
- public CamundaInput getVolumeGroupId() {
- return volumeGroupId;
- }
-
- @JsonProperty(CommonConstants.VOLUME_GROUP_ID_VARIABLE)
- public void setVolumeGroupId(CamundaInput volumeGroupId) {
- this.volumeGroupId = volumeGroupId;
- }
-
- @JsonProperty(CommonConstants.NETWORK_ID_VARIABLE)
- public CamundaInput getNetworkId() {
- return networkId;
- }
-
- @JsonProperty(CommonConstants.NETWORK_ID_VARIABLE)
- public void setNetworkId(CamundaInput networkId) {
- this.networkId = networkId;
- }
-
- @JsonProperty(CommonConstants.SERVICE_TYPE_VARIABLE)
- public CamundaInput getServiceType() {
- return serviceType;
- }
-
- @JsonProperty(CommonConstants.SERVICE_TYPE_VARIABLE)
- public void setServiceType(CamundaInput serviceType) {
- this.serviceType = serviceType;
- }
-
- @JsonProperty(CommonConstants.VNF_TYPE_VARIABLE)
- public CamundaInput getVnfType() {
- return vnfType;
- }
-
- @JsonProperty(CommonConstants.VNF_TYPE_VARIABLE)
- public void setVnfType(CamundaInput vnfType) {
- this.vnfType = vnfType;
- }
-
- @JsonProperty(CommonConstants.VF_MODULE_TYPE_VARIABLE)
- public CamundaInput getVfModuleType() {
- return vfModuleType;
- }
-
- @JsonProperty(CommonConstants.VF_MODULE_TYPE_VARIABLE)
- public void setVfModuleType(CamundaInput vfModuleType) {
- this.vfModuleType = vfModuleType;
- }
-
- @JsonProperty(CommonConstants.NETWORK_TYPE_VARIABLE)
- public CamundaInput getNetworkType() {
- return networkType;
- }
-
- @JsonProperty(CommonConstants.NETWORK_TYPE_VARIABLE)
- public void setNetworkType(CamundaInput networkType) {
- this.networkType = networkType;
- }
-
- @JsonProperty(CommonConstants.REQUEST_DETAILS_VARIABLE)
- public CamundaInput getRequestDetails() {
- return requestDetails;
- }
-
- @JsonProperty(CommonConstants.REQUEST_DETAILS_VARIABLE)
- public void setRequestDetails(CamundaInput requestDetails) {
- this.requestDetails = requestDetails;
- }
-
-
-
-
- @Override
- public String toString() {
-
- return "BpmnRequest";
- }
-
+ @JsonProperty(CommonConstants.CAMUNDA_HOST)
+ private CamundaInput host;
+
+ @JsonProperty(CommonConstants.REQUEST_ID_VARIABLE)
+ private CamundaInput requestId;
+
+ @JsonProperty(CommonConstants.IS_BASE_VF_MODULE_VARIABLE)
+ private CamundaBooleanInput isBaseVfModule;
+
+ @JsonProperty(CommonConstants.RECIPE_TIMEOUT_VARIABLE)
+ private CamundaIntegerInput recipeTimeout;
+
+ @JsonProperty(CommonConstants.REQUEST_ACTION_VARIABLE)
+ private CamundaInput requestAction;
+
+ @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE)
+ private CamundaInput serviceInstanceId;
+
+ @JsonProperty(CommonConstants.VNF_ID_VARIABLE)
+ private CamundaInput vnfId;
+
+ @JsonProperty(CommonConstants.VF_MODULE_ID_VARIABLE)
+ private CamundaInput vfModuleId;
+
+ @JsonProperty(CommonConstants.VOLUME_GROUP_ID_VARIABLE)
+ private CamundaInput volumeGroupId;
+
+ @JsonProperty(CommonConstants.NETWORK_ID_VARIABLE)
+ private CamundaInput networkId;
+
+ @JsonProperty(CommonConstants.SERVICE_TYPE_VARIABLE)
+ private CamundaInput serviceType;
+
+ @JsonProperty(CommonConstants.VNF_TYPE_VARIABLE)
+ private CamundaInput vnfType;
+
+ @JsonProperty(CommonConstants.VF_MODULE_TYPE_VARIABLE)
+ private CamundaInput vfModuleType;
+
+ @JsonProperty(CommonConstants.NETWORK_TYPE_VARIABLE)
+ private CamundaInput networkType;
+
+ @JsonProperty(CommonConstants.REQUEST_DETAILS_VARIABLE)
+ private CamundaInput requestDetails;
+
+ public BpmnRequest() {
+ /* Empty constructor */
+
+ }
+
+ @JsonProperty(CommonConstants.CAMUNDA_HOST)
+ public CamundaInput getHost() {
+ return host;
+ }
+
+ @JsonProperty(CommonConstants.CAMUNDA_HOST)
+ public void setHost(CamundaInput host) {
+ this.host = host;
+ }
+
+ @JsonProperty(CommonConstants.REQUEST_ID_VARIABLE)
+ public CamundaInput getRequestId() {
+ return requestId;
+ }
+
+ @JsonProperty(CommonConstants.REQUEST_ID_VARIABLE)
+ public void setRequestId(CamundaInput requestId) {
+ this.requestId = requestId;
+ }
+
+ @JsonProperty(CommonConstants.IS_BASE_VF_MODULE_VARIABLE)
+ public CamundaBooleanInput getIsBaseVfModule() {
+ return isBaseVfModule;
+ }
+
+ @JsonProperty(CommonConstants.IS_BASE_VF_MODULE_VARIABLE)
+ public void setIsBaseVfModule(CamundaBooleanInput isBaseVfModule) {
+ this.isBaseVfModule = isBaseVfModule;
+ }
+
+ @JsonProperty(CommonConstants.RECIPE_TIMEOUT_VARIABLE)
+ public CamundaIntegerInput getRecipeTimeout() {
+ return recipeTimeout;
+ }
+
+ @JsonProperty(CommonConstants.RECIPE_TIMEOUT_VARIABLE)
+ public void setRecipeTimeout(CamundaIntegerInput recipeTimeout) {
+ this.recipeTimeout = recipeTimeout;
+ }
+
+ @JsonProperty(CommonConstants.REQUEST_ACTION_VARIABLE)
+ public CamundaInput getRequestAction() {
+ return requestAction;
+ }
+
+ @JsonProperty(CommonConstants.REQUEST_ACTION_VARIABLE)
+ public void setRequestAction(CamundaInput requestAction) {
+ this.requestAction = requestAction;
+ }
+
+ @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE)
+ public CamundaInput getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE)
+ public void setServiceInstanceId(CamundaInput serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ @JsonProperty(CommonConstants.VNF_ID_VARIABLE)
+ public CamundaInput getVnfId() {
+ return vnfId;
+ }
+
+ @JsonProperty(CommonConstants.VNF_ID_VARIABLE)
+ public void setVnfId(CamundaInput vnfId) {
+ this.vnfId = vnfId;
+ }
+
+ @JsonProperty(CommonConstants.VF_MODULE_ID_VARIABLE)
+ public CamundaInput getVfModuleId() {
+ return vfModuleId;
+ }
+
+ @JsonProperty(CommonConstants.VF_MODULE_ID_VARIABLE)
+ public void setVfModuleId(CamundaInput vfModuleId) {
+ this.vfModuleId = vfModuleId;
+ }
+
+ @JsonProperty(CommonConstants.VOLUME_GROUP_ID_VARIABLE)
+ public CamundaInput getVolumeGroupId() {
+ return volumeGroupId;
+ }
+
+ @JsonProperty(CommonConstants.VOLUME_GROUP_ID_VARIABLE)
+ public void setVolumeGroupId(CamundaInput volumeGroupId) {
+ this.volumeGroupId = volumeGroupId;
+ }
+
+ @JsonProperty(CommonConstants.NETWORK_ID_VARIABLE)
+ public CamundaInput getNetworkId() {
+ return networkId;
+ }
+
+ @JsonProperty(CommonConstants.NETWORK_ID_VARIABLE)
+ public void setNetworkId(CamundaInput networkId) {
+ this.networkId = networkId;
+ }
+
+ @JsonProperty(CommonConstants.SERVICE_TYPE_VARIABLE)
+ public CamundaInput getServiceType() {
+ return serviceType;
+ }
+
+ @JsonProperty(CommonConstants.SERVICE_TYPE_VARIABLE)
+ public void setServiceType(CamundaInput serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ @JsonProperty(CommonConstants.VNF_TYPE_VARIABLE)
+ public CamundaInput getVnfType() {
+ return vnfType;
+ }
+
+ @JsonProperty(CommonConstants.VNF_TYPE_VARIABLE)
+ public void setVnfType(CamundaInput vnfType) {
+ this.vnfType = vnfType;
+ }
+
+ @JsonProperty(CommonConstants.VF_MODULE_TYPE_VARIABLE)
+ public CamundaInput getVfModuleType() {
+ return vfModuleType;
+ }
+
+ @JsonProperty(CommonConstants.VF_MODULE_TYPE_VARIABLE)
+ public void setVfModuleType(CamundaInput vfModuleType) {
+ this.vfModuleType = vfModuleType;
+ }
+
+ @JsonProperty(CommonConstants.NETWORK_TYPE_VARIABLE)
+ public CamundaInput getNetworkType() {
+ return networkType;
+ }
+
+ @JsonProperty(CommonConstants.NETWORK_TYPE_VARIABLE)
+ public void setNetworkType(CamundaInput networkType) {
+ this.networkType = networkType;
+ }
+
+ @JsonProperty(CommonConstants.REQUEST_DETAILS_VARIABLE)
+ public CamundaInput getRequestDetails() {
+ return requestDetails;
+ }
+
+ @JsonProperty(CommonConstants.REQUEST_DETAILS_VARIABLE)
+ public void setRequestDetails(CamundaInput requestDetails) {
+ this.requestDetails = requestDetails;
+ }
+
+
+
+ @Override
+ public String toString() {
+
+ return "BpmnRequest";
+ }
+
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaBooleanInput.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaBooleanInput.java
index ea44375ff7..9afcadcede 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaBooleanInput.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaBooleanInput.java
@@ -23,12 +23,10 @@ package org.onap.so.apihandler.camundabeans;
import org.onap.so.apihandler.common.CommonConstants;
-
import com.fasterxml.jackson.annotation.JsonProperty;
/**
- * JavaBean JSON class for a "gMyServiceInput" which contains the xml payload that
- * will be passed to the Camunda process
+ * JavaBean JSON class for a "gMyServiceInput" which contains the xml payload that will be passed to the Camunda process
*/
@@ -40,8 +38,7 @@ public class CamundaBooleanInput {
private String type = "Boolean";
- public CamundaBooleanInput() {
- }
+ public CamundaBooleanInput() {}
@JsonProperty(CommonConstants.CAMUNDA_VALUE)
public boolean getValue() {
@@ -55,15 +52,15 @@ public class CamundaBooleanInput {
@JsonProperty(CommonConstants.CAMUNDA_TYPE)
public String getType() {
- return type;
- }
+ return type;
+ }
@JsonProperty(CommonConstants.CAMUNDA_TYPE)
- public void setType(String type) {
- this.type = type;
- }
+ public void setType(String type) {
+ this.type = type;
+ }
- @Override
+ @Override
public String toString() {
return "CamundaInput [value=" + value + ", type=" + type + "]";
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaBpmnRequestInput.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaBpmnRequestInput.java
index 25293c7807..33eea6871a 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaBpmnRequestInput.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaBpmnRequestInput.java
@@ -23,12 +23,10 @@ package org.onap.so.apihandler.camundabeans;
import org.onap.so.apihandler.common.CommonConstants;
-
import com.fasterxml.jackson.annotation.JsonProperty;
/**
- * JavaBean JSON class for a "gMyServiceInput" which contains the xml payload that
- * will be passed to the Camunda process
+ * JavaBean JSON class for a "gMyServiceInput" which contains the xml payload that will be passed to the Camunda process
*/
public class CamundaBpmnRequestInput {
@@ -54,15 +52,15 @@ public class CamundaBpmnRequestInput {
@JsonProperty(CommonConstants.CAMUNDA_TYPE)
public String getType() {
- return type;
- }
+ return type;
+ }
@JsonProperty(CommonConstants.CAMUNDA_TYPE)
- public void setType(String type) {
- this.type = type;
- }
+ public void setType(String type) {
+ this.type = type;
+ }
- @Override
+ @Override
public String toString() {
return "CamundaInput [value=" + value + ", type=" + type + "]";
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaInput.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaInput.java
index 29e72e005a..b384c4ff89 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaInput.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaInput.java
@@ -22,55 +22,50 @@ package org.onap.so.apihandler.camundabeans;
-
import org.onap.so.apihandler.common.CommonConstants;
-
import com.fasterxml.jackson.annotation.JsonProperty;
/**
- * JavaBean JSON class for a "gMyServiceInput" which contains the xml payload that
- * will be passed to the Camunda process
+ * JavaBean JSON class for a "gMyServiceInput" which contains the xml payload that will be passed to the Camunda process
*
*/
public class CamundaInput {
-
- @JsonProperty(CommonConstants.CAMUNDA_VALUE)
- private String value;
-
-
- @JsonProperty(CommonConstants.CAMUNDA_TYPE)
- private String type = "String";
-
-
- @JsonProperty(CommonConstants.CAMUNDA_VALUE)
- public String getValue() {
- return value;
- }
-
- @JsonProperty(CommonConstants.CAMUNDA_TYPE)
- public String getType() {
- return type;
- }
-
- @JsonProperty(CommonConstants.CAMUNDA_TYPE)
- public void setType(String type) {
- this.type = type;
- }
-
- @JsonProperty(CommonConstants.CAMUNDA_VALUE)
- public void setValue(String value) {
- this.value = value;
- }
-
- @Override
- public String toString() {
- return "CamundaInput [value=" + value + ", type=" + type + "]";
- }
-
-
-
-
-
+
+ @JsonProperty(CommonConstants.CAMUNDA_VALUE)
+ private String value;
+
+
+ @JsonProperty(CommonConstants.CAMUNDA_TYPE)
+ private String type = "String";
+
+
+ @JsonProperty(CommonConstants.CAMUNDA_VALUE)
+ public String getValue() {
+ return value;
+ }
+
+ @JsonProperty(CommonConstants.CAMUNDA_TYPE)
+ public String getType() {
+ return type;
+ }
+
+ @JsonProperty(CommonConstants.CAMUNDA_TYPE)
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ @JsonProperty(CommonConstants.CAMUNDA_VALUE)
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return "CamundaInput [value=" + value + ", type=" + type + "]";
+ }
+
+
+
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaIntegerInput.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaIntegerInput.java
index 5bcfc6fb53..b75efe4bb0 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaIntegerInput.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaIntegerInput.java
@@ -23,24 +23,21 @@ package org.onap.so.apihandler.camundabeans;
import org.onap.so.apihandler.common.CommonConstants;
-
import com.fasterxml.jackson.annotation.JsonProperty;
/**
- * JavaBean JSON class for a "gMyServiceInput" which contains the xml payload that
- * will be passed to the Camunda process
+ * JavaBean JSON class for a "gMyServiceInput" which contains the xml payload that will be passed to the Camunda process
*/
public class CamundaIntegerInput {
@JsonProperty(CommonConstants.CAMUNDA_VALUE)
private int value;
-
+
@JsonProperty(CommonConstants.CAMUNDA_TYPE)
private String type = "Integer";
- public CamundaIntegerInput() {
- }
+ public CamundaIntegerInput() {}
@JsonProperty(CommonConstants.CAMUNDA_VALUE)
public int getValue() {
@@ -51,18 +48,18 @@ public class CamundaIntegerInput {
public void setValue(int value) {
this.value = value;
}
-
+
@JsonProperty(CommonConstants.CAMUNDA_TYPE)
public String getType() {
- return type;
- }
+ return type;
+ }
@JsonProperty(CommonConstants.CAMUNDA_TYPE)
- public void setType(String type) {
- this.type = type;
- }
+ public void setType(String type) {
+ this.type = type;
+ }
- @Override
+ @Override
public String toString() {
return "CamundaInput [value=" + Integer.toString(value) + ", type=" + type + "]";
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequest.java
index c57c0965b9..eb94b0d16e 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequest.java
@@ -98,10 +98,7 @@ public class CamundaMacroRequest {
@Override
public String toString() {
- return "CamundaMacroRequest{" +
- "requestId=" + requestId +
- ", action=" + action +
- ", serviceInstanceId=" + serviceInstanceId +
- '}';
+ return "CamundaMacroRequest{" + "requestId=" + requestId + ", action=" + action + ", serviceInstanceId="
+ + serviceInstanceId + '}';
}
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequestSerializer.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequestSerializer.java
index 81adb40498..82077a84e6 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequestSerializer.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequestSerializer.java
@@ -27,11 +27,12 @@ import com.fasterxml.jackson.databind.SerializationFeature;
/**
* Class used to create data object and serialize it to JSON which the BPEL macro flow understands.
*/
-public class CamundaMacroRequestSerializer {
+public class CamundaMacroRequestSerializer {
- private CamundaMacroRequestSerializer(){}
+ private CamundaMacroRequestSerializer() {}
- public static String getJsonRequest(String requestId, String action, String serviceInstanceId)throws JsonProcessingException{
+ public static String getJsonRequest(String requestId, String action, String serviceInstanceId)
+ throws JsonProcessingException {
CamundaMacroRequest macroRequest = new CamundaMacroRequest();
macroRequest.setAction(getCamundaInput(action));
macroRequest.setRequestId(getCamundaInput(requestId));
@@ -41,7 +42,7 @@ public class CamundaMacroRequestSerializer {
return mapper.writeValueAsString(macroRequest);
}
- private static CamundaInput getCamundaInput(String value){
+ private static CamundaInput getCamundaInput(String value) {
CamundaInput input = new CamundaInput();
input.setType("String");
input.setValue(value);
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaRequest.java
index 48eeede7b3..0a74b360c2 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaRequest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaRequest.java
@@ -22,114 +22,109 @@ package org.onap.so.apihandler.camundabeans;
-
-
import org.onap.so.apihandler.common.CommonConstants;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonRootName;
/**
- * JavaBean JSON class for a "variables" which contains the xml payload that
- * will be passed to the Camunda process
+ * JavaBean JSON class for a "variables" which contains the xml payload that will be passed to the Camunda process
*
*/
-@JsonPropertyOrder({ CommonConstants.CAMUNDA_SERVICE_INPUT, CommonConstants.CAMUNDA_HOST,
- CommonConstants.SCHEMA_VERSION_HEADER, CommonConstants.REQUEST_ID_HEADER, CommonConstants.SERVICE_INSTANCE_ID_HEADER,
- CommonConstants. REQUEST_TIMEOUT_HEADER, CommonConstants.CAMUNDA_SERVICE_INPUT})
+@JsonPropertyOrder({CommonConstants.CAMUNDA_SERVICE_INPUT, CommonConstants.CAMUNDA_HOST,
+ CommonConstants.SCHEMA_VERSION_HEADER, CommonConstants.REQUEST_ID_HEADER,
+ CommonConstants.SERVICE_INSTANCE_ID_HEADER, CommonConstants.REQUEST_TIMEOUT_HEADER,
+ CommonConstants.CAMUNDA_SERVICE_INPUT})
@JsonRootName(CommonConstants.CAMUNDA_ROOT_INPUT)
public class CamundaRequest {
- @JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT)
- private CamundaInput serviceInput;
-
- @JsonProperty(CommonConstants.CAMUNDA_HOST)
- private CamundaInput host;
-
- @JsonProperty(CommonConstants.SCHEMA_VERSION_HEADER)
- private CamundaInput schema;
-
- @JsonProperty(CommonConstants.REQUEST_ID_HEADER)
- private CamundaInput reqid;
-
- @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_HEADER)
- private CamundaInput svcid;
-
- @JsonProperty(CommonConstants.REQUEST_TIMEOUT_HEADER)
- private CamundaInput timeout;
-
- public CamundaRequest() {
- }
-
- @JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT)
- public CamundaInput getServiceInput() {
- return serviceInput;
- }
-
- @JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT)
- public void setServiceInput(CamundaInput serviceInput) {
- this.serviceInput = serviceInput;
- }
-
- @JsonProperty(CommonConstants.CAMUNDA_HOST)
- public CamundaInput getHost() {
- return host;
- }
-
- @JsonProperty(CommonConstants.CAMUNDA_HOST)
- public void setHost(CamundaInput host) {
- this.host = host;
- }
-
- @JsonProperty(CommonConstants.SCHEMA_VERSION_HEADER)
- public CamundaInput getSchema() {
- return schema;
- }
-
- @JsonProperty(CommonConstants.SCHEMA_VERSION_HEADER)
- public void setSchema(CamundaInput schema) {
- this.schema = schema;
- }
-
- @JsonProperty(CommonConstants.REQUEST_ID_HEADER)
- public CamundaInput getReqid() {
- return reqid;
- }
-
- @JsonProperty(CommonConstants.REQUEST_ID_HEADER)
- public void setReqid(CamundaInput reqid) {
- this.reqid = reqid;
- }
-
- @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_HEADER)
- public CamundaInput getSvcid() {
- return svcid;
- }
-
- @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_HEADER)
- public void setSvcid(CamundaInput svcid) {
- this.svcid = svcid;
- }
-
-
- @JsonProperty(CommonConstants.REQUEST_TIMEOUT_HEADER)
- public CamundaInput getTimeout() {
- return timeout;
- }
-
- @JsonProperty(CommonConstants.REQUEST_TIMEOUT_HEADER)
- public void setTimeout(CamundaInput timeout) {
- this.timeout = timeout;
- }
-
-
-
- @Override
- public String toString() {
- return "CamundaRequest [serviceInput=" + serviceInput + ", host="
- + host + ", schema=" + schema + ", reqid=" + reqid + ", svcid="
- + svcid + ", timeout=" + timeout + "]";
- }
-
+ @JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT)
+ private CamundaInput serviceInput;
+
+ @JsonProperty(CommonConstants.CAMUNDA_HOST)
+ private CamundaInput host;
+
+ @JsonProperty(CommonConstants.SCHEMA_VERSION_HEADER)
+ private CamundaInput schema;
+
+ @JsonProperty(CommonConstants.REQUEST_ID_HEADER)
+ private CamundaInput reqid;
+
+ @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_HEADER)
+ private CamundaInput svcid;
+
+ @JsonProperty(CommonConstants.REQUEST_TIMEOUT_HEADER)
+ private CamundaInput timeout;
+
+ public CamundaRequest() {}
+
+ @JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT)
+ public CamundaInput getServiceInput() {
+ return serviceInput;
+ }
+
+ @JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT)
+ public void setServiceInput(CamundaInput serviceInput) {
+ this.serviceInput = serviceInput;
+ }
+
+ @JsonProperty(CommonConstants.CAMUNDA_HOST)
+ public CamundaInput getHost() {
+ return host;
+ }
+
+ @JsonProperty(CommonConstants.CAMUNDA_HOST)
+ public void setHost(CamundaInput host) {
+ this.host = host;
+ }
+
+ @JsonProperty(CommonConstants.SCHEMA_VERSION_HEADER)
+ public CamundaInput getSchema() {
+ return schema;
+ }
+
+ @JsonProperty(CommonConstants.SCHEMA_VERSION_HEADER)
+ public void setSchema(CamundaInput schema) {
+ this.schema = schema;
+ }
+
+ @JsonProperty(CommonConstants.REQUEST_ID_HEADER)
+ public CamundaInput getReqid() {
+ return reqid;
+ }
+
+ @JsonProperty(CommonConstants.REQUEST_ID_HEADER)
+ public void setReqid(CamundaInput reqid) {
+ this.reqid = reqid;
+ }
+
+ @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_HEADER)
+ public CamundaInput getSvcid() {
+ return svcid;
+ }
+
+ @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_HEADER)
+ public void setSvcid(CamundaInput svcid) {
+ this.svcid = svcid;
+ }
+
+
+ @JsonProperty(CommonConstants.REQUEST_TIMEOUT_HEADER)
+ public CamundaInput getTimeout() {
+ return timeout;
+ }
+
+ @JsonProperty(CommonConstants.REQUEST_TIMEOUT_HEADER)
+ public void setTimeout(CamundaInput timeout) {
+ this.timeout = timeout;
+ }
+
+
+
+ @Override
+ public String toString() {
+ return "CamundaRequest [serviceInput=" + serviceInput + ", host=" + host + ", schema=" + schema + ", reqid="
+ + reqid + ", svcid=" + svcid + ", timeout=" + timeout + "]";
+ }
+
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaResponse.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaResponse.java
index 92f4542b82..8977f11e36 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaResponse.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaResponse.java
@@ -23,74 +23,70 @@ package org.onap.so.apihandler.camundabeans;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
- * JavaBean JSON class for a "variables" which contains the xml payload that
- * will be passed to the Camunda process
+ * JavaBean JSON class for a "variables" which contains the xml payload that will be passed to the Camunda process
*
*/
public class CamundaResponse {
-
- @JsonProperty("response")
- private String response;
- @JsonProperty("messageCode")
- private int messageCode;
- @JsonProperty("message")
- private String message;
- @JsonProperty("processInstanceID")
- private String processInstanceID;
- @JsonProperty("variables")
- private String variables;
-
- public String getProcessInstanceID() {
- return processInstanceID;
- }
-
- public void setProcessInstanceID(String processInstanceID) {
- this.processInstanceID = processInstanceID;
- }
-
- public String getVariables() {
- return variables;
- }
-
- public void setVariables(String variables) {
- this.variables = variables;
- }
-
- public CamundaResponse() {
- }
-
- public String getResponse() {
- return response;
- }
-
- public void setResponse(String response) {
- this.response = response;
- }
-
- public int getMessageCode() {
- return messageCode;
- }
-
- public void setMessageCode(int messageCode) {
- this.messageCode = messageCode;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- @Override
- public String toString() {
- return "CamundaResponse [response=" + response + ", messageCode="
- + messageCode + ", message=" + message + "]";
- }
-
-
-
-
+
+ @JsonProperty("response")
+ private String response;
+ @JsonProperty("messageCode")
+ private int messageCode;
+ @JsonProperty("message")
+ private String message;
+ @JsonProperty("processInstanceID")
+ private String processInstanceID;
+ @JsonProperty("variables")
+ private String variables;
+
+ public String getProcessInstanceID() {
+ return processInstanceID;
+ }
+
+ public void setProcessInstanceID(String processInstanceID) {
+ this.processInstanceID = processInstanceID;
+ }
+
+ public String getVariables() {
+ return variables;
+ }
+
+ public void setVariables(String variables) {
+ this.variables = variables;
+ }
+
+ public CamundaResponse() {}
+
+ public String getResponse() {
+ return response;
+ }
+
+ public void setResponse(String response) {
+ this.response = response;
+ }
+
+ public int getMessageCode() {
+ return messageCode;
+ }
+
+ public void setMessageCode(int messageCode) {
+ this.messageCode = messageCode;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ @Override
+ public String toString() {
+ return "CamundaResponse [response=" + response + ", messageCode=" + messageCode + ", message=" + message + "]";
+ }
+
+
+
}
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 7e9eed32b1..3880bd43b1 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
@@ -22,330 +22,331 @@ package org.onap.so.apihandler.camundabeans;
import org.onap.so.apihandler.common.CommonConstants;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonRootName;
/**
- * JavaBean JSON class for a "variables" which contains the JSON payload that
- * will be passed to the Camunda process
+ * JavaBean JSON class for a "variables" which contains the JSON payload that will be passed to the Camunda process
*/
@JsonPropertyOrder({CommonConstants.CAMUNDA_SERVICE_INPUT, CommonConstants.REQUEST_ID_VARIABLE,
- CommonConstants.REQUEST_ID_HEADER,
- CommonConstants.IS_BASE_VF_MODULE_VARIABLE, CommonConstants.RECIPE_TIMEOUT_VARIABLE,
- CommonConstants.REQUEST_ACTION_VARIABLE, CommonConstants.SERVICE_INSTANCE_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,
- CommonConstants.NETWORK_TYPE_VARIABLE, CommonConstants.CAMUNDA_SERVICE_INPUT, CommonConstants.RECIPE_PARAMS})
+ CommonConstants.REQUEST_ID_HEADER, CommonConstants.IS_BASE_VF_MODULE_VARIABLE,
+ CommonConstants.RECIPE_TIMEOUT_VARIABLE, CommonConstants.REQUEST_ACTION_VARIABLE,
+ CommonConstants.SERVICE_INSTANCE_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,
+ CommonConstants.NETWORK_TYPE_VARIABLE, CommonConstants.CAMUNDA_SERVICE_INPUT, CommonConstants.RECIPE_PARAMS})
@JsonRootName(CommonConstants.CAMUNDA_ROOT_INPUT)
public class CamundaVIDRequest {
- @JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT)
- private CamundaInput serviceInput;
-
- @JsonProperty(CommonConstants.CAMUNDA_HOST)
- private CamundaInput host;
+ @JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT)
+ private CamundaInput serviceInput;
+
+ @JsonProperty(CommonConstants.CAMUNDA_HOST)
+ private CamundaInput host;
+
+ @JsonProperty(CommonConstants.REQUEST_ID_VARIABLE)
+ private CamundaInput requestId;
+
+ @JsonProperty(CommonConstants.REQUEST_ID_HEADER)
+ private CamundaInput msoRequestId;
+
+ @JsonProperty(CommonConstants.IS_BASE_VF_MODULE_VARIABLE)
+ private CamundaBooleanInput isBaseVfModule;
+
+ @JsonProperty(CommonConstants.RECIPE_TIMEOUT_VARIABLE)
+ private CamundaIntegerInput recipeTimeout;
+
+ @JsonProperty(CommonConstants.REQUEST_ACTION_VARIABLE)
+ private CamundaInput requestAction;
+
+ @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE)
+ private CamundaInput serviceInstanceId;
+
+ @JsonProperty(CommonConstants.PNF_CORRELATION_ID)
+ private CamundaInput pnfCorrelationId;
+
+ @JsonProperty(CommonConstants.VNF_ID_VARIABLE)
+ private CamundaInput vnfId;
+
+ @JsonProperty(CommonConstants.VF_MODULE_ID_VARIABLE)
+ private CamundaInput vfModuleId;
+
+ @JsonProperty(CommonConstants.VOLUME_GROUP_ID_VARIABLE)
+ private CamundaInput volumeGroupId;
+
+ @JsonProperty(CommonConstants.NETWORK_ID_VARIABLE)
+ private CamundaInput networkId;
+
+ @JsonProperty(CommonConstants.CONFIGURATION_ID_VARIABLE)
+ private CamundaInput configurationId;
+
+ @JsonProperty(CommonConstants.SERVICE_TYPE_VARIABLE)
+ private CamundaInput serviceType;
+
+ @JsonProperty(CommonConstants.VNF_TYPE_VARIABLE)
+ private CamundaInput vnfType;
+
+ @JsonProperty(CommonConstants.VF_MODULE_TYPE_VARIABLE)
+ private CamundaInput vfModuleType;
+
+ @JsonProperty(CommonConstants.NETWORK_TYPE_VARIABLE)
+ private CamundaInput networkType;
+
+ @JsonProperty(CommonConstants.RECIPE_PARAMS)
+ private CamundaInput recipeParams;
+
+ @JsonProperty(CommonConstants.API_VERSION)
+ private CamundaInput apiVersion;
+
+ @JsonProperty(CommonConstants.ALACARTE)
+ private CamundaBooleanInput aLaCarte;
+
+ @JsonProperty(CommonConstants.REQUEST_URI)
+ private CamundaInput requestUri;
+
+ @JsonProperty(CommonConstants.INSTANCE_GROUP_ID)
+ private CamundaInput instanceGroupId;
+
+ @JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT)
+ public CamundaInput getServiceInput() {
+ return serviceInput;
+ }
+
+ @JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT)
+ public void setServiceInput(CamundaInput serviceInput) {
+ this.serviceInput = serviceInput;
+ }
+
+ @JsonProperty(CommonConstants.CAMUNDA_HOST)
+ public CamundaInput getHost() {
+ return host;
+ }
+
+ @JsonProperty(CommonConstants.CAMUNDA_HOST)
+ public void setHost(CamundaInput host) {
+ this.host = host;
+ }
+
+ @JsonProperty(CommonConstants.REQUEST_ID_VARIABLE)
+ public CamundaInput getRequestId() {
+ return requestId;
+ }
+
+ @JsonProperty(CommonConstants.REQUEST_ID_VARIABLE)
+ public void setRequestId(CamundaInput requestId) {
+ this.requestId = requestId;
+ }
+
+ @JsonProperty(CommonConstants.REQUEST_ID_HEADER)
+ public CamundaInput getMsoRequestId() {
+ return msoRequestId;
+ }
+
+ @JsonProperty(CommonConstants.REQUEST_ID_HEADER)
+ public void setMsoRequestId(CamundaInput msoRequestIdp) {
+ this.msoRequestId = msoRequestIdp;
+ }
+
+ @JsonProperty(CommonConstants.IS_BASE_VF_MODULE_VARIABLE)
+ public CamundaBooleanInput getIsBaseVfModule() {
+ return isBaseVfModule;
+ }
+
+ @JsonProperty(CommonConstants.IS_BASE_VF_MODULE_VARIABLE)
+ public void setIsBaseVfModule(CamundaBooleanInput isBaseVfModule) {
+ this.isBaseVfModule = isBaseVfModule;
+ }
+
+ @JsonProperty(CommonConstants.RECIPE_TIMEOUT_VARIABLE)
+ public CamundaIntegerInput getRecipeTimeout() {
+ return recipeTimeout;
+ }
+
+ @JsonProperty(CommonConstants.RECIPE_TIMEOUT_VARIABLE)
+ public void setRecipeTimeout(CamundaIntegerInput recipeTimeout) {
+ this.recipeTimeout = recipeTimeout;
+ }
+
+ @JsonProperty(CommonConstants.REQUEST_ACTION_VARIABLE)
+ public CamundaInput getRequestAction() {
+ return requestAction;
+ }
+
+ @JsonProperty(CommonConstants.REQUEST_ACTION_VARIABLE)
+ public void setRequestAction(CamundaInput requestAction) {
+ this.requestAction = requestAction;
+ }
+
+ @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE)
+ public CamundaInput getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE)
+ public void setServiceInstanceId(CamundaInput serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ @JsonProperty(CommonConstants.PNF_CORRELATION_ID)
+ public CamundaInput getPnfCorrelationId() {
+ return pnfCorrelationId;
+ }
+
+ @JsonProperty(CommonConstants.PNF_CORRELATION_ID)
+ public void setPnfCorrelationId(CamundaInput pnfCorrelationId) {
+ this.pnfCorrelationId = pnfCorrelationId;
+ }
+
+ @JsonProperty(CommonConstants.VNF_ID_VARIABLE)
+ public CamundaInput getVnfId() {
+ return vnfId;
+ }
+
+ @JsonProperty(CommonConstants.VNF_ID_VARIABLE)
+ public void setVnfId(CamundaInput vnfId) {
+ this.vnfId = vnfId;
+ }
+
+ @JsonProperty(CommonConstants.VF_MODULE_ID_VARIABLE)
+ public CamundaInput getVfModuleId() {
+ return vfModuleId;
+ }
+
+ @JsonProperty(CommonConstants.VF_MODULE_ID_VARIABLE)
+ public void setVfModuleId(CamundaInput vfModuleId) {
+ this.vfModuleId = vfModuleId;
+ }
+
+ @JsonProperty(CommonConstants.VOLUME_GROUP_ID_VARIABLE)
+ public CamundaInput getVolumeGroupId() {
+ return volumeGroupId;
+ }
+
+ @JsonProperty(CommonConstants.VOLUME_GROUP_ID_VARIABLE)
+ public void setVolumeGroupId(CamundaInput volumeGroupId) {
+ this.volumeGroupId = volumeGroupId;
+ }
+
+ @JsonProperty(CommonConstants.NETWORK_ID_VARIABLE)
+ public CamundaInput getNetworkId() {
+ return networkId;
+ }
+
+ @JsonProperty(CommonConstants.NETWORK_ID_VARIABLE)
+ public void setNetworkId(CamundaInput networkId) {
+ this.networkId = networkId;
+ }
+
+ @JsonProperty(CommonConstants.CONFIGURATION_ID_VARIABLE)
+ public CamundaInput getConfigurationId() {
+ return configurationId;
+ }
+
+ @JsonProperty(CommonConstants.CONFIGURATION_ID_VARIABLE)
+ public void setConfigurationId(CamundaInput configurationId) {
+ this.configurationId = configurationId;
+ }
+
+ @JsonProperty(CommonConstants.SERVICE_TYPE_VARIABLE)
+ public CamundaInput getServiceType() {
+ return serviceType;
+ }
+
+ @JsonProperty(CommonConstants.SERVICE_TYPE_VARIABLE)
+ public void setServiceType(CamundaInput serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ @JsonProperty(CommonConstants.VNF_TYPE_VARIABLE)
+ public CamundaInput getVnfType() {
+ return vnfType;
+ }
+
+ @JsonProperty(CommonConstants.VNF_TYPE_VARIABLE)
+ public void setVnfType(CamundaInput vnfType) {
+ this.vnfType = vnfType;
+ }
+
+ @JsonProperty(CommonConstants.VF_MODULE_TYPE_VARIABLE)
+ public CamundaInput getVfModuleType() {
+ return vfModuleType;
+ }
+
+ @JsonProperty(CommonConstants.VF_MODULE_TYPE_VARIABLE)
+ public void setVfModuleType(CamundaInput vfModuleType) {
+ this.vfModuleType = vfModuleType;
+ }
+
+ @JsonProperty(CommonConstants.NETWORK_TYPE_VARIABLE)
+ public CamundaInput getNetworkType() {
+ return networkType;
+ }
+
+ @JsonProperty(CommonConstants.NETWORK_TYPE_VARIABLE)
+ public void setNetworkType(CamundaInput networkType) {
+ this.networkType = networkType;
+ }
+
+ @JsonProperty(CommonConstants.API_VERSION)
+ public CamundaInput getApiVersion() {
+ return apiVersion;
+ }
+
+ @JsonProperty(CommonConstants.API_VERSION)
+ public void setApiVersion(CamundaInput apiVersion) {
+ this.apiVersion = apiVersion;
+ }
+
+ @JsonProperty(CommonConstants.ALACARTE)
+ public CamundaBooleanInput getaLaCarte() {
+ return aLaCarte;
+ }
+
+ @JsonProperty(CommonConstants.ALACARTE)
+ public void setaLaCarte(CamundaBooleanInput aLaCarte) {
+ this.aLaCarte = aLaCarte;
+ }
+
+ @JsonProperty(CommonConstants.REQUEST_URI)
+ public CamundaInput getRequestUri() {
+ return requestUri;
+ }
+
+ @JsonProperty(CommonConstants.REQUEST_URI)
+ public void setRequestUri(CamundaInput requestUri) {
+ this.requestUri = requestUri;
+ }
+
+ public CamundaInput getRecipeParams() {
+ return recipeParams;
+ }
+
+ public void setRecipeParams(CamundaInput recipeParams) {
+ this.recipeParams = recipeParams;
+ }
+
+ @JsonProperty(CommonConstants.INSTANCE_GROUP_ID)
+ public void setInstanceGroupId(CamundaInput instanceGroupIdInput) {
+ this.instanceGroupId = instanceGroupIdInput;
+ }
+
+ @JsonProperty(CommonConstants.INSTANCE_GROUP_ID)
+ public CamundaInput getInstanceGroupId() {
+ return instanceGroupId;
+ }
+
+ @Override
+ public String toString() {
+ // return "CamundaRequest [requestId=" + + ", host="
+ // + host + ", schema=" + schema + ", reqid=" + reqid + ", svcid="
+ // + svcid + ", timeout=" + timeout + "]";
+ return "CamundaRequest";
+ }
- @JsonProperty(CommonConstants.REQUEST_ID_VARIABLE)
- private CamundaInput requestId;
- @JsonProperty(CommonConstants.REQUEST_ID_HEADER)
- private CamundaInput msoRequestId;
-
- @JsonProperty(CommonConstants.IS_BASE_VF_MODULE_VARIABLE)
- private CamundaBooleanInput isBaseVfModule;
-
- @JsonProperty(CommonConstants.RECIPE_TIMEOUT_VARIABLE)
- private CamundaIntegerInput recipeTimeout;
-
- @JsonProperty(CommonConstants.REQUEST_ACTION_VARIABLE)
- private CamundaInput requestAction;
-
- @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE)
- private CamundaInput serviceInstanceId;
-
- @JsonProperty(CommonConstants.PNF_CORRELATION_ID)
- private CamundaInput pnfCorrelationId;
-
- @JsonProperty(CommonConstants.VNF_ID_VARIABLE)
- private CamundaInput vnfId;
-
- @JsonProperty(CommonConstants.VF_MODULE_ID_VARIABLE)
- private CamundaInput vfModuleId;
-
- @JsonProperty(CommonConstants.VOLUME_GROUP_ID_VARIABLE)
- private CamundaInput volumeGroupId;
-
- @JsonProperty(CommonConstants.NETWORK_ID_VARIABLE)
- private CamundaInput networkId;
-
- @JsonProperty(CommonConstants.CONFIGURATION_ID_VARIABLE)
- private CamundaInput configurationId;
-
- @JsonProperty(CommonConstants.SERVICE_TYPE_VARIABLE)
- private CamundaInput serviceType;
-
- @JsonProperty(CommonConstants.VNF_TYPE_VARIABLE)
- private CamundaInput vnfType;
-
- @JsonProperty(CommonConstants.VF_MODULE_TYPE_VARIABLE)
- private CamundaInput vfModuleType;
-
- @JsonProperty(CommonConstants.NETWORK_TYPE_VARIABLE)
- private CamundaInput networkType;
-
- @JsonProperty(CommonConstants.RECIPE_PARAMS)
- private CamundaInput recipeParams;
-
- @JsonProperty(CommonConstants.API_VERSION)
- private CamundaInput apiVersion;
-
- @JsonProperty(CommonConstants.ALACARTE)
- private CamundaBooleanInput aLaCarte;
-
- @JsonProperty(CommonConstants.REQUEST_URI)
- private CamundaInput requestUri;
-
- @JsonProperty(CommonConstants.INSTANCE_GROUP_ID)
- private CamundaInput instanceGroupId;
-
- @JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT)
- public CamundaInput getServiceInput() {
- return serviceInput;
- }
-
- @JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT)
- public void setServiceInput(CamundaInput serviceInput) {
- this.serviceInput = serviceInput;
- }
-
- @JsonProperty(CommonConstants.CAMUNDA_HOST)
- public CamundaInput getHost() {
- return host;
- }
-
- @JsonProperty(CommonConstants.CAMUNDA_HOST)
- public void setHost(CamundaInput host) {
- this.host = host;
- }
-
- @JsonProperty(CommonConstants.REQUEST_ID_VARIABLE)
- public CamundaInput getRequestId() {
- return requestId;
- }
-
- @JsonProperty(CommonConstants.REQUEST_ID_VARIABLE)
- public void setRequestId(CamundaInput requestId) {
- this.requestId = requestId;
- }
-
- @JsonProperty(CommonConstants.REQUEST_ID_HEADER)
- public CamundaInput getMsoRequestId() {
- return msoRequestId;
- }
-
- @JsonProperty(CommonConstants.REQUEST_ID_HEADER)
- public void setMsoRequestId(CamundaInput msoRequestIdp) {
- this.msoRequestId = msoRequestIdp;
- }
-
- @JsonProperty(CommonConstants.IS_BASE_VF_MODULE_VARIABLE)
- public CamundaBooleanInput getIsBaseVfModule() {
- return isBaseVfModule;
- }
-
- @JsonProperty(CommonConstants.IS_BASE_VF_MODULE_VARIABLE)
- public void setIsBaseVfModule(CamundaBooleanInput isBaseVfModule) {
- this.isBaseVfModule = isBaseVfModule;
- }
-
- @JsonProperty(CommonConstants.RECIPE_TIMEOUT_VARIABLE)
- public CamundaIntegerInput getRecipeTimeout() {
- return recipeTimeout;
- }
-
- @JsonProperty(CommonConstants.RECIPE_TIMEOUT_VARIABLE)
- public void setRecipeTimeout(CamundaIntegerInput recipeTimeout) {
- this.recipeTimeout = recipeTimeout;
- }
-
- @JsonProperty(CommonConstants.REQUEST_ACTION_VARIABLE)
- public CamundaInput getRequestAction() {
- return requestAction;
- }
-
- @JsonProperty(CommonConstants.REQUEST_ACTION_VARIABLE)
- public void setRequestAction(CamundaInput requestAction) {
- this.requestAction = requestAction;
- }
- @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE)
- public CamundaInput getServiceInstanceId() {
- return serviceInstanceId;
- }
-
- @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE)
- public void setServiceInstanceId(CamundaInput serviceInstanceId) {
- this.serviceInstanceId = serviceInstanceId;
- }
-
- @JsonProperty(CommonConstants.PNF_CORRELATION_ID)
- public CamundaInput getPnfCorrelationId() {
- return pnfCorrelationId;
- }
-
- @JsonProperty(CommonConstants.PNF_CORRELATION_ID)
- public void setPnfCorrelationId(CamundaInput pnfCorrelationId) {
- this.pnfCorrelationId = pnfCorrelationId;
- }
-
- @JsonProperty(CommonConstants.VNF_ID_VARIABLE)
- public CamundaInput getVnfId() {
- return vnfId;
- }
-
- @JsonProperty(CommonConstants.VNF_ID_VARIABLE)
- public void setVnfId(CamundaInput vnfId) {
- this.vnfId = vnfId;
- }
-
- @JsonProperty(CommonConstants.VF_MODULE_ID_VARIABLE)
- public CamundaInput getVfModuleId() {
- return vfModuleId;
- }
-
- @JsonProperty(CommonConstants.VF_MODULE_ID_VARIABLE)
- public void setVfModuleId(CamundaInput vfModuleId) {
- this.vfModuleId = vfModuleId;
- }
-
- @JsonProperty(CommonConstants.VOLUME_GROUP_ID_VARIABLE)
- public CamundaInput getVolumeGroupId() {
- return volumeGroupId;
- }
-
- @JsonProperty(CommonConstants.VOLUME_GROUP_ID_VARIABLE)
- public void setVolumeGroupId(CamundaInput volumeGroupId) {
- this.volumeGroupId = volumeGroupId;
- }
-
- @JsonProperty(CommonConstants.NETWORK_ID_VARIABLE)
- public CamundaInput getNetworkId() {
- return networkId;
- }
-
- @JsonProperty(CommonConstants.NETWORK_ID_VARIABLE)
- public void setNetworkId(CamundaInput networkId) {
- this.networkId = networkId;
- }
-
- @JsonProperty(CommonConstants.CONFIGURATION_ID_VARIABLE)
- public CamundaInput getConfigurationId() {
- return configurationId;
- }
-
- @JsonProperty(CommonConstants.CONFIGURATION_ID_VARIABLE)
- public void setConfigurationId(CamundaInput configurationId) {
- this.configurationId = configurationId;
- }
-
- @JsonProperty(CommonConstants.SERVICE_TYPE_VARIABLE)
- public CamundaInput getServiceType() {
- return serviceType;
- }
-
- @JsonProperty(CommonConstants.SERVICE_TYPE_VARIABLE)
- public void setServiceType(CamundaInput serviceType) {
- this.serviceType = serviceType;
- }
-
- @JsonProperty(CommonConstants.VNF_TYPE_VARIABLE)
- public CamundaInput getVnfType() {
- return vnfType;
- }
-
- @JsonProperty(CommonConstants.VNF_TYPE_VARIABLE)
- public void setVnfType(CamundaInput vnfType) {
- this.vnfType = vnfType;
- }
-
- @JsonProperty(CommonConstants.VF_MODULE_TYPE_VARIABLE)
- public CamundaInput getVfModuleType() {
- return vfModuleType;
- }
-
- @JsonProperty(CommonConstants.VF_MODULE_TYPE_VARIABLE)
- public void setVfModuleType(CamundaInput vfModuleType) {
- this.vfModuleType = vfModuleType;
- }
-
- @JsonProperty(CommonConstants.NETWORK_TYPE_VARIABLE)
- public CamundaInput getNetworkType() {
- return networkType;
- }
-
- @JsonProperty(CommonConstants.NETWORK_TYPE_VARIABLE)
- public void setNetworkType(CamundaInput networkType) {
- this.networkType = networkType;
- }
-
- @JsonProperty(CommonConstants.API_VERSION)
- public CamundaInput getApiVersion() {
- return apiVersion;
- }
-
- @JsonProperty(CommonConstants.API_VERSION)
- public void setApiVersion(CamundaInput apiVersion) {
- this.apiVersion = apiVersion;
- }
-
- @JsonProperty(CommonConstants.ALACARTE)
- public CamundaBooleanInput getaLaCarte() {
- return aLaCarte;
- }
-
- @JsonProperty(CommonConstants.ALACARTE)
- public void setaLaCarte(CamundaBooleanInput aLaCarte) {
- this.aLaCarte = aLaCarte;
- }
-
- @JsonProperty(CommonConstants.REQUEST_URI)
- public CamundaInput getRequestUri() {
- return requestUri;
- }
-
- @JsonProperty(CommonConstants.REQUEST_URI)
- public void setRequestUri(CamundaInput requestUri) {
- this.requestUri = requestUri;
- }
-
- public CamundaInput getRecipeParams() {
- return recipeParams;
- }
-
- public void setRecipeParams(CamundaInput recipeParams) {
- this.recipeParams = recipeParams;
- }
- @JsonProperty(CommonConstants.INSTANCE_GROUP_ID)
- public void setInstanceGroupId(CamundaInput instanceGroupIdInput) {
- this.instanceGroupId = instanceGroupIdInput;
- }
- @JsonProperty(CommonConstants.INSTANCE_GROUP_ID)
- public CamundaInput getInstanceGroupId() {
- return instanceGroupId;
- }
-
- @Override
- public String toString() {
- //return "CamundaRequest [requestId=" + + ", host="
- // + host + ", schema=" + schema + ", reqid=" + reqid + ", svcid="
- // + svcid + ", timeout=" + timeout + "]";
- return "CamundaRequest";
- }
-
-
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/Track.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/Track.java
index 3d4dc85089..112ab9966e 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/Track.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/Track.java
@@ -22,28 +22,28 @@ package org.onap.so.apihandler.camundabeans;
public class Track {
- String title;
- String singer;
+ String title;
+ String singer;
- public String getTitle() {
- return title;
- }
+ public String getTitle() {
+ return title;
+ }
- public void setTitle(String title) {
- this.title = title;
- }
+ public void setTitle(String title) {
+ this.title = title;
+ }
- public String getSinger() {
- return singer;
- }
+ public String getSinger() {
+ return singer;
+ }
- public void setSinger(String singer) {
- this.singer = singer;
- }
+ public void setSinger(String singer) {
+ this.singer = singer;
+ }
- @Override
- public String toString() {
- return "Track [title=" + title + ", singer=" + singer + "]";
- }
+ @Override
+ public String toString() {
+ return "Track [title=" + title + ", singer=" + singer + "]";
+ }
}
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 9b77c1469b..d11f1706e9 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
@@ -26,9 +26,7 @@ package org.onap.so.apihandler.common;
import java.io.IOException;
import java.util.UUID;
-
import javax.xml.bind.DatatypeConverter;
-
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
@@ -45,263 +43,270 @@ import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
-
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-public class CamundaClient extends RequestClient{
- private static Logger logger = LoggerFactory.getLogger(CamundaClient.class);
- private static final String CAMUNDA_URL_MESAGE = "Camunda url is: ";
-
- public CamundaClient() {
- super(CommonConstants.CAMUNDA);
- }
-
-
- @Override
- public HttpResponse post(String camundaReqXML, String requestId,
- String requestTimeout, String schemaVersion, String serviceInstanceId, String action)
- throws ClientProtocolException, IOException{
- HttpPost post = new HttpPost(url);
- logger.debug(CAMUNDA_URL_MESAGE + url);
- String jsonReq = wrapRequest(camundaReqXML, requestId, serviceInstanceId, requestTimeout, schemaVersion);
-
- StringEntity input = new StringEntity(jsonReq);
- input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
- logger.info("Camunda Request Content: {}", jsonReq);
-
-
- post.setEntity(input);
- setupHeaders(post);
-
- HttpResponse response = client.execute(post);
- logger.debug("Response is: {}", response);
-
- return response;
- }
-
-
- private void setupHeaders(HttpPost post) {
- post.addHeader(ONAPLogConstants.Headers.REQUEST_ID, MDC.get(ONAPLogConstants.MDCs.REQUEST_ID));
- post.addHeader(ONAPLogConstants.Headers.INVOCATION_ID, UUID.randomUUID().toString());
-
- String encryptedCredentials = null;
- if(props!=null){
- encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH);
- if(encryptedCredentials != null){
- String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, props.getProperty(CommonConstants.ENCRYPTION_KEY_PROP));
- if(userCredentials != null){
- post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
- }
- }
- }
- }
-
- @Override
- public HttpResponse post(String jsonReq)
- throws ClientProtocolException, IOException{
- HttpPost post = new HttpPost(url);
- logger.debug(CAMUNDA_URL_MESAGE + url);
-
- StringEntity input = new StringEntity(jsonReq);
- input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
- setupHeaders(post);
-
- String encryptedCredentials = null;
- if(props!=null){
- encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH);
- if(encryptedCredentials != null){
- String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, props.getProperty(CommonConstants.ENCRYPTION_KEY_PROP));
- if(userCredentials != null){
- post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
- }
- }
- }
-
-
- post.setEntity(input);
- HttpResponse response = client.execute(post);
- logger.debug("Response is: {}", response);
-
- return response;
- }
-
- public HttpResponse post(RequestClientParameter parameterObject)
- throws ClientProtocolException, IOException{
- HttpPost post = new HttpPost(url);
- logger.debug(CAMUNDA_URL_MESAGE+ url);
- String jsonReq = wrapVIDRequest(parameterObject.getRequestId(), parameterObject.isBaseVfModule(), parameterObject.getRecipeTimeout(), parameterObject.getRequestAction(),
- 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());
-
- StringEntity input = new StringEntity(jsonReq);
- input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
-
-
- setupHeaders(post);
-
- String encryptedCredentials = null;
- if(props!=null){
- encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH);
- if(encryptedCredentials != null){
- String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, props.getProperty(CommonConstants.ENCRYPTION_KEY_PROP));
- if(userCredentials != null){
- post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
- }
- }
- }
-
- post.setEntity(input);
- HttpResponse response = client.execute(post);
- logger.debug("Response is: {}", response);
-
- return response;
- }
-
- @Override
+public class CamundaClient extends RequestClient {
+ private static Logger logger = LoggerFactory.getLogger(CamundaClient.class);
+ private static final String CAMUNDA_URL_MESAGE = "Camunda url is: ";
+
+ public CamundaClient() {
+ super(CommonConstants.CAMUNDA);
+ }
+
+
+ @Override
+ public HttpResponse post(String camundaReqXML, String requestId, String requestTimeout, String schemaVersion,
+ String serviceInstanceId, String action) throws ClientProtocolException, IOException {
+ HttpPost post = new HttpPost(url);
+ logger.debug(CAMUNDA_URL_MESAGE + url);
+ String jsonReq = wrapRequest(camundaReqXML, requestId, serviceInstanceId, requestTimeout, schemaVersion);
+
+ StringEntity input = new StringEntity(jsonReq);
+ input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
+ logger.info("Camunda Request Content: {}", jsonReq);
+
+
+ post.setEntity(input);
+ setupHeaders(post);
+
+ HttpResponse response = client.execute(post);
+ logger.debug("Response is: {}", response);
+
+ return response;
+ }
+
+
+ private void setupHeaders(HttpPost post) {
+ post.addHeader(ONAPLogConstants.Headers.REQUEST_ID, MDC.get(ONAPLogConstants.MDCs.REQUEST_ID));
+ post.addHeader(ONAPLogConstants.Headers.INVOCATION_ID, UUID.randomUUID().toString());
+
+ String encryptedCredentials = null;
+ if (props != null) {
+ encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH);
+ if (encryptedCredentials != null) {
+ String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH,
+ props.getProperty(CommonConstants.ENCRYPTION_KEY_PROP));
+ if (userCredentials != null) {
+ post.addHeader("Authorization",
+ "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+ }
+ }
+ }
+ }
+
+ @Override
+ public HttpResponse post(String jsonReq) throws ClientProtocolException, IOException {
+ HttpPost post = new HttpPost(url);
+ logger.debug(CAMUNDA_URL_MESAGE + url);
+
+ StringEntity input = new StringEntity(jsonReq);
+ input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
+ setupHeaders(post);
+
+ String encryptedCredentials = null;
+ if (props != null) {
+ encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH);
+ if (encryptedCredentials != null) {
+ String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH,
+ props.getProperty(CommonConstants.ENCRYPTION_KEY_PROP));
+ if (userCredentials != null) {
+ post.addHeader("Authorization",
+ "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+ }
+ }
+ }
+
+
+ post.setEntity(input);
+ HttpResponse response = client.execute(post);
+ logger.debug("Response is: {}", response);
+
+ return response;
+ }
+
+ public HttpResponse post(RequestClientParameter parameterObject) throws ClientProtocolException, IOException {
+ HttpPost post = new HttpPost(url);
+ logger.debug(CAMUNDA_URL_MESAGE + url);
+ String jsonReq = wrapVIDRequest(parameterObject.getRequestId(), parameterObject.isBaseVfModule(),
+ parameterObject.getRecipeTimeout(), parameterObject.getRequestAction(),
+ 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());
+
+ StringEntity input = new StringEntity(jsonReq);
+ input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
+
+
+ setupHeaders(post);
+
+ String encryptedCredentials = null;
+ if (props != null) {
+ encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH);
+ if (encryptedCredentials != null) {
+ String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH,
+ props.getProperty(CommonConstants.ENCRYPTION_KEY_PROP));
+ if (userCredentials != null) {
+ post.addHeader("Authorization",
+ "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+ }
+ }
+ }
+
+ post.setEntity(input);
+ HttpResponse response = client.execute(post);
+ logger.debug("Response is: {}", response);
+
+ return response;
+ }
+
+ @Override
public HttpResponse get() {
return null;
}
- protected String wrapRequest(String reqXML, String requestId, String serviceInstanceId, String requestTimeout, String schemaVersion){
- String jsonReq = null;
-
- try{
- CamundaRequest camundaRequest = new CamundaRequest();
- CamundaInput camundaInput = new CamundaInput();
- CamundaInput host = new CamundaInput();
- CamundaInput schema = new CamundaInput();
- CamundaInput reqid = new CamundaInput();
- CamundaInput svcid = new CamundaInput();
- CamundaInput timeout = new CamundaInput();
- camundaInput.setValue(StringUtils.defaultString(reqXML));
- host.setValue(parseURL());
- schema.setValue(StringUtils.defaultString(schemaVersion));
- reqid.setValue(requestId);
- svcid.setValue(serviceInstanceId);
- timeout.setValue(StringUtils.defaultString(requestTimeout));
- camundaRequest.setServiceInput(camundaInput);
- camundaRequest.setHost(host);
- camundaRequest.setReqid(reqid);
- camundaRequest.setSvcid(svcid);
- camundaRequest.setSchema(schema);
- camundaRequest.setTimeout(timeout);
- ObjectMapper mapper = new ObjectMapper();
-
- mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
-
- jsonReq = mapper.writeValueAsString(camundaRequest);
- logger.trace("request body is {}", jsonReq);
- }catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapRequest",
- ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e);
- }
- return jsonReq;
- }
-
-
- protected String wrapVIDRequest(String requestId, boolean isBaseVfModule,
- 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,
- String instanceGroupId){
- String jsonReq = null;
-
- try{
- CamundaVIDRequest camundaRequest = new CamundaVIDRequest();
- CamundaInput serviceInput = new CamundaInput();
- CamundaInput host = new CamundaInput();
- CamundaInput requestIdInput= new CamundaInput();
- CamundaBooleanInput isBaseVfModuleInput = new CamundaBooleanInput();
- CamundaIntegerInput recipeTimeoutInput = new CamundaIntegerInput();
- CamundaInput requestActionInput = new CamundaInput();
- CamundaInput serviceInstanceIdInput = new CamundaInput();
- CamundaInput pnfCorrelationIdInput = new CamundaInput();
- CamundaInput vnfIdInput = new CamundaInput();
- CamundaInput vfModuleIdInput = new CamundaInput();
- CamundaInput volumeGroupIdInput = new CamundaInput();
- CamundaInput networkIdInput = new CamundaInput();
- CamundaInput configurationIdInput = new CamundaInput();
- CamundaInput serviceTypeInput = new CamundaInput();
- CamundaInput vnfTypeInput = new CamundaInput();
- CamundaInput vfModuleTypeInput = new CamundaInput();
- CamundaInput networkTypeInput = new CamundaInput();
- CamundaBooleanInput aLaCarteInput = new CamundaBooleanInput();
- CamundaInput apiVersionInput = new CamundaInput();
- CamundaInput requestUriInput = new CamundaInput();
- CamundaInput recipeParamsInput = new CamundaInput();
- CamundaInput instanceGroupIdInput = new CamundaInput();
-
- //host.setValue(parseURL());
- requestIdInput.setValue(StringUtils.defaultString(requestId));
- isBaseVfModuleInput.setValue(isBaseVfModule);
- recipeTimeoutInput.setValue(recipeTimeout);
- requestActionInput.setValue(StringUtils.defaultString(requestAction));
- serviceInstanceIdInput.setValue(StringUtils.defaultString(serviceInstanceId));
- pnfCorrelationIdInput.setValue(StringUtils.defaultString(pnfCorrelationId));
- vnfIdInput.setValue(StringUtils.defaultString(vnfId));
- vfModuleIdInput.setValue(StringUtils.defaultString(vfModuleId));
- volumeGroupIdInput.setValue(StringUtils.defaultString(volumeGroupId));
- networkIdInput.setValue(StringUtils.defaultString(networkId));
- configurationIdInput.setValue(StringUtils.defaultString(configurationId));
- serviceTypeInput.setValue(StringUtils.defaultString(serviceType));
- vnfTypeInput.setValue(StringUtils.defaultString(vnfType));
- vfModuleTypeInput.setValue(StringUtils.defaultString(vfModuleType));
- networkTypeInput.setValue(StringUtils.defaultString(networkType));
- aLaCarteInput.setValue(aLaCarte);
- apiVersionInput.setValue(StringUtils.defaultString(apiVersion));
- requestUriInput.setValue(StringUtils.defaultString(requestUri));
- recipeParamsInput.setValue(paramXsd);
- instanceGroupIdInput.setValue(StringUtils.defaultString(instanceGroupId));
-
- serviceInput.setValue(requestDetails);
- camundaRequest.setServiceInput(serviceInput);
- camundaRequest.setHost(host);
- camundaRequest.setRequestId(requestIdInput);
- camundaRequest.setMsoRequestId(requestIdInput);
- camundaRequest.setIsBaseVfModule(isBaseVfModuleInput);
- camundaRequest.setRecipeTimeout(recipeTimeoutInput);
- camundaRequest.setRequestAction(requestActionInput);
- camundaRequest.setServiceInstanceId(serviceInstanceIdInput);
- camundaRequest.setPnfCorrelationId(pnfCorrelationIdInput);
- camundaRequest.setVnfId(vnfIdInput);
- camundaRequest.setVfModuleId(vfModuleIdInput);
- camundaRequest.setVolumeGroupId(volumeGroupIdInput);
- camundaRequest.setNetworkId(networkIdInput);
- camundaRequest.setConfigurationId(configurationIdInput);
- camundaRequest.setServiceType(serviceTypeInput);
- camundaRequest.setVnfType(vnfTypeInput);
- camundaRequest.setVfModuleType(vfModuleTypeInput);
- camundaRequest.setNetworkType(networkTypeInput);
- camundaRequest.setaLaCarte(aLaCarteInput);
- camundaRequest.setApiVersion(apiVersionInput);
- camundaRequest.setRequestUri(requestUriInput);
- camundaRequest.setRecipeParams(recipeParamsInput);
- camundaRequest.setInstanceGroupId(instanceGroupIdInput);
-
- ObjectMapper mapper = new ObjectMapper();
- mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
-
- jsonReq = mapper.writeValueAsString(camundaRequest);
- logger.trace("request body is {}", jsonReq);
- }catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapVIDRequest",
- ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e);
- }
- return jsonReq;
- }
-
- private String parseURL(){
- String[] parts = url.split(":");
- String host = "";
- if(parts.length>=2){
- host = parts[1];
- if(host.length()>2){
- host = host.substring(2);
- }
- }
- return host;
- }
+ protected String wrapRequest(String reqXML, String requestId, String serviceInstanceId, String requestTimeout,
+ String schemaVersion) {
+ String jsonReq = null;
+
+ try {
+ CamundaRequest camundaRequest = new CamundaRequest();
+ CamundaInput camundaInput = new CamundaInput();
+ CamundaInput host = new CamundaInput();
+ CamundaInput schema = new CamundaInput();
+ CamundaInput reqid = new CamundaInput();
+ CamundaInput svcid = new CamundaInput();
+ CamundaInput timeout = new CamundaInput();
+ camundaInput.setValue(StringUtils.defaultString(reqXML));
+ host.setValue(parseURL());
+ schema.setValue(StringUtils.defaultString(schemaVersion));
+ reqid.setValue(requestId);
+ svcid.setValue(serviceInstanceId);
+ timeout.setValue(StringUtils.defaultString(requestTimeout));
+ camundaRequest.setServiceInput(camundaInput);
+ camundaRequest.setHost(host);
+ camundaRequest.setReqid(reqid);
+ camundaRequest.setSvcid(svcid);
+ camundaRequest.setSchema(schema);
+ camundaRequest.setTimeout(timeout);
+ ObjectMapper mapper = new ObjectMapper();
+
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
+
+ jsonReq = mapper.writeValueAsString(camundaRequest);
+ logger.trace("request body is {}", jsonReq);
+ } catch (Exception e) {
+ logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapRequest",
+ ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e);
+ }
+ return jsonReq;
+ }
+
+
+ protected String wrapVIDRequest(String requestId, boolean isBaseVfModule, 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, String instanceGroupId) {
+ String jsonReq = null;
+
+ try {
+ CamundaVIDRequest camundaRequest = new CamundaVIDRequest();
+ CamundaInput serviceInput = new CamundaInput();
+ CamundaInput host = new CamundaInput();
+ CamundaInput requestIdInput = new CamundaInput();
+ CamundaBooleanInput isBaseVfModuleInput = new CamundaBooleanInput();
+ CamundaIntegerInput recipeTimeoutInput = new CamundaIntegerInput();
+ CamundaInput requestActionInput = new CamundaInput();
+ CamundaInput serviceInstanceIdInput = new CamundaInput();
+ CamundaInput pnfCorrelationIdInput = new CamundaInput();
+ CamundaInput vnfIdInput = new CamundaInput();
+ CamundaInput vfModuleIdInput = new CamundaInput();
+ CamundaInput volumeGroupIdInput = new CamundaInput();
+ CamundaInput networkIdInput = new CamundaInput();
+ CamundaInput configurationIdInput = new CamundaInput();
+ CamundaInput serviceTypeInput = new CamundaInput();
+ CamundaInput vnfTypeInput = new CamundaInput();
+ CamundaInput vfModuleTypeInput = new CamundaInput();
+ CamundaInput networkTypeInput = new CamundaInput();
+ CamundaBooleanInput aLaCarteInput = new CamundaBooleanInput();
+ CamundaInput apiVersionInput = new CamundaInput();
+ CamundaInput requestUriInput = new CamundaInput();
+ CamundaInput recipeParamsInput = new CamundaInput();
+ CamundaInput instanceGroupIdInput = new CamundaInput();
+
+ // host.setValue(parseURL());
+ requestIdInput.setValue(StringUtils.defaultString(requestId));
+ isBaseVfModuleInput.setValue(isBaseVfModule);
+ recipeTimeoutInput.setValue(recipeTimeout);
+ requestActionInput.setValue(StringUtils.defaultString(requestAction));
+ serviceInstanceIdInput.setValue(StringUtils.defaultString(serviceInstanceId));
+ pnfCorrelationIdInput.setValue(StringUtils.defaultString(pnfCorrelationId));
+ vnfIdInput.setValue(StringUtils.defaultString(vnfId));
+ vfModuleIdInput.setValue(StringUtils.defaultString(vfModuleId));
+ volumeGroupIdInput.setValue(StringUtils.defaultString(volumeGroupId));
+ networkIdInput.setValue(StringUtils.defaultString(networkId));
+ configurationIdInput.setValue(StringUtils.defaultString(configurationId));
+ serviceTypeInput.setValue(StringUtils.defaultString(serviceType));
+ vnfTypeInput.setValue(StringUtils.defaultString(vnfType));
+ vfModuleTypeInput.setValue(StringUtils.defaultString(vfModuleType));
+ networkTypeInput.setValue(StringUtils.defaultString(networkType));
+ aLaCarteInput.setValue(aLaCarte);
+ apiVersionInput.setValue(StringUtils.defaultString(apiVersion));
+ requestUriInput.setValue(StringUtils.defaultString(requestUri));
+ recipeParamsInput.setValue(paramXsd);
+ instanceGroupIdInput.setValue(StringUtils.defaultString(instanceGroupId));
+
+ serviceInput.setValue(requestDetails);
+ camundaRequest.setServiceInput(serviceInput);
+ camundaRequest.setHost(host);
+ camundaRequest.setRequestId(requestIdInput);
+ camundaRequest.setMsoRequestId(requestIdInput);
+ camundaRequest.setIsBaseVfModule(isBaseVfModuleInput);
+ camundaRequest.setRecipeTimeout(recipeTimeoutInput);
+ camundaRequest.setRequestAction(requestActionInput);
+ camundaRequest.setServiceInstanceId(serviceInstanceIdInput);
+ camundaRequest.setPnfCorrelationId(pnfCorrelationIdInput);
+ camundaRequest.setVnfId(vnfIdInput);
+ camundaRequest.setVfModuleId(vfModuleIdInput);
+ camundaRequest.setVolumeGroupId(volumeGroupIdInput);
+ camundaRequest.setNetworkId(networkIdInput);
+ camundaRequest.setConfigurationId(configurationIdInput);
+ camundaRequest.setServiceType(serviceTypeInput);
+ camundaRequest.setVnfType(vnfTypeInput);
+ camundaRequest.setVfModuleType(vfModuleTypeInput);
+ camundaRequest.setNetworkType(networkTypeInput);
+ camundaRequest.setaLaCarte(aLaCarteInput);
+ camundaRequest.setApiVersion(apiVersionInput);
+ camundaRequest.setRequestUri(requestUriInput);
+ camundaRequest.setRecipeParams(recipeParamsInput);
+ camundaRequest.setInstanceGroupId(instanceGroupIdInput);
+
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
+
+ jsonReq = mapper.writeValueAsString(camundaRequest);
+ logger.trace("request body is {}", jsonReq);
+ } catch (Exception e) {
+ logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapVIDRequest",
+ ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e);
+ }
+ return jsonReq;
+ }
+
+ private String parseURL() {
+ String[] parts = url.split(":");
+ String host = "";
+ if (parts.length >= 2) {
+ host = parts[1];
+ if (host.length() > 2) {
+ host = host.substring(2);
+ }
+ }
+ return host;
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java
index d8c785dcb3..d6d999b4b5 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java
@@ -23,9 +23,7 @@
package org.onap.so.apihandler.common;
import java.io.IOException;
-
import javax.xml.bind.DatatypeConverter;
-
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
@@ -33,64 +31,66 @@ import org.apache.http.entity.StringEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class CamundaTaskClient extends RequestClient{
- private static Logger logger = LoggerFactory.getLogger(CamundaTaskClient.class);
+public class CamundaTaskClient extends RequestClient {
+ private static Logger logger = LoggerFactory.getLogger(CamundaTaskClient.class);
+
+ public CamundaTaskClient() {
+ super(CommonConstants.CAMUNDATASK);
+ }
+
+ @Override
+ public HttpResponse post(String jsonReq) throws IOException {
+ HttpPost post = new HttpPost(url);
+ logger.debug("Camunda Task url is: {}", url);
- public CamundaTaskClient() {
- super(CommonConstants.CAMUNDATASK);
- }
-
- @Override
- public HttpResponse post(String jsonReq) throws IOException{
- HttpPost post = new HttpPost(url);
- logger.debug("Camunda Task url is: {}", url);
+ StringEntity input = new StringEntity(jsonReq);
+ input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
- StringEntity input = new StringEntity(jsonReq);
- input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
+ String encryptedCredentials;
+ if (props != null) {
+ encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH);
+ if (encryptedCredentials != null) {
+ String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH,
+ props.getProperty(CommonConstants.ENCRYPTION_KEY_PROP));
+ if (userCredentials != null) {
+ post.addHeader("Authorization",
+ "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes()));
+ }
+ }
+ }
- String encryptedCredentials;
- if(props!=null){
- encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH);
- if(encryptedCredentials != null){
- String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, props.getProperty(CommonConstants.ENCRYPTION_KEY_PROP));
- if(userCredentials != null){
- post.addHeader("Authorization", "Basic " + DatatypeConverter
- .printBase64Binary(userCredentials.getBytes()));
- }
- }
- }
+ post.setEntity(input);
+ return client.execute(post);
+ }
- post.setEntity(input);
- return client.execute(post);
- }
-
- @Override
- public HttpResponse post(String camundaReqXML, String requestId,
- String requestTimeout, String schemaVersion, String serviceInstanceId, String action) {
- throw new UnsupportedOperationException("Method not supported.");
- }
+ @Override
+ public HttpResponse post(String camundaReqXML, String requestId, String requestTimeout, String schemaVersion,
+ String serviceInstanceId, String action) {
+ throw new UnsupportedOperationException("Method not supported.");
+ }
- @Override
- public HttpResponse post(RequestClientParameter params) {
- throw new UnsupportedOperationException("Method not supported.");
- }
+ @Override
+ public HttpResponse post(RequestClientParameter params) {
+ throw new UnsupportedOperationException("Method not supported.");
+ }
- @Override
- public HttpResponse get() throws IOException {
- HttpGet get = new HttpGet(url);
- logger.debug("Camunda Task url is: {}", url);
- String encryptedCredentials;
- if(props!=null){
- encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH);
- if(encryptedCredentials != null){
- String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, props.getProperty(CommonConstants.ENCRYPTION_KEY_PROP));
- if(userCredentials != null){
- get.addHeader("Authorization", "Basic " + new String(DatatypeConverter
- .printBase64Binary(userCredentials.getBytes())));
- }
- }
- }
- return client.execute(get);
- }
+ @Override
+ public HttpResponse get() throws IOException {
+ HttpGet get = new HttpGet(url);
+ logger.debug("Camunda Task url is: {}", url);
+ String encryptedCredentials;
+ if (props != null) {
+ encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH);
+ if (encryptedCredentials != null) {
+ String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH,
+ props.getProperty(CommonConstants.ENCRYPTION_KEY_PROP));
+ if (userCredentials != null) {
+ get.addHeader("Authorization",
+ "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+ }
+ }
+ }
+ return client.execute(get);
+ }
}
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 1dece5c341..e48c98a395 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
@@ -32,57 +32,57 @@ public final class CommonConstants {
public static final String SERVICE_INSTANCE_ID_HEADER = "mso-service-instance-id";
public static final String ACTION_HEADER = "mso-action";
- public static final String G_REQUEST_ID = "mso-request-id";
- public static final String G_SERVICEINSTANCEID = "serviceInstanceId";
- public static final String G_ACTION = "gAction";
+ public static final String G_REQUEST_ID = "mso-request-id";
+ public static final String G_SERVICEINSTANCEID = "serviceInstanceId";
+ public static final String G_ACTION = "gAction";
- public static final String CAMUNDA_SERVICE_INPUT = "bpmnRequest";
- public static final String CAMUNDA_ROOT_INPUT = "variables";
- public static final String CONTENT_TYPE_JSON= "application/json";
- public static final String CAMUNDA_TYPE = "type";
- public static final String CAMUNDA_VALUE = "value";
- public static final String CAMUNDA_URL = "mso.camundaURL";
- public static final String CAMUNDA_AUTH = "mso.camundaAuth";
- public static final String BPEL_SEARCH_STR = "active-bpel";
- public static final String TASK_SEARCH_STR = "task";
- public static final int BPEL = 0;
- public static final int CAMUNDA = 1;
- public static final int CAMUNDATASK = 2;
- public static final String CAMUNDA_HOST = "host";
- public static final String REQUEST_ID_VARIABLE = "requestId";
- public static final String IS_BASE_VF_MODULE_VARIABLE = "isBaseVfModule";
- 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 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";
- public static final String NETWORK_ID_VARIABLE = "networkId";
- public static final String CONFIGURATION_ID_VARIABLE = "configurationId";
- public static final String SERVICE_TYPE_VARIABLE = "serviceType";
- public static final String VNF_TYPE_VARIABLE = "vnfType";
- public static final String VF_MODULE_TYPE_VARIABLE = "vfModuleType";
- public static final String NETWORK_TYPE_VARIABLE = "networkType";
- public static final String REQUEST_DETAILS_VARIABLE = "requestDetails";
- public static final String ALACARTE_ORCHESTRATION = "mso.infra.default.alacarte.orchestrationUri";
- public static final String ALACARTE_RECIPE_TIMEOUT = "mso.infra.default.alacarte.recipeTimeout";
- public static final String RECIPE_PARAMS = "recipeParams";
- public static final String ALACARTE_TEST_API = "mso.infra.default.alacarte.testApi";
- public static final String MACRO_TEST_API = "mso.infra.service.macro.default.testApi";
- public static final String ALACARTE = "aLaCarte";
- public static final String API_VERSION = "apiVersion";
- public static final String REQUEST_URI = "requestUri";
- public static final String API_MINOR_VERSION = "mso.infra.default.versions.apiMinorVersion";
- public static final String API_PATCH_VERSION = "mso.infra.default.versions.apiPatchVersion";
- public static final String X_TRANSACTION_ID = "X-TransactionID";
- public static final String X_MINOR_VERSION = "X-MinorVersion";
- public static final String X_PATCH_VERSION = "X-PatchVersion";
- 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";
-
- private CommonConstants () {
- // prevent creating an instance of this class
- }
+ public static final String CAMUNDA_SERVICE_INPUT = "bpmnRequest";
+ public static final String CAMUNDA_ROOT_INPUT = "variables";
+ public static final String CONTENT_TYPE_JSON = "application/json";
+ public static final String CAMUNDA_TYPE = "type";
+ public static final String CAMUNDA_VALUE = "value";
+ public static final String CAMUNDA_URL = "mso.camundaURL";
+ public static final String CAMUNDA_AUTH = "mso.camundaAuth";
+ public static final String BPEL_SEARCH_STR = "active-bpel";
+ public static final String TASK_SEARCH_STR = "task";
+ public static final int BPEL = 0;
+ public static final int CAMUNDA = 1;
+ public static final int CAMUNDATASK = 2;
+ public static final String CAMUNDA_HOST = "host";
+ public static final String REQUEST_ID_VARIABLE = "requestId";
+ public static final String IS_BASE_VF_MODULE_VARIABLE = "isBaseVfModule";
+ 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 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";
+ public static final String NETWORK_ID_VARIABLE = "networkId";
+ public static final String CONFIGURATION_ID_VARIABLE = "configurationId";
+ public static final String SERVICE_TYPE_VARIABLE = "serviceType";
+ public static final String VNF_TYPE_VARIABLE = "vnfType";
+ public static final String VF_MODULE_TYPE_VARIABLE = "vfModuleType";
+ public static final String NETWORK_TYPE_VARIABLE = "networkType";
+ public static final String REQUEST_DETAILS_VARIABLE = "requestDetails";
+ public static final String ALACARTE_ORCHESTRATION = "mso.infra.default.alacarte.orchestrationUri";
+ public static final String ALACARTE_RECIPE_TIMEOUT = "mso.infra.default.alacarte.recipeTimeout";
+ public static final String RECIPE_PARAMS = "recipeParams";
+ public static final String ALACARTE_TEST_API = "mso.infra.default.alacarte.testApi";
+ public static final String MACRO_TEST_API = "mso.infra.service.macro.default.testApi";
+ public static final String ALACARTE = "aLaCarte";
+ public static final String API_VERSION = "apiVersion";
+ public static final String REQUEST_URI = "requestUri";
+ public static final String API_MINOR_VERSION = "mso.infra.default.versions.apiMinorVersion";
+ public static final String API_PATCH_VERSION = "mso.infra.default.versions.apiPatchVersion";
+ public static final String X_TRANSACTION_ID = "X-TransactionID";
+ public static final String X_MINOR_VERSION = "X-MinorVersion";
+ public static final String X_PATCH_VERSION = "X-PatchVersion";
+ 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";
+
+ 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/ErrorNumbers.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ErrorNumbers.java
index 5d755b9529..468fe61562 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ErrorNumbers.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ErrorNumbers.java
@@ -19,11 +19,10 @@
*/
package org.onap.so.apihandler.common;
-
+
public final class ErrorNumbers {
- private ErrorNumbers() {
- }
+ private ErrorNumbers() {}
public static final String REQUEST_FAILED_SCHEMA_VALIDATION = "1000";
public static final String RECIPE_DOES_NOT_EXIST = "1010";
@@ -48,7 +47,7 @@ public final class ErrorNumbers {
public static final String DISCONNECT_ALREADY_COMPLETE = "1100";
public static final String CANCEL_ALREADY_COMPLETE = "1110";
-
+
public static final String LOCKED_CREATE_ON_THE_SAME_VNF_NAME_IN_PROGRESS = "1400";
public static final String LOCKED_SAME_ACTION_AND_VNF_ID = "1410";
@@ -68,7 +67,7 @@ public final class ErrorNumbers {
public static final String NO_COMMUNICATION_TO_SDNC_ADAPTER = "7000";
public static final String NO_RESPONSE_FROM_SDNC_ADAPTER = "7010";
public static final String ERROR_FROM_SDNC_ADAPTER = "7020";
-
+
public static final String SVC_GENERAL_SERVICE_ERROR = "SVC0001";
public static final String SVC_BAD_PARAMETER = "SVC0002";
public static final String SVC_NO_SERVER_RESOURCES = "SVC1000";
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/LSInputImpl.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/LSInputImpl.java
index 60473fb8c4..a8085cfaaf 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/LSInputImpl.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/LSInputImpl.java
@@ -23,7 +23,6 @@ package org.onap.so.apihandler.common;
import java.io.InputStream;
import java.io.Reader;
-
import org.w3c.dom.ls.LSInput;
public class LSInputImpl implements LSInput {
@@ -38,82 +37,82 @@ public class LSInputImpl implements LSInput {
protected boolean fCertifiedText;
@Override
- public InputStream getByteStream () {
+ public InputStream getByteStream() {
return fByteStream;
}
@Override
- public void setByteStream (InputStream byteStream) {
+ public void setByteStream(InputStream byteStream) {
fByteStream = byteStream;
}
@Override
- public Reader getCharacterStream () {
+ public Reader getCharacterStream() {
return fCharStream;
}
@Override
- public void setCharacterStream (Reader characterStream) {
+ public void setCharacterStream(Reader characterStream) {
fCharStream = characterStream;
}
@Override
- public String getStringData () {
+ public String getStringData() {
return fData;
}
@Override
- public void setStringData (String stringData) {
+ public void setStringData(String stringData) {
fData = stringData;
}
@Override
- public String getEncoding () {
+ public String getEncoding() {
return fEncoding;
}
@Override
- public void setEncoding (String encoding) {
+ public void setEncoding(String encoding) {
fEncoding = encoding;
}
@Override
- public String getPublicId () {
+ public String getPublicId() {
return fPublicId;
}
@Override
- public void setPublicId (String publicId) {
+ public void setPublicId(String publicId) {
fPublicId = publicId;
}
@Override
- public String getSystemId () {
+ public String getSystemId() {
return fSystemId;
}
@Override
- public void setSystemId (String systemId) {
+ public void setSystemId(String systemId) {
fSystemId = systemId;
}
@Override
- public String getBaseURI () {
+ public String getBaseURI() {
return fBaseSystemId;
}
@Override
- public void setBaseURI (String baseURI) {
+ public void setBaseURI(String baseURI) {
fBaseSystemId = baseURI;
}
@Override
- public boolean getCertifiedText () {
+ public boolean getCertifiedText() {
return fCertifiedText;
}
@Override
- public void setCertifiedText (boolean certifiedText) {
+ public void setCertifiedText(boolean certifiedText) {
fCertifiedText = certifiedText;
}
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java
index ee1ea8e562..ad8cc3f250 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java
@@ -27,40 +27,39 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.InputStreamReader;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.ls.LSInput;
import org.w3c.dom.ls.LSResourceResolver;
public class PathResourceResolver implements LSResourceResolver {
-
+
private static Logger logger = LoggerFactory.getLogger(PathResourceResolver.class);
private String path;
-
+
public PathResourceResolver(String path) {
-
- this.path = path;
+
+ this.path = path;
}
-
+
@Override
public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) {
-
+
LSInputImpl input = new LSInputImpl();
-
+
InputStream stream = null;
- try {
- stream = new FileInputStream(path + systemId);
- } catch (FileNotFoundException e) {
- logger.debug ("Could not resolve resource based on file: {}", path + systemId, e);
- }
-
+ try {
+ stream = new FileInputStream(path + systemId);
+ } catch (FileNotFoundException e) {
+ logger.debug("Could not resolve resource based on file: {}", path + systemId, e);
+ }
+
input.setPublicId(publicId);
input.setSystemId(systemId);
input.setBaseURI(baseURI);
input.setCharacterStream(new InputStreamReader(stream));
-
+
return input;
}
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java
index 9f5c8460a1..0aac35d5a9 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java
@@ -24,7 +24,6 @@ package org.onap.so.apihandler.common;
import java.io.IOException;
import java.security.GeneralSecurityException;
-
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
@@ -34,72 +33,70 @@ import org.slf4j.LoggerFactory;
import org.springframework.core.env.Environment;
public abstract class RequestClient {
- private static Logger logger = LoggerFactory.getLogger(RequestClient.class);
- protected Environment props;
- protected String url;
- protected HttpClient client;
- private int type;
-
- public RequestClient(int type){
- this.type = type;
- }
-
- public void setProps(Environment env) {
- this.props = env;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- public String getUrl() {
- return url;
- }
-
- public int getType(){
- return type;
- }
-
- public HttpClient getClient() {
- return client;
- }
-
- public void setClient(HttpClient client) {
- this.client = client;
- }
-
- public abstract HttpResponse post(String request, String requestId, String requestTimeout, String schemaVersion, String serviceInstanceId, String action) throws IOException;
-
- public abstract HttpResponse post(String request) throws ClientProtocolException, IOException;
-
- public abstract HttpResponse post(RequestClientParameter parameterObject) throws ClientProtocolException, IOException;
-
- public abstract HttpResponse get()
- throws IOException;
-
- protected String decryptPropValue(String prop, String defaultValue, String encryptionKey) {
- try {
- String result = CryptoUtils.decrypt(prop, encryptionKey);
- return result;
- }
- catch (GeneralSecurityException e) {
- logger.debug("Security exception", e);
- }
- return defaultValue;
- }
-
- protected String getEncryptedPropValue (String prop, String defaultValue, String encryptionKey) {
- try {
- String result = CryptoUtils.decrypt(prop, encryptionKey);
- return result;
- }
- catch (GeneralSecurityException e) {
- logger.debug("Security exception", e);
- }
- return defaultValue;
- }
-
-
+ private static Logger logger = LoggerFactory.getLogger(RequestClient.class);
+ protected Environment props;
+ protected String url;
+ protected HttpClient client;
+ private int type;
+
+ public RequestClient(int type) {
+ this.type = type;
+ }
+
+ public void setProps(Environment env) {
+ this.props = env;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public HttpClient getClient() {
+ return client;
+ }
+
+ public void setClient(HttpClient client) {
+ this.client = client;
+ }
+
+ public abstract HttpResponse post(String request, String requestId, String requestTimeout, String schemaVersion,
+ String serviceInstanceId, String action) throws IOException;
+
+ public abstract HttpResponse post(String request) throws ClientProtocolException, IOException;
+
+ public abstract HttpResponse post(RequestClientParameter parameterObject)
+ throws ClientProtocolException, IOException;
+
+ public abstract HttpResponse get() throws IOException;
+
+ protected String decryptPropValue(String prop, String defaultValue, String encryptionKey) {
+ try {
+ String result = CryptoUtils.decrypt(prop, encryptionKey);
+ return result;
+ } catch (GeneralSecurityException e) {
+ logger.debug("Security exception", e);
+ }
+ return defaultValue;
+ }
+
+ protected String getEncryptedPropValue(String prop, String defaultValue, String encryptionKey) {
+ try {
+ String result = CryptoUtils.decrypt(prop, encryptionKey);
+ return result;
+ } catch (GeneralSecurityException e) {
+ logger.debug("Security exception", e);
+ }
+ return defaultValue;
+ }
+
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientFactory.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientFactory.java
index e94f186c60..4149d5ee45 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientFactory.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientFactory.java
@@ -22,7 +22,6 @@ package org.onap.so.apihandler.common;
-
import org.apache.http.impl.client.DefaultHttpClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
@@ -30,39 +29,37 @@ import org.springframework.stereotype.Component;
@Component
public class RequestClientFactory {
-
- @Autowired
- private Environment env;
-
- //based on URI, returns BPEL, CamundaTask or Camunda client
- public RequestClient getRequestClient(String orchestrationURI) throws IllegalStateException{
- RequestClient retClient;
- String url;
- if(orchestrationURI.contains(CommonConstants.TASK_SEARCH_STR)){
- url = env.getProperty(CommonConstants.CAMUNDA_URL) + orchestrationURI;
- retClient = new CamundaTaskClient();
- }
- else{
- url = env.getProperty(CommonConstants.CAMUNDA_URL) + orchestrationURI;
- retClient = new CamundaClient();
- }
- retClient.setClient(new DefaultHttpClient());
- retClient.setProps(env);
- retClient.setUrl(url);
- return retClient;
-
- }
+ @Autowired
+ private Environment env;
+
+ // based on URI, returns BPEL, CamundaTask or Camunda client
+ public RequestClient getRequestClient(String orchestrationURI) throws IllegalStateException {
+ RequestClient retClient;
+
+ String url;
+ if (orchestrationURI.contains(CommonConstants.TASK_SEARCH_STR)) {
+ url = env.getProperty(CommonConstants.CAMUNDA_URL) + orchestrationURI;
+ retClient = new CamundaTaskClient();
+ } else {
+ url = env.getProperty(CommonConstants.CAMUNDA_URL) + orchestrationURI;
+ retClient = new CamundaClient();
+ }
+ retClient.setClient(new DefaultHttpClient());
+ retClient.setProps(env);
+ retClient.setUrl(url);
+ return retClient;
+
+ }
+
+ public Environment getEnv() {
+ return env;
+ }
- public Environment getEnv() {
- return env;
- }
+ public void setEnv(Environment env) {
+ this.env = env;
+ }
- public void setEnv(Environment env) {
- this.env = env;
- }
-
-
}
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 209f337a1e..20c512af37 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
@@ -40,10 +40,10 @@ public class RequestClientParameter {
private String networkType;
private String requestDetails;
private String apiVersion;
- private boolean aLaCarte;
+ private boolean aLaCarte;
private String recipeParamXsd;
- private String requestUri;
- private String instanceGroupId;
+ private String requestUri;
+ private String instanceGroupId;
private RequestClientParameter(Builder builder) {
requestId = builder.requestId;
@@ -67,7 +67,7 @@ public class RequestClientParameter {
aLaCarte = builder.aLaCarte;
requestUri = builder.requestUri;
instanceGroupId = builder.instanceGroupId;
-
+
}
public String getRequestId() {
@@ -139,22 +139,22 @@ public class RequestClientParameter {
}
public String getApiVersion() {
- return apiVersion;
- }
-
- public boolean isaLaCarte() {
- return aLaCarte;
- }
-
- public String getRequestUri() {
- return requestUri;
- }
-
- public String getInstanceGroupId() {
- return instanceGroupId;
- }
-
- public static class Builder {
+ return apiVersion;
+ }
+
+ public boolean isaLaCarte() {
+ return aLaCarte;
+ }
+
+ public String getRequestUri() {
+ return requestUri;
+ }
+
+ public String getInstanceGroupId() {
+ return instanceGroupId;
+ }
+
+ public static class Builder {
private String requestId;
private boolean isBaseVfModule = false;
private int recipeTimeout;
@@ -172,10 +172,10 @@ public class RequestClientParameter {
private String networkType;
private String requestDetails;
private String apiVersion;
- private boolean aLaCarte = false;
+ private boolean aLaCarte = false;
private String recipeParamXsd;
- private String requestUri;
- private String instanceGroupId;
+ private String requestUri;
+ private String instanceGroupId;
public Builder setRequestId(String requestId) {
this.requestId = requestId;
@@ -261,28 +261,28 @@ public class RequestClientParameter {
this.recipeParamXsd = recipeParamXsd;
return this;
}
-
+
public Builder setApiVersion(String apiVersion) {
- this.apiVersion = apiVersion;
- return this;
+ this.apiVersion = apiVersion;
+ return this;
}
-
+
public Builder setALaCarte(boolean aLaCarte) {
- this.aLaCarte = aLaCarte;
- return this;
+ this.aLaCarte = aLaCarte;
+ return this;
}
-
+
public Builder setRequestUri(String requestUri) {
- this.requestUri = requestUri;
- return this;
+ this.requestUri = requestUri;
+ return this;
}
-
+
public Builder setInstanceGroupId(String instanceGroupId) {
- this.instanceGroupId = instanceGroupId;
- return this;
- }
+ this.instanceGroupId = instanceGroupId;
+ return this;
+ }
- public RequestClientParameter build(){
+ public RequestClientParameter build() {
return new RequestClientParameter(this);
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java
index 6b43e96b08..fff4c1d508 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java
@@ -24,7 +24,6 @@ package org.onap.so.apihandler.common;
import java.io.IOException;
-
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
@@ -37,189 +36,205 @@ import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-
import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ResponseHandler {
- private CamundaResponse response;
- private int status;
- private String responseBody="";
- private HttpResponse httpResponse;
- private int type;
- private static Logger logger = LoggerFactory.getLogger(ResponseHandler.class);
-
- public ResponseHandler(HttpResponse httpResponse, int type) throws ApiException{
- this.httpResponse = httpResponse;
- this.type=type;
- parseResponse();
- }
-
-
- private void parseResponse() throws ApiException{
- int statusCode = httpResponse.getStatusLine().getStatusCode();
- status = setStatus(statusCode);
- if(type==CommonConstants.CAMUNDA){
- parseCamunda();
- }else if(type==CommonConstants.CAMUNDATASK){
- parseCamundaTask();
- }else {
- parseBpel();
- }
-
- }
-
-
-
- private void parseCamunda() throws ApiException{
- try{
- HttpEntity entity = httpResponse.getEntity();
- responseBody = EntityUtils.toString(entity);
- } catch (IOException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
-
-
- ValidateException validateException = new ValidateException.Builder("IOException getting Camunda response body", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
- .errorInfo(errorLoggerInfo).build();
- throw validateException;
- }
-
- ObjectMapper mapper = new ObjectMapper();
- try {
- response = mapper.readValue(responseBody, CamundaResponse.class);
- } catch (IOException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
-
-
- ValidateException validateException = new ValidateException.Builder("Cannot parse Camunda Response", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
- .errorInfo(errorLoggerInfo).build();
- throw validateException;
- }
- if(response!=null){
- responseBody = response.getResponse();
- }else{
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, ErrorCode.BusinessProcesssError)
- .targetEntity("Camunda").targetServiceName("parseCamunda").build();
- BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(status), status, ErrorNumbers.ERROR_FROM_BPEL)
- .errorInfo(errorLoggerInfo).build();
+ private CamundaResponse response;
+ private int status;
+ private String responseBody = "";
+ private HttpResponse httpResponse;
+ private int type;
+ private static Logger logger = LoggerFactory.getLogger(ResponseHandler.class);
+
+ public ResponseHandler(HttpResponse httpResponse, int type) throws ApiException {
+ this.httpResponse = httpResponse;
+ this.type = type;
+ parseResponse();
+ }
+
+
+ private void parseResponse() throws ApiException {
+ int statusCode = httpResponse.getStatusLine().getStatusCode();
+ status = setStatus(statusCode);
+ if (type == CommonConstants.CAMUNDA) {
+ parseCamunda();
+ } else if (type == CommonConstants.CAMUNDATASK) {
+ parseCamundaTask();
+ } else {
+ parseBpel();
+ }
+
+ }
+
+
+
+ private void parseCamunda() throws ApiException {
+ try {
+ HttpEntity entity = httpResponse.getEntity();
+ responseBody = EntityUtils.toString(entity);
+ } catch (IOException e) {
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR, ErrorCode.SchemaError)
+ .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+
+
+ ValidateException validateException =
+ new ValidateException.Builder("IOException getting Camunda response body",
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+ throw validateException;
+ }
+
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ response = mapper.readValue(responseBody, CamundaResponse.class);
+ } catch (IOException e) {
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
+ .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+
+
+ ValidateException validateException =
+ new ValidateException.Builder("Cannot parse Camunda Response", HttpStatus.SC_BAD_REQUEST,
+ ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
+ throw validateException;
+ }
+ if (response != null) {
+ responseBody = response.getResponse();
+ } else {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER,
+ ErrorCode.BusinessProcesssError).targetEntity("Camunda").targetServiceName("parseCamunda").build();
+ BPMNFailureException bpmnFailureException =
+ new BPMNFailureException.Builder(String.valueOf(status), status, ErrorNumbers.ERROR_FROM_BPEL)
+ .errorInfo(errorLoggerInfo).build();
+ }
+ }
+
+ private void parseBpel() throws ApiException {
+
+ HttpEntity bpelEntity = httpResponse.getEntity();
+
+ try {
+ if (bpelEntity != null) {
+ responseBody = EntityUtils.toString(bpelEntity);
+
+ }
+ } catch (IOException e) {
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build();
+ ValidateException validateException =
+ new ValidateException.Builder("Could not convert BPEL response to string",
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+ throw validateException;
+ }
+ if (status != HttpStatus.SC_ACCEPTED) {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER,
+ ErrorCode.BusinessProcesssError).targetEntity("BPEL").targetServiceName("parseBpel").build();
+
+
+ BPMNFailureException bpmnFailureException =
+ new BPMNFailureException.Builder(String.valueOf(status), status, ErrorNumbers.ERROR_FROM_BPEL)
+ .errorInfo(errorLoggerInfo).build();
+
+ throw bpmnFailureException;
+ }
+
+ }
+
+ private void parseCamundaTask() throws ApiException {
+
+ HttpEntity camundataskEntity = httpResponse.getEntity();
+
+ try {
+ if (camundataskEntity != null) {
+ responseBody = EntityUtils.toString(camundataskEntity);
}
- }
-
- private void parseBpel() throws ApiException{
-
- HttpEntity bpelEntity = httpResponse.getEntity();
-
- try {
- if (bpelEntity != null) {
- responseBody = EntityUtils.toString(bpelEntity);
-
- }
- }catch(IOException e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build();
- ValidateException validateException = new ValidateException.Builder("Could not convert BPEL response to string", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
- .errorInfo(errorLoggerInfo).build();
- throw validateException;
- }
- if(status!=HttpStatus.SC_ACCEPTED){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, ErrorCode.BusinessProcesssError)
- .targetEntity("BPEL").targetServiceName("parseBpel").build();
-
-
- BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(status), status, ErrorNumbers.ERROR_FROM_BPEL)
- .errorInfo(errorLoggerInfo).build();
-
- throw bpmnFailureException;
- }
-
- }
-
- private void parseCamundaTask() throws ApiException{
-
- HttpEntity camundataskEntity = httpResponse.getEntity();
-
- try {
- if (camundataskEntity != null) {
- responseBody = EntityUtils.toString(camundataskEntity);
- }
- }catch(IOException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build();
-
-
- ValidateException validateException = new ValidateException.Builder("Could not convert CamundaTask response to string", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
- .errorInfo(errorLoggerInfo).build();
- throw validateException;
- }
- if(status!=HttpStatus.SC_NO_CONTENT && status != HttpStatus.SC_ACCEPTED){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, ErrorCode.BusinessProcesssError)
- .targetEntity("CAMUNDATASK").targetServiceName("parseCamundaTask").build();
-
-
- BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(status), status, ErrorNumbers.ERROR_FROM_BPEL)
- .errorInfo(errorLoggerInfo).build();
-
- throw bpmnFailureException;
- }
-
- }
-
- private int setStatus(int statusCode){
- int httpStatus;
- switch(statusCode) {
- case HttpStatus.SC_ACCEPTED:
- case HttpStatus.SC_OK:
- httpStatus = HttpStatus.SC_ACCEPTED;
- break;
- case HttpStatus.SC_BAD_REQUEST:
- httpStatus = HttpStatus.SC_BAD_REQUEST;
- break;
- case HttpStatus.SC_UNAUTHORIZED:
- case HttpStatus.SC_FORBIDDEN:
- httpStatus = HttpStatus.SC_INTERNAL_SERVER_ERROR;
- break;
- case HttpStatus.SC_NOT_FOUND:
- httpStatus = HttpStatus.SC_NOT_IMPLEMENTED;
- break;
- case HttpStatus.SC_INTERNAL_SERVER_ERROR:
- httpStatus = HttpStatus.SC_BAD_GATEWAY;
- break;
- case HttpStatus.SC_SERVICE_UNAVAILABLE:
- httpStatus = HttpStatus.SC_SERVICE_UNAVAILABLE;
- break;
- case HttpStatus.SC_NO_CONTENT:
- httpStatus = HttpStatus.SC_NO_CONTENT;
- break;
- default:
- httpStatus = HttpStatus.SC_INTERNAL_SERVER_ERROR;
- break;
- }
- return httpStatus;
- }
-
-
- public CamundaResponse getResponse() {
- return response;
- }
-
-
- public void setResponse(CamundaResponse response) {
- this.response = response;
- }
-
-
- public String getResponseBody() {
- return responseBody;
- }
-
-
- public void setResponseBody(String responseBody) {
- this.responseBody = responseBody;
- }
-
-
- public int getStatus() {
- return status;
- }
+ } catch (IOException e) {
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build();
+
+
+ ValidateException validateException =
+ new ValidateException.Builder("Could not convert CamundaTask response to string",
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+ throw validateException;
+ }
+ if (status != HttpStatus.SC_NO_CONTENT && status != HttpStatus.SC_ACCEPTED) {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER,
+ ErrorCode.BusinessProcesssError).targetEntity("CAMUNDATASK").targetServiceName("parseCamundaTask")
+ .build();
+
+
+ BPMNFailureException bpmnFailureException =
+ new BPMNFailureException.Builder(String.valueOf(status), status, ErrorNumbers.ERROR_FROM_BPEL)
+ .errorInfo(errorLoggerInfo).build();
+
+ throw bpmnFailureException;
+ }
+
+ }
+
+ private int setStatus(int statusCode) {
+ int httpStatus;
+ switch (statusCode) {
+ case HttpStatus.SC_ACCEPTED:
+ case HttpStatus.SC_OK:
+ httpStatus = HttpStatus.SC_ACCEPTED;
+ break;
+ case HttpStatus.SC_BAD_REQUEST:
+ httpStatus = HttpStatus.SC_BAD_REQUEST;
+ break;
+ case HttpStatus.SC_UNAUTHORIZED:
+ case HttpStatus.SC_FORBIDDEN:
+ httpStatus = HttpStatus.SC_INTERNAL_SERVER_ERROR;
+ break;
+ case HttpStatus.SC_NOT_FOUND:
+ httpStatus = HttpStatus.SC_NOT_IMPLEMENTED;
+ break;
+ case HttpStatus.SC_INTERNAL_SERVER_ERROR:
+ httpStatus = HttpStatus.SC_BAD_GATEWAY;
+ break;
+ case HttpStatus.SC_SERVICE_UNAVAILABLE:
+ httpStatus = HttpStatus.SC_SERVICE_UNAVAILABLE;
+ break;
+ case HttpStatus.SC_NO_CONTENT:
+ httpStatus = HttpStatus.SC_NO_CONTENT;
+ break;
+ default:
+ httpStatus = HttpStatus.SC_INTERNAL_SERVER_ERROR;
+ break;
+ }
+ return httpStatus;
+ }
+
+
+ public CamundaResponse getResponse() {
+ return response;
+ }
+
+
+ public void setResponse(CamundaResponse response) {
+ this.response = response;
+ }
+
+
+ public String getResponseBody() {
+ return responseBody;
+ }
+
+
+ public void setResponseBody(String responseBody) {
+ this.responseBody = responseBody;
+ }
+
+
+ public int getStatus() {
+ return status;
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java
index c3dfe2c685..b972f7e1db 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java
@@ -25,18 +25,15 @@ package org.onap.so.apihandler.common;
import java.io.FileInputStream;
import java.io.IOException;
-
import javax.xml.XMLConstants;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
-
import org.apache.commons.io.IOUtils;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.SAXException;
@@ -46,7 +43,7 @@ public class XMLValidator {
private static String XSDS_PATH;
static {
- String prefixMsoPropertiesPath = System.getProperty ("mso.config.path");
+ String prefixMsoPropertiesPath = System.getProperty("mso.config.path");
if (prefixMsoPropertiesPath == null) {
prefixMsoPropertiesPath = "";
}
@@ -61,44 +58,44 @@ public class XMLValidator {
private static Logger logger = LoggerFactory.getLogger(XMLValidator.class);
- public XMLValidator (String xsdFile){
+ public XMLValidator(String xsdFile) {
- try (FileInputStream xsdStream = new FileInputStream (XSDS_PATH + xsdFile)) {
+ try (FileInputStream xsdStream = new FileInputStream(XSDS_PATH + xsdFile)) {
- stringXsd = IOUtils.toString (xsdStream);
+ stringXsd = IOUtils.toString(xsdStream);
- factory = SchemaFactory.newInstance (XMLConstants.W3C_XML_SCHEMA_NS_URI);
- factory.setResourceResolver (new PathResourceResolver (XSDS_PATH));
- factory.setFeature (XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ factory.setResourceResolver(new PathResourceResolver(XSDS_PATH));
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
- String quotedXsd = stringXsd.replaceAll ("&#34;", "\"");
- Source src = new StreamSource (new java.io.StringReader (quotedXsd));
- schema = factory.newSchema (src);
+ String quotedXsd = stringXsd.replaceAll("&#34;", "\"");
+ Source src = new StreamSource(new java.io.StringReader(quotedXsd));
+ schema = factory.newSchema(src);
} catch (IOException | SAXException e) {
- logger.debug ("Cannot open file {}", XSDS_PATH + xsdFile, e);
- errorMsg = "ErrorDetails: xsd file " + xsdFile + "could not be opened - " + e.getMessage ();
+ logger.debug("Cannot open file {}", XSDS_PATH + xsdFile, e);
+ errorMsg = "ErrorDetails: xsd file " + xsdFile + "could not be opened - " + e.getMessage();
}
}
// Returns null when XML valid, otherwise returns error details.
- public String isXmlValid (String stringXml) {
+ public String isXmlValid(String stringXml) {
try {
- if (errorMsg != null && !errorMsg.isEmpty ()) {
+ if (errorMsg != null && !errorMsg.isEmpty()) {
return errorMsg;
}
- Source src2 = new StreamSource (new java.io.StringReader (stringXml));
- Validator validator = schema.newValidator ();
- validator.validate (src2);
+ Source src2 = new StreamSource(new java.io.StringReader(stringXml));
+ Validator validator = schema.newValidator();
+ validator.validate(src2);
} catch (IOException | SAXException e) {
- logger.debug ("Exception: ", e);
- return "ErrorDetails: " + e.getMessage ();
+ logger.debug("Exception: ", e);
+ return "ErrorDetails: " + e.getMessage();
} catch (Exception e) {
- logger.error("{} {} {}", MessageEnum.APIH_CANNOT_READ_SCHEMA.toString(),
- ErrorCode.SchemaError.getValue(), "APIH cannot read schema file", e);
+ logger.error("{} {} {}", MessageEnum.APIH_CANNOT_READ_SCHEMA.toString(), ErrorCode.SchemaError.getValue(),
+ "APIH cannot read schema file", e);
return "ErrorDetails: " + "Unable to read the schema file";
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/RequestIdFilter.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/RequestIdFilter.java
new file mode 100644
index 0000000000..399e0650f9
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/RequestIdFilter.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.apihandler.filters;
+
+import java.io.IOException;
+import javax.annotation.Priority;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
+import javax.ws.rs.ext.Provider;
+import org.apache.http.HttpStatus;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.slf4j.MDC;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Priority(2)
+@Provider
+@Component
+public class RequestIdFilter implements ContainerRequestFilter {
+
+ protected static Logger logger = LoggerFactory.getLogger(RequestIdFilter.class);
+
+ @Autowired
+ private RequestsDbClient infraActiveRequestsClient;
+
+ @Override
+ public void filter(ContainerRequestContext context) throws IOException {
+ String requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID);
+
+ InfraActiveRequests infraActiveRequests = infraActiveRequestsClient.getInfraActiveRequestbyRequestId(requestId);
+
+ if (infraActiveRequests != null) {
+ MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(HttpStatus.SC_BAD_REQUEST));
+ logger.error("RequestID exists in RequestDB.InfraActiveRequests : " + requestId);
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java
index aeed65b3c3..403dd920e8 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java
@@ -23,7 +23,6 @@
package org.onap.so.apihandler.recipe;
import java.io.IOException;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
@@ -32,21 +31,20 @@ import org.springframework.web.client.ResponseErrorHandler;
-public class CamundaClientErrorHandler implements ResponseErrorHandler{
-
- private static Logger logger = LoggerFactory.getLogger(CamundaClientErrorHandler.class);
-
- @Override
- public void handleError(ClientHttpResponse response) throws IOException {
+public class CamundaClientErrorHandler implements ResponseErrorHandler {
+
+ private static Logger logger = LoggerFactory.getLogger(CamundaClientErrorHandler.class);
+
+ @Override
+ public void handleError(ClientHttpResponse response) throws IOException {
+
+ logger.debug(response.getBody().toString());
+ }
- logger.debug(response.getBody().toString());
- }
+ @Override
+ public boolean hasError(ClientHttpResponse response) throws IOException {
+ HttpStatus.Series series = response.getStatusCode().series();
+ return (HttpStatus.Series.CLIENT_ERROR.equals(series) || HttpStatus.Series.SERVER_ERROR.equals(series));
+ }
- @Override
- public boolean hasError(ClientHttpResponse response) throws IOException {
- HttpStatus.Series series = response.getStatusCode().series();
- return (HttpStatus.Series.CLIENT_ERROR.equals(series)
- || HttpStatus.Series.SERVER_ERROR.equals(series));
- }
-
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java
index 897e2a5fc8..77dbff9ebb 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java
@@ -22,29 +22,7 @@ package org.onap.so.apihandlerinfra;
/*
* Enum for Status values returned by API Handler to Tail-F
-*/
-public enum Action implements Actions{
- createInstance,
- updateInstance,
- deleteInstance,
- configureInstance,
- replaceInstance,
- activateInstance,
- deactivateInstance,
- enablePort,
- disablePort,
- addRelationships,
- removeRelationships,
- inPlaceSoftwareUpdate,
- applyUpdatedConfig,
- completeTask,
- assignInstance,
- unassignInstance,
- compareModel,
- scaleInstance,
- deactivateAndCloudDelete,
- scaleOut,
- recreateInstance,
- addMembers,
- removeMembers
+ */
+public enum Action implements Actions {
+ createInstance, updateInstance, deleteInstance, configureInstance, replaceInstance, activateInstance, deactivateInstance, enablePort, disablePort, addRelationships, removeRelationships, inPlaceSoftwareUpdate, applyUpdatedConfig, completeTask, assignInstance, unassignInstance, compareModel, scaleInstance, deactivateAndCloudDelete, scaleOut, recreateInstance, addMembers, removeMembers
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java
index d824696147..0bbc3e336f 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java
@@ -23,32 +23,31 @@ package org.onap.so.apihandlerinfra;
public class Constants {
- private Constants() {
- }
+ private Constants() {}
- public static final String REQUEST_ID_PATH = "/{request-id}";
+ public static final String REQUEST_ID_PATH = "/{request-id}";
- public static final String STATUS_SUCCESS = "SUCCESS";
+ public static final String STATUS_SUCCESS = "SUCCESS";
- public static final String MODIFIED_BY_APIHANDLER = "APIH";
+ public static final String MODIFIED_BY_APIHANDLER = "APIH";
- public static final long PROGRESS_REQUEST_COMPLETED = 100L;
- public static final long PROGRESS_REQUEST_RECEIVED = 0L;
- public static final long PROGRESS_REQUEST_IN_PROGRESS = 20L;
+ public static final long PROGRESS_REQUEST_COMPLETED = 100L;
+ public static final long PROGRESS_REQUEST_RECEIVED = 0L;
+ public static final long PROGRESS_REQUEST_IN_PROGRESS = 20L;
- public static final String VNF_TYPE_WILDCARD = "*";
+ public static final String VNF_TYPE_WILDCARD = "*";
- public static final String VOLUME_GROUP_COMPONENT_TYPE = "VOLUME_GROUP";
+ public static final String VOLUME_GROUP_COMPONENT_TYPE = "VOLUME_GROUP";
- public static final String VALID_INSTANCE_NAME_FORMAT = "^[a-zA-Z][a-zA-Z0-9._-]*$";
+ public static final String VALID_INSTANCE_NAME_FORMAT = "^[a-zA-Z][a-zA-Z0-9._-]*$";
+
+ public static final String A_LA_CARTE = "aLaCarte";
+
+ public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+
+ public final static String VNF_REQUEST_SCOPE = "vnf";
+ public final static String SERVICE_INSTANCE_PATH = "/serviceInstances";
+ public final static String SERVICE_INSTANTIATION_PATH = "/serviceInstantiation";
+ public final static String ORCHESTRATION_REQUESTS_PATH = "/orchestrationRequests";
- public static final String A_LA_CARTE = "aLaCarte";
-
- public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
-
- public final static String VNF_REQUEST_SCOPE = "vnf";
- public final static String SERVICE_INSTANCE_PATH = "/serviceInstances";
- public final static String SERVICE_INSTANTIATION_PATH = "/serviceInstantiation";
- public final static String ORCHESTRATION_REQUESTS_PATH = "/orchestrationRequests";
-
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Messages.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Messages.java
index 555c536efb..c313cba032 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Messages.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Messages.java
@@ -23,34 +23,39 @@ package org.onap.so.apihandlerinfra;
import java.util.HashMap;
import java.util.Map;
-
import org.onap.so.apihandler.common.ErrorNumbers;
public class Messages {
- protected static final Map<String,String> errors = new HashMap<>();
- static {
- errors.put(ErrorNumbers.REQUEST_FAILED_SCHEMA_VALIDATION + "_service", "Service request FAILED schema validation. %s");
- errors.put(ErrorNumbers.REQUEST_FAILED_SCHEMA_VALIDATION + "_feature", "Feature request FAILED schema validation. %s");
- errors.put(ErrorNumbers.RECIPE_DOES_NOT_EXIST, "Recipe for %s-type and action specified does not exist in catalog %s");
- errors.put(ErrorNumbers.SERVICE_PARAMETERS_FAILED_SCHEMA_VALIDATION, "Service specific parameters passed in request FAILED schema validation. %s");
-
- errors.put(ErrorNumbers.LOCKED_CREATE_ON_THE_SAME_VNF_NAME_IN_PROGRESS, "%s-name (%s) is locked (status = %s) because already working on a CREATE request with same %s-name.");
- errors.put(ErrorNumbers.LOCKED_SAME_ACTION_AND_VNF_ID, "%s-id (%s) is locked (status = %s) because already working on a request with same action (%s) for this %s-id.");
- errors.put(ErrorNumbers.REQUEST_TIMED_OUT, "Service request timed out before completing");
- errors.put(ErrorNumbers.ERROR_FROM_BPEL, "BPEL returned an error: %s");
- errors.put(ErrorNumbers.NO_COMMUNICATION_TO_BPEL, "Could not communicate with BPEL %s");
- errors.put(ErrorNumbers.NO_RESPONSE_FROM_BPEL, "No response from BPEL %s");
- errors.put(ErrorNumbers.COULD_NOT_WRITE_TO_REQUESTS_DB, "Could not insert or update record in MSO_REQUESTS DB %s");
- errors.put(ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, "Could not communicate with MSO_REQUESTS DB %s");
- errors.put(ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB, "Could not communicate with MSO_CATALOG DB %s");
- errors.put(ErrorNumbers.ERROR_FROM_CATALOG_DB, "Received error from MSO_CATALOG DB %s");
- }
-
- private Messages(){
- }
-
- public static Map<String,String> getErrors() {
- return errors;
- }
+ protected static final Map<String, String> errors = new HashMap<>();
+ static {
+ errors.put(ErrorNumbers.REQUEST_FAILED_SCHEMA_VALIDATION + "_service",
+ "Service request FAILED schema validation. %s");
+ errors.put(ErrorNumbers.REQUEST_FAILED_SCHEMA_VALIDATION + "_feature",
+ "Feature request FAILED schema validation. %s");
+ errors.put(ErrorNumbers.RECIPE_DOES_NOT_EXIST,
+ "Recipe for %s-type and action specified does not exist in catalog %s");
+ errors.put(ErrorNumbers.SERVICE_PARAMETERS_FAILED_SCHEMA_VALIDATION,
+ "Service specific parameters passed in request FAILED schema validation. %s");
+
+ errors.put(ErrorNumbers.LOCKED_CREATE_ON_THE_SAME_VNF_NAME_IN_PROGRESS,
+ "%s-name (%s) is locked (status = %s) because already working on a CREATE request with same %s-name.");
+ errors.put(ErrorNumbers.LOCKED_SAME_ACTION_AND_VNF_ID,
+ "%s-id (%s) is locked (status = %s) because already working on a request with same action (%s) for this %s-id.");
+ errors.put(ErrorNumbers.REQUEST_TIMED_OUT, "Service request timed out before completing");
+ errors.put(ErrorNumbers.ERROR_FROM_BPEL, "BPEL returned an error: %s");
+ errors.put(ErrorNumbers.NO_COMMUNICATION_TO_BPEL, "Could not communicate with BPEL %s");
+ errors.put(ErrorNumbers.NO_RESPONSE_FROM_BPEL, "No response from BPEL %s");
+ errors.put(ErrorNumbers.COULD_NOT_WRITE_TO_REQUESTS_DB,
+ "Could not insert or update record in MSO_REQUESTS DB %s");
+ errors.put(ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, "Could not communicate with MSO_REQUESTS DB %s");
+ errors.put(ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB, "Could not communicate with MSO_CATALOG DB %s");
+ errors.put(ErrorNumbers.ERROR_FROM_CATALOG_DB, "Received error from MSO_CATALOG DB %s");
+ }
+
+ private Messages() {}
+
+ public static Map<String, String> getErrors() {
+ return errors;
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/ModelType.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/ModelType.java
index 7b3ea3a181..0c10599a52 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/ModelType.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/ModelType.java
@@ -22,11 +22,7 @@ package org.onap.so.apihandlerinfra;
/*
* Enum for Status values returned by API Handler to Tail-F
-*/
+ */
public enum ModelType {
- service,
- vnf,
- vfModule,
- volumeGroup,
- network
+ service, vnf, vfModule, volumeGroup, network
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/MsoException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/MsoException.java
index defc904b05..ed2946d78a 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/MsoException.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/MsoException.java
@@ -21,6 +21,5 @@
package org.onap.so.apihandlerinfra;
public enum MsoException {
- ServiceException,
- PolicyException,
+ ServiceException, PolicyException,
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Status.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Status.java
index fe9764a2f2..b791bf147b 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Status.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Status.java
@@ -23,14 +23,7 @@ package org.onap.so.apihandlerinfra;
/*
* Enum for Status values returned by API Handler to Tail-F
-*/
+ */
public enum Status {
- PENDING,
- IN_PROGRESS,
- COMPLETE,
- COMPLETED,
- FAILED,
- TIMEOUT,
- UNLOCKED,
- PENDING_MANUAL_TASK
+ PENDING, IN_PROGRESS, COMPLETE, COMPLETED, FAILED, TIMEOUT, UNLOCKED, PENDING_MANUAL_TASK
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiException.java
index fdf6b80e1c..c7f6459482 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiException.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiException.java
@@ -22,36 +22,34 @@ package org.onap.so.apihandlerinfra.exceptions;
import java.util.List;
-
-
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
-public abstract class ApiException extends Exception{
+public abstract class ApiException extends Exception {
/**
- *
- */
- private static final long serialVersionUID = 683162058616691134L;
- private int httpResponseCode;
+ *
+ */
+ private static final long serialVersionUID = 683162058616691134L;
+ private int httpResponseCode;
private String messageID;
private ErrorLoggerInfo errorLoggerInfo;
- private List<String> variables;
+ private List<String> variables;
- public ApiException(Builder builder){
+ public ApiException(Builder builder) {
super(builder.message, builder.cause);
this.httpResponseCode = builder.httpResponseCode;
this.messageID = builder.messageID;
this.variables = builder.variables;
this.errorLoggerInfo = builder.errorLoggerInfo;
- this.variables = builder.variables;
+ this.variables = builder.variables;
}
public ApiException(String message, Throwable cause) {
- super(message, cause);
- }
+ super(message, cause);
+ }
- public String getMessageID() {
+ public String getMessageID() {
return messageID;
}
@@ -76,7 +74,7 @@ public abstract class ApiException extends Exception{
private ErrorLoggerInfo errorLoggerInfo = null;
private List<String> variables = null;
-
+
public Builder(String message, int httpResponseCode, String messageID) {
this.message = message;
this.httpResponseCode = httpResponseCode;
@@ -103,7 +101,7 @@ public abstract class ApiException extends Exception{
return (T) this;
}
- public T errorInfo(ErrorLoggerInfo errorLoggerInfo){
+ public T errorInfo(ErrorLoggerInfo errorLoggerInfo) {
this.errorLoggerInfo = errorLoggerInfo;
return (T) this;
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java
index 4c069d5b1a..3b977639fc 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java
@@ -27,7 +27,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
-
import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
@@ -37,15 +36,11 @@ import javax.ws.rs.ext.Provider;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
-
-
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-
import org.onap.so.serviceinstancebeans.RequestError;
import org.onap.so.serviceinstancebeans.ServiceException;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -58,7 +53,7 @@ public class ApiExceptionMapper implements ExceptionMapper<ApiException> {
private static Logger logger = LoggerFactory.getLogger(ApiExceptionMapper.class);
-
+
private final JAXBContext context;
private final Marshaller marshaller;
@@ -66,14 +61,15 @@ public class ApiExceptionMapper implements ExceptionMapper<ApiException> {
private HttpHeaders headers;
public ApiExceptionMapper() {
- try {
- context = JAXBContext.newInstance(RequestError.class);
- marshaller = context.createMarshaller();
- } catch (JAXBException e) {
- logger.debug("could not create JAXB marshaller");
- throw new IllegalStateException(e);
- }
+ try {
+ context = JAXBContext.newInstance(RequestError.class);
+ marshaller = context.createMarshaller();
+ } catch (JAXBException e) {
+ logger.debug("could not create JAXB marshaller");
+ throw new IllegalStateException(e);
+ }
}
+
@Override
public Response toResponse(ApiException exception) {
@@ -93,23 +89,24 @@ public class ApiExceptionMapper implements ExceptionMapper<ApiException> {
}
-
+
List<MediaType> typeList = Optional.ofNullable(headers.getAcceptableMediaTypes()).orElse(new ArrayList<>());
List<String> typeListString = typeList.stream().map(item -> item.toString()).collect(Collectors.toList());
MediaType type;
if (typeListString.stream().anyMatch(item -> item.contains(MediaType.APPLICATION_XML))) {
- type = MediaType.APPLICATION_XML_TYPE;
+ type = MediaType.APPLICATION_XML_TYPE;
} else if (typeListString.stream().anyMatch(item -> typeListString.contains(MediaType.APPLICATION_JSON))) {
- type = MediaType.APPLICATION_JSON_TYPE;
+ type = MediaType.APPLICATION_JSON_TYPE;
} else {
- type = MediaType.APPLICATION_JSON_TYPE;
+ type = MediaType.APPLICATION_JSON_TYPE;
}
- return buildServiceErrorResponse(errorText,messageId,variables, type);
+ return buildServiceErrorResponse(errorText, messageId, variables, type);
}
- protected String buildServiceErrorResponse(String errorText, String messageId, List<String> variables, MediaType type){
+ protected String buildServiceErrorResponse(String errorText, String messageId, List<String> variables,
+ MediaType type) {
RequestError re = new RequestError();
ServiceException se = new ServiceException();
se.setMessageId(messageId);
@@ -123,21 +120,22 @@ public class ApiExceptionMapper implements ExceptionMapper<ApiException> {
String requestErrorStr;
ObjectMapper mapper = createObjectMapper();
-
+
mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
mapper.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT);
try {
- if (MediaType.APPLICATION_JSON_TYPE.equals(type)) {
- requestErrorStr = mapper.writeValueAsString(re);
+ if (MediaType.APPLICATION_JSON_TYPE.equals(type)) {
+ requestErrorStr = mapper.writeValueAsString(re);
} else {
- StringWriter sw = new StringWriter();
- this.getMarshaller().marshal(re, sw);
- requestErrorStr = sw.toString();
+ StringWriter sw = new StringWriter();
+ this.getMarshaller().marshal(re, sw);
+ requestErrorStr = sw.toString();
}
} catch (JsonProcessingException | JAXBException e) {
- String errorMsg = "Exception in buildServiceErrorResponse writing exceptionType to string " + e.getMessage();
+ String errorMsg =
+ "Exception in buildServiceErrorResponse writing exceptionType to string " + e.getMessage();
logger.error("{} {} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), "BuildServiceErrorResponse",
- ErrorCode.DataError.getValue(), errorMsg, e);
+ ErrorCode.DataError.getValue(), errorMsg, e);
return errorMsg;
}
@@ -145,19 +143,21 @@ public class ApiExceptionMapper implements ExceptionMapper<ApiException> {
}
protected void writeErrorLog(Exception e, String errorText, ErrorLoggerInfo errorLogInfo) {
- if( e!= null)
+ if (e != null)
logger.error("Exception occurred", e);
- if(errorLogInfo != null)
- logger.error(errorLogInfo.getLoggerMessageType().toString(), errorLogInfo.getErrorSource(), errorLogInfo.getTargetEntity(), errorLogInfo.getTargetServiceName(), errorLogInfo.getErrorCode(), errorText);
-
+ if (errorLogInfo != null)
+ logger.error(errorLogInfo.getLoggerMessageType().toString(), errorLogInfo.getErrorSource(),
+ errorLogInfo.getTargetEntity(), errorLogInfo.getTargetServiceName(), errorLogInfo.getErrorCode(),
+ errorText);
+
}
- public ObjectMapper createObjectMapper(){
+ public ObjectMapper createObjectMapper() {
return new ObjectMapper();
}
-
+
public Marshaller getMarshaller() {
- return marshaller;
+ return marshaller;
}
-
+
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/BPMNFailureException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/BPMNFailureException.java
index 8c215de213..97d46bd6f1 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/BPMNFailureException.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/BPMNFailureException.java
@@ -28,11 +28,11 @@ public class BPMNFailureException extends ApiException {
super(builder);
}
- public static class Builder extends ApiException.Builder<Builder>{
+ public static class Builder extends ApiException.Builder<Builder> {
public Builder(String message, int httpResponseCode, String messageID) {
- super(bpmnFailMessage.replaceAll ("\\$HTTPSTATUS", message),httpResponseCode,messageID);
+ super(bpmnFailMessage.replaceAll("\\$HTTPSTATUS", message), httpResponseCode, messageID);
}
public BPMNFailureException build() {
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ClientConnectionException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ClientConnectionException.java
index cf4c9168ea..4af5289ad7 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ClientConnectionException.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ClientConnectionException.java
@@ -23,19 +23,19 @@ package org.onap.so.apihandlerinfra.exceptions;
public class ClientConnectionException extends ApiException {
/**
- *
- */
- private static final long serialVersionUID = 1L;
- private static final String clientFailMessage = "Client from $URL failed to connect";
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private static final String clientFailMessage = "Client from $URL failed to connect";
private ClientConnectionException(Builder builder) {
super(builder);
}
- public static class Builder extends ApiException.Builder<Builder>{
+ public static class Builder extends ApiException.Builder<Builder> {
public Builder(String message, int httpResponseCode, String messageID) {
- super(clientFailMessage.replaceAll ("\\$URL", message),httpResponseCode,messageID);
+ super(clientFailMessage.replaceAll("\\$URL", message), httpResponseCode, messageID);
}
public ClientConnectionException build() {
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ContactCamundaException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ContactCamundaException.java
index e1ec46a9c1..6b38eec4ae 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ContactCamundaException.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ContactCamundaException.java
@@ -22,17 +22,19 @@ package org.onap.so.apihandlerinfra.exceptions;
public class ContactCamundaException extends ApiException {
- private static final String contactCamundaErrorMessage = "Unable to get process-instance history from Camunda for requestId: %s due to error: %s";
+ private static final String contactCamundaErrorMessage =
+ "Unable to get process-instance history from Camunda for requestId: %s due to error: %s";
private ContactCamundaException(Builder builder) {
super(builder);
}
- public static class Builder extends ApiException.Builder<Builder>{
+ public static class Builder extends ApiException.Builder<Builder> {
public Builder(String requestId, String error, int httpResponseCode, String messageID) {
- super(contactCamundaErrorMessage.format(contactCamundaErrorMessage, requestId, error),httpResponseCode,messageID);
+ super(contactCamundaErrorMessage.format(contactCamundaErrorMessage, requestId, error), httpResponseCode,
+ messageID);
}
public ContactCamundaException build() {
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestException.java
index 718dc6421d..21e9b44b19 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestException.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestException.java
@@ -22,18 +22,21 @@ package org.onap.so.apihandlerinfra.exceptions;
public class DuplicateRequestException extends ApiException {
- private static final String duplicateFailMessage = "Error: Locked instance - This %s (%s) " + "already has a request being worked with a status of %s (RequestId - %s). The existing request must finish or be cleaned up before proceeding.";
+ private static final String duplicateFailMessage = "Error: Locked instance - This %s (%s) "
+ + "already has a request being worked with a status of %s (RequestId - %s). The existing request must finish or be cleaned up before proceeding.";
private DuplicateRequestException(Builder builder) {
super(builder);
}
- public static class Builder extends ApiException.Builder<Builder>{
+ public static class Builder extends ApiException.Builder<Builder> {
- public Builder(String requestScope,String instance, String requestStatus, String requestID, int httpResponseCode, String messageID) {
- super(String.format(duplicateFailMessage,requestScope,instance,requestStatus,requestID),httpResponseCode,messageID);
+ public Builder(String requestScope, String instance, String requestStatus, String requestID,
+ int httpResponseCode, String messageID) {
+ super(String.format(duplicateFailMessage, requestScope, instance, requestStatus, requestID),
+ httpResponseCode, messageID);
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/RequestDbFailureException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/RequestDbFailureException.java
index 154ae36d41..577a14674b 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/RequestDbFailureException.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/RequestDbFailureException.java
@@ -28,11 +28,11 @@ public class RequestDbFailureException extends ApiException {
super(builder);
}
- public static class Builder extends ApiException.Builder<Builder>{
+ public static class Builder extends ApiException.Builder<Builder> {
public Builder(String action, String error, int httpResponseCode, String messageID) {
- super(requestDbFailMessage.format(requestDbFailMessage, action, error),httpResponseCode,messageID);
+ super(requestDbFailMessage.format(requestDbFailMessage, action, error), httpResponseCode, messageID);
}
public RequestDbFailureException build() {
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ValidateException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ValidateException.java
index b0cf39e1a2..372ed30d8e 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ValidateException.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ValidateException.java
@@ -28,10 +28,10 @@ public class ValidateException extends ApiException {
}
- public static class Builder extends ApiException.Builder<Builder>{
+ public static class Builder extends ApiException.Builder<Builder> {
public Builder(String message, int httpResponseCode, String messageID) {
- super(message,httpResponseCode,messageID);
+ super(message, httpResponseCode, messageID);
}
public ValidateException build() {
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/VfModuleNotFoundException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/VfModuleNotFoundException.java
index d80f2f7b48..cbd3f65a61 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/VfModuleNotFoundException.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/VfModuleNotFoundException.java
@@ -24,19 +24,20 @@ public class VfModuleNotFoundException extends ApiException {
/**
- *
- */
- private static final long serialVersionUID = 1L;
+ *
+ */
+ private static final long serialVersionUID = 1L;
- private VfModuleNotFoundException(Builder builder) {
+ private VfModuleNotFoundException(Builder builder) {
super(builder);
}
- public static class Builder extends ApiException.Builder<Builder>{
+ public static class Builder extends ApiException.Builder<Builder> {
public Builder(String message, int httpResponseCode, String messageID) {
- super(message,httpResponseCode,messageID);
+ super(message, httpResponseCode, messageID);
}
+
public VfModuleNotFoundException build() {
return new VfModuleNotFoundException(this);
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java
index 058d80868c..a896078d44 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java
@@ -21,24 +21,24 @@
package org.onap.so.apihandlerinfra.logging;
import java.io.Serializable;
-
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.ErrorCode;
-public class ErrorLoggerInfo implements Serializable{
+public class ErrorLoggerInfo implements Serializable {
/**
- *
- */
- private static final long serialVersionUID = -2917784544098682110L;
- private MessageEnum loggerMessageType;
+ *
+ */
+ private static final long serialVersionUID = -2917784544098682110L;
+ private MessageEnum loggerMessageType;
private String errorSource;
private String targetEntity;
private String targetServiceName;
private ErrorCode errorCode;
- private ErrorLoggerInfo(MessageEnum loggerMessageType, String errorSource, String targetEntity, String targetServiceName, ErrorCode errorCode){
+ private ErrorLoggerInfo(MessageEnum loggerMessageType, String errorSource, String targetEntity,
+ String targetServiceName, ErrorCode errorCode) {
this.loggerMessageType = loggerMessageType;
this.errorSource = errorSource;
this.targetEntity = targetEntity;
@@ -66,44 +66,44 @@ public class ErrorLoggerInfo implements Serializable{
return errorCode;
}
- public static class Builder{
+ public static class Builder {
private MessageEnum loggerMessageType;
private String errorSource = "";
private String targetEntity = "";
private String targetServiceName = "";
private ErrorCode errorCode;
- public Builder(MessageEnum loggerMessageType, ErrorCode errorCode){
+ public Builder(MessageEnum loggerMessageType, ErrorCode errorCode) {
this.loggerMessageType = loggerMessageType;
this.errorCode = errorCode;
}
- public Builder loggerMessageType(MessageEnum loggerMessageType){
+ public Builder loggerMessageType(MessageEnum loggerMessageType) {
this.loggerMessageType = loggerMessageType;
return this;
}
- public Builder errorSource(String errorSource){
+ public Builder errorSource(String errorSource) {
this.errorSource = errorSource;
return this;
}
- public Builder targetEntity(String targetEntity){
+ public Builder targetEntity(String targetEntity) {
this.targetEntity = targetEntity;
return this;
}
- public Builder targetServiceName(String targetServiceName){
+ public Builder targetServiceName(String targetServiceName) {
this.targetServiceName = targetServiceName;
return this;
}
- public Builder errorCode(ErrorCode errorCode){
+ public Builder errorCode(ErrorCode errorCode) {
this.errorCode = errorCode;
return this;
}
- public ErrorLoggerInfo build(){
+ public ErrorLoggerInfo build() {
return new ErrorLoggerInfo(loggerMessageType, errorSource, targetEntity, targetServiceName, errorCode);
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/camundabeans/BeansTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/camundabeans/BeansTest.java
index b596636f6d..af582fb868 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/camundabeans/BeansTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/camundabeans/BeansTest.java
@@ -21,7 +21,6 @@
package org.onap.so.apihandler.camundabeans;
import org.junit.Test;
-
import com.openpojo.validation.Validator;
import com.openpojo.validation.ValidatorBuilder;
import com.openpojo.validation.rule.impl.GetterMustExistRule;
@@ -39,34 +38,33 @@ import org.onap.so.openpojo.rules.ToStringTester;
public class BeansTest {
- private PojoClassFilter filterTestClasses = new FilterTestClasses();
-
- private PojoClassFilter enumFilter = new FilterEnum();
-
-
- @Test
- public void pojoStructure() {
- test("org.onap.so.apihandler.camundabeans");
- }
-
- private void test(String pojoPackage) {
- Validator validator = ValidatorBuilder.create()
-
-
-
-
- .with(new SetterTester())
- .with(new GetterTester())
- .with(new ToStringTester())
-
- .build();
-
-
- validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses,enumFilter,new FilterNonConcrete());
- }
- private static class FilterTestClasses implements PojoClassFilter {
- public boolean include(PojoClass pojoClass) {
- return !pojoClass.getSourcePath().contains("/test-classes/");
- }
- }
+ private PojoClassFilter filterTestClasses = new FilterTestClasses();
+
+ private PojoClassFilter enumFilter = new FilterEnum();
+
+
+ @Test
+ public void pojoStructure() {
+ test("org.onap.so.apihandler.camundabeans");
+ }
+
+ private void test(String pojoPackage) {
+ Validator validator = ValidatorBuilder.create()
+
+
+
+ .with(new SetterTester()).with(new GetterTester()).with(new ToStringTester())
+
+ .build();
+
+
+ validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses, enumFilter,
+ new FilterNonConcrete());
+ }
+
+ private static class FilterTestClasses implements PojoClassFilter {
+ public boolean include(PojoClass pojoClass) {
+ return !pojoClass.getSourcePath().contains("/test-classes/");
+ }
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/camundabeans/BpmnRequestTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/camundabeans/BpmnRequestTest.java
index 7087e90b73..7291f87554 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/camundabeans/BpmnRequestTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/camundabeans/BpmnRequestTest.java
@@ -175,4 +175,4 @@ public class BpmnRequestTest {
bpmnRequest.setRequestDetails(new CamundaInput());
}
-} \ No newline at end of file
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequestSerializerTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequestSerializerTest.java
index 36966342b2..4636fcc90d 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequestSerializerTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequestSerializerTest.java
@@ -28,9 +28,11 @@ import org.junit.Test;
*/
public class CamundaMacroRequestSerializerTest {
@Test
- public void testWithAllParameters() throws Exception{
+ public void testWithAllParameters() throws Exception {
String jsonRequest = CamundaMacroRequestSerializer.getJsonRequest("requestId", "action", "serviceInstanceId");
Assert.assertNotNull(jsonRequest);
- Assert.assertEquals("{\"variables\":{\"mso-request-id\":{\"value\":\"requestId\",\"type\":\"String\"},\"gAction\":{\"value\":\"action\",\"type\":\"String\"},\"serviceInstanceId\":{\"value\":\"serviceInstanceId\",\"type\":\"String\"}}}", jsonRequest);
+ Assert.assertEquals(
+ "{\"variables\":{\"mso-request-id\":{\"value\":\"requestId\",\"type\":\"String\"},\"gAction\":{\"value\":\"action\",\"type\":\"String\"},\"serviceInstanceId\":{\"value\":\"serviceInstanceId\",\"type\":\"String\"}}}",
+ jsonRequest);
}
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/AllTestsTestSuite.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/AllTestsTestSuite.java
index 47c166eff9..d1558a2a2c 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/AllTestsTestSuite.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/AllTestsTestSuite.java
@@ -21,13 +21,12 @@
package org.onap.so.apihandler.common;
import org.junit.runner.RunWith;
-
import com.googlecode.junittoolbox.SuiteClasses;
import com.googlecode.junittoolbox.WildcardPatternSuite;
@RunWith(WildcardPatternSuite.class)
@SuiteClasses("**/*Test.class")
public class AllTestsTestSuite {
- // the class remains empty,
- // used only as a holder for the above annotations
+ // the class remains empty,
+ // used only as a holder for the above annotations
}
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 edab3b07b6..36d004e87d 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
@@ -29,11 +29,9 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
-
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.ProtocolVersion;
@@ -50,7 +48,6 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.springframework.mock.env.MockEnvironment;
-
import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.databind.JsonMappingException;
@@ -60,7 +57,7 @@ import com.fasterxml.jackson.databind.JsonMappingException;
*
*
*/
-public class CamundaClientTest{
+public class CamundaClientTest {
@@ -74,31 +71,31 @@ public class CamundaClientTest{
}
@Test
- public void tesCamundaPost() throws JsonGenerationException,
- JsonMappingException, IOException {
+ public void tesCamundaPost() throws JsonGenerationException, JsonMappingException, IOException {
- String responseBody ="{\"links\":[{\"method\":\"GET\",\"href\":\"http://localhost:9080/engine-rest/process-instance/2047c658-37ae-11e5-9505-7a1020524153\",\"rel\":\"self\"}],\"id\":\"2047c658-37ae-11e5-9505-7a1020524153\",\"definitionId\":\"dummy:10:73298961-37ad-11e5-9505-7a1020524153\",\"businessKey\":null,\"caseInstanceId\":null,\"ended\":true,\"suspended\":false}";
+ String responseBody =
+ "{\"links\":[{\"method\":\"GET\",\"href\":\"http://localhost:9080/engine-rest/process-instance/2047c658-37ae-11e5-9505-7a1020524153\",\"rel\":\"self\"}],\"id\":\"2047c658-37ae-11e5-9505-7a1020524153\",\"definitionId\":\"dummy:10:73298961-37ad-11e5-9505-7a1020524153\",\"businessKey\":null,\"caseInstanceId\":null,\"ended\":true,\"suspended\":false}";
HttpResponse mockResponse = createResponse(200, responseBody);
mockHttpClient = Mockito.mock(HttpClient.class);
ArgumentCaptor<HttpPost> httpPostCaptor = ArgumentCaptor.forClass(HttpPost.class);
- Mockito.when(mockHttpClient.execute(Mockito.any(HttpPost.class)))
- .thenReturn(mockResponse);
+ Mockito.when(mockHttpClient.execute(Mockito.any(HttpPost.class))).thenReturn(mockResponse);
String reqXML = "<xml>test</xml>";
String orchestrationURI = "/engine-rest/process-definition/key/dummy/start";
MockEnvironment environment = new MockEnvironment();
-
+
environment.setProperty("mso.camundaUR", "yourValue1");
- environment.setProperty("mso.camundaAuth", "E8E19DD16CC90D2E458E8FF9A884CC0452F8F3EB8E321F96038DE38D5C1B0B02DFAE00B88E2CF6E2A4101AB2C011FC161212EE");
+ environment.setProperty("mso.camundaAuth",
+ "E8E19DD16CC90D2E458E8FF9A884CC0452F8F3EB8E321F96038DE38D5C1B0B02DFAE00B88E2CF6E2A4101AB2C011FC161212EE");
environment.setProperty("org.onap.so.adapters.network.encryptionKey", "aa3871669d893c7fb8abbcda31b88b4f");
-
-
+
+
RequestClientFactory reqClientFactory = new RequestClientFactory();
reqClientFactory.setEnv(environment);
RequestClient requestClient = reqClientFactory.getRequestClient(orchestrationURI);
-
+
requestClient.setClient(mockHttpClient);
HttpResponse response = requestClient.post(reqXML, "reqId", "timeout", "version", null, null);
@@ -107,22 +104,21 @@ public class CamundaClientTest{
assertEquals(requestClient.getType(), CommonConstants.CAMUNDA);
assertEquals(statusCode, HttpStatus.SC_OK);
-
+
requestClient = reqClientFactory.getRequestClient(orchestrationURI);
requestClient.setClient(mockHttpClient);
response = requestClient.post(null, "reqId", null, null, null, null);
assertEquals(requestClient.getType(), CommonConstants.CAMUNDA);
assertEquals(statusCode, HttpStatus.SC_OK);
- verify(mockHttpClient,times(2)).execute(httpPostCaptor.capture());
+ verify(mockHttpClient, times(2)).execute(httpPostCaptor.capture());
assertThat(httpPostCaptor.getValue().getHeaders(AUTHORIZATION_HEADER_NAME)).isNotEmpty();
- Assert.assertEquals("Basic YXBpaEJwbW46Y2FtdW5kYS1SMTUxMiE=",httpPostCaptor.getValue().getHeaders(AUTHORIZATION_HEADER_NAME)[0].getValue());
+ Assert.assertEquals("Basic YXBpaEJwbW46Y2FtdW5kYS1SMTUxMiE=",
+ httpPostCaptor.getValue().getHeaders(AUTHORIZATION_HEADER_NAME)[0].getValue());
}
- private HttpResponse createResponse(int respStatus,
- String respBody) {
- HttpResponse response = new BasicHttpResponse(
- new BasicStatusLine(
- new ProtocolVersion("HTTP", 1, 1), respStatus, ""));
+ private HttpResponse createResponse(int respStatus, String respBody) {
+ HttpResponse response =
+ new BasicHttpResponse(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), respStatus, ""));
response.setStatusCode(respStatus);
try {
response.setEntity(new StringEntity(respBody));
@@ -132,62 +128,64 @@ public class CamundaClientTest{
}
return response;
}
-
- public String inputStream(String JsonInput)throws IOException{
+
+ public String inputStream(String JsonInput) throws IOException {
JsonInput = "src/test/resources/CamundaClientTest" + JsonInput;
String input = new String(Files.readAllBytes(Paths.get(JsonInput)));
return input;
}
-
+
@Test
- public void wrapVIDRequestTest() throws IOException{
- CamundaClient testClient = new CamundaClient();
- testClient.setUrl("/mso/async/services/CreateGenericALaCarteServiceInstance");
-
- String requestId = "f7ce78bb-423b-11e7-93f8-0050569a796";
- boolean isBaseVfModule = true;
- int recipeTimeout = 10000;
- String requestAction = "createInstance";
- String serviceInstanceId = "12345679";
- String pnfCorrelationId = "12345679";
- String vnfId = "234567891";
- String vfModuleId = "345678912";
- String volumeGroupId = "456789123";
- String networkId = "567891234";
- String configurationId = "678912345";
- String serviceType = "testService";
- String vnfType = "testVnf";
- String vfModuleType = "vfModuleType";
- String networkType = "networkType";
- String requestDetails = "{requestDetails: }";
- String apiVersion = "6";
- boolean aLaCarte = true;
- String requestUri = "v7/serviceInstances/assign";
- String instanceGroupId = "ff305d54-75b4-431b-adb2-eb6b9e5ff000";
-
- 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");
-
- assertEquals(expected, testResult);
+ public void wrapVIDRequestTest() throws IOException {
+ CamundaClient testClient = new CamundaClient();
+ testClient.setUrl("/mso/async/services/CreateGenericALaCarteServiceInstance");
+
+ String requestId = "f7ce78bb-423b-11e7-93f8-0050569a796";
+ boolean isBaseVfModule = true;
+ int recipeTimeout = 10000;
+ String requestAction = "createInstance";
+ String serviceInstanceId = "12345679";
+ String pnfCorrelationId = "12345679";
+ String vnfId = "234567891";
+ String vfModuleId = "345678912";
+ String volumeGroupId = "456789123";
+ String networkId = "567891234";
+ String configurationId = "678912345";
+ String serviceType = "testService";
+ String vnfType = "testVnf";
+ String vfModuleType = "vfModuleType";
+ String networkType = "networkType";
+ String requestDetails = "{requestDetails: }";
+ String apiVersion = "6";
+ boolean aLaCarte = true;
+ String requestUri = "v7/serviceInstances/assign";
+ String instanceGroupId = "ff305d54-75b4-431b-adb2-eb6b9e5ff000";
+
+ 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");
+
+ assertEquals(expected, testResult);
}
@Test
- public void testPost() throws Exception{
+ public void testPost() throws Exception {
CamundaClient testClient = new CamundaClient();
String orchestrationURI = "/engine-rest/process-definition/key/dummy/start";
MockEnvironment environment = new MockEnvironment();
-
+
environment.setProperty("mso.camundaUR", "yourValue1");
testClient.setProps(environment);
testClient.setClient(mockHttpClient);
-
+
testClient.setUrl(orchestrationURI);
-
- String responseBody ="{\"links\":[{\"method\":\"GET\",\"href\":\"http://localhost:9080/engine-rest/process-instance/2047c658-37ae-11e5-9505-7a1020524153\",\"rel\":\"self\"}],\"id\":\"2047c658-37ae-11e5-9505-7a1020524153\",\"definitionId\":\"dummy:10:73298961-37ad-11e5-9505-7a1020524153\",\"businessKey\":null,\"caseInstanceId\":null,\"ended\":true,\"suspended\":false}";
+
+ String responseBody =
+ "{\"links\":[{\"method\":\"GET\",\"href\":\"http://localhost:9080/engine-rest/process-instance/2047c658-37ae-11e5-9505-7a1020524153\",\"rel\":\"self\"}],\"id\":\"2047c658-37ae-11e5-9505-7a1020524153\",\"definitionId\":\"dummy:10:73298961-37ad-11e5-9505-7a1020524153\",\"businessKey\":null,\"caseInstanceId\":null,\"ended\":true,\"suspended\":false}";
assertNull(testClient.post(responseBody));
-
+
}
@Test
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaTaskClientTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaTaskClientTest.java
index 2ba0e4a173..9e9ab6048e 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaTaskClientTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaTaskClientTest.java
@@ -25,11 +25,9 @@ import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
-
import org.apache.http.HttpEntity;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
@@ -47,8 +45,8 @@ import org.springframework.core.env.Environment;
@RunWith(MockitoJUnitRunner.class)
public class CamundaTaskClientTest {
- @Mock
- private Environment env;
+ @Mock
+ private Environment env;
private CamundaTaskClient testedObject = new CamundaTaskClient();
private HttpClient httpClientMock;
private static final String JSON_REQUEST = "{\"value1\": \"aaa\",\"value2\": \"bbb\"}";
@@ -61,7 +59,8 @@ public class CamundaTaskClientTest {
@Before
public void init() {
- when(env.getProperty(eq(CommonConstants.CAMUNDA_AUTH))).thenReturn("E8E19DD16CC90D2E458E8FF9A884CC0452F8F3EB8E321F96038DE38D5C1B0B02DFAE00B88E2CF6E2A4101AB2C011FC161212EE");
+ when(env.getProperty(eq(CommonConstants.CAMUNDA_AUTH))).thenReturn(
+ "E8E19DD16CC90D2E458E8FF9A884CC0452F8F3EB8E321F96038DE38D5C1B0B02DFAE00B88E2CF6E2A4101AB2C011FC161212EE");
when(env.getProperty(eq(CommonConstants.ENCRYPTION_KEY_PROP))).thenReturn("aa3871669d893c7fb8abbcda31b88b4f");
testedObject = new CamundaTaskClient();
httpClientMock = mock(HttpClient.class);
@@ -75,8 +74,8 @@ public class CamundaTaskClientTest {
testedObject.post(JSON_REQUEST);
verify(httpClientMock).execute(httpPostCaptor.capture());
checkUri(httpPostCaptor.getValue());
- assertThat(httpPostCaptor.getValue().getEntity().getContentType().getValue()).
- isEqualTo(CommonConstants.CONTENT_TYPE_JSON);
+ assertThat(httpPostCaptor.getValue().getEntity().getContentType().getValue())
+ .isEqualTo(CommonConstants.CONTENT_TYPE_JSON);
assertThat(getJsonFromEntity(httpPostCaptor.getValue().getEntity())).isEqualTo(JSON_REQUEST);
}
@@ -87,7 +86,8 @@ public class CamundaTaskClientTest {
testedObject.post(JSON_REQUEST);
verify(httpClientMock).execute(httpPostCaptor.capture());
assertThat(httpPostCaptor.getValue().getHeaders(AUTHORIZATION_HEADER_NAME)).isNotEmpty();
- Assert.assertEquals("Basic YXBpaEJwbW46Y2FtdW5kYS1SMTUxMiE=",httpPostCaptor.getValue().getHeaders(AUTHORIZATION_HEADER_NAME)[0].getValue());
+ Assert.assertEquals("Basic YXBpaEJwbW46Y2FtdW5kYS1SMTUxMiE=",
+ httpPostCaptor.getValue().getHeaders(AUTHORIZATION_HEADER_NAME)[0].getValue());
}
@Test
@@ -106,7 +106,8 @@ public class CamundaTaskClientTest {
testedObject.get();
verify(httpClientMock).execute(httpGetCaptor.capture());
assertThat(httpGetCaptor.getValue().getHeaders(AUTHORIZATION_HEADER_NAME)).isNotEmpty();
- Assert.assertEquals("Basic YXBpaEJwbW46Y2FtdW5kYS1SMTUxMiE=",httpGetCaptor.getValue().getHeaders(AUTHORIZATION_HEADER_NAME)[0].getValue());
+ Assert.assertEquals("Basic YXBpaEJwbW46Y2FtdW5kYS1SMTUxMiE=",
+ httpGetCaptor.getValue().getHeaders(AUTHORIZATION_HEADER_NAME)[0].getValue());
}
@Test(expected = UnsupportedOperationException.class)
@@ -127,8 +128,7 @@ public class CamundaTaskClientTest {
}
private String getJsonFromEntity(HttpEntity httpEntity) throws IOException {
- BufferedReader rd = new BufferedReader(
- new InputStreamReader(httpEntity.getContent()));
+ BufferedReader rd = new BufferedReader(new InputStreamReader(httpEntity.getContent()));
StringBuilder result = new StringBuilder();
String line;
while ((line = rd.readLine()) != null) {
@@ -137,4 +137,4 @@ public class CamundaTaskClientTest {
return result.toString();
}
-} \ No newline at end of file
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java
index 0d4778b5b6..2095a9117d 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java
@@ -19,7 +19,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
+
package org.onap.so.apihandler.common;
@@ -28,7 +28,6 @@ import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.startsWith;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.ProtocolVersion;
@@ -46,100 +45,98 @@ import org.onap.so.apihandlerinfra.exceptions.ValidateException;
*
*
*/
-public class ResponseHandlerTest{
+public class ResponseHandlerTest {
@Rule
public ExpectedException thrown = ExpectedException.none();
@Test
- public void tesParseCamundaResponse () throws ApiException {
+ public void tesParseCamundaResponse() throws ApiException {
// String body
// ="{\"links\":[{\"method\":\"GET\",\"href\":\"http://localhost:9080/engine-rest/process-instance/2047c658-37ae-11e5-9505-7a1020524153\",\"rel\":\"self\"}],\"id\":\"2047c658-37ae-11e5-9505-7a1020524153\",\"definitionId\":\"dummy:10:73298961-37ad-11e5-9505-7a1020524153\",\"businessKey\":null,\"caseInstanceId\":null,\"ended\":true,\"suspended\":false}";
String body = "{ \"response\": \"<xml>xml</xml>\"," + "\"messageCode\": 200,"
- + "\"message\": \"Successfully started the process\"}";
+ + "\"message\": \"Successfully started the process\"}";
- HttpResponse response = createResponse (200, body, "application/json");
+ HttpResponse response = createResponse(200, body, "application/json");
- ResponseHandler respHandler = new ResponseHandler (response, 1);
-
- int status = respHandler.getStatus ();
- assertEquals (status, HttpStatus.SC_ACCEPTED);
- assertEquals (respHandler.getResponse ().getMessage (), "Successfully started the process");
+ ResponseHandler respHandler = new ResponseHandler(response, 1);
+
+ int status = respHandler.getStatus();
+ assertEquals(status, HttpStatus.SC_ACCEPTED);
+ assertEquals(respHandler.getResponse().getMessage(), "Successfully started the process");
}
-
+
@Test
- public void tesParseCamundaResponseForCamundaTaskType () throws ApiException {
- String body = "{ \"response\": \"<xml>xml</xml>\"," + "\"messageCode\": 200,"
- + "\"message\": \"Successfully started the process\"}";
+ public void tesParseCamundaResponseForCamundaTaskType() throws ApiException {
+ String body = "{ \"response\": \"<xml>xml</xml>\"," + "\"messageCode\": 200,"
+ + "\"message\": \"Successfully started the process\"}";
+
+ HttpResponse response = createResponse(200, body, "application/json");
- HttpResponse response = createResponse (200, body, "application/json");
+ ResponseHandler respHandler = new ResponseHandler(response, 2);
- ResponseHandler respHandler = new ResponseHandler (response, 2);
-
- int status = respHandler.getStatus ();
- assertEquals (status, HttpStatus.SC_ACCEPTED);
- assertEquals (respHandler.getResponseBody(), body);
+ int status = respHandler.getStatus();
+ assertEquals(status, HttpStatus.SC_ACCEPTED);
+ assertEquals(respHandler.getResponseBody(), body);
}
+
@Test
- public void tesParseBpelResponse () throws ApiException{
+ public void tesParseBpelResponse() throws ApiException {
String body = "<test:service-response xmlns:test=\"http://org.onap/so/test\">"
- + "<test:request-id>req5</test:request-id>"
- + "<test:request-action>test</test:request-action>"
- + "<test:source>test</test:source>"
- + "<test:ack-final-indicator>n</test:ack-final-indicator>"
- + "</test:service-response>";
+ + "<test:request-id>req5</test:request-id>" + "<test:request-action>test</test:request-action>"
+ + "<test:source>test</test:source>" + "<test:ack-final-indicator>n</test:ack-final-indicator>"
+ + "</test:service-response>";
- HttpResponse response = createResponse (200, body, "text/xml");
+ HttpResponse response = createResponse(200, body, "text/xml");
- ResponseHandler respHandler = new ResponseHandler (response, 0);
+ ResponseHandler respHandler = new ResponseHandler(response, 0);
- int status = respHandler.getStatus ();
- assertEquals (status, HttpStatus.SC_ACCEPTED);
- assertTrue (respHandler.getResponseBody () != null);
+ int status = respHandler.getStatus();
+ assertEquals(status, HttpStatus.SC_ACCEPTED);
+ assertTrue(respHandler.getResponseBody() != null);
}
@Test
- public void tesMappingErrorResponse () throws ApiException {
+ public void tesMappingErrorResponse() throws ApiException {
thrown.expect(ValidateException.class);
thrown.expectMessage(startsWith("Cannot parse Camunda Response"));
thrown.expect(hasProperty("httpResponseCode", is(HttpStatus.SC_BAD_REQUEST)));
thrown.expect(hasProperty("messageID", is(ErrorNumbers.SVC_BAD_PARAMETER)));
-
- HttpResponse response = createResponse (HttpStatus.SC_NOT_FOUND, "<html>error</html>", "text/html");
- ResponseHandler respHandler = new ResponseHandler (response, 1);
- int status = respHandler.getStatus ();
+ HttpResponse response = createResponse(HttpStatus.SC_NOT_FOUND, "<html>error</html>", "text/html");
+ ResponseHandler respHandler = new ResponseHandler(response, 1);
+
+ int status = respHandler.getStatus();
- assertEquals (HttpStatus.SC_NOT_IMPLEMENTED, status);
+ assertEquals(HttpStatus.SC_NOT_IMPLEMENTED, status);
}
@Test
- public void tesGenricErrorResponse () throws ApiException {
+ public void tesGenricErrorResponse() throws ApiException {
String body = "{ \"response\": \"<xml>xml</xml>\"," + "\"messageCode\": 500,"
- + "\"message\": \"Something went wrong\"}";
+ + "\"message\": \"Something went wrong\"}";
- HttpResponse response = createResponse (500, body, "application/json");
- ResponseHandler respHandler = new ResponseHandler (response, 1);
- int status = respHandler.getStatus ();
- assertEquals (status, HttpStatus.SC_BAD_GATEWAY);
- assertEquals (respHandler.getResponse ().getMessage (), "Something went wrong");
+ HttpResponse response = createResponse(500, body, "application/json");
+ ResponseHandler respHandler = new ResponseHandler(response, 1);
+ int status = respHandler.getStatus();
+ assertEquals(status, HttpStatus.SC_BAD_GATEWAY);
+ assertEquals(respHandler.getResponse().getMessage(), "Something went wrong");
}
- private HttpResponse createResponse (int respStatus, String respBody, String contentType) {
- HttpResponse response = new BasicHttpResponse (new BasicStatusLine (new ProtocolVersion ("HTTP", 1, 1),
- respStatus,
- ""));
- response.setStatusCode (respStatus);
+ private HttpResponse createResponse(int respStatus, String respBody, String contentType) {
+ HttpResponse response =
+ new BasicHttpResponse(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), respStatus, ""));
+ response.setStatusCode(respStatus);
try {
- response.setEntity (new StringEntity (respBody));
- response.setHeader ("Content-Type", contentType);
+ response.setEntity(new StringEntity(respBody));
+ response.setHeader("Content-Type", contentType);
} catch (Exception e) {
- e.printStackTrace ();
+ e.printStackTrace();
}
return response;
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/filters/RequestIdFilterTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/filters/RequestIdFilterTest.java
new file mode 100644
index 0000000000..6c674db9f4
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/filters/RequestIdFilterTest.java
@@ -0,0 +1,66 @@
+package org.onap.so.apihandler.filters;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doReturn;
+import java.io.IOException;
+import javax.ws.rs.container.ContainerRequestContext;
+import org.apache.http.HttpStatus;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnit;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.MockitoRule;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.slf4j.MDC;
+
+@RunWith(MockitoJUnitRunner.class)
+public class RequestIdFilterTest {
+
+ @Mock
+ ContainerRequestContext mockContext;
+
+ @Mock
+ protected RequestsDbClient requestsDbClient;
+
+ @InjectMocks
+ @Spy
+ RequestIdFilter requestIdFilter;
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @Rule
+ public MockitoRule mockitoRule = MockitoJUnit.rule();
+
+ @Test
+ public void filterTest() throws IOException {
+
+ String requestId = "32807a28-1a14-4b88-b7b3-2950918aa769";
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId);
+
+ // ExpectedRecord InfraActiveRequests
+ InfraActiveRequests infraActiveRequests = new InfraActiveRequests();
+ infraActiveRequests.setRequestStatus("FAILED");
+ infraActiveRequests.setProgress(100L);
+ infraActiveRequests.setLastModifiedBy("APIH");
+ infraActiveRequests.setRequestScope("network");
+ infraActiveRequests.setRequestAction("deleteInstance");
+ infraActiveRequests.setRequestId("32807a28-1a14-4b88-b7b3-2950918aa769");
+
+ doReturn(infraActiveRequests).when(requestsDbClient).getInfraActiveRequestbyRequestId(requestId);
+
+ requestIdFilter.filter(mockContext);
+
+ Mockito.verify(requestIdFilter, Mockito.times(1)).filter(mockContext);
+ assertEquals(MDC.get(ONAPLogConstants.MDCs.RESPONSE_CODE), String.valueOf(HttpStatus.SC_BAD_REQUEST));
+
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandlerTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandlerTest.java
index 564121b7b5..9065a1a9ea 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandlerTest.java
@@ -1,30 +1,23 @@
/*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2018 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * 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
+ * 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.
+ * 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.apihandler.recipe;
import static org.junit.Assert.assertEquals;
-
import java.io.ByteArrayInputStream;
import java.io.IOException;
-
import org.springframework.http.HttpStatus;
import org.springframework.http.client.ClientHttpResponse;
import org.junit.Before;
@@ -32,41 +25,41 @@ import org.junit.Test;
import org.mockito.Mockito;
public class CamundaClientErrorHandlerTest {
-
- private ClientHttpResponse clientHttpResponse;
- private CamundaClientErrorHandler clientErrorHandler;
-
- @Before
- public void before() {
- clientHttpResponse = Mockito.mock(ClientHttpResponse.class);
- clientErrorHandler = new CamundaClientErrorHandler();
- }
-
- @Test
- public void handleError_SERVER_ERROR_Test() throws IOException {
- Mockito.when(clientHttpResponse.getStatusCode()).thenReturn(HttpStatus.INTERNAL_SERVER_ERROR);
- Mockito.when(clientHttpResponse.getBody()).thenReturn(new ByteArrayInputStream("{}".getBytes()));
- clientErrorHandler.handleError(clientHttpResponse);
- boolean serverHasError = clientErrorHandler.hasError(clientHttpResponse);
- assertEquals(true, serverHasError);
- }
-
- @Test
- public void handleError_CLIENT_ERROR_Test() throws IOException {
- Mockito.when(clientHttpResponse.getStatusCode()).thenReturn(HttpStatus.BAD_REQUEST);
- Mockito.when(clientHttpResponse.getBody()).thenReturn(new ByteArrayInputStream("{}".getBytes()));
- clientErrorHandler.handleError(clientHttpResponse);
- boolean clientHasError = clientErrorHandler.hasError(clientHttpResponse);
- assertEquals(true, clientHasError);
- }
-
- @Test
- public void handleError_SUCCESS_Test() throws IOException {
- Mockito.when(clientHttpResponse.getStatusCode()).thenReturn(HttpStatus.ACCEPTED);
- Mockito.when(clientHttpResponse.getBody()).thenReturn(new ByteArrayInputStream("{}".getBytes()));
- clientErrorHandler.handleError(clientHttpResponse);
- boolean hasNoError = clientErrorHandler.hasError(clientHttpResponse);
- assertEquals(false, hasNoError);
- }
-
-} \ No newline at end of file
+
+ private ClientHttpResponse clientHttpResponse;
+ private CamundaClientErrorHandler clientErrorHandler;
+
+ @Before
+ public void before() {
+ clientHttpResponse = Mockito.mock(ClientHttpResponse.class);
+ clientErrorHandler = new CamundaClientErrorHandler();
+ }
+
+ @Test
+ public void handleError_SERVER_ERROR_Test() throws IOException {
+ Mockito.when(clientHttpResponse.getStatusCode()).thenReturn(HttpStatus.INTERNAL_SERVER_ERROR);
+ Mockito.when(clientHttpResponse.getBody()).thenReturn(new ByteArrayInputStream("{}".getBytes()));
+ clientErrorHandler.handleError(clientHttpResponse);
+ boolean serverHasError = clientErrorHandler.hasError(clientHttpResponse);
+ assertEquals(true, serverHasError);
+ }
+
+ @Test
+ public void handleError_CLIENT_ERROR_Test() throws IOException {
+ Mockito.when(clientHttpResponse.getStatusCode()).thenReturn(HttpStatus.BAD_REQUEST);
+ Mockito.when(clientHttpResponse.getBody()).thenReturn(new ByteArrayInputStream("{}".getBytes()));
+ clientErrorHandler.handleError(clientHttpResponse);
+ boolean clientHasError = clientErrorHandler.hasError(clientHttpResponse);
+ assertEquals(true, clientHasError);
+ }
+
+ @Test
+ public void handleError_SUCCESS_Test() throws IOException {
+ Mockito.when(clientHttpResponse.getStatusCode()).thenReturn(HttpStatus.ACCEPTED);
+ Mockito.when(clientHttpResponse.getBody()).thenReturn(new ByteArrayInputStream("{}".getBytes()));
+ clientErrorHandler.handleError(clientHttpResponse);
+ boolean hasNoError = clientErrorHandler.hasError(clientHttpResponse);
+ assertEquals(false, hasNoError);
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java
index 42190a4a1e..2cdf4f1a3f 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java
@@ -26,15 +26,12 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandlerinfra.exceptions.*;
-
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
-
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.hamcrest.Matchers.hasProperty;
import static org.hamcrest.Matchers.is;
@@ -52,7 +49,8 @@ public class ApiExceptionTest {
thrown.expectMessage("Message rewritten");
thrown.expect(hasProperty("httpResponseCode", is(HttpStatus.SC_NOT_FOUND)));
thrown.expect(hasProperty("messageID", is(ErrorNumbers.SVC_BAD_PARAMETER)));
- RecipeNotFoundException testException = new RecipeNotFoundException.Builder("Test Message", HttpStatus.SC_NOT_FOUND,ErrorNumbers.SVC_BAD_PARAMETER).message("Message rewritten").build();
+ RecipeNotFoundException testException = new RecipeNotFoundException.Builder("Test Message",
+ HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_BAD_PARAMETER).message("Message rewritten").build();
throw testException;
}
@@ -65,8 +63,9 @@ public class ApiExceptionTest {
thrown.expectMessage(startsWith("Request Failed due to BPEL error with HTTP Status ="));
thrown.expect(hasProperty("httpResponseCode", is(HttpStatus.SC_NOT_FOUND)));
thrown.expect(hasProperty("messageID", is(ErrorNumbers.SVC_BAD_PARAMETER)));
- thrown.expect(hasProperty("variables",sameBeanAs(testVariables)));
- BPMNFailureException testException = new BPMNFailureException.Builder("Test Message", HttpStatus.SC_NOT_FOUND,ErrorNumbers.SVC_BAD_PARAMETER).variables(testVariables).build();
+ thrown.expect(hasProperty("variables", sameBeanAs(testVariables)));
+ BPMNFailureException testException = new BPMNFailureException.Builder("Test Message", HttpStatus.SC_NOT_FOUND,
+ ErrorNumbers.SVC_BAD_PARAMETER).variables(testVariables).build();
throw testException;
}
@@ -81,32 +80,39 @@ public class ApiExceptionTest {
thrown.expect(hasProperty("httpResponseCode", is(HttpStatus.SC_NOT_FOUND)));
thrown.expect(hasProperty("messageID", is(ErrorNumbers.SVC_BAD_PARAMETER)));
thrown.expect(hasProperty("cause", sameBeanAs(ioException)));
- ClientConnectionException testException = new ClientConnectionException.Builder("test", HttpStatus.SC_NOT_FOUND,ErrorNumbers.SVC_BAD_PARAMETER).cause(ioException).build();
+ ClientConnectionException testException =
+ new ClientConnectionException.Builder("test", HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_BAD_PARAMETER)
+ .cause(ioException).build();
throw testException;
}
@Test
public void testDuplicateRequestException() throws ApiException {
- ErrorLoggerInfo testLog = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo testLog =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.DataError)
+ .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
thrown.expect(DuplicateRequestException.class);
thrown.expectMessage(startsWith("Error: Locked instance"));
thrown.expect(hasProperty("httpResponseCode", is(HttpStatus.SC_NOT_FOUND)));
thrown.expect(hasProperty("messageID", is(ErrorNumbers.SVC_BAD_PARAMETER)));
thrown.expect(hasProperty("errorLoggerInfo", sameBeanAs(testLog)));
- DuplicateRequestException testException = new DuplicateRequestException.Builder("Test1", "Test2","Test3","Test4", HttpStatus.SC_NOT_FOUND,ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(testLog).build();
+ DuplicateRequestException testException = new DuplicateRequestException.Builder("Test1", "Test2", "Test3",
+ "Test4", HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(testLog).build();
throw testException;
}
@Test
- public void testValidateException() throws ApiException {
+ public void testValidateException() throws ApiException {
thrown.expect(ValidateException.class);
thrown.expectMessage("Test Message");
thrown.expect(hasProperty("httpResponseCode", is(HttpStatus.SC_NOT_FOUND)));
thrown.expect(hasProperty("messageID", is(ErrorNumbers.SVC_DETAILED_SERVICE_ERROR)));
- ValidateException testException = new ValidateException.Builder("Test Message", HttpStatus.SC_NOT_FOUND,ErrorNumbers.SVC_BAD_PARAMETER).messageID(ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).build();
+ ValidateException testException =
+ new ValidateException.Builder("Test Message", HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_BAD_PARAMETER)
+ .messageID(ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).build();
throw testException;
}
@@ -117,7 +123,9 @@ public class ApiExceptionTest {
thrown.expectMessage("Test Message");
thrown.expect(hasProperty("httpResponseCode", is(HttpStatus.SC_CONFLICT)));
thrown.expect(hasProperty("messageID", is(ErrorNumbers.SVC_BAD_PARAMETER)));
- VfModuleNotFoundException testException = new VfModuleNotFoundException.Builder("Test Message", HttpStatus.SC_NOT_FOUND,ErrorNumbers.SVC_BAD_PARAMETER).httpResponseCode(HttpStatus.SC_CONFLICT).build();
+ VfModuleNotFoundException testException =
+ new VfModuleNotFoundException.Builder("Test Message", HttpStatus.SC_NOT_FOUND,
+ ErrorNumbers.SVC_BAD_PARAMETER).httpResponseCode(HttpStatus.SC_CONFLICT).build();
throw testException;
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/TestAppender.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/TestAppender.java
index 48711a2595..1beb3b37a7 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/TestAppender.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/TestAppender.java
@@ -27,11 +27,11 @@ import ch.qos.logback.core.AppenderBase;
-public class TestAppender extends AppenderBase<ILoggingEvent> {
+public class TestAppender extends AppenderBase<ILoggingEvent> {
public static List<ILoggingEvent> events = new ArrayList<>();
-
- @Override
- protected void append(ILoggingEvent loggingEvent) {
- events.add(loggingEvent);
- }
+
+ @Override
+ protected void append(ILoggingEvent loggingEvent) {
+ events.add(loggingEvent);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapperTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapperTest.java
index 1962f00d52..2922aaa896 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapperTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapperTest.java
@@ -32,19 +32,15 @@ import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-
-
import java.io.IOException;
import java.io.Writer;
import java.util.Arrays;
import java.util.List;
-
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
-
import org.apache.http.HttpStatus;
import org.junit.Before;
import org.junit.Test;
@@ -62,7 +58,6 @@ import org.onap.so.apihandlerinfra.exceptions.ClientConnectionException;
import org.onap.so.apihandlerinfra.exceptions.DuplicateRequestException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.exceptions.VfModuleNotFoundException;
-
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -70,93 +65,111 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@RunWith(MockitoJUnitRunner.class)
public class ApiExceptionMapperTest {
- @Mock
- private HttpHeaders headers;
- @Mock
- private Marshaller marshaller;
-
- @InjectMocks
+ @Mock
+ private HttpHeaders headers;
+ @Mock
+ private Marshaller marshaller;
+
+ @InjectMocks
ApiExceptionMapper mapper = new ApiExceptionMapper();
- @Before
- public void setUp() {
- when(headers.getAcceptableMediaTypes()).thenReturn(Arrays.asList(MediaType.APPLICATION_JSON_TYPE));
- }
+ @Before
+ public void setUp() {
+ when(headers.getAcceptableMediaTypes()).thenReturn(Arrays.asList(MediaType.APPLICATION_JSON_TYPE));
+ }
+
@Test
public void testObjectMapperError() throws JsonProcessingException {
ObjectMapper mockedMapper = Mockito.mock(ObjectMapper.class);
Mockito.when(mockedMapper.writeValueAsString(anyObject())).thenThrow(JsonProcessingException.class);
- ValidateException validateException = new ValidateException.Builder("Test", 0 , null).build();
+ ValidateException validateException = new ValidateException.Builder("Test", 0, null).build();
ApiExceptionMapper mockedException = Mockito.spy(mapper);
Mockito.doReturn(mockedMapper).when(mockedException).createObjectMapper();
Response resp = mockedException.toResponse((ApiException) validateException);
- /// assertEquals(resp.getStatus(), HttpStatus.SC_BAD_REQUEST);
- assertThat(resp.getEntity().toString(),startsWith("Exception in buildServiceErrorResponse writing exceptionType to string"));
+ /// assertEquals(resp.getStatus(), HttpStatus.SC_BAD_REQUEST);
+ assertThat(resp.getEntity().toString(),
+ startsWith("Exception in buildServiceErrorResponse writing exceptionType to string"));
}
@Test
- public void testValidateResponse(){
- ValidateException validateException = new ValidateException.Builder("Test Message", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).build();
+ public void testValidateResponse() {
+ ValidateException validateException =
+ new ValidateException.Builder("Test Message", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER)
+ .build();
Response resp = mapper.toResponse((ApiException) validateException);
assertEquals(resp.getStatus(), HttpStatus.SC_BAD_REQUEST);
}
@Test
- public void testBPMNFailureResponse(){
- BPMNFailureException bpmnException = new BPMNFailureException.Builder("Test Message", HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_BAD_PARAMETER).build();
+ public void testBPMNFailureResponse() {
+ BPMNFailureException bpmnException = new BPMNFailureException.Builder("Test Message", HttpStatus.SC_NOT_FOUND,
+ ErrorNumbers.SVC_BAD_PARAMETER).build();
Response resp = mapper.toResponse((ApiException) bpmnException);
assertEquals(resp.getStatus(), HttpStatus.SC_NOT_FOUND);
}
+
@Test
- public void testClientConnectionResponse(){
- ClientConnectionException clientConnectionException = new ClientConnectionException.Builder("test", HttpStatus.SC_INTERNAL_SERVER_ERROR,ErrorNumbers.SVC_BAD_PARAMETER).build();
- Response resp = mapper.toResponse((ApiException) clientConnectionException);
+ public void testClientConnectionResponse() {
+ ClientConnectionException clientConnectionException = new ClientConnectionException.Builder("test",
+ HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER).build();
+ Response resp = mapper.toResponse((ApiException) clientConnectionException);
assertEquals(resp.getStatus(), HttpStatus.SC_INTERNAL_SERVER_ERROR);
}
+
@Test
public void testVFModuleResponse() {
- VfModuleNotFoundException vfModuleException = new VfModuleNotFoundException.Builder("Test Message", HttpStatus.SC_CONFLICT,ErrorNumbers.SVC_BAD_PARAMETER).build();
- Response resp = mapper.toResponse((ApiException) vfModuleException);
+ VfModuleNotFoundException vfModuleException = new VfModuleNotFoundException.Builder("Test Message",
+ HttpStatus.SC_CONFLICT, ErrorNumbers.SVC_BAD_PARAMETER).build();
+ Response resp = mapper.toResponse((ApiException) vfModuleException);
assertEquals(resp.getStatus(), HttpStatus.SC_CONFLICT);
}
+
@Test
public void testDuplicateRequestResponse() throws IOException {
- DuplicateRequestException duplicateRequestException = new DuplicateRequestException.Builder("Test1", "Test2","Test3","Test4", HttpStatus.SC_BAD_GATEWAY,ErrorNumbers.SVC_BAD_PARAMETER).build();
- Response resp = mapper.toResponse((ApiException) duplicateRequestException);
+ DuplicateRequestException duplicateRequestException = new DuplicateRequestException.Builder("Test1", "Test2",
+ "Test3", "Test4", HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_BAD_PARAMETER).build();
+ Response resp = mapper.toResponse((ApiException) duplicateRequestException);
assertEquals(resp.getStatus(), HttpStatus.SC_BAD_GATEWAY);
}
-
+
@Test
public void verifyXMLPath() throws JAXBException {
- when(headers.getAcceptableMediaTypes()).thenReturn(Arrays.asList(MediaType.APPLICATION_XML_TYPE));
- BPMNFailureException bpmnException = new BPMNFailureException.Builder("Test Message", HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_BAD_PARAMETER).build();
+ when(headers.getAcceptableMediaTypes()).thenReturn(Arrays.asList(MediaType.APPLICATION_XML_TYPE));
+ BPMNFailureException bpmnException = new BPMNFailureException.Builder("Test Message", HttpStatus.SC_NOT_FOUND,
+ ErrorNumbers.SVC_BAD_PARAMETER).build();
ApiExceptionMapper mapperSpy = Mockito.spy(mapper);
doReturn(marshaller).when(mapperSpy).getMarshaller();
- Response resp = mapperSpy.toResponse((ApiException) bpmnException);
+ Response resp = mapperSpy.toResponse((ApiException) bpmnException);
verify(marshaller, times(1)).marshal(any(Object.class), any(Writer.class));
}
-
+
@Test
public void verifyMediaType() {
- ApiExceptionMapper mapperSpy = Mockito.spy(mapper);
- BPMNFailureException bpmnException = new BPMNFailureException.Builder("Test Message", HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_BAD_PARAMETER).build();
- when(headers.getAcceptableMediaTypes()).thenReturn(Arrays.asList(MediaType.APPLICATION_XML_TYPE.withCharset("UTF-8")));
- mapperSpy.toResponse(bpmnException);
- verify(mapperSpy, times(1)).buildServiceErrorResponse(any(String.class), any(String.class), ArgumentMatchers.isNull(), eq(MediaType.APPLICATION_XML_TYPE));
- when(headers.getAcceptableMediaTypes()).thenReturn(Arrays.asList(MediaType.APPLICATION_JSON_TYPE.withCharset("UTF-8")));
- mapperSpy = Mockito.spy(mapper);
- mapperSpy.toResponse(bpmnException);
- verify(mapperSpy, times(1)).buildServiceErrorResponse(any(String.class), any(String.class), ArgumentMatchers.isNull(), eq(MediaType.APPLICATION_JSON_TYPE));
- when(headers.getAcceptableMediaTypes()).thenReturn(null);
- mapperSpy = Mockito.spy(mapper);
- mapperSpy.toResponse(bpmnException);
- verify(mapperSpy, times(1)).buildServiceErrorResponse(any(String.class), any(String.class),ArgumentMatchers.isNull(), eq(MediaType.APPLICATION_JSON_TYPE));
+ ApiExceptionMapper mapperSpy = Mockito.spy(mapper);
+ BPMNFailureException bpmnException = new BPMNFailureException.Builder("Test Message", HttpStatus.SC_NOT_FOUND,
+ ErrorNumbers.SVC_BAD_PARAMETER).build();
+ when(headers.getAcceptableMediaTypes())
+ .thenReturn(Arrays.asList(MediaType.APPLICATION_XML_TYPE.withCharset("UTF-8")));
+ mapperSpy.toResponse(bpmnException);
+ verify(mapperSpy, times(1)).buildServiceErrorResponse(any(String.class), any(String.class),
+ ArgumentMatchers.isNull(), eq(MediaType.APPLICATION_XML_TYPE));
+ when(headers.getAcceptableMediaTypes())
+ .thenReturn(Arrays.asList(MediaType.APPLICATION_JSON_TYPE.withCharset("UTF-8")));
+ mapperSpy = Mockito.spy(mapper);
+ mapperSpy.toResponse(bpmnException);
+ verify(mapperSpy, times(1)).buildServiceErrorResponse(any(String.class), any(String.class),
+ ArgumentMatchers.isNull(), eq(MediaType.APPLICATION_JSON_TYPE));
+ when(headers.getAcceptableMediaTypes()).thenReturn(null);
+ mapperSpy = Mockito.spy(mapper);
+ mapperSpy.toResponse(bpmnException);
+ verify(mapperSpy, times(1)).buildServiceErrorResponse(any(String.class), any(String.class),
+ ArgumentMatchers.isNull(), eq(MediaType.APPLICATION_JSON_TYPE));
}
}