Remove topic.properties and incorporate into overall config file for pdp-simulator
[policy/models.git] / models-sim / policy-models-sim-pdp / src / test / java / org / onap / policy / models / sim / pdp / comm / TestPdpUpdateListener.java
index e5eebf0..9ae8d37 100644 (file)
@@ -23,7 +23,6 @@ package org.onap.policy.models.sim.pdp.comm;
 
 import static org.junit.Assert.assertEquals;
 
-import java.io.FileInputStream;
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
@@ -37,6 +36,7 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 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;
@@ -67,8 +67,7 @@ public class TestPdpUpdateListener {
     @Before
     public void setUp() throws Exception {
         Registry.newRegistry();
-        final String[] pdpSimulatorConfigParameters = { "-c", "src/test/resources/PdpSimulatorConfigParameters.json",
-            "-p", "src/test/resources/topic.properties" };
+        final String[] pdpSimulatorConfigParameters = { "-c", "src/test/resources/PdpSimulatorConfigParameters.json" };
         final PdpSimulatorCommandLineArguments arguments = new PdpSimulatorCommandLineArguments();
         PdpSimulatorParameterGroup pdpSimulatorParameterGroup;
         // The arguments return a string if there is a message to print and we should
@@ -84,11 +83,8 @@ public class TestPdpUpdateListener {
         pdpSimulatorParameterGroup = new PdpSimulatorParameterHandler().getParameters(arguments);
 
         // Read the properties
-        final Properties topicProperties = new Properties();
-        final String propFile = arguments.getFullPropertyFilePath();
-        try (FileInputStream stream = new FileInputStream(propFile)) {
-            topicProperties.load(stream);
-        }
+        final Properties topicProperties =
+            ParameterUtils.getTopicProperties(pdpSimulatorParameterGroup.getTopicParameterGroup());
         activator = new PdpSimulatorActivator(pdpSimulatorParameterGroup, topicProperties);
         Registry.register(PdpSimulatorConstants.REG_PDP_SIMULATOR_ACTIVATOR, activator);
         activator.initialize();