From fc28b5a9e50f5bce124bf516de8c101003de4b0a Mon Sep 17 00:00:00 2001 From: Sevket Goekay Date: Tue, 10 Mar 2015 11:56:43 +0100 Subject: [PATCH] 1) do not select charge points without endpoint address for triggering ocpp operations (duh!) 2) made the fields final in dtos (these are just simple value objects for frontend) 3) updated maven dependencies to the latest versions 4) little version bump --- pom.xml | 16 ++++++++-------- .../idsg/steve/config/BeanConfiguration.java | 6 ++++++ .../repository/ChargePointRepositoryImpl.java | 2 ++ .../steve/repository/RequestTaskStoreImpl.java | 2 +- .../idsg/steve/repository/dto/ChargePoint.java | 2 +- .../steve/repository/dto/ChargePointSelect.java | 4 ++-- .../steve/repository/dto/ConnectorStatus.java | 4 ++-- .../idsg/steve/repository/dto/DbVersion.java | 2 +- .../idsg/steve/repository/dto/Heartbeat.java | 2 +- .../idsg/steve/repository/dto/Reservation.java | 6 +++--- .../idsg/steve/repository/dto/Statistics.java | 2 +- .../idsg/steve/repository/dto/TaskOverview.java | 6 +++--- .../idsg/steve/repository/dto/Transaction.java | 4 ++-- .../de/rwth/idsg/steve/repository/dto/User.java | 4 ++-- src/main/resources/log4j.xml | 3 ++- 15 files changed, 37 insertions(+), 28 deletions(-) diff --git a/pom.xml b/pom.xml index 063f8f946..75b4e531e 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 de.rwth.idsg steve - 1.0.2 + 1.0.3 jar @@ -17,12 +17,12 @@ 1.7 UTF-8 - 3.5.2 - 3.0.3 - 4.1.4.RELEASE - 3.2.5.RELEASE + 3.5.3 + 3.0.4 + 4.1.5.RELEASE + 3.2.6.RELEASE 5.1.34 - 9.2.7.v20150116 + 9.2.9.v20150224 @@ -279,7 +279,7 @@ org.projectlombok lombok - 1.16.0 + 1.16.2 provided @@ -399,7 +399,7 @@ com.zaxxer HikariCP-java6 - 2.2.5 + 2.3.3 diff --git a/src/main/java/de/rwth/idsg/steve/config/BeanConfiguration.java b/src/main/java/de/rwth/idsg/steve/config/BeanConfiguration.java index de3230df9..7071e4b47 100644 --- a/src/main/java/de/rwth/idsg/steve/config/BeanConfiguration.java +++ b/src/main/java/de/rwth/idsg/steve/config/BeanConfiguration.java @@ -4,6 +4,8 @@ import com.zaxxer.hikari.HikariDataSource; import de.rwth.idsg.steve.SteveConfiguration; import de.rwth.idsg.steve.web.GsonHttpMessageConverter; +import org.apache.log4j.Level; +import org.apache.log4j.Logger; import org.jooq.SQLDialect; import org.jooq.conf.Settings; import org.jooq.impl.DataSourceConnectionProvider; @@ -59,6 +61,10 @@ private void initDataSource() { @Qualifier("jooqConfig") public org.jooq.Configuration jooqConfig() { + // Disable the Jooq logo in logs + // https://github.com/jOOQ/jOOQ/issues/4019 + Logger.getLogger(org.jooq.Constants.class).setLevel(Level.WARN); + initDataSource(); // Configuration for JOOQ diff --git a/src/main/java/de/rwth/idsg/steve/repository/ChargePointRepositoryImpl.java b/src/main/java/de/rwth/idsg/steve/repository/ChargePointRepositoryImpl.java index 92c593ba9..5d115c5cd 100644 --- a/src/main/java/de/rwth/idsg/steve/repository/ChargePointRepositoryImpl.java +++ b/src/main/java/de/rwth/idsg/steve/repository/ChargePointRepositoryImpl.java @@ -54,12 +54,14 @@ public List getChargePointsV15() { * SELECT chargeBoxId, endpoint_address * FROM chargebox * WHERE ocppVersion = ? + * AND endpoint_address IS NOT NULL */ private List internalGetChargePoints(OcppVersion version) { return DSL.using(config) .select(CHARGEBOX.CHARGEBOXID, CHARGEBOX.ENDPOINT_ADDRESS) .from(CHARGEBOX) .where(CHARGEBOX.OCPPVERSION.equal(version.getValue())) + .and(CHARGEBOX.ENDPOINT_ADDRESS.isNotNull()) .fetch() .map(new ChargePointSelectMapper()); } diff --git a/src/main/java/de/rwth/idsg/steve/repository/RequestTaskStoreImpl.java b/src/main/java/de/rwth/idsg/steve/repository/RequestTaskStoreImpl.java index 74233cf3d..da7bb7d75 100644 --- a/src/main/java/de/rwth/idsg/steve/repository/RequestTaskStoreImpl.java +++ b/src/main/java/de/rwth/idsg/steve/repository/RequestTaskStoreImpl.java @@ -26,7 +26,7 @@ public class RequestTaskStoreImpl implements RequestTaskStore { @Override public List getOverview() { - List list = new ArrayList<>(); + List list = new ArrayList<>(lookupTable.size()); for (Map.Entry entry : lookupTable.entrySet()) { RequestTask r = entry.getValue(); list.add( diff --git a/src/main/java/de/rwth/idsg/steve/repository/dto/ChargePoint.java b/src/main/java/de/rwth/idsg/steve/repository/dto/ChargePoint.java index e36f534e3..739d9733b 100644 --- a/src/main/java/de/rwth/idsg/steve/repository/dto/ChargePoint.java +++ b/src/main/java/de/rwth/idsg/steve/repository/dto/ChargePoint.java @@ -11,7 +11,7 @@ @Getter @Builder public final class ChargePoint { - private String chargeBoxId, endpointAddress, ocppVersion, chargePointVendor, chargePointModel, + private final String chargeBoxId, endpointAddress, ocppVersion, chargePointVendor, chargePointModel, chargePointSerialNumber, chargeBoxSerialNumber, firewireVersion, firewireUpdateStatus, firewireUpdateTimestamp, iccid, imsi, meterType, meterSerialNumber, diagnosticsStatus, diagnosticsTimestamp, lastHeartbeatTimestamp; diff --git a/src/main/java/de/rwth/idsg/steve/repository/dto/ChargePointSelect.java b/src/main/java/de/rwth/idsg/steve/repository/dto/ChargePointSelect.java index d34ab9fd4..cb078e19b 100644 --- a/src/main/java/de/rwth/idsg/steve/repository/dto/ChargePointSelect.java +++ b/src/main/java/de/rwth/idsg/steve/repository/dto/ChargePointSelect.java @@ -9,6 +9,6 @@ */ @Getter @Builder -public class ChargePointSelect { - private String chargeBoxId, endpointAddress; +public final class ChargePointSelect { + private final String chargeBoxId, endpointAddress; } diff --git a/src/main/java/de/rwth/idsg/steve/repository/dto/ConnectorStatus.java b/src/main/java/de/rwth/idsg/steve/repository/dto/ConnectorStatus.java index 12e6ef210..72bc8d304 100644 --- a/src/main/java/de/rwth/idsg/steve/repository/dto/ConnectorStatus.java +++ b/src/main/java/de/rwth/idsg/steve/repository/dto/ConnectorStatus.java @@ -11,6 +11,6 @@ @Getter @Builder public final class ConnectorStatus { - private String chargeBoxId, timeStamp, status, errorCode; - private int connectorId; + private final String chargeBoxId, timeStamp, status, errorCode; + private final int connectorId; } \ No newline at end of file diff --git a/src/main/java/de/rwth/idsg/steve/repository/dto/DbVersion.java b/src/main/java/de/rwth/idsg/steve/repository/dto/DbVersion.java index 1fdf88696..337fb5d08 100644 --- a/src/main/java/de/rwth/idsg/steve/repository/dto/DbVersion.java +++ b/src/main/java/de/rwth/idsg/steve/repository/dto/DbVersion.java @@ -10,5 +10,5 @@ @Getter @Builder public final class DbVersion { - private String version, updateTimestamp; + private final String version, updateTimestamp; } diff --git a/src/main/java/de/rwth/idsg/steve/repository/dto/Heartbeat.java b/src/main/java/de/rwth/idsg/steve/repository/dto/Heartbeat.java index 50a2d2745..c3d2e4998 100644 --- a/src/main/java/de/rwth/idsg/steve/repository/dto/Heartbeat.java +++ b/src/main/java/de/rwth/idsg/steve/repository/dto/Heartbeat.java @@ -11,5 +11,5 @@ @Getter @Builder public final class Heartbeat { - private String chargeBoxId, lastTimestamp; + private final String chargeBoxId, lastTimestamp; } diff --git a/src/main/java/de/rwth/idsg/steve/repository/dto/Reservation.java b/src/main/java/de/rwth/idsg/steve/repository/dto/Reservation.java index 26d4371f7..ff84f4a5b 100644 --- a/src/main/java/de/rwth/idsg/steve/repository/dto/Reservation.java +++ b/src/main/java/de/rwth/idsg/steve/repository/dto/Reservation.java @@ -11,7 +11,7 @@ @Getter @Builder public final class Reservation { - private int id; - private Integer transactionId; - private String idTag, chargeBoxId, startDatetime, expiryDatetime, status; + private final int id; + private final Integer transactionId; + private final String idTag, chargeBoxId, startDatetime, expiryDatetime, status; } diff --git a/src/main/java/de/rwth/idsg/steve/repository/dto/Statistics.java b/src/main/java/de/rwth/idsg/steve/repository/dto/Statistics.java index 86aa7c595..10845d5b1 100644 --- a/src/main/java/de/rwth/idsg/steve/repository/dto/Statistics.java +++ b/src/main/java/de/rwth/idsg/steve/repository/dto/Statistics.java @@ -12,7 +12,7 @@ @Builder public final class Statistics { // Number of chargeboxes, users, reservations, transactions - private Integer numChargeBoxes, numUsers, numReservations, numTransactions, + private final Integer numChargeBoxes, numUsers, numReservations, numTransactions, // Received heartbeats heartbeatToday, heartbeatYesterday, heartbeatEarlier, // Number of available, occupied, faulted and unavailable chargebox connectors diff --git a/src/main/java/de/rwth/idsg/steve/repository/dto/TaskOverview.java b/src/main/java/de/rwth/idsg/steve/repository/dto/TaskOverview.java index 7431d986a..aef926217 100644 --- a/src/main/java/de/rwth/idsg/steve/repository/dto/TaskOverview.java +++ b/src/main/java/de/rwth/idsg/steve/repository/dto/TaskOverview.java @@ -12,9 +12,9 @@ @Getter @EqualsAndHashCode @Builder -public class TaskOverview implements Comparable { - private int taskId, responseCount, requestCount; - private DateTime start, end; +public final class TaskOverview implements Comparable { + private final int taskId, responseCount, requestCount; + private final DateTime start, end; /** * We want the tasks to be printed in descending order. diff --git a/src/main/java/de/rwth/idsg/steve/repository/dto/Transaction.java b/src/main/java/de/rwth/idsg/steve/repository/dto/Transaction.java index ee706c2c7..9f60ec3fa 100644 --- a/src/main/java/de/rwth/idsg/steve/repository/dto/Transaction.java +++ b/src/main/java/de/rwth/idsg/steve/repository/dto/Transaction.java @@ -11,6 +11,6 @@ @Getter @Builder public final class Transaction { - private int id, connectorId; - private String chargeBoxId, idTag, startTimestamp, startValue, stopTimestamp, stopValue; + private final int id, connectorId; + private final String chargeBoxId, idTag, startTimestamp, startValue, stopTimestamp, stopValue; } \ No newline at end of file diff --git a/src/main/java/de/rwth/idsg/steve/repository/dto/User.java b/src/main/java/de/rwth/idsg/steve/repository/dto/User.java index 3a2d9810f..6bc72c596 100644 --- a/src/main/java/de/rwth/idsg/steve/repository/dto/User.java +++ b/src/main/java/de/rwth/idsg/steve/repository/dto/User.java @@ -11,6 +11,6 @@ @Getter @Builder public final class User { - private String idTag, parentIdTag, expiryDate; - private boolean inTransaction, blocked; + private final String idTag, parentIdTag, expiryDate; + private final boolean inTransaction, blocked; } diff --git a/src/main/resources/log4j.xml b/src/main/resources/log4j.xml index 376bef745..c4418d421 100644 --- a/src/main/resources/log4j.xml +++ b/src/main/resources/log4j.xml @@ -21,7 +21,8 @@ - + +