@Test public void sendAuthorizationListUpdateTypeFullVerifyServiceCall() { ArgumentCaptor<SendLocalListRequest> sendLocalListArgument = ArgumentCaptor.forClass(SendLocalListRequest.class); when(chargePointService.sendLocalList(any(SendLocalListRequest.class), eq(CHARGING_STATION_ID.getId()))).thenReturn(getSendLocalListResponse(UpdateStatus.ACCEPTED)); client.sendAuthorizationList(CHARGING_STATION_ID, AUTH_LIST_HASH, LIST_VERSION, IDENTIFYING_TOKENS, AuthorizationListUpdateType.FULL); verify(chargePointService).sendLocalList(sendLocalListArgument.capture(), eq(CHARGING_STATION_ID.getId())); assertEquals(AUTH_LIST_HASH, sendLocalListArgument.getValue().getHash()); assertEquals(LIST_VERSION, sendLocalListArgument.getValue().getListVersion()); assertEquals(UpdateType.FULL, sendLocalListArgument.getValue().getUpdateType()); assertEquals(identifyingTokenConverterService.convertIdentifyingTokenList(IDENTIFYING_TOKENS).size(), sendLocalListArgument.getValue().getLocalAuthorisationList().size()); }
@Override public RequestResult sendAuthorizationList(ChargingStationId id, String hash, int listVersion, Set<IdentifyingToken> identifyingTokens, AuthorizationListUpdateType updateType) { ChargePointService chargePointService = this.createChargingStationService(id); SendLocalListRequest request = new SendLocalListRequest(); request.setHash(hash); request.setListVersion(listVersion); switch (updateType) { case DIFFERENTIAL: request.setUpdateType(UpdateType.DIFFERENTIAL); break; case FULL: request.setUpdateType(UpdateType.FULL); break; default: throw new AssertionError(String.format("Unknown update type [%s].", updateType)); } request.getLocalAuthorisationList().addAll(identifyingTokenConverterService.convertIdentifyingTokenList(identifyingTokens)); SendLocalListResponse response = chargePointService.sendLocalList(request, id.getId()); if (UpdateStatus.ACCEPTED.equals(response.getStatus())) { LOG.info("Update of local authorization list on {} has been accepted", id); return RequestResult.SUCCESS; } else { String responseStatus = response.getStatus() != null ? response.getStatus().value() : UNKNOWN_STATUS; LOG.warn("Update of local authorization list on {} has failed due to {}", id, responseStatus); return RequestResult.FAILURE; } }
ChargingStationOcpp15SoapClient implements ChargingStationOcpp15Client { @Override public RequestResult sendAuthorizationList(ChargingStationId id, String hash, int listVersion, Set<IdentifyingToken> identifyingTokens, AuthorizationListUpdateType updateType) { ChargePointService chargePointService = this.createChargingStationService(id); SendLocalListRequest request = new SendLocalListRequest(); request.setHash(hash); request.setListVersion(listVersion); switch (updateType) { case DIFFERENTIAL: request.setUpdateType(UpdateType.DIFFERENTIAL); break; case FULL: request.setUpdateType(UpdateType.FULL); break; default: throw new AssertionError(String.format("Unknown update type [%s].", updateType)); } request.getLocalAuthorisationList().addAll(identifyingTokenConverterService.convertIdentifyingTokenList(identifyingTokens)); SendLocalListResponse response = chargePointService.sendLocalList(request, id.getId()); if (UpdateStatus.ACCEPTED.equals(response.getStatus())) { LOG.info("Update of local authorization list on {} has been accepted", id); return RequestResult.SUCCESS; } else { String responseStatus = response.getStatus() != null ? response.getStatus().value() : UNKNOWN_STATUS; LOG.warn("Update of local authorization list on {} has failed due to {}", id, responseStatus); return RequestResult.FAILURE; } } }
ChargingStationOcpp15SoapClient implements ChargingStationOcpp15Client { @Override public RequestResult sendAuthorizationList(ChargingStationId id, String hash, int listVersion, Set<IdentifyingToken> identifyingTokens, AuthorizationListUpdateType updateType) { ChargePointService chargePointService = this.createChargingStationService(id); SendLocalListRequest request = new SendLocalListRequest(); request.setHash(hash); request.setListVersion(listVersion); switch (updateType) { case DIFFERENTIAL: request.setUpdateType(UpdateType.DIFFERENTIAL); break; case FULL: request.setUpdateType(UpdateType.FULL); break; default: throw new AssertionError(String.format("Unknown update type [%s].", updateType)); } request.getLocalAuthorisationList().addAll(identifyingTokenConverterService.convertIdentifyingTokenList(identifyingTokens)); SendLocalListResponse response = chargePointService.sendLocalList(request, id.getId()); if (UpdateStatus.ACCEPTED.equals(response.getStatus())) { LOG.info("Update of local authorization list on {} has been accepted", id); return RequestResult.SUCCESS; } else { String responseStatus = response.getStatus() != null ? response.getStatus().value() : UNKNOWN_STATUS; LOG.warn("Update of local authorization list on {} has failed due to {}", id, responseStatus); return RequestResult.FAILURE; } }  }
ChargingStationOcpp15SoapClient implements ChargingStationOcpp15Client { @Override public RequestResult sendAuthorizationList(ChargingStationId id, String hash, int listVersion, Set<IdentifyingToken> identifyingTokens, AuthorizationListUpdateType updateType) { ChargePointService chargePointService = this.createChargingStationService(id); SendLocalListRequest request = new SendLocalListRequest(); request.setHash(hash); request.setListVersion(listVersion); switch (updateType) { case DIFFERENTIAL: request.setUpdateType(UpdateType.DIFFERENTIAL); break; case FULL: request.setUpdateType(UpdateType.FULL); break; default: throw new AssertionError(String.format("Unknown update type [%s].", updateType)); } request.getLocalAuthorisationList().addAll(identifyingTokenConverterService.convertIdentifyingTokenList(identifyingTokens)); SendLocalListResponse response = chargePointService.sendLocalList(request, id.getId()); if (UpdateStatus.ACCEPTED.equals(response.getStatus())) { LOG.info("Update of local authorization list on {} has been accepted", id); return RequestResult.SUCCESS; } else { String responseStatus = response.getStatus() != null ? response.getStatus().value() : UNKNOWN_STATUS; LOG.warn("Update of local authorization list on {} has failed due to {}", id, responseStatus); return RequestResult.FAILURE; } }  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 RequestResult sendAuthorizationList(ChargingStationId id, String hash, int listVersion, Set<IdentifyingToken> identifyingTokens, AuthorizationListUpdateType updateType) { ChargePointService chargePointService = this.createChargingStationService(id); SendLocalListRequest request = new SendLocalListRequest(); request.setHash(hash); request.setListVersion(listVersion); switch (updateType) { case DIFFERENTIAL: request.setUpdateType(UpdateType.DIFFERENTIAL); break; case FULL: request.setUpdateType(UpdateType.FULL); break; default: throw new AssertionError(String.format("Unknown update type [%s].", updateType)); } request.getLocalAuthorisationList().addAll(identifyingTokenConverterService.convertIdentifyingTokenList(identifyingTokens)); SendLocalListResponse response = chargePointService.sendLocalList(request, id.getId()); if (UpdateStatus.ACCEPTED.equals(response.getStatus())) { LOG.info("Update of local authorization list on {} has been accepted", id); return RequestResult.SUCCESS; } else { String responseStatus = response.getStatus() != null ? response.getStatus().value() : UNKNOWN_STATUS; LOG.warn("Update of local authorization list on {} has failed due to {}", id, responseStatus); return RequestResult.FAILURE; } }  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);  }