Bump upstream dependencies to Ca
[transportpce.git] / olm / src / test / java / org / opendaylight / transportpce / olm / OlmPowerServiceRpcImplTest.java
index cf8541edc833c9d54c1c2723e6e39b4cb8c0f41e..19ed220051652313d58371cb154aac760a8f6562 100644 (file)
 
 package org.opendaylight.transportpce.olm;
 
-import com.google.common.util.concurrent.ListenableFuture;
 
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-import java.util.concurrent.ExecutionException;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.when;
 
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.controller.md.sal.binding.api.MountPoint;
-import org.opendaylight.controller.md.sal.binding.api.MountPointService;
-import org.opendaylight.transportpce.common.crossconnect.CrossConnect;
-import org.opendaylight.transportpce.common.crossconnect.CrossConnectImpl;
-import org.opendaylight.transportpce.common.crossconnect.CrossConnectImpl121;
-import org.opendaylight.transportpce.common.crossconnect.CrossConnectImpl22;
-import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
-import org.opendaylight.transportpce.common.device.DeviceTransactionManagerImpl;
-import org.opendaylight.transportpce.common.mapping.MappingUtils;
-import org.opendaylight.transportpce.common.mapping.MappingUtilsImpl;
-import org.opendaylight.transportpce.common.mapping.PortMapping;
-import org.opendaylight.transportpce.common.mapping.PortMappingImpl;
-import org.opendaylight.transportpce.common.mapping.PortMappingVersion121;
-import org.opendaylight.transportpce.common.mapping.PortMappingVersion22;
-import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaces;
-import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfacesImpl;
-import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfacesImpl121;
-import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfacesImpl22;
-import org.opendaylight.transportpce.olm.power.PowerMgmt;
+import com.google.common.util.concurrent.ListenableFuture;
+import java.util.concurrent.ExecutionException;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
+import org.opendaylight.mdsal.binding.api.RpcProviderService;
+import org.opendaylight.transportpce.olm.rpc.impl.CalculateSpanlossBaseImpl;
+import org.opendaylight.transportpce.olm.rpc.impl.CalculateSpanlossCurrentImpl;
+import org.opendaylight.transportpce.olm.rpc.impl.GetPmImpl;
+import org.opendaylight.transportpce.olm.rpc.impl.ServicePowerResetImpl;
+import org.opendaylight.transportpce.olm.rpc.impl.ServicePowerSetupImpl;
+import org.opendaylight.transportpce.olm.rpc.impl.ServicePowerTurndownImpl;
 import org.opendaylight.transportpce.olm.service.OlmPowerService;
-import org.opendaylight.transportpce.olm.service.OlmPowerServiceImpl;
-import org.opendaylight.transportpce.olm.stub.MountPointServiceStub;
-import org.opendaylight.transportpce.olm.stub.MountPointStub;
 import org.opendaylight.transportpce.olm.util.OlmPowerServiceRpcImplUtil;
 import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.CalculateSpanlossBaseInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.CalculateSpanlossBaseOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.CalculateSpanlossBaseOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.CalculateSpanlossCurrentInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.CalculateSpanlossCurrentOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.GetPmInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.GetPmOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.GetPmOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.ServicePowerResetInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.ServicePowerResetOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.ServicePowerSetupInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.ServicePowerSetupOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.ServicePowerSetupOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.ServicePowerTurndownInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.ServicePowerTurndownOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.ServicePowerTurndownOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev161014.CurrentPmlist;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev161014.CurrentPmlistBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev161014.current.pm.LayerRateBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev161014.current.pm.Measurements;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev161014.current.pm.MeasurementsBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev161014.current.pm.measurements.MeasurementBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev161014.currentpmlist.CurrentPm;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev161014.currentpmlist.CurrentPmBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev161014.PmDataType;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev161014.PmGranularity;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev161014.PmNamesEnum;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev161014.pm.measurement.PmParameterNameBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.resource.rev161014.resource.DeviceBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.resource.rev161014.resource.ResourceTypeBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.resource.rev161014.resource.resource.resource.CircuitPackBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.CalculateSpanlossBaseInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.CalculateSpanlossBaseOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.CalculateSpanlossCurrentInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.CalculateSpanlossCurrentInputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.CalculateSpanlossCurrentOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.GetPmInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.GetPmInputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.GetPmOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.GetPmOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.ServicePowerResetInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.ServicePowerResetOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.ServicePowerSetupInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.ServicePowerSetupOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.ServicePowerSetupOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.ServicePowerTurndownInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.ServicePowerTurndownOutputBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.resource.types.rev161014.ResourceTypeEnum;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev220926.PmGranularity;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev220926.olm.get.pm.input.ResourceIdentifierBuilder;
+import org.opendaylight.yangtools.yang.common.ErrorSeverity;
+import org.opendaylight.yangtools.yang.common.ErrorTag;
+import org.opendaylight.yangtools.yang.common.ErrorType;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 
-public class OlmPowerServiceRpcImplTest extends AbstractTest {
+@ExtendWith(MockitoExtension.class)
+class OlmPowerServiceRpcImplTest extends AbstractTest {
 
-    private MountPoint mountPoint;
-    private MountPointService mountPointService;
-    private DeviceTransactionManager deviceTransactionManager;
-    private CrossConnect crossConnect;
-    private OpenRoadmInterfaces openRoadmInterfaces;
-    private PortMapping portMapping;
-    private PowerMgmt powerMgmt;
+    @Mock
     private OlmPowerService olmPowerService;
-    private OlmPowerServiceRpcImpl olmPowerServiceRpc;
-    private MappingUtils mappingUtils;
-    private OpenRoadmInterfacesImpl121 openRoadmInterfacesImpl121;
-    private OpenRoadmInterfacesImpl22 openRoadmInterfacesImpl22;
-    private PortMappingVersion22 portMappingVersion22;
-    private PortMappingVersion121 portMappingVersion121;
-    private CrossConnectImpl121 crossConnectImpl121;
-    private CrossConnectImpl22 crossConnectImpl22;
-
-
-    @Before
-    public void setUp() {
-        this.mountPoint = new MountPointStub(this.getDataBroker());
-        this.mountPointService = new MountPointServiceStub(mountPoint);
-        this.deviceTransactionManager = new DeviceTransactionManagerImpl(mountPointService, 3000);
-        this.crossConnectImpl121 = new CrossConnectImpl121(this.deviceTransactionManager);
-        this.crossConnectImpl22 = new CrossConnectImpl22(this.deviceTransactionManager);
-        this.crossConnect = new CrossConnectImpl(this.deviceTransactionManager, this.mappingUtils,
-                this.crossConnectImpl121, this.crossConnectImpl22);
-        this.openRoadmInterfacesImpl121 = new OpenRoadmInterfacesImpl121(this.deviceTransactionManager);
-        this.openRoadmInterfacesImpl22 = new OpenRoadmInterfacesImpl22(this.deviceTransactionManager);
-        this.mappingUtils = new MappingUtilsImpl(getDataBroker());
-        this.openRoadmInterfaces = new OpenRoadmInterfacesImpl(deviceTransactionManager, mappingUtils,
-                openRoadmInterfacesImpl121, openRoadmInterfacesImpl22);
-        this.portMappingVersion22 =
-                new PortMappingVersion22(getDataBroker(), this.deviceTransactionManager, this.openRoadmInterfaces);
-        this.portMappingVersion121 =
-                new PortMappingVersion121(getDataBroker(), this.deviceTransactionManager, this.openRoadmInterfaces);
-        this.portMapping = new PortMappingImpl(getDataBroker(), this.portMappingVersion22, this.mappingUtils,
-                this.portMappingVersion121);
-        this.powerMgmt = new PowerMgmt(this.getDataBroker(), this.openRoadmInterfaces, this.crossConnect,
-            this.deviceTransactionManager);
-        this.olmPowerService = new OlmPowerServiceImpl(this.getDataBroker(), this.powerMgmt,
-            this.deviceTransactionManager, this.portMapping);
-        this.olmPowerServiceRpc = new OlmPowerServiceRpcImpl(this.olmPowerService);
-    }
+    @Mock
+    private RpcProviderService rpcProviderService;
 
     @Test
-    public void pmIsNotPresentTest() throws ExecutionException, InterruptedException {
-        GetPmInput input = OlmPowerServiceRpcImplUtil.getGetPmInput();
-        ListenableFuture<RpcResult<GetPmOutput>> output = this.olmPowerServiceRpc.getPm(input);
-        Assert.assertEquals(new GetPmOutputBuilder().build(), output.get().getResult());
-        Assert.assertEquals(null, output.get().getResult().getResourceId());
-        Assert.assertEquals(null, output.get().getResult().getMeasurements());
-        Assert.assertEquals(null, output.get().getResult().getGranularity());
-        Assert.assertEquals(null, output.get().getResult().getNodeId());
-        Assert.assertEquals(null, output.get().getResult().getResourceIdentifier());
-        Assert.assertEquals(null, output.get().getResult().getResourceType());
-    }
-
-    @Test
-    public void testGetPm1() throws ExecutionException, InterruptedException {
-        Measurements measurements = new MeasurementsBuilder().setMeasurement(
-            new MeasurementBuilder()
-                .setPmParameterUnit("unit")
-                .setPmParameterName(new PmParameterNameBuilder()
-                .setExtension("123")
-                .setType(PmNamesEnum.DefectSeconds).build())
-                .setPmParameterValue(new PmDataType(BigInteger.valueOf(1234))).build())
-            .build();
-        List<Measurements> measurementsList = new ArrayList<Measurements>();
-        measurementsList.add(measurements);
-
-        org.opendaylight.yang.gen.v1.http.org.openroadm.resource.rev161014.resource.Resource resource =
-            new org.opendaylight.yang.gen.v1.http.org.openroadm.resource.rev161014.resource.ResourceBuilder()
-                .setResource(new CircuitPackBuilder().setCircuitPackName("circuit pack name").build()).build();
-
-        org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev161014.current.pm.Resource resource2 =
-            new org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev161014.current.pm.ResourceBuilder()
-                .setDevice(new DeviceBuilder().setNodeId("node 1").build())
-                .setResourceType(new ResourceTypeBuilder()
-                    .setExtension("123")
-                    .setType(ResourceTypeEnum.Device).build())
-                .setResource(resource).build();
-        CurrentPm currentPm = new CurrentPmBuilder()
+    void testGetPmFailWithNodeIdNull() throws InterruptedException, ExecutionException {
+        GetPmInput input = new GetPmInputBuilder()
             .setGranularity(PmGranularity._15min)
-            .setId("id")
-            .setLayerRate(new LayerRateBuilder().build())
-            .setMeasurements(measurementsList)
-            .setResource(resource2)
-            .setRetrievalTime(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715
-                .DateAndTime("2018-11-01T12:00:31.456449+06:00")).build();
-
-        List<CurrentPm> currentPmList = new ArrayList<>();
-        currentPmList.add(currentPm);
-
-        Optional<CurrentPmlist> currentPmlistOptional = Optional.of(new CurrentPmlistBuilder()
-            .setCurrentPm(currentPmList).build());
-
-        org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.get.pm.output.Measurements
-            measurements1 = new org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.get.pm
-                .output.MeasurementsBuilder().setPmparameterName("name").setPmparameterValue("1234").build();
-
-
-        List<org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.get.pm.output
-            .Measurements> measurementsList1 = new ArrayList<>();
-        measurementsList1.add(measurements1);
-
-        GetPmInput input = OlmPowerServiceRpcImplUtil.getGetPmInput();
-        GetPmOutputBuilder pmOutputBuilder = new GetPmOutputBuilder().setNodeId(input.getNodeId())
-            .setResourceType(input.getResourceType())
-            .setResourceIdentifier(input.getResourceIdentifier())
-            .setGranularity(input.getGranularity())
-            .setMeasurements(measurementsList1);
-
-
-        ListenableFuture<RpcResult<GetPmOutput>> output = this.olmPowerServiceRpc.getPm(input);
-        Assert.assertEquals(new GetPmOutputBuilder().build(), output.get().getResult());
-        Assert.assertEquals(null, output.get().getResult().getResourceId());
+            .setResourceIdentifier(new ResourceIdentifierBuilder()
+                    .setResourceName("ots-deg1").build())
+            .setResourceType(ResourceTypeEnum.Interface)
+            .build();
+        ListenableFuture<RpcResult<GetPmOutput>> output = new GetPmImpl(olmPowerService).invoke(input);
+        assertFalse(output.get().isSuccessful());
+        assertNull(output.get().getResult());
+        assertEquals(ErrorType.RPC, output.get().getErrors().get(0).getErrorType());
+        assertEquals("Error with input parameters", output.get().getErrors().get(0).getMessage());
+        assertEquals(ErrorSeverity.ERROR, output.get().getErrors().get(0).getSeverity());
+        assertEquals(ErrorTag.OPERATION_FAILED, output.get().getErrors().get(0).getTag());
     }
 
-//    @Test
-//    public void testGetPm2() throws ExecutionException, InterruptedException {
-//        this.olmPowerService = Mockito.spy(this.olmPowerService);
-//        GetPmInput input = new GetPmInputBuilder().setGranularity(PmGranularity._15min).setNodeId("node1")
-//            .setResourceIdentifier(new ResourceIdentifierBuilder().setCircuitPackName("circuit pack name")
-//                .setResourceName("resource name").build()).setResourceType(ResourceTypeEnum.Device).build();
-//        org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev170418.get.pm.output.Measurements
-//        measurements1 = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev170418.get.pm
-//            .output.MeasurementsBuilder().setPmparameterName("name").setPmparameterValue("1234").build();
-//
-//
-//        List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev170418.get.pm.output
-//            .Measurements> measurementsList1 = new ArrayList<>();
-//        measurementsList1.add(measurements1);
-//
-//        GetPmOutputBuilder pmOutputBuilder = new GetPmOutputBuilder().setNodeId(input.getNodeId())
-//            .setResourceType(input.getResourceType())
-//            .setResourceIdentifier(input.getResourceIdentifier())
-//            .setGranularity(input.getGranularity())
-//            .setMeasurements(measurementsList1);
-//
-//        Mockito.doReturn(pmOutputBuilder.build()).when(this.olmPowerService).getPm(Mockito.any());
-//        ListenableFuture<RpcResult<GetPmOutput>> output = this.olmPowerServiceRpc.getPm(input);
-//        Assert.assertEquals(pmOutputBuilder.build(), output.get().getResult());
-//        Assert.assertEquals(true, output.get().isSuccessful());
-//    }
-
     @Test
-    public void testGetPm3() throws ExecutionException, InterruptedException {
-        GetPmInput input = OlmPowerServiceRpcImplUtil.getGetPmInput();
-        ListenableFuture<RpcResult<GetPmOutput>> output = this.olmPowerServiceRpc.getPm(input);
-        Assert.assertEquals(new GetPmOutputBuilder().build(), output.get().getResult());
-        Assert.assertEquals(null, output.get().getResult().getResourceId());
-        Assert.assertEquals(null, output.get().getResult().getMeasurements());
-        Assert.assertEquals(null, output.get().getResult().getGranularity());
-        Assert.assertEquals(null, output.get().getResult().getNodeId());
-        Assert.assertEquals(null, output.get().getResult().getResourceIdentifier());
-        Assert.assertEquals(null, output.get().getResult().getResourceType());
+    void testGetPmWithSuccess() throws InterruptedException, ExecutionException {
+        GetPmInput input = new GetPmInputBuilder()
+            .setNodeId("nodeId")
+            .build();
+        when(this.olmPowerService.getPm(any())).thenReturn(new GetPmOutputBuilder().build());
+        ListenableFuture<RpcResult<GetPmOutput>> output = new GetPmImpl(olmPowerService).invoke(input);
+        assertTrue(output.get().isSuccessful());
+        assertEquals(new GetPmOutputBuilder().build(), output.get().getResult());
     }
 
     @Test
-    public void testServicePowerSetup1() throws ExecutionException, InterruptedException {
+    void testServicePowerSetup() throws InterruptedException, ExecutionException {
         ServicePowerSetupInput input = OlmPowerServiceRpcImplUtil.getServicePowerSetupInput();
-        ListenableFuture<RpcResult<ServicePowerSetupOutput>> output = this.olmPowerServiceRpc.servicePowerSetup(input);
-        Assert.assertEquals(new ServicePowerSetupOutputBuilder().setResult("Success").build(), output.get()
-                .getResult());
-        Assert.assertEquals("Success", output.get().getResult().getResult());
-        Assert.assertEquals(true, output.get().isSuccessful());
+        when(this.olmPowerService.servicePowerSetup(any())).thenReturn(new ServicePowerSetupOutputBuilder().build());
+        ListenableFuture<RpcResult<ServicePowerSetupOutput>> output =
+            new ServicePowerSetupImpl(olmPowerService).invoke(input);
+        assertTrue(output.get().isSuccessful());
+        assertEquals(new ServicePowerSetupOutputBuilder().build(), output.get().getResult());
     }
 
-
     @Test
-    public void testServicePowerTurndown1() throws ExecutionException, InterruptedException {
+    void testServicePowerTurndown() throws InterruptedException, ExecutionException {
         ServicePowerTurndownInput input = OlmPowerServiceRpcImplUtil.getServicePowerTurndownInput();
-        ListenableFuture<RpcResult<ServicePowerTurndownOutput>> output = this.olmPowerServiceRpc
-            .servicePowerTurndown(input);
-        Assert.assertEquals(new ServicePowerTurndownOutputBuilder().setResult("Success").build(), output.get()
-            .getResult());
-        Assert.assertEquals("Success", output.get().getResult().getResult());
-        Assert.assertEquals(true, output.get().isSuccessful());
+        when(this.olmPowerService.servicePowerTurndown(any()))
+            .thenReturn(new ServicePowerTurndownOutputBuilder().build());
+        var output = new ServicePowerTurndownImpl(olmPowerService).invoke(input);
+        assertTrue(output.get().isSuccessful());
+        assertEquals(new ServicePowerTurndownOutputBuilder().build(), output.get().getResult());
     }
 
     @Test
-    public void testCalculateSpanlossBase1() throws ExecutionException, InterruptedException {
-        CalculateSpanlossBaseInput input = OlmPowerServiceRpcImplUtil.getCalculateSpanlossBaseInput();
-        ListenableFuture<RpcResult<CalculateSpanlossBaseOutput>> output = this.olmPowerServiceRpc
-            .calculateSpanlossBase(input);
-        Assert.assertEquals(new CalculateSpanlossBaseOutputBuilder().setResult("Failed").build(),
-            output.get().getResult());
-        Assert.assertEquals("Failed", output.get().getResult().getResult());
-        Assert.assertEquals(true, output.get().isSuccessful());
+    void testCalculateSpanlossBase() throws InterruptedException, ExecutionException {
+        CalculateSpanlossBaseInput input = OlmPowerServiceRpcImplUtil.getCalculateSpanlossBaseInputAll();
+        when(this.olmPowerService.calculateSpanlossBase(any()))
+            .thenReturn(new CalculateSpanlossBaseOutputBuilder().build());
+        var output = new CalculateSpanlossBaseImpl(olmPowerService).invoke(input);
+        assertTrue(output.get().isSuccessful());
+        assertEquals(new CalculateSpanlossBaseOutputBuilder().build(), output.get().getResult());
     }
 
     @Test
-    public void testCalculateSpanlossCurrent1() throws ExecutionException, InterruptedException {
-        CalculateSpanlossCurrentInput input = OlmPowerServiceRpcImplUtil.getCalculateSpanlossCurrentInput();
-        ListenableFuture<RpcResult<CalculateSpanlossCurrentOutput>> output = this.olmPowerServiceRpc
-            .calculateSpanlossCurrent(input);
-        Assert.assertEquals(null, output.get().getResult());
-        Assert.assertEquals(true, output.get().isSuccessful());
+    void testCalculateSpanlossCurrent() throws InterruptedException, ExecutionException {
+        CalculateSpanlossCurrentInput input = new CalculateSpanlossCurrentInputBuilder().build();
+        when(this.olmPowerService.calculateSpanlossCurrent(any()))
+            .thenReturn(new CalculateSpanlossCurrentOutputBuilder().build());
+        var output = new CalculateSpanlossCurrentImpl(olmPowerService).invoke(input);
+        assertTrue(output.get().isSuccessful());
+        assertEquals(new CalculateSpanlossCurrentOutputBuilder().build(), output.get().getResult());
     }
 
     @Test
-    public void testServicePowerResetInput() throws ExecutionException, InterruptedException {
+    void testServicePowerReset() throws InterruptedException, ExecutionException {
         ServicePowerResetInput input = OlmPowerServiceRpcImplUtil.getServicePowerResetInput();
-        ListenableFuture<RpcResult<ServicePowerResetOutput>> output = this.olmPowerServiceRpc
-            .servicePowerReset(input);
-        Assert.assertEquals(null, output.get().getResult());
-        Assert.assertEquals(true, output.get().isSuccessful());
+        when(this.olmPowerService.servicePowerReset(any()))
+            .thenReturn(new ServicePowerResetOutputBuilder().build());
+        var output = new ServicePowerResetImpl(olmPowerService).invoke(input);
+        assertTrue(output.get().isSuccessful());
+        assertEquals(new ServicePowerResetOutputBuilder().build(), output.get().getResult());
     }
 }