From: Arun S. Yerra Date: Tue, 19 Sep 2017 07:38:58 +0000 (-0700) Subject: Implement test case for Fabric Discovery Plugin X-Git-Tag: v0.1.0~23^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F39%2F13339%2F1;p=ccsdk%2Fsli%2Fplugins.git Implement test case for Fabric Discovery Plugin Fabric Discovery plugin implements framework to connect to fabric update notifications from local domain controllers. This task is to implement unit test case for this module. Issue-Id: CCSDK-96 Change-Id: I3387f248e693a7da6b4817bc27f87dbc86aea806 Signed-off-by: Arun S. Yerra --- 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 new file mode 100644 index 00000000..f5dc7cbc --- /dev/null +++ b/fabric-discovery-plugin/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/fabricdiscovery/TestFabricDiscoveryPlugin.java @@ -0,0 +1,35 @@ +package jtest.org.onap.ccsdk.sli.plugins.fabricdiscovery; + +import java.util.HashMap; +import java.util.Map; +import org.junit.Assert; +import org.junit.Test; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.plugins.fabricdiscovery.FabricDiscoveryPlugin; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Created by arun on 9/18/17. + */ + +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 final String FB_DISCOVERY_STATUS = "fb-response"; + + @Test + public void connectToNotificationServerSuccess() throws Exception { + SvcLogicContext ctx = new SvcLogicContext(); + String stream = C_STREAM; + + Map p = new HashMap(); + p.put("stream", stream); + p.put("enable", "true"); + + FabricDiscoveryPlugin fdp = new FabricDiscoveryPlugin(); + fdp.processDcNotificationStream(p, ctx); + Assert.assertEquals("Success", ctx.getAttribute(FB_DISCOVERY_STATUS)); + } +}