diff options
author | 2018-03-04 14:53:33 +0200 | |
---|---|---|
committer | 2018-03-07 13:19:05 +0000 | |
commit | a5445100050e49e83f73424198d73cd72d672a4d (patch) | |
tree | cacf4df817df31be23e4e790d1dda857bdae061e /catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathDeleteCITest.java | |
parent | 51157f92c21976cba4914c378aaa3cba49826931 (diff) |
Sync Integ to Master
Change-Id: I71e3acc26fa612127756ac04073a522b9cc6cd74
Issue-ID: SDC-977
Signed-off-by: Gitelman, Tal (tg851x) <tg851x@intl.att.com>
Diffstat (limited to 'catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathDeleteCITest.java')
-rw-r--r-- | catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathDeleteCITest.java | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathDeleteCITest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathDeleteCITest.java new file mode 100644 index 0000000000..e5de493cb1 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathDeleteCITest.java @@ -0,0 +1,74 @@ +package org.openecomp.sdc.be.components.path; + +import org.junit.Before; +import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.ForwardingPathElementDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition; +import org.openecomp.sdc.be.impl.ForwardingPathUtils; +import org.openecomp.sdc.be.model.Service; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +public class ForwardingPathDeleteCITest { + + private Service service; + private static final String nodeA = "nodeA"; + private static final String nodeB = "nodeB"; + private static final String fpName = "fpName"; + + @Before + public void initService() { + service = new Service(); + ForwardingPathDataDefinition forwardingPath = new ForwardingPathDataDefinition(fpName); + String protocol = "protocol"; + forwardingPath.setProtocol(protocol); + forwardingPath.setDestinationPortNumber("DestinationPortNumber"); + ListDataDefinition<ForwardingPathElementDataDefinition> forwardingPathElementListDataDefinition + = new ListDataDefinition<>(); + + forwardingPathElementListDataDefinition.add( + new ForwardingPathElementDataDefinition(nodeA, nodeB, "nodeAcpType", "nodeBcpType", "nodeDcpName", + "nodeBcpName")); + forwardingPathElementListDataDefinition.add( + new ForwardingPathElementDataDefinition(nodeB, "nodeC", "nodeBcpType", "nodeCcpType", "nodeDcpName", + "nodeBcpName")); + forwardingPathElementListDataDefinition.add( + new ForwardingPathElementDataDefinition("nodeC", "nodeD", "nodeCcpType", "nodeDcpType", "nodeDcpName", + "nodeBcpName")); + forwardingPath.setPathElements(forwardingPathElementListDataDefinition); + Map<String, ForwardingPathDataDefinition> forwardingPaths = new HashMap<>(); + forwardingPaths.put("NEW", forwardingPath); + service.setForwardingPaths(forwardingPaths); + } + + + @Test + public void getListToDelete() { + + Set<String> forwardingPathNamesToDeleteOnComponenetInstanceDeletion = new ForwardingPathUtils() + .findForwardingPathNamesToDeleteOnComponentInstanceDeletion(service, nodeA); + assertEquals(1, forwardingPathNamesToDeleteOnComponenetInstanceDeletion.size()); + assertTrue(forwardingPathNamesToDeleteOnComponenetInstanceDeletion.contains(fpName)); + + Set<String> forwardingPathNamesToDeleteOnCIDelete = new ForwardingPathUtils() + .findForwardingPathNamesToDeleteOnComponentInstanceDeletion(service, nodeB); + assertNotNull(forwardingPathNamesToDeleteOnCIDelete); + assertEquals(1, forwardingPathNamesToDeleteOnCIDelete.size()); + assertTrue(forwardingPathNamesToDeleteOnComponenetInstanceDeletion.contains(fpName)); + + forwardingPathNamesToDeleteOnCIDelete = new ForwardingPathUtils() + .findForwardingPathNamesToDeleteOnComponentInstanceDeletion(service, "Does not exist"); + assertNotNull(forwardingPathNamesToDeleteOnCIDelete); + assertEquals(0, forwardingPathNamesToDeleteOnCIDelete.size()); + assertFalse(forwardingPathNamesToDeleteOnCIDelete.contains(fpName)); + } + +} |