From 04f13ef80c6e79d8c0b7b3fa1faeeaa0def1584e Mon Sep 17 00:00:00 2001 From: Joanna Jeremicz Date: Wed, 30 Sep 2020 11:39:25 +0200 Subject: Adjust BP-gen to correctly support DFC component spec - types - Update relationshipsType and feedNode values in DmaapNode - Create a class for hardcoded values - Update unit tests Issue-ID: DCAEGEN2-2459 Signed-off-by: Joanna Jeremicz Change-Id: Ic5dc91844b4aefcf7d3d9d25c866a60e63875deb --- .../models/dmaapbp/DmaapNode.java | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapNode.java') diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapNode.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapNode.java index e28e49a..9069f82 100644 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapNode.java +++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapNode.java @@ -46,6 +46,14 @@ import lombok.Setter; import static org.onap.blueprintgenerator.common.blueprint.BlueprintHelper.isDataRouterType; import static org.onap.blueprintgenerator.common.blueprint.BlueprintHelper.isMessageRouterType; +import static org.onap.blueprintgenerator.models.blueprint.BpConstants.CONTENERIZED_SERVICE_COMPONENT_USING_DMAAP; +import static org.onap.blueprintgenerator.models.blueprint.BpConstants.FEED; +import static org.onap.blueprintgenerator.models.blueprint.BpConstants.TOPIC; +import static org.onap.blueprintgenerator.models.blueprint.BpConstants.PUBLISH_EVENTS; +import static org.onap.blueprintgenerator.models.blueprint.BpConstants.PUBLISH_FILES; +import static org.onap.blueprintgenerator.models.blueprint.BpConstants.SUBSCRIBE_TO_EVENTS; +import static org.onap.blueprintgenerator.models.blueprint.BpConstants.SUBSCRIBE_TO_FILES; + @JsonIgnoreProperties(ignoreUnknown = true) @Getter @Setter @@ -60,7 +68,7 @@ public class DmaapNode extends Node { TreeMap> retInputs = inps; //set the type - this.setType("dcae.nodes.ContainerizedServiceComponentUsingDmaap"); + this.setType(CONTENERIZED_SERVICE_COMPONENT_USING_DMAAP); //create the interface Interfaces inter = new Interfaces(); @@ -116,7 +124,7 @@ public class DmaapNode extends Node { stringType.put("type", "string"); //set the type - this.setType("ccsdk.nodes.Feed"); + this.setType(FEED); //create and set the properties Properties props = new Properties(); @@ -137,7 +145,7 @@ public class DmaapNode extends Node { stringType.put("type", "string"); //set the type - this.setType("ccsdk.nodes.Topic"); + this.setType(TOPIC); //create and set the properties Properties props = new Properties(); @@ -154,10 +162,10 @@ public class DmaapNode extends Node { private LinkedHashMap createTypeAndTargetPubRelations(Publishes publishes) { LinkedHashMap pubRelations = new LinkedHashMap<>(); if (isMessageRouterType(publishes.getType())) { - pubRelations.put("type", "ccsdk.relationships.publish_events"); + pubRelations.put("type", PUBLISH_EVENTS); pubRelations.put("target", publishes.getConfig_key() + "_topic"); } else if (isDataRouterType(publishes.getType())) { - pubRelations.put("type", "ccsdk.relationships.publish_files"); + pubRelations.put("type", PUBLISH_FILES); pubRelations.put("target", publishes.getConfig_key() + "_feed"); } return pubRelations; @@ -166,10 +174,10 @@ public class DmaapNode extends Node { private LinkedHashMap createTypeAndTargetSubRelations(Subscribes subscribes) { LinkedHashMap subRelations = new LinkedHashMap<>(); if (isMessageRouterType(subscribes.getType())) { - subRelations.put("type", "ccsdk.relationships.subscribe_to_events"); + subRelations.put("type", SUBSCRIBE_TO_EVENTS); subRelations.put("target", subscribes.getConfig_key() + "_topic"); } else if (isDataRouterType(subscribes.getType())) { - subRelations.put("type", "ccsdk.relationships.subscribe_to_files"); + subRelations.put("type", SUBSCRIBE_TO_FILES); subRelations.put("target", subscribes.getConfig_key() + "_feed"); } return subRelations; -- cgit 1.2.3-korg