From bb5be2989a75d48a56877e1bf5135a0bec68f43e Mon Sep 17 00:00:00 2001 From: "Arun S. Yerra" Date: Fri, 22 Sep 2017 15:20:32 -0700 Subject: Implement test cases for fabric discovery plugin This change adds a negative test case to test input from directed graph to start listening to domain controller notifications. Issue-id: CCSDK-96 Change-Id: I2dd1a4d2264df4c142362e242e04bf9495e0351a Signed-off-by: Arun S. Yerra --- .../fabricdiscovery/TestFabricDiscoveryPlugin.java | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/fabric-discovery-plugin/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/fabricdiscovery/TestFabricDiscoveryPlugin.java b/fabric-discovery-plugin/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/fabricdiscovery/TestFabricDiscoveryPlugin.java index f5dc7cbc0..ac0461889 100644 --- a/fabric-discovery-plugin/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/fabricdiscovery/TestFabricDiscoveryPlugin.java +++ b/fabric-discovery-plugin/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/fabricdiscovery/TestFabricDiscoveryPlugin.java @@ -17,6 +17,8 @@ public class TestFabricDiscoveryPlugin { private static final Logger LOG = LoggerFactory.getLogger(TestFabricDiscoveryPlugin.class); private static final String C_STREAM = "ws://localhost:8185/data-change-event-subscription/network-topology:network-topology/datastore=CONFIGURATION/scope=BASE"; + private static final String W_STREAM = + "get://localhost:8185/data-change-event-subscription/network-topology:network/datastore=CONFIGURATION/scope=BASE"; private final String FB_DISCOVERY_STATUS = "fb-response"; @Test @@ -32,4 +34,25 @@ public class TestFabricDiscoveryPlugin { fdp.processDcNotificationStream(p, ctx); Assert.assertEquals("Success", ctx.getAttribute(FB_DISCOVERY_STATUS)); } + + @Test + public void connectToNotificationServerFailure() throws Exception { + SvcLogicContext ctx = new SvcLogicContext(); + String stream = W_STREAM; + + Map p = new HashMap<>(); + p.put("stream", stream); + p.put("enable", "true"); + + FabricDiscoveryPlugin fdp = new FabricDiscoveryPlugin(); + try { + fdp.processDcNotificationStream(p, ctx); + LOG.info("Connection to Stream:{} succeeded.", stream); + } catch (Exception e) { + LOG.info("Received Exception while connecting to Fabric Discovery notification server: {}", e.getMessage()); + } finally { + Assert.assertEquals("Failure", ctx.getAttribute(FB_DISCOVERY_STATUS)); + } + } + } -- cgit 1.2.3-korg