aboutsummaryrefslogtreecommitdiffstats
path: root/generic-resource-api/provider/src
diff options
context:
space:
mode:
authorprakash.e <prakash.e@huawei.com>2019-08-09 18:36:52 +0530
committerprakash.e <prakash.e@huawei.com>2019-08-09 23:45:51 +0530
commit163008c4770de406175e1ebe9f049beee7ba7cd2 (patch)
tree8def18bfc47120e7586e4c35782413891838600b /generic-resource-api/provider/src
parent8b309d6e6a73f2d16d699da2e63e886522085887 (diff)
Test case added for code coverage
Added new test case for GenericConfigurationTopologyOperation Change-Id: Ie660b70e109725618d2470c0af30d0f326c125b2 Issue-ID: SDNC-840 Signed-off-by: Prakash.E <prakash.e@huawei.com>
Diffstat (limited to 'generic-resource-api/provider/src')
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GenericConfigurationTopologyOperationRPCTest.java53
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/MDSALUtil.java8
2 files changed, 61 insertions, 0 deletions
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GenericConfigurationTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GenericConfigurationTopologyOperationRPCTest.java
new file mode 100644
index 00000000..3962484a
--- /dev/null
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GenericConfigurationTopologyOperationRPCTest.java
@@ -0,0 +1,53 @@
+package org.onap.sdnc.northbound;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.sdnc.northbound.util.PropBuilder;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionChainClosedException;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.GenericConfigurationTopologyOperationInput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.GenericConfigurationTopologyOperationOutput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.request.information.RequestInformation;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sdnc.request.header.SdncRequestHeader.SvcAction;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import static org.onap.sdnc.northbound.GenericResourceApiProvider.APP_NAME;
+import static org.onap.sdnc.northbound.GenericResourceApiProvider.NO_SERVICE_LOGIC_ACTIVE;
+import static org.onap.sdnc.northbound.util.MDSALUtil.*;
+
+@RunWith(MockitoJUnitRunner.class)
+public class GenericConfigurationTopologyOperationRPCTest extends GenericResourceApiProviderTest {
+
+ private static final String SVC_OPERATION = "generic-configuration-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 {
+
+ GenericConfigurationTopologyOperationInput input = build(GenericConfigurationTopologyOperationInput());
+
+ GenericConfigurationTopologyOperationOutput output =
+ exec(genericResourceApiProvider::genericConfigurationTopologyOperation, 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/util/MDSALUtil.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/MDSALUtil.java
index d959b9f2..a6300d6a 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/MDSALUtil.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/MDSALUtil.java
@@ -36,6 +36,10 @@ import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.re
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadNetworkTopologyOperationOutputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVfModuleTopologyOperationInputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVfModuleTopologyOperationOutputBuilder;
+
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.GenericConfigurationTopologyOperationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.GenericConfigurationTopologyOperationOutputBuilder;
+
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.SecurityZoneTopologyOperationInputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.SecurityZoneTopologyOperationOutputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServiceTopologyOperationInputBuilder;
@@ -111,6 +115,10 @@ public class MDSALUtil {
return new PreloadVfModuleTopologyOperationInputBuilder();
}
+ public static GenericConfigurationTopologyOperationInputBuilder GenericConfigurationTopologyOperationInput() {
+ return new GenericConfigurationTopologyOperationInputBuilder();
+ }
+
public static PreloadVfModuleTopologyOperationOutputBuilder preloadVfModuleTopologyOperationOutput() {
return new PreloadVfModuleTopologyOperationOutputBuilder();
}