summaryrefslogtreecommitdiffstats
path: root/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapBlueprint.java
diff options
context:
space:
mode:
authorTomasz Wrobel <tomasz.wrobel@nokia.com>2020-09-22 15:19:03 +0200
committerTomasz Wrobel <tomasz.wrobel@nokia.com>2020-09-24 11:51:07 +0200
commitb9cb00657207bb020c1802485c930b46621d4813 (patch)
treee62c4603116ea79f5974859fd4455aa108b36b62 /mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapBlueprint.java
parent9e72a68a16d4a7aaeb093e23e288585f9aebd220 (diff)
Refactor, fix code formatting and add unittests
-Refactor DmaapNode class -Add UT for DmaapNode -Refactor and fix code formatting in DmaapStreem class -Top up version to 1.5.2 Issue-ID: DCAEGEN2-2449 Signed-off-by: Tomasz Wrobel <tomasz.wrobel@nokia.com> Change-Id: If6781f26bb6bfe2a645b0b0438157823670341a2
Diffstat (limited to 'mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapBlueprint.java')
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapBlueprint.java17
1 files changed, 6 insertions, 11 deletions
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapBlueprint.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapBlueprint.java
index 2774abb..84c5fc5 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapBlueprint.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapBlueprint.java
@@ -33,6 +33,8 @@ import org.onap.blueprintgenerator.models.componentspec.ComponentSpec;
import org.onap.blueprintgenerator.models.componentspec.Publishes;
import org.onap.blueprintgenerator.models.componentspec.Subscribes;
+import static org.onap.blueprintgenerator.common.blueprint.BlueprintHelper.isDataRouterType;
+import static org.onap.blueprintgenerator.common.blueprint.BlueprintHelper.isMessageRouterType;
import static org.onap.blueprintgenerator.common.blueprint.BlueprintHelper.joinUnderscore;
import static org.onap.blueprintgenerator.models.blueprint.Imports.createDmaapImports;
import static org.onap.blueprintgenerator.models.blueprint.Imports.createImportsFromFile;
@@ -74,12 +76,12 @@ public class DmaapBlueprint extends Blueprint {
//go through the streams publishes
if (componentSpec.getStreams().getPublishes() != null) {
for (Publishes publisher : componentSpec.getStreams().getPublishes()) {
- if (isMessageRouter(publisher.getType())) {
+ if (isMessageRouterType(publisher.getType())) {
String topic = joinUnderscore(publisher.getConfig_key(), TOPIC);
DmaapNode topicNode = new DmaapNode();
inps = topicNode.createTopicNode(componentSpec, inps, topic);
nodeTemplate.put(topic, topicNode);
- } else if (isDataRouter(publisher.getType())) {
+ } else if (isDataRouterType(publisher.getType())) {
String feed = joinUnderscore(publisher.getConfig_key(), FEED);
DmaapNode feedNode = new DmaapNode();
inps = feedNode.createFeedNode(componentSpec, inps, feed);
@@ -90,12 +92,12 @@ public class DmaapBlueprint extends Blueprint {
//go through the stream subscribes
if (componentSpec.getStreams().getSubscribes() != null) {
for (Subscribes subscriber : componentSpec.getStreams().getSubscribes()) {
- if (isMessageRouter(subscriber.getType())) {
+ if (isMessageRouterType(subscriber.getType())) {
String topic = joinUnderscore(subscriber.getConfig_key(), TOPIC);
DmaapNode topicNode = new DmaapNode();
inps = topicNode.createTopicNode(componentSpec, inps, topic);
nodeTemplate.put(topic, topicNode);
- } else if (isDataRouter(subscriber.getType())) {
+ } else if (isDataRouterType(subscriber.getType())) {
String feed = joinUnderscore(subscriber.getConfig_key(), FEED);
DmaapNode feedNode = new DmaapNode();
inps = feedNode.createFeedNode(componentSpec, inps, feed);
@@ -120,11 +122,4 @@ public class DmaapBlueprint extends Blueprint {
return blueprint;
}
- private boolean isDataRouter(String type) {
- return type.equals("data_router") || type.equals("data router");
- }
-
- private boolean isMessageRouter(String type) {
- return type.equals("message_router") || type.equals("message router");
- }
}