@Test public void dataTransferAcceptedVerifyReturnValue() { when(chargePointService.dataTransfer(any(DataTransferRequest.class), eq(CHARGING_STATION_ID.getId()))).thenReturn(getDataTransferResponse(DataTransferStatus.ACCEPTED)); DataTransferRequestResult result = client.dataTransfer(CHARGING_STATION_ID, DATA_TRANSFER_MESSAGE); assertEquals(RequestResult.SUCCESS, result.getRequestResult()); }
@Override public DataTransferRequestResult dataTransfer(ChargingStationId id, DataTransferMessage dataTransferMessage) { LOG.debug("Data transfer to {}", id); ChargePointService chargePointService = this.createChargingStationService(id); DataTransferRequest request = new DataTransferRequest(); request.setVendorId(dataTransferMessage.getVendorId()); request.setMessageId(dataTransferMessage.getMessageId()); request.setData(dataTransferMessage.getData()); DataTransferResponse response = chargePointService.dataTransfer(request, id.getId()); if (response.getStatus() == DataTransferStatus.UNKNOWN_MESSAGE_ID) { LOG.error("Unknown message id {} for datatransfer request", dataTransferMessage.getMessageId()); } else if(response.getStatus() == DataTransferStatus.UNKNOWN_VENDOR_ID) { LOG.error("Unknown vendor id {} for datatransfer request", dataTransferMessage.getVendorId()); } RequestResult requestResult = DataTransferStatus.ACCEPTED.equals(response.getStatus()) ? RequestResult.SUCCESS : RequestResult.FAILURE; return new DataTransferRequestResult(requestResult, response.getData()); }
ChargingStationOcpp15SoapClient implements ChargingStationOcpp15Client { @Override public DataTransferRequestResult dataTransfer(ChargingStationId id, DataTransferMessage dataTransferMessage) { LOG.debug("Data transfer to {}", id); ChargePointService chargePointService = this.createChargingStationService(id); DataTransferRequest request = new DataTransferRequest(); request.setVendorId(dataTransferMessage.getVendorId()); request.setMessageId(dataTransferMessage.getMessageId()); request.setData(dataTransferMessage.getData()); DataTransferResponse response = chargePointService.dataTransfer(request, id.getId()); if (response.getStatus() == DataTransferStatus.UNKNOWN_MESSAGE_ID) { LOG.error("Unknown message id {} for datatransfer request", dataTransferMessage.getMessageId()); } else if(response.getStatus() == DataTransferStatus.UNKNOWN_VENDOR_ID) { LOG.error("Unknown vendor id {} for datatransfer request", dataTransferMessage.getVendorId()); } RequestResult requestResult = DataTransferStatus.ACCEPTED.equals(response.getStatus()) ? RequestResult.SUCCESS : RequestResult.FAILURE; return new DataTransferRequestResult(requestResult, response.getData()); } }
ChargingStationOcpp15SoapClient implements ChargingStationOcpp15Client { @Override public DataTransferRequestResult dataTransfer(ChargingStationId id, DataTransferMessage dataTransferMessage) { LOG.debug("Data transfer to {}", id); ChargePointService chargePointService = this.createChargingStationService(id); DataTransferRequest request = new DataTransferRequest(); request.setVendorId(dataTransferMessage.getVendorId()); request.setMessageId(dataTransferMessage.getMessageId()); request.setData(dataTransferMessage.getData()); DataTransferResponse response = chargePointService.dataTransfer(request, id.getId()); if (response.getStatus() == DataTransferStatus.UNKNOWN_MESSAGE_ID) { LOG.error("Unknown message id {} for datatransfer request", dataTransferMessage.getMessageId()); } else if(response.getStatus() == DataTransferStatus.UNKNOWN_VENDOR_ID) { LOG.error("Unknown vendor id {} for datatransfer request", dataTransferMessage.getVendorId()); } RequestResult requestResult = DataTransferStatus.ACCEPTED.equals(response.getStatus()) ? RequestResult.SUCCESS : RequestResult.FAILURE; return new DataTransferRequestResult(requestResult, response.getData()); }  }
ChargingStationOcpp15SoapClient implements ChargingStationOcpp15Client { @Override public DataTransferRequestResult dataTransfer(ChargingStationId id, DataTransferMessage dataTransferMessage) { LOG.debug("Data transfer to {}", id); ChargePointService chargePointService = this.createChargingStationService(id); DataTransferRequest request = new DataTransferRequest(); request.setVendorId(dataTransferMessage.getVendorId()); request.setMessageId(dataTransferMessage.getMessageId()); request.setData(dataTransferMessage.getData()); DataTransferResponse response = chargePointService.dataTransfer(request, id.getId()); if (response.getStatus() == DataTransferStatus.UNKNOWN_MESSAGE_ID) { LOG.error("Unknown message id {} for datatransfer request", dataTransferMessage.getMessageId()); } else if(response.getStatus() == DataTransferStatus.UNKNOWN_VENDOR_ID) { LOG.error("Unknown vendor id {} for datatransfer request", dataTransferMessage.getVendorId()); } RequestResult requestResult = DataTransferStatus.ACCEPTED.equals(response.getStatus()) ? RequestResult.SUCCESS : RequestResult.FAILURE; return new DataTransferRequestResult(requestResult, response.getData()); }  Map<String, String> getConfiguration(ChargingStationId id, Set<String> keys); @Override boolean startTransaction(ChargingStationId id, IdentifyingToken identifyingToken, EvseId evseId); @Override boolean stopTransaction(ChargingStationId id, int transactionId); @Override boolean softReset(ChargingStationId id); @Override boolean hardReset(ChargingStationId id); @Override RequestResult unlockConnector(ChargingStationId id, EvseId evseId); @Override RequestResult changeAvailabilityToInoperative(ChargingStationId id, EvseId evseId); @Override RequestResult changeAvailabilityToOperative(ChargingStationId id, EvseId evseId); @Override DataTransferRequestResult dataTransfer(ChargingStationId id, DataTransferMessage dataTransferMessage); @Override boolean changeConfiguration(ChargingStationId id, ConfigurationItem configurationItem); @Override String getDiagnostics(ChargingStationId id, DiagnosticsUploadSettings diagnosticsUploadSettings); @Override boolean clearCache(ChargingStationId id); @Override void updateFirmware(ChargingStationId id, String downloadLocation, Date retrieveDate, Integer numRetries, Integer retryInterval); @Override int getAuthorizationListVersion(ChargingStationId id); @Override RequestResult sendAuthorizationList(ChargingStationId id, String hash, int listVersion, Set<IdentifyingToken> identifyingTokens, AuthorizationListUpdateType updateType); @Override io.motown.domain.api.chargingstation.ReservationStatus reserveNow(ChargingStationId id, EvseId evseId, IdentifyingToken identifyingToken, Date expiryDate, IdentifyingToken parentIdentifyingToken, int reservationId); @Override RequestResult cancelReservation(ChargingStationId id, int reservationId); void setDomainService(DomainService domainService); void setChargingStationProxyFactory(ChargingStationProxyFactory chargingStationProxyFactory); void setIdentifyingTokenConverterService(IdentifyingTokenConverterService identifyingTokenConverterService); }
ChargingStationOcpp15SoapClient implements ChargingStationOcpp15Client { @Override public DataTransferRequestResult dataTransfer(ChargingStationId id, DataTransferMessage dataTransferMessage) { LOG.debug("Data transfer to {}", id); ChargePointService chargePointService = this.createChargingStationService(id); DataTransferRequest request = new DataTransferRequest(); request.setVendorId(dataTransferMessage.getVendorId()); request.setMessageId(dataTransferMessage.getMessageId()); request.setData(dataTransferMessage.getData()); DataTransferResponse response = chargePointService.dataTransfer(request, id.getId()); if (response.getStatus() == DataTransferStatus.UNKNOWN_MESSAGE_ID) { LOG.error("Unknown message id {} for datatransfer request", dataTransferMessage.getMessageId()); } else if(response.getStatus() == DataTransferStatus.UNKNOWN_VENDOR_ID) { LOG.error("Unknown vendor id {} for datatransfer request", dataTransferMessage.getVendorId()); } RequestResult requestResult = DataTransferStatus.ACCEPTED.equals(response.getStatus()) ? RequestResult.SUCCESS : RequestResult.FAILURE; return new DataTransferRequestResult(requestResult, response.getData()); }  Map<String, String> getConfiguration(ChargingStationId id, Set<String> keys); @Override boolean startTransaction(ChargingStationId id, IdentifyingToken identifyingToken, EvseId evseId); @Override boolean stopTransaction(ChargingStationId id, int transactionId); @Override boolean softReset(ChargingStationId id); @Override boolean hardReset(ChargingStationId id); @Override RequestResult unlockConnector(ChargingStationId id, EvseId evseId); @Override RequestResult changeAvailabilityToInoperative(ChargingStationId id, EvseId evseId); @Override RequestResult changeAvailabilityToOperative(ChargingStationId id, EvseId evseId); @Override DataTransferRequestResult dataTransfer(ChargingStationId id, DataTransferMessage dataTransferMessage); @Override boolean changeConfiguration(ChargingStationId id, ConfigurationItem configurationItem); @Override String getDiagnostics(ChargingStationId id, DiagnosticsUploadSettings diagnosticsUploadSettings); @Override boolean clearCache(ChargingStationId id); @Override void updateFirmware(ChargingStationId id, String downloadLocation, Date retrieveDate, Integer numRetries, Integer retryInterval); @Override int getAuthorizationListVersion(ChargingStationId id); @Override RequestResult sendAuthorizationList(ChargingStationId id, String hash, int listVersion, Set<IdentifyingToken> identifyingTokens, AuthorizationListUpdateType updateType); @Override io.motown.domain.api.chargingstation.ReservationStatus reserveNow(ChargingStationId id, EvseId evseId, IdentifyingToken identifyingToken, Date expiryDate, IdentifyingToken parentIdentifyingToken, int reservationId); @Override RequestResult cancelReservation(ChargingStationId id, int reservationId); void setDomainService(DomainService domainService); void setChargingStationProxyFactory(ChargingStationProxyFactory chargingStationProxyFactory); void setIdentifyingTokenConverterService(IdentifyingTokenConverterService identifyingTokenConverterService);  }