summaryrefslogtreecommitdiffstats
path: root/policy-endpoints/src/test/java/org/onap
diff options
context:
space:
mode:
authorJorge Hernandez <jorge.hernandez-herrero@att.com>2019-02-19 20:05:31 -0600
committerJorge Hernandez <jorge.hernandez-herrero@att.com>2019-02-21 11:01:09 -0600
commit4c1c6891ed6cd4a9e5c2e0b3bacd0c2df89364a7 (patch)
tree36d229cab77b42d3c2504ce7ebe1f94d656e94da /policy-endpoints/src/test/java/org/onap
parent2917a67f12e32a7337e3a9f9b9fd3de4469a921c (diff)
Support for lab contextual topic names.
This work allows a drools application, with its drl template to refer to the topic name by its invariable canonical name, ie. POLICY-CL-MGT. Since the drl is a design time artifact, it is desired to know topics by its canonical non-changeable name. The actual per lab environment topic name may change on a per deployment basis, for example POLICY-CL-MGT-WINDRIVER or POLICY-CL-MGT-TLAB. The template can still use POLICY-CL-MGT without modification but the actual installation configuration would use the "effectiveTopic" property to point to the right topic on a per lab basis. This also helps with installation (long story) since the canonical topics will be known ahead of time. Change-Id: I8322bf7e427569c37a76eea5ce6d5b9547cb2ff3 Issue-ID: POLICY-1534 Signed-off-by: Jorge Hernandez <jorge.hernandez-herrero@att.com>
Diffstat (limited to 'policy-endpoints/src/test/java/org/onap')
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/BusTopicFactoryTestBase.java22
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/DmaapTopicPropertyBuilder.java7
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/NoopTopicPropertyBuilder.java7
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/TopicFactoryTestBase.java1
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/TopicTestBase.java7
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/UebTopicPropertyBuilder.java7
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicBaseTest.java8
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicParamsTest.java3
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBaseTest.java40
9 files changed, 88 insertions, 14 deletions
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/BusTopicFactoryTestBase.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/BusTopicFactoryTestBase.java
index 71d4fe27..919397d9 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/BusTopicFactoryTestBase.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/BusTopicFactoryTestBase.java
@@ -23,11 +23,13 @@ package org.onap.policy.common.endpoints.event.comm.bus;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_ALLOW_SELF_SIGNED_CERTIFICATES_SUFFIX;
import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_HTTP_HTTPS_SUFFIX;
import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_MANAGED_SUFFIX;
+import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_TOPIC_EFFECTIVE_TOPIC_SUFFIX;
import java.util.Arrays;
import java.util.List;
@@ -74,17 +76,21 @@ public abstract class BusTopicFactoryTestBase<T extends Topic> extends TopicFact
initFactory();
// two unmanaged topics
- T item = buildTopic(makeBuilder().managed(false).build());
+ T item = buildTopic(makeBuilder().managed(false).effectiveTopic(null).build());
T item2 = buildTopic(makeBuilder().managed(false).topic(TOPIC2).build());
assertNotNull(item);
assertNotNull(item2);
+ assertEquals(item.getTopic(), item.getEffectiveTopic());
+ assertNotEquals(item2.getTopic(), item2.getEffectiveTopic());
assertTrue(item != item2);
// duplicate topics, but since they aren't managed, they should be different
T item3 = buildTopic(makeBuilder().managed(false).build());
- T item4 = buildTopic(makeBuilder().managed(false).build());
+ T item4 = buildTopic(makeBuilder().managed(false).effectiveTopic(TOPIC2).build());
assertNotNull(item3);
assertNotNull(item4);
+ assertEquals(MY_TOPIC, item4.getTopic());
+ assertEquals(TOPIC2, item4.getEffectiveTopic());
assertTrue(item != item3);
assertTrue(item != item4);
assertTrue(item3 != item4);
@@ -143,7 +149,10 @@ public abstract class BusTopicFactoryTestBase<T extends Topic> extends TopicFact
public void testBuildProperties() {
initFactory();
- assertEquals(1, buildTopics(makePropBuilder().makeTopic(MY_TOPIC).build()).size());
+ List<T> topics = buildTopics(makePropBuilder().makeTopic(MY_TOPIC).build());
+ assertEquals(1, topics.size());
+ assertEquals(MY_TOPIC, topics.get(0).getTopic());
+ assertEquals(MY_EFFECTIVE_TOPIC, topics.get(0).getEffectiveTopic());
BusTopicParams params = getLastParams();
assertEquals(true, params.isManaged());
@@ -153,6 +162,13 @@ public abstract class BusTopicFactoryTestBase<T extends Topic> extends TopicFact
assertEquals(MY_API_SECRET, params.getApiSecret());
assertEquals(Arrays.asList(SERVER), params.getServers());
assertEquals(MY_TOPIC, params.getTopic());
+ assertEquals(MY_EFFECTIVE_TOPIC, params.getEffectiveTopic());
+
+ List<T> topics2 = buildTopics(makePropBuilder().makeTopic(TOPIC3)
+ .removeTopicProperty(PROPERTY_TOPIC_EFFECTIVE_TOPIC_SUFFIX).build());
+ assertEquals(1, topics2.size());
+ assertEquals(TOPIC3, topics2.get(0).getTopic());
+ assertEquals(topics2.get(0).getTopic(), topics2.get(0).getEffectiveTopic());
}
@Override
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/DmaapTopicPropertyBuilder.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/DmaapTopicPropertyBuilder.java
index 7276b445..3b63796c 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/DmaapTopicPropertyBuilder.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/DmaapTopicPropertyBuilder.java
@@ -1,8 +1,8 @@
/*
* ============LICENSE_START=======================================================
- * ONAP Policy Engine - Common Modules
+ * ONAP
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-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.
@@ -25,6 +25,7 @@ import static org.onap.policy.common.endpoints.event.comm.bus.TopicTestBase.MY_A
import static org.onap.policy.common.endpoints.event.comm.bus.TopicTestBase.MY_API_SECRET;
import static org.onap.policy.common.endpoints.event.comm.bus.TopicTestBase.MY_CONS_GROUP;
import static org.onap.policy.common.endpoints.event.comm.bus.TopicTestBase.MY_CONS_INST;
+import static org.onap.policy.common.endpoints.event.comm.bus.TopicTestBase.MY_EFFECTIVE_TOPIC;
import static org.onap.policy.common.endpoints.event.comm.bus.TopicTestBase.MY_ENV;
import static org.onap.policy.common.endpoints.event.comm.bus.TopicTestBase.MY_FETCH_LIMIT;
import static org.onap.policy.common.endpoints.event.comm.bus.TopicTestBase.MY_FETCH_TIMEOUT;
@@ -52,6 +53,7 @@ import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperti
import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_TOPIC_AAF_PASSWORD_SUFFIX;
import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_TOPIC_API_KEY_SUFFIX;
import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_TOPIC_API_SECRET_SUFFIX;
+import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_TOPIC_EFFECTIVE_TOPIC_SUFFIX;
import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX;
import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_TOPIC_SINK_PARTITION_KEY_SUFFIX;
import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_TOPIC_SOURCE_CONSUMER_GROUP_SUFFIX;
@@ -91,6 +93,7 @@ public class DmaapTopicPropertyBuilder extends TopicPropertyBuilder {
public DmaapTopicPropertyBuilder makeTopic(String topic) {
addTopic(topic);
+ setTopicProperty(PROPERTY_TOPIC_EFFECTIVE_TOPIC_SUFFIX, MY_EFFECTIVE_TOPIC);
setTopicProperty(PROPERTY_TOPIC_SOURCE_CONSUMER_GROUP_SUFFIX, MY_CONS_GROUP);
setTopicProperty(PROPERTY_TOPIC_SOURCE_CONSUMER_INSTANCE_SUFFIX, MY_CONS_INST);
setTopicProperty(PROPERTY_MANAGED_SUFFIX, "true");
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/NoopTopicPropertyBuilder.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/NoopTopicPropertyBuilder.java
index ace51d93..529f8b2f 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/NoopTopicPropertyBuilder.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/NoopTopicPropertyBuilder.java
@@ -1,8 +1,8 @@
/*
* ============LICENSE_START=======================================================
- * ONAP Policy Engine - Common Modules
+ * ONAP
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-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.
@@ -20,9 +20,11 @@
package org.onap.policy.common.endpoints.event.comm.bus;
+import static org.onap.policy.common.endpoints.event.comm.bus.TopicTestBase.MY_EFFECTIVE_TOPIC;
import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_ALLOW_SELF_SIGNED_CERTIFICATES_SUFFIX;
import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_HTTP_HTTPS_SUFFIX;
import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_MANAGED_SUFFIX;
+import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_TOPIC_EFFECTIVE_TOPIC_SUFFIX;
import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX;
public class NoopTopicPropertyBuilder extends TopicPropertyBuilder {
@@ -48,6 +50,7 @@ public class NoopTopicPropertyBuilder extends TopicPropertyBuilder {
public NoopTopicPropertyBuilder makeTopic(String topic) {
addTopic(topic);
+ setTopicProperty(PROPERTY_TOPIC_EFFECTIVE_TOPIC_SUFFIX, MY_EFFECTIVE_TOPIC);
setTopicProperty(PROPERTY_MANAGED_SUFFIX, "true");
setTopicProperty(PROPERTY_HTTP_HTTPS_SUFFIX, "true");
setTopicProperty(PROPERTY_ALLOW_SELF_SIGNED_CERTIFICATES_SUFFIX, "true");
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/TopicFactoryTestBase.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/TopicFactoryTestBase.java
index 419f9506..d8a16428 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/TopicFactoryTestBase.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/TopicFactoryTestBase.java
@@ -40,6 +40,7 @@ public abstract class TopicFactoryTestBase<T extends Topic> extends TopicTestBas
public static final String SERVER = "my-server";
public static final String TOPIC2 = "my-topic-2";
+ public static final String TOPIC3 = "my-topic-3";
/**
* Initializes a new factory.
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/TopicTestBase.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/TopicTestBase.java
index fb94e53e..326ec042 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/TopicTestBase.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/TopicTestBase.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* policy-endpoints
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-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.
@@ -49,6 +49,7 @@ public class TopicTestBase {
public static final String MY_PASSWD = "my-pass";
public static final int MY_PORT = 102;
public static final String MY_TOPIC = "my-topic";
+ public static final String MY_EFFECTIVE_TOPIC = "my-effective-topic";
public static final String MY_USERNAME = "my-user";
public static final String MY_MESSAGE = "my-message";
@@ -115,7 +116,7 @@ public class TopicTestBase {
.consumerGroup(MY_CONS_GROUP).consumerInstance(MY_CONS_INST).environment(MY_ENV)
.fetchLimit(MY_FETCH_LIMIT).fetchTimeout(MY_FETCH_TIMEOUT).hostname(MY_HOST).latitude(MY_LAT)
.longitude(MY_LONG).managed(true).partitionId(MY_PARTITION).partner(MY_PARTNER)
- .password(MY_PASSWD).port(MY_PORT).servers(servers).topic(MY_TOPIC).useHttps(true)
- .userName(MY_USERNAME);
+ .password(MY_PASSWD).port(MY_PORT).servers(servers).topic(MY_TOPIC)
+ .effectiveTopic(MY_EFFECTIVE_TOPIC).useHttps(true).userName(MY_USERNAME);
}
}
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/UebTopicPropertyBuilder.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/UebTopicPropertyBuilder.java
index efa1f125..3ac7d9ae 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/UebTopicPropertyBuilder.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/UebTopicPropertyBuilder.java
@@ -1,8 +1,8 @@
/*
* ============LICENSE_START=======================================================
- * ONAP Policy Engine - Common Modules
+ * ONAP
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-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.
@@ -25,6 +25,7 @@ import static org.onap.policy.common.endpoints.event.comm.bus.TopicTestBase.MY_A
import static org.onap.policy.common.endpoints.event.comm.bus.TopicTestBase.MY_API_SECRET;
import static org.onap.policy.common.endpoints.event.comm.bus.TopicTestBase.MY_CONS_GROUP;
import static org.onap.policy.common.endpoints.event.comm.bus.TopicTestBase.MY_CONS_INST;
+import static org.onap.policy.common.endpoints.event.comm.bus.TopicTestBase.MY_EFFECTIVE_TOPIC;
import static org.onap.policy.common.endpoints.event.comm.bus.TopicTestBase.MY_FETCH_LIMIT;
import static org.onap.policy.common.endpoints.event.comm.bus.TopicTestBase.MY_FETCH_TIMEOUT;
import static org.onap.policy.common.endpoints.event.comm.bus.TopicTestBase.MY_PARTITION;
@@ -36,6 +37,7 @@ import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperti
import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_TOPIC_AAF_PASSWORD_SUFFIX;
import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_TOPIC_API_KEY_SUFFIX;
import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_TOPIC_API_SECRET_SUFFIX;
+import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_TOPIC_EFFECTIVE_TOPIC_SUFFIX;
import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX;
import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_TOPIC_SINK_PARTITION_KEY_SUFFIX;
import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_TOPIC_SOURCE_CONSUMER_GROUP_SUFFIX;
@@ -69,6 +71,7 @@ public class UebTopicPropertyBuilder extends TopicPropertyBuilder {
public UebTopicPropertyBuilder makeTopic(String topic) {
addTopic(topic);
+ setTopicProperty(PROPERTY_TOPIC_EFFECTIVE_TOPIC_SUFFIX, MY_EFFECTIVE_TOPIC);
setTopicProperty(PROPERTY_TOPIC_SOURCE_CONSUMER_GROUP_SUFFIX, MY_CONS_GROUP);
setTopicProperty(PROPERTY_TOPIC_SOURCE_CONSUMER_INSTANCE_SUFFIX, MY_CONS_INST);
setTopicProperty(PROPERTY_MANAGED_SUFFIX, "true");
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicBaseTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicBaseTest.java
index 83a94bd5..5628a239 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicBaseTest.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicBaseTest.java
@@ -22,6 +22,7 @@ package org.onap.policy.common.endpoints.event.comm.bus.internal;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -77,6 +78,13 @@ public class BusTopicBaseTest extends TopicTestBase {
}
@Test
+ public void testTopic() {
+ assertEquals(MY_TOPIC, base.getTopic());
+ assertEquals(MY_EFFECTIVE_TOPIC, base.getEffectiveTopic());
+ assertNotEquals(base.getTopic(), base.getEffectiveTopic());
+ }
+
+ @Test
public void testAnyNullOrEmpty() {
assertFalse(base.anyNullOrEmpty());
assertFalse(base.anyNullOrEmpty("any-none-null", "any-none-null-B"));
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicParamsTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicParamsTest.java
index 8f1ab9bc..8d1c6343 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicParamsTest.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicParamsTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* policy-endpoints
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-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.
@@ -65,6 +65,7 @@ public class BusTopicParamsTest extends TopicTestBase {
assertEquals(MY_PORT, params.getPort());
assertEquals(servers, params.getServers());
assertEquals(MY_TOPIC, params.getTopic());
+ assertEquals(MY_EFFECTIVE_TOPIC, params.getEffectiveTopic());
assertEquals(true, params.isUseHttps());
assertEquals(MY_USERNAME, params.getUserName());
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBaseTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBaseTest.java
index a8ea84fc..55b2b404 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBaseTest.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBaseTest.java
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * ONAP Policy Engine - Common Modules
+ * ONAP
* ================================================================================
* Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -74,6 +74,27 @@ public class TopicBaseTest extends TopicTestBase {
}
@Test
+ public void testTopicBase_EffectiveTopic() {
+ TopicBase baseEf = new TopicBaseImpl(servers, MY_TOPIC, MY_EFFECTIVE_TOPIC);
+ assertEquals(MY_TOPIC, baseEf.getTopic());
+ assertEquals(MY_EFFECTIVE_TOPIC, baseEf.getEffectiveTopic());
+ }
+
+ @Test
+ public void testTopicBase_NullEffectiveTopic() {
+ TopicBase baseEf = new TopicBaseImpl(servers, MY_TOPIC, null);
+ assertEquals(MY_TOPIC, baseEf.getTopic());
+ assertEquals(MY_TOPIC, baseEf.getEffectiveTopic());
+ }
+
+ @Test
+ public void testTopicBase_EmptyEffectiveTopic() {
+ TopicBase baseEf = new TopicBaseImpl(servers, MY_TOPIC, "");
+ assertEquals(MY_TOPIC, baseEf.getTopic());
+ assertEquals(MY_TOPIC, baseEf.getEffectiveTopic());
+ }
+
+ @Test
public void testSerialize() {
new GsonTestUtils().compareGson(base, TopicBaseTest.class);
}
@@ -209,6 +230,12 @@ public class TopicBaseTest extends TopicTestBase {
}
@Test
+ public void testGetEffectiveTopic() {
+ assertEquals(MY_TOPIC, base.getTopic());
+ assertEquals(MY_TOPIC, base.getEffectiveTopic());
+ }
+
+ @Test
public void testIsAlive() {
assertFalse(base.isAlive());
base.start();
@@ -260,6 +287,17 @@ public class TopicBaseTest extends TopicTestBase {
super(servers, topic);
}
+ /**
+ * Constructor.
+ *
+ * @param servers list of servers
+ * @param topic topic name
+ * @param effectiveTopic effective topic name for network communication
+ */
+ public TopicBaseImpl(List<String> servers, String topic, String effectiveTopic) {
+ super(servers, topic, effectiveTopic);
+ }
+
@Override
public CommInfrastructure getTopicCommInfrastructure() {
return CommInfrastructure.NOOP;