summaryrefslogtreecommitdiffstats
path: root/adapters/mso-workflow-message-adapter
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2018-07-30 15:56:09 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2018-07-31 11:09:25 -0400
commit5a6a6de6f1a26a1897e4917a0df613e25a24eb70 (patch)
tree59a968f27b4b603aacc9d5e7b51fb598aeec5321 /adapters/mso-workflow-message-adapter
parentb6dc38501f3b746426b42d9de4cc883d894149e8 (diff)
Containerization feature of SO
Change-Id: I95381232eeefcd247a66a5cec370a8ce1c288e18 Issue-ID: SO-670 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'adapters/mso-workflow-message-adapter')
-rw-r--r--adapters/mso-workflow-message-adapter/WebContent/META-INF/MANIFEST.MF4
-rw-r--r--adapters/mso-workflow-message-adapter/WebContent/WEB-INF/jboss-deployment-structure.xml22
-rw-r--r--adapters/mso-workflow-message-adapter/WebContent/WEB-INF/jboss-web.xml3
-rw-r--r--adapters/mso-workflow-message-adapter/WebContent/WEB-INF/web.xml84
-rw-r--r--adapters/mso-workflow-message-adapter/WebContent/check.html10
-rw-r--r--adapters/mso-workflow-message-adapter/pom.xml72
-rw-r--r--adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/BPRestCallback.java178
-rw-r--r--adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterConstants.java30
-rw-r--r--adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterProperties.java89
-rw-r--r--adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterRest.java140
-rw-r--r--adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterUtils.java49
-rw-r--r--adapters/mso-workflow-message-adapter/src/test/java/org/onap/so/adapters/workflowmessage/BPRestCallbackTest.java (renamed from adapters/mso-workflow-message-adapter/src/test/java/org/openecomp/mso/adapters/workflowmessage/BPRestCallbackTest.java)6
-rw-r--r--adapters/mso-workflow-message-adapter/src/test/java/org/onap/so/adapters/workflowmessage/WMAdapterRestTest.java (renamed from adapters/mso-workflow-message-adapter/src/test/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterRestTest.java)2
-rw-r--r--adapters/mso-workflow-message-adapter/src/test/resources/logback-test.xml25
14 files changed, 4 insertions, 710 deletions
diff --git a/adapters/mso-workflow-message-adapter/WebContent/META-INF/MANIFEST.MF b/adapters/mso-workflow-message-adapter/WebContent/META-INF/MANIFEST.MF
deleted file mode 100644
index bbf7aa0cf9..0000000000
--- a/adapters/mso-workflow-message-adapter/WebContent/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,4 +0,0 @@
-Manifest-Version: 1.0
-Dependencies: org.jboss.logging
-Class-Path:
-
diff --git a/adapters/mso-workflow-message-adapter/WebContent/WEB-INF/jboss-deployment-structure.xml b/adapters/mso-workflow-message-adapter/WebContent/WEB-INF/jboss-deployment-structure.xml
deleted file mode 100644
index f6cef8a2ce..0000000000
--- a/adapters/mso-workflow-message-adapter/WebContent/WEB-INF/jboss-deployment-structure.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<jboss-deployment-structure>
- <deployment>
- <!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->
- <exclusions>
- <module name="org.apache.log4j" />
- <module name="org.slf4j" />
- <module name="org.slf4j.impl" />
- <module name="org.jboss.resteasy.resteasy-jackson-provider" />
- <module name="org.jboss.resteasy.resteasy-jettison-provider" />
- </exclusions>
- <dependencies>
- <module name="org.jboss.jandex" slot="main" />
- <module name="org.javassist" slot="main" />
- <module name="org.antlr" slot="main" />
- <module name="org.dom4j" slot="main" />
- <module name="org.jboss.resteasy.resteasy-jackson2-provider" services="import" />
- <!-- This module contain the ProviderBase class: -->
- <module name="com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider" export="true" />
- </dependencies>
- </deployment>
-</jboss-deployment-structure>
-
diff --git a/adapters/mso-workflow-message-adapter/WebContent/WEB-INF/jboss-web.xml b/adapters/mso-workflow-message-adapter/WebContent/WEB-INF/jboss-web.xml
deleted file mode 100644
index a6ab6790c1..0000000000
--- a/adapters/mso-workflow-message-adapter/WebContent/WEB-INF/jboss-web.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-<jboss-web>
- <context-root>workflows/messages</context-root>
-</jboss-web> \ No newline at end of file
diff --git a/adapters/mso-workflow-message-adapter/WebContent/WEB-INF/web.xml b/adapters/mso-workflow-message-adapter/WebContent/WEB-INF/web.xml
deleted file mode 100644
index c26a444465..0000000000
--- a/adapters/mso-workflow-message-adapter/WebContent/WEB-INF/web.xml
+++ /dev/null
@@ -1,84 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://java.sun.com/xml/ns/javaee"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
- id="WebApp_ID"
- version="3.0">
- <display-name>mso-workflow-message-adapter</display-name>
- <welcome-file-list>
- <welcome-file>check.html</welcome-file>
- </welcome-file-list>
- <context-param>
- <param-name>log.configuration</param-name>
- <param-value>logback.workflow-message-adapter.xml</param-value>
- </context-param>
- <context-param>
- <param-name>mso.configuration</param-name>
- <param-value>MSO_PROP_WORKFLOW_MESSAGE_ADAPTER=mso.workflow-message-adapter.properties,MSO_PROP_TOPOLOGY=topology.properties,MSO_PROP_AAF=cadi.properties</param-value>
- </context-param>
- <context-param>
- <param-name>resteasy.resources</param-name>
- <param-value>
- org.openecomp.mso.logger.MsoLoggingServlet,
- org.openecomp.mso.MsoStatusHandler,
- org.openecomp.mso.adapters.workflowmessage.WMAdapterRest
- </param-value>
- </context-param>
- <context-param>
- <param-name>resteasy.providers</param-name>
- <param-value>org.openecomp.mso.adapters.providers.JettisonStyleMapperProvider</param-value>
- </context-param>
- <servlet>
- <servlet-name>Resteasy</servlet-name>
- <servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
- </servlet>
- <servlet-mapping>
- <servlet-name>Resteasy</servlet-name>
- <url-pattern>/*</url-pattern>
- </servlet-mapping>
- <filter>
- <filter-name>LogFilter</filter-name>
- <filter-class>org.openecomp.mso.logger.LogFilter</filter-class>
- </filter>
- <filter-mapping>
- <filter-name>LogFilter</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
- <listener>
- <listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
- </listener>
- <security-constraint>
- <web-resource-collection>
- <web-resource-name>SiteStatus</web-resource-name>
- <description>SiteStatus APIs</description>
- <url-pattern>/rest/setStatus/*</url-pattern>
- <http-method>POST</http-method>
- </web-resource-collection>
- <auth-constraint>
- <role-name>SiteControl-Client</role-name>
- </auth-constraint>
- </security-constraint>
- <security-constraint>
- <web-resource-collection>
- <web-resource-name>MSO internal Requests</web-resource-name>
- <description>Internal Requests</description>
- <url-pattern>/rest/logging/*</url-pattern>
- <url-pattern>/rest/properties/*</url-pattern>
- <http-method>POST</http-method>
- <http-method>GET</http-method>
- </web-resource-collection>
- <auth-constraint>
- <role-name>MSO-Client</role-name>
- </auth-constraint>
- </security-constraint>
- <login-config>
- <auth-method>BASIC</auth-method>
- <realm-name>ApplicationRealm</realm-name>
- </login-config>
- <security-role>
- <role-name>SiteControl-Client</role-name>
- </security-role>
- <security-role>
- <role-name>MSO-Client</role-name>
- </security-role>
-</web-app>
diff --git a/adapters/mso-workflow-message-adapter/WebContent/check.html b/adapters/mso-workflow-message-adapter/WebContent/check.html
deleted file mode 100644
index 454997901e..0000000000
--- a/adapters/mso-workflow-message-adapter/WebContent/check.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="ISO-8859-1">
-<title>Health Check</title>
-</head>
-<body>
-Application ready
-</body>
-</html> \ No newline at end of file
diff --git a/adapters/mso-workflow-message-adapter/pom.xml b/adapters/mso-workflow-message-adapter/pom.xml
deleted file mode 100644
index dd17fe87e8..0000000000
--- a/adapters/mso-workflow-message-adapter/pom.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-<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.onap.so</groupId>
- <artifactId>adapters</artifactId>
- <version>1.2.0-SNAPSHOT</version>
- </parent>
- <groupId>org.onap.so.adapters</groupId>
- <artifactId>mso-workflow-message-adapter</artifactId>
- <packaging>war</packaging>
- <name>mso-workflow-message-adapter</name>
- <description>mso workflow message adapter</description>
-
- <build>
- <finalName>${project.artifactId}-${project.version}</finalName>
- <plugins>
-
- <plugin>
- <artifactId>maven-war-plugin</artifactId>
- <version>2.4</version>
- <configuration>
- <warSourceDirectory>${basedir}/WebContent</warSourceDirectory>
- <failOnMissingWebXml>false</failOnMissingWebXml>
- <attachClasses>true</attachClasses>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.onap.so.adapters</groupId>
- <artifactId>mso-adapters-rest-interface</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>javax</groupId>
- <artifactId>javaee-web-api</artifactId>
- <version>6.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.spec.javax.ejb</groupId>
- <artifactId>jboss-ejb-api_3.1_spec</artifactId>
- <version>1.0.0.Final</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.ejb3</groupId>
- <artifactId>jboss-ejb3-ext-api</artifactId>
- <version>1.1.1</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- <version>4.5.5</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so</groupId>
- <artifactId>status-control</artifactId>
- <version>${project.version}</version>
- </dependency>
- <!-- For UriUtils which does URL encoding according to RFC 3986 Section 2 -->
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- <version>4.3.2.RELEASE</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/BPRestCallback.java b/adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/BPRestCallback.java
deleted file mode 100644
index 20880c24a6..0000000000
--- a/adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/BPRestCallback.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.adapters.workflowmessage;
-
-import javax.xml.bind.DatatypeConverter;
-
-import org.apache.http.HttpResponse;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.config.RequestConfig;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.ContentType;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.HttpClientBuilder;
-import org.apache.http.util.EntityUtils;
-
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoAlarmLogger;
-import org.openecomp.mso.logger.MsoLogger;
-
-/**
- * Sends asynchronous messages to the BPMN WorkflowMessage service.
- */
-public class BPRestCallback {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
- private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger();
-
- /**
- * Sends a message to the BPMN workflow message service. The URL path is
- * constructed using the specified message type and correlator.
- * @param workflowMessageUrl the base BPMN WorkflowMessage URL
- * @param messageType the message type
- * @param correlator the message correlator
- * @param contentType the value for the HTTP Content-Type header (possibly null)
- * @param message the content (possibly null)
- * @return true if the message was consumed successfully by the endpoint
- */
- public boolean send(String workflowMessageUrl, String messageType,
- String correlator, ContentType contentType, String message) {
- LOGGER.debug(getClass().getSimpleName() + ".send("
- + "workflowMessageUrl=" + workflowMessageUrl
- + " messageType=" + messageType
- + " correlator=" + correlator
- + " contentType=" + contentType
- + " message=" + message
- + ")");
-
- while (workflowMessageUrl.endsWith("/")) {
- workflowMessageUrl = workflowMessageUrl.substring(0, workflowMessageUrl.length()-1);
- }
-
- String endpoint = workflowMessageUrl + "/" + WMAdapterUtils.encodeURLPathSegment(messageType)
- + "/" + WMAdapterUtils.encodeURLPathSegment(correlator);
-
- return send(endpoint, contentType, message);
- }
-
- /**
- * Sends a message to the BPMN workflow message service. The specified URL
- * must have the message type and correlator already embedded in it.
- * @param url the endpoint URL
- * @param message the content (possibly null)
- * @param contentType the value for the HTTP Content-Type header (possibly null)
- * @return true if the message was consumed successfully by the endpoint
- */
- public boolean send(String url, ContentType contentType, String message) {
- LOGGER.debug(getClass().getSimpleName() + ".send("
- + "url=" + url
- + " contentType=" + contentType
- + " message=" + message
- + ")");
-
- LOGGER.info(MessageEnum.RA_CALLBACK_BPEL, message == null ? "[no content]" : message, "Camunda", "");
-
- HttpPost method = null;
- HttpResponse httpResponse = null;
-
- try {
- // TODO: configurable timeout?
- int timeout = 60 * 1000;
-
- RequestConfig requestConfig = RequestConfig.custom()
- .setSocketTimeout(timeout)
- .setConnectTimeout(timeout)
- .setConnectionRequestTimeout(timeout)
- .build();
-
- HttpClient client = HttpClientBuilder.create().build();
- method = new HttpPost(url);
- method.setConfig(requestConfig);
-
- if (message != null) {
- method.setEntity(new StringEntity(message, contentType));
- }
-
- boolean error = false;
-
- try {
- // AAF Integration, disabled for now due to the constrains from other party
- // String userCredentials = CredentialConstants.getDecryptedCredential(WMAdapterConstants.DEFAULT_BPEL_AUTH);
- // Once AAF enabled, the credential shall be get by triggering the CredentialConstants.getDecryptedCredential -- remove line
- String userCredentials = WMAdapterProperties.getEncryptedProperty(WMAdapterConstants.BPEL_AUTH_PROP,
- WMAdapterConstants.DEFAULT_BPEL_AUTH, WMAdapterConstants.ENCRYPTION_KEY);
- String authorization = "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes());
- method.setHeader("Authorization", authorization);
- } catch (Exception e) {
- LOGGER.error(MessageEnum.RA_SET_CALLBACK_AUTH_EXC, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError,
- "Unable to set authorization in callback request", e);
- ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL,
- "Unable to set authorization in callback request: " + e.getMessage());
- error = true;
- }
-
- if (!error) {
- httpResponse = client.execute(method);
-
- @SuppressWarnings("unused")
- String responseContent;
-
- if (httpResponse.getEntity() != null) {
- responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8");
- }
-
- if (httpResponse.getStatusLine().getStatusCode() >= 300) {
- String msg = "Received error response to callback request: " + httpResponse.getStatusLine();
- LOGGER.error(MessageEnum.RA_CALLBACK_BPEL_EXC, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError, msg);
- ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, msg);
- }
-
- }
-
- return true;
- } catch (Exception e) {
- LOGGER.error(MessageEnum.RA_CALLBACK_BPEL_EXC, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError,
- "Error sending callback request", e);
- ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL,
- "Error sending callback request: " + e.getMessage());
- return false;
- } finally {
- if (httpResponse != null) {
- try {
- EntityUtils.consume(httpResponse.getEntity());
- httpResponse = null;
- } catch (Exception e) {
- LOGGER.debug("Exception :",e);
- }
- }
-
- if (method != null) {
- try {
- method.reset();
- method = null;
- } catch (Exception e) {
- LOGGER.debug("Exception :",e);
- }
- }
-
- LOGGER.info(MessageEnum.RA_CALLBACK_BPEL_COMPLETE, "Camunda", "");
- }
- }
-}
diff --git a/adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterConstants.java b/adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterConstants.java
deleted file mode 100644
index 8b0877ff8b..0000000000
--- a/adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterConstants.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.adapters.workflowmessage;
-
-public interface WMAdapterConstants {
- public static final String MSO_PROPERTIES_ID = "MSO_PROP_WORKFLOW_MESSAGE_ADAPTER";
- public static final String BPEL_URL_PROP = "org.openecomp.mso.adapters.workflow.message.bpelurl";
-
- // Once AAF enabled, the credential shall be get by triggering the CredentialConstants.getEncryptedPropValue
- public static final String BPEL_AUTH_PROP = "org.openecomp.mso.adapters.workflow.message.bpelauth";
- public static final String DEFAULT_BPEL_AUTH = "05FDA034C27D1CA51AAB8FAE512EDE45241E16FC8C137D292AA3A964431C82DB";
- public static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f";
-} \ No newline at end of file
diff --git a/adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterProperties.java b/adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterProperties.java
deleted file mode 100644
index 9d57d2c001..0000000000
--- a/adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterProperties.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.adapters.workflowmessage;
-
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.properties.MsoJavaProperties;
-import org.openecomp.mso.properties.MsoPropertiesException;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-
-/**
- * Static methods to access Workflow Message Adapter properties.
- */
-public final class WMAdapterProperties {
- private static final MsoPropertiesFactory MSO_PROPERTIES_FACTORY = new MsoPropertiesFactory();
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
-
- /**
- * Gets the value of a Workflow Message Adapter property.
- * @param key the property key
- * @param defaultValue the default value to use if the property does not
- * exist or if an error occurs
- */
- public static String getProperty(String key, String defaultValue) {
- MsoJavaProperties properties;
-
- try {
- properties = MSO_PROPERTIES_FACTORY.getMsoJavaProperties(WMAdapterConstants.MSO_PROPERTIES_ID);
- } catch (MsoPropertiesException e) {
- LOGGER.error (MessageEnum.NO_PROPERTIES,
- "Unknown. MSO Properties ID not found in cache: " + WMAdapterConstants.MSO_PROPERTIES_ID,
- "WorkflowMessageAdatper", "", MsoLogger.ErrorCode.DataError,
- "Exception - MSO Properties ID not found in cache", e);
- return defaultValue;
- }
-
- String value = properties.getProperty(key, defaultValue);
- LOGGER.debug("Config read for " + WMAdapterConstants.MSO_PROPERTIES_ID
- + " - key:" + key + " value:" + value);
- return value;
- }
-
- /**
- * Gets the value of an Workflow Message Adapter property.
- * @param key the property key
- * @param defaultValue the default value to use if the property does not
- * exist or if an error occurs
- */
- public static String getEncryptedProperty(String key, String defaultValue, String encryptionKey) {
- MsoJavaProperties properties;
-
- try {
- properties = MSO_PROPERTIES_FACTORY.getMsoJavaProperties(WMAdapterConstants.MSO_PROPERTIES_ID);
- } catch (MsoPropertiesException e) {
- LOGGER.error (MessageEnum.NO_PROPERTIES,
- "Unknown. MSO Properties ID not found in cache: " + WMAdapterConstants.MSO_PROPERTIES_ID,
- "WorkflowMessageAdatper", "", MsoLogger.ErrorCode.DataError,
- "Exception - MSO Properties ID not found in cache", e);
- return defaultValue;
- }
-
- String value = properties.getEncryptedProperty(key, defaultValue, encryptionKey);
- LOGGER.debug("Config read for " + WMAdapterConstants.MSO_PROPERTIES_ID + " - key:" + key);
- return value;
- }
-
- /**
- * Instantiation is not allowed.
- */
- private WMAdapterProperties() {
- }
-} \ No newline at end of file
diff --git a/adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterRest.java b/adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterRest.java
deleted file mode 100644
index 4be6b93d5c..0000000000
--- a/adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterRest.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.adapters.workflowmessage;
-
-import javax.servlet.http.HttpServletResponse;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.HEAD;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.HeaderParam;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.apache.http.entity.ContentType;
-
-import org.openecomp.mso.HealthCheckUtils;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoAlarmLogger;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.utils.UUIDChecker;
-
-/**
- * Workflow Message Adapter interface added in 1707. Supports delivery of
- * callbacks from external systems to waiting BPMN workflows.
- */
-@Path("/")
-public class WMAdapterRest {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
- private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger();
-
- @HEAD
- @GET
- @Path("/healthcheck")
- @Produces(MediaType.TEXT_HTML)
- public Response healthcheck(@QueryParam("requestId") String requestId) {
- long startTime = System.currentTimeMillis();
- MsoLogger.setServiceName("Healthcheck");
- UUIDChecker.verifyOldUUID(requestId, LOGGER);
- HealthCheckUtils healthCheck = new HealthCheckUtils();
-
- if (!healthCheck.siteStatusCheck(LOGGER)) {
- return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE;
- }
-
- if (!healthCheck.configFileCheck(LOGGER, startTime, WMAdapterConstants.MSO_PROPERTIES_ID)) {
- return HealthCheckUtils.NOT_STARTED_RESPONSE;
- }
-
- LOGGER.debug("healthcheck - Successful");
- return HealthCheckUtils.HEALTH_CHECK_RESPONSE;
- }
-
- /**
- * Receives a message from a remote system.
- * @param content the message content
- */
- @POST
- @Path("/message/{messageType}/{correlator}")
- @Consumes("*/*")
- @Produces({MediaType.TEXT_PLAIN})
- public Response receiveWorkflowMessage(
- @HeaderParam("Content-Type") String contentTypeHeader,
- @PathParam("messageType") String messageType,
- @PathParam("correlator") String correlator,
- String content) {
-
- String path= "workflow/" + messageType + "/" + correlator;
- LOGGER.info(MessageEnum.RA_RECEIVE_WORKFLOW_MESSAGE, content, "WorkflowMessageAdapter", path);
-
- long startTime = System.currentTimeMillis();
-
- ContentType contentType = null;
-
- if (contentTypeHeader != null) {
- try {
- contentType = ContentType.parse(contentTypeHeader);
- } catch (Exception e) {
- // If we don't get a valid one, we handle it below.
- LOGGER.debug("Exception :",e);
- }
- }
-
- if (contentType == null && content != null) {
- String error = "Missing or Invalid Content-Type";
- LOGGER.error(MessageEnum.RA_PARSING_REQUEST_ERROR, error, "WorkflowMessageAdapter", path,
- MsoLogger.ErrorCode.DataError, "Bad Request");
- ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
- return Response.status(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE).entity(error).build();
- }
-
- String bpUrl = WMAdapterProperties.getProperty(WMAdapterConstants.BPEL_URL_PROP, null);
-
- if (bpUrl == null) {
- String error = "Missing configuration for: " + WMAdapterConstants.BPEL_URL_PROP;
- LOGGER.error(MessageEnum.RA_CONFIG_EXC, error, "WorkflowMessageAdapter", path,
- MsoLogger.ErrorCode.DataError, "Configuration Error");
- ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
- return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(error).build();
- }
-
- long bpStartTime = System.currentTimeMillis();
- BPRestCallback callback = new BPRestCallback();
- boolean callbackSuccess = callback.send(bpUrl, messageType, correlator, contentType, content);
-
- if (callbackSuccess) {
- LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Sent notification", "BPMN", bpUrl, null);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
- } else {
- LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
- "Failed to send notification", "BPMN", bpUrl, null);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
- "Failed to send notification");
- }
-
- return Response.status(204).build();
- }
-}
diff --git a/adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterUtils.java b/adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterUtils.java
deleted file mode 100644
index f152931ae5..0000000000
--- a/adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterUtils.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.adapters.workflowmessage;
-
-import java.io.UnsupportedEncodingException;
-
-import org.springframework.web.util.UriUtils;
-
-/**
- * Utility methods used by WMAdapterRest.
- */
-public final class WMAdapterUtils {
- /**
- * Encodes a URL path segment according to RFC 3986 Section 2.
- * @param pathSegment the path segment to encode
- * @return the encoded path segment
- */
- public static String encodeURLPathSegment(String pathSegment) {
- try {
- return UriUtils.encodePathSegment(pathSegment, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- throw new RuntimeException("UTF-8 encoding is not supported",e);
- }
- }
-
- /**
- * Instantiation is not allowed.
- */
- private WMAdapterUtils() {
- }
-} \ No newline at end of file
diff --git a/adapters/mso-workflow-message-adapter/src/test/java/org/openecomp/mso/adapters/workflowmessage/BPRestCallbackTest.java b/adapters/mso-workflow-message-adapter/src/test/java/org/onap/so/adapters/workflowmessage/BPRestCallbackTest.java
index 8d2c938c09..21917c3d2c 100644
--- a/adapters/mso-workflow-message-adapter/src/test/java/org/openecomp/mso/adapters/workflowmessage/BPRestCallbackTest.java
+++ b/adapters/mso-workflow-message-adapter/src/test/java/org/onap/so/adapters/workflowmessage/BPRestCallbackTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.workflowmessage;
+package org.onap.so.adapters.workflowmessage;
import org.apache.http.entity.ContentType;
import org.junit.Test;
diff --git a/adapters/mso-workflow-message-adapter/src/test/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterRestTest.java b/adapters/mso-workflow-message-adapter/src/test/java/org/onap/so/adapters/workflowmessage/WMAdapterRestTest.java
index 47f843de0c..08728fa339 100644
--- a/adapters/mso-workflow-message-adapter/src/test/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterRestTest.java
+++ b/adapters/mso-workflow-message-adapter/src/test/java/org/onap/so/adapters/workflowmessage/WMAdapterRestTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.workflowmessage;
+package org.onap.so.adapters.workflowmessage;
import org.junit.Assert;
import org.junit.Test;
diff --git a/adapters/mso-workflow-message-adapter/src/test/resources/logback-test.xml b/adapters/mso-workflow-message-adapter/src/test/resources/logback-test.xml
deleted file mode 100644
index bc3d7f36b6..0000000000
--- a/adapters/mso-workflow-message-adapter/src/test/resources/logback-test.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<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> \ No newline at end of file