From 18df9bdaa77abfb89a909841912f9c8376b5d2f9 Mon Sep 17 00:00:00 2001 From: jrh3 Date: Mon, 29 Jul 2019 12:11:34 -0400 Subject: Use new addTopic(TopicParameterGroup) method in PAP Issue-ID: POLICY-1953 Signed-off-by: jrh3 Change-Id: I225dc5f03d867efe6167fd20781c9959af34e0e9 Signed-off-by: jrh3 --- main/src/main/java/org/onap/policy/pap/main/startstop/Main.java | 7 +------ .../main/java/org/onap/policy/pap/main/startstop/PapActivator.java | 7 ++----- .../java/org/onap/policy/pap/main/startstop/TestPapActivator.java | 6 +----- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/main/src/main/java/org/onap/policy/pap/main/startstop/Main.java b/main/src/main/java/org/onap/policy/pap/main/startstop/Main.java index ba73d354..fc3ebbce 100644 --- a/main/src/main/java/org/onap/policy/pap/main/startstop/Main.java +++ b/main/src/main/java/org/onap/policy/pap/main/startstop/Main.java @@ -22,8 +22,6 @@ package org.onap.policy.pap.main.startstop; import java.util.Arrays; -import java.util.Properties; -import org.onap.policy.common.endpoints.utils.ParameterUtils; import org.onap.policy.common.utils.services.Registry; import org.onap.policy.pap.main.PapConstants; import org.onap.policy.pap.main.PolicyPapException; @@ -79,9 +77,6 @@ public class Main { return; } - // Read the properties - Properties props = ParameterUtils.getTopicProperties(parameterGroup.getTopicParameterGroup()); - // Initialize database try { new PapDatabaseInitializer().initializePapDatabase(parameterGroup.getDatabaseProviderParameters()); @@ -91,7 +86,7 @@ public class Main { } // Now, create the activator for the policy pap service - activator = new PapActivator(parameterGroup, props); + activator = new PapActivator(parameterGroup); Registry.register(PapConstants.REG_PAP_ACTIVATOR, activator); // Start the activator diff --git a/main/src/main/java/org/onap/policy/pap/main/startstop/PapActivator.java b/main/src/main/java/org/onap/policy/pap/main/startstop/PapActivator.java index a15bc0f1..d119044f 100644 --- a/main/src/main/java/org/onap/policy/pap/main/startstop/PapActivator.java +++ b/main/src/main/java/org/onap/policy/pap/main/startstop/PapActivator.java @@ -22,7 +22,6 @@ package org.onap.policy.pap.main.startstop; import java.util.Arrays; -import java.util.Properties; import java.util.concurrent.atomic.AtomicReference; import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager; import org.onap.policy.common.endpoints.event.comm.TopicSource; @@ -93,13 +92,11 @@ public class PapActivator extends ServiceManagerContainer { * Instantiate the activator for policy pap as a complete service. * * @param papParameterGroup the parameters for the pap service - * @param topicProperties properties used to configure the topics */ - public PapActivator(final PapParameterGroup papParameterGroup, final Properties topicProperties) { + public PapActivator(final PapParameterGroup papParameterGroup) { super("Policy PAP"); - TopicEndpointManager.getManager().addTopicSinks(topicProperties); - TopicEndpointManager.getManager().addTopicSources(topicProperties); + TopicEndpointManager.getManager().addTopics(papParameterGroup.getTopicParameterGroup()); try { this.papParameterGroup = papParameterGroup; diff --git a/main/src/test/java/org/onap/policy/pap/main/startstop/TestPapActivator.java b/main/src/test/java/org/onap/policy/pap/main/startstop/TestPapActivator.java index 2ebd234c..13c06098 100644 --- a/main/src/test/java/org/onap/policy/pap/main/startstop/TestPapActivator.java +++ b/main/src/test/java/org/onap/policy/pap/main/startstop/TestPapActivator.java @@ -28,12 +28,10 @@ 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.common.endpoints.http.server.HttpServletServerFactoryInstance; -import org.onap.policy.common.endpoints.utils.ParameterUtils; import org.onap.policy.common.utils.services.Registry; import org.onap.policy.pap.main.PapConstants; import org.onap.policy.pap.main.PolicyPapException; @@ -67,9 +65,7 @@ public class TestPapActivator { final PapCommandLineArguments arguments = new PapCommandLineArguments(papConfigParameters); final PapParameterGroup parGroup = new PapParameterHandler().getParameters(arguments); - Properties props = ParameterUtils.getTopicProperties(parGroup.getTopicParameterGroup()); - - activator = new PapActivator(parGroup, props); + activator = new PapActivator(parGroup); } /** -- cgit 1.2.3-korg