-// @Test
-// public void serviceImplementationTerminationPointAsResourceNetwork() {
-//
-// ServiceImplementationRequestInput input = ServiceDataUtils
-// .buildServiceImplementationRequestInputTerminationPointResource(OpenRoadmInterfacesImpl.NETWORK_TOKEN);
-// writePortMapping(input, OpenRoadmInterfacesImpl.NETWORK_TOKEN);
-// ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input);
-// Assert.assertEquals(ResponseCodes.RESPONSE_OK, result.getConfigurationResponseCommon().getResponseCode());
-//
-// }
-//
-// @Test
-// public void serviceImplementationTerminationPointAsResourceClient() {
-// ServiceImplementationRequestInput input = ServiceDataUtils
-// .buildServiceImplementationRequestInputTerminationPointResource(OpenRoadmInterfacesImpl.CLIENT_TOKEN);
-// writePortMapping(input, OpenRoadmInterfacesImpl.CLIENT_TOKEN);
-// ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input);
-// Assert.assertEquals(ResponseCodes.RESPONSE_OK, result.getConfigurationResponseCommon().getResponseCode());
-// }
-//
-// @Test
-// public void serviceImplementationTerminationPointAsResourceNoMapping() {
-// String[] interfaceTokens = {
-// OpenRoadmInterfacesImpl.NETWORK_TOKEN,
-// OpenRoadmInterfacesImpl.CLIENT_TOKEN,
-// OpenRoadmInterfacesImpl.TTP_TOKEN,
-// OpenRoadmInterfacesImpl.PP_TOKEN
-// };
-// for (String tpToken : interfaceTokens) {
-// ServiceImplementationRequestInput input = ServiceDataUtils
-// .buildServiceImplementationRequestInputTerminationPointResource(tpToken);
-// ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input);
-// Assert.assertEquals(ResponseCodes.RESPONSE_FAILED,
-// result.getConfigurationResponseCommon().getResponseCode());
-// }
-// }
-
- private void writePortMapping(ServiceImplementationRequestInput input, String tpToken) {
- MountPointUtils.writeMapping(
- input.getServiceAEnd().getNodeId(),
- input.getServiceAEnd().getNodeId() + "-" + tpToken,
- this.deviceTransactionManager
- );
- MountPointUtils.writeMapping(
- input.getServiceZEnd().getNodeId(),
- input.getServiceZEnd().getNodeId() + "-" + tpToken,
- this.deviceTransactionManager
- );
+ @Test
+ void serviceImplementationServiceActive() throws InterruptedException, ExecutionException {
+ ServiceImplementationRequestInput input = ServiceDataUtils
+ .buildServiceImplementationRequestInputTerminationPointResource(StringConstants.NETWORK_TOKEN);
+ when(deviceRenderer.setupServicePath(any(), any(), any()))
+ .thenReturn(new ServicePathOutputBuilder().setResult("success").setSuccess(true).build());
+
+ when(rpcService.getRpc(ServicePowerSetup.class)).thenReturn(servicePowerSetup);
+ when(rpcService.getRpc(ServicePowerTurndown.class)).thenReturn(servicePowerTurndown);
+ when(rpcService.getRpc(GetPm.class)).thenReturn(getPm);
+ doReturn(RpcResultBuilder
+ .success(new ServicePowerSetupOutputBuilder().setResult(ResponseCodes.SUCCESS_RESULT).build())
+ .buildFuture()).when(servicePowerSetup).invoke(any());
+ GetPmOutput getPmOutput1 = null;
+ when(getPm.invoke(any())).thenReturn(RpcResultBuilder.success(getPmOutput1).buildFuture());
+ ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input, false)
+ .get();
+ assertEquals(ResponseCodes.RESPONSE_OK, result.getConfigurationResponseCommon().getResponseCode());