From a71d5cda181f7bb74420f044614cd78cc2a38496 Mon Sep 17 00:00:00 2001 From: "a.sreekumar" Date: Thu, 27 Jun 2019 10:26:04 +0000 Subject: Making the topic property utility method more generic - addressing Jorge's review comment Making the method to update topic properties object more generic so that it can be used by other components such as drools if needed. Change-Id: I29c0f8fde5f4e1dd464072a9b06f2d93cc15b137 Issue-ID: POLICY-1744 Signed-off-by: a.sreekumar --- .../common/endpoints/utils/ParameterUtilsTest.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'policy-endpoints/src/test/java') diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/utils/ParameterUtilsTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/utils/ParameterUtilsTest.java index e1c0dbcf..7e5c3a12 100644 --- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/utils/ParameterUtilsTest.java +++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/utils/ParameterUtilsTest.java @@ -22,6 +22,7 @@ package org.onap.policy.common.endpoints.utils; import static org.junit.Assert.assertEquals; +import java.util.Arrays; import java.util.Properties; import org.junit.Test; import org.onap.policy.common.endpoints.parameters.CommonTestData; @@ -52,4 +53,21 @@ public class ParameterUtilsTest { assertEquals(CommonTestData.TOPIC_SERVER, topicProperties .getProperty(CommonTestData.TOPIC_INFRA + ".sink.topics." + CommonTestData.TOPIC_NAME + ".servers")); } + + @Test + public void testUpdateTopicProperties() { + Properties topicProperties = new Properties(); + ParameterUtils.updateTopicProperties(topicProperties, "source", CommonTestData.TOPIC_INFRA, + CommonTestData.TOPIC_NAME, Arrays.asList(CommonTestData.TOPIC_SERVER)); + assertEquals(CommonTestData.TOPIC_NAME, + topicProperties.getProperty(CommonTestData.TOPIC_INFRA + ".source.topics")); + assertEquals(CommonTestData.TOPIC_SERVER, topicProperties + .getProperty(CommonTestData.TOPIC_INFRA + ".source.topics." + CommonTestData.TOPIC_NAME + ".servers")); + ParameterUtils.updateTopicProperties(topicProperties, "sink", CommonTestData.TOPIC_INFRA, + CommonTestData.TOPIC_NAME, Arrays.asList(CommonTestData.TOPIC_SERVER)); + assertEquals(CommonTestData.TOPIC_NAME, + topicProperties.getProperty(CommonTestData.TOPIC_INFRA + ".sink.topics")); + assertEquals(CommonTestData.TOPIC_SERVER, topicProperties + .getProperty(CommonTestData.TOPIC_INFRA + ".sink.topics." + CommonTestData.TOPIC_NAME + ".servers")); + } } -- cgit 1.2.3-korg