Add subscriber docker image for client testing 31/63231/1
authorFiachra Corcoran <fiachra.corcoran@ericsson.com>
Mon, 27 Aug 2018 16:59:42 +0000 (17:59 +0100)
committerFiachra Corcoran <fiachra.corcoran@ericsson.com>
Tue, 28 Aug 2018 09:56:07 +0000 (10:56 +0100)
Issue-ID: DMAAP-662
Change-Id: I5f8f5a23e5116b2077689f704962e88dbeafb1b0
Signed-off-by: Fiachra Corcoran <fiachra.corcoran@ericsson.com>
26 files changed:
Subscriber/src/SSASubscriber.java [deleted file]
Subscriber/src/log4j.properties [deleted file]
datarouter-prov/pom.xml
datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DB.java
datarouter-subscriber/pom.xml [new file with mode: 0755]
datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/Subscriber.java [new file with mode: 0644]
datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/SubscriberServlet.java [moved from Subscriber/src/SubscriberServlet.java with 50% similarity]
datarouter-subscriber/src/main/resources/docker/Dockerfile [new file with mode: 0644]
datarouter-subscriber/src/main/resources/docker/startup.sh [new file with mode: 0644]
datarouter-subscriber/src/main/resources/log4j.properties [new file with mode: 0644]
datarouter-subscriber/src/main/resources/subscriber.properties [new file with mode: 0644]
docker-compose/database/sql_init_01.sql [moved from datarouter-prov/src/main/resources/docker-compose/database/sql_init_01.sql with 100% similarity]
docker-compose/docker-compose.yml [moved from datarouter-prov/src/main/resources/docker-compose/docker-compose.yml with 89% similarity]
docker-compose/node_data/node.properties [moved from datarouter-prov/src/main/resources/docker-compose/node_data/node.properties with 94% similarity]
docker-compose/node_data/self_signed/cacerts.jks [moved from datarouter-prov/src/main/resources/docker-compose/node_data/self_signed/cacerts.jks with 100% similarity]
docker-compose/node_data/self_signed/keystore.jks [moved from datarouter-prov/src/main/resources/docker-compose/node_data/self_signed/keystore.jks with 100% similarity]
docker-compose/node_data/self_signed/mykey.cer [moved from datarouter-prov/src/main/resources/docker-compose/node_data/self_signed/mykey.cer with 100% similarity]
docker-compose/node_data/self_signed/nodekey.cer [moved from datarouter-prov/src/main/resources/docker-compose/node_data/self_signed/nodekey.cer with 100% similarity]
docker-compose/prov_data/addFeed3.txt [moved from datarouter-prov/src/main/resources/docker-compose/prov_data/addFeed3.txt with 100% similarity]
docker-compose/prov_data/addSubscriber.txt [moved from datarouter-prov/src/main/resources/docker-compose/prov_data/addSubscriber.txt with 100% similarity]
docker-compose/prov_data/provserver.properties [moved from datarouter-prov/src/main/resources/docker-compose/prov_data/provserver.properties with 100% similarity]
docker-compose/prov_data/self_signed/cacerts.jks [moved from datarouter-prov/src/main/resources/docker-compose/prov_data/self_signed/cacerts.jks with 100% similarity]
docker-compose/prov_data/self_signed/keystore.jks [moved from datarouter-prov/src/main/resources/docker-compose/prov_data/self_signed/keystore.jks with 100% similarity]
docker-compose/prov_data/self_signed/mykey.cer [moved from datarouter-prov/src/main/resources/docker-compose/prov_data/self_signed/mykey.cer with 100% similarity]
docker-compose/subscriber_data/subscriber.properties [new file with mode: 0644]
pom.xml

diff --git a/Subscriber/src/SSASubscriber.java b/Subscriber/src/SSASubscriber.java
deleted file mode 100644 (file)
index 5ec099b..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START==================================================
- * * org.onap.dmaap
- * * ===========================================================================
- * * Copyright © 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====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
-
-
-import org.eclipse.jetty.http.HttpVersion;
-import org.eclipse.jetty.servlet.*;
-import org.eclipse.jetty.util.ssl.*;
-import org.eclipse.jetty.server.*;
-import org.apache.log4j.Logger;
-
-/**
- *     Example stand alone subscriber
- */
-public class SSASubscriber {
-       private static final int Port = 8447;
-       private static final String KeyStoreType = "jks";
-       private static final String KeyStoreFile = "/root/sub/subscriber.jks";
-       //private static final String KeyStoreFile = "c:/tmp/subscriber.jks";
-       private static final String KeyStorePassword = "changeit";
-       private static final String KeyPassword = "changeit";
-       private static final String ContextPath = "/";
-       private static final String URLPattern = "/*";
-
-       public static void main(String[] args) throws Exception {
-               //User story # US792630  -Jetty Upgrade to 9.3.11
-               //SSASubscriber register Jetty server.
-        Server server = new Server();
-        HttpConfiguration http_config = new HttpConfiguration();
-        http_config.setSecureScheme("https");
-        http_config.setSecurePort(Port);
-        http_config.setRequestHeaderSize(8192);
-               
-        // HTTP connector
-        ServerConnector http = new ServerConnector(server,
-                new HttpConnectionFactory(http_config));
-        http.setPort(7070);
-        http.setIdleTimeout(30000);
-        
-        // SSL Context Factory
-        SslContextFactory sslContextFactory = new SslContextFactory();
-        sslContextFactory.setKeyStoreType(KeyStoreType);
-        sslContextFactory.setKeyStorePath(KeyStoreFile);
-        sslContextFactory.setKeyStorePassword(KeyStorePassword);
-        sslContextFactory.setKeyManagerPassword(KeyPassword);
-        
-        // sslContextFactory.setTrustStorePath(ncm.getKSFile());
-        // sslContextFactory.setTrustStorePassword("changeit");
-        sslContextFactory.setExcludeCipherSuites("SSL_RSA_WITH_DES_CBC_SHA",
-                "SSL_DHE_RSA_WITH_DES_CBC_SHA", "SSL_DHE_DSS_WITH_DES_CBC_SHA",
-                "SSL_RSA_EXPORT_WITH_RC4_40_MD5",
-                "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA",
-                "SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA",
-                "SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA");
-
-        // SSL HTTP Configuration
-        HttpConfiguration https_config = new HttpConfiguration(http_config);
-        https_config.addCustomizer(new SecureRequestCustomizer());
-
-        // SSL Connector
-        ServerConnector sslConnector = new ServerConnector(server,
-            new SslConnectionFactory(sslContextFactory,HttpVersion.HTTP_1_1.asString()),
-            new HttpConnectionFactory(https_config));
-        sslConnector.setPort(Port);
-        server.addConnector(sslConnector);
-        
-       /**Skip SSLv3 Fixes*/
-        sslContextFactory.addExcludeProtocols("SSLv3");
-        System.out.println("Excluded protocols SSASubscriber-"+sslContextFactory.getExcludeProtocols().toString());  
-               /**End of SSLv3 Fixes*/
-        
-        // HTTPS Configuration
-        ServerConnector https = new ServerConnector(server,
-            new SslConnectionFactory(sslContextFactory,HttpVersion.HTTP_1_1.asString()),
-                new HttpConnectionFactory(https_config));
-        https.setPort(Port);
-        https.setIdleTimeout(30000);
-        //server.setConnectors(new Connector[] { http, https });
-        server.setConnectors(new Connector[] {  http });
-               ServletContextHandler ctxt = new ServletContextHandler(0);
-               ctxt.setContextPath(ContextPath);
-               server.setHandler(ctxt);
-               
-               ctxt.addServlet(new ServletHolder(new SubscriberServlet()), "/*");
-               
-               try { 
-                   server.start();
-               } catch ( Exception e ) { 
-                       System.out.println("Jetty failed to start. Reporting will we unavailable-"+e);
-               };
-        server.join();
-        
-        System.out.println("Subscriber started-"+ server.getState());  
-
-       }
-}
\ No newline at end of file
diff --git a/Subscriber/src/log4j.properties b/Subscriber/src/log4j.properties
deleted file mode 100644 (file)
index 8c12d5c..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-log4j.debug=FALSE\r
-log4j.rootLogger=INFO,Root\r
-\r
-log4j.appender.Root=org.apache.log4j.DailyRollingFileAppender\r
-log4j.appender.Root.file=/opt/app/datartr/logs/subscriber.log\r
-log4j.appender.Root.datePattern='.'yyyyMMdd\r
-log4j.appender.Root.append=true\r
-log4j.appender.Root.layout=org.apache.log4j.PatternLayout\r
-log4j.appender.Root.layout.ConversionPattern=%d %p %t %m%n\r
index b3c2878..a970f71 100755 (executable)
                 <directory>src/main/resources</directory>\r
                 <filtering>true</filtering>\r
                 <includes>\r
-                    <include>**/proserver.properties</include>\r
+                    <include>**/provserver.properties</include>\r
                 </includes>\r
             </resource>\r
             <resource>\r
index a907a03..bbcacb5 100644 (file)
@@ -38,14 +38,12 @@ import java.util.*;
  */\r
 public class DB {\r
 \r
-    /**\r
-     * The name of the properties file (in CLASSPATH)\r
-     */\r
+    private static Logger intlogger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal");\r
+\r
     private static String DB_URL;\r
     private static String DB_LOGIN;\r
     private static String DB_PASSWORD;\r
     private static Properties props;\r
-    private static Logger intlogger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal");\r
     private static final Queue<Connection> queue = new LinkedList<>();\r
 \r
     public static String HTTPS_PORT;\r
diff --git a/datarouter-subscriber/pom.xml b/datarouter-subscriber/pom.xml
new file mode 100755 (executable)
index 0000000..52cb25c
--- /dev/null
@@ -0,0 +1,393 @@
+<!--
+  ============LICENSE_START==================================================
+  * org.onap.dmaap
+  * ===========================================================================
+  * Copyright © 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====================================================
+  *
+  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+  *
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.onap.dmaap.datarouter</groupId>
+        <artifactId>parent</artifactId>
+        <version>1.0.1-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <artifactId>datarouter-subscriber</artifactId>
+    <packaging>jar</packaging>
+    <name>datarouter-subscriber</name>
+    <properties>
+        <sonar.language>java</sonar.language>
+        <sonar.skip>false</sonar.skip>
+        <sonar.jacoco.reportMissing.force.zero>true</sonar.jacoco.reportMissing.force.zero>
+        <sitePath>/content/sites/site/${project.groupId}/${project.artifactId}/${project.version}</sitePath>
+
+        <docker.location>${basedir}/target/${artifactId}</docker.location>
+        <datarouter.prov.image.name>onap/dmaap/datarouter-subscriber</datarouter.prov.image.name>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-server</artifactId>
+            <version>${jetty.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-continuation</artifactId>
+            <version>${jetty.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-util</artifactId>
+            <version>${jetty.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-deploy</artifactId>
+            <version>${jetty.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-servlet</artifactId>
+            <version>${jetty.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-servlets</artifactId>
+            <version>${jetty.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-http</artifactId>
+            <version>${jetty.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-security</artifactId>
+            <version>${jetty.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-websocket</artifactId>
+            <version>${jetty.websocket.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-io</artifactId>
+            <version>${jetty.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>4.5.3</version>
+        </dependency>
+        <dependency>
+            <groupId>org.sonatype.http-testing-harness</groupId>
+            <artifactId>junit-runner</artifactId>
+            <version>0.11</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.databene</groupId>
+                    <artifactId>contiperf</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.10</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <version>1.2.17</version>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
+    <profiles>
+        <profile>
+            <id>docker</id>
+            <properties>
+                <skipDockerBuild>false</skipDockerBuild>
+                <skipDockerTag>false</skipDockerTag>
+                <skipTests>true</skipTests>
+            </properties>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>com.spotify</groupId>
+                        <artifactId>docker-maven-plugin</artifactId>
+                        <version>1.0.0</version>
+                        <configuration>
+                            <imageName>${onap.nexus.dockerregistry.daily}/${datarouter.prov.image.name}</imageName>
+                            <dockerDirectory>${docker.location}</dockerDirectory>
+                            <serverId>${onap.nexus.dockerregistry.daily}</serverId>
+                            <skipDockerBuild>false</skipDockerBuild>
+                            <imageTags>
+                                <imageTag>${project.version}</imageTag>
+                                <imageTag>latest</imageTag>
+                            </imageTags>
+                            <forceTags>true</forceTags>
+                            <resources>
+                                <resource>
+                                    <targetPath>/</targetPath>
+                                    <directory>${project.basedir}</directory>
+                                    <excludes>
+                                        <exclude>target/**/*</exclude>
+                                        <exclude>pom.xml</exclude>
+                                    </excludes>
+                                </resource>
+
+                                <resource>
+                                    <targetPath>/</targetPath>
+                                    <directory>${project.build.directory}</directory>
+                                    <include>**/**</include>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+    <build>
+        <finalName>datarouter-subscriber</finalName>
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <filtering>true</filtering>
+                <includes>
+                    <include>**/*.properties</include>
+                </includes>
+            </resource>
+            <resource>
+                <directory>src/main/resources</directory>
+                <filtering>true</filtering>
+                <includes>
+                    <include>**/subscriber.properties</include>
+                </includes>
+            </resource>
+            <resource>
+                <directory>src/main/resources</directory>
+                <filtering>true</filtering>
+                <includes>
+                    <include>**/log4j.properties</include>
+                </includes>
+            </resource>
+            <resource>
+                <directory>src/test/resources</directory>
+                <filtering>true</filtering>
+                <includes>
+                    <include>**/log4j.properties</include>
+                </includes>
+            </resource>
+        </resources>
+        <plugins>
+            <plugin>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <version>2.4</version>
+                <configuration>
+                    <descriptorRefs>
+                        <descriptorRef>jar-with-dependencies</descriptorRef>
+                    </descriptorRefs>
+                    <outputDirectory>${basedir}/target/opt/app/subscriber/lib</outputDirectory>
+                    <archive>
+                        <manifest>
+                            <addClasspath>true</addClasspath>
+                            <mainClass>org.onap.dmaap.datarouter.subscriber.Subscriber</mainClass>
+                        </manifest>
+                    </archive>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>make-assembly</id>
+                        <!-- this is used for inheritance merges -->
+                        <phase>package</phase>
+                        <!-- bind to the packaging phase -->
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.8</source>
+                    <target>1.8</target>
+                </configuration>
+                <version>3.6.0</version>
+            </plugin>
+            <plugin>
+                <artifactId>maven-resources-plugin</artifactId>
+                <version>2.7</version>
+                <executions>
+                    <execution>
+                        <id>copy-docker-file</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>${docker.location}</outputDirectory>
+                            <overwrite>true</overwrite>
+                            <resources>
+                                <resource>
+                                    <directory>${basedir}/src/main/resources/docker</directory>
+                                    <filtering>true</filtering>
+                                    <includes>
+                                        <include>**/*</include>
+                                    </includes>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>copy-resources-1</id>
+                        <phase>validate</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>${basedir}/target/opt/app/subscriber/lib</outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>${project.basedir}/src/main/resources</directory>
+                                    <includes>
+                                        <include>**/*.jar</include>
+                                    </includes>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>copy-resources-2</id>
+                        <phase>validate</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>${basedir}/target/opt/app/subscriber/etc</outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>${basedir}/src/main/resources</directory>
+                                    <includes>
+                                        <include>*.properties</include>
+                                    </includes>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <version>2.10</version>
+                <executions>
+                    <execution>
+                        <id>copy-dependencies</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>copy-dependencies</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>${project.build.directory}/opt/app/subscriber/lib</outputDirectory>
+                            <overWriteReleases>false</overWriteReleases>
+                            <overWriteSnapshots>false</overWriteSnapshots>
+                            <overWriteIfNewer>true</overWriteIfNewer>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-source-plugin</artifactId>
+                <version>2.2.1</version>
+                <executions>
+                    <execution>
+                        <id>attach-sources</id>
+                        <goals>
+                            <goal>jar-no-fork</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.jacoco</groupId>
+                <artifactId>jacoco-maven-plugin</artifactId>
+                <version>${jacoco.version}</version>
+                <configuration>
+                    <excludes>
+                        <exclude>**/gen/**</exclude>
+                        <exclude>**/generated-sources/**</exclude>
+                        <exclude>**/yang-gen/**</exclude>
+                        <exclude>**/pax/**</exclude>
+                    </excludes>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>pre-unit-test</id>
+                        <goals>
+                            <goal>prepare-agent</goal>
+                        </goals>
+                        <configuration>
+                            <destFile>${project.build.directory}/code-coverage/jacoco-ut.exec</destFile>
+                            <propertyName>surefireArgLine</propertyName>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>post-unit-test</id>
+                        <phase>test</phase>
+                        <goals>
+                            <goal>report</goal>
+                        </goals>
+                        <configuration>
+                            <dataFile>${project.build.directory}/code-coverage/jacoco-ut.exec</dataFile>
+                            <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>pre-integration-test</id>
+                        <phase>pre-integration-test</phase>
+                        <goals>
+                            <goal>prepare-agent</goal>
+                        </goals>
+                        <configuration>
+                            <destFile>${project.build.directory}/code-coverage/jacoco-it.exec</destFile>
+                            <propertyName>failsafeArgLine</propertyName>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>post-integration-test</id>
+                        <phase>post-integration-test</phase>
+                        <goals>
+                            <goal>report</goal>
+                        </goals>
+                        <configuration>
+                            <dataFile>${project.build.directory}/code-coverage/jacoco-it.exec</dataFile>
+                            <outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/Subscriber.java b/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/Subscriber.java
new file mode 100644 (file)
index 0000000..b6edb67
--- /dev/null
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * ============LICENSE_START==================================================
+ * * org.onap.dmaap
+ * * ===========================================================================
+ * * Copyright © 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====================================================
+ * *
+ * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * *
+ ******************************************************************************/
+
+package org.onap.dmaap.datarouter.subscriber;
+
+import org.apache.log4j.Logger;
+import org.eclipse.jetty.servlet.*;
+import org.eclipse.jetty.util.ssl.*;
+import org.eclipse.jetty.server.*;
+import org.eclipse.jetty.http.HttpVersion;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Properties;
+
+public class Subscriber {
+
+    private static Logger logger = Logger.getLogger("org.onap.dmaap.datarouter.subscriber.Subscriber");
+
+    private static final String CONTEXT_PATH = "/";
+    private static final String URL_PATTERN = "/*";
+
+    static Properties props;
+
+    private static void loadProps() {
+        if (props == null) {
+            props = new Properties();
+            try {
+                props.load(new FileInputStream(System.getProperty(
+                        "org.onap.dmaap.datarouter.subscriber.properties",
+                        "/opt/app/subscriber/etc/subscriber.properties")));
+            } catch (IOException e) {
+                logger.fatal("SubServlet: Exception opening properties: " + e.getMessage());
+                System.exit(1);
+            }
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        //Load the properties
+        loadProps();
+
+        int httpsPort = Integer.parseInt(props.getProperty("org.onap.dmaap.datarouter.subscriber.https.port", "8443"));
+        int httpPort = Integer.parseInt(props.getProperty("org.onap.dmaap.datarouter.subscriber.http.port", "8080"));
+
+        Server server = new Server();
+        HttpConfiguration httpConfig = new HttpConfiguration();
+        httpConfig.setRequestHeaderSize(8192);
+
+        // HTTP connector
+        ServletContextHandler ctxt;
+        try (ServerConnector httpServerConnector = new ServerConnector(server,
+                new HttpConnectionFactory(httpConfig))) {
+            httpServerConnector.setPort(httpPort);
+            httpServerConnector.setIdleTimeout(30000);
+
+            // SSL Context Factory
+            SslContextFactory sslContextFactory = new SslContextFactory();
+
+            // SSL HTTP Configuration
+            HttpConfiguration httpsConfig = new HttpConfiguration(httpConfig);
+            httpsConfig.addCustomizer(new SecureRequestCustomizer());
+
+            // SSL Connector
+            ServerConnector sslConnector = new ServerConnector(server,
+                    new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()),
+                    new HttpConnectionFactory(httpsConfig));
+            sslConnector.setPort(httpsPort);
+            server.addConnector(sslConnector);
+
+            /*Skip SSLv3 Fixes*/
+            sslContextFactory.addExcludeProtocols("SSLv3");
+            logger.info("Excluded protocols for Subscriber:" + Arrays.toString(sslContextFactory.getExcludeProtocols()));
+            /*End of SSLv3 Fixes*/
+
+            // HTTPS Configuration
+            try (ServerConnector https = new ServerConnector(server,
+                    new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()),
+                    new HttpConnectionFactory(httpsConfig))) {
+                https.setPort(httpsPort);
+                https.setIdleTimeout(30000);
+            }
+            server.setConnectors(new Connector[]{ httpServerConnector });
+        }
+        ctxt = new ServletContextHandler(0);
+        ctxt.setContextPath(CONTEXT_PATH);
+        server.setHandler(ctxt);
+
+        ctxt.addServlet(new ServletHolder(new SubscriberServlet()), URL_PATTERN);
+        try {
+            server.start();
+        } catch ( Exception e ) {
+            logger.info("Jetty failed to start. Reporting will be unavailable-"+e);
+        }
+        server.join();
+        logger.info("org.onap.dmaap.datarouter.subscriber.Subscriber started-"+ server.getState());
+
+    }
+}
\ No newline at end of file
@@ -7,9 +7,9 @@
  * * Licensed under the Apache License, Version 2.0 (the "License");
  * * you may not use this file except in compliance with the License.
  * * You may obtain a copy of the License at
- * * 
+ * *
  *  *      http://www.apache.org/licenses/LICENSE-2.0
- * * 
+ * *
  *  * Unless required by applicable law or agreed to in writing, software
  * * distributed under the License is distributed on an "AS IS" BASIS,
  * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * *
  ******************************************************************************/
 
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URLEncoder;
+package org.onap.dmaap.datarouter.subscriber;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.log4j.Logger;
 
 import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.net.URLEncoder;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.nio.file.attribute.PosixFilePermissions;
 
-import org.apache.commons.codec.binary.Base64;
-import org.apache.log4j.Logger;
+import static org.onap.dmaap.datarouter.subscriber.Subscriber.props;
 
-/**
- *     Example stand alone subscriber servlet with Authorization header checking
- */
-public class SubscriberServlet extends HttpServlet     {
-       private static Logger logger = Logger.getLogger("com.att.datarouter.pubsub.ssasubscribe.SubscriberServlet");
-       private String Login = "LOGIN";
-       private String Password = "PASSWORD";
-       private String OutputDirectory = "/root/sub/received";
+public class SubscriberServlet extends HttpServlet {
 
-       private String auth;
+       private static Logger logger = Logger.getLogger("org.onap.dmaap.datarouter.subscriber.SubscriberServlet");
+       private String outputDirectory;
+       private String basicAuth;
 
-       private static String gp(ServletConfig config, String param, String deflt) {
-               param = config.getInitParameter(param);
-               if (param == null || param.length() == 0) {
-                       param = deflt;
-               }
-               return(param);
-       }
        /**
         *      Configure this subscriberservlet.  Configuration parameters from config.getInitParameter() are:
         *      <ul>
         *      <li>Login - The login expected in the Authorization header (default "LOGIN").
         *      <li>Password - The password expected in the Authorization header (default "PASSWORD").
-        *      <li>OutputDirectory - The directory where files are placed (default "received").
+        *      <li>outputDirectory - The directory where files are placed (default "tmp").
         *      </ul>
         */
-       public void init(ServletConfig config) throws ServletException {
-               Login = gp(config, "Login", Login);
-               Password = gp(config, "Password", Password);
-               OutputDirectory = gp(config, "OutputDirectory", OutputDirectory);
-               (new File(OutputDirectory)).mkdirs();
-               auth = "Basic " + Base64.encodeBase64String((Login + ":" + Password).getBytes());
+       @Override
+    public void init(ServletConfig config) {
+        String login = props.getProperty("org.onap.dmaap.datarouter.subscriber.auth.user", "LOGIN");
+               String password = props.getProperty("org.onap.dmaap.datarouter.subscriber.auth.password", "PASSWORD");
+        outputDirectory = props.getProperty("org.onap.dmaap.datarouter.subscriber.delivery.dir", "/tmp");
+        try {
+            Files.createDirectory(Paths.get(outputDirectory), PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("rwxrwxrwx")));
+        } catch (IOException e) {
+            logger.info("SubServlet: Failed to create delivery dir: " + e.getMessage());
+            e.printStackTrace();
+        }
+               basicAuth = "Basic " + Base64.encodeBase64String((login + ":" + password).getBytes());
+       }
+
+       @Override
+       protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+               File filesPath = new File(outputDirectory);
+               File[] filesArr = filesPath.listFiles();
+        assert filesArr != null;
+        for (File file: filesArr) {
+            try (BufferedReader in = new BufferedReader(new FileReader(file))) {
+                String line = in.readLine();
+                while (line != null) {
+                    line = in.readLine();
+                }
+            }
+               }
        }
        /**
         *      Invoke common(req, resp, false).
         */
-       protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
-               common(req, resp, false);
-       }
+       @Override
+       protected void doPut(HttpServletRequest req, HttpServletResponse resp) {
+        try {
+            common(req, resp, false);
+        } catch (IOException e) {
+            logger.info("SubServlet: Failed to doPut: " + req.getRemoteAddr() + " : " + req.getPathInfo(), e);
+        }
+    }
        /**
         *      Invoke common(req, resp, true).
         */
-       protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
-               common(req, resp, true);
-       }
+       @Override
+       protected void doDelete(HttpServletRequest req, HttpServletResponse resp) {
+        try {
+            common(req, resp, true);
+        } catch (IOException e) {
+            logger.info("SubServlet: Failed to doDelete: " + req.getRemoteAddr() + " : " + req.getPathInfo(), e);
+        }
+    }
        /**
         *      Process a PUT or DELETE request.
         *      <ol>
@@ -90,59 +111,57 @@ public class SubscriberServlet extends HttpServlet {
         *      <li>Verify that the Authorization header matches the configured
         *      Login and Password or else FORBIDDEN.
         *      <li>If the request is PUT, store the message body as a file
-        *      in the configured OutputDirectory directory protecting against
+        *      in the configured outputDirectory directory protecting against
         *      evil characters in the received FileID.  The file is created
         *      initially with its name prefixed with a ".", and once it is complete, it is
         *      renamed to remove the leading "." character.
-        *      <li>If the request is DELETE, instead delete the file (if it exists) from the configured OutputDirectory directory.
+        *      <li>If the request is DELETE, instead delete the file (if it exists) from the configured outputDirectory directory.
         *      <li>Respond with NO_CONTENT.
         *      </ol>
         */
-       protected void common(HttpServletRequest req, HttpServletResponse resp, boolean isdelete) throws ServletException, IOException {
-               String ah = req.getHeader("Authorization");
-               if (ah == null) {
+    private void common(HttpServletRequest req, HttpServletResponse resp, boolean isdelete) throws IOException {
+               String authHeader = req.getHeader("Authorization");
+               if (authHeader == null) {
                        logger.info("Rejecting request with no Authorization header from " + req.getRemoteAddr() + ": " + req.getPathInfo());
                        resp.sendError(HttpServletResponse.SC_UNAUTHORIZED);
                        return;
                }
-               if (!auth.equals(ah)) {
+               if (!basicAuth.equals(authHeader)) {
                        logger.info("Rejecting request with incorrect Authorization header from " + req.getRemoteAddr() + ": " + req.getPathInfo());
                        resp.sendError(HttpServletResponse.SC_FORBIDDEN);
                        return;
                }
                String fileid = req.getPathInfo();
                fileid = fileid.substring(fileid.lastIndexOf('/') + 1);
-               String qs = req.getQueryString();
-               if (qs != null) {
-                       fileid = fileid + "?" + qs;
+               String queryString = req.getQueryString();
+               if (queryString != null) {
+                       fileid = fileid + "?" + queryString;
                }
                String publishid = req.getHeader("X-ATT-DR-PUBLISH-ID");
                String filename = URLEncoder.encode(fileid, "UTF-8").replaceAll("^\\.", "%2E").replaceAll("\\*", "%2A");
-               String finalname = OutputDirectory + "/" + filename;
-               String tmpname = OutputDirectory + "/." + filename;
+               String fullPath = outputDirectory + "/" + filename;
+               String tmpPath = outputDirectory + "/." + filename;
                try {
                        if (isdelete) {
-                               (new File(finalname)).delete();
-                               logger.info("Received delete for file id " + fileid + " from " + req.getRemoteAddr() + " publish id " + publishid + " as " + finalname);
+                           Files.deleteIfExists(Paths.get(fullPath));
+                               logger.info("Received delete for file id " + fileid + " from " + req.getRemoteAddr() + " publish id " + publishid + " as " + fullPath);
                        } else {
-                               InputStream is = req.getInputStream();
-                               OutputStream os = new FileOutputStream(tmpname);
-                               byte[] buf = new byte[65536];
-                               int i;
-                               while ((i = is.read(buf)) > 0) {
-                                       os.write(buf, 0, i);
-                               }
-                               is.close();
-                               os.close();
-                               (new File(tmpname)).renameTo(new File(finalname));
-                               logger.info("Received file id " + fileid + " from " + req.getRemoteAddr() + " publish id " + publishid + " as " + finalname);
+                new File(tmpPath).createNewFile();
+                try (InputStream is = req.getInputStream(); OutputStream os = new FileOutputStream(tmpPath)) {
+                    byte[] buf = new byte[65536];
+                    int i;
+                    while ((i = is.read(buf)) > 0) {
+                        os.write(buf, 0, i);
+                    }
+                }
+                Files.move(Paths.get(tmpPath), Paths.get(fullPath), StandardCopyOption.REPLACE_EXISTING);
+                               logger.info("Received file id " + fileid + " from " + req.getRemoteAddr() + " publish id " + publishid + " as " + fullPath);
                                resp.setStatus(HttpServletResponse.SC_NO_CONTENT);
-                               logger.info("Received file id " + fileid + " from " + req.getRemoteAddr() + " publish id " + publishid + " as " + finalname);
                        }
                        resp.setStatus(HttpServletResponse.SC_NO_CONTENT);
                } catch (IOException ioe) {
-                       (new File(tmpname)).delete();
-                       logger.info("Failure to save file " + finalname + " from " + req.getRemoteAddr() + ": " + req.getPathInfo(), ioe);
+            Files.deleteIfExists(Paths.get(tmpPath));
+                       logger.info("Failed to process file " + fullPath + " from " + req.getRemoteAddr() + ": " + req.getPathInfo());
                        throw ioe;
                }
        }
diff --git a/datarouter-subscriber/src/main/resources/docker/Dockerfile b/datarouter-subscriber/src/main/resources/docker/Dockerfile
new file mode 100644 (file)
index 0000000..6cc74cc
--- /dev/null
@@ -0,0 +1,6 @@
+FROM java:8
+ADD opt /opt/
+ADD startup.sh /startup.sh
+RUN chmod 700 /startup.sh
+ENTRYPOINT ./startup.sh start
+EXPOSE 7070
\ No newline at end of file
diff --git a/datarouter-subscriber/src/main/resources/docker/startup.sh b/datarouter-subscriber/src/main/resources/docker/startup.sh
new file mode 100644 (file)
index 0000000..53b1053
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/bash
+LIB=/opt/app/subscriber/lib
+ETC=/opt/app/subscriber/etc
+CLASSPATH=$ETC
+for FILE in `find $LIB -name *.jar`; do
+  CLASSPATH=$CLASSPATH:$FILE
+done
+java -classpath $CLASSPATH  org.onap.dmaap.datarouter.subscriber.Subscriber
+
+runner_file="$LIB/subscriber-jar-with-dependencies.jar"
+echo "Starting using" $runner_file
+java -Dorg.onap.dmaap.datarouter.subscriber.properties=/opt/app/subscriber/etc/subscriber.properties -jar $runner_file
\ No newline at end of file
diff --git a/datarouter-subscriber/src/main/resources/log4j.properties b/datarouter-subscriber/src/main/resources/log4j.properties
new file mode 100644 (file)
index 0000000..bb66ef4
--- /dev/null
@@ -0,0 +1,31 @@
+#-------------------------------------------------------------------------------
+# ============LICENSE_START==================================================
+# * org.onap.dmaap
+# * ===========================================================================
+# * Copyright � 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====================================================
+# *
+# * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+# *
+#-------------------------------------------------------------------------------
+
+log4j.rootLogger=info,Root
+
+log4j.appender.Root=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.Root.file=/opt/app/subscriber/logs/subscriber.log
+log4j.appender.Root.datePattern='.'yyyyMMdd
+log4j.appender.Root.append=true
+log4j.appender.Root.layout=org.apache.log4j.PatternLayout
+log4j.appender.Root.layout.ConversionPattern=%d %p %t %m%n
diff --git a/datarouter-subscriber/src/main/resources/subscriber.properties b/datarouter-subscriber/src/main/resources/subscriber.properties
new file mode 100644 (file)
index 0000000..771fdd3
--- /dev/null
@@ -0,0 +1,40 @@
+#-------------------------------------------------------------------------------
+# ============LICENSE_START==================================================
+# * org.onap.dmaap
+# * ===========================================================================
+# * Copyright � 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====================================================
+# *
+# * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+# *
+#-------------------------------------------------------------------------------
+
+#Subscriber properties
+org.onap.dmaap.datarouter.subscriber.http.port           = 7070
+org.onap.dmaap.datarouter.subscriber.https.port          = 7443
+org.onap.dmaap.datarouter.subscriber.auth.user           = LOGIN
+org.onap.dmaap.datarouter.subscriber.auth.password       = PASSWORD
+org.onap.dmaap.datarouter.subscriber.delivery.dir        = /opt/app/subscriber/delivery
+
+org.onap.dmaap.datarouter.subscriber.https.relaxation    = true
+org.onap.dmaap.datarouter.subscriber.keystore.type       = jks
+org.onap.dmaap.datarouter.subscriber.keymanager.password = changeit
+org.onap.dmaap.datarouter.subscriber.keystore.path       = /opt/app/datartr/self_signed/keystore.jks
+org.onap.dmaap.datarouter.subscriber.keystore.password   = changeit
+org.onap.dmaap.datarouter.subscriber.truststore.path     = /opt/app/datartr/self_signed/cacerts.jks
+org.onap.dmaap.datarouter.subscriber.truststore.password = changeit
+
+
+
-#-------------------------------------------------------------------------------\r
-# ============LICENSE_START==================================================\r
-# * org.onap.dmaap\r
-# * ===========================================================================\r
-# * Copyright © 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
-# * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
-# *\r
-#-------------------------------------------------------------------------------\r
-version: '2.1'\r
-services:\r
-  datarouter-prov:\r
-    image: nexus3.onap.org:10003/onap/dmaap/datarouter-prov\r
-    container_name: datarouter-prov\r
-    hostname: prov.datarouternew.com\r
-    ports:\r
-     - "8443:8443"\r
-     - "8080:8080"  \r
-    volumes:\r
-     - ./prov_data/provserver.properties:/opt/app/datartr/etc/provserver.properties\r
-     - ./prov_data/addSubscriber.txt:/opt/app/datartr/addSubscriber.txt\r
-     - ./prov_data/addFeed3.txt:/opt/app/datartr/addFeed3.txt\r
-    depends_on:\r
-      mariadb_container:\r
-        condition: service_healthy\r
-    healthcheck:\r
-      test: ["CMD", "curl", "-f", "http://prov.datarouternew.com:8080/internal/prov"]\r
-      interval: 10s\r
-      timeout: 10s\r
-      retries: 5\r
-    extra_hosts:\r
-      - "node.datarouternew.com:172.100.0.4"\r
-    networks:\r
-      testing_net:\r
-        ipv4_address: 172.100.0.3\r
-\r
-  datarouter-node:\r
-    image: nexus3.onap.org:10003/onap/dmaap/datarouter-node\r
-    container_name: datarouter-node\r
-    hostname: node.datarouternew.com\r
-    ports:\r
-     - "9443:8443"\r
-     - "9090:8080"\r
-    volumes:\r
-     - ./node_data/node.properties:/opt/app/datartr/etc/node.properties\r
-    depends_on:\r
-      datarouter-prov:\r
-        condition: service_healthy\r
-    extra_hosts:\r
-      - "prov.datarouternew.com:172.100.0.3"\r
-    networks:\r
-      testing_net:\r
-        ipv4_address: 172.100.0.4\r
-      \r
-  mariadb_container:\r
-    image: mariadb:10.2.14\r
-    container_name: mariadb\r
-    ports:\r
-      - "3306:3306"\r
-#    volumes:\r
-#     - ./database/sql_init_01.sql:/docker-entrypoint-initdb.d/sql_init_01.sql\r
-    environment:\r
-      MYSQL_ROOT_PASSWORD: datarouter\r
-      MYSQL_DATABASE: datarouter\r
-      MYSQL_USER: datarouter\r
-      MYSQL_PASSWORD: datarouter\r
-    healthcheck:\r
-      test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost", "--silent"]\r
-      interval: 10s\r
-      timeout: 30s\r
-      retries: 5\r
-\r
-    networks:\r
-      testing_net:\r
-        ipv4_address: 172.100.0.2\r
-\r
-networks:\r
-  testing_net:\r
-    driver: bridge\r
-    ipam:\r
-      driver: default\r
-      config:\r
-        - subnet: 172.100.0.0/16\r
+#-------------------------------------------------------------------------------
+# ============LICENSE_START==================================================
+# * org.onap.dmaap
+# * ===========================================================================
+# * Copyright © 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====================================================
+# *
+# * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+# *
+#-------------------------------------------------------------------------------
+version: '2.1'
+services:
+  datarouter-prov:
+    image: nexus3.onap.org:10003/onap/dmaap/datarouter-prov
+    container_name: datarouter-prov
+    hostname: prov.datarouternew.com
+    ports:
+     - "8443:8443"
+     - "8080:8080"  
+    volumes:
+     - ./prov_data/provserver.properties:/opt/app/datartr/etc/provserver.properties
+     - ./prov_data/addSubscriber.txt:/opt/app/datartr/addSubscriber.txt
+     - ./prov_data/addFeed3.txt:/opt/app/datartr/addFeed3.txt
+    depends_on:
+      mariadb_container:
+        condition: service_healthy
+    healthcheck:
+      test: ["CMD", "curl", "-f", "http://prov.datarouternew.com:8080/internal/prov"]
+      interval: 10s
+      timeout: 10s
+      retries: 5
+    extra_hosts:
+      - "node.datarouternew.com:172.100.0.4"
+    networks:
+      testing_net:
+        ipv4_address: 172.100.0.3
+
+  datarouter-node:
+    image: nexus3.onap.org:10003/onap/dmaap/datarouter-node
+    container_name: datarouter-node
+    hostname: node.datarouternew.com
+    ports:
+     - "9443:8443"
+     - "9090:8080"
+    volumes:
+     - ./node_data/node.properties:/opt/app/datartr/etc/node.properties
+    depends_on:
+      datarouter-prov:
+        condition: service_healthy
+    extra_hosts:
+      - "prov.datarouternew.com:172.100.0.3"
+    networks:
+      testing_net:
+        ipv4_address: 172.100.0.4
+
+  datarouter-subscriber:
+      image: nexus3.onap.org:10003/onap/dmaap/datarouter-subscriber
+      container_name: subscriber-node
+      hostname: subscriber.com
+      ports:
+       - "7070:7070"
+      volumes:
+       - ./subscriber_data/subscriber.properties:/opt/app/subscriber/etc/subscriber.properties
+      networks:
+        testing_net:
+          ipv4_address: 172.100.0.5
+      
+  mariadb_container:
+    image: mariadb:10.2.14
+    container_name: mariadb
+    ports:
+      - "3306:3306"
+#    volumes:
+#     - ./database/sql_init_01.sql:/docker-entrypoint-initdb.d/sql_init_01.sql
+    environment:
+      MYSQL_ROOT_PASSWORD: datarouter
+      MYSQL_DATABASE: datarouter
+      MYSQL_USER: datarouter
+      MYSQL_PASSWORD: datarouter
+    healthcheck:
+      test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost", "--silent"]
+      interval: 10s
+      timeout: 30s
+      retries: 5
+
+    networks:
+      testing_net:
+        ipv4_address: 172.100.0.2
+
+networks:
+  testing_net:
+    driver: bridge
+    ipam:
+      driver: default
+      config:
+        - subnet: 172.100.0.0/16
-#-------------------------------------------------------------------------------\r
-# ============LICENSE_START==================================================\r
-# * org.onap.dmaap\r
-# * ===========================================================================\r
-# * Copyright © 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
-# * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
-# *\r
-#-------------------------------------------------------------------------------\r
-#\r
-#    Configuration parameters fixed at startup for the DataRouter node\r
-#\r
-#    URL to retrieve dynamic configuration\r
-#\r
-#ProvisioningURL:    ${DRTR_PROV_INTURL:-https://feeds-drtr.web.att.com/internal/prov}\r
-ProvisioningURL=https://prov.datarouternew.com:8443/internal/prov\r
-\r
-#\r
-#    URL to upload PUB/DEL/EXP logs\r
-#\r
-#LogUploadURL:    ${DRTR_LOG_URL:-https://feeds-drtr.web.att.com/internal/logs}\r
-LogUploadURL=https://prov.datarouternew.com:8443/internal/logs\r
-\r
-#\r
-#    The port number for http as seen within the server\r
-#\r
-#IntHttpPort:    ${DRTR_NODE_INTHTTPPORT:-8080}\r
-IntHttpPort=8080\r
-#\r
-#    The port number for https as seen within the server\r
-#\r
-IntHttpsPort=8443\r
-#\r
-#    The external port number for https taking port mapping into account\r
-#\r
-ExtHttpsPort=443\r
-#\r
-#    The minimum interval between fetches of the dynamic configuration\r
-#    from the provisioning server\r
-#\r
-MinProvFetchInterval=10000\r
-#\r
-#    The minimum interval between saves of the redirection data file\r
-#\r
-MinRedirSaveInterval=10000\r
-#\r
-#    The path to the directory where log files are stored\r
-#\r
-LogDir=/opt/app/datartr/logs\r
-#\r
-#    The retention interval (in days) for log files\r
-#\r
-LogRetention=30\r
-#\r
-#    The path to the directories where data and meta data files are stored\r
-#\r
-SpoolDir=/opt/app/datartr/spool\r
-#\r
-#    The path to the redirection data file\r
-#\r
-#RedirectionFile:    etc/redirections.dat\r
-#\r
-#    The type of keystore for https\r
-#\r
-KeyStoreType:    jks\r
-#\r
-#    The path to the keystore for https\r
-#\r
-KeyStoreFile:/opt/app/datartr/self_signed/keystore.jks\r
-#\r
-#    The password for the https keystore\r
-#\r
-KeyStorePassword=changeit\r
-#\r
-#    The password for the private key in the https keystore\r
-#\r
-KeyPassword=changeit\r
-#\r
-#    The type of truststore for https\r
-#\r
-TrustStoreType=jks\r
-#\r
-#    The path to the truststore for https\r
-#\r
-#TrustStoreFile=/usr/lib/jvm/java-8-oracle/jre/lib/security/cacerts\r
-TrustStoreFile=/opt/app/datartr/self_signed/cacerts.jks\r
-#\r
-#    The password for the https truststore\r
-#\r
-TrustStorePassword=changeit\r
-#\r
-#    The path to the file used to trigger an orderly shutdown\r
-#\r
-QuiesceFile=etc/SHUTDOWN\r
-#\r
-#    The key used to generate passwords for node to node transfers\r
-#\r
-NodeAuthKey=Node123!\r
-\r
+#-------------------------------------------------------------------------------
+# ============LICENSE_START==================================================
+# * org.onap.dmaap
+# * ===========================================================================
+# * Copyright � 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====================================================
+# *
+# * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+# *
+#-------------------------------------------------------------------------------
+#
+#    Configuration parameters fixed at startup for the DataRouter node
+#
+#    URL to retrieve dynamic configuration
+#
+#ProvisioningURL:    ${DRTR_PROV_INTURL:-https://feeds-drtr.web.att.com/internal/prov}
+ProvisioningURL=https://prov.datarouternew.com:8443/internal/prov
+
+#
+#    URL to upload PUB/DEL/EXP logs
+#
+#LogUploadURL:    ${DRTR_LOG_URL:-https://feeds-drtr.web.att.com/internal/logs}
+LogUploadURL=https://prov.datarouternew.com:8443/internal/logs
+
+#
+#    The port number for http as seen within the server
+#
+#IntHttpPort:    ${DRTR_NODE_INTHTTPPORT:-8080}
+IntHttpPort=8080
+#
+#    The port number for https as seen within the server
+#
+IntHttpsPort=8443
+#
+#    The external port number for https taking port mapping into account
+#
+ExtHttpsPort=443
+#
+#    The minimum interval between fetches of the dynamic configuration
+#    from the provisioning server
+#
+MinProvFetchInterval=10000
+#
+#    The minimum interval between saves of the redirection data file
+#
+MinRedirSaveInterval=10000
+#
+#    The path to the directory where log files are stored
+#
+LogDir=/opt/app/datartr/logs
+#
+#    The retention interval (in days) for log files
+#
+LogRetention=30
+#
+#    The path to the directories where data and meta data files are stored
+#
+SpoolDir=/opt/app/datartr/spool
+#
+#    The path to the redirection data file
+#
+#RedirectionFile:    etc/redirections.dat
+#
+#    The type of keystore for https
+#
+KeyStoreType:    jks
+#
+#    The path to the keystore for https
+#
+KeyStoreFile:/opt/app/datartr/self_signed/keystore.jks
+#
+#    The password for the https keystore
+#
+KeyStorePassword=changeit
+#
+#    The password for the private key in the https keystore
+#
+KeyPassword=changeit
+#
+#    The type of truststore for https
+#
+TrustStoreType=jks
+#
+#    The path to the truststore for https
+#
+#TrustStoreFile=/usr/lib/jvm/java-8-oracle/jre/lib/security/cacerts
+TrustStoreFile=/opt/app/datartr/self_signed/cacerts.jks
+#
+#    The password for the https truststore
+#
+TrustStorePassword=changeit
+#
+#    The path to the file used to trigger an orderly shutdown
+#
+QuiesceFile=etc/SHUTDOWN
+#
+#    The key used to generate passwords for node to node transfers
+#
+NodeAuthKey=Node123!
+
diff --git a/docker-compose/subscriber_data/subscriber.properties b/docker-compose/subscriber_data/subscriber.properties
new file mode 100644 (file)
index 0000000..771fdd3
--- /dev/null
@@ -0,0 +1,40 @@
+#-------------------------------------------------------------------------------
+# ============LICENSE_START==================================================
+# * org.onap.dmaap
+# * ===========================================================================
+# * Copyright � 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====================================================
+# *
+# * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+# *
+#-------------------------------------------------------------------------------
+
+#Subscriber properties
+org.onap.dmaap.datarouter.subscriber.http.port           = 7070
+org.onap.dmaap.datarouter.subscriber.https.port          = 7443
+org.onap.dmaap.datarouter.subscriber.auth.user           = LOGIN
+org.onap.dmaap.datarouter.subscriber.auth.password       = PASSWORD
+org.onap.dmaap.datarouter.subscriber.delivery.dir        = /opt/app/subscriber/delivery
+
+org.onap.dmaap.datarouter.subscriber.https.relaxation    = true
+org.onap.dmaap.datarouter.subscriber.keystore.type       = jks
+org.onap.dmaap.datarouter.subscriber.keymanager.password = changeit
+org.onap.dmaap.datarouter.subscriber.keystore.path       = /opt/app/datartr/self_signed/keystore.jks
+org.onap.dmaap.datarouter.subscriber.keystore.password   = changeit
+org.onap.dmaap.datarouter.subscriber.truststore.path     = /opt/app/datartr/self_signed/cacerts.jks
+org.onap.dmaap.datarouter.subscriber.truststore.password = changeit
+
+
+
diff --git a/pom.xml b/pom.xml
index d3327ba..43aeca2 100755 (executable)
--- a/pom.xml
+++ b/pom.xml
@@ -60,6 +60,7 @@
     <modules>
         <module>datarouter-prov</module>
         <module>datarouter-node</module>
+        <module>datarouter-subscriber</module>
     </modules>
     <build>
         <plugins>