@Test public void reserveNowFaultedVerifyReturnValue() { when(chargePointService.reserveNow(any(ReserveNowRequest.class), eq(CHARGING_STATION_ID.getId()))).thenReturn(getReserveNowResponse(ReservationStatus.FAULTED)); io.motown.domain.api.chargingstation.ReservationStatus reservationStatus = client.reserveNow(CHARGING_STATION_ID, EVSE_ID, IDENTIFYING_TOKEN, EXPIRY_DATE, PARENT_IDENTIFYING_TOKEN, RESERVATION_ID.getNumber()); assertEquals(io.motown.domain.api.chargingstation.ReservationStatus.FAULTED, reservationStatus); }
@Override public io.motown.domain.api.chargingstation.ReservationStatus reserveNow(ChargingStationId id, EvseId evseId, IdentifyingToken identifyingToken, Date expiryDate, IdentifyingToken parentIdentifyingToken, int reservationId) { ChargePointService chargePointService = this.createChargingStationService(id); ReserveNowRequest request = new ReserveNowRequest(); request.setConnectorId(evseId.getNumberedId()); request.setExpiryDate(expiryDate); request.setIdTag(identifyingToken.getToken()); request.setParentIdTag(parentIdentifyingToken != null ? parentIdentifyingToken.getToken() : null); request.setReservationId(reservationId); io.motown.ocpp.v15.soap.chargepoint.schema.ReservationStatus responseStatus = chargePointService.reserveNow(request, id.getId()).getStatus(); io.motown.domain.api.chargingstation.ReservationStatus result; switch (responseStatus) { case ACCEPTED: result = io.motown.domain.api.chargingstation.ReservationStatus.ACCEPTED; break; case FAULTED: result = io.motown.domain.api.chargingstation.ReservationStatus.FAULTED; break; case OCCUPIED: result = io.motown.domain.api.chargingstation.ReservationStatus.OCCUPIED; break; case REJECTED: result = io.motown.domain.api.chargingstation.ReservationStatus.REJECTED; break; case UNAVAILABLE: result = io.motown.domain.api.chargingstation.ReservationStatus.UNAVAILABLE; break; default: throw new AssertionError(String.format("Unknown response status [%s].", responseStatus)); } return result; }
ChargingStationOcpp15SoapClient implements ChargingStationOcpp15Client { @Override public io.motown.domain.api.chargingstation.ReservationStatus reserveNow(ChargingStationId id, EvseId evseId, IdentifyingToken identifyingToken, Date expiryDate, IdentifyingToken parentIdentifyingToken, int reservationId) { ChargePointService chargePointService = this.createChargingStationService(id); ReserveNowRequest request = new ReserveNowRequest(); request.setConnectorId(evseId.getNumberedId()); request.setExpiryDate(expiryDate); request.setIdTag(identifyingToken.getToken()); request.setParentIdTag(parentIdentifyingToken != null ? parentIdentifyingToken.getToken() : null); request.setReservationId(reservationId); io.motown.ocpp.v15.soap.chargepoint.schema.ReservationStatus responseStatus = chargePointService.reserveNow(request, id.getId()).getStatus(); io.motown.domain.api.chargingstation.ReservationStatus result; switch (responseStatus) { case ACCEPTED: result = io.motown.domain.api.chargingstation.ReservationStatus.ACCEPTED; break; case FAULTED: result = io.motown.domain.api.chargingstation.ReservationStatus.FAULTED; break; case OCCUPIED: result = io.motown.domain.api.chargingstation.ReservationStatus.OCCUPIED; break; case REJECTED: result = io.motown.domain.api.chargingstation.ReservationStatus.REJECTED; break; case UNAVAILABLE: result = io.motown.domain.api.chargingstation.ReservationStatus.UNAVAILABLE; break; default: throw new AssertionError(String.format("Unknown response status [%s].", responseStatus)); } return result; } }
ChargingStationOcpp15SoapClient implements ChargingStationOcpp15Client { @Override public io.motown.domain.api.chargingstation.ReservationStatus reserveNow(ChargingStationId id, EvseId evseId, IdentifyingToken identifyingToken, Date expiryDate, IdentifyingToken parentIdentifyingToken, int reservationId) { ChargePointService chargePointService = this.createChargingStationService(id); ReserveNowRequest request = new ReserveNowRequest(); request.setConnectorId(evseId.getNumberedId()); request.setExpiryDate(expiryDate); request.setIdTag(identifyingToken.getToken()); request.setParentIdTag(parentIdentifyingToken != null ? parentIdentifyingToken.getToken() : null); request.setReservationId(reservationId); io.motown.ocpp.v15.soap.chargepoint.schema.ReservationStatus responseStatus = chargePointService.reserveNow(request, id.getId()).getStatus(); io.motown.domain.api.chargingstation.ReservationStatus result; switch (responseStatus) { case ACCEPTED: result = io.motown.domain.api.chargingstation.ReservationStatus.ACCEPTED; break; case FAULTED: result = io.motown.domain.api.chargingstation.ReservationStatus.FAULTED; break; case OCCUPIED: result = io.motown.domain.api.chargingstation.ReservationStatus.OCCUPIED; break; case REJECTED: result = io.motown.domain.api.chargingstation.ReservationStatus.REJECTED; break; case UNAVAILABLE: result = io.motown.domain.api.chargingstation.ReservationStatus.UNAVAILABLE; break; default: throw new AssertionError(String.format("Unknown response status [%s].", responseStatus)); } return result; }  }
ChargingStationOcpp15SoapClient implements ChargingStationOcpp15Client { @Override public io.motown.domain.api.chargingstation.ReservationStatus reserveNow(ChargingStationId id, EvseId evseId, IdentifyingToken identifyingToken, Date expiryDate, IdentifyingToken parentIdentifyingToken, int reservationId) { ChargePointService chargePointService = this.createChargingStationService(id); ReserveNowRequest request = new ReserveNowRequest(); request.setConnectorId(evseId.getNumberedId()); request.setExpiryDate(expiryDate); request.setIdTag(identifyingToken.getToken()); request.setParentIdTag(parentIdentifyingToken != null ? parentIdentifyingToken.getToken() : null); request.setReservationId(reservationId); io.motown.ocpp.v15.soap.chargepoint.schema.ReservationStatus responseStatus = chargePointService.reserveNow(request, id.getId()).getStatus(); io.motown.domain.api.chargingstation.ReservationStatus result; switch (responseStatus) { case ACCEPTED: result = io.motown.domain.api.chargingstation.ReservationStatus.ACCEPTED; break; case FAULTED: result = io.motown.domain.api.chargingstation.ReservationStatus.FAULTED; break; case OCCUPIED: result = io.motown.domain.api.chargingstation.ReservationStatus.OCCUPIED; break; case REJECTED: result = io.motown.domain.api.chargingstation.ReservationStatus.REJECTED; break; case UNAVAILABLE: result = io.motown.domain.api.chargingstation.ReservationStatus.UNAVAILABLE; break; default: throw new AssertionError(String.format("Unknown response status [%s].", responseStatus)); } return result; }  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 io.motown.domain.api.chargingstation.ReservationStatus reserveNow(ChargingStationId id, EvseId evseId, IdentifyingToken identifyingToken, Date expiryDate, IdentifyingToken parentIdentifyingToken, int reservationId) { ChargePointService chargePointService = this.createChargingStationService(id); ReserveNowRequest request = new ReserveNowRequest(); request.setConnectorId(evseId.getNumberedId()); request.setExpiryDate(expiryDate); request.setIdTag(identifyingToken.getToken()); request.setParentIdTag(parentIdentifyingToken != null ? parentIdentifyingToken.getToken() : null); request.setReservationId(reservationId); io.motown.ocpp.v15.soap.chargepoint.schema.ReservationStatus responseStatus = chargePointService.reserveNow(request, id.getId()).getStatus(); io.motown.domain.api.chargingstation.ReservationStatus result; switch (responseStatus) { case ACCEPTED: result = io.motown.domain.api.chargingstation.ReservationStatus.ACCEPTED; break; case FAULTED: result = io.motown.domain.api.chargingstation.ReservationStatus.FAULTED; break; case OCCUPIED: result = io.motown.domain.api.chargingstation.ReservationStatus.OCCUPIED; break; case REJECTED: result = io.motown.domain.api.chargingstation.ReservationStatus.REJECTED; break; case UNAVAILABLE: result = io.motown.domain.api.chargingstation.ReservationStatus.UNAVAILABLE; break; default: throw new AssertionError(String.format("Unknown response status [%s].", responseStatus)); } return result; }  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);  }