summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/Topic.java25
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedDmaapTopicSinkFactory.java6
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedDmaapTopicSourceFactory.java9
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedUebTopicSinkFactory.java7
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedUebTopicSourceFactory.java8
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicBase.java6
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicParams.java12
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineDmaapTopicSink.java8
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineUebTopicSink.java6
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java6
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedUebTopicSource.java7
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBase.java45
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/properties/PolicyEndPointProperties.java1
-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
-rw-r--r--policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/TopicEndpointProxyTest.json6
-rw-r--r--policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicBaseTest.json1
-rw-r--r--policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineBusTopicSinkTest.json1
-rw-r--r--policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineDmaapTopicSinkTest.json1
-rw-r--r--policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineUebTopicSinkTest.json1
-rw-r--r--policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedBusTopicSourceTest.json1
-rw-r--r--policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSourceTest.json1
-rw-r--r--policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedUebTopicSourceTest.json1
-rw-r--r--policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBaseTest.json1
31 files changed, 209 insertions, 53 deletions
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/Topic.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/Topic.java
index 800fcce4..96c00c77 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/Topic.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/Topic.java
@@ -1,8 +1,8 @@
/*-
* ============LICENSE_START=======================================================
- * policy-endpoints
+ * ONAP
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -35,7 +35,7 @@ public interface Topic extends TopicRegisterable, Startable, Lockable {
/**
* Underlying Communication infrastructure Types.
*/
- public enum CommInfrastructure {
+ enum CommInfrastructure {
/**
* UEB Communication Infrastructure.
*/
@@ -55,31 +55,40 @@ public interface Topic extends TopicRegisterable, Startable, Lockable {
}
/**
- * Gets the topic name.
+ * Gets the canonical topic name.
*
* @return topic name
*/
- public String getTopic();
+ String getTopic();
+
+ /**
+ * Gets the effective topic that is used in
+ * the network communication. This name is usually
+ * the topic name.
+ *
+ * @return topic name alias
+ */
+ String getEffectiveTopic();
/**
* Gets the communication infrastructure type.
*
* @return CommInfrastructure object
*/
- public CommInfrastructure getTopicCommInfrastructure();
+ CommInfrastructure getTopicCommInfrastructure();
/**
* Return list of servers.
*
* @return bus servers
*/
- public List<String> getServers();
+ List<String> getServers();
/**
* Get the more recent events in this topic entity.
*
* @return list of most recent events
*/
- public String[] getRecentEvents();
+ String[] getRecentEvents();
}
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedDmaapTopicSinkFactory.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedDmaapTopicSinkFactory.java
index 659833ce..4ccf08de 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedDmaapTopicSinkFactory.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedDmaapTopicSinkFactory.java
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * ONAP Policy Engine - Common Modules
+ * ONAP
* ================================================================================
* Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -109,6 +109,9 @@ class IndexedDmaapTopicSinkFactory implements DmaapTopicSinkFactory {
serverList = new ArrayList<>();
}
+ final String effectiveTopic = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS
+ + "." + topic + PolicyEndPointProperties.PROPERTY_TOPIC_EFFECTIVE_TOPIC_SUFFIX, topic);
+
final String apiKey = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS
+ "." + topic + PolicyEndPointProperties.PROPERTY_TOPIC_API_KEY_SUFFIX);
final String apiSecret = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS
@@ -232,6 +235,7 @@ class IndexedDmaapTopicSinkFactory implements DmaapTopicSinkFactory {
DmaapTopicSink dmaapTopicSink = this.build(BusTopicParams.builder()
.servers(serverList)
.topic(topic)
+ .effectiveTopic(effectiveTopic)
.apiKey(apiKey)
.apiSecret(apiSecret)
.userName(aafMechId)
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedDmaapTopicSourceFactory.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedDmaapTopicSourceFactory.java
index 0c008f11..ddc3321f 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedDmaapTopicSourceFactory.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedDmaapTopicSourceFactory.java
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * ONAP Policy Engine - Common Modules
+ * ONAP
* ================================================================================
* Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -99,6 +99,10 @@ class IndexedDmaapTopicSourceFactory implements DmaapTopicSourceFactory {
serverList = new ArrayList<>();
}
+ final String effectiveTopic = properties.getProperty(
+ PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "."
+ + topic + PolicyEndPointProperties.PROPERTY_TOPIC_EFFECTIVE_TOPIC_SUFFIX, topic);
+
final String apiKey = properties.getProperty(
PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "."
+ topic + PolicyEndPointProperties.PROPERTY_TOPIC_API_KEY_SUFFIX);
@@ -201,9 +205,7 @@ class IndexedDmaapTopicSourceFactory implements DmaapTopicSourceFactory {
dme2AdditionalProps.put(DME2_SESSION_STICKINESS_REQUIRED_PROPERTY, dme2SessionStickinessRequired);
}
-
if (servers == null || servers.isEmpty()) {
-
logger.error("{}: no DMaaP servers or DME2 ServiceName provided", this);
continue;
}
@@ -260,6 +262,7 @@ class IndexedDmaapTopicSourceFactory implements DmaapTopicSourceFactory {
DmaapTopicSource uebTopicSource = this.build(BusTopicParams.builder()
.servers(serverList)
.topic(topic)
+ .effectiveTopic(effectiveTopic)
.apiKey(apiKey)
.apiSecret(apiSecret)
.userName(aafMechId)
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedUebTopicSinkFactory.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedUebTopicSinkFactory.java
index 5b3fc669..62437823 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedUebTopicSinkFactory.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedUebTopicSinkFactory.java
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * ONAP Policy Engine - Common Modules
+ * ONAP
* ================================================================================
* Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -114,7 +114,9 @@ class IndexedUebTopicSinkFactory implements UebTopicSinkFactory {
final List<String> serverList = new ArrayList<>(Arrays.asList(servers.split("\\s*,\\s*")));
- final String apiKey = properties.getProperty(PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS
+ final String effectiveTopic = properties.getProperty(PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS
+ + "." + topic + PolicyEndPointProperties.PROPERTY_TOPIC_EFFECTIVE_TOPIC_SUFFIX, topic);
+ final String apiKey = properties.getProperty(PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS
+ "." + topic + PolicyEndPointProperties.PROPERTY_TOPIC_API_KEY_SUFFIX);
final String apiSecret = properties.getProperty(PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS
+ "." + topic + PolicyEndPointProperties.PROPERTY_TOPIC_API_SECRET_SUFFIX);
@@ -151,6 +153,7 @@ class IndexedUebTopicSinkFactory implements UebTopicSinkFactory {
UebTopicSink uebTopicWriter = this.build(BusTopicParams.builder()
.servers(serverList)
.topic(topic)
+ .effectiveTopic(effectiveTopic)
.apiKey(apiKey)
.apiSecret(apiSecret)
.partitionId(partitionKey)
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedUebTopicSourceFactory.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedUebTopicSourceFactory.java
index 88a472c2..f3ef8fdc 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedUebTopicSourceFactory.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedUebTopicSourceFactory.java
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * ONAP Policy Engine - Common Modules
+ * ONAP
* ================================================================================
* Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -101,7 +101,10 @@ class IndexedUebTopicSourceFactory implements UebTopicSourceFactory {
final List<String> serverList = new ArrayList<>(Arrays.asList(servers.split("\\s*,\\s*")));
- final String apiKey = properties.getProperty(PolicyEndPointProperties.PROPERTY_UEB_SOURCE_TOPICS
+ final String effectiveTopic = properties.getProperty(PolicyEndPointProperties.PROPERTY_UEB_SOURCE_TOPICS
+ + "." + topic + PolicyEndPointProperties.PROPERTY_TOPIC_EFFECTIVE_TOPIC_SUFFIX, topic);
+
+ final String apiKey = properties.getProperty(PolicyEndPointProperties.PROPERTY_UEB_SOURCE_TOPICS
+ "." + topic + PolicyEndPointProperties.PROPERTY_TOPIC_API_KEY_SUFFIX);
final String apiSecret = properties.getProperty(PolicyEndPointProperties.PROPERTY_UEB_SOURCE_TOPICS
@@ -167,6 +170,7 @@ class IndexedUebTopicSourceFactory implements UebTopicSourceFactory {
UebTopicSource uebTopicSource = this.build(BusTopicParams.builder()
.servers(serverList)
.topic(topic)
+ .effectiveTopic(effectiveTopic)
.apiKey(apiKey)
.apiSecret(apiSecret)
.consumerGroup(consumerGroup)
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicBase.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicBase.java
index 3e4f48e7..ccf25753 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicBase.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicBase.java
@@ -1,8 +1,8 @@
/*
* ============LICENSE_START=======================================================
- * policy-endpoints
+ * ONAP
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-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.
@@ -60,7 +60,7 @@ public abstract class BusTopicBase extends TopicBase implements ApiKeyEnabled {
* @throws IllegalArgumentException if invalid parameters are present
*/
public BusTopicBase(BusTopicParams busTopicParams) {
- super(busTopicParams.getServers(), busTopicParams.getTopic());
+ super(busTopicParams.getServers(), busTopicParams.getTopic(), busTopicParams.getEffectiveTopic());
this.apiKey = busTopicParams.getApiKey();
this.apiSecret = busTopicParams.getApiSecret();
this.useHttps = busTopicParams.isUseHttps();
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicParams.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicParams.java
index 6e3c2632..b9817abf 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicParams.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicParams.java
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * policy-endpoints
+ * ONAP
* ================================================================================
* Copyright (C) 2018 Samsung Electronics Co., Ltd. All rights reserved.
* Modifications Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
@@ -51,6 +51,7 @@ public class BusTopicParams {
private List<String> servers;
private Map<String, String> additionalProps;
private String topic;
+ private String effectiveTopic;
private String apiKey;
private String apiSecret;
private String consumerGroup;
@@ -122,6 +123,10 @@ public class BusTopicParams {
return topic;
}
+ public String getEffectiveTopic() {
+ return effectiveTopic;
+ }
+
public String getApiKey() {
return apiKey;
}
@@ -276,6 +281,11 @@ public class BusTopicParams {
return this;
}
+ public TopicParamsBuilder effectiveTopic(String effectiveTopic) {
+ this.params.effectiveTopic = effectiveTopic;
+ return this;
+ }
+
public TopicParamsBuilder apiKey(String apiKey) {
this.params.apiKey = apiKey;
return this;
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineDmaapTopicSink.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineDmaapTopicSink.java
index 01531055..ba556bb8 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineDmaapTopicSink.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineDmaapTopicSink.java
@@ -1,8 +1,8 @@
/*-
* ============LICENSE_START=======================================================
- * policy-endpoints
+ * ONAP
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -87,7 +87,7 @@ public class InlineDmaapTopicSink extends InlineBusTopicSink implements DmaapTop
if (allNullOrEmpty(this.environment, this.aftEnvironment, this.latitude, this.longitude, this.partner)) {
this.publisher = new BusPublisher.CambriaPublisherWrapper(BusTopicParams.builder()
.servers(this.servers)
- .topic(this.topic)
+ .topic(this.effectiveTopic)
.apiKey(this.apiKey)
.apiSecret(this.apiSecret)
.userName(this.userName)
@@ -98,7 +98,7 @@ public class InlineDmaapTopicSink extends InlineBusTopicSink implements DmaapTop
} else {
this.publisher = new BusPublisher.DmaapDmePublisherWrapper(BusTopicParams.builder()
.servers(this.servers)
- .topic(this.topic)
+ .topic(this.effectiveTopic)
.userName(this.userName)
.password(this.password)
.environment(this.environment)
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineUebTopicSink.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineUebTopicSink.java
index f989f808..f258d5d9 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineUebTopicSink.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineUebTopicSink.java
@@ -1,8 +1,8 @@
/*
* ============LICENSE_START=======================================================
- * policy-endpoints
+ * ONAP
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -63,7 +63,7 @@ public class InlineUebTopicSink extends InlineBusTopicSink implements UebTopicSi
this.publisher = new BusPublisher.CambriaPublisherWrapper(BusTopicParams.builder()
.servers(this.servers)
- .topic(this.topic)
+ .topic(this.effectiveTopic)
.apiKey(this.apiKey)
.apiSecret(this.apiSecret)
.useHttps(this.useHttps)
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java
index e4064c5d..e5d08a2a 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java
@@ -1,8 +1,8 @@
/*-
* ============LICENSE_START=======================================================
- * policy-endpoints
+ * ONAP
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2018-2019 Samsung Electronics Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -89,7 +89,7 @@ public class SingleThreadedDmaapTopicSource extends SingleThreadedBusTopicSource
public void init() throws MalformedURLException {
BusTopicParams.TopicParamsBuilder builder = BusTopicParams.builder()
.servers(this.servers)
- .topic(this.topic)
+ .topic(this.effectiveTopic)
.apiKey(this.apiKey)
.apiSecret(this.apiSecret)
.consumerGroup(this.consumerGroup)
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedUebTopicSource.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedUebTopicSource.java
index f6d4b531..e210762d 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedUebTopicSource.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedUebTopicSource.java
@@ -1,8 +1,8 @@
/*
* ============LICENSE_START=======================================================
- * policy-endpoints
+ * ONAP
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2018-2019 Samsung Electronics Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -38,7 +38,6 @@ public class SingleThreadedUebTopicSource extends SingleThreadedBusTopicSource i
*/
public SingleThreadedUebTopicSource(BusTopicParams busTopicParams) {
super(busTopicParams);
-
this.init();
}
@@ -49,7 +48,7 @@ public class SingleThreadedUebTopicSource extends SingleThreadedBusTopicSource i
public void init() {
this.consumer = new BusConsumer.CambriaConsumerWrapper(BusTopicParams.builder()
.servers(this.servers)
- .topic(this.topic)
+ .topic(this.effectiveTopic)
.apiKey(this.apiKey)
.apiSecret(this.apiSecret)
.consumerGroup(this.consumerGroup)
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBase.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBase.java
index 80664554..6f07df1b 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBase.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBase.java
@@ -1,8 +1,8 @@
/*
* ============LICENSE_START=======================================================
- * policy-endpoints
+ * ONAP
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-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.
@@ -44,7 +44,12 @@ public abstract class TopicBase implements Topic {
/**
* Topic.
*/
- protected String topic;
+ protected final String topic;
+
+ /**
+ * Topic Alias.
+ */
+ protected final String effectiveTopic;
/**
* Event cache.
@@ -78,6 +83,18 @@ public abstract class TopicBase implements Topic {
* @throws IllegalArgumentException if invalid parameters are present
*/
public TopicBase(List<String> servers, String topic) {
+ this(servers, topic, topic);
+ }
+
+ /**
+ * Instantiates a new Topic Base.
+ *
+ * @param servers list of servers
+ * @param topic topic name
+ *
+ * @throws IllegalArgumentException if invalid parameters are present
+ */
+ public TopicBase(List<String> servers, String topic, String effectiveTopic) {
if (servers == null || servers.isEmpty()) {
throw new IllegalArgumentException("Server(s) must be provided");
@@ -87,8 +104,16 @@ public abstract class TopicBase implements Topic {
throw new IllegalArgumentException("A Topic must be provided");
}
+ String effectiveTopicCopy;
+ if (effectiveTopic == null || effectiveTopic.isEmpty()) {
+ effectiveTopicCopy = topic;
+ } else {
+ effectiveTopicCopy = effectiveTopic;
+ }
+
this.servers = servers;
this.topic = topic;
+ this.effectiveTopic = effectiveTopicCopy;
}
@Override
@@ -204,6 +229,11 @@ public abstract class TopicBase implements Topic {
}
@Override
+ public String getEffectiveTopic() {
+ return effectiveTopic;
+ }
+
+ @Override
public boolean isAlive() {
return this.alive;
}
@@ -222,7 +252,12 @@ public abstract class TopicBase implements Topic {
@Override
public String toString() {
- return "TopicBase [servers=" + servers + ", topic=" + topic + ", #recentEvents=" + recentEvents.size()
- + ", locked=" + locked + ", #topicListeners=" + topicListeners.size() + "]";
+ return "TopicBase [servers=" + servers
+ + ", topic=" + topic
+ + ", effectiveTopic=" + effectiveTopic
+ + ", #recentEvents=" + recentEvents.size()
+ + ", locked=" + locked
+ + ", #topicListeners=" + topicListeners.size()
+ + "]";
}
}
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/properties/PolicyEndPointProperties.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/properties/PolicyEndPointProperties.java
index 2979c7e9..7e22712b 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/properties/PolicyEndPointProperties.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/properties/PolicyEndPointProperties.java
@@ -29,6 +29,7 @@ public interface PolicyEndPointProperties {
String PROPERTY_TOPIC_API_SECRET_SUFFIX = ".apiSecret";
String PROPERTY_TOPIC_AAF_MECHID_SUFFIX = ".aafMechId";
String PROPERTY_TOPIC_AAF_PASSWORD_SUFFIX = ".aafPassword";
+ String PROPERTY_TOPIC_EFFECTIVE_TOPIC_SUFFIX = ".effectiveTopic";
String PROPERTY_TOPIC_EVENTS_SUFFIX = ".events";
String PROPERTY_TOPIC_EVENTS_FILTER_SUFFIX = ".filter";
String PROPERTY_TOPIC_EVENTS_CUSTOM_MODEL_CODER_GSON_SUFFIX = ".events.custom.gson";
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;
diff --git a/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/TopicEndpointProxyTest.json b/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/TopicEndpointProxyTest.json
index 11624af0..3402a524 100644
--- a/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/TopicEndpointProxyTest.json
+++ b/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/TopicEndpointProxyTest.json
@@ -4,6 +4,7 @@
"topicSources" : [ {
"servers" : [ "my-server" ],
"topic" : "ueb-source",
+ "effectiveTopic" : "my-effective-topic",
"recentEvents" : [ ],
"alive" : false,
"locked" : false,
@@ -19,6 +20,7 @@
}, {
"servers" : [ "my-server" ],
"topic" : "dmaap-source",
+ "effectiveTopic" : "my-effective-topic",
"recentEvents" : [ ],
"alive" : false,
"locked" : false,
@@ -34,6 +36,7 @@
}, {
"servers" : [ "my-server" ],
"topic" : "noop-source",
+ "effectiveTopic" : "noop-source",
"recentEvents" : [ ],
"alive" : false,
"locked" : false,
@@ -42,6 +45,7 @@
"topicSinks" : [ {
"servers" : [ "my-server" ],
"topic" : "ueb-sink",
+ "effectiveTopic" : "my-effective-topic",
"recentEvents" : [ ],
"alive" : false,
"locked" : false,
@@ -54,6 +58,7 @@
}, {
"servers" : [ "my-server" ],
"topic" : "dmaap-sink",
+ "effectiveTopic" : "my-effective-topic",
"recentEvents" : [ ],
"alive" : false,
"locked" : false,
@@ -66,6 +71,7 @@
}, {
"servers" : [ "my-server" ],
"topic" : "noop-sink",
+ "effectiveTopic" : "noop-sink",
"recentEvents" : [ ],
"alive" : false,
"locked" : false,
diff --git a/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicBaseTest.json b/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicBaseTest.json
index 49eafaf1..dd0b8924 100644
--- a/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicBaseTest.json
+++ b/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicBaseTest.json
@@ -1,6 +1,7 @@
{
"servers" : [ "svra", "svrb" ],
"topic" : "my-topic",
+ "effectiveTopic" : "my-effective-topic",
"recentEvents" : [ ],
"alive" : false,
"locked" : false,
diff --git a/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineBusTopicSinkTest.json b/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineBusTopicSinkTest.json
index 98318751..8e39fddf 100644
--- a/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineBusTopicSinkTest.json
+++ b/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineBusTopicSinkTest.json
@@ -1,6 +1,7 @@
{
"servers" : [ "svra", "svrb" ],
"topic" : "my-topic",
+ "effectiveTopic" : "my-effective-topic",
"recentEvents" : [ ],
"alive" : false,
"locked" : false,
diff --git a/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineDmaapTopicSinkTest.json b/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineDmaapTopicSinkTest.json
index a83f5c97..2bed3347 100644
--- a/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineDmaapTopicSinkTest.json
+++ b/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineDmaapTopicSinkTest.json
@@ -1,6 +1,7 @@
{
"servers" : [ "svra", "svrb" ],
"topic" : "my-topic",
+ "effectiveTopic" : "my-effective-topic",
"recentEvents" : [ ],
"alive" : false,
"locked" : false,
diff --git a/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineUebTopicSinkTest.json b/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineUebTopicSinkTest.json
index 4ec0c80f..e7419d88 100644
--- a/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineUebTopicSinkTest.json
+++ b/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineUebTopicSinkTest.json
@@ -1,6 +1,7 @@
{
"servers" : [ "svra", "svrb" ],
"topic" : "my-topic",
+ "effectiveTopic" : "my-effective-topic",
"recentEvents" : [ ],
"alive" : false,
"locked" : false,
diff --git a/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedBusTopicSourceTest.json b/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedBusTopicSourceTest.json
index 4f880257..aeb233bc 100644
--- a/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedBusTopicSourceTest.json
+++ b/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedBusTopicSourceTest.json
@@ -1,6 +1,7 @@
{
"servers" : [ "svra", "svrb" ],
"topic" : "my-topic",
+ "effectiveTopic" : "my-effective-topic",
"recentEvents" : [ ],
"alive" : false,
"locked" : false,
diff --git a/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSourceTest.json b/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSourceTest.json
index 82e4b3ff..07aa916a 100644
--- a/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSourceTest.json
+++ b/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSourceTest.json
@@ -1,6 +1,7 @@
{
"servers" : [ "svra", "svrb" ],
"topic" : "my-topic",
+ "effectiveTopic" : "my-effective-topic",
"recentEvents" : [ ],
"alive" : false,
"locked" : false,
diff --git a/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedUebTopicSourceTest.json b/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedUebTopicSourceTest.json
index 4eeacc6d..6a6e8f52 100644
--- a/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedUebTopicSourceTest.json
+++ b/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedUebTopicSourceTest.json
@@ -1,6 +1,7 @@
{
"servers" : [ "svra", "svrb" ],
"topic" : "my-topic",
+ "effectiveTopic" : "my-effective-topic",
"recentEvents" : [ ],
"alive" : false,
"locked" : false,
diff --git a/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBaseTest.json b/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBaseTest.json
index 7431854d..b72b4efd 100644
--- a/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBaseTest.json
+++ b/policy-endpoints/src/test/resources/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBaseTest.json
@@ -1,6 +1,7 @@
{
"servers" : [ "svra", "svrb" ],
"topic" : "my-topic",
+ "effectiveTopic" : "my-topic",
"recentEvents" : [ ],
"alive" : false,
"locked" : false,