summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-common
diff options
context:
space:
mode:
authorChrisC <cc697w@intl.att.com>2017-01-31 11:40:03 +0100
committerChrisC <cc697w@intl.att.com>2017-01-31 12:59:33 +0100
commit025301d08b061482c1f046d562bf017c8cbcfe8d (patch)
tree68a2a549736c9bf0f7cd4e71c76e40ef7e2606f2 /mso-api-handlers/mso-api-handler-common
parent2754ad52f833278a5c925bd788a16d1dce16a598 (diff)
Initial OpenECOMP MSO commit
Change-Id: Ia6a7574859480717402cc2f22534d9973a78fa6d Signed-off-by: ChrisC <cc697w@intl.att.com>
Diffstat (limited to 'mso-api-handlers/mso-api-handler-common')
-rw-r--r--mso-api-handlers/mso-api-handler-common/pom.xml109
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/BpmnRequest.java255
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaBooleanInput.java61
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaBpmnRequestInput.java59
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaInput.java66
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaIntegerInput.java59
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaRequest.java133
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaResponse.java97
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java262
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/Track.java49
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java95
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java313
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java68
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ErrorNumbers.java70
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/LSInputImpl.java122
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/PathResourceResolver.java64
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java95
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientFactory.java56
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ResponseHandler.java173
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ValidationException.java44
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/XMLValidator.java103
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/package-info.java25
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/BPELRestClientTest.java126
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java123
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaRequestTest.java81
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaResponseTest.java59
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/ResponseHandlerTest.java131
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/resources/logback-test.xml48
28 files changed, 2946 insertions, 0 deletions
diff --git a/mso-api-handlers/mso-api-handler-common/pom.xml b/mso-api-handlers/mso-api-handler-common/pom.xml
new file mode 100644
index 0000000000..b9d622d08c
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/pom.xml
@@ -0,0 +1,109 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.openecomp.mso</groupId>
+ <artifactId>mso-api-handlers</artifactId>
+ <version>0.0.4-SNAPSHOT</version>
+ </parent>
+
+
+ <groupId>org.openecomp.mso</groupId>
+ <artifactId>mso-api-handler-common</artifactId>
+
+ <name>ECOMP MSO API Handler common</name>
+ <description>ECOMP MSO API Handler common classes</description>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxrs</artifactId>
+ <version>3.0.19.Final</version>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpcore</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax</groupId>
+ <artifactId>javaee-web-api</artifactId>
+ <version>6.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>javax.activation</groupId>
+ <artifactId>activation</artifactId>
+ <version>1.1.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-core-asl</artifactId>
+ <version>1.9.13</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-mapper-asl</artifactId>
+ <version>1.9.13</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openecomp.mso</groupId>
+ <artifactId>mso-catalog-db</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openecomp.mso</groupId>
+ <artifactId>mso-requests-db</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>1.10.19</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <finalName>${project.artifactId}-${project.version}</finalName>
+
+ </build>
+ <packaging>jar</packaging>
+</project> \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/BpmnRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/BpmnRequest.java
new file mode 100644
index 0000000000..4de534b600
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/BpmnRequest.java
@@ -0,0 +1,255 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.mso.apihandler.camundabeans;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonRootName;
+import org.codehaus.jackson.annotate.JsonPropertyOrder;
+
+import org.openecomp.mso.apihandler.common.CommonConstants;
+
+/**
+ * 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})
+@JsonRootName(CommonConstants.CAMUNDA_ROOT_INPUT)
+public class BpmnRequest {
+
+ public 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;
+
+
+
+ @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 "CamundaRequest [requestId=" + + ", host="
+ // + host + ", schema=" + schema + ", reqid=" + reqid + ", svcid="
+ // + svcid + ", timeout=" + timeout + "]";
+ return "BpmnRequest";
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaBooleanInput.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaBooleanInput.java
new file mode 100644
index 0000000000..c6ef7e59ca
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaBooleanInput.java
@@ -0,0 +1,61 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.mso.apihandler.camundabeans;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonRootName;
+
+import org.openecomp.mso.apihandler.common.CommonConstants;
+
+/**
+ * JavaBean JSON class for a "gMyServiceInput" which contains the xml payload that
+ * will be passed to the Camunda process
+ */
+
+
+public class CamundaBooleanInput {
+
+ @JsonProperty(CommonConstants.CAMUNDA_VALUE)
+ private boolean value;
+ @JsonProperty(CommonConstants.CAMUNDA_TYPE)
+ private String type = "Boolean";
+
+
+ public CamundaBooleanInput() {
+ }
+
+ @JsonProperty(CommonConstants.CAMUNDA_VALUE)
+ public boolean getValue() {
+ return value;
+ }
+
+ @JsonProperty(CommonConstants.CAMUNDA_VALUE)
+ public void setValue(boolean 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/openecomp/mso/apihandler/camundabeans/CamundaBpmnRequestInput.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaBpmnRequestInput.java
new file mode 100644
index 0000000000..e7e9b31edc
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaBpmnRequestInput.java
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.mso.apihandler.camundabeans;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonRootName;
+
+import org.openecomp.mso.apihandler.common.CommonConstants;
+
+/**
+ * JavaBean JSON class for a "gMyServiceInput" which contains the xml payload that
+ * will be passed to the Camunda process
+ */
+public class CamundaBpmnRequestInput {
+
+ @JsonProperty(CommonConstants.CAMUNDA_VALUE)
+ private BpmnRequest value;
+ @JsonProperty(CommonConstants.CAMUNDA_TYPE)
+ private String type = "String";
+
+
+ public CamundaBpmnRequestInput() {
+ }
+
+ @JsonProperty(CommonConstants.CAMUNDA_VALUE)
+ public BpmnRequest getValue() {
+ return value;
+ }
+
+ @JsonProperty(CommonConstants.CAMUNDA_VALUE)
+ public void setValue(BpmnRequest 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/openecomp/mso/apihandler/camundabeans/CamundaInput.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaInput.java
new file mode 100644
index 0000000000..16c71658a5
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaInput.java
@@ -0,0 +1,66 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.mso.apihandler.camundabeans;
+
+
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonRootName;
+
+import org.openecomp.mso.apihandler.common.CommonConstants;
+
+/**
+ * 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";
+
+
+ public CamundaInput() {
+ }
+
+ @JsonProperty(CommonConstants.CAMUNDA_VALUE)
+ public String getValue() {
+ return value;
+ }
+
+ @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/openecomp/mso/apihandler/camundabeans/CamundaIntegerInput.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaIntegerInput.java
new file mode 100644
index 0000000000..ac77fb75bd
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaIntegerInput.java
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.mso.apihandler.camundabeans;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonRootName;
+
+import org.openecomp.mso.apihandler.common.CommonConstants;
+
+/**
+ * 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() {
+ }
+
+ @JsonProperty(CommonConstants.CAMUNDA_VALUE)
+ public int getValue() {
+ return value;
+ }
+
+ @JsonProperty(CommonConstants.CAMUNDA_VALUE)
+ public void setValue(int value) {
+ this.value = value;
+ }
+
+ @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/openecomp/mso/apihandler/camundabeans/CamundaRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaRequest.java
new file mode 100644
index 0000000000..4eacff6623
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaRequest.java
@@ -0,0 +1,133 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.mso.apihandler.camundabeans;
+
+
+
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonRootName;
+import org.codehaus.jackson.annotate.JsonPropertyOrder;
+
+import org.openecomp.mso.apihandler.common.CommonConstants;
+
+/**
+ * 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})
+@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 + "]";
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaResponse.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaResponse.java
new file mode 100644
index 0000000000..3eeb0c0f76
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaResponse.java
@@ -0,0 +1,97 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.mso.apihandler.camundabeans;
+
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+/**
+ * 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 + "]";
+ }
+
+
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java
new file mode 100644
index 0000000000..5cf859d537
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java
@@ -0,0 +1,262 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.mso.apihandler.camundabeans;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonRootName;
+import org.codehaus.jackson.annotate.JsonPropertyOrder;
+
+import org.openecomp.mso.apihandler.common.CommonConstants;
+
+/**
+ * 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.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.CAMUNDA_SERVICE_INPUT})
+@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.REQUEST_ID_VARIABLE)
+ private CamundaInput requestId;
+
+ @JsonProperty(CommonConstants.REQUEST_ID_HEADER)
+ private CamundaInput attMsoRequestId;
+
+
+ @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.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 getAttMsoRequestId() {
+ return attMsoRequestId;
+ }
+
+ @JsonProperty(CommonConstants.REQUEST_ID_HEADER)
+ public void setAttMsoRequestId(CamundaInput attMsoRequestId) {
+ this.attMsoRequestId = attMsoRequestId;
+ }
+
+ @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;
+ }
+
+
+ @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/openecomp/mso/apihandler/camundabeans/Track.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/Track.java
new file mode 100644
index 0000000000..a625298881
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/Track.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.mso.apihandler.camundabeans;
+
+public class Track {
+
+ String title;
+ String singer;
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getSinger() {
+ return singer;
+ }
+
+ public void setSinger(String singer) {
+ this.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/openecomp/mso/apihandler/common/BPELRestClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java
new file mode 100644
index 0000000000..511b874e15
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java
@@ -0,0 +1,95 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.mso.apihandler.common;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.MediaType;
+import javax.xml.bind.DatatypeConverter;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+
+import org.openecomp.mso.logger.MsoLogger;
+
+public class BPELRestClient extends RequestClient {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+
+ public BPELRestClient () {
+ super (CommonConstants.BPEL);
+ }
+
+ @Override
+ public HttpResponse post (String bpelReqXML,
+ String requestId,
+ String requestTimeout,
+ String schemaVersion,
+ String serviceInstanceId,
+ String action) throws ClientProtocolException, IOException {
+ String encryptedCredentials = null;
+ HttpPost post = new HttpPost (url);
+ msoLogger.debug ("BPEL url is: " + url);
+ StringEntity input = new StringEntity (bpelReqXML);
+ input.setContentType (MediaType.TEXT_XML);
+ if (props != null) {
+ encryptedCredentials = props.getProperty (CommonConstants.BPEL_AUTH,null);
+ if (encryptedCredentials != null) {
+ String userCredentials = getEncryptedPropValue (encryptedCredentials,
+ CommonConstants.DEFAULT_BPEL_AUTH,
+ CommonConstants.ENCRYPTION_KEY);
+ if (userCredentials != null) {
+ post.addHeader ("Authorization",
+ "Basic " + new String (DatatypeConverter.printBase64Binary (userCredentials.getBytes ())));
+ }
+ }
+ }
+ post.addHeader (CommonConstants.REQUEST_ID_HEADER, requestId);
+ post.addHeader (CommonConstants.REQUEST_TIMEOUT_HEADER, requestTimeout);
+ post.addHeader (CommonConstants.SCHEMA_VERSION_HEADER, schemaVersion);
+ if (serviceInstanceId != null) {
+ post.addHeader (CommonConstants.SERVICE_INSTANCE_ID_HEADER, serviceInstanceId);
+ }
+ if (action != null) {
+ post.addHeader (CommonConstants.ACTION_HEADER, action);
+ }
+ post.setEntity (input);
+ HttpResponse response = client.execute (post);
+ msoLogger.debug ("bpel response " + response);
+ return response;
+ }
+
+ @Override
+ public HttpResponse post (String bpelReqXML) {
+ return null;
+ }
+
+ @Override
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails) {
+ return null;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java
new file mode 100644
index 0000000000..dd83d24c9e
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java
@@ -0,0 +1,313 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.mso.apihandler.common;
+
+
+import org.openecomp.mso.apihandler.camundabeans.*;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoLogger;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.map.SerializationConfig;
+
+import javax.xml.bind.DatatypeConverter;
+import java.io.IOException;
+
+public class CamundaClient extends RequestClient{
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH);
+
+ 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);
+ msoLogger.debug("Camunda url is: "+ url);
+ String jsonReq = wrapRequest(camundaReqXML, requestId, serviceInstanceId, requestTimeout, schemaVersion);
+
+ StringEntity input = new StringEntity(jsonReq);
+ input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
+
+ String encryptedCredentials = null;
+ if(props!=null){
+ encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH,null);
+ if(encryptedCredentials != null){
+ String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY);
+ if(userCredentials != null){
+ post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+ }
+ }
+ }
+
+ post.setEntity(input);
+ HttpResponse response = client.execute(post);
+
+ return response;
+ }
+
+ @Override
+ public HttpResponse post(String jsonReq)
+ throws ClientProtocolException, IOException{
+ HttpPost post = new HttpPost(url);
+ msoLogger.debug("Camunda url is: "+ url);
+ //String jsonReq = wrapRequest(camundaReqXML, requestId, serviceInstanceId, requestTimeout, schemaVersion);
+
+ StringEntity input = new StringEntity(jsonReq);
+ input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
+
+ String encryptedCredentials = null;
+ if(props!=null){
+ encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH,null);
+ if(encryptedCredentials != null){
+ String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY);
+ if(userCredentials != null){
+ post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+ }
+ }
+ }
+
+ post.setEntity(input);
+ HttpResponse response = client.execute(post);
+
+ return response;
+ }
+
+ @Override
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails)
+ throws ClientProtocolException, IOException{
+ HttpPost post = new HttpPost(url);
+ msoLogger.debug("Camunda url is: "+ url);
+ String jsonReq = wrapVIDRequest(requestId, isBaseVfModule, recipeTimeout, requestAction,
+ serviceInstanceId, vnfId, vfModuleId, volumeGroupId, networkId,
+ serviceType, vnfType, vfModuleType, networkType, requestDetails);
+
+ StringEntity input = new StringEntity(jsonReq);
+ input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
+
+ String encryptedCredentials = null;
+ if(props!=null){
+ encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH,null);
+ if(encryptedCredentials != null){
+ String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY);
+ if(userCredentials != null){
+ post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+ }
+ }
+ }
+
+ post.setEntity(input);
+ HttpResponse response = client.execute(post);
+
+ return response;
+ }
+
+ private String wrapRequest(String reqXML, String requestId, String serviceInstanceId, String requestTimeout, String schemaVersion){
+ String jsonReq = null;
+ if(reqXML == null){
+ reqXML ="";
+ }
+ if(requestTimeout == null){
+ requestTimeout ="";
+ }
+ if(schemaVersion == null){
+ schemaVersion = "";
+ }
+
+
+ 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(reqXML);
+ host.setValue(parseURL());
+ schema.setValue(schemaVersion);
+ reqid.setValue(requestId);
+ svcid.setValue(serviceInstanceId);
+ timeout.setValue(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(SerializationConfig.Feature.WRAP_ROOT_VALUE, true);
+
+ jsonReq = mapper.writeValueAsString(camundaRequest);
+ msoLogger.debug("request body is " + jsonReq);
+ }catch(Exception e){
+ msoLogger.error(MessageEnum.APIH_WARP_REQUEST, "Camunda", "wrapRequest", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH Warp request", e);
+ }
+ return jsonReq;
+ }
+
+ private String wrapVIDRequest(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails){
+ String jsonReq = null;
+ if(requestId == null){
+ requestId ="";
+ }
+ if(requestAction == null){
+ requestAction ="";
+ }
+ if(serviceInstanceId == null){
+ serviceInstanceId ="";
+ }
+ if(vnfId == null){
+ vnfId ="";
+ }
+ if(vfModuleId == null){
+ vfModuleId ="";
+ }
+ if(volumeGroupId == null){
+ volumeGroupId ="";
+ }
+ if(networkId == null){
+ networkId ="";
+ }
+ if(serviceType == null){
+ serviceType ="";
+ }
+ if(vnfType == null){
+ vnfType ="";
+ }
+ if(vfModuleType == null){
+ vfModuleType ="";
+ }
+ if(networkType == null){
+ networkType ="";
+ }
+ if(requestDetails == null){
+ requestDetails ="";
+ }
+
+
+
+ try{
+ CamundaVIDRequest camundaRequest = new CamundaVIDRequest();
+ BpmnRequest bpmnRequest = new BpmnRequest();
+ 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 vnfIdInput = new CamundaInput();
+ CamundaInput vfModuleIdInput = new CamundaInput();
+ CamundaInput volumeGroupIdInput = new CamundaInput();
+ CamundaInput networkIdInput = new CamundaInput();
+ CamundaInput serviceTypeInput = new CamundaInput();
+ CamundaInput vnfTypeInput = new CamundaInput();
+ CamundaInput vfModuleTypeInput = new CamundaInput();
+ CamundaInput networkTypeInput = new CamundaInput();
+
+ host.setValue(parseURL());
+ requestIdInput.setValue(requestId);
+ isBaseVfModuleInput.setValue(isBaseVfModule);
+ recipeTimeoutInput.setValue(recipeTimeout);
+ requestActionInput.setValue(requestAction);
+ serviceInstanceIdInput.setValue(serviceInstanceId);
+ vnfIdInput.setValue(vnfId);
+ vfModuleIdInput.setValue(vfModuleId);
+ volumeGroupIdInput.setValue(volumeGroupId);
+ networkIdInput.setValue(networkId);
+ serviceTypeInput.setValue(serviceType);
+ vnfTypeInput.setValue(vnfType);
+ vfModuleTypeInput.setValue(vfModuleType);
+ networkTypeInput.setValue(networkType);
+
+ bpmnRequest.setRequestId(requestIdInput);
+ bpmnRequest.setIsBaseVfModule(isBaseVfModuleInput);
+ bpmnRequest.setRecipeTimeout(recipeTimeoutInput);
+ bpmnRequest.setRequestAction(requestActionInput);
+ bpmnRequest.setServiceInstanceId(serviceInstanceIdInput);
+ bpmnRequest.setVnfId(vnfIdInput);
+ bpmnRequest.setVfModuleId(vfModuleIdInput);
+ bpmnRequest.setVolumeGroupId(volumeGroupIdInput);
+ bpmnRequest.setNetworkId(networkIdInput);
+ bpmnRequest.setServiceType(serviceTypeInput);
+ bpmnRequest.setVnfType(vnfTypeInput);
+ bpmnRequest.setVfModuleType(vfModuleTypeInput);
+ bpmnRequest.setNetworkType(networkTypeInput);
+ //bpmnRequest.setRequestDetails(requestDetailsInput);
+
+ serviceInput.setValue(requestDetails);
+ camundaRequest.setServiceInput(serviceInput);
+ camundaRequest.setHost(host);
+ camundaRequest.setRequestId(requestIdInput);
+ camundaRequest.setAttMsoRequestId(requestIdInput);
+ camundaRequest.setIsBaseVfModule(isBaseVfModuleInput);
+ camundaRequest.setRecipeTimeout(recipeTimeoutInput);
+ camundaRequest.setRequestAction(requestActionInput);
+ camundaRequest.setServiceInstanceId(serviceInstanceIdInput);
+ camundaRequest.setVnfId(vnfIdInput);
+ camundaRequest.setVfModuleId(vfModuleIdInput);
+ camundaRequest.setVolumeGroupId(volumeGroupIdInput);
+ camundaRequest.setNetworkId(networkIdInput);
+ camundaRequest.setServiceType(serviceTypeInput);
+ camundaRequest.setVnfType(vnfTypeInput);
+ camundaRequest.setVfModuleType(vfModuleTypeInput);
+ camundaRequest.setNetworkType(networkTypeInput);
+
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(SerializationConfig.Feature.WRAP_ROOT_VALUE, true);
+
+ jsonReq = mapper.writeValueAsString(camundaRequest);
+ msoLogger.debug("request body is " + jsonReq);
+ }catch(Exception e){
+ msoLogger.error(MessageEnum.APIH_WARP_REQUEST, "Camunda", "wrapVIDRequest", MsoLogger.ErrorCode.BusinessProcesssError, "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/openecomp/mso/apihandler/common/CommonConstants.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java
new file mode 100644
index 0000000000..3a9ad60ac2
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.mso.apihandler.common;
+
+
+public final class CommonConstants {
+
+ public static final String DEFAULT_BPEL_AUTH = "admin:admin";
+ public static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f";
+
+ public static final String REQUEST_ID_HEADER = "att-mso-request-id";
+ public static final String REQUEST_TIMEOUT_HEADER = "att-mso-service-request-timeout";
+ public static final String SCHEMA_VERSION_HEADER = "att-mso-schema-version";
+ public static final String SERVICE_INSTANCE_ID_HEADER = "att-mso-service-instance-id";
+ public static final String ACTION_HEADER = "att-mso-action";
+
+ 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 = "camundaURL";
+ public static final String CAMUNDA_AUTH = "camundaAuth";
+ public static final String BPEL_SEARCH_STR = "active-bpel";
+ public static final String BPEL_URL = "bpelURL";
+ public static final String BPEL_AUTH = "bpelAuth";
+ public static final int BPEL = 0;
+ public static final int CAMUNDA = 1;
+ public static final String CAMUNDA_HOST = "host";
+ public static final String SDNC_UUID_HEADER = "att-mso-sdnc-request-id";
+
+ 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 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 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";
+
+ private CommonConstants () {
+ // prevent creating an instance of this class
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ErrorNumbers.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ErrorNumbers.java
new file mode 100644
index 0000000000..498952fe83
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ErrorNumbers.java
@@ -0,0 +1,70 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.mso.apihandler.common;
+
+public final class ErrorNumbers {
+
+ public static final String REQUEST_FAILED_SCHEMA_VALIDATION = "1000";
+ public static final String RECIPE_DOES_NOT_EXIST = "1010";
+ public static final String VFMODULE_TYPE_DOES_NOT_EXIST = "1011";
+ public static final String SERVICE_PARAMETERS_FAILED_SCHEMA_VALIDATION = "1020";
+ public static final String LOCKED_SAME_SERVICE_TYPE_AND_REQUEST_ACTION = "1030";
+ public static final String LOCKED_CANCEL_ON_REQUEST_IN_PROGRESS = "1031";
+ public static final String LOCKED_REQUEST_IN_PROGRESS_TIMEOUT = "1032";
+ public static final String LOCKED_NOT_ALLOWED_FOR_REQUEST_IN_PROGRESS = "1033";
+ public static final String WITHDRAW_AFTER_COMPLETE = "1034";
+ public static final String COMPLETE_AFTER_WITHDRAW = "1035"; // NOT USED
+ public static final String REQUEST_PREVIOUSLY_COMPLETED = "1036";
+ public static final String CANNOT_RETRY_FINAL_ACTIVATION = "1037";
+ public static final String PREVIOUSLY_COMPLETED_WITH_DIFF_ORDER_VERSION = "1038";
+ public static final String LOCKED_DIFFERENT_REQUEST_ACTION = "1040";
+ public static final String LOCKED_DIFF_REQUEST_ACTION_SAME_SERVICE_INSTANCE_ID = "1041";
+ public static final String REQUEST_TIMED_OUT = "1050";
+
+ 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";
+
+ public static final String ERROR_FROM_BPEL = "2000";
+ public static final String NO_COMMUNICATION_TO_BPEL = "2010";
+ public static final String NO_RESPONSE_FROM_BPEL = "2020";
+
+ public static final String COULD_NOT_WRITE_TO_REQUESTS_DB = "4000";
+ public static final String NO_COMMUNICATION_TO_REQUESTS_DB = "4010";
+ public static final String NO_COMMUNICATION_TO_CATALOG_DB = "4020";
+ public static final String ERROR_FROM_CATALOG_DB = "4030";
+
+ public static final String ERROR_FROM_SDNC = "5300";
+ public static final String NO_COMMUNICATION_TO_SDNC = "5310";
+ public static final String NO_RESPONSE_FROM_SDNC = "5320";
+
+ 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";
+ public static final String SVC_DETAILED_SERVICE_ERROR = "SVC2000";
+
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/LSInputImpl.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/LSInputImpl.java
new file mode 100644
index 0000000000..ea26d25212
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/LSInputImpl.java
@@ -0,0 +1,122 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.mso.apihandler.common;
+
+
+import java.io.InputStream;
+import java.io.Reader;
+
+import org.w3c.dom.ls.LSInput;
+
+public class LSInputImpl implements LSInput {
+
+ protected String fPublicId;
+ protected String fSystemId;
+ protected String fBaseSystemId;
+ protected InputStream fByteStream;
+ protected Reader fCharStream;
+ protected String fData;
+ protected String fEncoding;
+ protected boolean fCertifiedText;
+
+ public LSInputImpl () {
+ }
+
+ @Override
+ public InputStream getByteStream () {
+ return fByteStream;
+ }
+
+ @Override
+ public void setByteStream (InputStream byteStream) {
+ fByteStream = byteStream;
+ }
+
+ @Override
+ public Reader getCharacterStream () {
+ return fCharStream;
+ }
+
+ @Override
+ public void setCharacterStream (Reader characterStream) {
+ fCharStream = characterStream;
+ }
+
+ @Override
+ public String getStringData () {
+ return fData;
+ }
+
+ @Override
+ public void setStringData (String stringData) {
+ fData = stringData;
+ }
+
+ @Override
+ public String getEncoding () {
+ return fEncoding;
+ }
+
+ @Override
+ public void setEncoding (String encoding) {
+ fEncoding = encoding;
+ }
+
+ @Override
+ public String getPublicId () {
+ return fPublicId;
+ }
+
+ @Override
+ public void setPublicId (String publicId) {
+ fPublicId = publicId;
+ }
+
+ @Override
+ public String getSystemId () {
+ return fSystemId;
+ }
+
+ @Override
+ public void setSystemId (String systemId) {
+ fSystemId = systemId;
+ }
+
+ @Override
+ public String getBaseURI () {
+ return fBaseSystemId;
+ }
+
+ @Override
+ public void setBaseURI (String baseURI) {
+ fBaseSystemId = baseURI;
+ }
+
+ @Override
+ public boolean getCertifiedText () {
+ return fCertifiedText;
+ }
+
+ @Override
+ public void setCertifiedText (boolean certifiedText) {
+ fCertifiedText = certifiedText;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/PathResourceResolver.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/PathResourceResolver.java
new file mode 100644
index 0000000000..ec1e1aee97
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/PathResourceResolver.java
@@ -0,0 +1,64 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.mso.apihandler.common;
+
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import org.w3c.dom.ls.LSInput;
+import org.w3c.dom.ls.LSResourceResolver;
+
+import org.openecomp.mso.logger.MsoLogger;
+
+public class PathResourceResolver implements LSResourceResolver {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH);
+
+ private String path;
+
+ public PathResourceResolver(String 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) {
+ msoLogger.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/openecomp/mso/apihandler/common/RequestClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java
new file mode 100644
index 0000000000..0b796d5ac2
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java
@@ -0,0 +1,95 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.mso.apihandler.common;
+
+import java.io.IOException;
+import java.security.GeneralSecurityException;
+import java.util.Properties;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.HttpClient;
+
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.properties.MsoJavaProperties;
+import org.openecomp.mso.utils.CryptoUtils;
+
+public abstract class RequestClient {
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH);
+ protected MsoJavaProperties props;
+ protected String url;
+ protected HttpClient client;
+ private int type;
+
+ public RequestClient(int type){
+ this.type = type;
+ }
+
+ public void setProps(MsoJavaProperties props) {
+ this.props = props;
+ }
+
+ 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 ClientProtocolException, IOException;
+
+ public abstract HttpResponse post(String request) throws ClientProtocolException, IOException;
+
+ public abstract HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails)
+ throws ClientProtocolException, IOException;
+
+ protected String getEncryptedPropValue (String prop, String defaultValue, String encryptionKey) {
+ try {
+ String result = CryptoUtils.decrypt(prop, encryptionKey);
+ return result;
+ }
+ catch (GeneralSecurityException e) {
+ msoLogger.debug("Security exception", e);
+ }
+ return defaultValue;
+ }
+
+
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientFactory.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientFactory.java
new file mode 100644
index 0000000000..9dc43c7e7a
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientFactory.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.mso.apihandler.common;
+
+
+import java.util.Properties;
+
+import org.apache.http.impl.client.DefaultHttpClient;
+
+import org.openecomp.mso.properties.MsoJavaProperties;
+
+public class RequestClientFactory {
+
+ //based on URI, returns BPEL or Camunda client
+ public static RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{
+ RequestClient retClient;
+ if(props ==null){
+ throw new IllegalStateException("properties is null");
+ }
+ String url = null;
+ if(orchestrationURI.contains(CommonConstants.BPEL_SEARCH_STR)){
+ url = props.getProperty(CommonConstants.BPEL_URL,null) + orchestrationURI;
+ retClient= new BPELRestClient();
+
+ }else{
+ url = props.getProperty(CommonConstants.CAMUNDA_URL,null) + orchestrationURI;
+ retClient = new CamundaClient();
+ }
+ retClient.setClient(new DefaultHttpClient());
+ retClient.setProps(props);
+ retClient.setUrl(url);
+ return retClient;
+
+ }
+
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ResponseHandler.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ResponseHandler.java
new file mode 100644
index 0000000000..2edf686e07
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ResponseHandler.java
@@ -0,0 +1,173 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.mso.apihandler.common;
+
+
+import java.io.IOException;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.apache.http.util.EntityUtils;
+import org.codehaus.jackson.map.ObjectMapper;
+
+import org.openecomp.mso.apihandler.camundabeans.CamundaResponse;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.logger.MessageEnum;
+
+public class ResponseHandler {
+
+ private CamundaResponse response;
+ private int status;
+ private String responseBody="";
+ private HttpResponse httpResponse;
+ private int type;
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH);
+
+ public ResponseHandler(HttpResponse httpResponse, int type) {
+ this.httpResponse = httpResponse;
+ this.type=type;
+ parseResponse();
+ }
+
+
+ private void parseResponse() {
+ int statusCode = httpResponse.getStatusLine().getStatusCode();
+ msoLogger.debug("Returned status is: " + statusCode);
+ status = setStatus(statusCode);
+ msoLogger.debug("Parsed status is: " + status);
+ if(type==CommonConstants.CAMUNDA){
+ parseCamunda();
+ }else{
+ parseBpel();
+ }
+
+ }
+
+
+
+ private void parseCamunda(){
+ try{
+ HttpEntity entity = httpResponse.getEntity();
+ responseBody = EntityUtils.toString(entity);
+ } catch (IOException e) {
+ msoLogger.debug("IOException getting Camunda response body", e);
+ }
+
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ response = mapper.readValue(responseBody, CamundaResponse.class);
+ } catch (IOException e) {
+ msoLogger.debug("IOException getting Camunda response body", e);
+ }
+ msoLogger.debug("json response is: " + responseBody);
+ if(response!=null){
+ responseBody = response.getResponse();
+ }
+ msoLogger.debug("response body is: " + responseBody);
+
+
+ if(status!=HttpStatus.SC_ACCEPTED){
+ msoLogger.error(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, "Camunda", String.valueOf(status), responseBody, "Camunda", "parseCamunda", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH from Camunda");
+ }
+ }
+
+ private void parseBpel(){
+
+ HttpEntity bpelEntity = httpResponse.getEntity();
+
+ try {
+ if (bpelEntity!=null) {
+ responseBody = EntityUtils.toString(bpelEntity);
+ msoLogger.debug("response body is: " + responseBody);
+
+ }
+ if(status!=HttpStatus.SC_ACCEPTED){
+ msoLogger.error(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, "BPEL", String.valueOf(status), responseBody, "BPEL", "parseBpel", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH from BPEL");
+ }
+ }
+ catch (IOException e) {
+ msoLogger.debug("IOException getting BPEL response body", e);
+ }
+ }
+
+
+
+
+ private int setStatus(int statusCode){
+ int status = 0;
+ switch(statusCode) {
+ case HttpStatus.SC_ACCEPTED:
+ case HttpStatus.SC_OK:
+ status = HttpStatus.SC_ACCEPTED;
+ break;
+ case HttpStatus.SC_BAD_REQUEST:
+ status = HttpStatus.SC_BAD_REQUEST;
+ break;
+ case HttpStatus.SC_UNAUTHORIZED:
+ case HttpStatus.SC_FORBIDDEN:
+ status = HttpStatus.SC_INTERNAL_SERVER_ERROR;
+ break;
+ case HttpStatus.SC_NOT_FOUND:
+ status = HttpStatus.SC_NOT_IMPLEMENTED;
+ break;
+ case HttpStatus.SC_INTERNAL_SERVER_ERROR:
+ status = HttpStatus.SC_BAD_GATEWAY;
+ break;
+ case HttpStatus.SC_SERVICE_UNAVAILABLE:
+ status = HttpStatus.SC_SERVICE_UNAVAILABLE;
+ break;
+ default:
+ status = HttpStatus.SC_INTERNAL_SERVER_ERROR;
+ break;
+ }
+ return status;
+ }
+
+
+ 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/openecomp/mso/apihandler/common/ValidationException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ValidationException.java
new file mode 100644
index 0000000000..0136a2d3b7
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ValidationException.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.mso.apihandler.common;
+
+
+public class ValidationException extends Exception {
+
+ /**
+ * This class simply extends Exception (without addition additional functionality)
+ * to provide an identifier for RequestsDB related exceptions on create, delete, query.
+ *
+ *
+ **/
+
+ private static final long serialVersionUID = 1L;
+ private static final String validationFailMessage = "No valid $ELEMENT is specified";
+
+ public ValidationException (String msg) {
+ super (validationFailMessage.replaceAll ("\\$ELEMENT", msg));
+ }
+
+ public ValidationException (String msg, Exception cause) {
+ super (validationFailMessage.replaceAll ("\\$ELEMENT", msg), cause);
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/XMLValidator.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/XMLValidator.java
new file mode 100644
index 0000000000..bd73b226a2
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/XMLValidator.java
@@ -0,0 +1,103 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.mso.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.xml.sax.SAXException;
+
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoAlarmLogger;
+import org.openecomp.mso.logger.MsoLogger;
+
+public class XMLValidator {
+
+ private static String XSDS_PATH;
+
+ static {
+ String prefixMsoPropertiesPath = System.getProperty ("mso.config.path");
+ if (prefixMsoPropertiesPath == null) {
+ prefixMsoPropertiesPath = "";
+ }
+ XSDS_PATH = prefixMsoPropertiesPath + "xsds/";
+ }
+
+ private String stringXsd;
+ private String errorMsg = null;
+ private SchemaFactory factory;
+ private Schema schema;
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+ private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
+
+ public XMLValidator (String xsdFile) {
+
+ try (FileInputStream xsdStream = new FileInputStream (XSDS_PATH + xsdFile)) {
+
+ 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);
+
+ String quotedXsd = stringXsd.replaceAll ("&#34;", "\"");
+ Source src = new StreamSource (new java.io.StringReader (quotedXsd));
+ schema = factory.newSchema (src);
+
+ } catch (IOException | SAXException e) {
+ msoLogger.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) {
+ try {
+ if (errorMsg != null && !errorMsg.isEmpty ()) {
+ return errorMsg;
+ }
+ Source src2 = new StreamSource (new java.io.StringReader (stringXml));
+ Validator validator = schema.newValidator ();
+ validator.validate (src2);
+
+ } catch (IOException | SAXException e) {
+ msoLogger.debug ("Exception: ", e);
+ return ("ErrorDetails: " + e.getMessage ());
+
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_CANNOT_READ_SCHEMA, "", "", MsoLogger.ErrorCode.SchemaError, "APIH cannot read schema file", e);
+ alarmLogger.sendAlarm ("MsoConfigurationError", MsoAlarmLogger.CRITICAL, "Unable to read the schema file");
+ return "ErrorDetails: " + "Unable to read the schema file";
+ }
+
+ return null;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/package-info.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/package-info.java
new file mode 100644
index 0000000000..790edd3f3e
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/package-info.java
@@ -0,0 +1,25 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 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=========================================================
+ */
+
+/**
+ * Common classes for API Handlers.
+ */
+package org.openecomp.mso.apihandler.common;
+
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/BPELRestClientTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/BPELRestClientTest.java
new file mode 100644
index 0000000000..46e3a4602f
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/BPELRestClientTest.java
@@ -0,0 +1,126 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.mso.camunda.tests;
+
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.Properties;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.apache.http.ProtocolVersion;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.message.BasicHttpResponse;
+import org.apache.http.message.BasicStatusLine;
+import org.codehaus.jackson.JsonGenerationException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+
+import org.openecomp.mso.apihandler.common.CommonConstants;
+import org.openecomp.mso.apihandler.common.RequestClient;
+import org.openecomp.mso.apihandler.common.RequestClientFactory;
+import org.openecomp.mso.properties.MsoJavaProperties;
+
+
+/**
+ * This class implements test methods of Camunda Beans.
+ *
+ *
+ */
+public class BPELRestClientTest {
+
+
+
+ @Mock
+ private HttpClient mockHttpClient;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void tesBPELPost() throws JsonGenerationException,
+ JsonMappingException, IOException {
+
+
+ String responseBody ="<layer3activate:service-response xmlns:layer3activate=\"http://ecomp.att.com/mso/request/layer3serviceactivate/schema/v1\""
+ + "xmlns:reqtype=\"http://ecomp.att.com/mso/request/types/v1\""
+ + "xmlns:aetgt=\"http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd\""
+ + "xmlns:types=\"http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd\">"
+ + "<reqtype:request-id>req5</reqtype:request-id>"
+ + "<reqtype:request-action>Layer3ServiceActivateRequest</reqtype:request-action>"
+ + "<reqtype:source>OMX</reqtype:source>"
+ + "<reqtype:ack-final-indicator>n</reqtype:ack-final-indicator>"
+ + "</layer3activate:service-response>";
+
+ HttpResponse mockResponse = createResponse(200, responseBody);
+ mockHttpClient = Mockito.mock(HttpClient.class);
+ Mockito.when(mockHttpClient.execute(Mockito.any(HttpPost.class)))
+ .thenReturn(mockResponse);
+
+ String reqXML = "<xml>test</xml>";
+ String orchestrationURI = "/active-bpel/services/REST/MsoLayer3ServiceActivate";
+
+ MsoJavaProperties props = new MsoJavaProperties();
+ props.setProperty(CommonConstants.BPEL_URL, "http://localhost:8089");
+ props.setProperty("bpelAuth", "786864AA53D0DCD881AED1154230C0C3058D58B9339D2EFB6193A0F0D82530E1");
+
+ RequestClient requestClient = RequestClientFactory.getRequestClient(orchestrationURI, props);
+ requestClient.setClient(mockHttpClient);
+ HttpResponse response = requestClient.post(reqXML, "reqId", "timeout", "version", null, null);
+
+
+ int statusCode = response.getStatusLine().getStatusCode();
+ assertEquals(requestClient.getType(), CommonConstants.BPEL);
+ assertEquals(statusCode, HttpStatus.SC_OK);
+
+
+ }
+
+ 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));
+ response.setHeader("Content-Type", "text/xml");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return response;
+ }
+
+
+
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java
new file mode 100644
index 0000000000..d8c0e52005
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java
@@ -0,0 +1,123 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.mso.camunda.tests;
+
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+
+import java.util.Properties;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.apache.http.ProtocolVersion;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.message.BasicHttpResponse;
+import org.apache.http.message.BasicStatusLine;
+import org.codehaus.jackson.JsonGenerationException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+
+import org.openecomp.mso.apihandler.common.CommonConstants;
+import org.openecomp.mso.apihandler.common.RequestClient;
+import org.openecomp.mso.apihandler.common.RequestClientFactory;
+import org.openecomp.mso.properties.MsoJavaProperties;
+
+
+/**
+ * This class implements test methods of Camunda Beans.
+ *
+ *
+ */
+public class CamundaClientTest {
+
+
+
+ @Mock
+ private HttpClient mockHttpClient;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ 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}";
+
+ HttpResponse mockResponse = createResponse(200, responseBody);
+ mockHttpClient = Mockito.mock(HttpClient.class);
+ Mockito.when(mockHttpClient.execute(Mockito.any(HttpPost.class)))
+ .thenReturn(mockResponse);
+
+ String reqXML = "<xml>test</xml>";
+ String orchestrationURI = "/engine-rest/process-definition/key/dummy/start";
+
+ MsoJavaProperties props = new MsoJavaProperties();
+ props.setProperty(CommonConstants.CAMUNDA_URL, "http://localhost:8089");
+
+ RequestClient requestClient = RequestClientFactory.getRequestClient(orchestrationURI, props);
+ requestClient.setClient(mockHttpClient);
+ HttpResponse response = requestClient.post(reqXML, "reqId", "timeout", "version", null, null);
+
+
+ int statusCode = response.getStatusLine().getStatusCode();
+ assertEquals(requestClient.getType(), CommonConstants.CAMUNDA);
+ assertEquals(statusCode, HttpStatus.SC_OK);
+
+ props.setProperty (CommonConstants.CAMUNDA_AUTH, "ABCD1234");
+ requestClient = RequestClientFactory.getRequestClient(orchestrationURI, props);
+ requestClient.setClient(mockHttpClient);
+ response = requestClient.post(null, "reqId", null, null, null, null);
+ assertEquals(requestClient.getType(), CommonConstants.CAMUNDA);
+ assertEquals(statusCode, HttpStatus.SC_OK);
+ }
+
+ 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));
+ response.setHeader("Content-Type", "application/json");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return response;
+ }
+
+
+
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaRequestTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaRequestTest.java
new file mode 100644
index 0000000000..bd2fee6f1e
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaRequestTest.java
@@ -0,0 +1,81 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.mso.camunda.tests;
+
+
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+
+import org.codehaus.jackson.JsonGenerationException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.map.SerializationConfig;
+import org.junit.Test;
+
+import org.openecomp.mso.apihandler.camundabeans.CamundaInput;
+import org.openecomp.mso.apihandler.camundabeans.CamundaRequest;
+import org.openecomp.mso.apihandler.common.CommonConstants;
+
+/**
+ * This class implements test methods of Camunda Beans.
+ *
+ *
+ */
+public class CamundaRequestTest {
+
+ @Test
+ public final void testSerialization() throws JsonGenerationException,
+ JsonMappingException, IOException {
+ 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("<aetgt:CreateTenantRequest xmlns:aetgt=\"http://ecomp.att.com/mso/workflow/schema/v1\" xmlns:sdncadapterworkflow=\"http://ecomp.att.com/mso/workflow/schema/v1\" xmlns:ns5=\"http://ecomp.att.com/mso/request/types/v1\"> <msoservtypes:request-information xmlns:msoservtypes=\"http://ecomp.att.com/mso/request/types/v1\"><msoservtypes:request-id>155415ab-b4a7-4382-b4c6-d17d950604</msoservtypes:request-id><msoservtypes:request-action>Layer3ServiceActivateRequest</msoservtypes:request-action><msoservtypes:source>OMX</msoservtypes:source><msoservtypes:notification-url>https://csi-tst-q22.it.att.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</msoservtypes:notification-url><msoservtypes:order-number>5051563</msoservtypes:order-number><msoservtypes:order-version>1</msoservtypes:order-version> </msoservtypes:request-information> <msoservtypes:service-information xmlns:msoservtypes=\"http://ecomp.att.com/mso/request/types/v1\"><msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type><msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id><msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> <sdncadapterworkflow:cloudId>MTSNJA4LCP1</sdncadapterworkflow:cloudId> </aetgt:CreateTenantRequest>");
+ camundaRequest.setServiceInput(camundaInput);
+ host.setValue("localhost");
+ camundaRequest.setHost(host);
+ schema.setValue("v1");
+ camundaRequest.setSchema(schema);
+ reqid.setValue("reqid123");
+ camundaRequest.setReqid(reqid);
+ svcid.setValue("svcid123");
+ camundaRequest.setSvcid(svcid);
+ timeout.setValue("");
+ camundaRequest.setTimeout(timeout);
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(SerializationConfig.Feature.WRAP_ROOT_VALUE, true);
+
+ String json = mapper.writeValueAsString(camundaRequest);
+ System.out.println(json);
+ assertEquals(
+ "{\"variables\":{\""+CommonConstants.CAMUNDA_SERVICE_INPUT+"\":{\"value\":\"<aetgt:CreateTenantRequest xmlns:aetgt=\\\"http://ecomp.att.com/mso/workflow/schema/v1\\\" xmlns:sdncadapterworkflow=\\\"http://ecomp.att.com/mso/workflow/schema/v1\\\" xmlns:ns5=\\\"http://ecomp.att.com/mso/request/types/v1\\\"> <msoservtypes:request-information xmlns:msoservtypes=\\\"http://ecomp.att.com/mso/request/types/v1\\\"><msoservtypes:request-id>155415ab-b4a7-4382-b4c6-d17d950604</msoservtypes:request-id><msoservtypes:request-action>Layer3ServiceActivateRequest</msoservtypes:request-action><msoservtypes:source>OMX</msoservtypes:source><msoservtypes:notification-url>https://csi-tst-q22.it.att.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</msoservtypes:notification-url><msoservtypes:order-number>5051563</msoservtypes:order-number><msoservtypes:order-version>1</msoservtypes:order-version> </msoservtypes:request-information> <msoservtypes:service-information xmlns:msoservtypes=\\\"http://ecomp.att.com/mso/request/types/v1\\\"><msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type><msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id><msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> <sdncadapterworkflow:cloudId>MTSNJA4LCP1</sdncadapterworkflow:cloudId> </aetgt:CreateTenantRequest>\",\"type\":\"String\"}" +
+ ",\"host\":{\"value\":\"localhost\",\"type\":\"String\"},\"att-mso-schema-version\":{\"value\":\"v1\",\"type\":\"String\"},\"att-mso-request-id\":{\"value\":\"reqid123\",\"type\":\"String\"},\"att-mso-service-instance-id\":{\"value\":\"svcid123\",\"type\":\"String\"},\"att-mso-service-request-timeout\":{\"value\":\"\",\"type\":\"String\"}}}",
+ json);
+
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaResponseTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaResponseTest.java
new file mode 100644
index 0000000000..aff8ab2a2c
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaResponseTest.java
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.mso.camunda.tests;
+
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+
+import org.codehaus.jackson.JsonGenerationException;
+import org.codehaus.jackson.map.DeserializationConfig;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.junit.Test;
+
+import org.openecomp.mso.apihandler.camundabeans.CamundaResponse;
+
+/**
+ * This class implements test methods of Camunda Beans.
+ *
+ *
+ */
+public class CamundaResponseTest {
+
+ @Test
+ public final void testDeserialization() throws JsonGenerationException,
+ JsonMappingException, IOException {
+ ObjectMapper mapper = new ObjectMapper(); // can reuse, share globally
+ mapper.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+
+ String responseBody = "{ \"response\": \"<xml>xml</xml>\","+
+ "\"messageCode\": 200,"+
+ "\"message\": \"Successfully started the process\"," +
+ "\"processInstanceID\":null,\"variables\":null}";
+
+ CamundaResponse response = mapper.readValue(responseBody, CamundaResponse.class);
+ assertEquals(response.toString(), "CamundaResponse [response=<xml>xml</xml>, messageCode=200, message=Successfully started the process]");
+
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/ResponseHandlerTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/ResponseHandlerTest.java
new file mode 100644
index 0000000000..ba2c5524b5
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/ResponseHandlerTest.java
@@ -0,0 +1,131 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.mso.camunda.tests;
+
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.apache.http.ProtocolVersion;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.message.BasicHttpResponse;
+import org.apache.http.message.BasicStatusLine;
+import org.codehaus.jackson.JsonGenerationException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.junit.Test;
+
+import org.openecomp.mso.apihandler.common.ResponseHandler;
+
+/**
+ * This class implements test methods of CamundaResoponseHandler.
+ *
+ *
+ */
+public class ResponseHandlerTest {
+
+ @Test
+ public void tesParseCamundaResponse () throws JsonGenerationException, JsonMappingException, IOException {
+ // 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\"}";
+
+ 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");
+
+ }
+
+ @Test
+ public void tesParseBpelResponse () throws JsonGenerationException, JsonMappingException, IOException {
+ String body = "<layer3activate:service-response xmlns:layer3activate=\"http://ecomp.att.com/mso/request/layer3serviceactivate/schema/v1\""
+ + "xmlns:reqtype=\"http://ecomp.att.com/mso/request/types/v1\""
+ + "xmlns:aetgt=\"http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd\""
+ + "xmlns:types=\"http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd\">"
+ + "<reqtype:request-id>req5</reqtype:request-id>"
+ + "<reqtype:request-action>Layer3ServiceActivateRequest</reqtype:request-action>"
+ + "<reqtype:source>OMX</reqtype:source>"
+ + "<reqtype:ack-final-indicator>n</reqtype:ack-final-indicator>"
+ + "</layer3activate:service-response>";
+
+ HttpResponse response = createResponse (200, body, "text/xml");
+
+ ResponseHandler respHandler = new ResponseHandler (response, 0);
+
+ int status = respHandler.getStatus ();
+ assertEquals (status, HttpStatus.SC_ACCEPTED);
+ assertTrue (respHandler.getResponseBody () != null);
+ }
+
+ @Test
+ public void tes404ErrorResponse () throws JsonGenerationException, JsonMappingException, IOException {
+
+
+ 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);
+
+ }
+
+ @Test
+ public void tesGenricErrorResponse () throws JsonGenerationException, JsonMappingException, IOException {
+
+ String body = "{ \"response\": \"<xml>xml</xml>\"," + "\"messageCode\": 500,"
+ + "\"message\": \"Something went wrong\"}";
+
+ HttpResponse response = createResponse (500, body, "application/json");
+
+ ResponseHandler respHandler = new ResponseHandler (response, 1);
+
+ int status = respHandler.getStatus ();
+ assertEquals (HttpStatus.SC_BAD_GATEWAY, status);
+ assertEquals (respHandler.getResponse ().getMessage (), "Something went wrong");
+ System.out.println (respHandler.getResponseBody ());
+
+ }
+
+ 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);
+ } catch (Exception e) {
+ e.printStackTrace ();
+ }
+ return response;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/resources/logback-test.xml b/mso-api-handlers/mso-api-handler-common/src/test/resources/logback-test.xml
new file mode 100644
index 0000000000..d2c17192ea
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/test/resources/logback-test.xml
@@ -0,0 +1,48 @@
+<!--
+ ============LICENSE_START=======================================================
+ ECOMP MSO
+ ================================================================================
+ Copyright (C) 2017 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=========================================================
+ -->
+
+<configuration >
+
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n</pattern>
+ </encoder>
+ </appender>
+
+
+ <logger name="com.att.eelf.audit" level="info" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <logger name="com.att.eelf.metrics" level="info" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <logger name="com.att.eelf.error" level="trace" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <root level="info">
+ <appender-ref ref="STDOUT" />
+ </root>
+
+
+</configuration>