summaryrefslogtreecommitdiffstats
path: root/dataChange/provider
diff options
context:
space:
mode:
authorJeremy Wolf <jw720x@us.att.com>2018-03-28 17:22:09 +0000
committerJeremy Wolf <jw720x@us.att.com>2018-03-28 17:22:09 +0000
commitc50170bc44f192a7c8e7efdfc773342d8b5c0437 (patch)
tree0a65234525d6d8eddd926c478537fa3ea46aa7dd /dataChange/provider
parent7ee6690d42bdfbc1685b1ea1c40dc4015bd271e8 (diff)
coverage sli-northbound
adding junit test files for AsdcApiSliClient, AsdcApiUtil, DataChangeClient, SdncFlatJsonDmaapConsumer, SdncARModel, SdncNodeModel, SdncVFCModel, SdncVFModuleModel, SdncUebCallback Change-Id: Ia7fb307b84957292f9080654c7ae31992434317f Issue-ID: CCSDK-230 Signed-off-by: Jeremy Wolf <jw720x@us.att.com>
Diffstat (limited to 'dataChange/provider')
-rw-r--r--dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/DataChangeClientTest.java56
1 files changed, 56 insertions, 0 deletions
diff --git a/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/DataChangeClientTest.java b/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/DataChangeClientTest.java
new file mode 100644
index 000000000..9ba6c8742
--- /dev/null
+++ b/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/DataChangeClientTest.java
@@ -0,0 +1,56 @@
+package org.onap.sdnc.northbound.dataChange;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+import java.util.Properties;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.ccsdk.sli.core.sli.SvcLogicException;
+import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper;
+import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService;
+import org.onap.ccsdk.sli.northbound.DataChangeClient;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationOutputBuilder;
+
+public class DataChangeClientTest {
+
+ SvcLogicService mockSvcLogicService;
+ String module = "test-module";
+ String rpc = "test-rpc";
+ String version = "test-version";
+ String mode = "test-mode";
+ Properties localProp = new Properties();
+
+ @Before
+ public void setUp() throws Exception {
+ mockSvcLogicService = mock(SvcLogicService.class);
+ when(mockSvcLogicService.hasGraph(module, rpc, version, mode)).thenReturn(true);
+ }
+
+ @Test
+ public void testDataChangeClientConstructor() {
+ DataChangeClient dataChangeClient = new DataChangeClient(mockSvcLogicService);
+ assertNotNull(dataChangeClient);
+ }
+
+ @Test
+ public void testHasGraph() throws SvcLogicException {
+ DataChangeClient dataChangeClient = new DataChangeClient(mockSvcLogicService);
+ boolean result = dataChangeClient.hasGraph(module, rpc, version, mode);
+ assertTrue(result);
+ }
+
+ @Test
+ public void testExecuteSvcLogicStatusFailure() throws SvcLogicException {
+ DataChangeNotificationOutputBuilder serviceData = mock(DataChangeNotificationOutputBuilder.class);
+ Properties parms = mock(Properties.class);
+ SvcLogicService svcLogicService = mock(SvcLogicService.class);
+ Properties properties = new Properties();
+ properties.setProperty("SvcLogic.status", "failure");
+ when(svcLogicService.execute(module, rpc, version, mode, properties)).thenReturn(properties);
+ DataChangeClient sliClient = new DataChangeClient(svcLogicService);
+ Properties prop = sliClient.execute(module, rpc, version, mode, serviceData, properties);
+ assertTrue(prop != null);
+ }
+} \ No newline at end of file