summaryrefslogtreecommitdiffstats
path: root/policy-endpoints/src/test/java/org
diff options
context:
space:
mode:
authora.sreekumar <ajith.sreekumar@est.tech>2019-06-27 10:26:04 +0000
committera.sreekumar <ajith.sreekumar@est.tech>2019-06-27 10:26:04 +0000
commita71d5cda181f7bb74420f044614cd78cc2a38496 (patch)
tree239da0857f1f51f565fc9b2a21a54a9d46683f41 /policy-endpoints/src/test/java/org
parentfc4b7d762f5ddabf4fbe4605d8a5d9d866b6cd54 (diff)
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 <ajith.sreekumar@est.tech>
Diffstat (limited to 'policy-endpoints/src/test/java/org')
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/utils/ParameterUtilsTest.java18
1 files changed, 18 insertions, 0 deletions
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"));
+ }
}