modified sample SDNO code for SO 73/22373/3
authorBenjamin, Max (mb388a) <mb388a@us.att.com>
Mon, 6 Nov 2017 20:01:36 +0000 (15:01 -0500)
committerBenjamin, Max (mb388a) <mb388a@us.att.com>
Tue, 7 Nov 2017 13:42:12 +0000 (08:42 -0500)
Issue-Id: SO-309
Change-Id: I998d5573d60d99987bb99133967ca012ef8dba6f
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
modified RestClient to accept rest properties

Issue-Id: SO-309
Change-Id: I68bd88f9f942573dc470dda2eb60dc747e782768
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
moved SDNO beans to their own package

Issue-Id: SO-309
Change-Id: I0b35edfe0ac3ad336320d8bc62d2efd98fff1b0b
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
added enum for ServiceType in policy

Issue-Id: SO-309
Change-Id: Icdc95b237a427bbacac4cf5d815fc71cebb91675
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
dmaap rest client implementation

Issue-Id: SO-309
Change-Id: I1bf8b85820524adca462d7d96c4c0beef5892864
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
dmaap client interface for SO component

Issue-Id: SO-309
Change-Id: Ieccfb22678c52af7ffcf8750a38462ba32486182
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
added required guava dependency to pom.xml

Issue-Id: SO-309
Change-Id: I3096bf54888e4960e60bb73b13d8cd3223217271
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
35 files changed:
bpmn/MSOCommonBPMN/pom.xml
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/PreconditionFailedException.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/ResponseExceptionMapper.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/ResponseExceptionMapperImpl.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/RestProperties.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/RestPropertiesLoader.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/Consumer.java
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DefaultDmaapPropertiesImpl.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DmaapClient.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DmaapConsumer.java
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DmaapProperties.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DmaapPropertiesLoader.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DmaapPublisher.java
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/Publisher.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/exceptions/DMaaPConsumerFailure.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/exceptions/ExceededMaximumPollingTime.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/DMaaPRestClient.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/PropertiesBean.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/RestConsumer.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/RestPublisher.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/LoggingFilter.java
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/PolicyRestClient.java
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/PolicyRestProperties.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/RestClient.java
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/entities/PolicyServiceType.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidatorImpl.java
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/beans/Body.java [moved from bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/Body.java with 97% similarity]
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/beans/Input.java [moved from bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/Input.java with 95% similarity]
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/beans/RequestHealthDiagnostic.java [moved from bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/RequestHealthDiagnostic.java with 98% similarity]
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/beans/ResultInfo.java [moved from bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/ResultInfo.java with 95% similarity]
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/beans/SDNO.java [moved from bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNO.java with 86% similarity]
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/policy/PolicyDecisionTest.java [deleted file]

index e5becbf..9650b4c 100644 (file)
-<?xml version="1.0"?>\r
-<project\r
-       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"\r
-       xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
-       <modelVersion>4.0.0</modelVersion>\r
-       <parent>\r
-               <groupId>org.openecomp.so</groupId>\r
-               <artifactId>bpmn</artifactId>\r
-               <version>1.1.0-SNAPSHOT</version>\r
-       </parent>\r
-       <artifactId>MSOCommonBPMN</artifactId>\r
-       <name>MSOCommonBPMN</name>\r
-       <packaging>war</packaging>\r
-\r
-       <properties>\r
-               <camunda.version>7.6.0</camunda.version>\r
-               <spring.version>4.3.2.RELEASE</spring.version>\r
-               <httpclient.version>3.1</httpclient.version>\r
-               <jax.ws.rs>2.0.1</jax.ws.rs>\r
-               <jackson.version>1.1.1</jackson.version>\r
-               <maven.compiler.target>1.8</maven.compiler.target>\r
-               <maven.compiler.source>1.8</maven.compiler.source>\r
-       </properties>\r
-\r
-\r
-       <build>\r
-               <plugins>\r
-                       <plugin>\r
-                               <groupId>org.apache.maven.plugins</groupId>\r
-                               <artifactId>maven-compiler-plugin</artifactId>\r
-                               <executions>\r
-                                       <execution>\r
-                                               <id>test-compile</id>\r
-                                               <phase>compile</phase>\r
-                                               <goals>\r
-                                                       <goal>testCompile</goal>\r
-                                               </goals>\r
-                                               <configuration>\r
-                                                       <skip>false</skip>\r
-                                               </configuration>\r
-                                       </execution>\r
-                               </executions>\r
-                       </plugin>\r
-\r
-                       <plugin>\r
-                               <groupId>org.apache.maven.plugins</groupId>\r
-                               <artifactId>maven-jar-plugin</artifactId>\r
-                               <version>2.6</version>\r
-                               <executions>\r
-                                       <execution>\r
-                                               <!-- Build MSOCommonBPMN-${version}.jar -->\r
-                                               <id>default-jar</id>\r
-                                               <phase>package</phase>\r
-                                               <goals>\r
-                                                       <goal>jar</goal>\r
-                                               </goals>\r
-                                               <configuration>\r
-                                                       <excludes>\r
-                                                               <exclude>org/openecomp/mso/bpmn/common/MSOCommonApplication.class</exclude>\r
-                                                               <!-- <exclude>META-INF/</exclude> -->\r
-                                                       </excludes>\r
-                                               </configuration>\r
-                                       </execution>\r
-                                       <execution>\r
-                                               <goals>\r
-                                                       <goal>test-jar</goal>\r
-                                               </goals>\r
-                                               <configuration>\r
-                                                       <forceCreation>true</forceCreation>\r
-                                                       <skip>false</skip>\r
-                                               </configuration>\r
-                                       </execution>\r
-                               </executions>\r
-                       </plugin>\r
-                       <plugin>\r
-                               <groupId>org.codehaus.mojo</groupId>\r
-                               <artifactId>build-helper-maven-plugin</artifactId>\r
-                               <version>3.0.0</version>\r
-                               <executions>\r
-                                       <execution>\r
-                                               <goals>\r
-                                                       <goal>attach-artifact</goal>\r
-                                               </goals>\r
-                                               <phase>package</phase>\r
-                                               <configuration>\r
-                                                       <artifacts>\r
-                                                               <artifact>\r
-                                                                       <file>${project.build.directory}/${project.artifactId}-${project.version}.jar</file>\r
-                                                                       <type>jar</type>\r
-                                                               </artifact>\r
-                                                       </artifacts>\r
-                                               </configuration>\r
-                                       </execution>\r
-                               </executions>\r
-                       </plugin>\r
-\r
-                       <plugin>\r
-                               <groupId>org.apache.maven.plugins</groupId>\r
-                               <artifactId>maven-war-plugin</artifactId>\r
-                               <version>2.3</version>\r
-                               <configuration>\r
-                                       <failOnMissingWebXml>false</failOnMissingWebXml>\r
-                               </configuration>\r
-                       </plugin>\r
-                       <plugin>\r
-                               <groupId>org.apache.cxf</groupId>\r
-                               <artifactId>cxf-codegen-plugin</artifactId>\r
-                               <version>2.5.2</version>\r
-                       </plugin>\r
-                       <plugin>\r
-                               <groupId>org.apache.maven.plugins</groupId>\r
-                               <artifactId>maven-eclipse-plugin</artifactId>\r
-                               <version>2.8</version>\r
-                               <configuration>\r
-                                       <additionalProjectnatures>\r
-                                               <projectnature>org.eclipse.jdt.groovy.core.groovyNature</projectnature>\r
-                                       </additionalProjectnatures>\r
-                                       <sourceIncludes>\r
-                                               <sourceInclude>**/*.groovy</sourceInclude>\r
-                                       </sourceIncludes>\r
-                               </configuration>\r
-                       </plugin>\r
-                       <plugin>\r
-                               <artifactId>maven-antrun-plugin</artifactId>\r
-                               <executions>\r
-                                       <execution>\r
-                                               <id>compile</id>\r
-                                               <phase>compile</phase>\r
-                                               <configuration>\r
-                                                       <tasks>\r
-                                                               <mkdir dir="${basedir}/src/main/groovy" />\r
-                                                               <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc">\r
-                                                                       <classpath refid="maven.compile.classpath" />\r
-                                                               </taskdef>\r
-                                                               <mkdir dir="${project.build.outputDirectory}" />\r
-                                                               <groovyc destdir="${project.build.outputDirectory}"\r
-                                                                       srcdir="${basedir}/src/main/groovy/" listfiles="true">\r
-                                                                       <classpath refid="maven.compile.classpath" />\r
-                                                               </groovyc>\r
-                                                       </tasks>\r
-                                               </configuration>\r
-                                               <goals>\r
-                                                       <goal>run</goal>\r
-                                               </goals>\r
-                                       </execution>\r
-                                       <execution>\r
-                                               <id>test-compile</id>\r
-                                               <phase>test-compile</phase>\r
-                                               <configuration>\r
-                                                       <tasks>\r
-                                                               <mkdir dir="${basedir}/src/test/groovy" />\r
-                                                               <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc">\r
-                                                                       <classpath refid="maven.test.classpath" />\r
-                                                               </taskdef>\r
-                                                               <mkdir dir="${project.build.testOutputDirectory}" />\r
-                                                               <groovyc destdir="${project.build.testOutputDirectory}"\r
-                                                                       srcdir="${basedir}/src/test/groovy/" listfiles="true">\r
-                                                                       <classpath refid="maven.test.classpath" />\r
-                                                               </groovyc>\r
-                                                       </tasks>\r
-                                               </configuration>\r
-                                               <goals>\r
-                                                       <goal>run</goal>\r
-                                               </goals>\r
-                                       </execution>\r
-                               </executions>\r
-                       </plugin>\r
-                       <plugin>\r
-                               <groupId>org.codehaus.mojo</groupId>\r
-                               <artifactId>jaxb2-maven-plugin</artifactId>\r
-                               <version>2.3</version>\r
-                               <executions>\r
-                                       <execution>\r
-                                               <id>xjc</id>\r
-                                               <goals>\r
-                                                       <goal>xjc</goal>\r
-                                               </goals>\r
-                                       </execution>\r
-                               </executions>\r
-                               <configuration>\r
-                                       <extension>true</extension>\r
-                                       <arguments>\r
-                                               <argument>-Xannotate</argument>\r
-                                               <argument>-Xcommons-lang</argument>\r
-                                       </arguments>\r
-                                       <sources>\r
-                                               <source>src/main/resources/xsd</source>\r
-                                       </sources>\r
-                                       <xjbSources>\r
-                                               <xjbSource>src/main/resources/xjb</xjbSource>\r
-                                       </xjbSources>\r
-                                       <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>\r
-                               </configuration>\r
-                               <dependencies>\r
-                                       <dependency>\r
-                                               <groupId>org.jvnet.jaxb2_commons</groupId>\r
-                                               <artifactId>jaxb2-basics-annotate</artifactId>\r
-                                               <version>0.6.4</version>\r
-                                       </dependency>\r
-                                       <dependency>\r
-                                               <groupId>org.jvnet.jaxb2_commons</groupId>\r
-                                               <artifactId>jaxb2-commons-lang</artifactId>\r
-                                               <version>2.3</version>\r
-                                       </dependency>\r
-                                       <dependency>\r
-                                               <groupId>com.sun.codemodel</groupId>\r
-                                               <artifactId>codemodel</artifactId>\r
-                                               <version>2.6</version>\r
-                                       </dependency>\r
-                               </dependencies>\r
-                       </plugin>\r
-               </plugins>\r
-               <pluginManagement>\r
-                       <plugins>\r
-                               <!--This plugin's configuration is used to store Eclipse m2e settings \r
-                                       only. It has no influence on the Maven build itself. -->\r
-                               <plugin>\r
-                                       <groupId>org.eclipse.m2e</groupId>\r
-                                       <artifactId>lifecycle-mapping</artifactId>\r
-                                       <version>1.0.0</version>\r
-                                       <configuration>\r
-                                               <lifecycleMappingMetadata>\r
-                                                       <pluginExecutions>\r
-                                                               <pluginExecution>\r
-                                                                       <pluginExecutionFilter>\r
-                                                                               <groupId>\r
-                                                                                       org.apache.maven.plugins\r
-                                                                               </groupId>\r
-                                                                               <artifactId>\r
-                                                                                       maven-antrun-plugin\r
-                                                                               </artifactId>\r
-                                                                               <versionRange>\r
-                                                                                       [1.3,)\r
-                                                                               </versionRange>\r
-                                                                               <goals>\r
-                                                                                       <goal>run</goal>\r
-                                                                               </goals>\r
-                                                                       </pluginExecutionFilter>\r
-                                                                       <action>\r
-                                                                               <ignore></ignore>\r
-                                                                       </action>\r
-                                                               </pluginExecution>\r
-                                                       </pluginExecutions>\r
-                                               </lifecycleMappingMetadata>\r
-                                       </configuration>\r
-                               </plugin>\r
-\r
-\r
-                       </plugins>\r
-               </pluginManagement>\r
-       </build>\r
-\r
-       <dependencies>\r
-\r
-               <dependency>\r
-                       <!-- process engine, in compile scope to include it in the war file -->\r
-                       <groupId>org.camunda.bpm</groupId>\r
-                       <artifactId>camunda-engine</artifactId>\r
-                       <scope>compile</scope>\r
-                       <exclusions>\r
-                               <exclusion>\r
-                                       <groupId>org.slf4j</groupId>\r
-                                       <artifactId>slf4j-api</artifactId>\r
-                               </exclusion>\r
-                       </exclusions>\r
-               </dependency>\r
-               <!-- Using the `DefaultEjbProcessApplication` result in: `java.sql.SQLException: \r
-                       You cannot commit during a managed transaction!` -->\r
-               <dependency>\r
-                       <!-- CDI integration, needs to be included in WAR, otherwise CDI can not \r
-                               work correctly -->\r
-                       <groupId>org.camunda.bpm</groupId>\r
-                       <artifactId>camunda-engine-cdi</artifactId>\r
-               </dependency>\r
-\r
-               <dependency>\r
-                       <groupId>org.camunda.bpm.extension</groupId>\r
-                       <artifactId>camunda-bpm-assert</artifactId>\r
-                       <scope>test</scope>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>org.mockito</groupId>\r
-                       <artifactId>mockito-all</artifactId>\r
-                       <version>1.10.19</version>\r
-                       <scope>test</scope>\r
-               </dependency>\r
-               \r
-               <!-- Spin dataformat support, in compile scope to include it in the war \r
-                       file -->\r
-               <dependency>\r
-                       <groupId>org.camunda.spin</groupId>\r
-                       <artifactId>camunda-spin-dataformat-all</artifactId>\r
-                       <scope>compile</scope>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>org.camunda.bpm</groupId>\r
-                       <artifactId>camunda-engine-plugin-spin</artifactId>\r
-                       <scope>compile</scope>\r
-               </dependency>\r
-\r
-               <dependency>\r
-                       <groupId>org.camunda.bpm</groupId>\r
-                       <artifactId>camunda-engine-plugin-connect</artifactId>\r
-                       <scope>compile</scope>\r
-               </dependency>\r
-\r
-               <dependency>\r
-                       <!-- Bootstrap for styling via Webjars project -->\r
-                       <groupId>org.webjars</groupId>\r
-                       <artifactId>bootstrap</artifactId>\r
-                       <version>2.3.2</version>\r
-               </dependency>\r
-\r
-               <dependency>\r
-                       <groupId>org.jboss.resteasy</groupId>\r
-                       <artifactId>resteasy-client</artifactId>\r
-                       <version>3.0.19.Final</version>\r
-                       <scope>provided</scope>\r
-                       <exclusions>\r
-                               <exclusion>\r
-                                       <groupId>org.apache.httpcomponents</groupId>\r
-                                       <artifactId>httpclient</artifactId>\r
-                               </exclusion>\r
-                       </exclusions>\r
-               </dependency>\r
-\r
-               <dependency>\r
-                       <!-- Needed for InMemoryH2Test -->\r
-                       <groupId>com.h2database</groupId>\r
-                       <artifactId>h2</artifactId>\r
-                       <scope>test</scope>\r
-               </dependency>\r
-\r
-               <dependency>\r
-                       <groupId>com.fasterxml.uuid</groupId>\r
-                       <artifactId>java-uuid-generator</artifactId>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>org.codehaus.groovy</groupId>\r
-                       <artifactId>groovy-all</artifactId>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>org.apache.commons</groupId>\r
-                       <artifactId>commons-lang3</artifactId>\r
-                       <version>3.4</version>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>org.openecomp.so</groupId>\r
-                       <artifactId>MSOCoreBPMN</artifactId>\r
-                       <version>${project.version}</version>\r
-               </dependency>\r
-               <dependency>\r
-                       <!-- unit test utilities -->\r
-                       <groupId>org.openecomp.so</groupId>\r
-                       <artifactId>MSOCoreBPMN</artifactId>\r
-                       <version>${project.version}</version>\r
-                       <classifier>tests</classifier>\r
-                       <scope>test</scope>\r
-               </dependency>\r
-               <dependency>\r
-            <groupId>org.openecomp.so</groupId>\r
-            <artifactId>common</artifactId>\r
-            <version>${project.version}</version>\r
-        </dependency>\r
-               <dependency>\r
-                       <groupId>javax.ws.rs</groupId>\r
-                       <artifactId>javax.ws.rs-api</artifactId>\r
-                       <version>2.0</version>\r
-               </dependency>\r
-               <!-- for encoding the url the same way A&AI does -->\r
-               <dependency>\r
-                       <groupId>org.openecomp.so</groupId>\r
-                       <artifactId>MSOMockServer</artifactId>\r
-                       <version>${project.version}</version>\r
-                       <classifier>classes</classifier>\r
-                       <scope>test</scope>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>org.openecomp.so</groupId>\r
-                       <artifactId>MSORESTClient</artifactId>\r
-                       <version>${project.version}</version>\r
-               </dependency>\r
-\r
-               <dependency>\r
-                       <groupId>javax.servlet</groupId>\r
-                       <artifactId>javax.servlet-api</artifactId>\r
-                       <version>3.0.1</version>\r
-                       <scope>provided</scope>\r
-               </dependency>\r
-\r
-               <dependency>\r
-                       <groupId>org.springframework</groupId>\r
-                       <artifactId>spring-test</artifactId>\r
-                       <version>${spring.version}</version>\r
-               </dependency>\r
-\r
-               <dependency>\r
-                       <groupId>com.github.tomakehurst</groupId>\r
-                       <artifactId>wiremock</artifactId>\r
-                       <version>1.56</version>\r
-                       <scope>test</scope>\r
-                       <classifier>standalone</classifier>\r
-                       <exclusions>\r
-                               <exclusion>\r
-                                       <groupId>org.mortbay.jetty</groupId>\r
-                                       <artifactId>jetty</artifactId>\r
-                               </exclusion>\r
-                               <exclusion>\r
-                                       <groupId>com.google.guava</groupId>\r
-                                       <artifactId>guava</artifactId>\r
-                               </exclusion>\r
-                               <exclusion>\r
-                                       <groupId>com.fasterxml.jackson.core</groupId>\r
-                                       <artifactId>jackson-core</artifactId>\r
-                               </exclusion>\r
-                               <exclusion>\r
-                                       <groupId>com.fasterxml.jackson.core</groupId>\r
-                                       <artifactId>jackson-annotations</artifactId>\r
-                               </exclusion>\r
-                               <exclusion>\r
-                                       <groupId>com.fasterxml.jackson.core</groupId>\r
-                                       <artifactId>jackson-databind</artifactId>\r
-                               </exclusion>\r
-                               <exclusion>\r
-                                       <groupId>org.apache.httpcomponents</groupId>\r
-                                       <artifactId>httpclient</artifactId>\r
-                               </exclusion>\r
-                               <exclusion>\r
-                                       <groupId>org.skyscreamer</groupId>\r
-                                       <artifactId>jsonassert</artifactId>\r
-                               </exclusion>\r
-                               <exclusion>\r
-                                       <groupId>xmlunit</groupId>\r
-                                       <artifactId>xmlunit</artifactId>\r
-                               </exclusion>\r
-                               <exclusion>\r
-                                       <groupId>com.jayway.jsonpath</groupId>\r
-                                       <artifactId>json-path</artifactId>\r
-                               </exclusion>\r
-                               <exclusion>\r
-                                       <groupId>net.sf.jopt-simple</groupId>\r
-                                       <artifactId>jopt-simple</artifactId>\r
-                               </exclusion>\r
-                       </exclusions>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>org.camunda.bpm</groupId>\r
-                       <artifactId>camunda-engine-spring</artifactId>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>org.springframework</groupId>\r
-                       <artifactId>spring-beans</artifactId>\r
-                       <version>4.3.2.RELEASE</version>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>com.fasterxml.jackson.core</groupId>\r
-                       <artifactId>jackson-annotations</artifactId>\r
-                       <version>2.8.7</version>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>com.fasterxml.jackson.core</groupId>\r
-                       <artifactId>jackson-core</artifactId>\r
-                       <version>2.8.7</version>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>com.fasterxml.jackson.module</groupId>\r
-                       <artifactId>jackson-module-jaxb-annotations</artifactId>\r
-                       <version>2.4.0</version>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>org.aspectj</groupId>\r
-                       <artifactId>aspectjrt</artifactId>\r
-                       <version>1.6.12</version>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>commons-httpclient</groupId>\r
-                       <artifactId>commons-httpclient</artifactId>\r
-                       <version>${httpclient.version}</version>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>org.openecomp.appc.client</groupId>\r
-                       <artifactId>client-kit</artifactId>\r
-                       <version>1.1.0</version>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>org.openecomp.appc.client</groupId>\r
-                       <artifactId>client-lib</artifactId>\r
-                       <version>1.1.0</version>\r
-               </dependency>\r
-               \r
-               <dependency>\r
-                       <groupId>org.onap.aai.aai-common</groupId>\r
-                       <artifactId>aai-schema</artifactId>\r
-                       <version>1.1.0</version>\r
-               </dependency>\r
-               \r
-               \r
-               <dependency>\r
-                       <groupId>com.fasterxml.jackson.core</groupId>\r
-                       <artifactId>jackson-databind</artifactId>\r
-                       <version>2.8.7</version>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>org.mockito</groupId>\r
-                       <artifactId>mockito-all</artifactId>\r
-                       <version>1.10.19</version>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>commons-lang</groupId>\r
-                       <artifactId>commons-lang</artifactId>\r
-                       <version>2.6</version>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>com.openpojo</groupId>\r
-                       <artifactId>openpojo</artifactId>\r
-                       <version>0.8.6</version>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>com.jayway.jsonpath</groupId>\r
-                       <artifactId>json-path</artifactId>\r
-                       <version>2.2.0</version>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>org.springframework</groupId>\r
-                       <artifactId>spring-web</artifactId>\r
-                       <version>${spring.version}</version>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>org.springframework</groupId>\r
-                       <artifactId>spring-test</artifactId>\r
-                       <version>${spring.version}</version>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>junit</groupId>\r
-                       <artifactId>junit</artifactId>\r
-                       <version>4.12</version>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>commons-httpclient</groupId>\r
-                       <artifactId>commons-httpclient</artifactId>\r
-                       <version>${httpclient.version}</version>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>javax.ws.rs</groupId>\r
-                       <artifactId>javax.ws.rs-api</artifactId>\r
-                       <version>${jax.ws.rs}</version>\r
-               </dependency>\r
-\r
-               <dependency>\r
-                       <groupId>org.openecomp.appc.client</groupId>\r
-                       <artifactId>client-kit</artifactId>\r
-                       <version>1.1.0</version>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>org.openecomp.appc.client</groupId>\r
-                       <artifactId>client-lib</artifactId>\r
-                       <version>1.1.0</version>\r
-               </dependency>\r
-               \r
-               <dependency>\r
-                       <groupId>com.fasterxml.jackson.core</groupId>\r
-                       <artifactId>jackson-databind</artifactId>\r
-                       <version>2.8.7</version>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>com.fasterxml.jackson.core</groupId>\r
-                       <artifactId>jackson-annotations</artifactId>\r
-                       <version>2.8.7</version>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>com.fasterxml.jackson.module</groupId>\r
-                       <artifactId>jackson-module-jaxb-annotations</artifactId>\r
-                       <version>2.4.0</version>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>org.aspectj</groupId>\r
-                       <artifactId>aspectjrt</artifactId>\r
-                       <version>1.6.12</version>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>org.mockito</groupId>\r
-                       <artifactId>mockito-all</artifactId>\r
-                       <version>1.10.19</version>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>com.att.nsa</groupId>\r
-                       <artifactId>dmaapClient</artifactId>\r
-                       <version>0.2.12</version>\r
-               </dependency>\r
-               <dependency>\r
-                       <!-- Optional Plugin for Camunda BPM Workbench -->\r
-                       <groupId>org.camunda.bpm.workbench</groupId>\r
-                       <artifactId>camunda-workbench-dist-embeddable</artifactId>\r
-                       <version>1.0.0-alpha8</version>\r
-                       <scope>test</scope>\r
-               </dependency>\r
-               <dependency>\r
-       <groupId>org.jboss.resteasy</groupId>\r
-       <artifactId>resteasy-jackson2-provider</artifactId>\r
-       <version>3.0.11.Final</version>\r
-    </dependency>\r
-                               \r
-       </dependencies>\r
-</project>\r
+<?xml version="1.0"?>
+<project
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+       xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+       <modelVersion>4.0.0</modelVersion>
+       <parent>
+               <groupId>org.openecomp.so</groupId>
+               <artifactId>bpmn</artifactId>
+               <version>1.1.0-SNAPSHOT</version>
+       </parent>
+       <artifactId>MSOCommonBPMN</artifactId>
+       <name>MSOCommonBPMN</name>
+       <packaging>war</packaging>
+
+       <properties>
+               <camunda.version>7.6.0</camunda.version>
+               <spring.version>4.3.2.RELEASE</spring.version>
+               <httpclient.version>3.1</httpclient.version>
+               <jax.ws.rs>2.0.1</jax.ws.rs>
+               <jackson.version>1.1.1</jackson.version>
+               <maven.compiler.target>1.8</maven.compiler.target>
+               <maven.compiler.source>1.8</maven.compiler.source>
+       </properties>
+
+
+       <build>
+               <plugins>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-compiler-plugin</artifactId>
+                               <executions>
+                                       <execution>
+                                               <id>test-compile</id>
+                                               <phase>compile</phase>
+                                               <goals>
+                                                       <goal>testCompile</goal>
+                                               </goals>
+                                               <configuration>
+                                                       <skip>false</skip>
+                                               </configuration>
+                                       </execution>
+                               </executions>
+                       </plugin>
+
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-jar-plugin</artifactId>
+                               <version>2.6</version>
+                               <executions>
+                                       <execution>
+                                               <!-- Build MSOCommonBPMN-${version}.jar -->
+                                               <id>default-jar</id>
+                                               <phase>package</phase>
+                                               <goals>
+                                                       <goal>jar</goal>
+                                               </goals>
+                                               <configuration>
+                                                       <excludes>
+                                                               <exclude>org/openecomp/mso/bpmn/common/MSOCommonApplication.class</exclude>
+                                                               <!-- <exclude>META-INF/</exclude> -->
+                                                       </excludes>
+                                               </configuration>
+                                       </execution>
+                                       <execution>
+                                               <goals>
+                                                       <goal>test-jar</goal>
+                                               </goals>
+                                               <configuration>
+                                                       <forceCreation>true</forceCreation>
+                                                       <skip>false</skip>
+                                               </configuration>
+                                       </execution>
+                               </executions>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.codehaus.mojo</groupId>
+                               <artifactId>build-helper-maven-plugin</artifactId>
+                               <version>3.0.0</version>
+                               <executions>
+                                       <execution>
+                                               <goals>
+                                                       <goal>attach-artifact</goal>
+                                               </goals>
+                                               <phase>package</phase>
+                                               <configuration>
+                                                       <artifacts>
+                                                               <artifact>
+                                                                       <file>${project.build.directory}/${project.artifactId}-${project.version}.jar</file>
+                                                                       <type>jar</type>
+                                                               </artifact>
+                                                       </artifacts>
+                                               </configuration>
+                                       </execution>
+                               </executions>
+                       </plugin>
+
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-war-plugin</artifactId>
+                               <version>2.3</version>
+                               <configuration>
+                                       <failOnMissingWebXml>false</failOnMissingWebXml>
+                               </configuration>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.cxf</groupId>
+                               <artifactId>cxf-codegen-plugin</artifactId>
+                               <version>2.5.2</version>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-eclipse-plugin</artifactId>
+                               <version>2.8</version>
+                               <configuration>
+                                       <additionalProjectnatures>
+                                               <projectnature>org.eclipse.jdt.groovy.core.groovyNature</projectnature>
+                                       </additionalProjectnatures>
+                                       <sourceIncludes>
+                                               <sourceInclude>**/*.groovy</sourceInclude>
+                                       </sourceIncludes>
+                               </configuration>
+                       </plugin>
+                       <plugin>
+                               <artifactId>maven-antrun-plugin</artifactId>
+                               <executions>
+                                       <execution>
+                                               <id>compile</id>
+                                               <phase>compile</phase>
+                                               <configuration>
+                                                       <tasks>
+                                                               <mkdir dir="${basedir}/src/main/groovy" />
+                                                               <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc">
+                                                                       <classpath refid="maven.compile.classpath" />
+                                                               </taskdef>
+                                                               <mkdir dir="${project.build.outputDirectory}" />
+                                                               <groovyc destdir="${project.build.outputDirectory}"
+                                                                       srcdir="${basedir}/src/main/groovy/" listfiles="true">
+                                                                       <classpath refid="maven.compile.classpath" />
+                                                               </groovyc>
+                                                       </tasks>
+                                               </configuration>
+                                               <goals>
+                                                       <goal>run</goal>
+                                               </goals>
+                                       </execution>
+                                       <execution>
+                                               <id>test-compile</id>
+                                               <phase>test-compile</phase>
+                                               <configuration>
+                                                       <tasks>
+                                                               <mkdir dir="${basedir}/src/test/groovy" />
+                                                               <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc">
+                                                                       <classpath refid="maven.test.classpath" />
+                                                               </taskdef>
+                                                               <mkdir dir="${project.build.testOutputDirectory}" />
+                                                               <groovyc destdir="${project.build.testOutputDirectory}"
+                                                                       srcdir="${basedir}/src/test/groovy/" listfiles="true">
+                                                                       <classpath refid="maven.test.classpath" />
+                                                               </groovyc>
+                                                       </tasks>
+                                               </configuration>
+                                               <goals>
+                                                       <goal>run</goal>
+                                               </goals>
+                                       </execution>
+                               </executions>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.codehaus.mojo</groupId>
+                               <artifactId>jaxb2-maven-plugin</artifactId>
+                               <version>2.3</version>
+                               <executions>
+                                       <execution>
+                                               <id>xjc</id>
+                                               <goals>
+                                                       <goal>xjc</goal>
+                                               </goals>
+                                       </execution>
+                               </executions>
+                               <configuration>
+                                       <extension>true</extension>
+                                       <arguments>
+                                               <argument>-Xannotate</argument>
+                                               <argument>-Xcommons-lang</argument>
+                                       </arguments>
+                                       <sources>
+                                               <source>src/main/resources/xsd</source>
+                                       </sources>
+                                       <xjbSources>
+                                               <xjbSource>src/main/resources/xjb</xjbSource>
+                                       </xjbSources>
+                                       <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
+                               </configuration>
+                               <dependencies>
+                                       <dependency>
+                                               <groupId>org.jvnet.jaxb2_commons</groupId>
+                                               <artifactId>jaxb2-basics-annotate</artifactId>
+                                               <version>0.6.4</version>
+                                       </dependency>
+                                       <dependency>
+                                               <groupId>org.jvnet.jaxb2_commons</groupId>
+                                               <artifactId>jaxb2-commons-lang</artifactId>
+                                               <version>2.3</version>
+                                       </dependency>
+                                       <dependency>
+                                               <groupId>com.sun.codemodel</groupId>
+                                               <artifactId>codemodel</artifactId>
+                                               <version>2.6</version>
+                                       </dependency>
+                               </dependencies>
+                       </plugin>
+               </plugins>
+               <pluginManagement>
+                       <plugins>
+                               <!--This plugin's configuration is used to store Eclipse m2e settings 
+                                       only. It has no influence on the Maven build itself. -->
+                               <plugin>
+                                       <groupId>org.eclipse.m2e</groupId>
+                                       <artifactId>lifecycle-mapping</artifactId>
+                                       <version>1.0.0</version>
+                                       <configuration>
+                                               <lifecycleMappingMetadata>
+                                                       <pluginExecutions>
+                                                               <pluginExecution>
+                                                                       <pluginExecutionFilter>
+                                                                               <groupId>
+                                                                                       org.apache.maven.plugins
+                                                                               </groupId>
+                                                                               <artifactId>
+                                                                                       maven-antrun-plugin
+                                                                               </artifactId>
+                                                                               <versionRange>
+                                                                                       [1.3,)
+                                                                               </versionRange>
+                                                                               <goals>
+                                                                                       <goal>run</goal>
+                                                                               </goals>
+                                                                       </pluginExecutionFilter>
+                                                                       <action>
+                                                                               <ignore></ignore>
+                                                                       </action>
+                                                               </pluginExecution>
+                                                       </pluginExecutions>
+                                               </lifecycleMappingMetadata>
+                                       </configuration>
+                               </plugin>
+
+
+                       </plugins>
+               </pluginManagement>
+       </build>
+
+       <dependencies>
+
+               <dependency>
+                       <!-- process engine, in compile scope to include it in the war file -->
+                       <groupId>org.camunda.bpm</groupId>
+                       <artifactId>camunda-engine</artifactId>
+                       <scope>compile</scope>
+                       <exclusions>
+                               <exclusion>
+                                       <groupId>org.slf4j</groupId>
+                                       <artifactId>slf4j-api</artifactId>
+                               </exclusion>
+                       </exclusions>
+               </dependency>
+               <!-- Using the `DefaultEjbProcessApplication` result in: `java.sql.SQLException: 
+                       You cannot commit during a managed transaction!` -->
+               <dependency>
+                       <!-- CDI integration, needs to be included in WAR, otherwise CDI can not 
+                               work correctly -->
+                       <groupId>org.camunda.bpm</groupId>
+                       <artifactId>camunda-engine-cdi</artifactId>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.camunda.bpm.extension</groupId>
+                       <artifactId>camunda-bpm-assert</artifactId>
+                       <scope>test</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.mockito</groupId>
+                       <artifactId>mockito-all</artifactId>
+                       <version>1.10.19</version>
+                       <scope>test</scope>
+               </dependency>
+               
+               <!-- Spin dataformat support, in compile scope to include it in the war 
+                       file -->
+               <dependency>
+                       <groupId>org.camunda.spin</groupId>
+                       <artifactId>camunda-spin-dataformat-all</artifactId>
+                       <scope>compile</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.camunda.bpm</groupId>
+                       <artifactId>camunda-engine-plugin-spin</artifactId>
+                       <scope>compile</scope>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.camunda.bpm</groupId>
+                       <artifactId>camunda-engine-plugin-connect</artifactId>
+                       <scope>compile</scope>
+               </dependency>
+
+               <dependency>
+                       <!-- Bootstrap for styling via Webjars project -->
+                       <groupId>org.webjars</groupId>
+                       <artifactId>bootstrap</artifactId>
+                       <version>2.3.2</version>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.jboss.resteasy</groupId>
+                       <artifactId>resteasy-client</artifactId>
+                       <version>3.0.19.Final</version>
+                       <scope>provided</scope>
+                       <exclusions>
+                               <exclusion>
+                                       <groupId>org.apache.httpcomponents</groupId>
+                                       <artifactId>httpclient</artifactId>
+                               </exclusion>
+                       </exclusions>
+               </dependency>
+
+               <dependency>
+                       <!-- Needed for InMemoryH2Test -->
+                       <groupId>com.h2database</groupId>
+                       <artifactId>h2</artifactId>
+                       <scope>test</scope>
+               </dependency>
+
+               <dependency>
+                       <groupId>com.fasterxml.uuid</groupId>
+                       <artifactId>java-uuid-generator</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.codehaus.groovy</groupId>
+                       <artifactId>groovy-all</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.commons</groupId>
+                       <artifactId>commons-lang3</artifactId>
+                       <version>3.4</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.openecomp.so</groupId>
+                       <artifactId>MSOCoreBPMN</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+               <dependency>
+                       <!-- unit test utilities -->
+                       <groupId>org.openecomp.so</groupId>
+                       <artifactId>MSOCoreBPMN</artifactId>
+                       <version>${project.version}</version>
+                       <classifier>tests</classifier>
+                       <scope>test</scope>
+               </dependency>
+               <dependency>
+            <groupId>org.openecomp.so</groupId>
+            <artifactId>common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+               <dependency>
+                       <groupId>javax.ws.rs</groupId>
+                       <artifactId>javax.ws.rs-api</artifactId>
+                       <version>2.0</version>
+               </dependency>
+               <!-- for encoding the url the same way A&AI does -->
+               <dependency>
+                       <groupId>org.openecomp.so</groupId>
+                       <artifactId>MSOMockServer</artifactId>
+                       <version>${project.version}</version>
+                       <classifier>classes</classifier>
+                       <scope>test</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.openecomp.so</groupId>
+                       <artifactId>MSORESTClient</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+
+               <dependency>
+                       <groupId>javax.servlet</groupId>
+                       <artifactId>javax.servlet-api</artifactId>
+                       <version>3.0.1</version>
+                       <scope>provided</scope>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.springframework</groupId>
+                       <artifactId>spring-test</artifactId>
+                       <version>${spring.version}</version>
+               </dependency>
+
+               <dependency>
+                       <groupId>com.github.tomakehurst</groupId>
+                       <artifactId>wiremock</artifactId>
+                       <version>1.56</version>
+                       <scope>test</scope>
+                       <classifier>standalone</classifier>
+                       <exclusions>
+                               <exclusion>
+                                       <groupId>org.mortbay.jetty</groupId>
+                                       <artifactId>jetty</artifactId>
+                               </exclusion>
+                               <exclusion>
+                                       <groupId>com.google.guava</groupId>
+                                       <artifactId>guava</artifactId>
+                               </exclusion>
+                               <exclusion>
+                                       <groupId>com.fasterxml.jackson.core</groupId>
+                                       <artifactId>jackson-core</artifactId>
+                               </exclusion>
+                               <exclusion>
+                                       <groupId>com.fasterxml.jackson.core</groupId>
+                                       <artifactId>jackson-annotations</artifactId>
+                               </exclusion>
+                               <exclusion>
+                                       <groupId>com.fasterxml.jackson.core</groupId>
+                                       <artifactId>jackson-databind</artifactId>
+                               </exclusion>
+                               <exclusion>
+                                       <groupId>org.apache.httpcomponents</groupId>
+                                       <artifactId>httpclient</artifactId>
+                               </exclusion>
+                               <exclusion>
+                                       <groupId>org.skyscreamer</groupId>
+                                       <artifactId>jsonassert</artifactId>
+                               </exclusion>
+                               <exclusion>
+                                       <groupId>xmlunit</groupId>
+                                       <artifactId>xmlunit</artifactId>
+                               </exclusion>
+                               <exclusion>
+                                       <groupId>com.jayway.jsonpath</groupId>
+                                       <artifactId>json-path</artifactId>
+                               </exclusion>
+                               <exclusion>
+                                       <groupId>net.sf.jopt-simple</groupId>
+                                       <artifactId>jopt-simple</artifactId>
+                               </exclusion>
+                       </exclusions>
+               </dependency>
+               <dependency>
+                       <groupId>org.camunda.bpm</groupId>
+                       <artifactId>camunda-engine-spring</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.springframework</groupId>
+                       <artifactId>spring-beans</artifactId>
+                       <version>4.3.2.RELEASE</version>
+               </dependency>
+               <dependency>
+                       <groupId>com.fasterxml.jackson.core</groupId>
+                       <artifactId>jackson-annotations</artifactId>
+                       <version>2.8.7</version>
+               </dependency>
+               <dependency>
+                       <groupId>com.fasterxml.jackson.core</groupId>
+                       <artifactId>jackson-core</artifactId>
+                       <version>2.8.7</version>
+               </dependency>
+               <dependency>
+                       <groupId>com.fasterxml.jackson.module</groupId>
+                       <artifactId>jackson-module-jaxb-annotations</artifactId>
+                       <version>2.4.0</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.aspectj</groupId>
+                       <artifactId>aspectjrt</artifactId>
+                       <version>1.6.12</version>
+               </dependency>
+               <dependency>
+                       <groupId>commons-httpclient</groupId>
+                       <artifactId>commons-httpclient</artifactId>
+                       <version>${httpclient.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.openecomp.appc.client</groupId>
+                       <artifactId>client-kit</artifactId>
+                       <version>1.1.0</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.openecomp.appc.client</groupId>
+                       <artifactId>client-lib</artifactId>
+                       <version>1.1.0</version>
+               </dependency>
+               
+               <dependency>
+                       <groupId>org.onap.aai.aai-common</groupId>
+                       <artifactId>aai-schema</artifactId>
+                       <version>1.1.0</version>
+               </dependency>
+               
+               
+               <dependency>
+                       <groupId>com.fasterxml.jackson.core</groupId>
+                       <artifactId>jackson-databind</artifactId>
+                       <version>2.8.7</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.mockito</groupId>
+                       <artifactId>mockito-all</artifactId>
+                       <version>1.10.19</version>
+               </dependency>
+               <dependency>
+                       <groupId>commons-lang</groupId>
+                       <artifactId>commons-lang</artifactId>
+                       <version>2.6</version>
+               </dependency>
+               <dependency>
+                       <groupId>com.openpojo</groupId>
+                       <artifactId>openpojo</artifactId>
+                       <version>0.8.6</version>
+               </dependency>
+               <dependency>
+                       <groupId>com.jayway.jsonpath</groupId>
+                       <artifactId>json-path</artifactId>
+                       <version>2.2.0</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.springframework</groupId>
+                       <artifactId>spring-web</artifactId>
+                       <version>${spring.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.springframework</groupId>
+                       <artifactId>spring-test</artifactId>
+                       <version>${spring.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>junit</groupId>
+                       <artifactId>junit</artifactId>
+                       <version>4.12</version>
+               </dependency>
+               <dependency>
+                       <groupId>commons-httpclient</groupId>
+                       <artifactId>commons-httpclient</artifactId>
+                       <version>${httpclient.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>javax.ws.rs</groupId>
+                       <artifactId>javax.ws.rs-api</artifactId>
+                       <version>${jax.ws.rs}</version>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.openecomp.appc.client</groupId>
+                       <artifactId>client-kit</artifactId>
+                       <version>1.1.0</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.openecomp.appc.client</groupId>
+                       <artifactId>client-lib</artifactId>
+                       <version>1.1.0</version>
+               </dependency>
+               
+               <dependency>
+                       <groupId>com.fasterxml.jackson.core</groupId>
+                       <artifactId>jackson-databind</artifactId>
+                       <version>2.8.7</version>
+               </dependency>
+               <dependency>
+                       <groupId>com.fasterxml.jackson.core</groupId>
+                       <artifactId>jackson-annotations</artifactId>
+                       <version>2.8.7</version>
+               </dependency>
+               <dependency>
+                       <groupId>com.fasterxml.jackson.module</groupId>
+                       <artifactId>jackson-module-jaxb-annotations</artifactId>
+                       <version>2.4.0</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.aspectj</groupId>
+                       <artifactId>aspectjrt</artifactId>
+                       <version>1.6.12</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.mockito</groupId>
+                       <artifactId>mockito-all</artifactId>
+                       <version>1.10.19</version>
+               </dependency>
+               <dependency>
+                       <groupId>com.att.nsa</groupId>
+                       <artifactId>dmaapClient</artifactId>
+                       <version>0.2.12</version>
+               </dependency>
+               <dependency>
+                       <!-- Optional Plugin for Camunda BPM Workbench -->
+                       <groupId>org.camunda.bpm.workbench</groupId>
+                       <artifactId>camunda-workbench-dist-embeddable</artifactId>
+                       <version>1.0.0-alpha8</version>
+                       <scope>test</scope>
+               </dependency>
+               <dependency>
+       <groupId>org.jboss.resteasy</groupId>
+       <artifactId>resteasy-jackson2-provider</artifactId>
+       <version>3.0.11.Final</version>
+    </dependency>
+    <dependency>
+               <groupId>com.google.guava</groupId>
+               <artifactId>guava</artifactId>
+               <version>22.0</version>
+       </dependency>
+                               
+       </dependencies>
+</project>
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/PreconditionFailedException.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/PreconditionFailedException.java
new file mode 100644 (file)
index 0000000..df28baa
--- /dev/null
@@ -0,0 +1,35 @@
+/*-
+ * ============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.client;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+
+public class PreconditionFailedException extends WebApplicationException {
+       /**
+        * 
+        */
+       private static final long serialVersionUID = 1L;
+
+       public PreconditionFailedException(String message) {
+        super(message, Response.Status.PRECONDITION_FAILED);
+    }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/ResponseExceptionMapper.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/ResponseExceptionMapper.java
new file mode 100644 (file)
index 0000000..e0e3e93
--- /dev/null
@@ -0,0 +1,98 @@
+/*-
+ * ============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.client;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Optional;
+
+import javax.annotation.Priority;
+import javax.ws.rs.BadRequestException;
+import javax.ws.rs.ForbiddenException;
+import javax.ws.rs.InternalServerErrorException;
+import javax.ws.rs.NotAcceptableException;
+import javax.ws.rs.NotAllowedException;
+import javax.ws.rs.NotAuthorizedException;
+import javax.ws.rs.NotFoundException;
+import javax.ws.rs.NotSupportedException;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.client.ClientRequestContext;
+import javax.ws.rs.client.ClientResponseContext;
+import javax.ws.rs.client.ClientResponseFilter;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+@Priority(value = 1)
+public abstract class ResponseExceptionMapper implements ClientResponseFilter {
+
+       @Override
+       public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) throws IOException {
+               if (responseContext.getStatus() >= 300) {
+                       String message = "empty message";
+                       if (responseContext.hasEntity()) {
+                               Optional<String> result = this.extractMessage(responseContext.getEntityStream());
+                               if (result.isPresent()) {
+                                       message = result.get();
+                               }
+                       }
+                       Response.Status status = Response.Status.fromStatusCode(responseContext.getStatus());
+                       WebApplicationException webAppException;
+                       switch (status) {
+                       case BAD_REQUEST:
+                               webAppException = new BadRequestException(message);
+                               break;
+                       case UNAUTHORIZED:
+                               webAppException = new NotAuthorizedException(message);
+                               break;
+                       case FORBIDDEN:
+                               webAppException = new ForbiddenException(message);
+                               break;
+                       case NOT_FOUND:
+                               webAppException = new NotFoundException(message);
+                               break;
+                       case METHOD_NOT_ALLOWED:
+                               webAppException = new NotAllowedException(message);
+                               break;
+                       case NOT_ACCEPTABLE:
+                               webAppException = new NotAcceptableException(message);
+                               break;
+                       case PRECONDITION_FAILED:
+                               webAppException = new PreconditionFailedException(message);
+                               break;
+                       case UNSUPPORTED_MEDIA_TYPE:
+                               webAppException = new NotSupportedException(message);
+                               break;
+                       case INTERNAL_SERVER_ERROR:
+                               webAppException = new InternalServerErrorException(message);
+                               break;
+                       case SERVICE_UNAVAILABLE:
+                               webAppException = new WebApplicationException(message);
+                               break;
+                       default:
+                               webAppException = new WebApplicationException(message);
+                       }
+                       throw webAppException;
+               }
+       }
+       
+       public abstract Optional<String> extractMessage(InputStream stream) throws IOException;
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/ResponseExceptionMapperImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/ResponseExceptionMapperImpl.java
new file mode 100644 (file)
index 0000000..0845a2f
--- /dev/null
@@ -0,0 +1,39 @@
+/*-
+ * ============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.client;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Optional;
+
+import org.apache.commons.io.IOUtils;
+
+public class ResponseExceptionMapperImpl extends ResponseExceptionMapper {
+
+       @Override
+       public Optional<String> extractMessage(InputStream stream) throws IOException {
+               final String input = IOUtils.toString(stream, "UTF-8");
+               IOUtils.closeQuietly(stream);
+               return Optional.of(input);
+       }
+       
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/RestProperties.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/RestProperties.java
new file mode 100644 (file)
index 0000000..ae8862d
--- /dev/null
@@ -0,0 +1,30 @@
+/*-
+ * ============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.client;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+public interface RestProperties {
+
+       public URL getEndpoint() throws MalformedURLException;
+       public String getSystemName();
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/RestPropertiesLoader.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/RestPropertiesLoader.java
new file mode 100644 (file)
index 0000000..6d49d98
--- /dev/null
@@ -0,0 +1,55 @@
+/*-
+ * ============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.client;
+
+import java.util.Iterator;
+import java.util.ServiceLoader;
+
+public class RestPropertiesLoader {
+
+       private final ServiceLoader<RestProperties> services;
+       private RestPropertiesLoader() {
+               services = ServiceLoader.load(RestProperties.class);
+       }
+       
+       private static class Helper {
+               private static final RestPropertiesLoader INSTANCE = new RestPropertiesLoader();
+       }
+       
+       public static RestPropertiesLoader getInstance() {
+               return Helper.INSTANCE;
+       }
+       
+       public <T> T getImpl(Class<? extends RestProperties> clazz) {
+               T result = null;
+               Iterator<RestProperties> propertyImpls = services.iterator();
+               RestProperties item;
+               while (propertyImpls.hasNext()) {
+                       item = propertyImpls.next();
+                       if (clazz.isAssignableFrom(item.getClass())) {
+                               result = (T)item;
+                               break;
+                       }
+               }
+               
+               return result;
+       }
+}
index f1bafde..0e00ae5 100644 (file)
@@ -22,33 +22,5 @@ package org.openecomp.mso.client.dmaap;
 
 public interface Consumer {
 
-       /**
-        * Should this consumer continue to consume messages from the topic?
-        * @return
-        */
-       public boolean continuePolling();
-       /**
-        * Process a message from a DMaaP topic
-        * 
-        * @param message
-        * @throws Exception
-        */
-       public void processMessage(String message) throws Exception;
-       /**
-        * Has the request been accepted by the receiving system?
-        * Should the consumer move to processing messages?
-        * 
-        * @param message
-        * @return
-        */
-       public boolean isAccepted(String message);
-       /**
-        * The request id to filter messages on
-        * @return
-        */
-       public String getRequestId();
-       /**
-        * Logic that defines when the consumer should stop processing messages
-        */
-       public void stopProcessingMessages();
+       public Iterable<String> fetch();
 }
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DefaultDmaapPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DefaultDmaapPropertiesImpl.java
new file mode 100644 (file)
index 0000000..9af1fd3
--- /dev/null
@@ -0,0 +1,38 @@
+/*-
+ * ============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.client.dmaap;
+
+import java.util.Map;
+
+import org.openecomp.mso.bpmn.core.PropertyConfiguration;
+
+public class DefaultDmaapPropertiesImpl implements DmaapProperties {
+
+       private final Map<String, String> properties;
+       public DefaultDmaapPropertiesImpl() {
+               this.properties = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties");
+       }
+       @Override
+       public Map<String, String> getProperties() {
+               return this.properties;
+       } 
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DmaapClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DmaapClient.java
new file mode 100644 (file)
index 0000000..7862c9d
--- /dev/null
@@ -0,0 +1,68 @@
+/*-
+ * ============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.client.dmaap;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Base64;
+import java.util.Map;
+import java.util.Properties;
+
+import org.openecomp.mso.bpmn.core.PropertyConfiguration;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+public abstract class DmaapClient {
+       
+       protected final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
+       protected final Map<String, String> msoProperties;
+       protected final Properties properties;
+       public DmaapClient(String filepath) throws FileNotFoundException, IOException {
+               Resource resource = new ClassPathResource(filepath);
+               DmaapProperties dmaapProperties = DmaapPropertiesLoader.getInstance().getImpl();
+               if (dmaapProperties == null) {
+                       dmaapProperties = new DefaultDmaapPropertiesImpl();
+               }
+               this.msoProperties = dmaapProperties.getProperties();
+               this.properties = new Properties();
+               this.properties.load(resource.getInputStream());
+               this.properties.put("password", this.deobfuscatePassword(this.getPassword()));
+               this.properties.put("username", this.getUserName());
+               this.properties.put("topic", this.getTopic());
+       }
+       protected String deobfuscatePassword(String password) {
+               
+               try {
+                       return new String(Base64.getDecoder().decode(password.getBytes()));
+               } catch(IllegalArgumentException iae) {
+                       
+                       return password;
+               }
+       }
+       
+       
+       public abstract String getUserName();
+       public abstract String getPassword();
+       public abstract String getTopic();
+}
index 2a61876..0339516 100644 (file)
@@ -22,39 +22,110 @@ package org.openecomp.mso.client.dmaap;
 
 import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.util.concurrent.TimeUnit;
 
-import com.att.nsa.mr.client.MRClientFactory;
-import com.att.nsa.mr.client.MRConsumer;
+import org.openecomp.mso.client.dmaap.exceptions.DMaaPConsumerFailure;
+import org.openecomp.mso.client.dmaap.exceptions.ExceededMaximumPollingTime;
+import org.openecomp.mso.client.dmaap.rest.RestConsumer;
 
-public class DmaapConsumer {
+import com.google.common.base.Stopwatch;
 
-       private final MRConsumer mrConsumer;
-       public DmaapConsumer() {
-               mrConsumer = null;
-       }
-       public DmaapConsumer (String filepath) throws FileNotFoundException, IOException {
-               
-               mrConsumer = MRClientFactory.createConsumer(filepath);
+public abstract class DmaapConsumer extends DmaapClient {
+
+       public DmaapConsumer() throws FileNotFoundException, IOException {
+               super("dmaap/default-consumer.properties");
        }
        
-       
-       public MRConsumer getMRConsumer() {
-               return mrConsumer;
+       public Consumer getConsumer() throws FileNotFoundException, IOException {
+               return new RestConsumer(this.properties);
        }
-       public boolean consume(Consumer consumer) throws Exception {
+       public boolean consume() throws Exception {
+               
+               Consumer mrConsumer = this.getConsumer();
+               int iterations = 0;
                boolean accepted = false;
-               while (consumer.continuePolling()) {
-                       for (String message : this.getMRConsumer().fetch()) {
-                               if (!accepted && consumer.isAccepted(message)) {
-                                       accepted = true;
-                               } 
-                               if (accepted) {
-                                       consumer.processMessage(message);
+               Stopwatch stopwatch = Stopwatch.createUnstarted();
+               try {
+                       while (this.continuePolling()) {
+                               if (stopwatch.elapsed(TimeUnit.MILLISECONDS) >= this.getMaximumElapsedTime()) {
+                                       final String message = "exceeded maximum retries on " + this.getRequestId() + " on " + this.getTopic();
+                                       auditLogger.error(message);
+                                       throw new ExceededMaximumPollingTime(message);
                                }
+                               stopwatch.start();
+                               Iterable<String> itr = mrConsumer.fetch();
+                               stopwatch.stop();
+                               for (String message : itr) {
+                                       if (!accepted && this.isAccepted(message)) {
+                                               auditLogger.info("accepted message found for " + this.getRequestId() + " on " + this.getTopic());
+                                               accepted = true;
+                                       } 
+                                       if (accepted) {
+                                               if (this.isFailure(message)) {
+                                                       this.stopProcessingMessages();
+                                                       auditLogger.info("received dmaap message: " + message);
+                                                       final String errorMsg = "failure received from dmaap topic " + this.getTopic();
+                                                       auditLogger.error(errorMsg);
+                                                       throw new DMaaPConsumerFailure(errorMsg);
+                                               } else {
+                                                       auditLogger.info("received dmaap message: " + message);
+                                                       this.processMessage(message);
+                                               }
+                                       }
+                               }
+                               iterations++;
+                       }
+                       return true;
+               } catch (Exception e ) {
+                       throw e;
+               } finally {
+                       if (stopwatch.isRunning()) {
+                               stopwatch.stop();
                        }
                }
-               
-               return true;
        }
        
+       /**
+        * Should this consumer continue to consume messages from the topic?
+        * @return
+        */
+       public abstract boolean continuePolling();
+       /**
+        * Process a message from a DMaaP topic
+        * 
+        * @param message
+        * @throws Exception
+        */
+       public abstract void processMessage(String message) throws Exception;
+       /**
+        * Has the request been accepted by the receiving system?
+        * Should the consumer move to processing messages?
+        * 
+        * @param message
+        * @return
+        */
+       public abstract boolean isAccepted(String message);
+       /**
+        * has the request failed?
+        * 
+        * @param message
+        * @return
+        */
+       public abstract boolean isFailure(String message);
+       /**
+        * The request id to filter messages on
+        * @return
+        */
+       public abstract String getRequestId();
+       /**
+        * Logic that defines when the consumer should stop processing messages
+        */
+       public abstract void stopProcessingMessages();
+       
+       /**
+        * time in milliseconds
+        */
+       public int getMaximumElapsedTime() {
+               return 180000;
+       }
 }
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DmaapProperties.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DmaapProperties.java
new file mode 100644 (file)
index 0000000..7bdd7df
--- /dev/null
@@ -0,0 +1,32 @@
+/*-
+ * ============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.client.dmaap;
+
+import java.util.Map;
+
+public interface DmaapProperties {
+
+       /**
+        * A map of strings which contains the properties for a dmaap client
+        * @return
+        */
+       public Map<String, String> getProperties();
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DmaapPropertiesLoader.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DmaapPropertiesLoader.java
new file mode 100644 (file)
index 0000000..a21dbe8
--- /dev/null
@@ -0,0 +1,49 @@
+/*-
+ * ============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.client.dmaap;
+
+import java.util.Iterator;
+import java.util.ServiceLoader;
+
+public class DmaapPropertiesLoader {
+
+       private final ServiceLoader<DmaapProperties> services;
+       private DmaapPropertiesLoader() {
+               services = ServiceLoader.load(DmaapProperties.class);
+       }
+       
+       private static class Helper {
+               private static final DmaapPropertiesLoader INSTANCE = new DmaapPropertiesLoader();
+       }
+       
+       public static DmaapPropertiesLoader getInstance() {
+               return Helper.INSTANCE;
+       }
+       
+       public DmaapProperties getImpl() {
+               Iterator<DmaapProperties> propertyImpls = services.iterator();
+               while (propertyImpls.hasNext()) {
+                       return propertyImpls.next();
+               }
+               
+               return null;
+       }
+}
index 4d70a16..d2752c5 100644 (file)
@@ -22,29 +22,30 @@ package org.openecomp.mso.client.dmaap;
 
 import java.io.FileNotFoundException;
 import java.io.IOException;
-import java.util.concurrent.TimeUnit;
 
-import com.att.nsa.mr.client.MRBatchingPublisher;
-import com.att.nsa.mr.client.MRClientFactory;
+import org.openecomp.mso.client.dmaap.rest.RestPublisher;
 
-public class DmaapPublisher {
+public abstract class DmaapPublisher extends DmaapClient {
        
-       private final long seconds;
-       private final MRBatchingPublisher publisher;
-       
-       public DmaapPublisher(String filepath) throws FileNotFoundException, IOException {
+       private long seconds;
+       private final Publisher publisher;
+       public DmaapPublisher() throws FileNotFoundException, IOException {
+               super("dmaap/default-consumer.properties");
+               this.publisher = new RestPublisher(properties);
                this.seconds = 20;
-               this.publisher = MRClientFactory.createBatchingPublisher(filepath);
+               
        }
        
-       public DmaapPublisher(String filepath, long seconds) throws FileNotFoundException, IOException {
+       public DmaapPublisher(long seconds) throws FileNotFoundException, IOException {
+               this();
                this.seconds = seconds;
-               this.publisher = MRClientFactory.createBatchingPublisher(filepath);
        }
        
        public void send(String json) throws IOException, InterruptedException {
+               auditLogger.info("publishing message to dmaap topic " + this.getTopic() + ": " + json);
                publisher.send(json);
-               publisher.close(seconds, TimeUnit.SECONDS);
+               //publisher.close(seconds, TimeUnit.SECONDS);
        }
 
+
 }
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/Publisher.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/Publisher.java
new file mode 100644 (file)
index 0000000..d89ee6e
--- /dev/null
@@ -0,0 +1,26 @@
+/*-
+ * ============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.client.dmaap;
+
+public interface Publisher {
+
+       public void send(String json);
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/exceptions/DMaaPConsumerFailure.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/exceptions/DMaaPConsumerFailure.java
new file mode 100644 (file)
index 0000000..29472b2
--- /dev/null
@@ -0,0 +1,34 @@
+/*-
+ * ============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.client.dmaap.exceptions;
+
+public class DMaaPConsumerFailure extends Exception {
+
+       private static final long serialVersionUID = 2499229901897110362L;
+
+       public DMaaPConsumerFailure() {
+               super();
+       }
+       
+       public DMaaPConsumerFailure(String message) {
+               super(message);
+       }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/exceptions/ExceededMaximumPollingTime.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/exceptions/ExceededMaximumPollingTime.java
new file mode 100644 (file)
index 0000000..c9d6750
--- /dev/null
@@ -0,0 +1,34 @@
+/*-
+ * ============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.client.dmaap.exceptions;
+
+public class ExceededMaximumPollingTime extends RuntimeException  {
+
+       private static final long serialVersionUID = 2331207691092906423L;
+
+       public ExceededMaximumPollingTime() {
+               super();
+       }
+       
+       public ExceededMaximumPollingTime(String message) {
+               super(message);
+       }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/DMaaPRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/DMaaPRestClient.java
new file mode 100644 (file)
index 0000000..124e2c3
--- /dev/null
@@ -0,0 +1,57 @@
+/*-
+ * ============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.client.dmaap.rest;
+
+import java.net.URL;
+import java.util.Base64;
+import java.util.Map;
+import java.util.Optional;
+
+import javax.ws.rs.client.ClientResponseFilter;
+
+import org.openecomp.mso.client.ResponseExceptionMapperImpl;
+import org.openecomp.mso.client.policy.RestClient;
+
+public class DMaaPRestClient  extends RestClient {
+
+       private final String username;
+       private final String password;
+       public DMaaPRestClient(URL url, String contentType, String username, String password) {
+               super(url, contentType);
+               this.username = username;
+               this.password = password;
+       }
+
+       @Override
+       protected void initializeHeaderMap(Map<String, String> headerMap) {
+               headerMap.put("Authorization", "Basic " + Base64.getEncoder().encodeToString(new String(username + ":" + password).getBytes()));
+       }
+
+       @Override
+       protected Optional<ClientResponseFilter> addResponseFilter() {
+               return Optional.of(new ResponseExceptionMapperImpl());
+       }
+
+       @Override
+       public RestClient addRequestId(String requestId) {
+               return null;
+       }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/PropertiesBean.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/PropertiesBean.java
new file mode 100644 (file)
index 0000000..fb914a0
--- /dev/null
@@ -0,0 +1,131 @@
+/*-
+ * ============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.client.dmaap.rest;
+
+import java.util.Properties;
+
+public class PropertiesBean {
+
+       private String username;
+       private String password;
+       private String environment;
+       private String partition;
+       private String contentType;
+       private String host;
+       private String topic;
+       private String timeout;
+       
+       
+       public PropertiesBean(Properties properties) {
+               this.withUsername(properties.getProperty("username"))
+               .withPassword(properties.getProperty("password"))
+               .withTopic(properties.getProperty("topic"))
+               .withEnvironment(properties.getProperty("environment"))
+               .withHost(properties.getProperty("host"))
+               .withTimeout(properties.getProperty("timeout", "20000"))
+               .withPartition(properties.getProperty("partition"))
+               .withContentType(properties.getProperty("contentType", "application/json"));
+       }
+       public String getUsername() {
+               return username;
+       }
+       public void setUsername(String username) {
+               this.username = username;
+       }
+       public PropertiesBean withUsername(String username) {
+               this.username = username;
+               return this;
+       }
+       public String getPassword() {
+               return password;
+       }
+       public void setPassword(String password) {
+               this.password = password;
+       }
+       public PropertiesBean withPassword(String password) {
+               this.password = password;
+               return this;
+       }
+       public String getEnvironment() {
+               return environment;
+       }
+       public void setEnvironment(String environment) {
+               this.environment = environment;
+       }
+       public PropertiesBean withEnvironment(String environment) {
+               this.environment = environment;
+               return this;
+       }
+       public String getPartition() {
+               return partition;
+       }
+       public void setPartition(String partition) {
+               this.partition = partition;
+       }
+       public PropertiesBean withPartition(String partition) {
+               this.partition = partition;
+               return this;
+       }
+       public String getContentType() {
+               return contentType;
+       }
+       public void setContentType(String contentType) {
+               this.contentType = contentType;
+       }
+       public PropertiesBean withContentType(String contentType) {
+               this.contentType = contentType;
+               return this;
+       }
+       public String getHost() {
+               return host;
+       }
+       public void setHost(String host) {
+               this.host = host;
+       }
+       public PropertiesBean withHost(String host) {
+               this.host = host;
+               return this;
+       }
+       public String getTopic() {
+               return topic;
+       }
+       public void setTopic(String topic) {
+               this.topic = topic;
+       }
+       public PropertiesBean withTopic(String topic) {
+               this.topic = topic;
+               return this;
+       }
+       public String getTimeout() {
+               return timeout;
+       }
+       public void setTimeout(String timeout) {
+               this.timeout = timeout;
+       }
+       public PropertiesBean withTimeout(String timeout) {
+               this.timeout = timeout;
+               return this;
+       }
+       
+       
+       
+       
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/RestConsumer.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/RestConsumer.java
new file mode 100644 (file)
index 0000000..ff199e2
--- /dev/null
@@ -0,0 +1,60 @@
+/*-
+ * ============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.client.dmaap.rest;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+import java.util.Properties;
+
+import javax.ws.rs.core.GenericType;
+import javax.ws.rs.core.UriBuilder;
+
+import org.openecomp.mso.client.dmaap.Consumer;
+import org.openecomp.mso.client.policy.RestClient;
+
+public class RestConsumer implements Consumer {
+
+       private final RestClient client;
+       public RestConsumer(Properties properties) {
+               PropertiesBean bean = new PropertiesBean(properties);
+               client = new DMaaPRestClient(this.createURL(bean), bean.getContentType(), bean.getUsername(), bean.getPassword());
+       }
+       
+       private URL createURL(PropertiesBean properties) {
+               try {
+                       return UriBuilder.fromUri("http://" + properties.getHost())
+                                       .path("events").path(properties.getTopic())
+                                       .path(properties.getPartition())
+                                       .path("consumer1")
+                                       .queryParam("timeout",  properties.getTimeout()).build().toURL();
+               } catch (MalformedURLException e) {
+                       throw new RuntimeException(e);
+               }
+       }
+       
+       @Override
+       public Iterable<String> fetch() {
+               
+               return client.get(new GenericType<List<String>>() {});
+       }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/RestPublisher.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/RestPublisher.java
new file mode 100644 (file)
index 0000000..e8e6859
--- /dev/null
@@ -0,0 +1,56 @@
+/*-
+ * ============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.client.dmaap.rest;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Properties;
+
+import javax.ws.rs.core.UriBuilder;
+import javax.ws.rs.core.UriBuilderException;
+
+import org.openecomp.mso.client.dmaap.Publisher;
+import org.openecomp.mso.client.policy.RestClient;
+
+public class RestPublisher implements Publisher {
+
+       private final RestClient client;
+
+       public RestPublisher(Properties properties) {
+               PropertiesBean bean = new PropertiesBean(properties);
+               client = new DMaaPRestClient(this.createURL(bean), bean.getContentType(), bean.getUsername(), bean.getPassword());
+       }
+       
+       private URL createURL(PropertiesBean properties) {
+               try {
+                       return UriBuilder.fromUri("http://" + properties.getHost())
+                                       .path("events").path(properties.getTopic())
+                                       .queryParam("timeout",  properties.getTimeout()).build().toURL();
+               } catch (MalformedURLException e) {
+                       throw new RuntimeException(e);
+               }
+       }
+       
+       @Override
+       public void send(String json) {
+               client.post(json);
+       }
+}
index 665b905..e029419 100644 (file)
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP - SO\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.mso.client.policy;\r
-\r
-import java.io.BufferedInputStream;\r
-\r
-import java.io.ByteArrayOutputStream;\r
-import java.io.FilterOutputStream;\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-import java.io.OutputStream;\r
-import java.nio.charset.Charset;\r
-import java.nio.charset.StandardCharsets;\r
-import java.util.logging.Logger;\r
-import javax.annotation.Priority;\r
-import javax.ws.rs.WebApplicationException;\r
-import javax.ws.rs.client.ClientRequestContext;\r
-import javax.ws.rs.client.ClientRequestFilter;\r
-import javax.ws.rs.client.ClientResponseContext;\r
-import javax.ws.rs.client.ClientResponseFilter;\r
-import javax.ws.rs.ext.WriterInterceptor;\r
-import javax.ws.rs.ext.WriterInterceptorContext;\r
-\r
-@Priority(Integer.MIN_VALUE)\r
-public class LoggingFilter implements ClientRequestFilter, ClientResponseFilter, WriterInterceptor {\r
-\r
-       private static final Logger logger = Logger.getLogger(LoggingFilter.class.getName());\r
-       private static final String ENTITY_STREAM_PROPERTY = "LoggingFilter.entityStream";\r
-       private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;\r
-       private final int maxEntitySize = 1024 * 8;\r
-\r
-       private void log(StringBuilder sb) {\r
-               logger.info(sb.toString());\r
-       }\r
-\r
-       private InputStream logInboundEntity(final StringBuilder b, InputStream stream, final Charset charset)\r
-                       throws IOException {\r
-               InputStream inputStream = stream;\r
-               if (!inputStream.markSupported()) {\r
-                       inputStream = new BufferedInputStream(inputStream);\r
-               }\r
-               inputStream.mark(maxEntitySize + 1);\r
-               final byte[] entity = new byte[maxEntitySize + 1];\r
-               final int entitySize = inputStream.read(entity);\r
-               b.append(new String(entity, 0, Math.min(entitySize, maxEntitySize), charset));\r
-               if (entitySize > maxEntitySize) {\r
-                       b.append("...more...");\r
-               }\r
-               b.append('\n');\r
-               inputStream.reset();\r
-               return inputStream;\r
-       }\r
-\r
-       @Override\r
-       public void filter(ClientRequestContext requestContext) throws IOException {\r
-               if (requestContext.hasEntity()) {\r
-                       final OutputStream stream = new LoggingStream(requestContext.getEntityStream());\r
-                       requestContext.setEntityStream(stream);\r
-                       requestContext.setProperty(ENTITY_STREAM_PROPERTY, stream);\r
-               }\r
-       }\r
-\r
-       @Override\r
-       public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) throws IOException {\r
-               final StringBuilder sb = new StringBuilder();\r
-               if (responseContext.hasEntity()) {\r
-                       responseContext.setEntityStream(logInboundEntity(sb, responseContext.getEntityStream(), DEFAULT_CHARSET));\r
-                       log(sb);\r
-               }\r
-\r
-       }\r
-\r
-       @Override\r
-       public void aroundWriteTo(WriterInterceptorContext context) throws IOException, WebApplicationException {\r
-               final LoggingStream stream = (LoggingStream) context.getProperty(ENTITY_STREAM_PROPERTY);\r
-               context.proceed();\r
-               if (stream != null) {\r
-                       log(stream.getStringBuilder(DEFAULT_CHARSET));\r
-               }\r
-       }\r
-\r
-       private class LoggingStream extends FilterOutputStream {\r
-\r
-               private final StringBuilder sb = new StringBuilder();\r
-               private final ByteArrayOutputStream baos = new ByteArrayOutputStream();\r
-\r
-               LoggingStream(OutputStream out) {\r
-                       super(out);\r
-               }\r
-\r
-               StringBuilder getStringBuilder(Charset charset) {\r
-                       // write entity to the builder\r
-                       final byte[] entity = baos.toByteArray();\r
-\r
-                       sb.append(new String(entity, 0, entity.length, charset));\r
-                       if (entity.length > maxEntitySize) {\r
-                               sb.append("...more...");\r
-                       }\r
-                       sb.append('\n');\r
-\r
-                       return sb;\r
-               }\r
-\r
-               @Override\r
-               public void write(final int i) throws IOException {\r
-                       if (baos.size() <= maxEntitySize) {\r
-                               baos.write(i);\r
-                       }\r
-                       out.write(i);\r
-               }\r
-       }\r
-}\r
+/*-
+ * ============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.client.policy;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FilterOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.util.logging.Logger;
+
+import javax.annotation.Priority;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.client.ClientRequestContext;
+import javax.ws.rs.client.ClientRequestFilter;
+import javax.ws.rs.client.ClientResponseContext;
+import javax.ws.rs.client.ClientResponseFilter;
+import javax.ws.rs.ext.WriterInterceptor;
+import javax.ws.rs.ext.WriterInterceptorContext;
+
+@Priority(Integer.MIN_VALUE)
+public class LoggingFilter implements ClientRequestFilter, ClientResponseFilter, WriterInterceptor {
+
+       private static final Logger logger = Logger.getLogger(LoggingFilter.class.getName());
+       private static final String ENTITY_STREAM_PROPERTY = "LoggingFilter.entityStream";
+       private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
+       private final int maxEntitySize;
+
+       public LoggingFilter() {
+               maxEntitySize = 1024 * 1024;
+       }
+
+       public LoggingFilter(int maxPayloadSize) {
+               this.maxEntitySize = Integer.min(maxPayloadSize, 1024 * 1024);
+       }
+
+       private void log(StringBuilder sb) {
+               logger.info(sb.toString());
+       }
+
+       private InputStream logInboundEntity(final StringBuilder b, InputStream stream, final Charset charset)
+                       throws IOException {
+               if (!stream.markSupported()) {
+                       stream = new BufferedInputStream(stream);
+               }
+               stream.mark(maxEntitySize + 1);
+               final byte[] entity = new byte[maxEntitySize + 1];
+               final int entitySize = stream.read(entity);
+               if (entitySize != -1) {
+                       b.append(new String(entity, 0, Math.min(entitySize, maxEntitySize), charset));
+               }
+               if (entitySize > maxEntitySize) {
+                       b.append("...more...");
+               }
+               b.append('\n');
+               stream.reset();
+               return stream;
+       }
+
+       @Override
+       public void filter(ClientRequestContext requestContext) throws IOException {
+               if (requestContext.hasEntity()) {
+                       final OutputStream stream = new LoggingStream(requestContext.getEntityStream());
+                       requestContext.setEntityStream(stream);
+                       requestContext.setProperty(ENTITY_STREAM_PROPERTY, stream);
+               }
+       }
+
+       @Override
+       public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) throws IOException {
+               final StringBuilder sb = new StringBuilder();
+               if (responseContext.hasEntity()) {
+                       responseContext.setEntityStream(logInboundEntity(sb, responseContext.getEntityStream(), DEFAULT_CHARSET));
+                       log(sb);
+               }
+       }
+
+       @Override
+       public void aroundWriteTo(WriterInterceptorContext context) throws IOException, WebApplicationException {
+               final LoggingStream stream = (LoggingStream) context.getProperty(ENTITY_STREAM_PROPERTY);
+               context.proceed();
+               if (stream != null) {
+                       log(stream.getStringBuilder(DEFAULT_CHARSET));
+               }
+       }
+
+       private class LoggingStream extends FilterOutputStream {
+
+               private final StringBuilder sb = new StringBuilder();
+               private final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+               LoggingStream(OutputStream out) {
+                       super(out);
+               }
+
+               StringBuilder getStringBuilder(Charset charset) {
+                       // write entity to the builder
+                       final byte[] entity = baos.toByteArray();
+
+                       sb.append(new String(entity, 0, entity.length, charset));
+                       if (entity.length > maxEntitySize) {
+                               sb.append("...more...");
+                       }
+                       sb.append('\n');
+
+                       return sb;
+               }
+
+               @Override
+               public void write(final int i) throws IOException {
+                       if (baos.size() <= maxEntitySize) {
+                               baos.write(i);
+                       }
+                       out.write(i);
+               }
+       }
+}
\ No newline at end of file
index 71ae56f..4ed2a88 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- * ONAP - SO
+ * OPENECOMP - MSO
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
 
 package org.openecomp.mso.client.policy;
 
+import java.net.MalformedURLException;
 import java.util.Map;
+import java.util.Optional;
 import java.util.UUID;
 
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.core.MediaType;
+import javax.ws.rs.client.ClientResponseFilter;
+import javax.ws.rs.core.UriBuilder;
+import javax.ws.rs.core.UriBuilderException;
 
+import org.openecomp.mso.client.ResponseExceptionMapperImpl;
+import org.openecomp.mso.client.RestProperties;
+import org.openecomp.mso.client.policy.entities.PolicyServiceType;
 import org.springframework.stereotype.Service;
 
 @Service
 public class PolicyRestClient extends RestClient {
 
-       private static final String ENDPOINT_KEY = "policy.endpoint";
        private static final String X_ECOMP_REQUESTID = String.valueOf(UUID.randomUUID());
-
-       public PolicyRestClient() {
-               super(ENDPOINT_KEY);
+       private final PolicyRestProperties properties;
+       public PolicyRestClient(PolicyRestProperties props, PolicyServiceType serviceType) {
+               super(props, Optional.of(UriBuilder.fromPath(serviceType.toString()).build()));
+               this.properties = props;
+               this.getClient();
        }
 
        @Override
        protected void initializeHeaderMap(Map<String, String> headerMap) {
-               headerMap.put("ClientAuth", properties.get("policy.client.auth"));
-               headerMap.put("Authorization", properties.get("policy.auth"));
-               headerMap.put("Environment", properties.get("policy.environment"));
-               headerMap.put("X-ECOMP-RequestID", X_ECOMP_REQUESTID);
+               headerMap.put("ClientAuth", properties.getClientAuth());
+               headerMap.put("Authorization", properties.getAuth());
+               headerMap.put("Environment", properties.getEnvironment());
+               this.addRequestId(X_ECOMP_REQUESTID);
        }
 
-       public PolicyDecision getDecision(String serviceType, String vnfType, String bbID, String workStep,
-                       String errorCode) {
-               DecisionAttributes decisionAttributes = new DecisionAttributes();
-               decisionAttributes.setServiceType(serviceType);
-               decisionAttributes.setVNFType(vnfType);
-               decisionAttributes.setBBID(bbID);
-               decisionAttributes.setWorkStep(workStep);
-               decisionAttributes.setErrorCode(errorCode);
-
-               return this.getDecision(decisionAttributes);
+       @Override
+       protected Optional<ClientResponseFilter> addResponseFilter() {
+               return Optional.of(new ResponseExceptionMapperImpl());
        }
 
-       private PolicyDecision getDecision(DecisionAttributes decisionAttributes) {
-               PolicyDecisionRequest decisionRequest = new PolicyDecisionRequest();
-               decisionRequest.setDecisionAttributes(decisionAttributes);
-               decisionRequest.setEcompcomponentName(ECOMP_COMPONENT_NAME);
-
-               return this.getBuilder().accept(MediaType.APPLICATION_JSON_TYPE)
-                               .post(Entity.entity(decisionRequest, MediaType.APPLICATION_JSON)).readEntity(PolicyDecision.class);
+       @Override
+       public RestClient addRequestId(String requestId) {
+               this.headerMap.put("X-ECOMP-RequestID", requestId);
+               return this;
        }
 }
\ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/PolicyRestProperties.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/PolicyRestProperties.java
new file mode 100644 (file)
index 0000000..d933676
--- /dev/null
@@ -0,0 +1,64 @@
+/*-
+ * ============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.client.policy;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Map;
+
+import org.openecomp.mso.bpmn.core.PropertyConfiguration;
+import org.openecomp.mso.client.RestProperties;
+
+public class PolicyRestProperties implements RestProperties {
+
+       
+       final Map<String, String> props;
+       public PolicyRestProperties() {
+               this.props = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties");
+
+       }
+       @Override
+       public URL getEndpoint() {
+               try {
+                       return new URL(props.getOrDefault("policy.endpoint", ""));
+               } catch (MalformedURLException e) {
+                       return null;
+               }
+       }
+
+       @Override
+       public String getSystemName() {
+               return "MSO";
+       }
+       
+       public String getClientAuth() {
+               return props.get("policy.client.auth");
+       }
+       
+       public String getAuth() {
+               return props.get("policy.auth");
+       }
+       
+       public String getEnvironment() {
+               return props.get("policy.environment");
+       }
+
+}
index 81c072f..74b1c3f 100644 (file)
 
 package org.openecomp.mso.client.policy;
 
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Map.Entry;
-import java.util.logging.Logger;
+import java.util.Optional;
 
+import javax.ws.rs.client.Client;
 import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.ClientResponseFilter;
+import javax.ws.rs.client.Entity;
 import javax.ws.rs.client.Invocation.Builder;
 import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.GenericType;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriBuilder;
+import javax.ws.rs.ext.ContextResolver;
 
-
-import org.openecomp.mso.bpmn.core.PropertyConfiguration;
+import org.apache.log4j.Logger;
+import org.openecomp.mso.client.RestProperties;
 import org.openecomp.mso.logger.MsoLogger;
 import org.springframework.stereotype.Service;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+
 @Service
 public abstract class RestClient {
        protected static final String ECOMP_COMPONENT_NAME = "MSO";
-
+       
+       private static final int MAX_PAYLOAD_SIZE = 1024 * 1024;
        private WebTarget webTarget;
 
        protected final Map<String, String> headerMap;
        protected final MsoLogger msoLogger;
-       protected Map<String, String> properties;
-       protected String host;
+       protected URL host;
+       protected Optional<URI> path;
+       protected Logger logger;
+       protected String accept;
+       protected String contentType;
 
-       protected RestClient(String endpointKey) {
-               Logger logger = Logger.getLogger(getClass().getName());
+       protected RestClient(RestProperties props, Optional<URI> path) {
+               logger = Logger.getLogger(getClass().getName());
                msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
-               
-               properties = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties");
+
                headerMap = new HashMap<>();
-               initializeHeaderMap(headerMap);
+               try {
+                       host = props.getEndpoint();
+               } catch (MalformedURLException e) {
+                       logger.error("url not valid", e);
+                       throw new RuntimeException(e);
+               }
+               
+               this.path = path;
+               initializeClient(getClient());
+       }
 
-               host = this.getHost(endpointKey);
+       protected RestClient(RestProperties props, Optional<URI> path, String accept, String contentType) {
+               this(props, path);
+               this.accept = accept;
+               this.contentType = contentType;
 
-               webTarget = ClientBuilder.newClient().register(logger).register(new LoggingFilter())
-                               .register(new CommonObjectMapperProvider()).target(host);
        }
 
-       private String getHost(String key) {
-               return properties.get(key);
+       protected RestClient(URL host, String contentType) {
+               headerMap = new HashMap<>();
+               logger = Logger.getLogger(getClass().getName());
+               msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
+               this.path = Optional.empty();
+               this.host = host;
+               this.contentType = contentType;
+               initializeClient(getClient());
+       }
+
+       /**
+        * Override method to return false to disable logging.
+        * 
+        * @return true - to enable logging, false otherwise
+        */
+       protected boolean enableLogging() {
+               return true;
+       }
+       
+       /**
+        * Override method to return custom value for max payload size.
+        * 
+        * @return Default value for MAX_PAYLOAD_SIZE = 1024 * 1024
+        */
+       protected int getMaxPayloadSize()
+       {
+               return MAX_PAYLOAD_SIZE;
        }
 
        protected Builder getBuilder() {
+
                Builder builder = webTarget.request();
+               initializeHeaderMap(headerMap);
 
                for (Entry<String, String> entry : headerMap.entrySet()) {
                        builder.header(entry.getKey(), entry.getValue());
@@ -73,4 +126,100 @@ public abstract class RestClient {
        }
 
        protected abstract void initializeHeaderMap(Map<String, String> headerMap);
+
+       protected abstract Optional<ClientResponseFilter> addResponseFilter();
+
+       public abstract RestClient addRequestId(String requestId);
+
+       protected ContextResolver<ObjectMapper> getMapper() {
+               return new CommonObjectMapperProvider();
+       }
+
+       protected String getAccept() {
+               return accept;
+       }
+
+       protected String getContentType() {
+               return contentType;
+       }
+
+       protected String getMergeContentType() {
+               return "application/merge-patch+json";
+       }
+
+       protected Client getClient() {
+               return ClientBuilder.newBuilder().build();
+       }
+
+       protected void initializeClient(Client client) {
+               if (this.enableLogging()) {
+                       client.register(logger).register(new LoggingFilter(this.getMaxPayloadSize()));
+               }
+               client.register(this.getMapper());
+               Optional<ClientResponseFilter> responseFilter = this.addResponseFilter();
+               if (responseFilter.isPresent()) {
+                       client.register(responseFilter.get());
+               }
+               if (!path.isPresent()) {
+                       webTarget = client.target(host.toString());
+               } else {
+                       webTarget = client.target(UriBuilder.fromUri(host + path.get().toString()));
+               }
+               this.accept = MediaType.APPLICATION_JSON;
+               this.contentType = MediaType.APPLICATION_JSON;
+       }
+
+       public Response get() {
+               return this.getBuilder().accept(this.getAccept()).get();
+       }
+
+       public Response post(Object obj) {
+               return this.getBuilder().accept(this.getAccept()).post(Entity.entity(obj, this.getContentType()));
+       }
+
+       public Response patch(Object obj) {
+               return this.getBuilder().header("X-HTTP-Method-Override", "PATCH").accept(this.getAccept())
+                               .post(Entity.entity(obj, this.getMergeContentType()));
+       }
+
+       public Response put(Object obj) {
+               return this.getBuilder().accept(this.getAccept()).put(Entity.entity(obj, this.getContentType()));
+       }
+
+       public Response delete() {
+               return this.getBuilder().accept(this.getAccept()).delete();
+       }
+
+       public Response delete(Object obj) {
+               return this.getBuilder().header("X-HTTP-Method-Override", "DELETE").accept(this.getAccept())
+                               .put(Entity.entity(obj, this.getContentType()));
+       }
+
+       public <T> T get(Class<T> resultClass) {
+               return this.get().readEntity(resultClass);
+       }
+
+       public <T> T get(GenericType<T> resultClass) {
+               return this.get().readEntity(resultClass);
+       }
+
+       public <T> T post(Object obj, Class<T> resultClass) {
+               return this.post(obj).readEntity(resultClass);
+       }
+
+       public <T> T patch(Object obj, Class<T> resultClass) {
+               return this.patch(obj).readEntity(resultClass);
+       }
+
+       public <T> T put(Object obj, Class<T> resultClass) {
+               return this.put(obj).readEntity(resultClass);
+       }
+
+       public <T> T delete(Class<T> resultClass) {
+               return this.delete().readEntity(resultClass);
+       }
+       
+       public <T> T delete(Object obj, Class<T> resultClass) {
+               return this.delete(obj).readEntity(resultClass);
+       }
 }
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/entities/PolicyServiceType.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/entities/PolicyServiceType.java
new file mode 100644 (file)
index 0000000..b5ab63c
--- /dev/null
@@ -0,0 +1,48 @@
+/*-
+ * ============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.client.policy.entities;
+
+public enum PolicyServiceType {
+       GET_CONFIG("getConfig"),
+       SEND_EVENT("sendEvent"),
+       PUSH_POLICY("pushPolicy"),
+       CREATE_POLICY("createPolicy"),
+       UPDATE_POLICY("updatePolicy"),
+       GET_DECISION("getDecision"),
+       GET_METRICS("getMetrics"),
+       DELETE_POLICY("deletePolicy"),
+       LIST_CONFIG("listConfig"),
+       CREATE_DICTIONARY_ITEM("createDictionaryItem"),
+       UPDATE_DICTIONARY_ITEM("updateDictionaryItem"),
+       GET_DICTIONARY_ITEMS("getDictionaryItems");
+       
+       private final String name;
+       
+       private PolicyServiceType(String name) {
+               this.name = name;
+       }
+       
+       @Override
+       public String toString() {
+               return name;
+       }
+       
+}
index eb18e10..c746c0d 100644 (file)
@@ -32,6 +32,6 @@ public interface SDNOValidator {
         * @throws IOException
         * @throws Exception
         */
-       public void healthDiagnostic(String vnfName, String uuid) throws IOException, Exception;
+       public void healthDiagnostic(String vnfId, String requestingUserId) throws IOException, Exception;
 
 }
index 92a00ee..bdb4aa9 100644 (file)
@@ -30,7 +30,7 @@ import org.openecomp.mso.client.dmaap.DmaapPublisher;
 import org.openecomp.mso.client.exceptions.SDNOException;
 import org.openecomp.mso.jsonpath.JsonPathUtil;
 
-public class SDNOValidatorImpl implements SDNOValidator, Consumer {
+public class SDNOValidatorImpl implements SDNOValidator {
 
        private final static String aafUserName = "something";
        private final static String clientName = "MSO";
@@ -51,103 +51,4 @@ public class SDNOValidatorImpl implements SDNOValidator, Consumer {
                //block and continue to poll waiting for response
        }
 
-       protected SDNO buildRequestDiagnostic(String vnfName, String uuid, String oamIp) {
-               
-               Input input = new Input();
-               SDNO parentRequest = new SDNO();
-               Body body = new Body();
-               parentRequest.setBody(body);
-               parentRequest.setNodeType("vPE");
-               parentRequest.setOperation("health-diagnostic");
-               
-               body.setInput(input);
-               
-               RequestHealthDiagnostic request = new RequestHealthDiagnostic();
-               request.setRequestClientName(clientName);
-               request.setRequestNodeName(vnfName);
-               request.setRequestNodeIp(oamIp); //generic-vnf oam ip
-               request.setRequestUserId(aafUserName); //mech id?
-               request.setRequestId(uuid); //something to identify this request by for polling
-               
-               input.setRequestHealthDiagnostic(request);
-               
-               return parentRequest;
-       }
-       protected void submitRequest(String json) throws FileNotFoundException, IOException, InterruptedException {
-               DmaapPublisher publisher = new DmaapPublisher(this.producerFilePath);
-               publisher.send(json);
-       }
-       protected boolean pollForResponse(DmaapConsumer consumer, String uuid) throws Exception {
-               this.uuid = uuid;
-               return consumer.consume(this);
-       }
-       
-       @Override
-       public boolean continuePolling() {
-               return continuePolling;
-       }
-       
-       @Override
-       public void stopProcessingMessages() {
-               continuePolling = false;
-       }
-       @Override
-       public void processMessage(String message) throws Exception {
-               if (isHealthDiagnostic(message, this.getRequestId())) {
-                       if (!healthDiagnosticSuccessful(message)) {
-                               Optional<String> statusMessage = this.getStatusMessage(message);
-                               if (statusMessage.isPresent()) {
-                                       throw new SDNOException(statusMessage.get());
-                               } else {
-                                       throw new SDNOException();
-                               }
-                       } else {
-                               stopProcessingMessages();
-                       }
-               }
-       }
-       
-       @Override
-       public boolean isAccepted(String message) {
-               if (isResultInfo(message)) {
-                       Optional<String> code = isAccepted(message, this.getRequestId());
-                       if (code.isPresent()) {
-                               if ("202".equals(code.get())) {
-                                       return true;
-                               } else {
-                                       //TODO check other statuses 400 and 500
-                               }
-                       } else {
-                               //TODO throw error
-                       }
-               }
-               
-               return false;
-       }
-       
-       @Override
-       public String getRequestId() {
-               return uuid;
-       }
-       
-       protected Optional<String> isAccepted(String json, String uuid) {
-               return JsonPathUtil.getInstance().locateResult(json, String.format("$.result-info[?(@.status=='ACCEPTED' && @.request-id=='%s')].code", uuid));
-       }
-       
-       protected boolean isResultInfo(String json) {
-               return JsonPathUtil.getInstance().pathExists(json, "$[?(@.result-info)]");
-       }
-       
-       protected boolean isHealthDiagnostic(String json, String uuid) {
-               return JsonPathUtil.getInstance().pathExists(json, String.format("$[?(@.result-info.request-id=='%s')].%s", uuid, healthDiagnosticPath));
-       }
-       
-       protected boolean healthDiagnosticSuccessful(String json) {
-               return JsonPathUtil.getInstance().pathExists(json, "$." + healthDiagnosticPath + "[?(@.response-status=='Success')]");
-       }
-       
-       protected Optional<String> getStatusMessage(String json) {
-               return JsonPathUtil.getInstance().locateResult(json, "$." + healthDiagnosticPath + ".response-details-json");
-       }
-       
 }
@@ -18,7 +18,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.mso.client.sdno;
+package org.openecomp.mso.client.sdno.beans;
 
 import java.io.Serializable;
 import java.util.HashMap;
@@ -41,7 +41,7 @@ public class Body implements Serializable
     @JsonProperty("input")
     private Input input;
     @JsonIgnore
-    private Map<String, Object> additionalProperties = new HashMap<>();
+    private Map<String, Object> additionalProperties = new HashMap<String, Object>();
     private final static long serialVersionUID = 9101706044452851559L;
 
     @JsonProperty("input")
@@ -18,7 +18,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.mso.client.sdno;
+package org.openecomp.mso.client.sdno.beans;
 
 import java.io.Serializable;
 import java.util.HashMap;
@@ -33,15 +33,17 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
 
 @JsonInclude(JsonInclude.Include.NON_NULL)
 @JsonPropertyOrder({
-    "request-healthdiagnostic"
+    "request-healthdiagnostic",
+    "request-hd-custom"
 })
 public class Input implements Serializable
 {
 
     @JsonProperty("request-healthdiagnostic")
     private RequestHealthDiagnostic RequestHealthDiagnostic;
+    
     @JsonIgnore
-    private Map<String, Object> additionalProperties = new HashMap<>();
+    private Map<String, Object> additionalProperties = new HashMap<String, Object>();
     private final static long serialVersionUID = 7155546785389227528L;
 
     @JsonProperty("request-healthdiagnostic")
@@ -18,7 +18,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.mso.client.sdno;
+package org.openecomp.mso.client.sdno.beans;
 
 import java.io.Serializable;
 import java.util.HashMap;
@@ -59,7 +59,7 @@ public class RequestHealthDiagnostic implements Serializable
     @JsonProperty("health-diagnostic-code")
     private String healthDiagnosticCode;
     @JsonIgnore
-    private Map<String, Object> additionalProperties = new HashMap<>();
+    private Map<String, Object> additionalProperties = new HashMap<String, Object>();
     private final static long serialVersionUID = 1166788526178388021L;
 
     @JsonProperty("request-client-name")
@@ -18,7 +18,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.mso.client.sdno;
+package org.openecomp.mso.client.sdno.beans;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -51,7 +51,7 @@ private String requestId;
 @JsonProperty("status")
 private String status;
 @JsonIgnore
-private Map<String, Object> additionalProperties = new HashMap<>();
+private Map<String, Object> additionalProperties = new HashMap<String, Object>();
 
 @JsonProperty("client-name")
 public String getClientName() {
@@ -18,7 +18,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.mso.client.sdno;
+package org.openecomp.mso.client.sdno.beans;
 
 import java.io.Serializable;
 import java.util.HashMap;
@@ -34,6 +34,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
 @JsonInclude(JsonInclude.Include.NON_NULL)
 @JsonPropertyOrder({
     "operation",
+    "nodeLoc",
     "nodeType",
     "body"
 })
@@ -42,12 +43,14 @@ public class SDNO implements Serializable
 
     @JsonProperty("operation")
     private String operation;
+    @JsonProperty("nodeLoc")
+    private String nodeLoc;
     @JsonProperty("nodeType")
     private String nodeType;
     @JsonProperty("body")
     private Body body;
     @JsonIgnore
-    private Map<String, Object> additionalProperties = new HashMap<>();
+    private Map<String, Object> additionalProperties = new HashMap<String, Object>();
     private final static long serialVersionUID = -5303297382564282650L;
 
     @JsonProperty("operation")
@@ -59,8 +62,23 @@ public class SDNO implements Serializable
     public void setOperation(String operation) {
         this.operation = operation;
     }
+    
+    @JsonProperty("nodeLoc")
+    public String getNodeLoc() {
+               return nodeLoc;
+       }
+    
+    @JsonProperty("nodeLoc")
+       public void setNodeLoc(String nodeLoc) {
+               this.nodeLoc = nodeLoc;
+       }
+    
+    public SDNO withNodeLoc(String nodeLoc) {
+       this.nodeLoc = nodeLoc;
+       return this;
+    }
 
-    public SDNO withOperation(String operation) {
+       public SDNO withOperation(String operation) {
         this.operation = operation;
         return this;
     }
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java
new file mode 100644 (file)
index 0000000..f23d882
--- /dev/null
@@ -0,0 +1,156 @@
+/*-
+ * ============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.client.sdno.dmaap;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Optional;
+
+import org.openecomp.mso.client.dmaap.DmaapConsumer;
+import org.openecomp.mso.client.exceptions.SDNOException;
+import org.openecomp.mso.jsonpath.JsonPathUtil;
+
+public class SDNOHealthCheckDmaapConsumer extends DmaapConsumer {
+
+       private final String uuid;
+       private boolean continuePolling = true;
+       private final static String healthDiagnosticPath = "body.output.*";
+
+       public SDNOHealthCheckDmaapConsumer() throws FileNotFoundException, IOException {
+               this("none");
+       }
+       
+       public SDNOHealthCheckDmaapConsumer(String uuid) throws FileNotFoundException, IOException {
+               super();
+               this.uuid = uuid;
+       }
+       
+       @Override
+       public String getUserName() {
+               return msoProperties.get("sdno.health-check.dmaap.username");
+       }
+
+       @Override
+       public String getPassword() {
+               return msoProperties.get("sdno.health-check.dmaap.password");
+       }
+
+       @Override
+       public String getTopic() {
+               return msoProperties.get("sdno.health-check.dmaap.subscriber.topic");
+       }
+
+       @Override
+       public boolean continuePolling() {
+               return continuePolling;
+       }
+       
+       @Override
+       public void stopProcessingMessages() {
+               continuePolling = false;
+       }
+       @Override
+       public void processMessage(String message) throws Exception {
+               if (isHealthDiagnostic(message, this.getRequestId())) {
+                       if (!healthDiagnosticSuccessful(message)) {
+                               Optional<String> statusMessage = this.getStatusMessage(message);
+                               if (statusMessage.isPresent()) {
+                                       throw new SDNOException("failed with message " + statusMessage.get());
+                               } else {
+                                       throw new SDNOException("failed with no status message");
+                               }
+                       } else {
+                               auditLogger.info("successful health diagnostic found for request: " + this.getRequestId());
+                               stopProcessingMessages();
+                       }
+               }
+       }
+       
+       @Override
+       public boolean isAccepted(String message) {
+               if (isResultInfo(message)) {
+                       Optional<String> code = isAccepted(message, this.getRequestId());
+                       if (code.isPresent()) {
+                               if ("202".equals(code.get())) {
+                                       return true;
+                               } else {
+                                       //TODO check other statuses 400 and 500
+                               }
+                       } else {
+                               //TODO throw error
+                       }
+               }
+               
+               return false;
+       }
+       
+       @Override
+       public boolean isFailure(String message) {
+               if (isResultInfo(message)) {
+                       Optional<String> code = isFailure(message, this.getRequestId());
+                       if (code.isPresent()) {
+                               if ("500".equals(code.get())) {
+                                       return true;
+                               } else {
+                                       //TODO check other statuses 400 and 500
+                               }
+                       } else {
+                               //TODO throw error
+                       }
+               }
+               
+               return false;
+       }
+       
+       @Override
+       public String getRequestId() {
+               return uuid;
+       }
+       
+       protected Optional<String> isAccepted(String json, String uuid) {
+               return JsonPathUtil.getInstance().locateResult(json, String.format("$.result-info[?(@.status=='ACCEPTED' && @.request-id=='%s')].code", uuid));
+       }
+       
+       protected Optional<String> isFailure(String json, String uuid) {
+               return JsonPathUtil.getInstance().locateResult(json, String.format("$.result-info[?(@.status=='FAILURE' && @.request-id=='%s')].code", uuid));
+       }
+       
+       protected boolean isResultInfo(String json) {
+               return JsonPathUtil.getInstance().pathExists(json, "$[?(@.result-info)]");
+       }
+       
+       protected boolean isHealthDiagnostic(String json, String uuid) {
+               return JsonPathUtil.getInstance().pathExists(json, String.format("$[?(@.result-info.request-id=='%s')].%s", uuid, healthDiagnosticPath));
+       }
+       
+       protected boolean healthDiagnosticSuccessful(String json) {
+               return JsonPathUtil.getInstance().pathExists(json, "$." + healthDiagnosticPath + "[?(@.response-status=='Success')]");
+       }
+       
+       protected Optional<String> getStatusMessage(String json) {
+               return JsonPathUtil.getInstance().locateResult(json, "$." + healthDiagnosticPath + ".error-message");
+       }
+       
+       @Override
+       public int getMaximumElapsedTime() {
+               return 300000;
+       }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java
new file mode 100644 (file)
index 0000000..73f06b8
--- /dev/null
@@ -0,0 +1,50 @@
+/*-
+ * ============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.client.sdno.dmaap;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import org.openecomp.mso.client.dmaap.DmaapPublisher;
+
+public class SDNOHealthCheckDmaapPublisher extends DmaapPublisher {
+       
+       public SDNOHealthCheckDmaapPublisher() throws FileNotFoundException, IOException {
+               super();
+       }
+       
+       @Override
+       public String getUserName() {
+               return msoProperties.get("sdno.health-check.dmaap.username");
+       }
+
+       @Override
+       public String getPassword() {
+               return msoProperties.get("sdno.health-check.dmaap.password");
+       }
+
+       @Override
+       public String getTopic() {
+               return msoProperties.get("sdno.health-check.dmaap.publisher.topic");
+       }
+       
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/policy/PolicyDecisionTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/policy/PolicyDecisionTest.java
deleted file mode 100644 (file)
index 8370f74..0000000
+++ /dev/null
@@ -1,70 +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.client.policy;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-import java.util.Map;
-
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class PolicyDecisionTest {
-       
-       @BeforeClass
-       public static void setUp() {
-               System.setProperty("mso.config.path", "src/test/resources");
-       }
-       @Test
-       public void successReadProperties() throws IOException, Exception {
-               PolicyRestClient client = new PolicyRestClient();
-               Map<String, String> headerMap = client.headerMap;
-               
-               assertEquals("Found expected Client Auth", headerMap.get("ClientAuth"), "Basic bTAzNzQzOnBvbGljeVIwY2sk");
-               assertEquals("Found expected Authorization", headerMap.get("Authorization"), "Basic dGVzdHBkcDphbHBoYTEyMw==");
-               assertEquals("Found expected Environment", headerMap.get("Environment"), "TEST");
-               assertEquals("Has X-ECOMP-RequestID", headerMap.containsKey("X-ECOMP-RequestID"), true);
-       }
-       
-       @Test
-       @Ignore // IGNORED FOR 1710 MERGE TO ONAP
-       public void restEndpointCall() throws IOException, Exception {
-               PolicyRestClient client = new PolicyRestClient();
-               PolicyDecision decision = client.getDecision("X", "Y", "BB1", "1", "123");
-               assertEquals("Decision is correct", decision.getDecision(), "PERMIT");
-               assertEquals("Decision details is correct", decision.getDetails(), "Abort");
-       }
-/*
-       @Test
-       public void failure() throws IOException, Exception {
-               when(dmaapConsumer.getMRConsumer()).thenReturn(mrConsumer);
-               when(mrConsumer.fetch())
-                               .thenReturn(Arrays.asList(new String[] { getJson("response.json"), getJson("output-failure.json") }));
-
-               SDNOValidatorImpl validator = new SDNOValidatorImpl();
-               thrown.expect(SDNOException.class);
-               thrown.expectMessage("my message");
-               boolean result = validator.pollForResponse(dmaapConsumer, "xyz123");
-
-       }*/
-}