Add useExisting property to Dmaap Feed Node in Blueprint-Generator 50/113350/3
authorTomasz Wrobel <tomasz.wrobel@nokia.com>
Wed, 30 Sep 2020 06:59:39 +0000 (08:59 +0200)
committerTomasz Wrobel <tomasz.wrobel@nokia.com>
Thu, 1 Oct 2020 11:34:19 +0000 (13:34 +0200)
Issue-ID: DCAEGEN2-2460
Signed-off-by: Tomasz Wrobel <tomasz.wrobel@nokia.com>
Change-Id: Ie170ed503be3e775b05bd3acf51c19d245b85c38

mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Properties.java
mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapNode.java
mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapNodeTest.java

index c847f13..9aa5354 100644 (file)
@@ -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;
 
index 9069f82..515099a 100644 (file)
@@ -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);
 
index 6936393..83419e5 100644 (file)
@@ -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();