aboutsummaryrefslogtreecommitdiffstats
path: root/generic-resource-api/provider/src
diff options
context:
space:
mode:
authorJakub Dudycz <jakub.dudycz@nokia.com>2018-03-22 16:43:48 +0100
committerJakub Dudycz <jakub.dudycz@nokia.com>2018-03-22 16:43:48 +0100
commit957aad2599fe9e694dbe63f900f272c1028687e2 (patch)
tree948d5e65cf6da76590059519ac406a2c758c1dc5 /generic-resource-api/provider/src
parent894476cd13c0045d8ce44bf77f1729a3f44c0e10 (diff)
GenericResourceApiProvider unit tests part 7.
Added unit tests for tunnelxconnTopologyOperation and brgTopologyOperation methods Change-Id: I2172a62bddb3f394caf93c56ed2078efc153f3ea Issue-ID: SDNC-275 Signed-off-by: Jakub Dudycz <jakub.dudycz@nokia.com>
Diffstat (limited to 'generic-resource-api/provider/src')
-rw-r--r--generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java32
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/BrgTopologyOperationRPCTest.java146
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/TunnelxconnTopologyOperationRPCTest.java146
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/GenericResourceApiSvcLogicServiceClientMockUtil.java70
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/MDSALUtil.java30
5 files changed, 387 insertions, 37 deletions
diff --git a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java
index 099d723c..6c6e424e 100644
--- a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java
+++ b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java
@@ -1722,25 +1722,25 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
// Call SLI sync method
// Get SvcLogicService reference
- ResponseObject error = new ResponseObject("200", "");
+ ResponseObject responseObject = new ResponseObject("200", "");
String ackFinal = "Y";
String allottedResourceId = ERROR_NETWORK_ID;
String serviceObjectPath = null;
String tunnelxconnObjectPath = null;
- Properties respProps = tryGetProperties(svcOperation, parms, error);
+ Properties respProps = tryGetProperties(svcOperation, parms, responseObject);
if (respProps != null) {
- error.setStatusCode(respProps.getProperty(ERROR_CODE_PARAM));
- error.setMessage(respProps.getProperty(ERROR_MESSAGE_PARAM));
+ responseObject.setStatusCode(respProps.getProperty(ERROR_CODE_PARAM));
+ responseObject.setMessage(respProps.getProperty(ERROR_MESSAGE_PARAM));
ackFinal = respProps.getProperty(ACK_FINAL_PARAM, "Y");
allottedResourceId = respProps.getProperty(ALLOTTED_RESOURCE_ID_PARAM);
serviceObjectPath = respProps.getProperty(SERVICE_OBJECT_PATH_PARAM);
tunnelxconnObjectPath = respProps.getProperty("tunnelxconn-object-path");
}
- if (failed(error)) {
- responseBuilder.setResponseCode(error.getStatusCode());
- responseBuilder.setResponseMessage(error.getMessage());
+ if (failed(responseObject)) {
+ responseBuilder.setResponseCode(responseObject.getStatusCode());
+ responseBuilder.setResponseMessage(responseObject.getMessage());
responseBuilder.setAckFinalIndicator(ackFinal);
log.error(RETURNED_FAILED_MESSAGE, svcOperation, siid, responseBuilder.build());
@@ -1781,9 +1781,9 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
}
// Update succeeded
- responseBuilder.setResponseCode(error.getStatusCode());
+ responseBuilder.setResponseCode(responseObject.getStatusCode());
responseBuilder.setAckFinalIndicator(ackFinal);
- trySetResponseMessage(responseBuilder, error);
+ trySetResponseMessage(responseBuilder, responseObject);
log.info(UPDATED_MDSAL_INFO_MESSAGE, svcOperation, siid);
log.info(RETURNED_SUCCESS_MESSAGE, svcOperation, siid, responseBuilder.build());
@@ -1808,7 +1808,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
|| input.getServiceInformation().getServiceInstanceId().length() == 0;
}
- private Properties tryGetProperties(String svcOperation, Properties parms, ResponseObject error) {
+ private Properties tryGetProperties(String svcOperation, Properties parms, ResponseObject responseObject) {
try {
if (svcLogicClient.hasGraph(APP_NAME, svcOperation, null, "sync")) {
@@ -1816,16 +1816,16 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
return svcLogicClient.execute(APP_NAME, svcOperation, null, "sync", parms);
} catch (Exception e) {
log.error(SERVICE_LOGIC_EXECUTION_ERROR_MESSAGE, svcOperation, e);
- error.setMessage(e.getMessage());
- error.setStatusCode("500");
+ responseObject.setMessage(e.getMessage());
+ responseObject.setStatusCode("500");
}
} else {
- error.setMessage(NO_SERVICE_LOGIC_ACTIVE + APP_NAME + ": '" + svcOperation + "'");
- error.setStatusCode("503");
+ responseObject.setMessage(NO_SERVICE_LOGIC_ACTIVE + APP_NAME + ": '" + svcOperation + "'");
+ responseObject.setStatusCode("503");
}
} catch (Exception e) {
- error.setMessage(e.getMessage());
- error.setStatusCode("500");
+ responseObject.setMessage(e.getMessage());
+ responseObject.setStatusCode("500");
log.error(SERVICE_LOGIC_SEARCH_ERROR_MESSAGE, e);
}
return null;
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/BrgTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/BrgTopologyOperationRPCTest.java
new file mode 100644
index 00000000..ec00c363
--- /dev/null
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/BrgTopologyOperationRPCTest.java
@@ -0,0 +1,146 @@
+package org.onap.sdnc.northbound;
+
+import static org.junit.Assert.assertEquals;
+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.GenericResourceApiProvider.NULL_OR_EMPTY_ERROR_PARAM;
+import static org.onap.sdnc.northbound.util.MDSALUtil.brgResponseInformation;
+import static org.onap.sdnc.northbound.util.MDSALUtil.brgTopologyOperationInput;
+import static org.onap.sdnc.northbound.util.MDSALUtil.brgTopologyOperationOutput;
+import static org.onap.sdnc.northbound.util.MDSALUtil.build;
+import static org.onap.sdnc.northbound.util.MDSALUtil.exec;
+import static org.onap.sdnc.northbound.util.MDSALUtil.requestInformation;
+import static org.onap.sdnc.northbound.util.MDSALUtil.sdncRequestHeader;
+import static org.onap.sdnc.northbound.util.MDSALUtil.serviceInformationBuilder;
+import static org.onap.sdnc.northbound.util.MDSALUtil.serviceResponseInformation;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.sdnc.northbound.util.PropBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.BrgTopologyOperationInput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.BrgTopologyOperationOutput;
+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;
+
+@RunWith(MockitoJUnitRunner.class)
+public class BrgTopologyOperationRPCTest extends GenericResourceApiProviderTest {
+
+ private static final String SVC_OPERATION = "brg-topology-operation";
+
+
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ svcClient.setScvOperation(SVC_OPERATION);
+ }
+
+ @Test
+ public void should_fail_when_service_instance_id_not_present() throws Exception {
+
+ BrgTopologyOperationInput input = build(brgTopologyOperationInput());
+
+ BrgTopologyOperationOutput output =
+ exec(genericResourceApiProvider::brgTopologyOperation, input, RpcResult::getResult);
+
+ assertEquals("404", output.getResponseCode());
+ assertEquals(NULL_OR_EMPTY_ERROR_PARAM, output.getResponseMessage());
+ assertEquals("Y", output.getAckFinalIndicator());
+ }
+
+ @Test
+ public void should_fail_when_client_execution_failed() throws Exception {
+
+ svcClient.mockHasGraph(true);
+ svcClient.mockExecuteWoServiceData(new RuntimeException("test exception"));
+
+ BrgTopologyOperationInput input = build(brgTopologyOperationInput()
+ .setSdncRequestHeader(build(sdncRequestHeader()
+ .setSvcRequestId("test-svc-request-id")
+ .setSvcAction(SvcAction.Assign)
+ ))
+ .setServiceInformation(build(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id")
+ ))
+ );
+
+ BrgTopologyOperationOutput output =
+ exec(genericResourceApiProvider::brgTopologyOperation, input, RpcResult::getResult);
+
+ assertEquals("500", output.getResponseCode());
+ assertEquals("test exception", output.getResponseMessage());
+ assertEquals("Y", output.getAckFinalIndicator());
+ }
+
+ @Test
+ public void should_fail_when_client_has_no_graph() throws Exception {
+
+ svcClient.mockHasGraph(false);
+
+ BrgTopologyOperationInput input = build(brgTopologyOperationInput()
+ .setSdncRequestHeader(build(sdncRequestHeader()
+ .setSvcRequestId("test-svc-request-id")
+ .setSvcAction(SvcAction.Assign)
+ ))
+ .setServiceInformation(build(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id")
+ ))
+ );
+
+ BrgTopologyOperationOutput output =
+ exec(genericResourceApiProvider::brgTopologyOperation, input, RpcResult::getResult);
+
+ assertEquals("503", output.getResponseCode());
+ assertEquals(NO_SERVICE_LOGIC_ACTIVE + APP_NAME + ": '" + SVC_OPERATION + "'", output.getResponseMessage());
+ assertEquals("Y", output.getAckFinalIndicator());
+ }
+
+ @Test
+ public void should_success_when_no_errors_encountered() throws Exception {
+
+ svcClient.mockHasGraph(true);
+ PropBuilder svcResultProp = svcClient.createExecuteOKResult();
+ svcResultProp.set("security-zone-object-path", "securityZoneObjectPath: XYZ");
+ svcClient.mockExecuteWoServiceData(svcResultProp);
+
+ BrgTopologyOperationInput input = build(brgTopologyOperationInput()
+ .setRequestInformation(build(requestInformation()
+ .setRequestId("test-request-id")
+ .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance)
+ ))
+ .setServiceInformation(build(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id")
+ ))
+ );
+
+ BrgTopologyOperationOutput output =
+ exec(genericResourceApiProvider::brgTopologyOperation, input, RpcResult::getResult);
+
+ assertEquals("200", output.getResponseCode());
+ assertEquals("OK", output.getResponseMessage());
+ assertEquals("Y", output.getAckFinalIndicator());
+
+ BrgTopologyOperationOutput expectedOutput = createExpectedOutput(svcResultProp, input);
+ assertEquals(expectedOutput, output);
+
+ }
+
+ private BrgTopologyOperationOutput createExpectedOutput(PropBuilder propBuilder,
+ BrgTopologyOperationInput input) {
+
+ return build(brgTopologyOperationOutput()
+ .setBrgResponseInformation(build(brgResponseInformation()
+ .setObjectPath(propBuilder.get("brg-object-path"))))
+ .setResponseCode(propBuilder.get(svcClient.errorCode))
+ .setAckFinalIndicator(propBuilder.get(svcClient.ackFinal))
+ .setResponseMessage(propBuilder.get(svcClient.errorMessage))
+ .setServiceResponseInformation(build(serviceResponseInformation()
+ .setInstanceId(input.getServiceInformation().getServiceInstanceId())
+ .setObjectPath(propBuilder.get(svcClient.serviceObjectPath))
+ ))
+ );
+ }
+
+}
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/TunnelxconnTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/TunnelxconnTopologyOperationRPCTest.java
new file mode 100644
index 00000000..2e1f1cb1
--- /dev/null
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/TunnelxconnTopologyOperationRPCTest.java
@@ -0,0 +1,146 @@
+package org.onap.sdnc.northbound;
+
+import static org.junit.Assert.assertEquals;
+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.GenericResourceApiProvider.NULL_OR_EMPTY_ERROR_PARAM;
+import static org.onap.sdnc.northbound.util.MDSALUtil.build;
+import static org.onap.sdnc.northbound.util.MDSALUtil.exec;
+import static org.onap.sdnc.northbound.util.MDSALUtil.requestInformation;
+import static org.onap.sdnc.northbound.util.MDSALUtil.sdncRequestHeader;
+import static org.onap.sdnc.northbound.util.MDSALUtil.serviceInformationBuilder;
+import static org.onap.sdnc.northbound.util.MDSALUtil.serviceResponseInformation;
+import static org.onap.sdnc.northbound.util.MDSALUtil.tunnelxconnResponseInformation;
+import static org.onap.sdnc.northbound.util.MDSALUtil.tunnelxconnTopologyOperationInput;
+import static org.onap.sdnc.northbound.util.MDSALUtil.tunnelxconnTopologyOperationOutput;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.sdnc.northbound.util.PropBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.TunnelxconnTopologyOperationInput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.TunnelxconnTopologyOperationOutput;
+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;
+
+@RunWith(MockitoJUnitRunner.class)
+public class TunnelxconnTopologyOperationRPCTest extends GenericResourceApiProviderTest {
+
+
+ private static final String SVC_OPERATION = "tunnelxconn-topology-operation";
+
+
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ svcClient.setScvOperation(SVC_OPERATION);
+ }
+
+ @Test
+ public void should_fail_when_service_instance_id_not_present() throws Exception {
+
+ TunnelxconnTopologyOperationInput input = build(tunnelxconnTopologyOperationInput());
+
+ TunnelxconnTopologyOperationOutput output =
+ exec(genericResourceApiProvider::tunnelxconnTopologyOperation, input, RpcResult::getResult);
+
+ assertEquals("404", output.getResponseCode());
+ assertEquals(NULL_OR_EMPTY_ERROR_PARAM, output.getResponseMessage());
+ assertEquals("Y", output.getAckFinalIndicator());
+ }
+
+ @Test
+ public void should_fail_when_client_execution_failed() throws Exception {
+
+ svcClient.mockHasGraph(true);
+ svcClient.mockExecuteWoServiceData(new RuntimeException("test exception"));
+
+ TunnelxconnTopologyOperationInput input = build(tunnelxconnTopologyOperationInput()
+ .setSdncRequestHeader(build(sdncRequestHeader()
+ .setSvcRequestId("test-svc-request-id")
+ .setSvcAction(SvcAction.Assign)
+ ))
+ .setServiceInformation(build(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id")
+ ))
+ );
+
+ TunnelxconnTopologyOperationOutput output =
+ exec(genericResourceApiProvider::tunnelxconnTopologyOperation, input, RpcResult::getResult);
+
+ assertEquals("500", output.getResponseCode());
+ assertEquals("test exception", output.getResponseMessage());
+ assertEquals("Y", output.getAckFinalIndicator());
+ }
+
+ @Test
+ public void should_fail_when_client_has_no_graph() throws Exception {
+
+ svcClient.mockHasGraph(false);
+
+ TunnelxconnTopologyOperationInput input = build(tunnelxconnTopologyOperationInput()
+ .setSdncRequestHeader(build(sdncRequestHeader()
+ .setSvcRequestId("test-svc-request-id")
+ .setSvcAction(SvcAction.Assign)
+ ))
+ .setServiceInformation(build(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id")
+ ))
+ );
+
+ TunnelxconnTopologyOperationOutput output =
+ exec(genericResourceApiProvider::tunnelxconnTopologyOperation, input, RpcResult::getResult);
+
+ assertEquals("503", output.getResponseCode());
+ assertEquals(NO_SERVICE_LOGIC_ACTIVE + APP_NAME + ": '" + SVC_OPERATION + "'", output.getResponseMessage());
+ assertEquals("Y", output.getAckFinalIndicator());
+ }
+
+ @Test
+ public void should_success_when_no_errors_encountered() throws Exception {
+
+ svcClient.mockHasGraph(true);
+ PropBuilder svcResultProp = svcClient.createExecuteOKResult();
+ svcResultProp.set("security-zone-object-path", "securityZoneObjectPath: XYZ");
+ svcClient.mockExecuteWoServiceData(svcResultProp);
+
+ TunnelxconnTopologyOperationInput input = build(tunnelxconnTopologyOperationInput()
+ .setRequestInformation(build(requestInformation()
+ .setRequestId("test-request-id")
+ .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance)
+ ))
+ .setServiceInformation(build(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id")
+ ))
+ );
+
+ TunnelxconnTopologyOperationOutput output =
+ exec(genericResourceApiProvider::tunnelxconnTopologyOperation, input, RpcResult::getResult);
+
+ assertEquals("200", output.getResponseCode());
+ assertEquals("OK", output.getResponseMessage());
+ assertEquals("Y", output.getAckFinalIndicator());
+
+ TunnelxconnTopologyOperationOutput expectedOutput = createExpectedOutput(svcResultProp, input);
+ assertEquals(expectedOutput, output);
+
+ }
+
+ private TunnelxconnTopologyOperationOutput createExpectedOutput(PropBuilder propBuilder,
+ TunnelxconnTopologyOperationInput input) {
+
+ return build(tunnelxconnTopologyOperationOutput()
+ .setTunnelxconnResponseInformation(build(tunnelxconnResponseInformation()
+ .setObjectPath(propBuilder.get("tunnelxconn-object-path"))))
+ .setResponseCode(propBuilder.get(svcClient.errorCode))
+ .setAckFinalIndicator(propBuilder.get(svcClient.ackFinal))
+ .setResponseMessage(propBuilder.get(svcClient.errorMessage))
+ .setServiceResponseInformation(build(serviceResponseInformation()
+ .setInstanceId(input.getServiceInformation().getServiceInstanceId())
+ .setObjectPath(propBuilder.get(svcClient.serviceObjectPath))
+ ))
+ );
+ }
+}
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/GenericResourceApiSvcLogicServiceClientMockUtil.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/GenericResourceApiSvcLogicServiceClientMockUtil.java
index 650147fd..784717d9 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/GenericResourceApiSvcLogicServiceClientMockUtil.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/GenericResourceApiSvcLogicServiceClientMockUtil.java
@@ -56,21 +56,24 @@ public class GenericResourceApiSvcLogicServiceClientMockUtil {
private final GenericResourceApiSvcLogicServiceClient mockGenericResourceApiSvcLogicServiceClient;
-
- public GenericResourceApiSvcLogicServiceClientMockUtil(GenericResourceApiSvcLogicServiceClient mockGenericResourceApiSvcLogicServiceClient) {
+ public GenericResourceApiSvcLogicServiceClientMockUtil(
+ GenericResourceApiSvcLogicServiceClient mockGenericResourceApiSvcLogicServiceClient) {
this.mockGenericResourceApiSvcLogicServiceClient = mockGenericResourceApiSvcLogicServiceClient;
}
- /** @param scvOperation - The scvOperation parameter to use on the {@link GenericResourceApiSvcLogicServiceClient} methods */
+ /**
+ * @param scvOperation - The scvOperation parameter to use on the {@link GenericResourceApiSvcLogicServiceClient}
+ * methods
+ */
public void setScvOperation(String scvOperation) {
this.scvOperation = scvOperation;
}
/**
- * Configure {@link GenericResourceApiSvcLogicServiceClient#hasGraph(String, String, String, String)}
- * to return the specified value when when invoked with the parameters
- * {@link #MODULE}, {@link #MODE}, {@link #VERSION} and {@link #scvOperation}
+ * Configure {@link GenericResourceApiSvcLogicServiceClient#hasGraph(String, String, String, String)} to return the
+ * specified value when when invoked with the parameters {@link #MODULE}, {@link #MODE}, {@link #VERSION} and {@link
+ * #scvOperation}
*/
public void mockHasGraph(Boolean isHasGraph) throws Exception {
when(
@@ -85,29 +88,27 @@ public class GenericResourceApiSvcLogicServiceClientMockUtil {
/**
- * @return
- * PropBuilder - A PropBuilder populated with the expected properties returned from
- * {@link GenericResourceApiSvcLogicServiceClient#execute(String, String, String, String, ServiceDataBuilder, Properties)}
+ * @return PropBuilder - A PropBuilder populated with the expected properties returned from {@link
+ * GenericResourceApiSvcLogicServiceClient#execute(String, String, String, String, ServiceDataBuilder, Properties)}
*/
- public PropBuilder createExecuteOKResult(){
+ public PropBuilder createExecuteOKResult() {
return propBuilder()
- .set(errorCode,"200")
- .set(errorMessage,"OK")
- .set(ackFinal,"Y")
- .set(serviceObjectPath,"serviceObjectPath: XYZ")
- .set(networkObjectPath,"networkObjectPath: XYZ")
- .set(networkId,"networkId: XYZ");
+ .set(errorCode, "200")
+ .set(errorMessage, "OK")
+ .set(ackFinal, "Y")
+ .set(serviceObjectPath, "serviceObjectPath: XYZ")
+ .set(networkObjectPath, "networkObjectPath: XYZ")
+ .set(networkId, "networkId: XYZ");
}
/**
- * Configure
- * {@link GenericResourceApiSvcLogicServiceClient#execute(String, String, String, String, ServiceDataBuilder, Properties)}
- * to return the specified svcResultProp when when invoked with the parameters
+ * Configure {@link GenericResourceApiSvcLogicServiceClient#execute(String, String, String, String,
+ * ServiceDataBuilder, Properties)} to return the specified svcResultProp when when invoked with the parameters
* {@link #MODULE}, {@link #MODE}, {@link #VERSION} and {@link #scvOperation}
*/
- public void mockExecute(PropBuilder svcResultProp) throws Exception{
+ public void mockExecute(PropBuilder svcResultProp) throws Exception {
when(
mockGenericResourceApiSvcLogicServiceClient
.execute(
@@ -120,7 +121,7 @@ public class GenericResourceApiSvcLogicServiceClientMockUtil {
).thenReturn(build(svcResultProp));
}
- public void mockExecute(RuntimeException exception) throws Exception{
+ public void mockExecute(RuntimeException exception) throws Exception {
when(
mockGenericResourceApiSvcLogicServiceClient
.execute(
@@ -134,4 +135,31 @@ public class GenericResourceApiSvcLogicServiceClientMockUtil {
).thenThrow(exception);
}
+
+ public void mockExecuteWoServiceData(PropBuilder svcResultProp) throws Exception {
+ when(
+ mockGenericResourceApiSvcLogicServiceClient
+ .execute(
+ eq(MODULE),
+ eq(scvOperation),
+ eq(VERSION),
+ eq(MODE),
+ isA(Properties.class))
+ ).thenReturn(build(svcResultProp));
+ }
+
+ public void mockExecuteWoServiceData(RuntimeException exception) throws Exception {
+ when(
+ mockGenericResourceApiSvcLogicServiceClient
+ .execute(
+ eq(MODULE),
+ eq(scvOperation),
+ eq(VERSION),
+ eq(MODE),
+ isA(Properties.class)
+ )
+ ).thenThrow(exception);
+ }
+
+
}
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 ef11e128..1c3c5969 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
@@ -24,6 +24,8 @@ package org.onap.sdnc.northbound.util;
import java.util.concurrent.Future;
import java.util.function.Consumer;
import java.util.function.Function;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.BrgTopologyOperationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.BrgTopologyOperationOutputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ContrailRouteTopologyOperationInputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ContrailRouteTopologyOperationOutputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.NetworkTopologyOperationInputBuilder;
@@ -32,10 +34,13 @@ 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.SecurityZoneTopologyOperationOutputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServiceTopologyOperationInputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServiceTopologyOperationOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.TunnelxconnTopologyOperationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.TunnelxconnTopologyOperationOutputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VfModuleTopologyOperationInputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VfModuleTopologyOperationOutputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VnfTopologyOperationInputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VnfTopologyOperationOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.brg.response.information.BrgResponseInformationBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.contrail.route.response.information.ContrailRouteResponseInformationBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.information.NetworkInformationBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.response.information.NetworkResponseInformationBuilder;
@@ -48,6 +53,7 @@ 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.service.model.infrastructure.ServiceBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.response.information.ServiceResponseInformationBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.status.ServiceStatusBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.tunnelxconn.response.information.TunnelxconnResponseInformationBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.information.VfModuleInformationBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.information.VnfInformationBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.response.information.VnfResponseInformationBuilder;
@@ -82,6 +88,22 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
*/
public class MDSALUtil {
+ public static BrgTopologyOperationInputBuilder brgTopologyOperationInput() {
+ return new BrgTopologyOperationInputBuilder();
+ }
+
+ public static BrgTopologyOperationOutputBuilder brgTopologyOperationOutput() {
+ return new BrgTopologyOperationOutputBuilder();
+ }
+
+ public static TunnelxconnTopologyOperationInputBuilder tunnelxconnTopologyOperationInput() {
+ return new TunnelxconnTopologyOperationInputBuilder();
+ }
+
+ public static TunnelxconnTopologyOperationOutputBuilder tunnelxconnTopologyOperationOutput() {
+ return new TunnelxconnTopologyOperationOutputBuilder();
+ }
+
public static SecurityZoneTopologyOperationInputBuilder securityZoneTopologyOperationInput() {
return new SecurityZoneTopologyOperationInputBuilder();
}
@@ -140,6 +162,14 @@ public class MDSALUtil {
return new SecurityZoneResponseInformationBuilder();
}
+ public static TunnelxconnResponseInformationBuilder tunnelxconnResponseInformation() {
+ return new TunnelxconnResponseInformationBuilder();
+ }
+
+ public static BrgResponseInformationBuilder brgResponseInformation() {
+ return new BrgResponseInformationBuilder();
+ }
+
public static ContrailRouteResponseInformationBuilder contrailRouteResponseInformation() {
return new ContrailRouteResponseInformationBuilder();
}