Even more unit test and code cleanup
[dmaap/datarouter.git] / README.md
index 559b03d..56d29bb 100644 (file)
--- a/README.md
+++ b/README.md
 # DMAAP_DATAROUTER\r
-                              \r
+\r
 ## OVERVIEW\r
-  \r
-The Data Routing System project is intended to provide a common framework by which data producers can make data available to data consumers and a way for potential consumers to find feeds with the data they require.  \r
+\r
+The Data Routing System project is intended to provide a common framework by which data producers can make data available to data consumers and a way for potential consumers to find feeds with the data they require.\r
 The delivery of data from these kinds of production systems is the domain of the Data Routing System. Its primary goal is to make it easier to move data from existing applications that may not have been designed from the ground up to share data.\r
 The Data Routing System is different from many existing platforms for distributing messages from producers to consumers which focus on real-time delivery of small messages (on the order of a few kilobytes or so) for more\r
 \r
    Provisioning is implemented as a Java servlet running under Jetty in one JVM\r
-   \r
+\r
    Provisioning data is stored in a MariaDB database\r
-   \r
+\r
    The backup provisioning server and each node is informed any time provisioning data changes\r
-   \r
+\r
    The backup provisioning server and each node may request the complete set of provisioning data at any time\r
-   \r
+\r
    A Node is implemented as a Java servlet running under Jetty in one JVM\r
 \r
 Assumptions\r
     For 95% of all feeds (there will be some exceptions):\r
-       \r
+\r
     Number of Publishing Endpoints per Feed: 1 – 10\r
-       \r
+\r
     Number of Subscribers per Feed: 2 – 10\r
-       \r
+\r
     File Size: 105 – 1010 bytes\r
-       \r
+\r
     with a distribution towards the high end\r
-       \r
+\r
     Frequency of Publishing: 1/day – 10/minute\r
-       \r
+\r
     Lifetime of a Feed: months to years\r
-       \r
+\r
     Lifetime of a Subscription: months to years\r
-       \r
\r
+\r
+\r
 Data Router and Sensitive Data Handling\r
\r
+\r
     A publisher of a Data Router feed of sensitive (e.g., PCI, SPI, etc.) data needs to encrypt that data prior to delivering it to the Data Router\r
-       \r
+\r
     The Data Router will distribute that data to all of the subscribers of that feed.\r
-       \r
+\r
     Data Router does not examine the Feed content or enforce any restrictions or Validations on the Feed Content in any way\r
-       \r
+\r
     It is the responsibility of the subscribers to work with the publisher to determine how to decrypt that data\r
-       \r
 \r
 \r
\r
+\r
+\r
 \r
 What the Data Router is NOT:\r
 \r
     Does not support streaming data\r
-       \r
+\r
     Does not tightly couple to any specific publish endpoint or subscriber\r
-       \r
+\r
     Agnostic as to source and sink of data residing in an RDBMS, NoSQL DB, Other DBMS, Flat Files, etc.\r
-       \r
+\r
     Does not transform any published data\r
-       \r
+\r
     Does not “examine” any published data\r
-       \r
+\r
     Does not verify the integrity of a published file\r
-       \r
+\r
     Does not perform any data “cleansing”\r
-       \r
+\r
     Does not store feeds (not a repository or archive)\r
-       \r
+\r
     There is no long-term storage – assumes subscribers are responsive most of the time\r
-       \r
+\r
     Does not encrypt data when queued on a node\r
-       \r
+\r
     Does not provide guaranteed order of delivery\r
-       \r
+\r
     Per-file metadata can be used for ordering\r
-       \r
-   External customers supported is via DITREX (MOTS 18274)\r
\r
\r
\r
 \r
-## BUILD  \r
\r
-Datarouter can be cloned and repository and builb using Maven \r
-In the repository \r
+\r
+\r
+\r
+## BUILD\r
+\r
+After Datarouter repository is cloned it can be built using Maven\r
+In the repository\r
 \r
 Go to datarouter-prov in the root\r
 \r
        mvn clean install\r
-       \r
+\r
 Go to datarouter-node in the root\r
 \r
        mvn clean install\r
-        \r
+\r
 Project Build will be Successful\r
 \r
 \r
 \r
 \r
-## RUN \r
+## RUN\r
 \r
-Datarouter is a Unix based service \r
+Datarouter is a Unix based service\r
 \r
 Pre-requisites to run the service\r
 \r
@@ -111,39 +109,79 @@ Install MariaDB and load needed table into the database
 \r
 Sample sql_init_01.sql is provided in the datarouter-prov/src/main/resources/misc\r
 \r
-Go to datarouter-prov module and run the service using main.java \r
\r
-Go to datarouter-node module and run the service using nodemain.java \r
+Go to datarouter-prov module and run the service using main.java\r
+\r
+Go to datarouter-node module and run the service using nodemain.java\r
 \r
 Curl Commands to test:\r
 \r
 create a feed:\r
 \r
-curl -v -X POST -H "Content-Type : application/vnd.att-dr.feed" -H "X-ATT-DR-ON-BEHALF-OF: rs873m" --data-ascii @/opt/app/datartr/addFeed3.txt --post301 --location-trusted  -k https://prov.datarouternew.com:8443\r
+curl -v -X POST -H "Content-Type : application/vnd.dmaap-dr.feed" -H "X-DMAAP-DR-ON-BEHALF-OF: rs873m" --data-ascii @/opt/app/datartr/addFeed3.txt --post301 --location-trusted  -k https://dmaap-dr-prov:8443\r
 \r
 Subscribe to feed:\r
 \r
-curl -v -X POST -H "Content-Type: application/vnd.att-dr.subscription" -H "X-ATT-DR-ON-BEHALF-OF: rs873m" --data-ascii @/opt/app/datartr/addSubscriber.txt --post301 --location-trusted -k https://prov.datarouternew.com:8443/subscribe/1\r
+curl -v -X POST -H "Content-Type: application/vnd.dmaap-dr.subscription" -H "X-DMAAP-DR-ON-BEHALF-OF: rs873m" --data-ascii @/opt/app/datartr/addSubscriber.txt --post301 --location-trusted -k https://dmaap-dr-prov:8443/subscribe/1\r
 \r
 Publish to feed:\r
 \r
-curl -v -X PUT --user rs873m:rs873m -H "Content-Type: application/octet-stream" --data-binary @/opt/app/datartr/addFeed3.txt  --post301 --location-trusted -k https://prov.datarouternew.com:8443/publish/1/test1\r
+curl -v -X PUT --user rs873m:rs873m -H "Content-Type: application/octet-stream" --data-binary @/opt/app/datartr/addFeed3.txt  --post301 --location-trusted -k https://dmaap-dr-prov:8443/publish/1/test1\r
+\r
 \r
 \r
\r
 \r
- ## CONFIGURATION \r
+ ## CONFIGURATION\r
 \r
-Recommended \r
+Recommended\r
 \r
 Environment - Unix based\r
 \r
 Java - 1.8\r
 \r
-Maven - 3.2.5 \r
+Maven - 3.2.5\r
 \r
 MariaDB - 10.2.14\r
 \r
 Self Signed SSL certificates\r
\r
\r
+\r
+## This section describes how to build and test datarouter containers on a host such as\r
+a laptop or remote server.\r
+\r
+- Install git, maven, docker\r
+    - See https://wiki.onap.org/display/DW/Setting+Up+Your+Development+Environment\r
+    - See https://docs.docker.com/install/\r
+\r
+### Build\r
+- in terminal \r
+> git clone https://gerrit.onap.org/r/dmaap/datarouter\r
+> cd datarouter\r
+> mvn clean install -DskipTests -Pdocker\r
+> docker images\r
+REPOSITORY                                               TAG                 IMAGE ID            CREATED             SIZE\r
+nexus3.onap.org:10003/onap/dmaap/datarouter-subscriber   2.0.0-SNAPSHOT      0dfc99a7612c        13 seconds ago      99.2MB\r
+nexus3.onap.org:10003/onap/dmaap/datarouter-subscriber   latest              0dfc99a7612c        13 seconds ago      99.2MB\r
+nexus3.onap.org:10003/onap/dmaap/datarouter-node         2.0.0-SNAPSHOT      6573f4bdc310        27 seconds ago      116MB\r
+nexus3.onap.org:10003/onap/dmaap/datarouter-node         latest              6573f4bdc310        27 seconds ago      116MB\r
+nexus3.onap.org:10003/onap/dmaap/datarouter-prov         2.0.0-SNAPSHOT      9e4148737c18        47 seconds ago      148MB\r
+nexus3.onap.org:10003/onap/dmaap/datarouter-prov         latest              9e4148737c18        47 seconds ago      148MB\r
+openjdk                                                  8-jre-alpine        1b46cc2ba839        3 weeks ago         85MB\r
+nexus3.onap.org:10001/openjdk                            8-jre-alpine        1b46cc2ba839        3 weeks ago         85MB\r
+\r
+### Test\r
+> cd datarouter-docker-compose/src/main/resources\r
+- edit docker-compose, change nexus 0001 (remote pull repo) to 0003 (local build)\r
+> docker-compose up\r
+\r
+- terminal 2\r
+>  docker container ls -a\r
+CONTAINER ID        IMAGE                                                    COMMAND                  CREATED              STATUS                        PORTS                                                                   NAMES\r
+c193317ec860        nexus3.onap.org:10003/onap/dmaap/datarouter-node         "sh startup.sh"          About a minute ago   Up About a minute             0.0.0.0:9090->8080/tcp, 0.0.0.0:9443->8443/tcp                          datarouter-node\r
+e8dab741550e        nexus3.onap.org:10003/onap/dmaap/datarouter-prov         "sh startup.sh"          About a minute ago   Up About a minute (healthy)   0.0.0.0:8080->8080/tcp, 0.0.0.0:8443->8443/tcp, 0.0.0.0:443->8443/tcp   datarouter-prov\r
+cf0e996f0f31        nexus3.onap.org:10003/onap/dmaap/datarouter-subscriber   "sh startup.sh"          About a minute ago   Up About a minute             8080/tcp, 0.0.0.0:7070->7070/tcp, 8443/tcp                              subscriber-node\r
+73affb6364f9        mariadb:10.2.14                                          "docker-entrypoint.s…"   About a minute ago   Up About a minute (healthy)   0.0.0.0:3306->3306/tcp                                                  mariadb\r
+\r
+> docker exec -it datarouter-node /bin/sh\r
+    # curl http://dmaap-dr-prov:8080/internal/prov\r
+> docker exec -it datarouter-prov /bin/sh\r
+    # curl -v -X POST -H "Content-Type : application/vnd.dmaap-dr.feed" -H "X-DMAAP-DR-ON-BEHALF-OF: rs873m" --data-ascii @/opt/app/datartr/addFeed3.txt --post301 --location-trusted  -k https://dmaap-dr-prov:8443\r
+\r