From 43a65d7605b852140a12f1398a152dea33112d87 Mon Sep 17 00:00:00 2001 From: Tomasz Wrobel Date: Wed, 30 Sep 2020 08:59:39 +0200 Subject: Add useExisting property to Dmaap Feed Node in Blueprint-Generator Issue-ID: DCAEGEN2-2460 Signed-off-by: Tomasz Wrobel Change-Id: Ie170ed503be3e775b05bd3acf51c19d245b85c38 --- .../models/blueprint/Properties.java | 2 +- .../models/dmaapbp/DmaapNode.java | 2 +- .../models/dmaapbp/DmaapNodeTest.java | 22 ++++++++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Properties.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Properties.java index c847f13..9aa5354 100644 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Properties.java +++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Properties.java @@ -71,7 +71,7 @@ public class Properties { private ExternalTlsInfo external_cert; private ResourceConfig resource_config; private GetInput always_pull_image; - //private boolean useExisting; + private Boolean useExisting; @JsonIgnore private ExternalTlsInfoFactory externalCertFactory; 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 9069f82..515099a 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 @@ -131,7 +131,7 @@ public class DmaapNode extends Node { GetInput topicInput = new GetInput(); topicInput.setBpInputName(name + "_name"); props.setFeed_name(topicInput); - //props.setUseExisting(true); + props.setUseExisting(true); retInputs.put(name + "_name", stringType); this.setProperties(props); diff --git a/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapNodeTest.java b/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapNodeTest.java index 6936393..83419e5 100644 --- a/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapNodeTest.java +++ b/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapNodeTest.java @@ -21,6 +21,8 @@ package org.onap.blueprintgenerator.models.dmaapbp; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; import static org.onap.blueprintgenerator.models.blueprint.BpConstants.CONTENERIZED_SERVICE_COMPONENT_USING_DMAAP; @@ -146,6 +148,16 @@ public class DmaapNodeTest { assertEquals(FEED, dmaapNode.getType()); } + @Test + public void feedNodePropertiesShouldHaveUseExistingField() { + ComponentSpec componentSpec = getSpiedComponentSpecWithoutRelationships(); + + DmaapNode dmaapNode = new DmaapNode(); + dmaapNode.createFeedNode(componentSpec, new TreeMap<>() ,""); + + assertTrue(dmaapNode.getProperties().getUseExisting()); + } + @Test public void createTopicNodeShouldSetTopicNodeType() { @@ -157,6 +169,16 @@ public class DmaapNodeTest { assertEquals(TOPIC, dmaapNode.getType()); } + @Test + public void topicNodePropertiesShouldNotHaveUseExistingField() { + ComponentSpec componentSpec = getSpiedComponentSpecWithoutRelationships(); + + DmaapNode dmaapNode = new DmaapNode(); + dmaapNode.createTopicNode(componentSpec, new TreeMap<>() ,""); + + assertNull(dmaapNode.getProperties().getUseExisting()); + } + private Publishes[] createSamplePublishes(String type) { Publishes publishes = new Publishes(); -- cgit 1.2.3-korg