summaryrefslogtreecommitdiffstats
path: root/generic-resource-api/provider
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2022-08-03 11:59:43 -0400
committerDan Timoney <dtimoney@att.com>2022-08-05 16:10:18 -0400
commit219b28ed3c3ee23f10d67c9c50583a8bd5a84f3a (patch)
treee3d5654f7cb1c16d899d652ab25c97992bf635b6 /generic-resource-api/provider
parent2b1dc5b10650ed62f71d4b84ef662b59ed663fc1 (diff)
Changes to support ODL Sulfur update
Changes to sdnc/northbound to conform to changes in OpenDaylight Sulfur release. Many of these changes are due to a change in yangtools, which no longer implements a common ancestor for its builder classes. This broke a utility method used in jUnit test cases (build()), which meant all jUnits using that method had to be updated to call each individual builder's build() method directly. Issue-ID: CCSDK-1728 Signed-off-by: Dan Timoney <dtimoney@att.com> Change-Id: Ia82aa3decd82d873120dd643a6a0427928890f99
Diffstat (limited to 'generic-resource-api/provider')
-rw-r--r--generic-resource-api/provider/pom.xml7
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/BrgTopologyOperationRPCTest.java61
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ConnectionAttachmentTopologyOperationRPCTest.java124
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ContrailRouteTopologyOperationRPCTest.java118
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GenericConfigurationNotificationRPCTest.java4
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GenericConfigurationTopologyOperationRPCTest.java7
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GetpathsegmentTopologyOperationRPCTest.java10
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/NetworkTopologyOperationRPCTest.java105
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PnfTopologyOperationRPCTest.java90
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PolicyUpdateNotifyOperationRPCTest.java4
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PortMirrorTopologyOperationRPCTest.java2
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PreloadNetworkTopologyRPCTest.java64
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PreloadVnfTopologyOperationRPCTest.java181
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/SecurityZoneTopologyOperationRPCTest.java126
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ServiceTopologyOperationRPCTest.java98
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/TunnelxconnTopologyOperationRPCTest.java62
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VfModuleTopologyOperationRPCTest.java125
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VnfTopologyOperationRPCTest.java90
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/DataBrokerUtil.java15
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/GenericResourceApiSvcLogicServiceClientMockUtil.java5
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/MDSALUtil.java23
21 files changed, 625 insertions, 696 deletions
diff --git a/generic-resource-api/provider/pom.xml b/generic-resource-api/provider/pom.xml
index 1e6362fc..4f2bc8a9 100644
--- a/generic-resource-api/provider/pom.xml
+++ b/generic-resource-api/provider/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.3.3</version>
+ <version>2.4.1</version>
<relativePath/>
</parent>
@@ -16,6 +16,10 @@
<name>sdnc-northbound :: generic-resource-api :: ${project.artifactId}</name>
+ <properties>
+ <ccsdk.sli.version>1.5.0-SNAPSHOT</ccsdk.sli.version>
+ </properties>
+
<dependencies>
<dependency>
<groupId>org.onap.sdnc.northbound</groupId>
@@ -66,6 +70,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
+ <version>3.12.4</version>
<scope>test</scope>
</dependency>
</dependencies>
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
index ec00c363..35ffabab 100644
--- 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
@@ -7,7 +7,6 @@ import static org.onap.sdnc.northbound.GenericResourceApiProvider.NULL_OR_EMPTY_
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;
@@ -40,8 +39,7 @@ public class BrgTopologyOperationRPCTest extends GenericResourceApiProviderTest
@Test
public void should_fail_when_service_instance_id_not_present() throws Exception {
- BrgTopologyOperationInput input = build(brgTopologyOperationInput());
-
+ BrgTopologyOperationInput input =brgTopologyOperationInput().build();
BrgTopologyOperationOutput output =
exec(genericResourceApiProvider::brgTopologyOperation, input, RpcResult::getResult);
@@ -56,15 +54,13 @@ public class BrgTopologyOperationRPCTest extends GenericResourceApiProviderTest
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")
- ))
- );
+ BrgTopologyOperationInput input = brgTopologyOperationInput()
+ .setSdncRequestHeader(sdncRequestHeader()
+ .setSvcRequestId("test-svc-request-id")
+ .setSvcAction(SvcAction.Assign)
+ .build())
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()).build();
BrgTopologyOperationOutput output =
exec(genericResourceApiProvider::brgTopologyOperation, input, RpcResult::getResult);
@@ -79,15 +75,13 @@ public class BrgTopologyOperationRPCTest extends GenericResourceApiProviderTest
svcClient.mockHasGraph(false);
- BrgTopologyOperationInput input = build(brgTopologyOperationInput()
- .setSdncRequestHeader(build(sdncRequestHeader()
+ BrgTopologyOperationInput input = brgTopologyOperationInput()
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("test-svc-request-id")
- .setSvcAction(SvcAction.Assign)
- ))
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- );
+ .setSvcAction(SvcAction.Assign).build())
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build())
+ .build();
BrgTopologyOperationOutput output =
exec(genericResourceApiProvider::brgTopologyOperation, input, RpcResult::getResult);
@@ -105,15 +99,13 @@ public class BrgTopologyOperationRPCTest extends GenericResourceApiProviderTest
svcResultProp.set("security-zone-object-path", "securityZoneObjectPath: XYZ");
svcClient.mockExecuteWoServiceData(svcResultProp);
- BrgTopologyOperationInput input = build(brgTopologyOperationInput()
- .setRequestInformation(build(requestInformation()
+ BrgTopologyOperationInput input = brgTopologyOperationInput()
+ .setRequestInformation(requestInformation()
.setRequestId("test-request-id")
- .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance)
- ))
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- );
+ .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance).build())
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()).build();
+
BrgTopologyOperationOutput output =
exec(genericResourceApiProvider::brgTopologyOperation, input, RpcResult::getResult);
@@ -130,17 +122,16 @@ public class BrgTopologyOperationRPCTest extends GenericResourceApiProviderTest
private BrgTopologyOperationOutput createExpectedOutput(PropBuilder propBuilder,
BrgTopologyOperationInput input) {
- return build(brgTopologyOperationOutput()
- .setBrgResponseInformation(build(brgResponseInformation()
- .setObjectPath(propBuilder.get("brg-object-path"))))
+ return brgTopologyOperationOutput()
+ .setBrgResponseInformation(brgResponseInformation()
+ .setObjectPath(propBuilder.get("brg-object-path")).build())
.setResponseCode(propBuilder.get(svcClient.errorCode))
.setAckFinalIndicator(propBuilder.get(svcClient.ackFinal))
.setResponseMessage(propBuilder.get(svcClient.errorMessage))
- .setServiceResponseInformation(build(serviceResponseInformation()
+ .setServiceResponseInformation(serviceResponseInformation()
.setInstanceId(input.getServiceInformation().getServiceInstanceId())
- .setObjectPath(propBuilder.get(svcClient.serviceObjectPath))
- ))
- );
+ .setObjectPath(propBuilder.get(svcClient.serviceObjectPath)).build())
+ .build();
}
}
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ConnectionAttachmentTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ConnectionAttachmentTopologyOperationRPCTest.java
index 7c6082bd..7c75695a 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ConnectionAttachmentTopologyOperationRPCTest.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ConnectionAttachmentTopologyOperationRPCTest.java
@@ -7,7 +7,6 @@ import static org.onap.sdnc.northbound.GenericResourceApiProvider.APP_NAME;
import static org.onap.sdnc.northbound.GenericResourceApiProvider.INVALID_INPUT_ERROR_MESSAGE;
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.connectionAttachmentResponseInformation;
import static org.onap.sdnc.northbound.util.MDSALUtil.connectionAttachmentTopologyOperationInput;
import static org.onap.sdnc.northbound.util.MDSALUtil.connectionAttachmentTopologyOperationOutput;
@@ -61,7 +60,7 @@ public class ConnectionAttachmentTopologyOperationRPCTest extends GenericResourc
@Test
public void should_fail_when_service_instance_id_not_present() throws Exception {
- ConnectionAttachmentTopologyOperationInput input = build(connectionAttachmentTopologyOperationInput());
+ ConnectionAttachmentTopologyOperationInput input = connectionAttachmentTopologyOperationInput().build();
ConnectionAttachmentTopologyOperationOutput output =
exec(genericResourceApiProvider::connectionAttachmentTopologyOperation, input, RpcResult::getResult);
@@ -75,15 +74,14 @@ public class ConnectionAttachmentTopologyOperationRPCTest extends GenericResourc
@Test
public void should_fail_when_invalid_service_data() throws Exception {
- ConnectionAttachmentTopologyOperationInput input = build(connectionAttachmentTopologyOperationInput()
- .setSdncRequestHeader(build(sdncRequestHeader()
+ ConnectionAttachmentTopologyOperationInput input = connectionAttachmentTopologyOperationInput()
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("test-svc-request-id")
- .setSvcAction(SvcAction.Assign)
- ))
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- );
+ .setSvcAction(SvcAction.Assign).build()
+ )
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ ).build();
ConnectionAttachmentTopologyOperationOutput output =
exec(genericResourceApiProvider::connectionAttachmentTopologyOperation, input, RpcResult::getResult);
@@ -100,15 +98,15 @@ public class ConnectionAttachmentTopologyOperationRPCTest extends GenericResourc
svcClient.mockHasGraph(true);
svcClient.mockExecute(new RuntimeException("test exception"));
- ConnectionAttachmentTopologyOperationInput input = build(connectionAttachmentTopologyOperationInput()
- .setSdncRequestHeader(build(sdncRequestHeader()
+ ConnectionAttachmentTopologyOperationInput input = connectionAttachmentTopologyOperationInput()
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("test-svc-request-id")
- .setSvcAction(SvcAction.Assign)
- ))
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- );
+ .setSvcAction(SvcAction.Assign).build()
+ )
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ ).build();
+
persistServiceInDataBroker(input);
@@ -125,15 +123,15 @@ public class ConnectionAttachmentTopologyOperationRPCTest extends GenericResourc
svcClient.mockHasGraph(false);
- ConnectionAttachmentTopologyOperationInput input = build(connectionAttachmentTopologyOperationInput()
- .setSdncRequestHeader(build(sdncRequestHeader()
+ ConnectionAttachmentTopologyOperationInput input = connectionAttachmentTopologyOperationInput()
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("test-svc-request-id")
- .setSvcAction(SvcAction.Assign)
- ))
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- );
+ .setSvcAction(SvcAction.Assign).build()
+ )
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ ).build();
+
persistServiceInDataBroker(input);
@@ -158,15 +156,15 @@ public class ConnectionAttachmentTopologyOperationRPCTest extends GenericResourc
when(spyDataBroker.newWriteOnlyTransaction()).thenReturn(mockWriteTransaction);
genericResourceApiProvider.setDataBroker(spyDataBroker);
- ConnectionAttachmentTopologyOperationInput input = build(connectionAttachmentTopologyOperationInput()
- .setSdncRequestHeader(build(sdncRequestHeader()
+ ConnectionAttachmentTopologyOperationInput input = connectionAttachmentTopologyOperationInput()
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("test-svc-request-id")
- .setSvcAction(SvcAction.Assign)
- ))
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- );
+ .setSvcAction(SvcAction.Assign).build()
+ )
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ ).build();
+
persistServiceInDataBroker(input);
@@ -187,19 +185,19 @@ public class ConnectionAttachmentTopologyOperationRPCTest extends GenericResourc
svcResultProp.set("contrail-route-object-path", "connectionAttachmentObjectPath: XYZ");
svcClient.mockExecute(svcResultProp);
- ConnectionAttachmentTopologyOperationInput input = build(connectionAttachmentTopologyOperationInput()
- .setSdncRequestHeader(build(sdncRequestHeader()
+ ConnectionAttachmentTopologyOperationInput input = connectionAttachmentTopologyOperationInput()
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("test-svc-request-id")
- .setSvcAction(SvcAction.Assign)
- ))
- .setRequestInformation(build(requestInformation()
+ .setSvcAction(SvcAction.Assign).build()
+ )
+ .setRequestInformation(requestInformation()
.setRequestId("test-request-id")
- .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance)
- ))
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- );
+ .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance).build()
+ )
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ ).build();
+
Service service = persistServiceInDataBroker(input);
@@ -222,20 +220,20 @@ public class ConnectionAttachmentTopologyOperationRPCTest extends GenericResourc
private Service persistServiceInDataBroker(ConnectionAttachmentTopologyOperationInput input) throws Exception {
- Service service = build(service()
+ Service service = service()
.setServiceInstanceId(input.getServiceInformation().getServiceInstanceId())
- .setServiceData(build(serviceData()
- .setServiceLevelOperStatus(build(serviceLevelOperStatus()
+ .setServiceData(serviceData()
+ .setServiceLevelOperStatus(serviceLevelOperStatus()
.setOrderStatus(OrderStatus.Created)
.setModifyTimestamp(Instant.now().toString())
.setLastSvcRequestId(input.getSdncRequestHeader().getSvcRequestId())
.setLastRpcAction(LastRpcAction.Activate)
.setLastOrderStatus(LastOrderStatus.PendingAssignment)
.setLastAction(LastAction.ActivateNetworkInstance)
- .setCreateTimestamp(Instant.now().toString())
- ))
- ))
- );
+ .setCreateTimestamp(Instant.now().toString()).build()
+ ).build()
+ ).build();
+
db.write(true, service, LogicalDatastoreType.CONFIGURATION);
return service;
}
@@ -243,18 +241,19 @@ public class ConnectionAttachmentTopologyOperationRPCTest extends GenericResourc
private ConnectionAttachmentTopologyOperationOutput createExpectedOutput(PropBuilder propBuilder,
ConnectionAttachmentTopologyOperationInput input) {
- return build(connectionAttachmentTopologyOperationOutput()
- .setConnectionAttachmentResponseInformation(build(connectionAttachmentResponseInformation()
- .setObjectPath(propBuilder.get("connection-attachement-object-path"))))
+ return connectionAttachmentTopologyOperationOutput()
+ .setConnectionAttachmentResponseInformation(connectionAttachmentResponseInformation()
+ .setObjectPath(propBuilder.get("connection-attachement-object-path")).build()
+ )
.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId())
.setResponseCode(propBuilder.get(svcClient.errorCode))
.setAckFinalIndicator(propBuilder.get(svcClient.ackFinal))
.setResponseMessage(propBuilder.get(svcClient.errorMessage))
- .setServiceResponseInformation(build(serviceResponseInformation()
+ .setServiceResponseInformation(serviceResponseInformation()
.setInstanceId(input.getServiceInformation().getServiceInstanceId())
- .setObjectPath(propBuilder.get(svcClient.serviceObjectPath))
- ))
- );
+ .setObjectPath(propBuilder.get(svcClient.serviceObjectPath)).build()
+ ).build();
+
}
private Service createExpectedService(
@@ -262,11 +261,10 @@ public class ConnectionAttachmentTopologyOperationRPCTest extends GenericResourc
ServiceInformation expectedServiceInformation = expectedInput.getServiceInformation();
- return build(service()
+ return service()
.setServiceInstanceId(expectedServiceInformation.getServiceInstanceId())
- .setServiceData(build(serviceData()))
+ .setServiceData(serviceData().build())
.setServiceData(expectedServiceData)
- .setServiceStatus(build(serviceStatus()))
- );
+ .setServiceStatus(serviceStatus().build()).build();
}
}
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ContrailRouteTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ContrailRouteTopologyOperationRPCTest.java
index 06c66870..1cb8ecbb 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ContrailRouteTopologyOperationRPCTest.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ContrailRouteTopologyOperationRPCTest.java
@@ -7,7 +7,6 @@ import static org.onap.sdnc.northbound.GenericResourceApiProvider.APP_NAME;
import static org.onap.sdnc.northbound.GenericResourceApiProvider.INVALID_INPUT_ERROR_MESSAGE;
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.contrailRouteResponseInformation;
import static org.onap.sdnc.northbound.util.MDSALUtil.contrailRouteTopologyOperationInput;
import static org.onap.sdnc.northbound.util.MDSALUtil.contrailRouteTopologyOperationOutput;
@@ -61,7 +60,7 @@ public class ContrailRouteTopologyOperationRPCTest extends GenericResourceApiPro
@Test
public void should_fail_when_service_instance_id_not_present() throws Exception {
- ContrailRouteTopologyOperationInput input = build(contrailRouteTopologyOperationInput());
+ ContrailRouteTopologyOperationInput input = contrailRouteTopologyOperationInput().build();
ContrailRouteTopologyOperationOutput output =
exec(genericResourceApiProvider::contrailRouteTopologyOperation, input, RpcResult::getResult);
@@ -75,15 +74,14 @@ public class ContrailRouteTopologyOperationRPCTest extends GenericResourceApiPro
@Test
public void should_fail_when_invalid_service_data() throws Exception {
- ContrailRouteTopologyOperationInput input = build(contrailRouteTopologyOperationInput()
- .setSdncRequestHeader(build(sdncRequestHeader()
+ ContrailRouteTopologyOperationInput input = contrailRouteTopologyOperationInput()
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("test-svc-request-id")
- .setSvcAction(SvcAction.Assign)
- ))
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- );
+ .setSvcAction(SvcAction.Assign).build()
+ )
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ ).build();
ContrailRouteTopologyOperationOutput output =
exec(genericResourceApiProvider::contrailRouteTopologyOperation, input, RpcResult::getResult);
@@ -100,15 +98,14 @@ public class ContrailRouteTopologyOperationRPCTest extends GenericResourceApiPro
svcClient.mockHasGraph(true);
svcClient.mockExecute(new RuntimeException("test exception"));
- ContrailRouteTopologyOperationInput input = build(contrailRouteTopologyOperationInput()
- .setSdncRequestHeader(build(sdncRequestHeader()
+ ContrailRouteTopologyOperationInput input = contrailRouteTopologyOperationInput()
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("test-svc-request-id")
- .setSvcAction(SvcAction.Assign)
- ))
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- );
+ .setSvcAction(SvcAction.Assign).build()
+ )
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ ).build();
persistServiceInDataBroker(input);
@@ -125,15 +122,14 @@ public class ContrailRouteTopologyOperationRPCTest extends GenericResourceApiPro
svcClient.mockHasGraph(false);
- ContrailRouteTopologyOperationInput input = build(contrailRouteTopologyOperationInput()
- .setSdncRequestHeader(build(sdncRequestHeader()
+ ContrailRouteTopologyOperationInput input = contrailRouteTopologyOperationInput()
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("test-svc-request-id")
- .setSvcAction(SvcAction.Assign)
- ))
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- );
+ .setSvcAction(SvcAction.Assign).build()
+ )
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ ).build();
persistServiceInDataBroker(input);
@@ -158,15 +154,14 @@ public class ContrailRouteTopologyOperationRPCTest extends GenericResourceApiPro
when(spyDataBroker.newWriteOnlyTransaction()).thenReturn(mockWriteTransaction);
genericResourceApiProvider.setDataBroker(spyDataBroker);
- ContrailRouteTopologyOperationInput input = build(contrailRouteTopologyOperationInput()
- .setSdncRequestHeader(build(sdncRequestHeader()
+ ContrailRouteTopologyOperationInput input = contrailRouteTopologyOperationInput()
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("test-svc-request-id")
- .setSvcAction(SvcAction.Assign)
- ))
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- );
+ .setSvcAction(SvcAction.Assign).build()
+ )
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ ).build();
persistServiceInDataBroker(input);
@@ -187,19 +182,18 @@ public class ContrailRouteTopologyOperationRPCTest extends GenericResourceApiPro
svcResultProp.set("contrail-route-object-path", "contrailRouteObjectPath: XYZ");
svcClient.mockExecute(svcResultProp);
- ContrailRouteTopologyOperationInput input = build(contrailRouteTopologyOperationInput()
- .setSdncRequestHeader(build(sdncRequestHeader()
+ ContrailRouteTopologyOperationInput input = contrailRouteTopologyOperationInput()
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("test-svc-request-id")
- .setSvcAction(SvcAction.Assign)
- ))
- .setRequestInformation(build(requestInformation()
+ .setSvcAction(SvcAction.Assign).build()
+ )
+ .setRequestInformation(requestInformation()
.setRequestId("test-request-id")
- .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance)
- ))
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- );
+ .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance).build()
+ )
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ ).build();
Service service = persistServiceInDataBroker(input);
@@ -222,20 +216,19 @@ public class ContrailRouteTopologyOperationRPCTest extends GenericResourceApiPro
private Service persistServiceInDataBroker(ContrailRouteTopologyOperationInput input) throws Exception {
- Service service = build(service()
+ Service service = service()
.setServiceInstanceId(input.getServiceInformation().getServiceInstanceId())
- .setServiceData(build(serviceData()
- .setServiceLevelOperStatus(build(serviceLevelOperStatus()
+ .setServiceData(serviceData()
+ .setServiceLevelOperStatus(serviceLevelOperStatus()
.setOrderStatus(OrderStatus.Created)
.setModifyTimestamp(Instant.now().toString())
.setLastSvcRequestId(input.getSdncRequestHeader().getSvcRequestId())
.setLastRpcAction(LastRpcAction.Activate)
.setLastOrderStatus(LastOrderStatus.PendingAssignment)
.setLastAction(LastAction.ActivateNetworkInstance)
- .setCreateTimestamp(Instant.now().toString())
- ))
- ))
- );
+ .setCreateTimestamp(Instant.now().toString()).build()
+ ).build()
+ ).build();
db.write(true, service, LogicalDatastoreType.CONFIGURATION);
return service;
}
@@ -243,18 +236,18 @@ public class ContrailRouteTopologyOperationRPCTest extends GenericResourceApiPro
private ContrailRouteTopologyOperationOutput createExpectedOutput(PropBuilder propBuilder,
ContrailRouteTopologyOperationInput input) {
- return build(contrailRouteTopologyOperationOutput()
- .setContrailRouteResponseInformation(build(contrailRouteResponseInformation()
- .setObjectPath(propBuilder.get("contrail-route-object-path"))))
+ return contrailRouteTopologyOperationOutput()
+ .setContrailRouteResponseInformation(contrailRouteResponseInformation()
+ .setObjectPath(propBuilder.get("contrail-route-object-path")).build()
+ )
.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId())
.setResponseCode(propBuilder.get(svcClient.errorCode))
.setAckFinalIndicator(propBuilder.get(svcClient.ackFinal))
.setResponseMessage(propBuilder.get(svcClient.errorMessage))
- .setServiceResponseInformation(build(serviceResponseInformation()
+ .setServiceResponseInformation(serviceResponseInformation()
.setInstanceId(input.getServiceInformation().getServiceInstanceId())
- .setObjectPath(propBuilder.get(svcClient.serviceObjectPath))
- ))
- );
+ .setObjectPath(propBuilder.get(svcClient.serviceObjectPath)).build()
+ ).build();
}
private Service createExpectedService(
@@ -262,11 +255,10 @@ public class ContrailRouteTopologyOperationRPCTest extends GenericResourceApiPro
ServiceInformation expectedServiceInformation = expectedInput.getServiceInformation();
- return build(service()
+ return service()
.setServiceInstanceId(expectedServiceInformation.getServiceInstanceId())
- .setServiceData(build(serviceData()))
+ .setServiceData(serviceData().build())
.setServiceData(expectedServiceData)
- .setServiceStatus(build(serviceStatus()))
- );
+ .setServiceStatus(serviceStatus().build()).build();
}
}
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
index 5d611801..836778ff 100644
--- 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
@@ -26,8 +26,8 @@ public class GenericConfigurationNotificationRPCTest extends GenericResourceApiP
@Test
public void should_complete_with_success_when_no_errors() throws Exception {
- GenericConfigurationNotificationInput input = build(GenericConfigurationNotificationInput()
- .setServiceInformation(new ServiceInformationBuilder().setServiceInstanceId("serviceInstanceId").build()));
+ GenericConfigurationNotificationInput input = GenericConfigurationNotificationInput()
+ .setServiceInformation(new ServiceInformationBuilder().setServiceInstanceId("serviceInstanceId").build()).build();
GenericConfigurationNotificationOutput output =
exec(genericResourceApiProvider::genericConfigurationNotification, input, RpcResult::getResult);
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 c77455d4..7a6081e3 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
@@ -2,7 +2,6 @@ package org.onap.sdnc.northbound;
import static org.junit.Assert.assertEquals;
import static org.onap.sdnc.northbound.util.MDSALUtil.GenericConfigurationTopologyOperationInput;
-import static org.onap.sdnc.northbound.util.MDSALUtil.build;
import static org.onap.sdnc.northbound.util.MDSALUtil.exec;
import org.junit.Before;
@@ -28,7 +27,7 @@ public class GenericConfigurationTopologyOperationRPCTest extends GenericResourc
@Test
public void should_fail_when_invalid_vnf_topology() throws Exception {
- GenericConfigurationTopologyOperationInput input = build(GenericConfigurationTopologyOperationInput());
+ GenericConfigurationTopologyOperationInput input = GenericConfigurationTopologyOperationInput().build();
GenericConfigurationTopologyOperationOutput output =
exec(genericResourceApiProvider::genericConfigurationTopologyOperation, input, RpcResult::getResult);
@@ -41,8 +40,8 @@ public class GenericConfigurationTopologyOperationRPCTest extends GenericResourc
@Test
public void should_fail_when_valid_vnf_topology() throws Exception {
- GenericConfigurationTopologyOperationInput input = build(GenericConfigurationTopologyOperationInput()
- .setServiceInformation(new ServiceInformationBuilder().setServiceInstanceId("ServiceInsatnceId").build()));
+ GenericConfigurationTopologyOperationInput input = GenericConfigurationTopologyOperationInput()
+ .setServiceInformation(new ServiceInformationBuilder().setServiceInstanceId("ServiceInsatnceId").build()).build();
GenericConfigurationTopologyOperationOutput output =
exec(genericResourceApiProvider::genericConfigurationTopologyOperation, input, RpcResult::getResult);
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GetpathsegmentTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GetpathsegmentTopologyOperationRPCTest.java
index 06da74c6..f2a92c04 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GetpathsegmentTopologyOperationRPCTest.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GetpathsegmentTopologyOperationRPCTest.java
@@ -27,7 +27,7 @@ public class GetpathsegmentTopologyOperationRPCTest extends GenericResourceApiPr
@Test
public void should_fail_when_invalid_vnf_topology() throws Exception {
- GetpathsegmentTopologyOperationInput input = build(GetpathsegmentTopologyOperationInput());
+ GetpathsegmentTopologyOperationInput input = GetpathsegmentTopologyOperationInput().build();
GetpathsegmentTopologyOperationOutput output =
exec(genericResourceApiProvider::getpathsegmentTopologyOperation, input, RpcResult::getResult);
@@ -40,8 +40,8 @@ public class GetpathsegmentTopologyOperationRPCTest extends GenericResourceApiPr
@Test
public void should_fail_when_valid_vnf_topology() throws Exception {
- GetpathsegmentTopologyOperationInput input = build(GetpathsegmentTopologyOperationInput()
- .setServiceInformation(new ServiceInformationBuilder().setServiceInstanceId("ServiceInstanceID").build()));
+ GetpathsegmentTopologyOperationInput input = GetpathsegmentTopologyOperationInput()
+ .setServiceInformation(new ServiceInformationBuilder().setServiceInstanceId("ServiceInstanceID").build()).build();
GetpathsegmentTopologyOperationOutput output =
exec(genericResourceApiProvider::getpathsegmentTopologyOperation, input, RpcResult::getResult);
@@ -54,9 +54,9 @@ public class GetpathsegmentTopologyOperationRPCTest extends GenericResourceApiPr
@Test
public void should_fail_when_valid_serice_excep_vnf_topology() throws Exception {
- GetpathsegmentTopologyOperationInput input = build(GetpathsegmentTopologyOperationInput()
+ GetpathsegmentTopologyOperationInput input = GetpathsegmentTopologyOperationInput()
.setServiceInformation(new ServiceInformationBuilder().setServiceInstanceId("ServiceInstanceID")
- .setOnapModelInformation(new OnapModelInformationBuilder().setModelUuid("moduleUUID").build()).build()));
+ .setOnapModelInformation(new OnapModelInformationBuilder().setModelUuid("moduleUUID").build()).build()).build();
GetpathsegmentTopologyOperationOutput output =
exec(genericResourceApiProvider::getpathsegmentTopologyOperation, input, RpcResult::getResult);
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/NetworkTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/NetworkTopologyOperationRPCTest.java
index b5b0a336..bb93c7a2 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/NetworkTopologyOperationRPCTest.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/NetworkTopologyOperationRPCTest.java
@@ -28,7 +28,6 @@ import static org.onap.sdnc.northbound.GenericResourceApiProvider.APP_NAME;
import static org.onap.sdnc.northbound.GenericResourceApiProvider.INVALID_INPUT_ERROR_MESSAGE;
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.networkInformation;
import static org.onap.sdnc.northbound.util.MDSALUtil.networkResponseInformation;
@@ -90,7 +89,7 @@ public class NetworkTopologyOperationRPCTest extends GenericResourceApiProviderT
@Test
public void should_fail_when_service_instance_id_not_present() throws Exception {
- NetworkTopologyOperationInput input = build(networkTopologyOperationInput());
+ NetworkTopologyOperationInput input = networkTopologyOperationInput().build();
NetworkTopologyOperationOutput output =
exec(genericResourceApiProvider::networkTopologyOperation, input, RpcResult::getResult);
@@ -104,11 +103,10 @@ public class NetworkTopologyOperationRPCTest extends GenericResourceApiProviderT
@Test
public void should_fail_when_invalid_service_data() throws Exception {
- NetworkTopologyOperationInput input = build(networkTopologyOperationInput()
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- );
+ NetworkTopologyOperationInput input = networkTopologyOperationInput()
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ ).build();
NetworkTopologyOperationOutput output =
exec(genericResourceApiProvider::networkTopologyOperation, input, RpcResult::getResult);
@@ -125,11 +123,10 @@ public class NetworkTopologyOperationRPCTest extends GenericResourceApiProviderT
svcClient.mockHasGraph(true);
svcClient.mockExecute(new RuntimeException("test exception"));
- NetworkTopologyOperationInput input = build(networkTopologyOperationInput()
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- );
+ NetworkTopologyOperationInput input = networkTopologyOperationInput()
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ ).build();
persistServiceInDataBroker(input);
@@ -146,11 +143,10 @@ public class NetworkTopologyOperationRPCTest extends GenericResourceApiProviderT
svcClient.mockHasGraph(false);
- NetworkTopologyOperationInput input = build(networkTopologyOperationInput()
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- );
+ NetworkTopologyOperationInput input = networkTopologyOperationInput()
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ ).build();
persistServiceInDataBroker(input);
@@ -175,11 +171,10 @@ public class NetworkTopologyOperationRPCTest extends GenericResourceApiProviderT
when(spyDataBroker.newWriteOnlyTransaction()).thenReturn(mockWriteTransaction);
genericResourceApiProvider.setDataBroker(spyDataBroker);
- NetworkTopologyOperationInput input = build(networkTopologyOperationInput()
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- );
+ NetworkTopologyOperationInput input = networkTopologyOperationInput()
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ ).build();
persistServiceInDataBroker(input);
NetworkTopologyOperationOutput output =
@@ -241,36 +236,34 @@ public class NetworkTopologyOperationRPCTest extends GenericResourceApiProviderT
private NetworkTopologyOperationInput createNTOI() {
- return build(
+ return
networkTopologyOperationInput()
- .setSdncRequestHeader(build(sdncRequestHeader()
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("svc-request-id: xyz")
- .setSvcAction(SvcAction.Assign)
- ))
- .setRequestInformation(build(requestInformation()
+ .setSvcAction(SvcAction.Assign).build()
+ )
+ .setRequestInformation(requestInformation()
.setRequestId("request-id: xyz")
- .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance)
- ))
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("service-instance-id: xyz")
- ))
- .setNetworkInformation(build(
- networkInformation()
- ))
- );
+ .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance).build()
+ )
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("service-instance-id: xyz").build()
+ )
+ .setNetworkInformation(networkInformation().build()
+ ).build();
}
private Service persistServiceInDataBroker(
NetworkTopologyOperationInput networkTopologyOperationInput
) throws Exception {
- Service service = build(
+ Service service =
service()
.setServiceInstanceId(
networkTopologyOperationInput.getServiceInformation().getServiceInstanceId()
)
- .setServiceData(build(
+ .setServiceData(
serviceData()
- .setServiceLevelOperStatus(build(
+ .setServiceLevelOperStatus(
serviceLevelOperStatus()
.setOrderStatus(OrderStatus.Created)
.setModifyTimestamp(Instant.now().toString())
@@ -278,11 +271,10 @@ public class NetworkTopologyOperationRPCTest extends GenericResourceApiProviderT
.setLastRpcAction(LastRpcAction.Activate)
.setLastOrderStatus(LastOrderStatus.PendingAssignment)
.setLastAction(LastAction.ActivateNetworkInstance)
- .setCreateTimestamp(Instant.now().toString())
- ))
- ))
+ .setCreateTimestamp(Instant.now().toString()).build()
+ ).build()
+ ).build();
- );
db.write(true, service, LogicalDatastoreType.CONFIGURATION);
return service;
}
@@ -291,22 +283,21 @@ public class NetworkTopologyOperationRPCTest extends GenericResourceApiProviderT
private NetworkTopologyOperationOutput createExpectedNTOO(
PropBuilder expectedSvcResultProp,
NetworkTopologyOperationInput expectedNetworkTopologyOperationInput) {
- return build(
+ return
networkTopologyOperationOutput()
.setSvcRequestId(expectedNetworkTopologyOperationInput.getSdncRequestHeader().getSvcRequestId())
.setResponseCode(expectedSvcResultProp.get(svcClient.errorCode))
.setAckFinalIndicator(expectedSvcResultProp.get(svcClient.ackFinal))
.setResponseMessage(expectedSvcResultProp.get(svcClient.errorMessage))
- .setServiceResponseInformation(build(serviceResponseInformation()
+ .setServiceResponseInformation(serviceResponseInformation()
.setInstanceId(expectedNetworkTopologyOperationInput.getServiceInformation().getServiceInstanceId())
- .setObjectPath(expectedSvcResultProp.get(svcClient.serviceObjectPath))
- ))
- .setNetworkResponseInformation(build(
+ .setObjectPath(expectedSvcResultProp.get(svcClient.serviceObjectPath)).build()
+ )
+ .setNetworkResponseInformation(
networkResponseInformation()
.setInstanceId(expectedSvcResultProp.get(svcClient.networkId))
- .setObjectPath(expectedSvcResultProp.get(svcClient.networkObjectPath))
- ))
- );
+ .setObjectPath(expectedSvcResultProp.get(svcClient.networkObjectPath)).build()
+ ).build();
}
private Service createExpectedService(
@@ -325,17 +316,15 @@ public class NetworkTopologyOperationRPCTest extends GenericResourceApiProviderT
ServiceInformation expectedServiceInformation = expectedNetworkTopologyOperationInput.getServiceInformation();
RequestInformation expectedRequestInformation = expectedNetworkTopologyOperationInput.getRequestInformation();
- return build(
+ return
service()
.setServiceInstanceId(expectedServiceInformation.getServiceInstanceId())
- .setServiceData(build(serviceData()))
+ .setServiceData(serviceData().build())
.setServiceData(expectedServiceData)
.setServiceStatus(
- build(
- serviceStatus()
- )
- )
- );
+ serviceStatus().build()
+ ).build();
+
}
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PnfTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PnfTopologyOperationRPCTest.java
index 29d48857..57d218ec 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PnfTopologyOperationRPCTest.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PnfTopologyOperationRPCTest.java
@@ -6,7 +6,6 @@ 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.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.pnfDetailsBuilder;
import static org.onap.sdnc.northbound.util.MDSALUtil.pnfResponseInformation;
@@ -46,7 +45,7 @@ public class PnfTopologyOperationRPCTest extends GenericResourceApiProviderTest
@Test
public void should_fail_when_service_info_not_present() throws Exception {
- PnfTopologyOperationInput input = build(pnfTopologyOperationInput());
+ PnfTopologyOperationInput input = pnfTopologyOperationInput().build();
PnfTopologyOperationOutput output =
exec(genericResourceApiProvider::pnfTopologyOperation, input, RpcResult::getResult);
@@ -82,14 +81,13 @@ public class PnfTopologyOperationRPCTest extends GenericResourceApiProviderTest
svcClient.mockHasGraph(true);
svcClient.mockExecute(new RuntimeException("test exception"));
- PnfTopologyOperationInput input = build(pnfTopologyOperationInput()
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- .setPnfDetails(build(pnfDetailsBuilder()
- .setPnfId("test-pnf-id")
- ))
- );
+ PnfTopologyOperationInput input = pnfTopologyOperationInput()
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ )
+ .setPnfDetails(pnfDetailsBuilder()
+ .setPnfId("test-pnf-id").build()
+ ).build();
PnfTopologyOperationOutput output =
exec(genericResourceApiProvider::pnfTopologyOperation, input, RpcResult::getResult);
@@ -104,14 +102,13 @@ public class PnfTopologyOperationRPCTest extends GenericResourceApiProviderTest
svcClient.mockHasGraph(false);
- PnfTopologyOperationInput input = build(pnfTopologyOperationInput()
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- .setPnfDetails(build(pnfDetailsBuilder()
- .setPnfId("test-pnf-id")
- ))
- );
+ PnfTopologyOperationInput input = pnfTopologyOperationInput()
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ )
+ .setPnfDetails(pnfDetailsBuilder()
+ .setPnfId("test-pnf-id").build()
+ ).build();
PnfTopologyOperationOutput output =
exec(genericResourceApiProvider::pnfTopologyOperation, input, RpcResult::getResult);
@@ -134,14 +131,13 @@ public class PnfTopologyOperationRPCTest extends GenericResourceApiProviderTest
when(spyDataBroker.newWriteOnlyTransaction()).thenReturn(mockWriteTransaction);
genericResourceApiProvider.setDataBroker(spyDataBroker);
- PnfTopologyOperationInput input = build(pnfTopologyOperationInput()
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- .setPnfDetails(build(pnfDetailsBuilder()
- .setPnfId("test-pnf-id")
- ))
- );
+ PnfTopologyOperationInput input = pnfTopologyOperationInput()
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ )
+ .setPnfDetails(pnfDetailsBuilder()
+ .setPnfId("test-pnf-id").build()
+ ).build();
PnfTopologyOperationOutput output =
exec(genericResourceApiProvider::pnfTopologyOperation, input, RpcResult::getResult);
@@ -158,22 +154,21 @@ public class PnfTopologyOperationRPCTest extends GenericResourceApiProviderTest
PropBuilder svcResultProp = svcClient.createExecuteOKResult();
svcClient.mockExecute(svcResultProp);
- PnfTopologyOperationInput input = build(pnfTopologyOperationInput()
- .setSdncRequestHeader(build(sdncRequestHeader()
+ PnfTopologyOperationInput input = pnfTopologyOperationInput()
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("test-svc-request-id")
- .setSvcAction(SvcAction.Assign)
- ))
- .setRequestInformation(build(requestInformation()
+ .setSvcAction(SvcAction.Assign).build()
+ )
+ .setRequestInformation(requestInformation()
.setRequestId("test-request-id")
- .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance)
- ))
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- .setPnfDetails(build(pnfDetailsBuilder()
- .setPnfId("test-pnf-id")
- ))
- );
+ .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance).build()
+ )
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ )
+ .setPnfDetails(pnfDetailsBuilder()
+ .setPnfId("test-pnf-id").build()
+ ).build();
PnfTopologyOperationOutput output =
exec(genericResourceApiProvider::pnfTopologyOperation, input, RpcResult::getResult);
@@ -189,20 +184,19 @@ public class PnfTopologyOperationRPCTest extends GenericResourceApiProviderTest
private PnfTopologyOperationOutput createExpectedOutput(PropBuilder svcResultProp,
PnfTopologyOperationInput pnfTopologyOperationInput) {
- return build(
+ return
pnfTopologyOperationOutput()
.setSvcRequestId(pnfTopologyOperationInput.getSdncRequestHeader().getSvcRequestId())
.setResponseCode(svcResultProp.get(svcClient.errorCode))
.setAckFinalIndicator(svcResultProp.get(svcClient.ackFinal))
.setResponseMessage(svcResultProp.get(svcClient.errorMessage))
- .setServiceResponseInformation(build(serviceResponseInformation()
+ .setServiceResponseInformation(serviceResponseInformation()
.setInstanceId(pnfTopologyOperationInput.getServiceInformation().getServiceInstanceId())
- .setObjectPath(svcResultProp.get(svcClient.serviceObjectPath))
- ))
- .setPnfResponseInformation(build(pnfResponseInformation()
+ .setObjectPath(svcResultProp.get(svcClient.serviceObjectPath)).build()
+ )
+ .setPnfResponseInformation(pnfResponseInformation()
.setInstanceId(pnfTopologyOperationInput.getPnfDetails().getPnfId())
- .setObjectPath(svcResultProp.get(svcClient.pnfObjectPath))
- ))
- );
+ .setObjectPath(svcResultProp.get(svcClient.pnfObjectPath)).build()
+ ).build();
}
}
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 ff2a4351..3c6222f5 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
@@ -25,7 +25,7 @@ public class PolicyUpdateNotifyOperationRPCTest extends GenericResourceApiProvid
@Test
public void should_fail_when_invalid_vnf_topology() throws Exception {
- PolicyUpdateNotifyOperationInput input = build(PolicyUpdateNotifyOperationInput());
+ PolicyUpdateNotifyOperationInput input = PolicyUpdateNotifyOperationInput().build();
PolicyUpdateNotifyOperationOutput output =
exec(genericResourceApiProvider::policyUpdateNotifyOperation, input, RpcResult::getResult);
@@ -37,7 +37,7 @@ public class PolicyUpdateNotifyOperationRPCTest extends GenericResourceApiProvid
@Test
public void should_fail_when_valid_vnf_topology() throws Exception {
- PolicyUpdateNotifyOperationInput input = build(PolicyUpdateNotifyOperationInput().setPolicyName("PolicyName").setUpdateType("UpdateType").setVersionId("vID"));
+ PolicyUpdateNotifyOperationInput input = PolicyUpdateNotifyOperationInput().setPolicyName("PolicyName").setUpdateType("UpdateType").setVersionId("vID").build();
PolicyUpdateNotifyOperationOutput output =
exec(genericResourceApiProvider::policyUpdateNotifyOperation, input, RpcResult::getResult);
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
index dd3e5d90..bdfbd991 100644
--- 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
@@ -25,7 +25,7 @@ public class PortMirrorTopologyOperationRPCTest extends GenericResourceApiProvid
@Test
public void should_fail_when_invalid_vnf_topology() throws Exception {
- PortMirrorTopologyOperationInput input = build(PortMirrorTopologyOperationInput());
+ PortMirrorTopologyOperationInput input = PortMirrorTopologyOperationInput().build();
PortMirrorTopologyOperationOutput output =
exec(genericResourceApiProvider::portMirrorTopologyOperation, input, RpcResult::getResult);
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PreloadNetworkTopologyRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PreloadNetworkTopologyRPCTest.java
index e6565e30..696df262 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PreloadNetworkTopologyRPCTest.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PreloadNetworkTopologyRPCTest.java
@@ -6,7 +6,6 @@ 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.build;
import static org.onap.sdnc.northbound.util.MDSALUtil.exec;
import static org.onap.sdnc.northbound.util.MDSALUtil.networkTopologyIdentifierStructureBuilder;
import static org.onap.sdnc.northbound.util.MDSALUtil.preloadNetworkTopologyInformationBuilder;
@@ -44,7 +43,7 @@ public class PreloadNetworkTopologyRPCTest extends GenericResourceApiProviderTes
@Test
public void should_fail_when_invalid_network_topology() throws Exception {
- PreloadNetworkTopologyOperationInput input = build(preloadNetworkTopologyOperationInput());
+ PreloadNetworkTopologyOperationInput input = preloadNetworkTopologyOperationInput().build();
PreloadNetworkTopologyOperationOutput output =
exec(genericResourceApiProvider::preloadNetworkTopologyOperation, input, RpcResult::getResult);
@@ -61,12 +60,13 @@ public class PreloadNetworkTopologyRPCTest extends GenericResourceApiProviderTes
svcClient.mockHasGraph(true);
svcClient.mockExecuteWoServiceDataPreload(new RuntimeException("test exception"));
- PreloadNetworkTopologyOperationInput input = build(preloadNetworkTopologyOperationInput()
- .setPreloadNetworkTopologyInformation(build(preloadNetworkTopologyInformationBuilder()
- .setNetworkTopologyIdentifierStructure(build(networkTopologyIdentifierStructureBuilder()
+ PreloadNetworkTopologyOperationInput input = preloadNetworkTopologyOperationInput()
+ .setPreloadNetworkTopologyInformation(preloadNetworkTopologyInformationBuilder()
+ .setNetworkTopologyIdentifierStructure(networkTopologyIdentifierStructureBuilder()
.setNetworkName("test-network-name")
- .setNetworkType("test-network-type")))))
- );
+ .setNetworkType("test-network-type").build()
+ ).build()
+ ).build();
PreloadNetworkTopologyOperationOutput output =
exec(genericResourceApiProvider::preloadNetworkTopologyOperation, input, RpcResult::getResult);
@@ -81,12 +81,13 @@ public class PreloadNetworkTopologyRPCTest extends GenericResourceApiProviderTes
svcClient.mockHasGraph(false);
- PreloadNetworkTopologyOperationInput input = build(preloadNetworkTopologyOperationInput()
- .setPreloadNetworkTopologyInformation(build(preloadNetworkTopologyInformationBuilder()
- .setNetworkTopologyIdentifierStructure(build(networkTopologyIdentifierStructureBuilder()
+ PreloadNetworkTopologyOperationInput input = preloadNetworkTopologyOperationInput()
+ .setPreloadNetworkTopologyInformation(preloadNetworkTopologyInformationBuilder()
+ .setNetworkTopologyIdentifierStructure(networkTopologyIdentifierStructureBuilder()
.setNetworkName("test-network-name")
- .setNetworkType("test-network-type")))))
- );
+ .setNetworkType("test-network-type").build()
+ ).build()
+ ).build();
PreloadNetworkTopologyOperationOutput output =
exec(genericResourceApiProvider::preloadNetworkTopologyOperation, input, RpcResult::getResult);
@@ -109,12 +110,13 @@ public class PreloadNetworkTopologyRPCTest extends GenericResourceApiProviderTes
when(spyDataBroker.newWriteOnlyTransaction()).thenReturn(mockWriteTransaction);
genericResourceApiProvider.setDataBroker(spyDataBroker);
- PreloadNetworkTopologyOperationInput input = build(preloadNetworkTopologyOperationInput()
- .setPreloadNetworkTopologyInformation(build(preloadNetworkTopologyInformationBuilder()
- .setNetworkTopologyIdentifierStructure(build(networkTopologyIdentifierStructureBuilder()
+ PreloadNetworkTopologyOperationInput input = preloadNetworkTopologyOperationInput()
+ .setPreloadNetworkTopologyInformation(preloadNetworkTopologyInformationBuilder()
+ .setNetworkTopologyIdentifierStructure(networkTopologyIdentifierStructureBuilder()
.setNetworkName("test-network-name")
- .setNetworkType("test-network-type")))))
- );
+ .setNetworkType("test-network-type").build()
+ ).build()
+ ).build();
PreloadNetworkTopologyOperationOutput output =
exec(genericResourceApiProvider::preloadNetworkTopologyOperation, input, RpcResult::getResult);
@@ -131,20 +133,21 @@ public class PreloadNetworkTopologyRPCTest extends GenericResourceApiProviderTes
PropBuilder svcResultProp = svcClient.createExecuteOKResult();
svcClient.mockExecute(svcResultProp);
- PreloadNetworkTopologyOperationInput input = build(preloadNetworkTopologyOperationInput()
- .setPreloadNetworkTopologyInformation(build(preloadNetworkTopologyInformationBuilder()
- .setNetworkTopologyIdentifierStructure(build(networkTopologyIdentifierStructureBuilder()
+ PreloadNetworkTopologyOperationInput input = preloadNetworkTopologyOperationInput()
+ .setPreloadNetworkTopologyInformation(preloadNetworkTopologyInformationBuilder()
+ .setNetworkTopologyIdentifierStructure(networkTopologyIdentifierStructureBuilder()
.setNetworkName("test-network-name")
- .setNetworkType("test-network-type")))))
- .setSdncRequestHeader(build(sdncRequestHeader()
+ .setNetworkType("test-network-type").build()
+ ).build()
+ )
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("test-svc-request-id")
- .setSvcAction(SvcAction.Assign)
- ))
- .setRequestInformation(build(requestInformation()
+ .setSvcAction(SvcAction.Assign).build()
+ )
+ .setRequestInformation(requestInformation()
.setRequestId("test-request-id")
- .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance)
- ))
- );
+ .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance).build()
+ ).build();
PreloadNetworkTopologyOperationOutput output =
exec(genericResourceApiProvider::preloadNetworkTopologyOperation, input, RpcResult::getResult);
@@ -158,11 +161,10 @@ public class PreloadNetworkTopologyRPCTest extends GenericResourceApiProviderTes
private PreloadNetworkTopologyOperationOutput createExpectedOutput(PropBuilder svcResultProp,
PreloadNetworkTopologyOperationInput input) {
- return build(preloadNetworkTopologyOperationOutput()
+ return preloadNetworkTopologyOperationOutput()
.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId())
.setResponseCode(svcResultProp.get(svcClient.errorCode))
- .setAckFinalIndicator(svcResultProp.get(svcClient.ackFinal))
- );
+ .setAckFinalIndicator(svcResultProp.get(svcClient.ackFinal)).build();
}
}
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PreloadVnfTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PreloadVnfTopologyOperationRPCTest.java
index 3a0e6265..863563f2 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PreloadVnfTopologyOperationRPCTest.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PreloadVnfTopologyOperationRPCTest.java
@@ -6,7 +6,6 @@ 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.build;
import static org.onap.sdnc.northbound.util.MDSALUtil.exec;
import static org.onap.sdnc.northbound.util.MDSALUtil.preloadVfModuleTopologyInformationBuilder;
import static org.onap.sdnc.northbound.util.MDSALUtil.preloadVfModuleTopologyOperationInput;
@@ -46,7 +45,7 @@ public class PreloadVnfTopologyOperationRPCTest extends GenericResourceApiProvid
@Test
public void should_fail_when_invalid_vnf_topology() throws Exception {
- PreloadVfModuleTopologyOperationInput input = build(preloadVfModuleTopologyOperationInput());
+ PreloadVfModuleTopologyOperationInput input = preloadVfModuleTopologyOperationInput().build();
PreloadVfModuleTopologyOperationOutput output =
exec(genericResourceApiProvider::preloadVfModuleTopologyOperation, input, RpcResult::getResult);
@@ -60,11 +59,12 @@ public class PreloadVnfTopologyOperationRPCTest extends GenericResourceApiProvid
@Test
public void should_fail_when_invalid_preload_data() throws Exception {
- PreloadVfModuleTopologyOperationInput input = build(preloadVfModuleTopologyOperationInput()
- .setPreloadVfModuleTopologyInformation(build(preloadVfModuleTopologyInformationBuilder()
- .setVnfTopologyIdentifierStructure(build(vnfTopologyIdentifierStructureBuilder()
- .setVnfName("test-vnf-name")))))
- );
+ PreloadVfModuleTopologyOperationInput input = preloadVfModuleTopologyOperationInput()
+ .setPreloadVfModuleTopologyInformation(preloadVfModuleTopologyInformationBuilder()
+ .setVnfTopologyIdentifierStructure(vnfTopologyIdentifierStructureBuilder()
+ .setVnfName("test-vnf-name").build()
+ ).build()
+ ).build();
PreloadVfModuleTopologyOperationOutput output =
exec(genericResourceApiProvider::preloadVfModuleTopologyOperation, input, RpcResult::getResult);
@@ -81,24 +81,26 @@ public class PreloadVnfTopologyOperationRPCTest extends GenericResourceApiProvid
svcClient.mockHasGraph(true);
svcClient.mockExecuteWoServiceDataPreload(new RuntimeException("test exception"));
- PreloadVfModuleTopologyOperationInput input = build(preloadVfModuleTopologyOperationInput()
- .setPreloadVfModuleTopologyInformation(build(preloadVfModuleTopologyInformationBuilder()
- .setVnfTopologyIdentifierStructure(build(vnfTopologyIdentifierStructureBuilder()
+ PreloadVfModuleTopologyOperationInput input = preloadVfModuleTopologyOperationInput()
+ .setPreloadVfModuleTopologyInformation(preloadVfModuleTopologyInformationBuilder()
+ .setVnfTopologyIdentifierStructure(vnfTopologyIdentifierStructureBuilder()
.setVnfName("test-vnf-name")
- .setVnfType("test-vnf-type")))
- .setVfModuleTopology(build(vfModuleTopologyBuilder()
- .setVfModuleTopologyIdentifier(build(vfModuleTopologyIdentifierBuilder()
- .setVfModuleName("vf-module-name"))
- )))))
- .setSdncRequestHeader(build(sdncRequestHeader()
+ .setVnfType("test-vnf-type").build()
+ )
+ .setVfModuleTopology(vfModuleTopologyBuilder()
+ .setVfModuleTopologyIdentifier(vfModuleTopologyIdentifierBuilder()
+ .setVfModuleName("vf-module-name").build()
+ ).build()
+ ).build()
+ )
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("test-svc-request-id")
- .setSvcAction(SvcAction.Assign)
- ))
- .setRequestInformation(build(requestInformation()
+ .setSvcAction(SvcAction.Assign).build()
+ )
+ .setRequestInformation(requestInformation()
.setRequestId("test-request-id")
- .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance)
- ))
- );
+ .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance).build()
+ ).build();
PreloadVfModuleTopologyOperationOutput output =
exec(genericResourceApiProvider::preloadVfModuleTopologyOperation, input, RpcResult::getResult);
@@ -113,24 +115,26 @@ public class PreloadVnfTopologyOperationRPCTest extends GenericResourceApiProvid
svcClient.mockHasGraph(false);
- PreloadVfModuleTopologyOperationInput input = build(preloadVfModuleTopologyOperationInput()
- .setPreloadVfModuleTopologyInformation(build(preloadVfModuleTopologyInformationBuilder()
- .setVnfTopologyIdentifierStructure(build(vnfTopologyIdentifierStructureBuilder()
+ PreloadVfModuleTopologyOperationInput input = preloadVfModuleTopologyOperationInput()
+ .setPreloadVfModuleTopologyInformation(preloadVfModuleTopologyInformationBuilder()
+ .setVnfTopologyIdentifierStructure(vnfTopologyIdentifierStructureBuilder()
.setVnfName("test-vnf-name")
- .setVnfType("test-vnf-type")))
- .setVfModuleTopology(build(vfModuleTopologyBuilder()
- .setVfModuleTopologyIdentifier(build(vfModuleTopologyIdentifierBuilder()
- .setVfModuleName("vf-module-name"))
- )))))
- .setSdncRequestHeader(build(sdncRequestHeader()
+ .setVnfType("test-vnf-type").build()
+ )
+ .setVfModuleTopology(vfModuleTopologyBuilder()
+ .setVfModuleTopologyIdentifier(vfModuleTopologyIdentifierBuilder()
+ .setVfModuleName("vf-module-name").build()
+ ).build()
+ ).build()
+ )
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("test-svc-request-id")
- .setSvcAction(SvcAction.Assign)
- ))
- .setRequestInformation(build(requestInformation()
+ .setSvcAction(SvcAction.Assign).build()
+ )
+ .setRequestInformation(requestInformation()
.setRequestId("test-request-id")
- .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance)
- ))
- );
+ .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance).build()
+ ).build();
PreloadVfModuleTopologyOperationOutput output =
exec(genericResourceApiProvider::preloadVfModuleTopologyOperation, input, RpcResult::getResult);
@@ -153,24 +157,27 @@ public class PreloadVnfTopologyOperationRPCTest extends GenericResourceApiProvid
when(spyDataBroker.newWriteOnlyTransaction()).thenReturn(mockWriteTransaction);
genericResourceApiProvider.setDataBroker(spyDataBroker);
- PreloadVfModuleTopologyOperationInput input = build(preloadVfModuleTopologyOperationInput()
- .setPreloadVfModuleTopologyInformation(build(preloadVfModuleTopologyInformationBuilder()
- .setVnfTopologyIdentifierStructure(build(vnfTopologyIdentifierStructureBuilder()
+ PreloadVfModuleTopologyOperationInput input = preloadVfModuleTopologyOperationInput()
+ .setPreloadVfModuleTopologyInformation(preloadVfModuleTopologyInformationBuilder()
+ .setVnfTopologyIdentifierStructure(vnfTopologyIdentifierStructureBuilder()
.setVnfName("test-vnf-name")
- .setVnfType("test-vnf-type")))
- .setVfModuleTopology(build(vfModuleTopologyBuilder()
- .setVfModuleTopologyIdentifier(build(vfModuleTopologyIdentifierBuilder()
- .setVfModuleName("vf-module-name"))
- )))))
- .setSdncRequestHeader(build(sdncRequestHeader()
+ .setVnfType("test-vnf-type").build()
+ )
+ .setVfModuleTopology(vfModuleTopologyBuilder()
+ .setVfModuleTopologyIdentifier(vfModuleTopologyIdentifierBuilder()
+ .setVfModuleName("vf-module-name").build()
+ ).build()
+ ).build()
+ )
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("test-svc-request-id")
- .setSvcAction(SvcAction.Assign)
- ))
- .setRequestInformation(build(requestInformation()
+ .setSvcAction(SvcAction.Assign).build()
+ )
+ .setRequestInformation(requestInformation()
.setRequestId("test-request-id")
- .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance)
- ))
- );
+ .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance).build()
+ ).build();
+
PreloadVfModuleTopologyOperationOutput output =
exec(genericResourceApiProvider::preloadVfModuleTopologyOperation, input, RpcResult::getResult);
@@ -187,24 +194,27 @@ public class PreloadVnfTopologyOperationRPCTest extends GenericResourceApiProvid
PropBuilder svcResultProp = svcClient.createExecuteOKResult();
svcClient.mockExecute(svcResultProp);
- PreloadVfModuleTopologyOperationInput input = build(preloadVfModuleTopologyOperationInput()
- .setPreloadVfModuleTopologyInformation(build(preloadVfModuleTopologyInformationBuilder()
- .setVnfTopologyIdentifierStructure(build(vnfTopologyIdentifierStructureBuilder()
+ PreloadVfModuleTopologyOperationInput input = preloadVfModuleTopologyOperationInput()
+ .setPreloadVfModuleTopologyInformation(preloadVfModuleTopologyInformationBuilder()
+ .setVnfTopologyIdentifierStructure(vnfTopologyIdentifierStructureBuilder()
.setVnfName("test-vnf-name")
- .setVnfType("test-vnf-type")))
- .setVfModuleTopology(build(vfModuleTopologyBuilder()
- .setVfModuleTopologyIdentifier(build(vfModuleTopologyIdentifierBuilder()
- .setVfModuleName("vf-module-name"))
- )))))
- .setSdncRequestHeader(build(sdncRequestHeader()
+ .setVnfType("test-vnf-type").build()
+ )
+ .setVfModuleTopology(vfModuleTopologyBuilder()
+ .setVfModuleTopologyIdentifier(vfModuleTopologyIdentifierBuilder()
+ .setVfModuleName("vf-module-name").build()
+ ).build()
+ ).build()
+ )
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("test-svc-request-id")
- .setSvcAction(SvcAction.Assign)
- ))
- .setRequestInformation(build(requestInformation()
+ .setSvcAction(SvcAction.Assign).build()
+ )
+ .setRequestInformation(requestInformation()
.setRequestId("test-request-id")
- .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance)
- ))
- );
+ .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance).build()
+ ).build();
+
PreloadVfModuleTopologyOperationOutput output =
exec(genericResourceApiProvider::preloadVfModuleTopologyOperation, input, RpcResult::getResult);
@@ -224,24 +234,26 @@ public class PreloadVnfTopologyOperationRPCTest extends GenericResourceApiProvid
PropBuilder svcResultProp = svcClient.createExecuteOKResult();
svcClient.mockExecute(svcResultProp);
- PreloadVfModuleTopologyOperationInput input = build(preloadVfModuleTopologyOperationInput()
- .setPreloadVfModuleTopologyInformation(build(preloadVfModuleTopologyInformationBuilder()
- .setVnfTopologyIdentifierStructure(build(vnfTopologyIdentifierStructureBuilder()
+ PreloadVfModuleTopologyOperationInput input = preloadVfModuleTopologyOperationInput()
+ .setPreloadVfModuleTopologyInformation(preloadVfModuleTopologyInformationBuilder()
+ .setVnfTopologyIdentifierStructure(vnfTopologyIdentifierStructureBuilder()
.setVnfName("test-vnf-name")
- .setVnfType("test-vnf-type")))
- .setVfModuleTopology(build(vfModuleTopologyBuilder()
- .setVfModuleTopologyIdentifier(build(vfModuleTopologyIdentifierBuilder()
- .setVfModuleName("vf-module-name"))
- )))))
- .setSdncRequestHeader(build(sdncRequestHeader()
+ .setVnfType("test-vnf-type").build()
+ )
+ .setVfModuleTopology(vfModuleTopologyBuilder()
+ .setVfModuleTopologyIdentifier(vfModuleTopologyIdentifierBuilder()
+ .setVfModuleName("vf-module-name").build()
+ ).build()
+ ).build()
+ )
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("test-svc-request-id")
- .setSvcAction(SvcAction.Delete)
- ))
- .setRequestInformation(build(requestInformation()
+ .setSvcAction(SvcAction.Delete).build()
+ )
+ .setRequestInformation(requestInformation()
.setRequestId("test-request-id")
- .setRequestAction(RequestInformation.RequestAction.DeleteServiceInstance)
- ))
- );
+ .setRequestAction(RequestInformation.RequestAction.DeleteServiceInstance).build()
+ ).build();
PreloadVfModuleTopologyOperationOutput output =
exec(genericResourceApiProvider::preloadVfModuleTopologyOperation, input, RpcResult::getResult);
@@ -257,11 +269,10 @@ public class PreloadVnfTopologyOperationRPCTest extends GenericResourceApiProvid
private PreloadVfModuleTopologyOperationOutput createExpectedOutput(PropBuilder svcResultProp,
PreloadVfModuleTopologyOperationInput input) {
- return build(preloadVfModuleTopologyOperationOutput()
+ return preloadVfModuleTopologyOperationOutput()
.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId())
.setResponseCode(svcResultProp.get(svcClient.errorCode))
- .setAckFinalIndicator(svcResultProp.get(svcClient.ackFinal))
- );
+ .setAckFinalIndicator(svcResultProp.get(svcClient.ackFinal)).build();
}
}
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/SecurityZoneTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/SecurityZoneTopologyOperationRPCTest.java
index c572ab6f..00224d6a 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/SecurityZoneTopologyOperationRPCTest.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/SecurityZoneTopologyOperationRPCTest.java
@@ -7,7 +7,6 @@ import static org.onap.sdnc.northbound.GenericResourceApiProvider.APP_NAME;
import static org.onap.sdnc.northbound.GenericResourceApiProvider.INVALID_INPUT_ERROR_MESSAGE;
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;
@@ -62,7 +61,7 @@ public class SecurityZoneTopologyOperationRPCTest extends GenericResourceApiProv
@Test
public void should_fail_when_service_instance_id_not_present() throws Exception {
- SecurityZoneTopologyOperationInput input = build(securityZoneTopologyOperationInput());
+ SecurityZoneTopologyOperationInput input = securityZoneTopologyOperationInput().build();
SecurityZoneTopologyOperationOutput output =
exec(genericResourceApiProvider::securityZoneTopologyOperation, input, RpcResult::getResult);
@@ -76,15 +75,14 @@ public class SecurityZoneTopologyOperationRPCTest extends GenericResourceApiProv
@Test
public void should_fail_when_invalid_service_data() throws Exception {
- SecurityZoneTopologyOperationInput input = build(securityZoneTopologyOperationInput()
- .setSdncRequestHeader(build(sdncRequestHeader()
+ SecurityZoneTopologyOperationInput input = securityZoneTopologyOperationInput()
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("test-svc-request-id")
- .setSvcAction(SvcAction.Assign)
- ))
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- );
+ .setSvcAction(SvcAction.Assign).build()
+ )
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ ).build();
SecurityZoneTopologyOperationOutput output =
exec(genericResourceApiProvider::securityZoneTopologyOperation, input, RpcResult::getResult);
@@ -101,15 +99,14 @@ public class SecurityZoneTopologyOperationRPCTest extends GenericResourceApiProv
svcClient.mockHasGraph(true);
svcClient.mockExecute(new RuntimeException("test exception"));
- SecurityZoneTopologyOperationInput input = build(securityZoneTopologyOperationInput()
- .setSdncRequestHeader(build(sdncRequestHeader()
+ SecurityZoneTopologyOperationInput input = securityZoneTopologyOperationInput()
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("test-svc-request-id")
- .setSvcAction(SvcAction.Assign)
- ))
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- );
+ .setSvcAction(SvcAction.Assign).build()
+ )
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ ).build();
persistServiceInDataBroker(input);
@@ -126,15 +123,15 @@ public class SecurityZoneTopologyOperationRPCTest extends GenericResourceApiProv
svcClient.mockHasGraph(false);
- SecurityZoneTopologyOperationInput input = build(securityZoneTopologyOperationInput()
- .setSdncRequestHeader(build(sdncRequestHeader()
+ SecurityZoneTopologyOperationInput input = securityZoneTopologyOperationInput()
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("test-svc-request-id")
- .setSvcAction(SvcAction.Assign)
- ))
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- );
+ .setSvcAction(SvcAction.Assign).build()
+ )
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ ).build();
+
persistServiceInDataBroker(input);
@@ -159,15 +156,14 @@ public class SecurityZoneTopologyOperationRPCTest extends GenericResourceApiProv
when(spyDataBroker.newWriteOnlyTransaction()).thenReturn(mockWriteTransaction);
genericResourceApiProvider.setDataBroker(spyDataBroker);
- SecurityZoneTopologyOperationInput input = build(securityZoneTopologyOperationInput()
- .setSdncRequestHeader(build(sdncRequestHeader()
+ SecurityZoneTopologyOperationInput input = securityZoneTopologyOperationInput()
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("test-svc-request-id")
- .setSvcAction(SvcAction.Assign)
- ))
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- );
+ .setSvcAction(SvcAction.Assign).build()
+ )
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ ).build();
persistServiceInDataBroker(input);
@@ -187,19 +183,18 @@ public class SecurityZoneTopologyOperationRPCTest extends GenericResourceApiProv
svcResultProp.set("security-zone-object-path", "securityZoneObjectPath: XYZ");
svcClient.mockExecute(svcResultProp);
- SecurityZoneTopologyOperationInput input = build(securityZoneTopologyOperationInput()
- .setSdncRequestHeader(build(sdncRequestHeader()
+ SecurityZoneTopologyOperationInput input = securityZoneTopologyOperationInput()
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("test-svc-request-id")
- .setSvcAction(SvcAction.Assign)
- ))
- .setRequestInformation(build(requestInformation()
+ .setSvcAction(SvcAction.Assign).build()
+ )
+ .setRequestInformation(requestInformation()
.setRequestId("test-request-id")
- .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance)
- ))
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- );
+ .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance).build()
+ )
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ ).build();
Service service = persistServiceInDataBroker(input);
@@ -222,20 +217,20 @@ public class SecurityZoneTopologyOperationRPCTest extends GenericResourceApiProv
private Service persistServiceInDataBroker(SecurityZoneTopologyOperationInput input) throws Exception {
- Service service = build(service()
+ Service service = service()
.setServiceInstanceId(input.getServiceInformation().getServiceInstanceId())
- .setServiceData(build(serviceData()
- .setServiceLevelOperStatus(build(serviceLevelOperStatus()
+ .setServiceData(serviceData()
+ .setServiceLevelOperStatus(serviceLevelOperStatus()
.setOrderStatus(OrderStatus.Created)
.setModifyTimestamp(Instant.now().toString())
.setLastSvcRequestId(input.getSdncRequestHeader().getSvcRequestId())
.setLastRpcAction(LastRpcAction.Activate)
.setLastOrderStatus(LastOrderStatus.PendingAssignment)
.setLastAction(LastAction.ActivateNetworkInstance)
- .setCreateTimestamp(Instant.now().toString())
- ))
- ))
- );
+ .setCreateTimestamp(Instant.now().toString()).build()
+ ).build()
+ ).build();
+
db.write(true, service, LogicalDatastoreType.CONFIGURATION);
return service;
}
@@ -243,18 +238,18 @@ public class SecurityZoneTopologyOperationRPCTest extends GenericResourceApiProv
private SecurityZoneTopologyOperationOutput createExpectedOutput(PropBuilder propBuilder,
SecurityZoneTopologyOperationInput input) {
- return build(securityZoneTopologyOperationOutput()
- .setSecurityZoneResponseInformation(build(securityZoneResponseInformation()
- .setObjectPath(propBuilder.get("security-zone-object-path"))))
+ return securityZoneTopologyOperationOutput()
+ .setSecurityZoneResponseInformation(securityZoneResponseInformation()
+ .setObjectPath(propBuilder.get("security-zone-object-path")).build()
+ )
.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId())
.setResponseCode(propBuilder.get(svcClient.errorCode))
.setAckFinalIndicator(propBuilder.get(svcClient.ackFinal))
.setResponseMessage(propBuilder.get(svcClient.errorMessage))
- .setServiceResponseInformation(build(serviceResponseInformation()
+ .setServiceResponseInformation(serviceResponseInformation()
.setInstanceId(input.getServiceInformation().getServiceInstanceId())
- .setObjectPath(propBuilder.get(svcClient.serviceObjectPath))
- ))
- );
+ .setObjectPath(propBuilder.get(svcClient.serviceObjectPath)).build()
+ ).build();
}
private Service createExpectedService(
@@ -262,12 +257,13 @@ public class SecurityZoneTopologyOperationRPCTest extends GenericResourceApiProv
ServiceInformation expectedServiceInformation = expectedInput.getServiceInformation();
- return build(service()
- .setServiceInstanceId(expectedServiceInformation.getServiceInstanceId())
- .setServiceData(build(serviceData()))
- .setServiceData(expectedServiceData)
- .setServiceStatus(build(serviceStatus()))
- );
+ return service()
+ .setServiceInstanceId(expectedServiceInformation.getServiceInstanceId())
+ .setServiceData(serviceData().build()
+ )
+ .setServiceData(expectedServiceData)
+ .setServiceStatus(serviceStatus().build()
+ ).build();
}
}
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ServiceTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ServiceTopologyOperationRPCTest.java
index 25f3fc7e..26799cb1 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ServiceTopologyOperationRPCTest.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ServiceTopologyOperationRPCTest.java
@@ -27,7 +27,6 @@ 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.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;
@@ -120,16 +119,16 @@ public class ServiceTopologyOperationRPCTest extends GenericResourceApiProviderT
@Test
public void should_fail_when_service_info_not_present() throws Exception {
// create the ServiceTopologyOperationInput from the template
- ServiceTopologyOperationInput input = build(
+ ServiceTopologyOperationInput input =
serviceTopologyOperationInput()
- .setSdncRequestHeader(build(sdncRequestHeader()
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("svc-request-id: xyz")
- .setSvcAction(SvcAction.Assign)
- ))
- .setRequestInformation(build(requestInformation()
+ .setSvcAction(SvcAction.Assign).build()
+ )
+ .setRequestInformation(requestInformation()
.setRequestId("request-id: xyz")
- .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance)
- )));
+ .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance).build()
+ ).build();
//execute the mdsal exec
ServiceTopologyOperationOutput output = exec(
@@ -253,72 +252,68 @@ public class ServiceTopologyOperationRPCTest extends GenericResourceApiProviderT
private ServiceTopologyOperationInput createSTOI() {
- return build(
+ return
serviceTopologyOperationInput()
- .setSdncRequestHeader(build(sdncRequestHeader()
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("svc-request-id: xyz")
- .setSvcAction(SvcAction.Assign)
- ))
- .setRequestInformation(build(requestInformation()
+ .setSvcAction(SvcAction.Assign).build()
+ )
+ .setRequestInformation(requestInformation()
.setRequestId("request-id: xyz")
- .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance)
- ))
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("service-instance-id: xyz")
- ))
- );
+ .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance).build()
+ )
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("service-instance-id: xyz").build()
+ ).build();
}
private ServiceTopologyOperationInput deleteSTOI() {
- return build(
+ return
serviceTopologyOperationInput()
- .setSdncRequestHeader(build(sdncRequestHeader()
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("svc-request-id: xyz")
- .setSvcAction(SvcAction.Unassign)
- ))
- .setRequestInformation(build(requestInformation()
+ .setSvcAction(SvcAction.Unassign).build()
+ )
+ .setRequestInformation(requestInformation()
.setRequestId("request-id: xyz")
- .setRequestAction(RequestInformation.RequestAction.DeleteServiceInstance)
- ))
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("service-instance-id: xyz")
- ))
- );
+ .setRequestAction(RequestInformation.RequestAction.DeleteServiceInstance).build()
+ )
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("service-instance-id: xyz").build()
+ ).build();
}
private ServiceTopologyOperationInput deleteServiceSTOI() {
- return build(
+ return
serviceTopologyOperationInput()
- .setSdncRequestHeader(build(sdncRequestHeader()
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("svc-request-id: xyz")
- .setSvcAction(SvcAction.Delete)
- ))
- .setRequestInformation(build(requestInformation()
+ .setSvcAction(SvcAction.Delete).build()
+ )
+ .setRequestInformation(requestInformation()
.setRequestId("request-id: xyz")
- .setRequestAction(RequestInformation.RequestAction.DeleteServiceInstance)
- ))
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("service-instance-id: xyz")
- ))
- );
+ .setRequestAction(RequestInformation.RequestAction.DeleteServiceInstance).build()
+ )
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("service-instance-id: xyz").build()
+ ).build();
}
private ServiceTopologyOperationOutput createExpectedSTOO(PropBuilder expectedSvcResultProp,
ServiceTopologyOperationInput expectedServiceTopologyOperationInput) {
- return build(
+ return
serviceTopologyOperationOutput()
.setSvcRequestId(expectedServiceTopologyOperationInput.getSdncRequestHeader().getSvcRequestId())
.setResponseCode(expectedSvcResultProp.get(svcClient.errorCode))
.setAckFinalIndicator(expectedSvcResultProp.get(svcClient.ackFinal))
.setResponseMessage(expectedSvcResultProp.get(svcClient.errorMessage))
- .setServiceResponseInformation(build(serviceResponseInformation()
+ .setServiceResponseInformation(serviceResponseInformation()
.setInstanceId(expectedServiceTopologyOperationInput.getServiceInformation().getServiceInstanceId())
- .setObjectPath(expectedSvcResultProp.get(svcClient.serviceObjectPath))
- ))
- );
+ .setObjectPath(expectedSvcResultProp.get(svcClient.serviceObjectPath)).build()
+ ).build();
}
private Service createExpectedService(
@@ -336,12 +331,11 @@ public class ServiceTopologyOperationRPCTest extends GenericResourceApiProviderT
ServiceInformation expectedServiceInformation = expectedServiceTopologyOperationInput.getServiceInformation();
RequestInformation expectedRequestInformation = expectedServiceTopologyOperationInput.getRequestInformation();
- return build(
+ return
service()
.setServiceInstanceId(expectedServiceInformation.getServiceInstanceId())
- .setServiceData(build(serviceData()))
+ .setServiceData(serviceData().build())
.setServiceStatus(
- build(
serviceStatus()
.setAction(expectedRequestInformation.getRequestAction().name())
.setFinalIndicator(expectedServiceTopologyOperationOutput.getAckFinalIndicator())
@@ -350,10 +344,8 @@ public class ServiceTopologyOperationRPCTest extends GenericResourceApiProviderT
.setRpcAction(toRpcAction(expectedSdncRequestHeader.getSvcAction()))
.setRpcName(SVC_OPERATION)
.setRequestStatus(ServiceStatus.RequestStatus.Synccomplete)
- .setResponseTimestamp(responseTimeStamp)
- )
- )
- );
+ .setResponseTimestamp(responseTimeStamp).build()
+ ).build();
}
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
index 2e1f1cb1..1c6a468f 100644
--- 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
@@ -4,7 +4,6 @@ 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;
@@ -41,7 +40,7 @@ public class TunnelxconnTopologyOperationRPCTest extends GenericResourceApiProvi
@Test
public void should_fail_when_service_instance_id_not_present() throws Exception {
- TunnelxconnTopologyOperationInput input = build(tunnelxconnTopologyOperationInput());
+ TunnelxconnTopologyOperationInput input = tunnelxconnTopologyOperationInput().build();
TunnelxconnTopologyOperationOutput output =
exec(genericResourceApiProvider::tunnelxconnTopologyOperation, input, RpcResult::getResult);
@@ -57,15 +56,14 @@ public class TunnelxconnTopologyOperationRPCTest extends GenericResourceApiProvi
svcClient.mockHasGraph(true);
svcClient.mockExecuteWoServiceData(new RuntimeException("test exception"));
- TunnelxconnTopologyOperationInput input = build(tunnelxconnTopologyOperationInput()
- .setSdncRequestHeader(build(sdncRequestHeader()
+ TunnelxconnTopologyOperationInput input = tunnelxconnTopologyOperationInput()
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("test-svc-request-id")
- .setSvcAction(SvcAction.Assign)
- ))
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- );
+ .setSvcAction(SvcAction.Assign).build()
+ )
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ ).build();
TunnelxconnTopologyOperationOutput output =
exec(genericResourceApiProvider::tunnelxconnTopologyOperation, input, RpcResult::getResult);
@@ -80,15 +78,14 @@ public class TunnelxconnTopologyOperationRPCTest extends GenericResourceApiProvi
svcClient.mockHasGraph(false);
- TunnelxconnTopologyOperationInput input = build(tunnelxconnTopologyOperationInput()
- .setSdncRequestHeader(build(sdncRequestHeader()
+ TunnelxconnTopologyOperationInput input = tunnelxconnTopologyOperationInput()
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("test-svc-request-id")
- .setSvcAction(SvcAction.Assign)
- ))
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- );
+ .setSvcAction(SvcAction.Assign).build()
+ )
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ ).build();
TunnelxconnTopologyOperationOutput output =
exec(genericResourceApiProvider::tunnelxconnTopologyOperation, input, RpcResult::getResult);
@@ -106,15 +103,14 @@ public class TunnelxconnTopologyOperationRPCTest extends GenericResourceApiProvi
svcResultProp.set("security-zone-object-path", "securityZoneObjectPath: XYZ");
svcClient.mockExecuteWoServiceData(svcResultProp);
- TunnelxconnTopologyOperationInput input = build(tunnelxconnTopologyOperationInput()
- .setRequestInformation(build(requestInformation()
+ TunnelxconnTopologyOperationInput input = tunnelxconnTopologyOperationInput()
+ .setRequestInformation(requestInformation()
.setRequestId("test-request-id")
- .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance)
- ))
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- );
+ .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance).build()
+ )
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ ).build();
TunnelxconnTopologyOperationOutput output =
exec(genericResourceApiProvider::tunnelxconnTopologyOperation, input, RpcResult::getResult);
@@ -131,16 +127,16 @@ public class TunnelxconnTopologyOperationRPCTest extends GenericResourceApiProvi
private TunnelxconnTopologyOperationOutput createExpectedOutput(PropBuilder propBuilder,
TunnelxconnTopologyOperationInput input) {
- return build(tunnelxconnTopologyOperationOutput()
- .setTunnelxconnResponseInformation(build(tunnelxconnResponseInformation()
- .setObjectPath(propBuilder.get("tunnelxconn-object-path"))))
+ return tunnelxconnTopologyOperationOutput()
+ .setTunnelxconnResponseInformation(tunnelxconnResponseInformation()
+ .setObjectPath(propBuilder.get("tunnelxconn-object-path")).build()
+ )
.setResponseCode(propBuilder.get(svcClient.errorCode))
.setAckFinalIndicator(propBuilder.get(svcClient.ackFinal))
.setResponseMessage(propBuilder.get(svcClient.errorMessage))
- .setServiceResponseInformation(build(serviceResponseInformation()
+ .setServiceResponseInformation(serviceResponseInformation()
.setInstanceId(input.getServiceInformation().getServiceInstanceId())
- .setObjectPath(propBuilder.get(svcClient.serviceObjectPath))
- ))
- );
+ .setObjectPath(propBuilder.get(svcClient.serviceObjectPath)).build()
+ ).build();
}
}
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VfModuleTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VfModuleTopologyOperationRPCTest.java
index 81adeb87..84986e97 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VfModuleTopologyOperationRPCTest.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VfModuleTopologyOperationRPCTest.java
@@ -6,7 +6,6 @@ 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.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;
@@ -48,7 +47,7 @@ public class VfModuleTopologyOperationRPCTest extends GenericResourceApiProvider
@Test
public void should_fail_when_service_info_not_present() throws Exception {
- VfModuleTopologyOperationInput input = build(vfModuleTopologyOperationInput());
+ VfModuleTopologyOperationInput input = vfModuleTopologyOperationInput().build();
VfModuleTopologyOperationOutput output =
exec(genericResourceApiProvider::vfModuleTopologyOperation, input, RpcResult::getResult);
@@ -62,11 +61,10 @@ public class VfModuleTopologyOperationRPCTest extends GenericResourceApiProvider
@Test
public void should_fail_when_invalid_vnf_id() throws Exception {
- VfModuleTopologyOperationInput input = build(vfModuleTopologyOperationInput()
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- );
+ VfModuleTopologyOperationInput input = vfModuleTopologyOperationInput()
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ ).build();
VfModuleTopologyOperationOutput output =
exec(genericResourceApiProvider::vfModuleTopologyOperation, input, RpcResult::getResult);
@@ -102,17 +100,16 @@ public class VfModuleTopologyOperationRPCTest extends GenericResourceApiProvider
svcClient.mockHasGraph(true);
svcClient.mockExecute(new RuntimeException("test exception"));
- VfModuleTopologyOperationInput input = build(vfModuleTopologyOperationInput()
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- .setVnfInformation(build(vnfInformationBuilder()
- .setVnfId("test-vnf-id")
- ))
- .setVfModuleInformation(build(vfModuleInformationBuilder()
- .setVfModuleId("test-vf-module-id")
- ))
- );
+ VfModuleTopologyOperationInput input = vfModuleTopologyOperationInput()
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ )
+ .setVnfInformation(vnfInformationBuilder()
+ .setVnfId("test-vnf-id").build()
+ )
+ .setVfModuleInformation(vfModuleInformationBuilder()
+ .setVfModuleId("test-vf-module-id").build()
+ ).build();
VfModuleTopologyOperationOutput output =
exec(genericResourceApiProvider::vfModuleTopologyOperation, input, RpcResult::getResult);
@@ -127,17 +124,16 @@ public class VfModuleTopologyOperationRPCTest extends GenericResourceApiProvider
svcClient.mockHasGraph(false);
- VfModuleTopologyOperationInput input = build(vfModuleTopologyOperationInput()
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- .setVnfInformation(build(vnfInformationBuilder()
- .setVnfId("test-vnf-id")
- ))
- .setVfModuleInformation(build(vfModuleInformationBuilder()
- .setVfModuleId("test-vf-module-id")
- ))
- );
+ VfModuleTopologyOperationInput input = vfModuleTopologyOperationInput()
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ )
+ .setVnfInformation(vnfInformationBuilder()
+ .setVnfId("test-vnf-id").build()
+ )
+ .setVfModuleInformation(vfModuleInformationBuilder()
+ .setVfModuleId("test-vf-module-id").build()
+ ).build();
VfModuleTopologyOperationOutput output =
exec(genericResourceApiProvider::vfModuleTopologyOperation, input, RpcResult::getResult);
@@ -160,17 +156,16 @@ public class VfModuleTopologyOperationRPCTest extends GenericResourceApiProvider
when(spyDataBroker.newWriteOnlyTransaction()).thenReturn(mockWriteTransaction);
genericResourceApiProvider.setDataBroker(spyDataBroker);
- VfModuleTopologyOperationInput input = build(vfModuleTopologyOperationInput()
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- .setVnfInformation(build(vnfInformationBuilder()
- .setVnfId("test-vnf-id")
- ))
- .setVfModuleInformation(build(vfModuleInformationBuilder()
- .setVfModuleId("test-vf-module-id")
- ))
- );
+ VfModuleTopologyOperationInput input = vfModuleTopologyOperationInput()
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ )
+ .setVnfInformation(vnfInformationBuilder()
+ .setVnfId("test-vnf-id").build()
+ )
+ .setVfModuleInformation(vfModuleInformationBuilder()
+ .setVfModuleId("test-vf-module-id").build()
+ ).build();
VfModuleTopologyOperationOutput output =
exec(genericResourceApiProvider::vfModuleTopologyOperation, input, RpcResult::getResult);
@@ -187,25 +182,24 @@ public class VfModuleTopologyOperationRPCTest extends GenericResourceApiProvider
PropBuilder svcResultProp = svcClient.createExecuteOKResult();
svcClient.mockExecute(svcResultProp);
- VfModuleTopologyOperationInput input = build(vfModuleTopologyOperationInput()
- .setSdncRequestHeader(build(sdncRequestHeader()
+ VfModuleTopologyOperationInput input = vfModuleTopologyOperationInput()
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("test-svc-request-id")
- .setSvcAction(SvcAction.Assign)
- ))
- .setRequestInformation(build(requestInformation()
+ .setSvcAction(SvcAction.Assign).build()
+ )
+ .setRequestInformation(requestInformation()
.setRequestId("test-request-id")
- .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance)
- ))
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- .setVnfInformation(build(vnfInformationBuilder()
- .setVnfId("test-vnf-id")
- ))
- .setVfModuleInformation(build(vfModuleInformationBuilder()
- .setVfModuleId("test-vf-module-id")
- ))
- );
+ .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance).build()
+ )
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ )
+ .setVnfInformation(vnfInformationBuilder()
+ .setVnfId("test-vnf-id").build()
+ )
+ .setVfModuleInformation(vfModuleInformationBuilder()
+ .setVfModuleId("test-vf-module-id").build()
+ ).build();
VfModuleTopologyOperationOutput output =
exec(genericResourceApiProvider::vfModuleTopologyOperation, input, RpcResult::getResult);
@@ -220,23 +214,22 @@ public class VfModuleTopologyOperationRPCTest extends GenericResourceApiProvider
private VfModuleTopologyOperationOutput createExpectedVMTOO(PropBuilder propBuilder,
VfModuleTopologyOperationInput input) {
- return build(vfModuleTopologyOperationOutput()
+ return vfModuleTopologyOperationOutput()
.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId())
.setResponseCode(propBuilder.get(svcClient.errorCode))
.setAckFinalIndicator(propBuilder.get(svcClient.ackFinal))
.setResponseMessage(propBuilder.get(svcClient.errorMessage))
- .setServiceResponseInformation(build(serviceResponseInformation()
+ .setServiceResponseInformation(serviceResponseInformation()
.setInstanceId(input.getServiceInformation().getServiceInstanceId())
- .setObjectPath(propBuilder.get(svcClient.serviceObjectPath)))
+ .setObjectPath(propBuilder.get(svcClient.serviceObjectPath)).build()
)
- .setVnfResponseInformation(build(vnfResponseInformation()
+ .setVnfResponseInformation(vnfResponseInformation()
.setInstanceId(input.getVnfInformation().getVnfId())
- .setObjectPath(propBuilder.get(svcClient.vnfObjectPath)))
+ .setObjectPath(propBuilder.get(svcClient.vnfObjectPath)).build()
)
- .setVfModuleResponseInformation(build(vfModuleResponseInformation()
+ .setVfModuleResponseInformation(vfModuleResponseInformation()
.setInstanceId(input.getVfModuleInformation().getVfModuleId())
- .setObjectPath(propBuilder.get(svcClient.vfModuleObjectPath)))
- )
- );
+ .setObjectPath(propBuilder.get(svcClient.vfModuleObjectPath)).build()
+ ).build();
}
}
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VnfTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VnfTopologyOperationRPCTest.java
index c1564c39..cc5e8975 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VnfTopologyOperationRPCTest.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VnfTopologyOperationRPCTest.java
@@ -6,7 +6,6 @@ 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.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;
@@ -46,7 +45,7 @@ public class VnfTopologyOperationRPCTest extends GenericResourceApiProviderTest
@Test
public void should_fail_when_service_info_not_present() throws Exception {
- VnfTopologyOperationInput input = build(vnfTopologyOperationInput());
+ VnfTopologyOperationInput input = vnfTopologyOperationInput().build();
VnfTopologyOperationOutput output =
exec(genericResourceApiProvider::vnfTopologyOperation, input, RpcResult::getResult);
@@ -82,14 +81,13 @@ public class VnfTopologyOperationRPCTest extends GenericResourceApiProviderTest
svcClient.mockHasGraph(true);
svcClient.mockExecute(new RuntimeException("test exception"));
- VnfTopologyOperationInput input = build(vnfTopologyOperationInput()
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- .setVnfInformation(build(vnfInformationBuilder()
- .setVnfId("test-vnf-id")
- ))
- );
+ VnfTopologyOperationInput input = vnfTopologyOperationInput()
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ )
+ .setVnfInformation(vnfInformationBuilder()
+ .setVnfId("test-vnf-id").build()
+ ).build();
VnfTopologyOperationOutput output =
exec(genericResourceApiProvider::vnfTopologyOperation, input, RpcResult::getResult);
@@ -104,14 +102,13 @@ public class VnfTopologyOperationRPCTest extends GenericResourceApiProviderTest
svcClient.mockHasGraph(false);
- VnfTopologyOperationInput input = build(vnfTopologyOperationInput()
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- .setVnfInformation(build(vnfInformationBuilder()
- .setVnfId("test-vnf-id")
- ))
- );
+ VnfTopologyOperationInput input = vnfTopologyOperationInput()
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ )
+ .setVnfInformation(vnfInformationBuilder()
+ .setVnfId("test-vnf-id").build()
+ ).build();
VnfTopologyOperationOutput output =
exec(genericResourceApiProvider::vnfTopologyOperation, input, RpcResult::getResult);
@@ -134,14 +131,13 @@ public class VnfTopologyOperationRPCTest extends GenericResourceApiProviderTest
when(spyDataBroker.newWriteOnlyTransaction()).thenReturn(mockWriteTransaction);
genericResourceApiProvider.setDataBroker(spyDataBroker);
- VnfTopologyOperationInput input = build(vnfTopologyOperationInput()
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- .setVnfInformation(build(vnfInformationBuilder()
- .setVnfId("test-vnf-id")
- ))
- );
+ VnfTopologyOperationInput input = vnfTopologyOperationInput()
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ )
+ .setVnfInformation(vnfInformationBuilder()
+ .setVnfId("test-vnf-id").build()
+ ).build();
VnfTopologyOperationOutput output =
exec(genericResourceApiProvider::vnfTopologyOperation, input, RpcResult::getResult);
@@ -158,22 +154,21 @@ public class VnfTopologyOperationRPCTest extends GenericResourceApiProviderTest
PropBuilder svcResultProp = svcClient.createExecuteOKResult();
svcClient.mockExecute(svcResultProp);
- VnfTopologyOperationInput input = build(vnfTopologyOperationInput()
- .setSdncRequestHeader(build(sdncRequestHeader()
+ VnfTopologyOperationInput input = vnfTopologyOperationInput()
+ .setSdncRequestHeader(sdncRequestHeader()
.setSvcRequestId("test-svc-request-id")
- .setSvcAction(SvcAction.Assign)
- ))
- .setRequestInformation(build(requestInformation()
+ .setSvcAction(SvcAction.Assign).build()
+ )
+ .setRequestInformation(requestInformation()
.setRequestId("test-request-id")
- .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance)
- ))
- .setServiceInformation(build(serviceInformationBuilder()
- .setServiceInstanceId("test-service-instance-id")
- ))
- .setVnfInformation(build(vnfInformationBuilder()
- .setVnfId("test-vnf-id")
- ))
- );
+ .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance).build()
+ )
+ .setServiceInformation(serviceInformationBuilder()
+ .setServiceInstanceId("test-service-instance-id").build()
+ )
+ .setVnfInformation(vnfInformationBuilder()
+ .setVnfId("test-vnf-id").build()
+ ).build();
VnfTopologyOperationOutput output =
exec(genericResourceApiProvider::vnfTopologyOperation, input, RpcResult::getResult);
@@ -189,20 +184,19 @@ public class VnfTopologyOperationRPCTest extends GenericResourceApiProviderTest
private VnfTopologyOperationOutput createExpectedOutput(PropBuilder svcResultProp,
VnfTopologyOperationInput vnfTopologyOperationInput) {
- return build(
+ return
vnfTopologyOperationOutput()
.setSvcRequestId(vnfTopologyOperationInput.getSdncRequestHeader().getSvcRequestId())
.setResponseCode(svcResultProp.get(svcClient.errorCode))
.setAckFinalIndicator(svcResultProp.get(svcClient.ackFinal))
.setResponseMessage(svcResultProp.get(svcClient.errorMessage))
- .setServiceResponseInformation(build(serviceResponseInformation()
+ .setServiceResponseInformation(serviceResponseInformation()
.setInstanceId(vnfTopologyOperationInput.getServiceInformation().getServiceInstanceId())
- .setObjectPath(svcResultProp.get(svcClient.serviceObjectPath))
- ))
- .setVnfResponseInformation(build(vnfResponseInformation()
+ .setObjectPath(svcResultProp.get(svcClient.serviceObjectPath)).build()
+ )
+ .setVnfResponseInformation(vnfResponseInformation()
.setInstanceId(vnfTopologyOperationInput.getVnfInformation().getVnfId())
- .setObjectPath(svcResultProp.get(svcClient.vnfObjectPath))
- ))
- );
+ .setObjectPath(svcResultProp.get(svcClient.vnfObjectPath)).build()
+ ).build();
}
}
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/DataBrokerUtil.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/DataBrokerUtil.java
index 8bfea834..6ac43e86 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/DataBrokerUtil.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/DataBrokerUtil.java
@@ -42,7 +42,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.status.ServiceStatusBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import static org.onap.sdnc.northbound.util.MDSALUtil.build;
+
/**
@@ -72,12 +72,13 @@ public class DataBrokerUtil {
//The toString() value from a Service object returned form data.get() is different than the toString() value
//from a Service Object constructed from a Builder. This makes it difficult to compare deltas when doing a
// assertEquals. That why we rebuild it her to solve that problem.
- return build(ServiceBuilder::new,data.get(),(service) -> service
- .setServiceStatus(build(ServiceStatusBuilder::new,service.getServiceStatus()))
- .setServiceData(build(ServiceDataBuilder::new,service.getServiceData(),(serviceStatus)->serviceStatus
- .setServiceLevelOperStatus(build(ServiceLevelOperStatusBuilder::new,serviceStatus.getServiceLevelOperStatus()))
- ))
- );
+ ServiceBuilder svcBuilder = new ServiceBuilder();
+ svcBuilder.setServiceStatus(data.get().getServiceStatus());
+ ServiceDataBuilder svcDataBuilder = new ServiceDataBuilder(data.get().getServiceData());
+ svcDataBuilder.setServiceLevelOperStatus(data.get().getServiceData().getServiceLevelOperStatus());
+ svcBuilder.setServiceData(svcDataBuilder.build());
+ svcBuilder.setServiceInstanceId(data.get().getServiceInstanceId());
+ return svcBuilder.build();
}
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 b0cd627e..51eaa1fd 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
@@ -24,7 +24,6 @@ package org.onap.sdnc.northbound.util;
import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.isA;
import static org.mockito.Mockito.when;
-import static org.onap.sdnc.northbound.util.MDSALUtil.build;
import static org.onap.sdnc.northbound.util.PropBuilder.propBuilder;
import java.util.Properties;
@@ -121,7 +120,7 @@ public class GenericResourceApiSvcLogicServiceClientMockUtil {
eq(MODE),
isA(ServiceDataBuilder.class),
isA(Properties.class))
- ).thenReturn(build(svcResultProp));
+ ).thenReturn(svcResultProp.build());
}
public void mockExecute(RuntimeException exception) throws Exception {
@@ -148,7 +147,7 @@ public class GenericResourceApiSvcLogicServiceClientMockUtil {
eq(VERSION),
eq(MODE),
isA(Properties.class))
- ).thenReturn(build(svcResultProp));
+ ).thenReturn(svcResultProp.build());
}
public void mockExecuteWoServiceData(RuntimeException exception) throws 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 840b4228..5db09f92 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
@@ -92,7 +92,6 @@ 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.pnf.details.PnfDetailsBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.pnf.response.information.PnfResponseInformationBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.pnf.topology.identifier.structure.PnfTopologyIdentifierStructureBuilder;
-import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.common.RpcResult;
@@ -353,28 +352,6 @@ public class MDSALUtil {
return new ServiceLevelOperStatusBuilder();
}
- public static <P> P build(Builder<P> b) {
- return b == null ? null : b.build();
- }
-
- public static <P, B extends Builder<P>> P build(Function<P, B> builderConstructor, P sourceDataObject) {
- if (sourceDataObject == null) {
- return null;
- }
- B bp = builderConstructor.apply(sourceDataObject);
- return bp.build();
- }
-
- public static <P, B extends Builder<P>> P build(Function<P, B> builderConstructor, P sourceDataObject,
- Consumer<B> builder) {
- if (sourceDataObject == null) {
- return null;
- }
- B bp = builderConstructor.apply(sourceDataObject);
- builder.accept(bp);
- return bp.build();
- }
-
public static <I, O> O exec(Function<I, Future<RpcResult<O>>> rpc, I rpcParameter,
Function<RpcResult<O>, O> rpcResult) throws Exception {
Future<RpcResult<O>> future = rpc.apply(rpcParameter);