Merge "Update configuration"
diff --git a/src/main/java/org/onap/dcaegen2/services/pmmapper/datarouter/DataRouterSubscriber.java b/src/main/java/org/onap/dcaegen2/services/pmmapper/datarouter/DataRouterSubscriber.java
index 40efde5..4dcad3e 100644
--- a/src/main/java/org/onap/dcaegen2/services/pmmapper/datarouter/DataRouterSubscriber.java
+++ b/src/main/java/org/onap/dcaegen2/services/pmmapper/datarouter/DataRouterSubscriber.java
@@ -124,7 +124,7 @@
         JsonObject subscriberObj = new JsonObject();
         subscriberObj.addProperty("dcaeLocationName", config.getDcaeLocation());
         subscriberObj.addProperty("deliveryURL", config.getBusControllerDeliveryUrl());
-        subscriberObj.addProperty("feedId", config.getBusControllerFeedId());
+        subscriberObj.addProperty("feedId", config.getDmaapDRFeedId());
         subscriberObj.addProperty("lastMod", Instant.now().toString());
         subscriberObj.addProperty("username", config.getBusControllerUserName());
         subscriberObj.addProperty("userpwd", config.getBusControllerPassword());
diff --git a/src/main/java/org/onap/dcaegen2/services/pmmapper/model/EnvironmentConfig.java b/src/main/java/org/onap/dcaegen2/services/pmmapper/model/EnvironmentConfig.java
index fe48bfc..e2c1c6e 100644
--- a/src/main/java/org/onap/dcaegen2/services/pmmapper/model/EnvironmentConfig.java
+++ b/src/main/java/org/onap/dcaegen2/services/pmmapper/model/EnvironmentConfig.java
@@ -31,13 +31,13 @@
     public static final String ENV_SERVICE_NAME_KEY = "HOSTNAME";

 

     public static String getServiceName() throws EnvironmentConfigException {

-        return Optional.ofNullable(System.getenv("HOSTNAME"))

+        return Optional.ofNullable(System.getenv(ENV_SERVICE_NAME_KEY))

                 .orElseThrow(() -> new EnvironmentConfigException(

                         ENV_SERVICE_NAME_KEY+ " environment variable must be defined prior to pm-mapper initialization."));

     }

 

     public static String getCBSHostName() throws EnvironmentConfigException {

-        return Optional.ofNullable(System.getenv("CONFIG_BINDING_SERVICE_SERVICE_HOST"))

+        return Optional.ofNullable(System.getenv(ENV_CBS_HOST_KEY))

                 .orElseThrow(() -> new EnvironmentConfigException(

                         ENV_CBS_HOST_KEY+ " environment variable must be defined prior to pm-mapper initialization."));

     }

@@ -45,12 +45,11 @@
     public static Integer getCBSPort() throws EnvironmentConfigException {

         Integer port = DEFAULT_CBS_PORT;

         try {

-            port = Optional.ofNullable(System.getenv("CONFIG_BINDING_SERVICE_SERVICE_PORT"))

+            port = Optional.ofNullable(System.getenv(ENV_CBS_PORT_KEY))

                     .map(Integer::valueOf).orElse(DEFAULT_CBS_PORT);

         } catch (NumberFormatException e) {

             throw new EnvironmentConfigException(ENV_CBS_PORT_KEY + " must be valid: " + port);

         }

         return port;

-

     }

 }

diff --git a/src/main/java/org/onap/dcaegen2/services/pmmapper/model/MapperConfig.java b/src/main/java/org/onap/dcaegen2/services/pmmapper/model/MapperConfig.java
index 1753c2c..40327db 100644
--- a/src/main/java/org/onap/dcaegen2/services/pmmapper/model/MapperConfig.java
+++ b/src/main/java/org/onap/dcaegen2/services/pmmapper/model/MapperConfig.java
@@ -42,12 +42,21 @@
     private StreamsSubscribes streamsSubscribes;

 

     @GSONRequired

+    @Getter(AccessLevel.PRIVATE)

+    @SerializedName("streams_publishes")

+    private StreamsPublishes streamsPublishes;

+

+    @GSONRequired

     @SerializedName("buscontroller_feed_subscription_endpoint")

     private String busControllerSubscriptionEndpoint;

 

     @GSONRequired

-    @SerializedName("buscontroller_feed_id")

-    private String busControllerFeedId;

+    @SerializedName("dmaap_dr_feed_id")

+    private String dmaapDRFeedId;

+

+    @GSONRequired

+    @SerializedName("dmaap_dr_delete_endpoint")

+    private String dmaapDRDeleteEndpoint;

 

     public String getBusControllerDeliveryUrl() {

         return this.getStreamsSubscribes().getDmaapSubscriber().getDmaapInfo().getDeliveryUrl();

@@ -87,8 +96,23 @@
 

     @Getter

     @EqualsAndHashCode

-    class DmaapInfo {

+    private class StreamsPublishes {

         @GSONRequired

+        @SerializedName("dmaap_publisher")

+        DmaapPublisher dmaapPublisher;

+    }

+

+    @Getter

+    @EqualsAndHashCode

+    class DmaapPublisher {

+        @GSONRequired

+        @SerializedName("dmaap_info")

+        DmaapInfo dmaapInfo;

+    }

+

+    @Getter

+    @EqualsAndHashCode

+    class DmaapInfo {

         private String location;

         private String username;

         private String password;

@@ -98,9 +122,20 @@
 

         @SerializedName("subscriber_id")

         private String subscriberId;

+

+        @SerializedName("aaf_username")

+        private String aafUsername;

+

+        @SerializedName("aaf_password")

+        private String aafPassword;

+

+        @SerializedName("client_role")

+        private String clientRole;

+

+        @SerializedName("client_id")

+        private String clientId;

+

+        @SerializedName("topic_url")

+        private String topicUrl;

     }

-}

-

-

-

-

+}
\ No newline at end of file
diff --git a/src/test/resources/valid_mapper_config.json b/src/test/resources/valid_mapper_config.json
index 27765ae..c4423ff 100644
--- a/src/test/resources/valid_mapper_config.json
+++ b/src/test/resources/valid_mapper_config.json
@@ -1,6 +1,5 @@
 {

     "pm-mapper-filter": "{ \"filters\":[]}",

-    "3GPP.schema.file": "{\"3GPP_Schema\":\"./etc/3GPP_relaxed_schema.xsd\"}",

     "streams_subscribes": {

         "dmaap_subscriber": {

             "type": "data_router",

@@ -11,16 +10,16 @@
                 "delivery_url": "delivery_url",

                 "username": "username",

                 "password": "password",

-                "subscriber_id": "subsriber_id"

+                "subscriber_id": "subscriber_id"

             }

         }

     },

     "streams_publishes": {

-        "pm_mapper_handle_out": {

+        "dmaap_publisher": {

             "type": "message_router",

             "aaf_password": null,

             "dmaap_info": {

-                "topic_url": "https://we-are-message-router.us:3905/events/some-topic",

+                "topic_url": "https://message-router.onap.svc.cluster.local:3904/events/some-topic",

                 "client_role": null,

                 "location": null,

                 "client_id": null

@@ -28,7 +27,8 @@
             "aaf_username": null

         }

     },

-    "buscontroller_feed_id": "2",

+    "dmaap_dr_feed_id": "2",

     "buscontroller_feed_subscription_endpoint": "http://dmaap-bc.onap.svc.cluster.local:8080/webapi/dr_subs",

+    "dmaap_dr_delete_endpoint": "http://dmaap-dr-node.onap.svc.cluster.local:8443/delete",

     "services_calls": {}

 }
\ No newline at end of file