summaryrefslogtreecommitdiffstats
path: root/asdcApi
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 /asdcApi
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 'asdcApi')
-rw-r--r--asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiSliClientTest.java59
-rw-r--r--asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiUtilTest.java15
2 files changed, 74 insertions, 0 deletions
diff --git a/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiSliClientTest.java b/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiSliClientTest.java
new file mode 100644
index 000000000..5e6a9daf7
--- /dev/null
+++ b/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiSliClientTest.java
@@ -0,0 +1,59 @@
+package org.onap.ccsdk.sli.northbound.asdcapi;
+
+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.SvcLogicService;
+
+public class AsdcApiSliClientTest {
+ Properties mockProp;
+ Properties propReturn;
+ AsdcApiSliClient testAsdcApiSliClient;
+
+ @Before
+ public void setup() {
+ SvcLogicService mockSvcLogic = mock(SvcLogicService.class);
+ mockProp = new Properties();
+ mockProp.setProperty("test-value1", "value1");
+ propReturn = new Properties();
+ propReturn.setProperty("SvcLogic.status", "Success");
+ propReturn.setProperty("Object1", "value1");
+ try {
+ when(mockSvcLogic.hasGraph("TestModule", "TestRPC", "TestVersion", "TestMode")).thenReturn(true);
+ when(mockSvcLogic.hasGraph("NotExist", "TestRPC", "TestVersion", "TestMode")).thenReturn(false);
+ when(mockSvcLogic.execute("TestModule", "TestRPC", "TestVersion", "TestMode", mockProp)).thenReturn(propReturn);
+ } catch (Exception e) {
+ System.out.println(e);
+ }
+
+ testAsdcApiSliClient = new AsdcApiSliClient(mockSvcLogic);
+ }
+
+ @Test
+ public void testhasGraphGraphExsists() throws SvcLogicException {
+ assertTrue(testAsdcApiSliClient.hasGraph("TestModule", "TestRPC", "TestVersion", "TestMode"));
+ }
+
+ @Test
+ public void testhasGraphnoGraph() throws SvcLogicException {
+ assertFalse(testAsdcApiSliClient.hasGraph("NotExist", "TestRPC", "TestVersion", "TestMode"));
+ }
+
+ @Test
+ public void testExecutewithSvcLogicSuccess() throws SvcLogicException {
+ Properties result = testAsdcApiSliClient.execute("TestModule", "TestRPC", "TestVersion", "TestMode", mockProp);
+ assertEquals(result.getProperty("error-code"), "200");
+ }
+
+ @Test
+ public void testExecutewithSvcLogicFailure500() throws SvcLogicException {
+ propReturn.setProperty("SvcLogic.status", "failure");
+ Properties result = testAsdcApiSliClient.execute("TestModule", "TestRPC", "TestVersion", "TestMode", mockProp);
+ assertEquals(result.getProperty("error-code"), "500");
+ }
+} \ No newline at end of file
diff --git a/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiUtilTest.java b/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiUtilTest.java
new file mode 100644
index 000000000..463e5ea0b
--- /dev/null
+++ b/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiUtilTest.java
@@ -0,0 +1,15 @@
+package org.onap.ccsdk.sli.northbound.asdcapi;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class AsdcApiUtilTest {
+
+ @Test
+ public void testAsdcApiUtilConstructor() {
+ AsdcApiUtil asdcApiUtilTest = new AsdcApiUtil();
+ assertNotNull(asdcApiUtilTest);
+ }
+
+} \ No newline at end of file