@Test public void meterValuesVerifyServiceCall() { MeterValuesRequest request = new MeterValuesRequest(); request.setConnectorId(EVSE_ID.getNumberedId()); request.setTransactionId(TRANSACTION_NUMBER); List<io.motown.ocpp.v15.soap.centralsystem.schema.MeterValue> meterValuesSoap = getMeterValuesSoap(4); request.getValues().addAll(meterValuesSoap); List<io.motown.domain.api.chargingstation.MeterValue> expectedMeterValuesList = new ArrayList<>(); for (io.motown.ocpp.v15.soap.centralsystem.schema.MeterValue mv : meterValuesSoap) { for (io.motown.ocpp.v15.soap.centralsystem.schema.MeterValue.Value value : mv.getValue()) { expectedMeterValuesList.add(new io.motown.domain.api.chargingstation.MeterValue(mv.getTimestamp(), value.getValue())); } } motownCentralSystemService.meterValues(request, CHARGING_STATION_ID.getId()); verify(domainService).meterValues(CHARGING_STATION_ID, TRANSACTION_ID, EVSE_ID, expectedMeterValuesList, OCPPS15_ADD_ON_IDENTITY); }
@Override public MeterValuesResponse meterValues(MeterValuesRequest request, String chargeBoxIdentity) { ChargingStationId chargingStationId = new ChargingStationId(chargeBoxIdentity); TransactionId transactionId = request.getTransactionId() != null ? new NumberedTransactionId(chargingStationId, PROTOCOL_IDENTIFIER, request.getTransactionId()) : null; List<MeterValue> meterValues = new ArrayList<>(); for (io.motown.ocpp.v15.soap.centralsystem.schema.MeterValue mv : request.getValues()) { for (io.motown.ocpp.v15.soap.centralsystem.schema.MeterValue.Value value : mv.getValue()) { ReadingContext readingContext = new ReadingContextTranslator(value.getContext()).translate(); ValueFormat valueFormat = new ValueFormatTranslator(value.getFormat()).translate(); Measurand measurand = new MeasurandTranslator(value.getMeasurand()).translate(); Location location = new LocationTranslator(value.getLocation()).translate(); UnitOfMeasure unitOfMeasure = new UnitOfMeasureTranslator(value.getUnit()).translate(); meterValues.add(new MeterValue(mv.getTimestamp(), value.getValue(), readingContext, valueFormat, measurand, location, unitOfMeasure)); } } domainService.meterValues(chargingStationId, transactionId, new EvseId(request.getConnectorId()), meterValues, addOnIdentity); return new MeterValuesResponse(); }
MotownCentralSystemService implements io.motown.ocpp.v15.soap.centralsystem.schema.CentralSystemService { @Override public MeterValuesResponse meterValues(MeterValuesRequest request, String chargeBoxIdentity) { ChargingStationId chargingStationId = new ChargingStationId(chargeBoxIdentity); TransactionId transactionId = request.getTransactionId() != null ? new NumberedTransactionId(chargingStationId, PROTOCOL_IDENTIFIER, request.getTransactionId()) : null; List<MeterValue> meterValues = new ArrayList<>(); for (io.motown.ocpp.v15.soap.centralsystem.schema.MeterValue mv : request.getValues()) { for (io.motown.ocpp.v15.soap.centralsystem.schema.MeterValue.Value value : mv.getValue()) { ReadingContext readingContext = new ReadingContextTranslator(value.getContext()).translate(); ValueFormat valueFormat = new ValueFormatTranslator(value.getFormat()).translate(); Measurand measurand = new MeasurandTranslator(value.getMeasurand()).translate(); Location location = new LocationTranslator(value.getLocation()).translate(); UnitOfMeasure unitOfMeasure = new UnitOfMeasureTranslator(value.getUnit()).translate(); meterValues.add(new MeterValue(mv.getTimestamp(), value.getValue(), readingContext, valueFormat, measurand, location, unitOfMeasure)); } } domainService.meterValues(chargingStationId, transactionId, new EvseId(request.getConnectorId()), meterValues, addOnIdentity); return new MeterValuesResponse(); } }
MotownCentralSystemService implements io.motown.ocpp.v15.soap.centralsystem.schema.CentralSystemService { @Override public MeterValuesResponse meterValues(MeterValuesRequest request, String chargeBoxIdentity) { ChargingStationId chargingStationId = new ChargingStationId(chargeBoxIdentity); TransactionId transactionId = request.getTransactionId() != null ? new NumberedTransactionId(chargingStationId, PROTOCOL_IDENTIFIER, request.getTransactionId()) : null; List<MeterValue> meterValues = new ArrayList<>(); for (io.motown.ocpp.v15.soap.centralsystem.schema.MeterValue mv : request.getValues()) { for (io.motown.ocpp.v15.soap.centralsystem.schema.MeterValue.Value value : mv.getValue()) { ReadingContext readingContext = new ReadingContextTranslator(value.getContext()).translate(); ValueFormat valueFormat = new ValueFormatTranslator(value.getFormat()).translate(); Measurand measurand = new MeasurandTranslator(value.getMeasurand()).translate(); Location location = new LocationTranslator(value.getLocation()).translate(); UnitOfMeasure unitOfMeasure = new UnitOfMeasureTranslator(value.getUnit()).translate(); meterValues.add(new MeterValue(mv.getTimestamp(), value.getValue(), readingContext, valueFormat, measurand, location, unitOfMeasure)); } } domainService.meterValues(chargingStationId, transactionId, new EvseId(request.getConnectorId()), meterValues, addOnIdentity); return new MeterValuesResponse(); }  }
MotownCentralSystemService implements io.motown.ocpp.v15.soap.centralsystem.schema.CentralSystemService { @Override public MeterValuesResponse meterValues(MeterValuesRequest request, String chargeBoxIdentity) { ChargingStationId chargingStationId = new ChargingStationId(chargeBoxIdentity); TransactionId transactionId = request.getTransactionId() != null ? new NumberedTransactionId(chargingStationId, PROTOCOL_IDENTIFIER, request.getTransactionId()) : null; List<MeterValue> meterValues = new ArrayList<>(); for (io.motown.ocpp.v15.soap.centralsystem.schema.MeterValue mv : request.getValues()) { for (io.motown.ocpp.v15.soap.centralsystem.schema.MeterValue.Value value : mv.getValue()) { ReadingContext readingContext = new ReadingContextTranslator(value.getContext()).translate(); ValueFormat valueFormat = new ValueFormatTranslator(value.getFormat()).translate(); Measurand measurand = new MeasurandTranslator(value.getMeasurand()).translate(); Location location = new LocationTranslator(value.getLocation()).translate(); UnitOfMeasure unitOfMeasure = new UnitOfMeasureTranslator(value.getUnit()).translate(); meterValues.add(new MeterValue(mv.getTimestamp(), value.getValue(), readingContext, valueFormat, measurand, location, unitOfMeasure)); } } domainService.meterValues(chargingStationId, transactionId, new EvseId(request.getConnectorId()), meterValues, addOnIdentity); return new MeterValuesResponse(); }  @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 MeterValuesResponse meterValues(MeterValuesRequest request, String chargeBoxIdentity) { ChargingStationId chargingStationId = new ChargingStationId(chargeBoxIdentity); TransactionId transactionId = request.getTransactionId() != null ? new NumberedTransactionId(chargingStationId, PROTOCOL_IDENTIFIER, request.getTransactionId()) : null; List<MeterValue> meterValues = new ArrayList<>(); for (io.motown.ocpp.v15.soap.centralsystem.schema.MeterValue mv : request.getValues()) { for (io.motown.ocpp.v15.soap.centralsystem.schema.MeterValue.Value value : mv.getValue()) { ReadingContext readingContext = new ReadingContextTranslator(value.getContext()).translate(); ValueFormat valueFormat = new ValueFormatTranslator(value.getFormat()).translate(); Measurand measurand = new MeasurandTranslator(value.getMeasurand()).translate(); Location location = new LocationTranslator(value.getLocation()).translate(); UnitOfMeasure unitOfMeasure = new UnitOfMeasureTranslator(value.getUnit()).translate(); meterValues.add(new MeterValue(mv.getTimestamp(), value.getValue(), readingContext, valueFormat, measurand, location, unitOfMeasure)); } } domainService.meterValues(chargingStationId, transactionId, new EvseId(request.getConnectorId()), meterValues, addOnIdentity); return new MeterValuesResponse(); }  @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; }