Use new addTopic() method in apex-pdp 12/92312/1
authorjrh3 <jrh3@att.com>
Tue, 30 Jul 2019 19:50:13 +0000 (15:50 -0400)
committerjrh3 <jrh3@att.com>
Tue, 30 Jul 2019 19:50:13 +0000 (15:50 -0400)
Replaced ParameterUtils with the use of the new
addTopic(TopicParameterGroup) method.

Issue-ID: POLICY-1953
Signed-off-by: jrh3 <jrh3@att.com>
Change-Id: Ie1952c3bdf6d40834261029141ccb21edcdc1ad7

services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterActivator.java
services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterMain.java
services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/TestApexStarterActivator.java
services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/comm/TestPdpStateChangeListener.java
services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/comm/TestPdpUpdateListener.java

index 968c54d..affbf39 100644 (file)
@@ -22,7 +22,6 @@
 package org.onap.policy.apex.services.onappf;
 
 import java.util.List;
-import java.util.Properties;
 import lombok.Getter;
 import lombok.Setter;
 import org.onap.policy.apex.services.onappf.comm.PdpStateChangeListener;
@@ -80,13 +79,14 @@ public class ApexStarterActivator {
      * Instantiate the activator for onappf PDP-A.
      *
      * @param apexStarterParameterGroup the parameters for the onappf PDP-A service
-     * @param topicProperties properties used to configure the topics
      */
-    public ApexStarterActivator(final ApexStarterParameterGroup apexStarterParameterGroup,
-            final Properties topicProperties) {
+    public ApexStarterActivator(final ApexStarterParameterGroup apexStarterParameterGroup) {
 
-        topicSinks = TopicEndpointManager.getManager().addTopicSinks(topicProperties);
-        topicSources = TopicEndpointManager.getManager().addTopicSources(topicProperties);
+        topicSinks = TopicEndpointManager.getManager()
+                        .addTopicSinks(apexStarterParameterGroup.getTopicParameterGroup().getTopicSinks());
+
+        topicSources = TopicEndpointManager.getManager()
+                        .addTopicSources(apexStarterParameterGroup.getTopicParameterGroup().getTopicSources());
 
         // TODO: instanceId currently set as a random string, could be fetched from actual deployment
         final int random = (int) (Math.random() * 100);
index 15d9a83..2a3031a 100644 (file)
@@ -1,6 +1,8 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019 Nordix Foundation.
+ *  Modifications Copyright (C) 2019 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.
 package org.onap.policy.apex.services.onappf;
 
 import java.util.Arrays;
-import java.util.Properties;
 import org.onap.policy.apex.services.onappf.exception.ApexStarterException;
 import org.onap.policy.apex.services.onappf.parameters.ApexStarterParameterGroup;
 import org.onap.policy.apex.services.onappf.parameters.ApexStarterParameterHandler;
-import org.onap.policy.common.endpoints.utils.ParameterUtils;
 import org.onap.policy.common.utils.services.Registry;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -76,11 +76,8 @@ public class ApexStarterMain {
             return;
         }
 
-        // Read the properties
-        Properties topicProperties = ParameterUtils.getTopicProperties(parameterGroup.getTopicParameterGroup());
-
         // create the activator
-        activator = new ApexStarterActivator(parameterGroup, topicProperties);
+        activator = new ApexStarterActivator(parameterGroup);
         Registry.register(ApexStarterConstants.REG_APEX_STARTER_ACTIVATOR, activator);
         // Start the activator
         try {
index e4dd3d9..c8f889f 100644 (file)
@@ -1,6 +1,8 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019 Nordix Foundation.
+ *  Modifications Copyright (C) 2019 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.
@@ -27,19 +29,13 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
-import java.util.Properties;
-
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
-import org.onap.policy.apex.services.onappf.ApexStarterActivator;
-import org.onap.policy.apex.services.onappf.ApexStarterCommandLineArguments;
-import org.onap.policy.apex.services.onappf.ApexStarterConstants;
 import org.onap.policy.apex.services.onappf.exception.ApexStarterException;
 import org.onap.policy.apex.services.onappf.parameters.ApexStarterParameterGroup;
 import org.onap.policy.apex.services.onappf.parameters.ApexStarterParameterHandler;
 import org.onap.policy.apex.services.onappf.parameters.CommonTestData;
-import org.onap.policy.common.endpoints.utils.ParameterUtils;
 import org.onap.policy.common.utils.services.Registry;
 import org.onap.policy.models.pdp.concepts.PdpStatus;
 
@@ -64,8 +60,7 @@ public class TestApexStarterActivator {
         final ApexStarterCommandLineArguments arguments =
                 new ApexStarterCommandLineArguments(apexStarterConfigParameters);
         final ApexStarterParameterGroup parGroup = new ApexStarterParameterHandler().getParameters(arguments);
-        Properties topicProperties = ParameterUtils.getTopicProperties(parGroup.getTopicParameterGroup());
-        activator = new ApexStarterActivator(parGroup, topicProperties);
+        activator = new ApexStarterActivator(parGroup);
     }
 
     /**
index fc7bd8f..c475b50 100644 (file)
@@ -1,6 +1,8 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019 Nordix Foundation.
+ *  Modifications Copyright (C) 2019 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.
@@ -31,8 +33,6 @@ import java.util.ArrayList;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Properties;
-
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -43,7 +43,6 @@ import org.onap.policy.apex.services.onappf.exception.ApexStarterException;
 import org.onap.policy.apex.services.onappf.parameters.ApexStarterParameterGroup;
 import org.onap.policy.apex.services.onappf.parameters.ApexStarterParameterHandler;
 import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
-import org.onap.policy.common.endpoints.utils.ParameterUtils;
 import org.onap.policy.common.utils.services.Registry;
 import org.onap.policy.models.pdp.concepts.PdpStateChange;
 import org.onap.policy.models.pdp.concepts.PdpStatus;
@@ -90,9 +89,7 @@ public class TestPdpStateChangeListener {
         // Read the parameters
         parameterGroup = new ApexStarterParameterHandler().getParameters(arguments);
 
-        // Read the properties
-        Properties topicProperties = ParameterUtils.getTopicProperties(parameterGroup.getTopicParameterGroup());
-        activator = new ApexStarterActivator(parameterGroup, topicProperties);
+        activator = new ApexStarterActivator(parameterGroup);
         Registry.register(ApexStarterConstants.REG_APEX_STARTER_ACTIVATOR, activator);
         activator.initialize();
     }
index 98ca3eb..7007978 100644 (file)
@@ -1,6 +1,8 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019 Nordix Foundation.
+ *  Modifications Copyright (C) 2019 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.
@@ -31,8 +33,6 @@ import java.util.ArrayList;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Properties;
-
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -44,7 +44,6 @@ import org.onap.policy.apex.services.onappf.handler.PdpMessageHandler;
 import org.onap.policy.apex.services.onappf.parameters.ApexStarterParameterGroup;
 import org.onap.policy.apex.services.onappf.parameters.ApexStarterParameterHandler;
 import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
-import org.onap.policy.common.endpoints.utils.ParameterUtils;
 import org.onap.policy.common.utils.services.Registry;
 import org.onap.policy.models.pdp.concepts.PdpStatus;
 import org.onap.policy.models.pdp.concepts.PdpUpdate;
@@ -86,9 +85,7 @@ public class TestPdpUpdateListener {
         // Read the parameters
         parameterGroup = new ApexStarterParameterHandler().getParameters(arguments);
 
-        // Read the properties
-        Properties topicProperties = ParameterUtils.getTopicProperties(parameterGroup.getTopicParameterGroup());
-        activator = new ApexStarterActivator(parameterGroup, topicProperties);
+        activator = new ApexStarterActivator(parameterGroup);
         Registry.register(ApexStarterConstants.REG_APEX_STARTER_ACTIVATOR, activator);
         activator.initialize();
         pdpUpdateMessageListener = new PdpUpdateListener();