Merge "Test case addition for sdnc code coverage"
authorDan Timoney <dtimoney@att.com>
Mon, 12 Aug 2019 13:12:01 +0000 (13:12 +0000)
committerGerrit Code Review <gerrit@onap.org>
Mon, 12 Aug 2019 13:12:01 +0000 (13:12 +0000)
generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GetpathsegmentTopologyOperationRPCTest.java [new file with mode: 0644]
generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PolicyUpdateNotifyOperationRPCTest.java [new file with mode: 0644]
generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PortMirrorTopologyOperationRPCTest.java [new file with mode: 0644]

diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GetpathsegmentTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GetpathsegmentTopologyOperationRPCTest.java
new file mode 100644 (file)
index 0000000..e97df5d
--- /dev/null
@@ -0,0 +1,37 @@
+package org.onap.sdnc.northbound;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.GetpathsegmentTopologyOperationInput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.GetpathsegmentTopologyOperationOutput;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+
+import static org.junit.Assert.assertEquals;
+import static org.onap.sdnc.northbound.util.MDSALUtil.*;
+
+@RunWith(MockitoJUnitRunner.class)
+public class GetpathsegmentTopologyOperationRPCTest extends GenericResourceApiProviderTest {
+
+    private static final String SVC_OPERATION = "getpathsegment-topology-operation";
+
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+        svcClient.setScvOperation(SVC_OPERATION);
+    }
+
+    @Test
+    public void should_fail_when_invalid_vnf_topology() throws Exception {
+
+        GetpathsegmentTopologyOperationInput input = build(GetpathsegmentTopologyOperationInput());
+
+        GetpathsegmentTopologyOperationOutput output =
+                exec(genericResourceApiProvider::getpathsegmentTopologyOperation, input, RpcResult::getResult);
+
+        assertEquals("404", output.getResponseCode());
+        assertEquals("invalid input, null or empty service-instance-id", output.getResponseMessage());
+        assertEquals("Y", output.getAckFinalIndicator());
+    }
+}
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PolicyUpdateNotifyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PolicyUpdateNotifyOperationRPCTest.java
new file mode 100644 (file)
index 0000000..b73bd11
--- /dev/null
@@ -0,0 +1,36 @@
+package org.onap.sdnc.northbound;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PolicyUpdateNotifyOperationInput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PolicyUpdateNotifyOperationOutput;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+
+import static org.junit.Assert.assertEquals;
+import static org.onap.sdnc.northbound.util.MDSALUtil.*;
+
+@RunWith(MockitoJUnitRunner.class)
+public class PolicyUpdateNotifyOperationRPCTest extends GenericResourceApiProviderTest {
+
+    private static final String SVC_OPERATION = "policy-update-notify-operation";
+
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+        svcClient.setScvOperation(SVC_OPERATION);
+    }
+
+    @Test
+    public void should_fail_when_invalid_vnf_topology() throws Exception {
+
+        PolicyUpdateNotifyOperationInput input = build(PolicyUpdateNotifyOperationInput());
+
+        PolicyUpdateNotifyOperationOutput output =
+                exec(genericResourceApiProvider::policyUpdateNotifyOperation, input, RpcResult::getResult);
+
+        assertEquals("404", output.getErrorCode());
+        assertEquals("Invalid input, missing input data", output.getErrorMsg());
+    }
+}
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PortMirrorTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PortMirrorTopologyOperationRPCTest.java
new file mode 100644 (file)
index 0000000..dd3e5d9
--- /dev/null
@@ -0,0 +1,36 @@
+package org.onap.sdnc.northbound;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PortMirrorTopologyOperationInput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PortMirrorTopologyOperationOutput;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+
+import static org.junit.Assert.assertEquals;
+import static org.onap.sdnc.northbound.util.MDSALUtil.*;
+
+@RunWith(MockitoJUnitRunner.class)
+public class PortMirrorTopologyOperationRPCTest extends GenericResourceApiProviderTest {
+
+    private static final String SVC_OPERATION = "policy-update-notify-operation";
+
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+        svcClient.setScvOperation(SVC_OPERATION);
+    }
+
+    @Test
+    public void should_fail_when_invalid_vnf_topology() throws Exception {
+
+        PortMirrorTopologyOperationInput input = build(PortMirrorTopologyOperationInput());
+
+        PortMirrorTopologyOperationOutput output =
+                exec(genericResourceApiProvider::portMirrorTopologyOperation, input, RpcResult::getResult);
+
+        assertEquals("404", output.getResponseCode());
+        assertEquals("invalid input, null or empty service-instance-id", output.getResponseMessage());
+    }
+}