@Test public void authorizeAcceptedVerifyResponse() throws InterruptedException, ExecutionException { prepareAuthorization(AuthorizationResultStatus.ACCEPTED); AuthorizeRequest request = new AuthorizeRequest(); request.setIdTag(IDENTIFYING_TOKEN.getToken()); AuthorizeResponse response = motownCentralSystemService.authorize(request, CHARGING_STATION_ID.getId()); assertEquals(AuthorizationStatus.ACCEPTED, response.getIdTagInfo().getStatus()); }
@Override public AuthorizeResponse authorize(final AuthorizeRequest request, final String chargeBoxIdentity) { final AuthorizationFutureEventCallback future = new AuthorizationFutureEventCallback(); final ChargingStationId chargingStationId = new ChargingStationId(chargeBoxIdentity); FutureRequestHandler<AuthorizeResponse, AuthorizationResult> handler = new FutureRequestHandler<>(context.getMessageContext(), continuationTimeout); return handler.handle(future, new CallInitiator() { @Override public void initiateCall() { domainService.authorize(chargingStationId, request.getIdTag(), future, addOnIdentity); } }, new AuthorizeResponseFactory(), new ResponseFactory<AuthorizeResponse>() { @Override public AuthorizeResponse createResponse() { LOG.error("Error while handling 'authorize' request, returning invalid for idTag: {}", request.getIdTag()); AuthorizeResponse response = new AuthorizeResponse(); IdTagInfo tagInfo = new IdTagInfo(); tagInfo.setStatus(AuthorizationStatus.INVALID); response.setIdTagInfo(tagInfo); return response; } }); }
MotownCentralSystemService implements io.motown.ocpp.v15.soap.centralsystem.schema.CentralSystemService { @Override public AuthorizeResponse authorize(final AuthorizeRequest request, final String chargeBoxIdentity) { final AuthorizationFutureEventCallback future = new AuthorizationFutureEventCallback(); final ChargingStationId chargingStationId = new ChargingStationId(chargeBoxIdentity); FutureRequestHandler<AuthorizeResponse, AuthorizationResult> handler = new FutureRequestHandler<>(context.getMessageContext(), continuationTimeout); return handler.handle(future, new CallInitiator() { @Override public void initiateCall() { domainService.authorize(chargingStationId, request.getIdTag(), future, addOnIdentity); } }, new AuthorizeResponseFactory(), new ResponseFactory<AuthorizeResponse>() { @Override public AuthorizeResponse createResponse() { LOG.error("Error while handling 'authorize' request, returning invalid for idTag: {}", request.getIdTag()); AuthorizeResponse response = new AuthorizeResponse(); IdTagInfo tagInfo = new IdTagInfo(); tagInfo.setStatus(AuthorizationStatus.INVALID); response.setIdTagInfo(tagInfo); return response; } }); } }
MotownCentralSystemService implements io.motown.ocpp.v15.soap.centralsystem.schema.CentralSystemService { @Override public AuthorizeResponse authorize(final AuthorizeRequest request, final String chargeBoxIdentity) { final AuthorizationFutureEventCallback future = new AuthorizationFutureEventCallback(); final ChargingStationId chargingStationId = new ChargingStationId(chargeBoxIdentity); FutureRequestHandler<AuthorizeResponse, AuthorizationResult> handler = new FutureRequestHandler<>(context.getMessageContext(), continuationTimeout); return handler.handle(future, new CallInitiator() { @Override public void initiateCall() { domainService.authorize(chargingStationId, request.getIdTag(), future, addOnIdentity); } }, new AuthorizeResponseFactory(), new ResponseFactory<AuthorizeResponse>() { @Override public AuthorizeResponse createResponse() { LOG.error("Error while handling 'authorize' request, returning invalid for idTag: {}", request.getIdTag()); AuthorizeResponse response = new AuthorizeResponse(); IdTagInfo tagInfo = new IdTagInfo(); tagInfo.setStatus(AuthorizationStatus.INVALID); response.setIdTagInfo(tagInfo); return response; } }); }  }
MotownCentralSystemService implements io.motown.ocpp.v15.soap.centralsystem.schema.CentralSystemService { @Override public AuthorizeResponse authorize(final AuthorizeRequest request, final String chargeBoxIdentity) { final AuthorizationFutureEventCallback future = new AuthorizationFutureEventCallback(); final ChargingStationId chargingStationId = new ChargingStationId(chargeBoxIdentity); FutureRequestHandler<AuthorizeResponse, AuthorizationResult> handler = new FutureRequestHandler<>(context.getMessageContext(), continuationTimeout); return handler.handle(future, new CallInitiator() { @Override public void initiateCall() { domainService.authorize(chargingStationId, request.getIdTag(), future, addOnIdentity); } }, new AuthorizeResponseFactory(), new ResponseFactory<AuthorizeResponse>() { @Override public AuthorizeResponse createResponse() { LOG.error("Error while handling 'authorize' request, returning invalid for idTag: {}", request.getIdTag()); AuthorizeResponse response = new AuthorizeResponse(); IdTagInfo tagInfo = new IdTagInfo(); tagInfo.setStatus(AuthorizationStatus.INVALID); response.setIdTagInfo(tagInfo); return response; } }); }  @Override DataTransferResponse dataTransfer(final DataTransferRequest request, final String chargeBoxIdentity); @Override StatusNotificationResponse statusNotification(StatusNotificationRequest request, String chargeBoxIdentity); @Override StopTransactionResponse stopTransaction(StopTransactionRequest request, String chargeBoxIdentity); @Override BootNotificationResponse bootNotification(BootNotificationRequest request, String chargeBoxIdentity); @Override HeartbeatResponse heartbeat(HeartbeatRequest parameters, String chargeBoxIdentity); @Override MeterValuesResponse meterValues(MeterValuesRequest request, String chargeBoxIdentity); @Override DiagnosticsStatusNotificationResponse diagnosticsStatusNotification(DiagnosticsStatusNotificationRequest request, String chargeBoxIdentity); @Override AuthorizeResponse authorize(final AuthorizeRequest request, final String chargeBoxIdentity); @Override FirmwareStatusNotificationResponse firmwareStatusNotification(FirmwareStatusNotificationRequest request, String chargeBoxIdentity); @Override StartTransactionResponse startTransaction(final StartTransactionRequest parameters, final String chargeBoxIdentity); void setDomainService(DomainService domainService); void setContext(WebServiceContext context); void setContinuationTimeout(int continuationTimeout); void setHeartbeatIntervalFallback(int heartbeatIntervalFallback); void setSoapHeaderReader(SoapHeaderReader soapHeaderReader); void setAddOnId(String id); }
MotownCentralSystemService implements io.motown.ocpp.v15.soap.centralsystem.schema.CentralSystemService { @Override public AuthorizeResponse authorize(final AuthorizeRequest request, final String chargeBoxIdentity) { final AuthorizationFutureEventCallback future = new AuthorizationFutureEventCallback(); final ChargingStationId chargingStationId = new ChargingStationId(chargeBoxIdentity); FutureRequestHandler<AuthorizeResponse, AuthorizationResult> handler = new FutureRequestHandler<>(context.getMessageContext(), continuationTimeout); return handler.handle(future, new CallInitiator() { @Override public void initiateCall() { domainService.authorize(chargingStationId, request.getIdTag(), future, addOnIdentity); } }, new AuthorizeResponseFactory(), new ResponseFactory<AuthorizeResponse>() { @Override public AuthorizeResponse createResponse() { LOG.error("Error while handling 'authorize' request, returning invalid for idTag: {}", request.getIdTag()); AuthorizeResponse response = new AuthorizeResponse(); IdTagInfo tagInfo = new IdTagInfo(); tagInfo.setStatus(AuthorizationStatus.INVALID); response.setIdTagInfo(tagInfo); return response; } }); }  @Override DataTransferResponse dataTransfer(final DataTransferRequest request, final String chargeBoxIdentity); @Override StatusNotificationResponse statusNotification(StatusNotificationRequest request, String chargeBoxIdentity); @Override StopTransactionResponse stopTransaction(StopTransactionRequest request, String chargeBoxIdentity); @Override BootNotificationResponse bootNotification(BootNotificationRequest request, String chargeBoxIdentity); @Override HeartbeatResponse heartbeat(HeartbeatRequest parameters, String chargeBoxIdentity); @Override MeterValuesResponse meterValues(MeterValuesRequest request, String chargeBoxIdentity); @Override DiagnosticsStatusNotificationResponse diagnosticsStatusNotification(DiagnosticsStatusNotificationRequest request, String chargeBoxIdentity); @Override AuthorizeResponse authorize(final AuthorizeRequest request, final String chargeBoxIdentity); @Override FirmwareStatusNotificationResponse firmwareStatusNotification(FirmwareStatusNotificationRequest request, String chargeBoxIdentity); @Override StartTransactionResponse startTransaction(final StartTransactionRequest parameters, final String chargeBoxIdentity); void setDomainService(DomainService domainService); void setContext(WebServiceContext context); void setContinuationTimeout(int continuationTimeout); void setHeartbeatIntervalFallback(int heartbeatIntervalFallback); void setSoapHeaderReader(SoapHeaderReader soapHeaderReader); void setAddOnId(String id); static final String ADD_ON_TYPE; }