Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@
<artifactId>annotations</artifactId>
<version>26.0.2</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.27.3</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down Expand Up @@ -184,7 +189,7 @@
<version>[17,)</version>
</requireJavaVersion>
<requireMavenVersion>
<version>[3.3.9,)</version>
<version>[3.9.0,)</version>
</requireMavenVersion>
</rules>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import de.rwth.idsg.steve.web.api.exception.NotFoundException;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.joda.time.DateTime;
import org.joda.time.LocalDateTime;
import org.springframework.beans.propertyeditors.StringTrimmerEditor;
import org.springframework.http.HttpStatus;
import org.springframework.validation.BindException;
Expand All @@ -38,6 +36,8 @@

import jakarta.servlet.http.HttpServletRequest;

import java.time.LocalDateTime;

/**
* @author Sevket Goekay <sevketgokay@gmail.com>
* @since 13.09.2022
Expand Down Expand Up @@ -103,7 +103,7 @@ public ApiErrorResponse handleException(HttpServletRequest req, Exception except
public static ApiErrorResponse createResponse(String url, HttpStatus status, String message) {
ApiErrorResponse result = new ApiErrorResponse();

result.setTimestamp(DateTime.now());
result.setTimestamp(LocalDateTime.now());
result.setStatus(status.value());
result.setError(status.getReasonPhrase());
result.setMessage(message);
Expand All @@ -114,7 +114,7 @@ public static ApiErrorResponse createResponse(String url, HttpStatus status, Str

@Data
public static class ApiErrorResponse {
private DateTime timestamp;
private LocalDateTime timestamp;
private int status;
private String error;
private String message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@
import de.rwth.idsg.steve.ocpp.RequestResult;
import de.rwth.idsg.steve.ocpp.TaskOrigin;
import io.swagger.v3.oas.annotations.media.Schema;

import java.time.OffsetDateTime;
import java.util.Map;

import lombok.Getter;
import lombok.Setter;
import org.joda.time.DateTime;

/**
* @author fnkbsi
* @since 18.10.2023
*/

@Getter
@Setter
public class ApiTaskInfo {
Expand All @@ -54,9 +54,9 @@ public class ApiTaskInfo {
private int resultSize;

@Schema(description = "Starttime")
private DateTime startTimestamp;
private OffsetDateTime startTimestamp;
@Schema(description = "Endtime")
private DateTime endTimestamp;
private OffsetDateTime endTimestamp;

@Schema(description = "Error count")
private int errorCount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@
import de.rwth.idsg.steve.web.dto.ocpp.ChargePointSelection;
import lombok.AccessLevel;
import lombok.Getter;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import jakarta.xml.ws.AsyncHandler;

import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand All @@ -56,8 +57,8 @@ public abstract class CommunicationTask<S extends ChargePointSelection, RESPONSE
private final Map<String, RequestResult> resultMap;
private final int resultSize;

private final DateTime startTimestamp = DateTime.now();
private DateTime endTimestamp;
private final OffsetDateTime startTimestamp = OffsetDateTime.now();
private OffsetDateTime endTimestamp;

private final AtomicInteger errorCount = new AtomicInteger(0);
private final AtomicInteger responseCount = new AtomicInteger(0);
Expand Down Expand Up @@ -113,7 +114,7 @@ public void addNewResponse(String chargeBoxId, String response) {

synchronized (lockObject) {
if (resultSize == (errorCount.get() + responseCount.incrementAndGet())) {
endTimestamp = DateTime.now();
endTimestamp = OffsetDateTime.now();
}
}
}
Expand All @@ -123,7 +124,7 @@ public void addNewError(String chargeBoxId, String errorMessage) {

synchronized (lockObject) {
if (resultSize == (errorCount.incrementAndGet() + responseCount.get())) {
endTimestamp = DateTime.now();
endTimestamp = OffsetDateTime.now();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

import jakarta.xml.ws.AsyncHandler;

import static de.rwth.idsg.steve.utils.DateTimeUtils.toDateTime;
import static de.rwth.idsg.steve.utils.DateTimeUtils.toOffsetDateTime;

/**
* @author Sevket Goekay <sevketgokay@gmail.com>
Expand All @@ -47,8 +47,8 @@ public ocpp.cp._2010._08.GetDiagnosticsRequest getOcpp12Request() {
.withLocation(params.getLocation())
.withRetries(params.getRetries())
.withRetryInterval(params.getRetryInterval())
.withStartTime(toDateTime(params.getStart()))
.withStopTime(toDateTime(params.getStop()));
.withStartTime(toOffsetDateTime(params.getStart()))
.withStopTime(toOffsetDateTime(params.getStop()));
}

@Override
Expand All @@ -57,8 +57,8 @@ public ocpp.cp._2012._06.GetDiagnosticsRequest getOcpp15Request() {
.withLocation(params.getLocation())
.withRetries(params.getRetries())
.withRetryInterval(params.getRetryInterval())
.withStartTime(toDateTime(params.getStart()))
.withStopTime(toDateTime(params.getStop()));
.withStartTime(toOffsetDateTime(params.getStart()))
.withStopTime(toOffsetDateTime(params.getStop()));
}

@Override
Expand All @@ -67,8 +67,8 @@ public ocpp.cp._2015._10.GetDiagnosticsRequest getOcpp16Request() {
.withLocation(params.getLocation())
.withRetries(params.getRetries())
.withRetryInterval(params.getRetryInterval())
.withStartTime(toDateTime(params.getStart()))
.withStopTime(toDateTime(params.getStop()));
.withStartTime(toOffsetDateTime(params.getStart()))
.withStopTime(toOffsetDateTime(params.getStop()));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

import jakarta.xml.ws.AsyncHandler;

import static de.rwth.idsg.steve.utils.DateTimeUtils.toOffsetDateTime;

/**
* @author Sevket Goekay <sevketgokay@gmail.com>
* @since 09.03.2018
Expand Down Expand Up @@ -71,7 +73,7 @@ public void failed(String chargeBoxId, Exception e) {
public ocpp.cp._2012._06.ReserveNowRequest getOcpp15Request() {
return new ocpp.cp._2012._06.ReserveNowRequest()
.withConnectorId(params.getReserveNowParams().getConnectorId())
.withExpiryDate(params.getReserveNowParams().getExpiry().toDateTime())
.withExpiryDate(toOffsetDateTime(params.getReserveNowParams().getExpiry()))
.withIdTag(params.getReserveNowParams().getIdTag())
.withReservationId(params.getReservationId())
.withParentIdTag(params.getParentIdTag());
Expand All @@ -81,7 +83,7 @@ public ocpp.cp._2012._06.ReserveNowRequest getOcpp15Request() {
public ocpp.cp._2015._10.ReserveNowRequest getOcpp16Request() {
return new ocpp.cp._2015._10.ReserveNowRequest()
.withConnectorId(params.getReserveNowParams().getConnectorId())
.withExpiryDate(params.getReserveNowParams().getExpiry().toDateTime())
.withExpiryDate(toOffsetDateTime(params.getReserveNowParams().getExpiry()))
.withIdTag(params.getReserveNowParams().getIdTag())
.withReservationId(params.getReservationId())
.withParentIdTag(params.getParentIdTag());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
import java.util.List;
import java.util.stream.Collectors;

import static de.rwth.idsg.steve.utils.DateTimeUtils.toOffsetDateTime;

/**
* @author Sevket Goekay <sevketgokay@gmail.com>
* @since 13.03.2018
Expand Down Expand Up @@ -86,7 +88,7 @@ public SetChargingProfileRequest getOcpp16Request() {

ChargingSchedule schedule = new ChargingSchedule()
.withDuration(profile.getDurationInSeconds())
.withStartSchedule(profile.getStartSchedule())
.withStartSchedule(toOffsetDateTime(profile.getStartSchedule()))
.withChargingRateUnit(ChargingRateUnitType.fromValue(profile.getChargingRateUnit()))
.withMinChargingRate(profile.getMinChargingRate())
.withChargingSchedulePeriod(schedulePeriods);
Expand All @@ -97,8 +99,8 @@ public SetChargingProfileRequest getOcpp16Request() {
.withChargingProfilePurpose(ChargingProfilePurposeType.fromValue(profile.getChargingProfilePurpose()))
.withChargingProfileKind(ChargingProfileKindType.fromValue(profile.getChargingProfileKind()))
.withRecurrencyKind(profile.getRecurrencyKind() == null ? null : RecurrencyKindType.fromValue(profile.getRecurrencyKind()))
.withValidFrom(profile.getValidFrom())
.withValidTo(profile.getValidTo())
.withValidFrom(toOffsetDateTime(profile.getValidFrom()))
.withValidTo(toOffsetDateTime(profile.getValidTo()))
.withChargingSchedule(schedule);

var request = new SetChargingProfileRequest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

import jakarta.xml.ws.AsyncHandler;

import static de.rwth.idsg.steve.utils.DateTimeUtils.toDateTime;
import static de.rwth.idsg.steve.utils.DateTimeUtils.toOffsetDateTime;

/**
* @author Sevket Goekay <sevketgokay@gmail.com>
Expand All @@ -45,7 +45,7 @@ public OcppCallback<String> defaultCallback() {
public ocpp.cp._2010._08.UpdateFirmwareRequest getOcpp12Request() {
return new ocpp.cp._2010._08.UpdateFirmwareRequest()
.withLocation(params.getLocation())
.withRetrieveDate(toDateTime(params.getRetrieve()))
.withRetrieveDate(toOffsetDateTime(params.getRetrieve()))
.withRetries(params.getRetries())
.withRetryInterval(params.getRetryInterval());
}
Expand All @@ -54,7 +54,7 @@ public ocpp.cp._2010._08.UpdateFirmwareRequest getOcpp12Request() {
public ocpp.cp._2012._06.UpdateFirmwareRequest getOcpp15Request() {
return new ocpp.cp._2012._06.UpdateFirmwareRequest()
.withLocation(params.getLocation())
.withRetrieveDate(toDateTime(params.getRetrieve()))
.withRetrieveDate(toOffsetDateTime(params.getRetrieve()))
.withRetries(params.getRetries())
.withRetryInterval(params.getRetryInterval());
}
Expand All @@ -63,7 +63,7 @@ public ocpp.cp._2012._06.UpdateFirmwareRequest getOcpp15Request() {
public ocpp.cp._2015._10.UpdateFirmwareRequest getOcpp16Request() {
return new ocpp.cp._2015._10.UpdateFirmwareRequest()
.withLocation(params.getLocation())
.withRetrieveDate(toDateTime(params.getRetrieve()))
.withRetrieveDate(toOffsetDateTime(params.getRetrieve()))
.withRetries(params.getRetries())
.withRetryInterval(params.getRetryInterval());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import de.rwth.idsg.steve.repository.dto.UpdateChargeboxParams;
import de.rwth.idsg.steve.repository.dto.UpdateTransactionParams;
import ocpp.cs._2015._10.MeterValue;
import org.joda.time.DateTime;

import java.time.LocalDateTime;
import java.util.List;

/**
Expand All @@ -39,7 +39,7 @@ public interface OcppServerRepository {
void updateEndpointAddress(String chargeBoxIdentity, String endpointAddress);
void updateChargeboxFirmwareStatus(String chargeBoxIdentity, String firmwareStatus);
void updateChargeboxDiagnosticsStatus(String chargeBoxIdentity, String status);
void updateChargeboxHeartbeat(String chargeBoxIdentity, DateTime ts);
void updateChargeboxHeartbeat(String chargeBoxIdentity, LocalDateTime ts);

void insertConnectorStatus(InsertConnectorStatusParams params);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@
import lombok.Builder;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.joda.time.DateTime;

import java.time.LocalDateTime;

/**
*
* @author Sevket Goekay <sevketgokay@gmail.com>
*
*/
public final class ChargePoint {

Expand All @@ -37,7 +36,7 @@ public final class ChargePoint {
public static final class Overview {
private final int chargeBoxPk;
private final String chargeBoxId, description, ocppProtocol, lastHeartbeatTimestamp;
private final DateTime lastHeartbeatTimestampDT;
private final LocalDateTime lastHeartbeatTimestampDT;
}

@Getter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import lombok.Builder;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.joda.time.DateTime;

import java.time.LocalDateTime;
import java.util.List;

/**
Expand Down Expand Up @@ -54,7 +54,7 @@ public static final class Overview {
private final int chargingProfilePk;
private final int stackLevel;
private final String description, profilePurpose, profileKind, recurrencyKind;
private final DateTime validFrom, validTo;
private final LocalDateTime validFrom, validTo;
}

@Getter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
import org.joda.time.DateTime;

import java.time.OffsetDateTime;

/**
*
* @author Sevket Goekay <sevketgokay@gmail.com>
*
*/
@Getter
@Builder
Expand All @@ -52,7 +51,7 @@ public final class ConnectorStatus {
// For additional internal processing. Not related to the humanized
// String version above, which is for representation on frontend
@Schema(description = "Timestamp of the status")
private final DateTime statusTimestamp;
private final OffsetDateTime statusTimestamp;

@Schema(description = "OCPP version")
private final OcppProtocol ocppProtocol;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

import lombok.Builder;
import lombok.Getter;
import org.joda.time.DateTime;

import java.time.OffsetDateTime;

/**
* @author Sevket Goekay <sevketgokay@gmail.com>
Expand All @@ -31,7 +32,7 @@
public class InsertConnectorStatusParams {
private final String chargeBoxId;
private final int connectorId;
private final DateTime timestamp;
private final OffsetDateTime timestamp;
private final String status;
private final String errorCode;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

import lombok.Builder;
import lombok.Getter;
import org.joda.time.DateTime;

import java.time.LocalDateTime;

/**
* @author Sevket Goekay <sevketgokay@gmail.com>
Expand All @@ -31,5 +32,5 @@
public class InsertReservationParams {
private final String idTag, chargeBoxId;
private final int connectorId;
private final DateTime startTimestamp, expiryTimestamp;
private final LocalDateTime startTimestamp, expiryTimestamp;
}
Loading
Loading