summaryrefslogtreecommitdiffstats
path: root/vnfapi/provider/src/test
diff options
context:
space:
mode:
authorpawel.kadlubanski <pawel.kadlubanski@nokia.com>2018-02-22 16:07:01 +0100
committerpawel.kadlubanski <pawel.kadlubanski@nokia.com>2018-02-27 14:12:39 +0100
commit75c4c587354928db3893d1900bc8b3d6b4b3ef4b (patch)
treebae3322310b6d030e3fcc65bf8b4bc36de717ab9 /vnfapi/provider/src/test
parentd6f411054a03befc485ef6c1913c80bff36621da (diff)
Add tests to VnfApiProvider part 4
Write test for function vnfInstanceTopologyOperation in vnfapiProvider class. Case when svcLogicClient svcLogicClient execute method returns null but exception is thrown during transaction writing. Issue-ID: SDNC-267 Change-Id: I28c833938297032eaa717001cae8810ab007e9b7 Signed-off-by: pawel.kadlubanski <pawel.kadlubanski@nokia.com>
Diffstat (limited to 'vnfapi/provider/src/test')
-rw-r--r--vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfApiProviderTest.java173
-rw-r--r--vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfInstanceTopologyOperationTest.java250
2 files changed, 250 insertions, 173 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 6c2cbe0e..458e6d41 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
@@ -21,13 +21,8 @@
package org.onap.sdnc.vnfapi;
-import org.junit.Assert;
import org.junit.Before;
-import org.junit.Test;
import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.sdnc.vnfapi.util.DataBrokerUtil;
import org.onap.sdnc.vnfapi.util.PropBuilder;
import org.onap.sdnc.vnfapi.util.VNFSDNSvcLogicServiceClientMockUtil;
@@ -37,28 +32,9 @@ import org.opendaylight.controller.md.sal.binding.test.AbstractConcurrentDataBro
import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationInput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.request.information.VnfInstanceRequestInformation;
-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;
public class VnfApiProviderTest extends AbstractConcurrentDataBrokerTest {
- private static final String INVALID_INPUT = "invalid input, null or empty vnf-instance-id";
- private static final String NO_SERVICE_LOGIC = "No service logic active for VNF-API: \'vnf-instance-topology-operation\'";
- 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;
@@ -70,10 +46,8 @@ public class VnfApiProviderTest extends AbstractConcurrentDataBrokerTest {
protected DataBrokerUtil db;
protected VNFSDNSvcLogicServiceClientMockUtil svcClient;
-
@Before
public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
svcClient = new VNFSDNSvcLogicServiceClientMockUtil(mockVNFSDNSvcLogicServiceClient);
dataBroker = getDataBroker();
db = new DataBrokerUtil(dataBroker);
@@ -90,154 +64,7 @@ public class VnfApiProviderTest extends AbstractConcurrentDataBrokerTest {
}
}
-
public static PropBuilder prop(){
return (new PropBuilder());
}
-
- @Test
- public void vnfInstanceTopologyOperationInputIsNull() throws Exception {
- VnfInstanceTopologyOperationInput input = null;
- checkVnfInstanceTopologyOperation(input, "403", INVALID_INPUT);
- }
-
-
- @Test
- public void vnfInstanceTopologyOperationInput_VnfInstanceRequestInformationIsNull() throws Exception {
- VnfInstanceTopologyOperationInputBuilder builder = new VnfInstanceTopologyOperationInputBuilder();
- builder.setVnfInstanceRequestInformation(null);
- VnfInstanceTopologyOperationInput input = builder.build();
-
- checkVnfInstanceTopologyOperation(input, "403", INVALID_INPUT);
- }
-
- @Test
- public void vnfInstanceTopologyOperationInput_getVnfInstanceRequestInformationVnfInstanceIdIsNull() throws Exception {
- VnfInstanceTopologyOperationInputBuilder builder = new VnfInstanceTopologyOperationInputBuilder();
- builder.setVnfInstanceRequestInformation(createVnfInstanceRequestInformation(null));
- VnfInstanceTopologyOperationInput input = builder.build();
-
- checkVnfInstanceTopologyOperation(input, "403", INVALID_INPUT);
- }
-
- @Test
- public void vnfInstanceTopologyOperationInput_VnfInstanceRequestInformationVnfInstanceIdIsZero() throws Exception {
- VnfInstanceTopologyOperationInputBuilder builder = new VnfInstanceTopologyOperationInputBuilder();
- builder.setVnfInstanceRequestInformation(createVnfInstanceRequestInformation(""));
- VnfInstanceTopologyOperationInput input = builder.build();
-
- checkVnfInstanceTopologyOperation(input, "403", INVALID_INPUT);
- }
-
- @Test
- public void vnfInstanceTopologyOperationInput_svcLogicClientHasGrapheReturnFalse() throws Exception {
- VnfInstanceTopologyOperationInputBuilder builder = new VnfInstanceTopologyOperationInputBuilder();
- builder.setVnfInstanceRequestInformation(createVnfInstanceRequestInformation(VIID));
- VnfInstanceTopologyOperationInput input = builder.build();
-
- Mockito.when(mockVNFSDNSvcLogicServiceClient
- .hasGraph(Mockito.any(),Mockito.any(), Mockito.any(),Mockito.any()))
- .thenReturn(false);
-
- checkVnfInstanceTopologyOperation(input, "503", NO_SERVICE_LOGIC);
- }
-
-
- @Test
- public void vnfInstanceTopologyOperationInput_svcLogicClientExecuteThrowsSvcLogicException() throws Exception {
- VnfInstanceTopologyOperationInputBuilder builder = new VnfInstanceTopologyOperationInputBuilder();
- builder.setVnfInstanceRequestInformation(createVnfInstanceRequestInformation(VIID));
- VnfInstanceTopologyOperationInput input = builder.build();
-
- Mockito.when(mockVNFSDNSvcLogicServiceClient
- .hasGraph(Mockito.any(),Mockito.any(), Mockito.any(),Mockito.any()))
- .thenReturn(true);
- setMockVNFSDNSvcLogicServiceClientToThrowException(SvcLogicException.class);
- checkVnfInstanceTopologyOperation(input, "500", null);
- }
-
- @Test
- public void vnfInstanceTopologyOperationInput_svcLogicClientExecuteThrowsException() throws Exception {
- VnfInstanceTopologyOperationInputBuilder builder = new VnfInstanceTopologyOperationInputBuilder();
- builder.setVnfInstanceRequestInformation(createVnfInstanceRequestInformation(VIID));
- VnfInstanceTopologyOperationInput input = builder.build();
-
- Mockito.when(mockVNFSDNSvcLogicServiceClient
- .hasGraph(Mockito.any(),Mockito.any(), Mockito.any(),Mockito.any()))
- .thenReturn(true);
- setMockVNFSDNSvcLogicServiceClientToThrowException(Exception.class);
- checkVnfInstanceTopologyOperation(input, "500", null);
- }
-
- private void setMockVNFSDNSvcLogicServiceClientToThrowException(Class exceptionClass) throws Exception {
- Mockito.when(mockVNFSDNSvcLogicServiceClient
- .execute(Mockito.any(),
- Mockito.any(),
- Mockito.any(),
- Mockito.any(),
- Mockito.any(VnfInstanceServiceDataBuilder.class),
- 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)
- .setVnfInstanceName(PRELOAD_NAME)
- .setVnfModelId(PRELOAD_TYPE)
- .build();
- }
-
- private void checkVnfInstanceTopologyOperation(VnfInstanceTopologyOperationInput input,
- String expectedResponseCode, String expectedResponseMessage) throws ExecutionException, InterruptedException {
-
- VnfInstanceTopologyOperationOutput output = executeVnfInstanceTopologyOperation(input);
- checkVnfInstanceTopologyOperationOutput(output, expectedResponseCode, expectedResponseMessage);
- }
-
- private VnfInstanceTopologyOperationOutput executeVnfInstanceTopologyOperation(
- VnfInstanceTopologyOperationInput input) throws ExecutionException, InterruptedException {
- return vnfapiProvider
- .vnfInstanceTopologyOperation(input)
- .get()
- .getResult();
- }
-
- private void checkVnfInstanceTopologyOperationOutput(VnfInstanceTopologyOperationOutput result,
- String expectedResponseCode, String expectedResponseMessage) {
-
- String expectedAckFinalIndicator = "Y";
-
- Assert.assertEquals(result.getResponseCode(), expectedResponseCode );
- Assert.assertEquals(result.getResponseMessage(), expectedResponseMessage);
- Assert.assertEquals(result.getAckFinalIndicator(), expectedAckFinalIndicator);
- }
} \ No newline at end of file
diff --git a/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfInstanceTopologyOperationTest.java b/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfInstanceTopologyOperationTest.java
new file mode 100644
index 00000000..26c9b306
--- /dev/null
+++ b/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfInstanceTopologyOperationTest.java
@@ -0,0 +1,250 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.sdnc.vnfapi;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.Mockito;
+import org.onap.ccsdk.sli.core.sli.SvcLogicException;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+import org.opendaylight.controller.md.sal.binding.impl.BindingDOMDataBrokerAdapter;
+import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec;
+import org.opendaylight.controller.md.sal.binding.test.AbstractDataBrokerTestCustomizer;
+import org.opendaylight.controller.md.sal.binding.test.ConcurrentDataBrokerTestCustomizer;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationInput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationOutput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.request.information.VnfInstanceRequestInformation;
+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;
+
+class DataBrokerErrorMsgConfigurator {
+ static public String JAVA_LANG_RUNTIME_EXCEPTION = "java.lang.RuntimeException: ";
+ static public String TRANSACTION_WRITE_ERROR = "transaction-write-error";
+}
+
+class DataBrokerStab extends BindingDOMDataBrokerAdapter {
+ public DataBrokerStab(final DOMDataBroker domDataBroker, final BindingToNormalizedNodeCodec codec) {
+ super(domDataBroker, codec);
+
+ }
+
+ @Override
+ public WriteTransaction newWriteOnlyTransaction() {
+ WriteTransaction mockWriteTransaction = Mockito.mock(WriteTransaction.class);
+ Mockito.doThrow(new RuntimeException(DataBrokerErrorMsgConfigurator.TRANSACTION_WRITE_ERROR))
+ .when(mockWriteTransaction).put(Mockito.any(), Mockito.any(), Mockito.any());
+ return mockWriteTransaction;
+ }
+}
+
+class VnfApiProviderDataBrokerTestCustomizer extends ConcurrentDataBrokerTestCustomizer {
+ public DataBroker createDataBroker() {
+ return new DataBrokerStab(createDOMDataBroker(), super.getBindingToNormalized());
+ }
+}
+
+@RunWith(MockitoJUnitRunner.class)
+public class VnfInstanceTopologyOperationTest extends VnfApiProviderTest {
+ protected static final Logger LOG = LoggerFactory.getLogger(VnfInstanceTopologyOperationTest.class);
+
+ private static final String INVALID_INPUT = "invalid input, null or empty vnf-instance-id";
+ private static final String NO_SERVICE_LOGIC = "No service logic active for VNF-API: \'vnf-instance-topology-operation\'";
+ 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";
+ private static final String SVC_OPERATION = "vnf-topology-operation";
+
+ @Override
+ protected AbstractDataBrokerTestCustomizer createDataBrokerTestCustomizer() {
+ return new VnfApiProviderDataBrokerTestCustomizer();
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ svcClient.setScvOperation(SVC_OPERATION);
+ }
+
+ @Test
+ public void vnfInstanceTopologyOperationInputIsNull() throws Exception {
+ VnfInstanceTopologyOperationInput input = null;
+ checkVnfInstanceTopologyOperation(input, "403", INVALID_INPUT);
+ }
+
+ @Test
+ public void vnfInstanceTopologyOperationInput_VnfInstanceRequestInformationIsNull() throws Exception {
+ VnfInstanceTopologyOperationInputBuilder builder = new VnfInstanceTopologyOperationInputBuilder();
+ builder.setVnfInstanceRequestInformation(null);
+ VnfInstanceTopologyOperationInput input = builder.build();
+ checkVnfInstanceTopologyOperation(input, "403", INVALID_INPUT);
+ }
+
+ @Test
+ public void vnfInstanceTopologyOperationInput_getVnfInstanceRequestInformationVnfInstanceIdIsNull() throws Exception {
+ VnfInstanceTopologyOperationInputBuilder builder = new VnfInstanceTopologyOperationInputBuilder();
+ builder.setVnfInstanceRequestInformation(createVnfInstanceRequestInformation(null));
+ VnfInstanceTopologyOperationInput input = builder.build();
+ checkVnfInstanceTopologyOperation(input, "403", INVALID_INPUT);
+ }
+
+ @Test
+ public void vnfInstanceTopologyOperationInput_VnfInstanceRequestInformationVnfInstanceIdIsZero() throws Exception {
+ VnfInstanceTopologyOperationInputBuilder builder = new VnfInstanceTopologyOperationInputBuilder();
+ builder.setVnfInstanceRequestInformation(createVnfInstanceRequestInformation(""));
+ VnfInstanceTopologyOperationInput input = builder.build();
+ checkVnfInstanceTopologyOperation(input, "403", INVALID_INPUT);
+ }
+
+ @Test
+ public void vnfInstanceTopologyOperationInput_svcLogicClientHasGrapheReturnFalse() throws Exception {
+ VnfInstanceTopologyOperationInputBuilder builder = new VnfInstanceTopologyOperationInputBuilder();
+ builder.setVnfInstanceRequestInformation(createVnfInstanceRequestInformation(VIID));
+ VnfInstanceTopologyOperationInput input = builder.build();
+ setReturnForSvcLogicServiceClientHasGraph(false);
+ checkVnfInstanceTopologyOperation(input, "503", NO_SERVICE_LOGIC);
+ }
+
+ @Test
+ public void vnfInstanceTopologyOperationInput_svcLogicClientExecuteThrowsSvcLogicException() throws Exception {
+ VnfInstanceTopologyOperationInputBuilder builder = new VnfInstanceTopologyOperationInputBuilder();
+ builder.setVnfInstanceRequestInformation(createVnfInstanceRequestInformation(VIID));
+ VnfInstanceTopologyOperationInput input = builder.build();
+ setReturnForSvcLogicServiceClientHasGraph(true);
+ setMockVNFSDNSvcLogicServiceClientToThrowException(SvcLogicException.class);
+ checkVnfInstanceTopologyOperation(input, "500", null);
+ }
+
+ @Test
+ public void vnfInstanceTopologyOperationInput_svcLogicClientExecuteThrowsException() throws Exception {
+ VnfInstanceTopologyOperationInputBuilder builder = new VnfInstanceTopologyOperationInputBuilder();
+ builder.setVnfInstanceRequestInformation(createVnfInstanceRequestInformation(VIID));
+ VnfInstanceTopologyOperationInput input = builder.build();
+
+ setReturnForSvcLogicServiceClientHasGraph(true);
+ setMockVNFSDNSvcLogicServiceClientToThrowException(Exception.class);
+ checkVnfInstanceTopologyOperation(input, "500", null);
+ }
+
+ @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();
+
+ setReturnForSvcLogicServiceClientHasGraph(true);
+ setReturnForSvcLogicServiceClientExecute(properties);
+ checkVnfInstanceTopologyOperation(input, "500", ERROR_MESSAGE);
+ }
+
+ @Test
+ public void vnfInstanceTopologyOperationInput_svcLogicClientExecuteReturnsNull() throws Exception {
+ VnfInstanceTopologyOperationInputBuilder builder = new VnfInstanceTopologyOperationInputBuilder();
+ builder.setVnfInstanceRequestInformation(createVnfInstanceRequestInformation(VIID));
+ VnfInstanceTopologyOperationInput input = builder.build();
+
+ setReturnForSvcLogicServiceClientHasGraph(true);
+ setReturnForSvcLogicServiceClientExecute(null);
+ String expectedErrorMsg = DataBrokerErrorMsgConfigurator.JAVA_LANG_RUNTIME_EXCEPTION
+ + DataBrokerErrorMsgConfigurator.TRANSACTION_WRITE_ERROR;
+ checkVnfInstanceTopologyOperation(input, "500", expectedErrorMsg);
+ }
+
+ private void checkVnfInstanceTopologyOperation(VnfInstanceTopologyOperationInput input,
+ String expectedResponseCode, String expectedResponseMessage) throws ExecutionException, InterruptedException {
+
+ VnfInstanceTopologyOperationOutput output = executeVnfInstanceTopologyOperation(input);
+ checkVnfInstanceTopologyOperationOutput(output, expectedResponseCode, expectedResponseMessage);
+ }
+
+ private VnfInstanceTopologyOperationOutput executeVnfInstanceTopologyOperation(
+ VnfInstanceTopologyOperationInput input) throws ExecutionException, InterruptedException {
+ return vnfapiProvider
+ .vnfInstanceTopologyOperation(input)
+ .get()
+ .getResult();
+ }
+
+ private void checkVnfInstanceTopologyOperationOutput(VnfInstanceTopologyOperationOutput result,
+ String expectedResponseCode, String expectedResponseMessage) {
+
+ String expectedAckFinalIndicator = "Y";
+
+ Assert.assertEquals(expectedResponseCode , result.getResponseCode());
+ Assert.assertEquals(expectedResponseMessage, result.getResponseMessage());
+ Assert.assertEquals(expectedAckFinalIndicator, result.getAckFinalIndicator());
+ }
+
+ private void setReturnForSvcLogicServiceClientHasGraph(Boolean returnValue) throws Exception{
+ Mockito.when(mockVNFSDNSvcLogicServiceClient
+ .hasGraph(Mockito.any(),Mockito.any(), Mockito.any(),Mockito.any()))
+ .thenReturn(returnValue);
+ }
+
+ private void setReturnForSvcLogicServiceClientExecute(Properties properties) throws Exception{
+ Mockito.when(mockVNFSDNSvcLogicServiceClient
+ .execute(Mockito.any(),
+ Mockito.any(),
+ Mockito.any(),
+ Mockito.any(),
+ Mockito.any(VnfInstanceServiceDataBuilder.class),
+ Mockito.any()))
+ .thenReturn(properties);
+ }
+
+ private void setMockVNFSDNSvcLogicServiceClientToThrowException(Class exceptionClass) throws Exception {
+ Mockito.when(mockVNFSDNSvcLogicServiceClient
+ .execute(Mockito.any(),
+ Mockito.any(),
+ Mockito.any(),
+ Mockito.any(),
+ Mockito.any(VnfInstanceServiceDataBuilder.class),
+ Mockito.any()))
+ .thenThrow(exceptionClass.asSubclass(Throwable.class));
+ }
+
+ private VnfInstanceRequestInformation createVnfInstanceRequestInformation(String vnfInstanceId) {
+ return new VnfInstanceRequestInformationBuilder()
+ .setVnfInstanceId(vnfInstanceId)
+ .setVnfInstanceName(PRELOAD_NAME)
+ .setVnfModelId(PRELOAD_TYPE)
+ .build();
+ }
+}