diff options
4 files changed, 100 insertions, 1 deletions
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GenericConfigurationNotificationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GenericConfigurationNotificationRPCTest.java new file mode 100644 index 00000000..5d611801 --- /dev/null +++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GenericConfigurationNotificationRPCTest.java @@ -0,0 +1,38 @@ +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.GenericConfigurationNotificationInput; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.GenericConfigurationNotificationOutput; +import org.opendaylight.yangtools.yang.common.RpcResult; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.information.ServiceInformationBuilder; + +import static org.junit.Assert.assertNull; +import static org.onap.sdnc.northbound.util.MDSALUtil.*; + +@RunWith(MockitoJUnitRunner.class) +public class GenericConfigurationNotificationRPCTest extends GenericResourceApiProviderTest { + + private static final String SVC_OPERATION = "generic-configuration-notification"; + + @Before + public void setUp() throws Exception { + super.setUp(); + svcClient.setScvOperation(SVC_OPERATION); + } + + @Test + public void should_complete_with_success_when_no_errors() throws Exception { + + GenericConfigurationNotificationInput input = build(GenericConfigurationNotificationInput() + .setServiceInformation(new ServiceInformationBuilder().setServiceInstanceId("serviceInstanceId").build())); + + GenericConfigurationNotificationOutput output = + exec(genericResourceApiProvider::genericConfigurationNotification, input, RpcResult::getResult); + + assertNull(output); + } +} + 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 index 3962484a..629b485c 100644 --- 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 @@ -13,6 +13,8 @@ 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.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.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.information.ServiceInformationBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.configuration.information.ConfigurationInformationBuilder; import org.opendaylight.yangtools.yang.common.RpcResult; import static org.junit.Assert.assertEquals; @@ -46,8 +48,19 @@ public class GenericConfigurationTopologyOperationRPCTest extends GenericResourc assertEquals("Y", output.getAckFinalIndicator()); } + @Test + public void should_fail_when_valid_vnf_topology() throws Exception { + GenericConfigurationTopologyOperationInput input = build(GenericConfigurationTopologyOperationInput() + .setServiceInformation(new ServiceInformationBuilder().setServiceInstanceId("ServiceInsatnceId").build())); -} + GenericConfigurationTopologyOperationOutput output = + exec(genericResourceApiProvider::genericConfigurationTopologyOperation, input, RpcResult::getResult); + assertEquals("404", output.getResponseCode()); + assertEquals("invalid input, null or empty configuration-id or configuration-type", 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 index b73bd113..ff2a4351 100644 --- 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 @@ -33,4 +33,16 @@ public class PolicyUpdateNotifyOperationRPCTest extends GenericResourceApiProvid assertEquals("404", output.getErrorCode()); assertEquals("Invalid input, missing input data", output.getErrorMsg()); } + + @Test + public void should_fail_when_valid_vnf_topology() throws Exception { + + PolicyUpdateNotifyOperationInput input = build(PolicyUpdateNotifyOperationInput().setPolicyName("PolicyName").setUpdateType("UpdateType").setVersionId("vID")); + + PolicyUpdateNotifyOperationOutput output = + exec(genericResourceApiProvider::policyUpdateNotifyOperation, input, RpcResult::getResult); + + assertEquals("503", output.getErrorCode()); + assertEquals("No service logic active for generic-resource-api: 'policy-update-notify-operation'", 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 index 00000000..dd3e5d90 --- /dev/null +++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PortMirrorTopologyOperationRPCTest.java @@ -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()); + } +} |