diff options
Diffstat (limited to 'mod/bpgenerator/src/test/java')
-rw-r--r-- | mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapNodeTest.java | 39 |
1 files changed, 31 insertions, 8 deletions
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 d117cd5..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,9 +21,15 @@ 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; +import static org.onap.blueprintgenerator.models.blueprint.BpConstants.FEED; +import static org.onap.blueprintgenerator.models.blueprint.BpConstants.SUBSCRIBE_TO_EVENTS; +import static org.onap.blueprintgenerator.models.blueprint.BpConstants.SUBSCRIBE_TO_FILES; +import static org.onap.blueprintgenerator.models.blueprint.BpConstants.TOPIC; import java.util.Map; import java.util.TreeMap; @@ -37,8 +43,6 @@ import org.onap.blueprintgenerator.models.componentspec.Subscribes; public class DmaapNodeTest { - private static final String EXPECTED_DMAAP_NODE_TYPE = "dcae.nodes.ContainerizedServiceComponentUsingDmaap"; - private static final String DATA_ROUTER_TYPE = "data_router"; private static final String MESSAGE_ROUTER_TYPE = "message_router"; @@ -59,7 +63,7 @@ public class DmaapNodeTest { DmaapNode dmaapNode = new DmaapNode(); dmaapNode.createDmaapNode(mockedComponentSpec, new TreeMap<>(), ""); - assertEquals(EXPECTED_DMAAP_NODE_TYPE, dmaapNode.getType()); + assertEquals(CONTENERIZED_SERVICE_COMPONENT_USING_DMAAP, dmaapNode.getType()); } @Test @@ -112,7 +116,7 @@ public class DmaapNodeTest { Map<String, String> relationship = dmaapNode.getRelationships().get(0); - assertNotNull(relationship.get(TYPE)); + assertEquals(SUBSCRIBE_TO_EVENTS, relationship.get(TYPE)); assertNotNull(relationship.get(TARGET)); } @@ -130,7 +134,7 @@ public class DmaapNodeTest { Map<String, String> relationship = dmaapNode.getRelationships().get(0); - assertNotNull(relationship.get(TYPE)); + assertEquals(SUBSCRIBE_TO_FILES, relationship.get(TYPE)); assertNotNull(relationship.get(TARGET)); } @@ -139,9 +143,19 @@ public class DmaapNodeTest { ComponentSpec componentSpec = getSpiedComponentSpecWithoutRelationships(); DmaapNode dmaapNode = new DmaapNode(); + dmaapNode.createFeedNode(componentSpec, new TreeMap<>(), ""); + + assertEquals(FEED, dmaapNode.getType()); + } + + @Test + public void feedNodePropertiesShouldHaveUseExistingField() { + ComponentSpec componentSpec = getSpiedComponentSpecWithoutRelationships(); + + DmaapNode dmaapNode = new DmaapNode(); dmaapNode.createFeedNode(componentSpec, new TreeMap<>() ,""); - assertTrue(dmaapNode.getType().endsWith("Feed")); + assertTrue(dmaapNode.getProperties().getUseExisting()); } @Test @@ -150,9 +164,19 @@ public class DmaapNodeTest { ComponentSpec componentSpec = getSpiedComponentSpecWithoutRelationships(); DmaapNode dmaapNode = new DmaapNode(); + dmaapNode.createTopicNode(componentSpec, new TreeMap<>(), ""); + + assertEquals(TOPIC, dmaapNode.getType()); + } + + @Test + public void topicNodePropertiesShouldNotHaveUseExistingField() { + ComponentSpec componentSpec = getSpiedComponentSpecWithoutRelationships(); + + DmaapNode dmaapNode = new DmaapNode(); dmaapNode.createTopicNode(componentSpec, new TreeMap<>() ,""); - assertTrue(dmaapNode.getType().endsWith("Topic")); + assertNull(dmaapNode.getProperties().getUseExisting()); } private Publishes[] createSamplePublishes(String type) { @@ -196,6 +220,5 @@ public class DmaapNodeTest { when(componentSpec.getPolicyInfo()).thenReturn(null); return componentSpec; - } } |