diff options
author | Arun S. Yerra <arun.yerra@huawei.com> | 2017-09-22 15:20:32 -0700 |
---|---|---|
committer | Arun S. Yerra <arun.yerra@huawei.com> | 2017-09-22 15:20:32 -0700 |
commit | bb5be2989a75d48a56877e1bf5135a0bec68f43e (patch) | |
tree | 1644d4979d0e29751a8f486251cabfa48273825b | |
parent | 32dafea52a38760178682fa59e4442fa1345f7cb (diff) |
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 <arun.yerra@huawei.com>
-rw-r--r-- | fabric-discovery-plugin/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/fabricdiscovery/TestFabricDiscoveryPlugin.java | 23 |
1 files changed, 23 insertions, 0 deletions
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<String, String> 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)); + } + } + } |