aboutsummaryrefslogtreecommitdiffstats
path: root/vnfapi/provider/src/test/java
diff options
context:
space:
mode:
authorpawel.kadlubanski <pawel.kadlubanski@nokia.com>2018-02-20 14:22:30 +0100
committerpawel.kadlubanski <pawel.kadlubanski@nokia.com>2018-02-20 14:24:16 +0100
commitd6f411054a03befc485ef6c1913c80bff36621da (patch)
treef148272e61630d7f81d34b07f710369396e085dc /vnfapi/provider/src/test/java
parentc4254fe8d4865c8e767fb6e614d8d72d7e41db53 (diff)
Add tests to VnfApiProvider part 3
Write test for function vnfInstanceTopologyOperation in vnfapiProvider class. Case when svcLogicClient svcLogicClient execute method returns not null. Change-Id: Ia00b6d8ce2370920035424c6095e1d31611aaeb1 Issue-ID: SDNC-267 Signed-off-by: pawel.kadlubanski <pawel.kadlubanski@nokia.com>
Diffstat (limited to 'vnfapi/provider/src/test/java')
-rw-r--r--vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfApiProviderTest.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfApiProviderTest.java b/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfApiProviderTest.java
index 5cc34e0c..6c2cbe0e 100644
--- a/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfApiProviderTest.java
+++ b/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfApiProviderTest.java
@@ -45,6 +45,7 @@ import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.r
import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.request.information.VnfInstanceRequestInformationBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.service.data.VnfInstanceServiceDataBuilder;
+import java.util.Properties;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
@@ -55,6 +56,9 @@ public class VnfApiProviderTest extends AbstractConcurrentDataBrokerTest {
private static final String VIID = "viid";
private static final String PRELOAD_NAME = "preloadName";
private static final String PRELOAD_TYPE = "preloadType";
+ private static final String ERROR_CODE = "error-code";
+ private static final String ERROR_MESSAGE = "error-message";
+ private static final String ACK_FINAL = "ack-final";
protected VnfApiProvider vnfapiProvider;
protected DataBroker dataBroker;
@@ -175,6 +179,35 @@ public class VnfApiProviderTest extends AbstractConcurrentDataBrokerTest {
Mockito.any()))
.thenThrow(exceptionClass.asSubclass(Throwable.class));
}
+
+ @Test
+ public void vnfInstanceTopologyOperationInput_svcLogicClientExecuteReturnsNotNull() throws Exception {
+ VnfInstanceTopologyOperationInputBuilder builder = new VnfInstanceTopologyOperationInputBuilder();
+ builder.setVnfInstanceRequestInformation(createVnfInstanceRequestInformation(VIID));
+ VnfInstanceTopologyOperationInput input = builder.build();
+
+ Properties properties = prop().set(ERROR_CODE, "500")
+ .set(ERROR_MESSAGE, ERROR_MESSAGE)
+ .set(ACK_FINAL, "Y")
+ .build();
+
+ Mockito.when(mockVNFSDNSvcLogicServiceClient
+ .hasGraph(Mockito.any(),Mockito.any(), Mockito.any(),Mockito.any()))
+ .thenReturn(true);
+
+ Mockito.when(mockVNFSDNSvcLogicServiceClient
+ .execute(Mockito.any(),
+ Mockito.any(),
+ Mockito.any(),
+ Mockito.any(),
+ Mockito.any(VnfInstanceServiceDataBuilder.class),
+ Mockito.any()))
+ .thenReturn(properties);
+
+
+ checkVnfInstanceTopologyOperation(input, "500", ERROR_MESSAGE);
+ }
+
private VnfInstanceRequestInformation createVnfInstanceRequestInformation(String vnfInstanceId) {
return new VnfInstanceRequestInformationBuilder()
.setVnfInstanceId(vnfInstanceId)