diff options
author | Joanna Jeremicz <joanna.jeremicz@nokia.com> | 2020-09-30 11:39:25 +0200 |
---|---|---|
committer | Joanna Jeremicz <joanna.jeremicz@nokia.com> | 2020-09-30 14:47:59 +0200 |
commit | 04f13ef80c6e79d8c0b7b3fa1faeeaa0def1584e (patch) | |
tree | 894d637bc63f782439c068c0cbd0991a96a17643 /mod/bpgenerator/src/test | |
parent | f51b3e1a957ede6c263d0c3634f36c7fcfbb95ff (diff) |
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 <joanna.jeremicz@nokia.com>
Change-Id: Ic5dc91844b4aefcf7d3d9d25c866a60e63875deb
Diffstat (limited to 'mod/bpgenerator/src/test')
-rw-r--r-- | mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapNodeTest.java | 23 |
1 files changed, 12 insertions, 11 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..6936393 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,13 @@ package org.onap.blueprintgenerator.models.dmaapbp; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -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 +41,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 +61,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 +114,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 +132,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 +141,9 @@ public class DmaapNodeTest { ComponentSpec componentSpec = getSpiedComponentSpecWithoutRelationships(); DmaapNode dmaapNode = new DmaapNode(); - dmaapNode.createFeedNode(componentSpec, new TreeMap<>() ,""); + dmaapNode.createFeedNode(componentSpec, new TreeMap<>(), ""); - assertTrue(dmaapNode.getType().endsWith("Feed")); + assertEquals(FEED, dmaapNode.getType()); } @Test @@ -150,9 +152,9 @@ public class DmaapNodeTest { ComponentSpec componentSpec = getSpiedComponentSpecWithoutRelationships(); DmaapNode dmaapNode = new DmaapNode(); - dmaapNode.createTopicNode(componentSpec, new TreeMap<>() ,""); + dmaapNode.createTopicNode(componentSpec, new TreeMap<>(), ""); - assertTrue(dmaapNode.getType().endsWith("Topic")); + assertEquals(TOPIC, dmaapNode.getType()); } private Publishes[] createSamplePublishes(String type) { @@ -196,6 +198,5 @@ public class DmaapNodeTest { when(componentSpec.getPolicyInfo()).thenReturn(null); return componentSpec; - } } |