@Test public void changeConfigurationRejectedVerifyReturnValue() { when(chargePointService.changeConfiguration(any(ChangeConfigurationRequest.class), eq(CHARGING_STATION_ID.getId()))).thenReturn(getChangeConfigurationResponse(ConfigurationStatus.REJECTED)); boolean hasConfigurationChanged = client.changeConfiguration(CHARGING_STATION_ID, CONFIGURATION_ITEM); assertFalse(hasConfigurationChanged); }
@Override public boolean changeConfiguration(ChargingStationId id, ConfigurationItem configurationItem) { checkNotNull(id); checkNotNull(configurationItem); final String key = configurationItem.getKey(); final String value = configurationItem.getValue(); ChargePointService chargePointService = this.createChargingStationService(id); ChangeConfigurationRequest request = new ChangeConfigurationRequest(); request.setKey(key); request.setValue(value); ChangeConfigurationResponse response = chargePointService.changeConfiguration(request, id.getId()); boolean hasConfigurationChanged; switch (response.getStatus()) { case ACCEPTED: LOG.info("Configuration change of {} on {} has been accepted", key, id); hasConfigurationChanged = true; break; case REJECTED: LOG.info("Configuration change of {} on {} was rejected", key, id); hasConfigurationChanged = false; break; case NOT_SUPPORTED: LOG.info("Configuration change of {} on {} was not supported", key, id); hasConfigurationChanged = false; break; default: throw new AssertionError("Configuration change returned unknown response status " + response.getStatus()); } return hasConfigurationChanged; }
ChargingStationOcpp15SoapClient implements ChargingStationOcpp15Client { @Override public boolean changeConfiguration(ChargingStationId id, ConfigurationItem configurationItem) { checkNotNull(id); checkNotNull(configurationItem); final String key = configurationItem.getKey(); final String value = configurationItem.getValue(); ChargePointService chargePointService = this.createChargingStationService(id); ChangeConfigurationRequest request = new ChangeConfigurationRequest(); request.setKey(key); request.setValue(value); ChangeConfigurationResponse response = chargePointService.changeConfiguration(request, id.getId()); boolean hasConfigurationChanged; switch (response.getStatus()) { case ACCEPTED: LOG.info("Configuration change of {} on {} has been accepted", key, id); hasConfigurationChanged = true; break; case REJECTED: LOG.info("Configuration change of {} on {} was rejected", key, id); hasConfigurationChanged = false; break; case NOT_SUPPORTED: LOG.info("Configuration change of {} on {} was not supported", key, id); hasConfigurationChanged = false; break; default: throw new AssertionError("Configuration change returned unknown response status " + response.getStatus()); } return hasConfigurationChanged; } }
ChargingStationOcpp15SoapClient implements ChargingStationOcpp15Client { @Override public boolean changeConfiguration(ChargingStationId id, ConfigurationItem configurationItem) { checkNotNull(id); checkNotNull(configurationItem); final String key = configurationItem.getKey(); final String value = configurationItem.getValue(); ChargePointService chargePointService = this.createChargingStationService(id); ChangeConfigurationRequest request = new ChangeConfigurationRequest(); request.setKey(key); request.setValue(value); ChangeConfigurationResponse response = chargePointService.changeConfiguration(request, id.getId()); boolean hasConfigurationChanged; switch (response.getStatus()) { case ACCEPTED: LOG.info("Configuration change of {} on {} has been accepted", key, id); hasConfigurationChanged = true; break; case REJECTED: LOG.info("Configuration change of {} on {} was rejected", key, id); hasConfigurationChanged = false; break; case NOT_SUPPORTED: LOG.info("Configuration change of {} on {} was not supported", key, id); hasConfigurationChanged = false; break; default: throw new AssertionError("Configuration change returned unknown response status " + response.getStatus()); } return hasConfigurationChanged; }  }
ChargingStationOcpp15SoapClient implements ChargingStationOcpp15Client { @Override public boolean changeConfiguration(ChargingStationId id, ConfigurationItem configurationItem) { checkNotNull(id); checkNotNull(configurationItem); final String key = configurationItem.getKey(); final String value = configurationItem.getValue(); ChargePointService chargePointService = this.createChargingStationService(id); ChangeConfigurationRequest request = new ChangeConfigurationRequest(); request.setKey(key); request.setValue(value); ChangeConfigurationResponse response = chargePointService.changeConfiguration(request, id.getId()); boolean hasConfigurationChanged; switch (response.getStatus()) { case ACCEPTED: LOG.info("Configuration change of {} on {} has been accepted", key, id); hasConfigurationChanged = true; break; case REJECTED: LOG.info("Configuration change of {} on {} was rejected", key, id); hasConfigurationChanged = false; break; case NOT_SUPPORTED: LOG.info("Configuration change of {} on {} was not supported", key, id); hasConfigurationChanged = false; break; default: throw new AssertionError("Configuration change returned unknown response status " + response.getStatus()); } return hasConfigurationChanged; }  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 boolean changeConfiguration(ChargingStationId id, ConfigurationItem configurationItem) { checkNotNull(id); checkNotNull(configurationItem); final String key = configurationItem.getKey(); final String value = configurationItem.getValue(); ChargePointService chargePointService = this.createChargingStationService(id); ChangeConfigurationRequest request = new ChangeConfigurationRequest(); request.setKey(key); request.setValue(value); ChangeConfigurationResponse response = chargePointService.changeConfiguration(request, id.getId()); boolean hasConfigurationChanged; switch (response.getStatus()) { case ACCEPTED: LOG.info("Configuration change of {} on {} has been accepted", key, id); hasConfigurationChanged = true; break; case REJECTED: LOG.info("Configuration change of {} on {} was rejected", key, id); hasConfigurationChanged = false; break; case NOT_SUPPORTED: LOG.info("Configuration change of {} on {} was not supported", key, id); hasConfigurationChanged = false; break; default: throw new AssertionError("Configuration change returned unknown response status " + response.getStatus()); } return hasConfigurationChanged; }  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);  }