@Test public void stopTransactionWithoutIdTag() { StopTransactionRequest request = new StopTransactionRequest(); request.setIdTag(null); request.setMeterStop(METER_STOP); request.setTimestamp(FIVE_MINUTES_AGO); request.setTransactionId(TRANSACTION_NUMBER); request.getTransactionData().addAll(TRANSACTION_DATA); motownCentralSystemService.stopTransaction(request, CHARGING_STATION_ID.getId()); verify(domainService).stopTransaction(eq(CHARGING_STATION_ID), eq(new NumberedTransactionId(CHARGING_STATION_ID, PROTOCOL_IDENTIFIER, TRANSACTION_NUMBER)), eq(EMPTY_IDENTIFYING_TOKEN), eq(METER_STOP), eq(FIVE_MINUTES_AGO), anyListOf(MeterValue.class), eq(OCPPS15_ADD_ON_IDENTITY)); }
@Override public StopTransactionResponse stopTransaction(StopTransactionRequest request, String chargeBoxIdentity) { ChargingStationId chargingStationId = new ChargingStationId(chargeBoxIdentity); NumberedTransactionId transactionId = new NumberedTransactionId(chargingStationId, PROTOCOL_IDENTIFIER, request.getTransactionId()); String idTag = request.getIdTag() != null ? request.getIdTag() : ""; IdentifyingToken identifyingToken = new TextualToken(idTag); List<MeterValue> meterValues = new ArrayList<>(); List<TransactionData> transactionData = request.getTransactionData(); for (TransactionData data : transactionData) { for (io.motown.ocpp.v15.soap.centralsystem.schema.MeterValue mv : data.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.stopTransaction(chargingStationId, transactionId, identifyingToken, request.getMeterStop(), request.getTimestamp(), meterValues, addOnIdentity); return new StopTransactionResponse(); }
MotownCentralSystemService implements io.motown.ocpp.v15.soap.centralsystem.schema.CentralSystemService { @Override public StopTransactionResponse stopTransaction(StopTransactionRequest request, String chargeBoxIdentity) { ChargingStationId chargingStationId = new ChargingStationId(chargeBoxIdentity); NumberedTransactionId transactionId = new NumberedTransactionId(chargingStationId, PROTOCOL_IDENTIFIER, request.getTransactionId()); String idTag = request.getIdTag() != null ? request.getIdTag() : ""; IdentifyingToken identifyingToken = new TextualToken(idTag); List<MeterValue> meterValues = new ArrayList<>(); List<TransactionData> transactionData = request.getTransactionData(); for (TransactionData data : transactionData) { for (io.motown.ocpp.v15.soap.centralsystem.schema.MeterValue mv : data.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.stopTransaction(chargingStationId, transactionId, identifyingToken, request.getMeterStop(), request.getTimestamp(), meterValues, addOnIdentity); return new StopTransactionResponse(); } }
MotownCentralSystemService implements io.motown.ocpp.v15.soap.centralsystem.schema.CentralSystemService { @Override public StopTransactionResponse stopTransaction(StopTransactionRequest request, String chargeBoxIdentity) { ChargingStationId chargingStationId = new ChargingStationId(chargeBoxIdentity); NumberedTransactionId transactionId = new NumberedTransactionId(chargingStationId, PROTOCOL_IDENTIFIER, request.getTransactionId()); String idTag = request.getIdTag() != null ? request.getIdTag() : ""; IdentifyingToken identifyingToken = new TextualToken(idTag); List<MeterValue> meterValues = new ArrayList<>(); List<TransactionData> transactionData = request.getTransactionData(); for (TransactionData data : transactionData) { for (io.motown.ocpp.v15.soap.centralsystem.schema.MeterValue mv : data.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.stopTransaction(chargingStationId, transactionId, identifyingToken, request.getMeterStop(), request.getTimestamp(), meterValues, addOnIdentity); return new StopTransactionResponse(); }  }
MotownCentralSystemService implements io.motown.ocpp.v15.soap.centralsystem.schema.CentralSystemService { @Override public StopTransactionResponse stopTransaction(StopTransactionRequest request, String chargeBoxIdentity) { ChargingStationId chargingStationId = new ChargingStationId(chargeBoxIdentity); NumberedTransactionId transactionId = new NumberedTransactionId(chargingStationId, PROTOCOL_IDENTIFIER, request.getTransactionId()); String idTag = request.getIdTag() != null ? request.getIdTag() : ""; IdentifyingToken identifyingToken = new TextualToken(idTag); List<MeterValue> meterValues = new ArrayList<>(); List<TransactionData> transactionData = request.getTransactionData(); for (TransactionData data : transactionData) { for (io.motown.ocpp.v15.soap.centralsystem.schema.MeterValue mv : data.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.stopTransaction(chargingStationId, transactionId, identifyingToken, request.getMeterStop(), request.getTimestamp(), meterValues, addOnIdentity); return new StopTransactionResponse(); }  @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 StopTransactionResponse stopTransaction(StopTransactionRequest request, String chargeBoxIdentity) { ChargingStationId chargingStationId = new ChargingStationId(chargeBoxIdentity); NumberedTransactionId transactionId = new NumberedTransactionId(chargingStationId, PROTOCOL_IDENTIFIER, request.getTransactionId()); String idTag = request.getIdTag() != null ? request.getIdTag() : ""; IdentifyingToken identifyingToken = new TextualToken(idTag); List<MeterValue> meterValues = new ArrayList<>(); List<TransactionData> transactionData = request.getTransactionData(); for (TransactionData data : transactionData) { for (io.motown.ocpp.v15.soap.centralsystem.schema.MeterValue mv : data.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.stopTransaction(chargingStationId, transactionId, identifyingToken, request.getMeterStop(), request.getTimestamp(), meterValues, addOnIdentity); return new StopTransactionResponse(); }  @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; }