From b1f5b4a63d2fa36b22165df605bf8e7dac384945 Mon Sep 17 00:00:00 2001 From: Robert Schlabbach Date: Fri, 5 Dec 2025 08:07:13 +0100 Subject: [PATCH] Remove obsolete "ocpp-v2_0" subproject The "ocpp-v2_0" subproject was the first attempt at OCPP 2.0.1 support, which only allowed using this protocol version. It has been replaced by the new "ocpp-v2" implementation, which allows offering multiple OCPP versions in the Websocket handshake (currently OCPP 1.6 and OCPP 2.0.1) and is extensible for future OCPP 2.x versions. Remove the deprecated "ocpp-v2_0" subproject to avoid confusion. --- .../ocpp/test/FakeCentralSystem.java | 115 ----------- .../chargetime/ocpp/test/FakeChargePoint.java | 82 -------- .../ocpp/test/FeatureTestDecorator.java | 67 ------- .../ocpp/test/features/BootNotification.java | 78 -------- .../ocpp/test/features/GetVariables.java | 92 --------- .../ocpp/test/features/SetVariables.java | 92 --------- .../test/features/StatusNotification.java | 70 ------- .../features/BaseSpec.groovy | 32 --- .../features/BootNotificationSpec.groovy | 31 --- .../features/GetVariablesSpec.groovy | 30 --- .../features/SetVariablesSpec.groovy | 30 --- .../features/StatusNotificationSpec.groovy | 29 --- .../java/eu/chargetime/ocpp/IClientAPI.java | 49 ----- .../java/eu/chargetime/ocpp/IServerAPI.java | 52 ----- .../java/eu/chargetime/ocpp/JSONClient.java | 169 ---------------- .../java/eu/chargetime/ocpp/JSONServer.java | 163 --------------- .../basic/BootNotificationFeature.java | 63 ------ .../features/basic/GetVariablesFeature.java | 63 ------ .../features/basic/SetVariablesFeature.java | 63 ------ .../basic/StatusNotificationFeature.java | 64 ------ .../IClientGetVariablesRequestHandler.java | 33 ---- .../IClientSetVariablesRequestHandler.java | 34 ---- ...IServerBootNotificationRequestHandler.java | 36 ---- ...erverStatusNotificationRequestHandler.java | 36 ---- .../basic/BootNotificationConfirmation.java | 133 ------------- .../model/basic/BootNotificationRequest.java | 113 ----------- .../model/basic/GetVariablesConfirmation.java | 82 -------- .../ocpp/model/basic/GetVariablesRequest.java | 85 -------- .../model/basic/SetVariablesConfirmation.java | 90 --------- .../ocpp/model/basic/SetVariablesRequest.java | 93 --------- .../basic/StatusNotificationConfirmation.java | 54 ----- .../basic/StatusNotificationRequest.java | 164 --------------- .../model/basic/types/AttributeEnumType.java | 41 ---- .../model/basic/types/BootReasonEnumType.java | 58 ------ .../basic/types/ChargingStationType.java | 185 ----------------- .../ocpp/model/basic/types/ComponentType.java | 140 ------------- .../basic/types/ConnectorStatusEnumType.java | 34 ---- .../ocpp/model/basic/types/EVSEType.java | 98 --------- .../basic/types/GetVariableDataType.java | 128 ------------ .../basic/types/GetVariableResultType.java | 186 ------------------ .../types/GetVariableStatusEnumType.java | 44 ----- .../ocpp/model/basic/types/ModemType.java | 105 ---------- .../types/RegistrationStatusEnumType.java | 43 ---- .../basic/types/SetVariableDataType.java | 159 --------------- .../basic/types/SetVariableResultType.java | 154 --------------- .../types/SetVariableStatusEnumType.java | 57 ------ .../ocpp/model/basic/types/VariableType.java | 109 ---------- .../model/validation/OCPP2PrimDatatypes.java | 45 ----- .../StringMaxLengthValidationRule.java | 45 ----- .../basic/SetVariablesConfirmationTest.java | 68 ------- .../BootNotificationConfirmationTest.java | 47 ----- .../test/BootNotificationRequestTest.java | 75 ------- .../basic/test/SetVariablesRequestTest.java | 70 ------- .../test/StatusNotificationRequestTest.java | 89 --------- .../model/basic/types/ComponentTypeTest.java | 78 -------- .../types/test/ChargingStationTypeTest.java | 107 ---------- .../types/test/GetVariableResultTypeTest.java | 93 --------- .../types/test/SetVariableDataTypeTest.java | 75 ------- .../basic/types/test/VariableTypeTest.java | 79 -------- .../IdentifierStringValidationRuleTest.java | 51 ----- pom.xml | 2 - settings.gradle | 4 - 62 files changed, 4856 deletions(-) delete mode 100644 ocpp-v2_0-test/src/main/java/eu/chargetime/ocpp/test/FakeCentralSystem.java delete mode 100644 ocpp-v2_0-test/src/main/java/eu/chargetime/ocpp/test/FakeChargePoint.java delete mode 100644 ocpp-v2_0-test/src/main/java/eu/chargetime/ocpp/test/FeatureTestDecorator.java delete mode 100644 ocpp-v2_0-test/src/main/java/eu/chargetime/ocpp/test/features/BootNotification.java delete mode 100644 ocpp-v2_0-test/src/main/java/eu/chargetime/ocpp/test/features/GetVariables.java delete mode 100644 ocpp-v2_0-test/src/main/java/eu/chargetime/ocpp/test/features/SetVariables.java delete mode 100644 ocpp-v2_0-test/src/main/java/eu/chargetime/ocpp/test/features/StatusNotification.java delete mode 100644 ocpp-v2_0-test/src/test/groovy/eu.chargetime.ocpp.test/features/BaseSpec.groovy delete mode 100644 ocpp-v2_0-test/src/test/groovy/eu.chargetime.ocpp.test/features/BootNotificationSpec.groovy delete mode 100644 ocpp-v2_0-test/src/test/groovy/eu.chargetime.ocpp.test/features/GetVariablesSpec.groovy delete mode 100644 ocpp-v2_0-test/src/test/groovy/eu.chargetime.ocpp.test/features/SetVariablesSpec.groovy delete mode 100644 ocpp-v2_0-test/src/test/groovy/eu.chargetime.ocpp.test/features/StatusNotificationSpec.groovy delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/IClientAPI.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/IServerAPI.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/JSONClient.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/JSONServer.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/BootNotificationFeature.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/GetVariablesFeature.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/SetVariablesFeature.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/StatusNotificationFeature.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/handlers/IClientGetVariablesRequestHandler.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/handlers/IClientSetVariablesRequestHandler.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/handlers/IServerBootNotificationRequestHandler.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/handlers/IServerStatusNotificationRequestHandler.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/BootNotificationConfirmation.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/BootNotificationRequest.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/GetVariablesConfirmation.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/GetVariablesRequest.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/SetVariablesConfirmation.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/SetVariablesRequest.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/StatusNotificationConfirmation.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/StatusNotificationRequest.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/AttributeEnumType.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/BootReasonEnumType.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/ChargingStationType.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/ComponentType.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/ConnectorStatusEnumType.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/EVSEType.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/GetVariableDataType.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/GetVariableResultType.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/GetVariableStatusEnumType.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/ModemType.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/RegistrationStatusEnumType.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/SetVariableDataType.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/SetVariableResultType.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/SetVariableStatusEnumType.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/VariableType.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/validation/OCPP2PrimDatatypes.java delete mode 100644 ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/validation/StringMaxLengthValidationRule.java delete mode 100644 ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/SetVariablesConfirmationTest.java delete mode 100644 ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/test/BootNotificationConfirmationTest.java delete mode 100644 ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/test/BootNotificationRequestTest.java delete mode 100644 ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/test/SetVariablesRequestTest.java delete mode 100644 ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/test/StatusNotificationRequestTest.java delete mode 100644 ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/types/ComponentTypeTest.java delete mode 100644 ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/types/test/ChargingStationTypeTest.java delete mode 100644 ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/types/test/GetVariableResultTypeTest.java delete mode 100644 ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/types/test/SetVariableDataTypeTest.java delete mode 100644 ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/types/test/VariableTypeTest.java delete mode 100644 ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/validation/test/IdentifierStringValidationRuleTest.java diff --git a/ocpp-v2_0-test/src/main/java/eu/chargetime/ocpp/test/FakeCentralSystem.java b/ocpp-v2_0-test/src/main/java/eu/chargetime/ocpp/test/FakeCentralSystem.java deleted file mode 100644 index 25cae3629..000000000 --- a/ocpp-v2_0-test/src/main/java/eu/chargetime/ocpp/test/FakeCentralSystem.java +++ /dev/null @@ -1,115 +0,0 @@ -package eu.chargetime.ocpp.test; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.AuthenticationException; -import eu.chargetime.ocpp.IServerAPI; -import eu.chargetime.ocpp.JSONConfiguration; -import eu.chargetime.ocpp.JSONServer; -import eu.chargetime.ocpp.NotConnectedException; -import eu.chargetime.ocpp.OccurenceConstraintException; -import eu.chargetime.ocpp.ServerEvents; -import eu.chargetime.ocpp.UnsupportedFeatureException; -import eu.chargetime.ocpp.feature.Feature; -import eu.chargetime.ocpp.model.Confirmation; -import eu.chargetime.ocpp.model.Request; -import eu.chargetime.ocpp.model.SessionInformation; -import java.util.UUID; -import java.util.concurrent.CompletionStage; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class FakeCentralSystem { - private static final Logger logger = LoggerFactory.getLogger(FakeCentralSystem.class); - private final int port = 8887; - private final String host = "127.0.0.1"; - - private IServerAPI server; - private boolean isStarted; - private UUID currentSession; - private Request handlerRequest = null; - private Confirmation receivedConfirmation; - - public FakeCentralSystem() { - JSONConfiguration configuration = - JSONConfiguration.get().setParameter(JSONConfiguration.REUSE_ADDR_PARAMETER, true); - server = new JSONServer(configuration); - isStarted = false; - } - - public void addFeature(Feature feature) { - FeatureTestDecorator monitoredFeature = - new FeatureTestDecorator(feature, request -> handlerRequest = request); - server.addFeature(monitoredFeature); - } - - public void started() throws Exception { - if (!isStarted) { - server.open( - host, - port, - new ServerEvents() { - @Override - public void authenticateSession( - SessionInformation information, String username, byte[] password) throws AuthenticationException {} - - @Override - public void newSession(UUID sessionIndex, SessionInformation information) { - currentSession = sessionIndex; - } - - @Override - public void lostSession(UUID sessionIndex) { - currentSession = null; - } - }); - logger.info("Server started on host: {}, port: {}", host, port); - isStarted = true; - } - } - - public void stopped() { - server.close(); - isStarted = false; - } - - public boolean hasHandled(Request request) { - if (handlerRequest != null && request != null) return handlerRequest.equals(request); - return false; - } - - public void send(Request request) - throws NotConnectedException, OccurenceConstraintException, UnsupportedFeatureException { - CompletionStage send = server.send(currentSession, request); - send.whenComplete((confirmation, throwable) -> receivedConfirmation = confirmation); - } - - public boolean received(Confirmation confirmation) { - if (receivedConfirmation != null && confirmation != null) - return receivedConfirmation.equals(confirmation); - return false; - } -} diff --git a/ocpp-v2_0-test/src/main/java/eu/chargetime/ocpp/test/FakeChargePoint.java b/ocpp-v2_0-test/src/main/java/eu/chargetime/ocpp/test/FakeChargePoint.java deleted file mode 100644 index 7aede7c8f..000000000 --- a/ocpp-v2_0-test/src/main/java/eu/chargetime/ocpp/test/FakeChargePoint.java +++ /dev/null @@ -1,82 +0,0 @@ -package eu.chargetime.ocpp.test; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.*; -import eu.chargetime.ocpp.feature.Feature; -import eu.chargetime.ocpp.model.Confirmation; -import eu.chargetime.ocpp.model.Request; -import java.util.concurrent.CompletionStage; - -public class FakeChargePoint { - private final String url = "ws://127.0.0.1:8887"; - private IClientAPI client; - private Confirmation receivedConfirmation = null; - private Request handlerRequest; - - public FakeChargePoint() { - client = new JSONClient(); - } - - public void connect() { - client.connect( - url, - new ClientEvents() { - @Override - public void connectionOpened() {} - - @Override - public void connectionClosed() {} - }); - } - - public void addFeature(Feature feature) { - FeatureTestDecorator monitoredFeature = - new FeatureTestDecorator(feature, request -> handlerRequest = request); - client.addFeature(monitoredFeature); - } - - public void disconnect() { - client.disconnect(); - } - - public void send(Request request) - throws OccurenceConstraintException, UnsupportedFeatureException { - CompletionStage send = client.send(request); - send.whenComplete((confirmation, throwable) -> receivedConfirmation = confirmation); - } - - public boolean received(Confirmation confirmation) { - if (receivedConfirmation != null && confirmation != null) - return receivedConfirmation.equals(confirmation); - return false; - } - - public boolean hasHandled(Request request) { - if (handlerRequest != null && request != null) return handlerRequest.equals(request); - return false; - } -} diff --git a/ocpp-v2_0-test/src/main/java/eu/chargetime/ocpp/test/FeatureTestDecorator.java b/ocpp-v2_0-test/src/main/java/eu/chargetime/ocpp/test/FeatureTestDecorator.java deleted file mode 100644 index e97be3913..000000000 --- a/ocpp-v2_0-test/src/main/java/eu/chargetime/ocpp/test/FeatureTestDecorator.java +++ /dev/null @@ -1,67 +0,0 @@ -package eu.chargetime.ocpp.test; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.feature.Feature; -import eu.chargetime.ocpp.model.Confirmation; -import eu.chargetime.ocpp.model.Request; -import java.util.UUID; - -public class FeatureTestDecorator implements Feature { - - private final Feature decorated; - private final IRequestMonitor monitor; - - public FeatureTestDecorator(Feature decorated, IRequestMonitor monitor) { - this.decorated = decorated; - this.monitor = monitor; - } - - @Override - public Confirmation handleRequest(UUID sessionIndex, Request request) { - monitor.receivedRequest(request); - return decorated.handleRequest(sessionIndex, request); - } - - @Override - public Class getRequestType() { - return decorated.getRequestType(); - } - - @Override - public Class getConfirmationType() { - return decorated.getConfirmationType(); - } - - @Override - public String getAction() { - return decorated.getAction(); - } - - public interface IRequestMonitor { - void receivedRequest(Request request); - } -} diff --git a/ocpp-v2_0-test/src/main/java/eu/chargetime/ocpp/test/features/BootNotification.java b/ocpp-v2_0-test/src/main/java/eu/chargetime/ocpp/test/features/BootNotification.java deleted file mode 100644 index 854b32b46..000000000 --- a/ocpp-v2_0-test/src/main/java/eu/chargetime/ocpp/test/features/BootNotification.java +++ /dev/null @@ -1,78 +0,0 @@ -package eu.chargetime.ocpp.test.features; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - Copyright (C) 2019 Kevin Raddatz - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.feature.Feature; -import eu.chargetime.ocpp.features.basic.BootNotificationFeature; -import eu.chargetime.ocpp.features.basic.handlers.IServerBootNotificationRequestHandler; -import eu.chargetime.ocpp.model.basic.BootNotificationConfirmation; -import eu.chargetime.ocpp.model.basic.BootNotificationRequest; -import eu.chargetime.ocpp.model.basic.types.BootReasonEnumType; -import eu.chargetime.ocpp.model.basic.types.ChargingStationType; -import eu.chargetime.ocpp.model.basic.types.RegistrationStatusEnumType; -import java.time.ZoneOffset; -import java.time.ZonedDateTime; -import java.util.UUID; - -public class BootNotification implements IServerBootNotificationRequestHandler { - private BootNotificationFeature feature; - private BootNotificationConfirmation confirmation; - - public BootNotification() { - feature = new BootNotificationFeature(this); - - confirmation = new BootNotificationConfirmation(); - ZonedDateTime calendar = ZonedDateTime.now(ZoneOffset.UTC); - confirmation.setCurrentTime(calendar); - confirmation.setInterval(42); - confirmation.setStatus(RegistrationStatusEnumType.Accepted); - } - - @Override - public BootNotificationConfirmation handleBootNotificationRequest( - UUID sessionIndex, BootNotificationRequest request) { - return confirmation; - } - - public BootNotificationConfirmation getConfirmation() { - return confirmation; - } - - public BootNotificationRequest createRequest() { - BootNotificationRequest request = new BootNotificationRequest(); - request.setReason(BootReasonEnumType.Unknown); - ChargingStationType chargingStationType = new ChargingStationType(); - request.setChargingStation(chargingStationType); - chargingStationType.setVendorName("ChargeTimeEU"); - chargingStationType.setModel("Test"); - return request; - } - - public Feature getFeature() { - return feature; - } -} diff --git a/ocpp-v2_0-test/src/main/java/eu/chargetime/ocpp/test/features/GetVariables.java b/ocpp-v2_0-test/src/main/java/eu/chargetime/ocpp/test/features/GetVariables.java deleted file mode 100644 index 7003f118d..000000000 --- a/ocpp-v2_0-test/src/main/java/eu/chargetime/ocpp/test/features/GetVariables.java +++ /dev/null @@ -1,92 +0,0 @@ -package eu.chargetime.ocpp.test.features; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import static eu.chargetime.ocpp.utilities.TestUtilities.aList; - -import eu.chargetime.ocpp.features.basic.GetVariablesFeature; -import eu.chargetime.ocpp.features.basic.handlers.IClientGetVariablesRequestHandler; -import eu.chargetime.ocpp.model.basic.GetVariablesConfirmation; -import eu.chargetime.ocpp.model.basic.GetVariablesRequest; -import eu.chargetime.ocpp.model.basic.types.*; - -public class GetVariables implements IClientGetVariablesRequestHandler { - private GetVariablesFeature feature; - private GetVariablesConfirmation confirmation; - - public GetVariables() { - feature = new GetVariablesFeature(this); - confirmation = createConfirmation(); - } - - private GetVariablesConfirmation createConfirmation() { - VariableType variableType = new VariableType(); - variableType.setName("A name"); - - ComponentType componentType = new ComponentType(); - componentType.setName("A name"); - - GetVariableResultType getVariableResultType = new GetVariableResultType(); - getVariableResultType.setAttributeStatus(GetVariableStatusEnumType.Accepted); - getVariableResultType.setAttributeValue("Some value"); - getVariableResultType.setComponent(componentType); - getVariableResultType.setVariable(variableType); - - GetVariablesConfirmation confirmation = new GetVariablesConfirmation(); - confirmation.setGetVariableResult(aList(getVariableResultType)); - return confirmation; - } - - public GetVariablesConfirmation getConfirmation() { - return confirmation; - } - - public GetVariablesFeature getFeature() { - return feature; - } - - public GetVariablesRequest createRequest() { - VariableType variableType = new VariableType(); - variableType.setName("A name"); - - ComponentType componentType = new ComponentType(); - componentType.setName("A name"); - - GetVariableDataType getVariableDataType = new GetVariableDataType(); - getVariableDataType.setComponent(componentType); - getVariableDataType.setVariable(variableType); - - GetVariablesRequest request = new GetVariablesRequest(); - request.setGetVariableData(aList(getVariableDataType)); - - return request; - } - - @Override - public GetVariablesConfirmation handleGetVariablesRequest(GetVariablesRequest request) { - return confirmation; - } -} diff --git a/ocpp-v2_0-test/src/main/java/eu/chargetime/ocpp/test/features/SetVariables.java b/ocpp-v2_0-test/src/main/java/eu/chargetime/ocpp/test/features/SetVariables.java deleted file mode 100644 index 06abcebdf..000000000 --- a/ocpp-v2_0-test/src/main/java/eu/chargetime/ocpp/test/features/SetVariables.java +++ /dev/null @@ -1,92 +0,0 @@ -package eu.chargetime.ocpp.test.features; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import static eu.chargetime.ocpp.utilities.TestUtilities.aList; - -import eu.chargetime.ocpp.features.basic.SetVariablesFeature; -import eu.chargetime.ocpp.features.basic.handlers.IClientSetVariablesRequestHandler; -import eu.chargetime.ocpp.model.basic.SetVariablesConfirmation; -import eu.chargetime.ocpp.model.basic.SetVariablesRequest; -import eu.chargetime.ocpp.model.basic.types.*; - -public class SetVariables implements IClientSetVariablesRequestHandler { - private SetVariablesFeature feature; - private SetVariablesConfirmation confirmation; - - public SetVariables() { - feature = new SetVariablesFeature(this); - confirmation = createConfirmation(); - } - - private SetVariablesConfirmation createConfirmation() { - VariableType variableType = new VariableType(); - variableType.setName("A name"); - - ComponentType componentType = new ComponentType(); - componentType.setName("A name"); - - SetVariableResultType setVariableResultType = new SetVariableResultType(); - setVariableResultType.setAttributeStatus(SetVariableStatusEnumType.Accepted); - setVariableResultType.setComponent(componentType); - setVariableResultType.setVariable(variableType); - - SetVariablesConfirmation confirmation = new SetVariablesConfirmation(); - confirmation.setSetVariableResult(aList(setVariableResultType)); - return confirmation; - } - - public SetVariablesConfirmation getConfirmation() { - return confirmation; - } - - public SetVariablesFeature getFeature() { - return feature; - } - - @Override - public SetVariablesConfirmation handleSetVariablesRequest(SetVariablesRequest request) { - return confirmation; - } - - public SetVariablesRequest createRequest() { - VariableType variableType = new VariableType(); - variableType.setName("A name"); - - ComponentType componentType = new ComponentType(); - componentType.setName("A name"); - - SetVariableDataType setVariableDataType = new SetVariableDataType(); - setVariableDataType.setAttributeValue("A variable"); - setVariableDataType.setComponent(componentType); - setVariableDataType.setVariable(variableType); - - SetVariablesRequest request = new SetVariablesRequest(); - request.setSetVariableData(aList(setVariableDataType)); - - return request; - } -} diff --git a/ocpp-v2_0-test/src/main/java/eu/chargetime/ocpp/test/features/StatusNotification.java b/ocpp-v2_0-test/src/main/java/eu/chargetime/ocpp/test/features/StatusNotification.java deleted file mode 100644 index 35b5c9b2b..000000000 --- a/ocpp-v2_0-test/src/main/java/eu/chargetime/ocpp/test/features/StatusNotification.java +++ /dev/null @@ -1,70 +0,0 @@ -package eu.chargetime.ocpp.test.features; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2021 John Michael Luy - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.feature.Feature; -import eu.chargetime.ocpp.features.basic.StatusNotificationFeature; -import eu.chargetime.ocpp.features.basic.handlers.IServerStatusNotificationRequestHandler; -import eu.chargetime.ocpp.model.basic.StatusNotificationConfirmation; -import eu.chargetime.ocpp.model.basic.StatusNotificationRequest; -import eu.chargetime.ocpp.model.basic.types.ConnectorStatusEnumType; -import java.time.ZonedDateTime; -import java.util.UUID; - -public class StatusNotification implements IServerStatusNotificationRequestHandler { - - private StatusNotificationFeature feature; - private StatusNotificationConfirmation confirmation; - - public StatusNotification() { - feature = new StatusNotificationFeature(this); - - confirmation = new StatusNotificationConfirmation(); - } - - @Override - public StatusNotificationConfirmation handleStatusNotificationRequest( - UUID sessionIndex, StatusNotificationRequest request) { - return confirmation; - } - - public StatusNotificationConfirmation getConfirmation() { - return confirmation; - } - - public StatusNotificationRequest createRequest() { - StatusNotificationRequest request = new StatusNotificationRequest(); - request.setTimestamp(ZonedDateTime.now()); - request.setConnectorStatus(ConnectorStatusEnumType.Available); - request.setEvseId(1); - request.setConnectorId(1); - return request; - } - - public Feature getFeature() { - return feature; - } -} diff --git a/ocpp-v2_0-test/src/test/groovy/eu.chargetime.ocpp.test/features/BaseSpec.groovy b/ocpp-v2_0-test/src/test/groovy/eu.chargetime.ocpp.test/features/BaseSpec.groovy deleted file mode 100644 index 223cc5b3d..000000000 --- a/ocpp-v2_0-test/src/test/groovy/eu.chargetime.ocpp.test/features/BaseSpec.groovy +++ /dev/null @@ -1,32 +0,0 @@ -package eu.chargetime.ocpp.test.base.json - -import eu.chargetime.ocpp.test.FakeCentralSystem -import eu.chargetime.ocpp.test.FakeChargePoint -import spock.lang.Shared -import spock.lang.Specification - -abstract class BaseSpec extends Specification { - - @Shared - FakeCentralSystem centralSystem = new FakeCentralSystem() - @Shared - FakeChargePoint chargePoint = new FakeChargePoint() - - def setupSpec() { - // When a Central System is running - centralSystem.started() - } - - def setup() { - //Thread.sleep(100); - chargePoint.connect() - } - - def cleanup() { - chargePoint.disconnect() - } - - def cleanupSpec() { - centralSystem.stopped() - } -} diff --git a/ocpp-v2_0-test/src/test/groovy/eu.chargetime.ocpp.test/features/BootNotificationSpec.groovy b/ocpp-v2_0-test/src/test/groovy/eu.chargetime.ocpp.test/features/BootNotificationSpec.groovy deleted file mode 100644 index edad972eb..000000000 --- a/ocpp-v2_0-test/src/test/groovy/eu.chargetime.ocpp.test/features/BootNotificationSpec.groovy +++ /dev/null @@ -1,31 +0,0 @@ -package eu.chargetime.ocpp.test.features - -import eu.chargetime.ocpp.test.base.json.BaseSpec -import eu.chargetime.ocpp.test.features.BootNotification -import spock.util.concurrent.PollingConditions - -class BootNotificationSpec extends BaseSpec -{ - def "Charge point sends Boot Notification and receives a response"() { - def conditions = new PollingConditions(timeout: 1) - - given: - def tester = new BootNotification() - chargePoint.addFeature(tester.feature) - centralSystem.addFeature(tester.feature) - def request = tester.createRequest() - - when: - chargePoint.send(request) - - then: - conditions.eventually { - assert centralSystem.hasHandled(request) - } - - then: - conditions.eventually { - assert chargePoint.received(tester.confirmation) - } - } -} diff --git a/ocpp-v2_0-test/src/test/groovy/eu.chargetime.ocpp.test/features/GetVariablesSpec.groovy b/ocpp-v2_0-test/src/test/groovy/eu.chargetime.ocpp.test/features/GetVariablesSpec.groovy deleted file mode 100644 index c24114c1e..000000000 --- a/ocpp-v2_0-test/src/test/groovy/eu.chargetime.ocpp.test/features/GetVariablesSpec.groovy +++ /dev/null @@ -1,30 +0,0 @@ -package eu.chargetime.ocpp.test.features - -import eu.chargetime.ocpp.test.base.json.BaseSpec -import spock.util.concurrent.PollingConditions - -class GetVariablesSpec extends BaseSpec -{ - def "The central system sends a Get Variables request and receives a response"() { - def conditions = new PollingConditions(timeout: 11) - - given: - def tester = new GetVariables() - chargePoint.addFeature(tester.feature) - centralSystem.addFeature(tester.feature) - def request = tester.createRequest() - - when: - centralSystem.send(request) - - then: - conditions.eventually { - assert chargePoint.hasHandled(request) - } - - then: - conditions.eventually { - assert centralSystem.received(tester.confirmation) - } - } -} diff --git a/ocpp-v2_0-test/src/test/groovy/eu.chargetime.ocpp.test/features/SetVariablesSpec.groovy b/ocpp-v2_0-test/src/test/groovy/eu.chargetime.ocpp.test/features/SetVariablesSpec.groovy deleted file mode 100644 index d5f11ad23..000000000 --- a/ocpp-v2_0-test/src/test/groovy/eu.chargetime.ocpp.test/features/SetVariablesSpec.groovy +++ /dev/null @@ -1,30 +0,0 @@ -package eu.chargetime.ocpp.test.features - -import eu.chargetime.ocpp.test.base.json.BaseSpec -import spock.util.concurrent.PollingConditions - -class SetVariablesSpec extends BaseSpec -{ - def "The central system sends a Set Variables request and receives a response"() { - def conditions = new PollingConditions(timeout: 11) - - given: - def tester = new SetVariables() - chargePoint.addFeature(tester.feature) - centralSystem.addFeature(tester.feature) - def request = tester.createRequest() - - when: - centralSystem.send(request) - - then: - conditions.eventually { - assert chargePoint.hasHandled(request) - } - - then: - conditions.eventually { - assert centralSystem.received(tester.confirmation) - } - } -} diff --git a/ocpp-v2_0-test/src/test/groovy/eu.chargetime.ocpp.test/features/StatusNotificationSpec.groovy b/ocpp-v2_0-test/src/test/groovy/eu.chargetime.ocpp.test/features/StatusNotificationSpec.groovy deleted file mode 100644 index faa23ba66..000000000 --- a/ocpp-v2_0-test/src/test/groovy/eu.chargetime.ocpp.test/features/StatusNotificationSpec.groovy +++ /dev/null @@ -1,29 +0,0 @@ -package eu.chargetime.ocpp.test.features - -import eu.chargetime.ocpp.test.base.json.BaseSpec -import spock.util.concurrent.PollingConditions - -class StatusNotificationSpec extends BaseSpec { - def "Charge point sends Status Notification and receives a response"() { - def conditions = new PollingConditions(timeout: 1) - - given: - def tester = new StatusNotification() - chargePoint.addFeature(tester.feature) - centralSystem.addFeature(tester.feature) - def request = tester.createRequest() - - when: - chargePoint.send(request) - - then: - conditions.eventually { - assert centralSystem.hasHandled(request) - } - - then: - conditions.eventually { - assert chargePoint.received(tester.confirmation) - } - } -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/IClientAPI.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/IClientAPI.java deleted file mode 100644 index ec7fe74b0..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/IClientAPI.java +++ /dev/null @@ -1,49 +0,0 @@ -package eu.chargetime.ocpp; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.feature.Feature; -import eu.chargetime.ocpp.model.Confirmation; -import eu.chargetime.ocpp.model.Request; -import java.util.UUID; -import java.util.concurrent.CompletionStage; - -public interface IClientAPI { - void addFeature(Feature feature); - - void connect(String url, ClientEvents clientEvents); - - CompletionStage send(Request request) - throws OccurenceConstraintException, UnsupportedFeatureException; - - boolean asyncCompleteRequest(String uniqueId, Confirmation confirmation) throws UnsupportedFeatureException, OccurenceConstraintException; - - void disconnect(); - - boolean isClosed(); - - UUID getSessionId(); -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/IServerAPI.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/IServerAPI.java deleted file mode 100644 index 60911b25e..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/IServerAPI.java +++ /dev/null @@ -1,52 +0,0 @@ -package eu.chargetime.ocpp; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.feature.Feature; -import eu.chargetime.ocpp.model.Confirmation; -import eu.chargetime.ocpp.model.Request; -import java.util.UUID; -import java.util.concurrent.CompletionStage; - -public interface IServerAPI { - void addFeature(Feature feature); - - boolean isSessionOpen(UUID session); - - void closeSession(UUID session); - - void open(String host, int port, ServerEvents serverEvents); - - void close(); - - boolean isClosed(); - - CompletionStage send(UUID sessionIndex, Request request) - throws OccurenceConstraintException, UnsupportedFeatureException, NotConnectedException; - - boolean asyncCompleteRequest(UUID sessionIndex, String uniqueId, Confirmation confirmation) - throws NotConnectedException, UnsupportedFeatureException, OccurenceConstraintException; -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/JSONClient.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/JSONClient.java deleted file mode 100644 index c38eb6894..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/JSONClient.java +++ /dev/null @@ -1,169 +0,0 @@ -package eu.chargetime.ocpp; -/* - * ChargeTime.eu - Java-OCA-OCPP - * - * MIT License - * - * Copyright (C) 2016-2018 Thomas Volden - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import eu.chargetime.ocpp.feature.Feature; -import eu.chargetime.ocpp.model.Confirmation; -import eu.chargetime.ocpp.model.Request; -import eu.chargetime.ocpp.wss.BaseWssSocketBuilder; -import eu.chargetime.ocpp.wss.WssSocketBuilder; -import java.io.IOException; -import java.util.Collections; -import java.util.UUID; -import java.util.concurrent.CompletionStage; -import javax.net.ssl.SSLContext; -import org.java_websocket.drafts.Draft; -import org.java_websocket.drafts.Draft_6455; -import org.java_websocket.protocols.Protocol; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** OCA OCPP version 2.0 JSON Web Socket implementation of the client. */ -public class JSONClient implements IClientAPI { - - private static final Logger logger = LoggerFactory.getLogger(JSONClient.class); - - public final Draft draftOcppOnly; - private final WebSocketTransmitter transmitter; - private final FeatureRepository featureRepository; - private final Client client; - private final String identity; - - public JSONClient() { - this(null); - } - - /** - * Application composite root for a json client. - * - * @param identity if set, will append identity to url. - * @param configuration network configuration for a json client. - */ - public JSONClient(String identity, JSONConfiguration configuration) { - this.identity = identity; - draftOcppOnly = - new Draft_6455(Collections.emptyList(), Collections.singletonList(new Protocol("ocpp1.6"))); - transmitter = new WebSocketTransmitter(configuration, draftOcppOnly); - JSONCommunicator communicator = new JSONCommunicator(transmitter); - featureRepository = new FeatureRepository(); - ISession session = new SessionFactory(featureRepository).createSession(communicator); - client = new Client(session, new PromiseRepository()); - } - - /** - * Application composite root for a json client. - * - * @param identity if set, will append identity to url. - */ - public JSONClient(String identity) { - this(identity, JSONConfiguration.get()); - } - - /** - * Application composite root for a json client. - * - * @param identity if set, will append identity to url. - * @param wssSocketBuilder to build {@link java.net.Socket} to support wss://. - * @param configuration network configuration for a json client. - */ - public JSONClient( - String identity, WssSocketBuilder wssSocketBuilder, JSONConfiguration configuration) { - this(identity, configuration); - enableWSS(wssSocketBuilder); - } - - /** - * Application composite root for a json client. - * - * @param identity if set, will append identity to url. - * @param wssSocketBuilder to build {@link java.net.Socket} to support wss://. - */ - public JSONClient(String identity, WssSocketBuilder wssSocketBuilder) { - this(identity, wssSocketBuilder, JSONConfiguration.get()); - } - - // To ensure the exposed API is backward compatible - public void enableWSS(SSLContext sslContext) throws IOException { - WssSocketBuilder wssSocketBuilder = - BaseWssSocketBuilder.builder().sslSocketFactory(sslContext.getSocketFactory()); - enableWSS(wssSocketBuilder); - } - - /** - * Enables WSS connection to the endpoint. The {@code wssSocketBuilder} must be initialized at - * that step (as required parameters set might vary depending on implementation the {@link - * eu.chargetime.ocpp.wss.WssSocketBuilder#verify()} is used to ensure initialization). - * - * @param wssSocketBuilder builder to provide SSL socket - * @return instance of {@link JSONClient} - * @throws IllegalStateException in case if the client is already connected - * @throws IllegalStateException in case {@code wssSocketBuilder} not initialized properly - */ - public JSONClient enableWSS(WssSocketBuilder wssSocketBuilder) { - wssSocketBuilder.verify(); - transmitter.enableWSS(wssSocketBuilder); - return this; - } - - @Override - public void addFeature(Feature feature) { - featureRepository.addFeature(feature); - } - - @Override - public void connect(String url, ClientEvents clientEvents) { - logger.debug("Feature repository: {}", featureRepository); - - String identityUrl = (identity != null) ? String.format("%s/%s", url, identity) : url; - client.connect(identityUrl, clientEvents); - } - - @Override - public CompletionStage send(Request request) - throws OccurenceConstraintException, UnsupportedFeatureException { - return client.send(request); - } - - @Override - public boolean asyncCompleteRequest(String uniqueId, Confirmation confirmation) throws UnsupportedFeatureException, OccurenceConstraintException { - return client.asyncCompleteRequest(uniqueId, confirmation); - } - - @Override - public void disconnect() { - client.disconnect(); - } - - @Override - public boolean isClosed() { - return transmitter.isClosed(); - } - - @Override - public UUID getSessionId() { - return client.getSessionId(); - } -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/JSONServer.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/JSONServer.java deleted file mode 100644 index ba38c90fe..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/JSONServer.java +++ /dev/null @@ -1,163 +0,0 @@ -package eu.chargetime.ocpp; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2016-2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.feature.Feature; -import eu.chargetime.ocpp.model.Confirmation; -import eu.chargetime.ocpp.model.Request; -import eu.chargetime.ocpp.wss.BaseWssFactoryBuilder; -import eu.chargetime.ocpp.wss.WssFactoryBuilder; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.UUID; -import java.util.concurrent.CompletionStage; -import javax.net.ssl.SSLContext; -import org.java_websocket.drafts.Draft; -import org.java_websocket.drafts.Draft_6455; -import org.java_websocket.protocols.IProtocol; -import org.java_websocket.protocols.Protocol; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class JSONServer implements IServerAPI { - private static final Logger logger = LoggerFactory.getLogger(JSONServer.class); - - public final Draft draftOcppOnly; - private final WebSocketListener listener; - private final Server server; - private final FeatureRepository featureRepository; - private JSONConfiguration jsonConfiguration; - - /** - * The core feature profile is required as a minimum. The constructor creates WS-ready server. - * - * @param configuration network configuration for a json server. - */ - public JSONServer(JSONConfiguration configuration) { - featureRepository = new FeatureRepository(); - SessionFactory sessionFactory = new SessionFactory(featureRepository); - - ArrayList protocols = new ArrayList<>(); - protocols.add(new Protocol("ocpp1.6")); - protocols.add(new Protocol("")); - draftOcppOnly = new Draft_6455(Collections.emptyList(), protocols); - logger.info("JSONServer 2.0 without HttpHealthCheckDraft"); - this.listener = new WebSocketListener(sessionFactory, configuration, draftOcppOnly); - server = new Server(this.listener, new PromiseRepository()); - } - - /** The constructor creates WS-ready server. */ - public JSONServer() { - this(JSONConfiguration.get()); - } - - /** - * The constructor creates WSS-ready server. - * - * @param wssFactoryBuilder to build {@link org.java_websocket.WebSocketServerFactory} to support - * wss://. - * @param configuration network configuration for a json server. - */ - public JSONServer(WssFactoryBuilder wssFactoryBuilder, JSONConfiguration configuration) { - this(configuration); - enableWSS(wssFactoryBuilder); - } - - /** - * The constructor creates WSS-ready server. - * - * @param wssFactoryBuilder to build {@link org.java_websocket.WebSocketServerFactory} to support - * wss://. - */ - public JSONServer(WssFactoryBuilder wssFactoryBuilder) { - this(wssFactoryBuilder, JSONConfiguration.get()); - } - - // To ensure the exposed API is backward compatible - public void enableWSS(SSLContext sslContext) throws IOException { - WssFactoryBuilder builder = BaseWssFactoryBuilder.builder().sslContext(sslContext); - enableWSS(builder); - } - - /** - * Enables server to accept WSS connections. The {@code wssFactoryBuilder} must be initialized at - * that step (as required parameters set might vary depending on implementation the {@link - * eu.chargetime.ocpp.wss.WssFactoryBuilder#verify()} is used to ensure initialization). - * - * @param wssFactoryBuilder builder to provide WebSocketServerFactory - * @return instance of {@link JSONServer} - * @throws IllegalStateException in case if the server is already connected - * @throws IllegalStateException in case {@code wssFactoryBuilder} not initialized properly - */ - public JSONServer enableWSS(WssFactoryBuilder wssFactoryBuilder) { - wssFactoryBuilder.verify(); - listener.enableWSS(wssFactoryBuilder); - return this; - } - - @Override - public void addFeature(Feature feature) { - featureRepository.addFeature(feature); - } - - @Override - public boolean isSessionOpen(UUID session) { - return server.isSessionOpen(session); - } - - @Override - public void closeSession(UUID session) { - server.closeSession(session); - } - - @Override - public void open(String host, int port, ServerEvents serverEvents) { - logger.info("Feature repository: {}", featureRepository); - server.open(host, port, serverEvents); - } - - @Override - public void close() { - server.close(); - } - - @Override - public boolean isClosed() { - return listener.isClosed(); - } - - @Override - public CompletionStage send(UUID session, Request request) - throws OccurenceConstraintException, UnsupportedFeatureException, NotConnectedException { - return server.send(session, request); - } - - @Override - public boolean asyncCompleteRequest(UUID sessionIndex, String uniqueId, Confirmation confirmation) throws NotConnectedException, UnsupportedFeatureException, OccurenceConstraintException { - return server.asyncCompleteRequest(sessionIndex, uniqueId, confirmation); - } -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/BootNotificationFeature.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/BootNotificationFeature.java deleted file mode 100644 index 32ed17dea..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/BootNotificationFeature.java +++ /dev/null @@ -1,63 +0,0 @@ -package eu.chargetime.ocpp.features.basic; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.feature.Feature; -import eu.chargetime.ocpp.features.basic.handlers.IServerBootNotificationRequestHandler; -import eu.chargetime.ocpp.model.Confirmation; -import eu.chargetime.ocpp.model.Request; -import eu.chargetime.ocpp.model.basic.BootNotificationConfirmation; -import eu.chargetime.ocpp.model.basic.BootNotificationRequest; -import java.util.UUID; - -public class BootNotificationFeature implements Feature { - - private final IServerBootNotificationRequestHandler handler; - - public BootNotificationFeature(IServerBootNotificationRequestHandler handler) { - this.handler = handler; - } - - @Override - public Confirmation handleRequest(UUID sessionIndex, Request request) { - return handler.handleBootNotificationRequest(sessionIndex, (BootNotificationRequest) request); - } - - @Override - public Class getRequestType() { - return BootNotificationRequest.class; - } - - @Override - public Class getConfirmationType() { - return BootNotificationConfirmation.class; - } - - @Override - public String getAction() { - return "BootNotification"; - } -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/GetVariablesFeature.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/GetVariablesFeature.java deleted file mode 100644 index 2078adb7c..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/GetVariablesFeature.java +++ /dev/null @@ -1,63 +0,0 @@ -package eu.chargetime.ocpp.features.basic; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.feature.Feature; -import eu.chargetime.ocpp.features.basic.handlers.IClientGetVariablesRequestHandler; -import eu.chargetime.ocpp.model.Confirmation; -import eu.chargetime.ocpp.model.Request; -import eu.chargetime.ocpp.model.basic.GetVariablesConfirmation; -import eu.chargetime.ocpp.model.basic.GetVariablesRequest; -import java.util.UUID; - -public class GetVariablesFeature implements Feature { - - private final IClientGetVariablesRequestHandler handler; - - public GetVariablesFeature(IClientGetVariablesRequestHandler handler) { - this.handler = handler; - } - - @Override - public Confirmation handleRequest(UUID sessionIndex, Request request) { - return handler.handleGetVariablesRequest((GetVariablesRequest) request); - } - - @Override - public Class getRequestType() { - return GetVariablesRequest.class; - } - - @Override - public Class getConfirmationType() { - return GetVariablesConfirmation.class; - } - - @Override - public String getAction() { - return "GetVariables"; - } -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/SetVariablesFeature.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/SetVariablesFeature.java deleted file mode 100644 index 6ceb2d02e..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/SetVariablesFeature.java +++ /dev/null @@ -1,63 +0,0 @@ -package eu.chargetime.ocpp.features.basic; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.feature.Feature; -import eu.chargetime.ocpp.features.basic.handlers.IClientSetVariablesRequestHandler; -import eu.chargetime.ocpp.model.Confirmation; -import eu.chargetime.ocpp.model.Request; -import eu.chargetime.ocpp.model.basic.SetVariablesConfirmation; -import eu.chargetime.ocpp.model.basic.SetVariablesRequest; -import java.util.UUID; - -public class SetVariablesFeature implements Feature { - - private final IClientSetVariablesRequestHandler handler; - - public SetVariablesFeature(IClientSetVariablesRequestHandler handler) { - this.handler = handler; - } - - @Override - public Confirmation handleRequest(UUID sessionIndex, Request request) { - return handler.handleSetVariablesRequest((SetVariablesRequest) request); - } - - @Override - public Class getRequestType() { - return SetVariablesRequest.class; - } - - @Override - public Class getConfirmationType() { - return SetVariablesConfirmation.class; - } - - @Override - public String getAction() { - return "SetVariables"; - } -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/StatusNotificationFeature.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/StatusNotificationFeature.java deleted file mode 100644 index 68321d83a..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/StatusNotificationFeature.java +++ /dev/null @@ -1,64 +0,0 @@ -package eu.chargetime.ocpp.features.basic; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2021 John Michael Luy - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.feature.Feature; -import eu.chargetime.ocpp.features.basic.handlers.IServerStatusNotificationRequestHandler; -import eu.chargetime.ocpp.model.Confirmation; -import eu.chargetime.ocpp.model.Request; -import eu.chargetime.ocpp.model.basic.StatusNotificationConfirmation; -import eu.chargetime.ocpp.model.basic.StatusNotificationRequest; -import java.util.UUID; - -public class StatusNotificationFeature implements Feature { - - private final IServerStatusNotificationRequestHandler handler; - - public StatusNotificationFeature(IServerStatusNotificationRequestHandler handler) { - this.handler = handler; - } - - @Override - public Confirmation handleRequest(UUID sessionIndex, Request request) { - return handler.handleStatusNotificationRequest( - sessionIndex, (StatusNotificationRequest) request); - } - - @Override - public Class getRequestType() { - return StatusNotificationRequest.class; - } - - @Override - public Class getConfirmationType() { - return StatusNotificationConfirmation.class; - } - - @Override - public String getAction() { - return "StatusNotification"; - } -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/handlers/IClientGetVariablesRequestHandler.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/handlers/IClientGetVariablesRequestHandler.java deleted file mode 100644 index 95ad2370c..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/handlers/IClientGetVariablesRequestHandler.java +++ /dev/null @@ -1,33 +0,0 @@ -package eu.chargetime.ocpp.features.basic.handlers; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.model.basic.GetVariablesConfirmation; -import eu.chargetime.ocpp.model.basic.GetVariablesRequest; - -public interface IClientGetVariablesRequestHandler { - GetVariablesConfirmation handleGetVariablesRequest(GetVariablesRequest request); -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/handlers/IClientSetVariablesRequestHandler.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/handlers/IClientSetVariablesRequestHandler.java deleted file mode 100644 index 12f8d30c6..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/handlers/IClientSetVariablesRequestHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -package eu.chargetime.ocpp.features.basic.handlers; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.model.basic.SetVariablesConfirmation; -import eu.chargetime.ocpp.model.basic.SetVariablesRequest; - -/** Charging Station handler of {@link SetVariablesRequest} */ -public interface IClientSetVariablesRequestHandler { - SetVariablesConfirmation handleSetVariablesRequest(SetVariablesRequest request); -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/handlers/IServerBootNotificationRequestHandler.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/handlers/IServerBootNotificationRequestHandler.java deleted file mode 100644 index 3d3b7ec55..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/handlers/IServerBootNotificationRequestHandler.java +++ /dev/null @@ -1,36 +0,0 @@ -package eu.chargetime.ocpp.features.basic.handlers; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.model.basic.BootNotificationConfirmation; -import eu.chargetime.ocpp.model.basic.BootNotificationRequest; -import java.util.UUID; - -/** Central system handler of {@link BootNotificationRequest}s. */ -public interface IServerBootNotificationRequestHandler { - BootNotificationConfirmation handleBootNotificationRequest( - UUID sessionIndex, BootNotificationRequest request); -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/handlers/IServerStatusNotificationRequestHandler.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/handlers/IServerStatusNotificationRequestHandler.java deleted file mode 100644 index 03500bc68..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/features/basic/handlers/IServerStatusNotificationRequestHandler.java +++ /dev/null @@ -1,36 +0,0 @@ -package eu.chargetime.ocpp.features.basic.handlers; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2021 John Michael Luy - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.model.basic.StatusNotificationConfirmation; -import eu.chargetime.ocpp.model.basic.StatusNotificationRequest; -import java.util.UUID; - -/** Central system handler of {@link StatusNotificationRequest}s. */ -public interface IServerStatusNotificationRequestHandler { - StatusNotificationConfirmation handleStatusNotificationRequest( - UUID sessionIndex, StatusNotificationRequest request); -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/BootNotificationConfirmation.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/BootNotificationConfirmation.java deleted file mode 100644 index b964446ef..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/BootNotificationConfirmation.java +++ /dev/null @@ -1,133 +0,0 @@ -package eu.chargetime.ocpp.model.basic; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - Copyright (C) 2019 Kevin Raddatz - Copyright (C) 2022 Emil Melar - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.model.Confirmation; -import eu.chargetime.ocpp.model.basic.types.RegistrationStatusEnumType; -import eu.chargetime.ocpp.model.validation.RequiredValidator; -import eu.chargetime.ocpp.utilities.MoreObjects; -import java.time.ZonedDateTime; -import java.util.Objects; - -/** sent by the CSMS to the Charging Station in response to a {@link BootNotificationRequest}. */ -public class BootNotificationConfirmation extends Confirmation { - private transient RequiredValidator validator = new RequiredValidator(); - - private ZonedDateTime currentTime; - private int interval; - private RegistrationStatusEnumType status; - - /** - * This contains the CSMS’s current time. - * - * @return {@link ZonedDateTime} - */ - public ZonedDateTime getCurrentTime() { - return currentTime; - } - - /** - * Required. This contains the CSMS’s current time. - * - * @param currentTime {@link ZonedDateTime} - */ - public void setCurrentTime(ZonedDateTime currentTime) { - validator.validate(currentTime); - this.currentTime = currentTime; - } - - /** - * When Status is Accepted, this contains the heartbeat interval in seconds. If the CSMS returns - * something other than Accepted, the value of the interval field indicates the minimum wait time - * before sending a next BootNotification request. - * - * @return integer - */ - public int getInterval() { - return interval; - } - - /** - * Required. When Status is Accepted, this contains the heartbeat interval in seconds. If the CSMS - * returns something other than Accepted, the value of the interval field indicates the minimum - * wait time before sending a next BootNotification request. - * - * @param interval integer - */ - public void setInterval(int interval) { - this.interval = interval; - } - - /** - * This contains whether the Charging Station has been registered within the CSMS. - * - * @return {@link RegistrationStatusEnumType}. - */ - public RegistrationStatusEnumType getStatus() { - return status; - } - - /** - * Required. This contains whether the Charging Station has been registered within the CSMS. - * - * @param status {@link RegistrationStatusEnumType}. - */ - public void setStatus(RegistrationStatusEnumType status) { - validator.validate(status); - this.status = status; - } - - @Override - public boolean validate() { - return currentTime != null && interval > 0 && status != null; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - BootNotificationConfirmation that = (BootNotificationConfirmation) o; - return currentTime.compareTo(that.currentTime) == 0 - && Objects.equals(interval, that.interval) - && Objects.equals(status, that.status); - } - - @Override - public int hashCode() { - return Objects.hash(currentTime, interval, status); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("currentTime", currentTime) - .add("interval", interval) - .add("status", status) - .toString(); - } -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/BootNotificationRequest.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/BootNotificationRequest.java deleted file mode 100644 index ebd06fa96..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/BootNotificationRequest.java +++ /dev/null @@ -1,113 +0,0 @@ -package eu.chargetime.ocpp.model.basic; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.model.RequestWithId; -import eu.chargetime.ocpp.model.basic.types.BootReasonEnumType; -import eu.chargetime.ocpp.model.basic.types.ChargingStationType; -import eu.chargetime.ocpp.model.validation.RequiredValidator; -import eu.chargetime.ocpp.utilities.MoreObjects; -import java.util.Objects; - -/** Sent by the Charging Station to the CSMS. */ -public class BootNotificationRequest extends RequestWithId { - private transient RequiredValidator validator = new RequiredValidator(); - - private BootReasonEnumType reason; - private ChargingStationType chargingStation; - - public BootNotificationRequest() {} - - /** - * This contains the reason for sending this message to the CSMS. - * - * @return {@link BootReasonEnumType} - */ - public BootReasonEnumType getReason() { - return reason; - } - - /** - * Required. This contains the reason for sending this message to the CSMS. - * - * @param reason {@link BootReasonEnumType} - */ - public void setReason(BootReasonEnumType reason) { - validator.validate(reason); - this.reason = reason; - } - - /** - * Identifies the Charging Station. - * - * @return {@link ChargingStationType} - */ - public ChargingStationType getChargingStation() { - return chargingStation; - } - - /** - * Required. Identifies the Charging Station. - * - * @param chargingStation {@link ChargingStationType} - */ - public void setChargingStation(ChargingStationType chargingStation) { - this.chargingStation = chargingStation; - } - - @Override - public boolean validate() { - return validator.safeValidate(reason) - && validator.safeValidate(chargingStation) - && chargingStation.validate(); - } - - @Override - public boolean transactionRelated() { - return false; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - BootNotificationRequest that = (BootNotificationRequest) o; - return Objects.equals(reason, that.reason); - } - - @Override - public int hashCode() { - return Objects.hash(reason, chargingStation); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("reason", reason) - .add("chargingStation", chargingStation) - .toString(); - } -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/GetVariablesConfirmation.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/GetVariablesConfirmation.java deleted file mode 100644 index 691d5ad9f..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/GetVariablesConfirmation.java +++ /dev/null @@ -1,82 +0,0 @@ -package eu.chargetime.ocpp.model.basic; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - Copyright (C) 2022 Emil Melar - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.model.Confirmation; -import eu.chargetime.ocpp.model.basic.types.GetVariableResultType; -import eu.chargetime.ocpp.utilities.MoreObjects; -import java.util.Arrays; -import java.util.Objects; - -public class GetVariablesConfirmation extends Confirmation { - - private GetVariableResultType[] getVariableResult; - - /** - * List of requested variables and their values. - * - * @return {@link GetVariableResultType} - */ - public GetVariableResultType[] getGetVariableResult() { - return getVariableResult; - } - - /** - * Required. List of requested variables and their values. - * - * @param getVariableResult {@link GetVariableResultType} - */ - public void setGetVariableResult(GetVariableResultType[] getVariableResult) { - this.getVariableResult = getVariableResult; - } - - @Override - public boolean validate() { - return getVariableResult != null - && getVariableResult.length > 0 - && Arrays.stream(getVariableResult) - .allMatch(getVariableResult -> getVariableResult.validate()); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - GetVariablesConfirmation that = (GetVariablesConfirmation) o; - return Arrays.equals(getVariableResult, that.getVariableResult); - } - - @Override - public int hashCode() { - return Objects.hash(getVariableResult); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this).add("getVariableResult", getVariableResult).toString(); - } -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/GetVariablesRequest.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/GetVariablesRequest.java deleted file mode 100644 index 7c71fe48c..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/GetVariablesRequest.java +++ /dev/null @@ -1,85 +0,0 @@ -package eu.chargetime.ocpp.model.basic; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.model.RequestWithId; -import eu.chargetime.ocpp.model.basic.types.GetVariableDataType; -import eu.chargetime.ocpp.utilities.MoreObjects; -import java.util.Arrays; -import java.util.Objects; - -public class GetVariablesRequest extends RequestWithId { - - private GetVariableDataType[] getVariableData; - - /** - * List of requested variables. - * - * @return {@link GetVariableDataType}[] - */ - public GetVariableDataType[] getGetVariableData() { - return getVariableData; - } - - /** - * Required. List of requested variables. - * - * @param getVariableData {@link GetVariableDataType}[] - */ - public void setGetVariableData(GetVariableDataType[] getVariableData) { - this.getVariableData = getVariableData; - } - - @Override - public boolean transactionRelated() { - return false; - } - - @Override - public boolean validate() { - return getVariableData != null - && getVariableData.length > 0 - && Arrays.stream(getVariableData).allMatch(getVariableData -> getVariableData.validate()); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - GetVariablesRequest that = (GetVariablesRequest) o; - return Arrays.equals(getVariableData, that.getVariableData); - } - - @Override - public int hashCode() { - return Objects.hash(getVariableData); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this).add("getVariableData", getVariableData).toString(); - } -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/SetVariablesConfirmation.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/SetVariablesConfirmation.java deleted file mode 100644 index 0a864119d..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/SetVariablesConfirmation.java +++ /dev/null @@ -1,90 +0,0 @@ -package eu.chargetime.ocpp.model.basic; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - Copyright (C) 2022 Emil Melar - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.model.Confirmation; -import eu.chargetime.ocpp.model.basic.types.SetVariableResultType; -import eu.chargetime.ocpp.model.validation.RequiredValidator; -import eu.chargetime.ocpp.model.validation.Validator; -import eu.chargetime.ocpp.utilities.MoreObjects; -import java.util.Arrays; -import java.util.Objects; - -/** - * This contains the field definition of the SetVariablesResponse PDU sent by the Charging Station - * to the CSMS in response to a SetVariablesRequest. - */ -public class SetVariablesConfirmation extends Confirmation { - private transient Validator requiredValidator = new RequiredValidator(); - - private SetVariableResultType[] setVariableResult; - - /** - * List of result statuses per Component-Variable. - * - * @return SetVariableResultType[] - */ - public SetVariableResultType[] getSetVariableResult() { - return setVariableResult; - } - - /** - * Required. List of result statuses per Component-Variable. - * - * @param setVariableResult SetVariableResultType[] - */ - public void setSetVariableResult(SetVariableResultType[] setVariableResult) { - requiredValidator.validate(setVariableResult); - this.setVariableResult = setVariableResult; - } - - @Override - public boolean validate() { - return setVariableResult != null - && setVariableResult.length > 0 - && Arrays.stream(setVariableResult) - .allMatch(setVariableResult -> setVariableResult.validate()); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - SetVariablesConfirmation that = (SetVariablesConfirmation) o; - return Arrays.equals(setVariableResult, that.setVariableResult); - } - - @Override - public int hashCode() { - return Objects.hash(setVariableResult); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this).add("setVariableResult", setVariableResult).toString(); - } -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/SetVariablesRequest.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/SetVariablesRequest.java deleted file mode 100644 index dd5363775..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/SetVariablesRequest.java +++ /dev/null @@ -1,93 +0,0 @@ -package eu.chargetime.ocpp.model.basic; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.model.RequestWithId; -import eu.chargetime.ocpp.model.basic.types.SetVariableDataType; -import eu.chargetime.ocpp.model.validation.RequiredValidator; -import eu.chargetime.ocpp.model.validation.Validator; -import eu.chargetime.ocpp.utilities.MoreObjects; -import java.util.Arrays; -import java.util.Objects; - -/** - * This contains the field definition of the SetVariablesRequest PDU sent by the CSMS to the - * Charging Station. - */ -public class SetVariablesRequest extends RequestWithId { - private transient Validator requiredValidator = new RequiredValidator(); - private SetVariableDataType[] setVariableData; - - @Override - public boolean transactionRelated() { - return false; - } - - @Override - public boolean validate() { - return setVariableData != null - && setVariableData.length > 0 - && Arrays.stream(setVariableData) - .allMatch(setVariableDataType -> setVariableDataType.validate()); - } - - /** - * List of Component-Variable pairs and attribute values to set. - * - * @param setVariableData {@link SetVariableDataType} - */ - public void setSetVariableData(SetVariableDataType[] setVariableData) { - requiredValidator.validate(setVariableData); - this.setVariableData = setVariableData; - } - - /** - * Required. List of Component-Variable pairs and attribute values to set. - * - * @return {@link SetVariableDataType} - */ - public SetVariableDataType[] getSetVariableData() { - return this.setVariableData; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - SetVariablesRequest that = (SetVariablesRequest) o; - return Arrays.equals(setVariableData, that.setVariableData); - } - - @Override - public int hashCode() { - return Objects.hash(setVariableData); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this).add("setVariableData", setVariableData).toString(); - } -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/StatusNotificationConfirmation.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/StatusNotificationConfirmation.java deleted file mode 100644 index 8d9fb4a0c..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/StatusNotificationConfirmation.java +++ /dev/null @@ -1,54 +0,0 @@ -package eu.chargetime.ocpp.model.basic; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2021 John Michael Luy - Copyright (C) 2022 Emil Melar - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.model.Confirmation; -import eu.chargetime.ocpp.utilities.MoreObjects; -import java.util.Objects; - -public class StatusNotificationConfirmation extends Confirmation { - - @Override - public boolean validate() { - return true; - } - - @Override - public boolean equals(Object o) { - return this == o || (o != null && getClass() == o.getClass()); - } - - @Override - public int hashCode() { - return Objects.hash(StatusNotificationConfirmation.class); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this).add("isValid", validate()).toString(); - } -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/StatusNotificationRequest.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/StatusNotificationRequest.java deleted file mode 100644 index 8cbaf4a55..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/StatusNotificationRequest.java +++ /dev/null @@ -1,164 +0,0 @@ -package eu.chargetime.ocpp.model.basic; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2021 John Michael Luy - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.model.RequestWithId; -import eu.chargetime.ocpp.model.basic.types.ConnectorStatusEnumType; -import eu.chargetime.ocpp.model.validation.RequiredValidator; -import eu.chargetime.ocpp.utilities.MoreObjects; -import java.time.ZonedDateTime; -import java.util.Objects; - -public class StatusNotificationRequest extends RequestWithId { - - private transient RequiredValidator validator = new RequiredValidator(); - - private ZonedDateTime timestamp; - - private ConnectorStatusEnumType connectorStatus; - - private Integer evseId; - - private Integer connectorId; - - /** - * This is the time for which the status is reported - * - * @return {@link ZonedDateTime} - */ - public ZonedDateTime getTimestamp() { - return timestamp; - } - - /** - * Required. Time the status is reported. - * - * @param timestamp {@link ZonedDateTime} - */ - public void setTimestamp(ZonedDateTime timestamp) { - validator.validate(timestamp); - this.timestamp = timestamp; - } - - /** - * This contains the current status of the Connector. - * - * @return {@link ConnectorStatusEnumType} - */ - public ConnectorStatusEnumType getConnectorStatus() { - return connectorStatus; - } - - /** - * Required. The current status of the Connector. - * - * @param connectorStatus {@link ConnectorStatusEnumType} - */ - public void setConnectorStatus(ConnectorStatusEnumType connectorStatus) { - validator.validate(connectorStatus); - this.connectorStatus = connectorStatus; - } - - /** - * This is the id of the EVSE to which the connector belongs for which the status is reported. - * - * @return {@link ConnectorStatusEnumType} - */ - public Integer getEvseId() { - return evseId; - } - - /** - * Required. The id of the EVSE to which the connector belongs for which the status is reported. - * - * @param evseId integer, evse id - */ - public void setEvseId(Integer evseId) { - validator.validate(evseId); - this.evseId = evseId; - } - - /** - * This is the id of the connector within the EVSE for which the status is reported. - * - * @return {@link ConnectorStatusEnumType} - */ - public Integer getConnectorId() { - return connectorId; - } - - /** - * Required. The id of the connector within the EVSE for which the status is reported. - * - * @param connectorId integer, connector id - */ - public void setConnectorId(Integer connectorId) { - validator.validate(connectorId); - this.connectorId = connectorId; - } - - @Override - public boolean transactionRelated() { - return false; - } - - @Override - public boolean validate() { - return validator.safeValidate(timestamp) - && validator.safeValidate(connectorStatus) - && validator.safeValidate(evseId) - && validator.safeValidate(connectorId); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - StatusNotificationRequest that = (StatusNotificationRequest) o; - return Objects.equals(connectorStatus, that.connectorStatus) - && Objects.equals(evseId, that.evseId) - && Objects.equals(connectorId, that.connectorId); - } - - @Override - public int hashCode() { - return Objects.hash(timestamp, connectorStatus, evseId, connectorId); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("timestamp", timestamp) - .add("connectorStatus", connectorStatus) - .add("evseId", evseId) - .add("connectorId", connectorId) - .toString(); - } -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/AttributeEnumType.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/AttributeEnumType.java deleted file mode 100644 index b77f7510e..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/AttributeEnumType.java +++ /dev/null @@ -1,41 +0,0 @@ -package eu.chargetime.ocpp.model.basic.types; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -/** AttributeEnumType is used by {@link SetVariableDataType}, {@link GetVariableDataType} */ -public enum AttributeEnumType { - /** The actual value of the variable. */ - Actual, - - /** The target value for this variable. */ - Target, - - /** The minimal allowed value for this variable. */ - MinSet, - - /** The maximum allowed value for this variable. */ - MaxSet -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/BootReasonEnumType.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/BootReasonEnumType.java deleted file mode 100644 index ec5cc9089..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/BootReasonEnumType.java +++ /dev/null @@ -1,58 +0,0 @@ -package eu.chargetime.ocpp.model.basic.types; -/* - * ChargeTime.eu - Java-OCA-OCPP - * - * MIT License - * - * Copyright (C) 2016-2018 Thomas Volden - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import eu.chargetime.ocpp.model.basic.BootNotificationRequest; - -/** Accepted values used with {@link BootNotificationRequest}. */ -public enum BootReasonEnumType { - /** The Charging Station rebooted due to an application error. */ - ApplicationReset, - - /** The Charging Station rebooted due to a firmware update. */ - FirmwareUpdate, - - /** The Charging Station rebooted due to a local reset command. */ - LocalReset, - - /** The Charging Station powered up and registers itself with the CSMS. */ - PowerUp, - - /** The Charging Station rebooted due to a remote reset command. */ - RemoteReset, - - /** The Charging Station rebooted due to a scheduled reset command. */ - ScheduledReset, - - /** Requested by the CSMS via a TriggerMessage. */ - Triggered, - - /** The boot reason is unknown. */ - Unknown, - - /** The Charging Station rebooted due to an elapsed watchdog timer. */ - Watchdog -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/ChargingStationType.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/ChargingStationType.java deleted file mode 100644 index 291fb230a..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/ChargingStationType.java +++ /dev/null @@ -1,185 +0,0 @@ -package eu.chargetime.ocpp.model.basic.types; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.model.Validatable; -import eu.chargetime.ocpp.model.validation.OCPP2PrimDatatypes; -import eu.chargetime.ocpp.model.validation.Validator; -import eu.chargetime.ocpp.model.validation.ValidatorBuilder; -import eu.chargetime.ocpp.utilities.MoreObjects; -import java.util.Objects; - -public class ChargingStationType implements Validatable { - private transient Validator serialNumberValidator = - new ValidatorBuilder().addRule(OCPP2PrimDatatypes.string20()).build(); - private transient Validator modelValidator = - new ValidatorBuilder().setRequired(true).addRule(OCPP2PrimDatatypes.string20()).build(); - private transient Validator vendorNameValidator = - new ValidatorBuilder().setRequired(true).addRule(OCPP2PrimDatatypes.string50()).build(); - private transient Validator firmwareVersionValidator = - new ValidatorBuilder().addRule(OCPP2PrimDatatypes.string50()).build(); - - private String serialNumber; - private String model; - private String vendorName; - private String firmwareVersion; - private ModemType modem; - - /** - * Vendor-specific device identifier. - * - * @return string[0..20] - */ - public String getSerialNumber() { - return serialNumber; - } - - /** - * Optional. Vendor-specific device identifier. - * - * @param serialNumber string[0..20] - */ - public void setSerialNumber(String serialNumber) { - serialNumberValidator.validate(serialNumber); - - this.serialNumber = serialNumber; - } - - /** - * Defines the model of the device. - * - * @return string[0..20] - */ - public String getModel() { - return model; - } - - /** - * Required. Defines the model of the device. - * - * @param model string[0..20] - */ - public void setModel(String model) { - modelValidator.validate(model); - - this.model = model; - } - - /** - * Identifies the vendor (not necessarily in a unique manner). - * - * @return string[0..50] - */ - public String getVendorName() { - return vendorName; - } - - /** - * Required. Identifies the vendor (not necessarily in a unique manner). - * - * @param vendorName string[0..50] - */ - public void setVendorName(String vendorName) { - vendorNameValidator.validate(vendorName); - - this.vendorName = vendorName; - } - - /** - * This contains the firmware version of the Charging Station. - * - * @return string[0..50] - */ - public String getFirmwareVersion() { - return firmwareVersion; - } - - /** - * Optional. This contains the firmware version of the Charging Station. - * - * @param firmwareVersion string[0..50] - */ - public void setFirmwareVersion(String firmwareVersion) { - firmwareVersionValidator.validate(firmwareVersion); - - this.firmwareVersion = firmwareVersion; - } - - /** - * Defines the functional parameters of a communication link. - * - * @return {@link ModemType} - */ - public ModemType getModem() { - return modem; - } - - /** - * Optional. Defines the functional parameters of a communication link. - * - * @param modem {@link ModemType} - */ - public void setModem(ModemType modem) { - this.modem = modem; - } - - @Override - public boolean validate() { - return serialNumberValidator.safeValidate(serialNumber) - && modelValidator.safeValidate(model) - && vendorNameValidator.safeValidate(vendorName) - && firmwareVersionValidator.safeValidate(firmwareVersion) - && (modem == null || modem.validate()); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - ChargingStationType that = (ChargingStationType) o; - return Objects.equals(serialNumber, that.serialNumber) - && Objects.equals(model, that.model) - && Objects.equals(vendorName, that.vendorName) - && Objects.equals(firmwareVersion, that.firmwareVersion) - && Objects.equals(modem, that.modem); - } - - @Override - public int hashCode() { - return Objects.hash(serialNumber, model, vendorName, firmwareVersion, modem); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("serialNumber", serialNumber) - .add("model", model) - .add("vendorName", vendorName) - .add("firmwareVersion", firmwareVersion) - .add("modem", modem) - .toString(); - } -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/ComponentType.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/ComponentType.java deleted file mode 100644 index 2c7370dc4..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/ComponentType.java +++ /dev/null @@ -1,140 +0,0 @@ -package eu.chargetime.ocpp.model.basic.types; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.model.Validatable; -import eu.chargetime.ocpp.model.validation.OCPP2PrimDatatypes; -import eu.chargetime.ocpp.model.validation.Validator; -import eu.chargetime.ocpp.model.validation.ValidatorBuilder; -import eu.chargetime.ocpp.utilities.MoreObjects; -import java.util.Objects; - -/** A physical or logical component. */ -public class ComponentType implements Validatable { - private transient Validator nameValidator = - new ValidatorBuilder().setRequired(true).addRule(OCPP2PrimDatatypes.string50()).build(); - private transient Validator instanceValidator = - new ValidatorBuilder().addRule(OCPP2PrimDatatypes.string50()).build(); - - private String name; - private String instance; - private EVSEType evse; - - /** - * Name of the component. Name should be taken from the list of standardized component names - * whenever possible. Case Insensitive. strongly advised to use Camel Case. - * - * @return string[0..50] - */ - public String getName() { - return name; - } - - /** - * Required. Name of the component. Name should be taken from the list of standardized component - * names whenever possible. Case Insensitive. strongly advised to use Camel Case. - * - * @param name string[0..50] - */ - public void setName(String name) { - nameValidator.validate(name); - - this.name = name; - } - - /** - * Name of instance in case the component exists as multiple instances. Case Insensitive. strongly - * advised to use Camel Case. - * - * @return string[0..50] - */ - public String getInstance() { - return instance; - } - - /** - * Optional. Name of instance in case the component exists as multiple instances. Case - * Insensitive. strongly advised to use Camel Case. - * - * @param instance string[0..50] - */ - public void setInstance(String instance) { - instanceValidator.validate(instance); - - this.instance = instance; - } - - /** - * Specifies the EVSE when component is located at EVSE level, also specifies the connector when - * component is located at Connector level. - * - * @return {@link EVSEType} - */ - public EVSEType getEvse() { - return evse; - } - - /** - * Optional. Specifies the EVSE when component is located at EVSE level, also specifies the - * connector when component is located at Connector level. - * - * @param evse {@link EVSEType} - */ - public void setEvse(EVSEType evse) { - this.evse = evse; - } - - @Override - public boolean validate() { - return nameValidator.safeValidate(name) - && instanceValidator.safeValidate(instance) - && (evse == null || evse.validate()); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - ComponentType that = (ComponentType) o; - return Objects.equals(name, that.name) - && Objects.equals(instance, that.instance) - && Objects.equals(evse, that.evse); - } - - @Override - public int hashCode() { - return Objects.hash(name, instance, evse); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("name", name) - .add("instance", instance) - .add("evse", evse) - .toString(); - } -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/ConnectorStatusEnumType.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/ConnectorStatusEnumType.java deleted file mode 100644 index b771f1991..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/ConnectorStatusEnumType.java +++ /dev/null @@ -1,34 +0,0 @@ -package eu.chargetime.ocpp.model.basic.types; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2021 John Michael Luy - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -public enum ConnectorStatusEnumType { - Available, - Occupied, - Reserved, - Unavailable, - Faulted -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/EVSEType.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/EVSEType.java deleted file mode 100644 index a8556a5c9..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/EVSEType.java +++ /dev/null @@ -1,98 +0,0 @@ -package eu.chargetime.ocpp.model.basic.types; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.model.Validatable; -import eu.chargetime.ocpp.utilities.MoreObjects; -import java.util.Objects; - -/** Electric Vehicle Supply Equipment */ -public class EVSEType implements Validatable { - private int id; - private Integer connectorId; - - /** - * EVSE Identifier. When 0, the ID references the Charging Station as a whole. - * - * @return integer - */ - public int getId() { - return id; - } - - /** - * Required. EVSE Identifier. When 0, the ID references the Charging Station as a whole. - * - * @param id integer - */ - public void setId(int id) { - this.id = id; - } - - /** - * An id to designate a specific connector (on an EVSE) by connector index number. - * - * @return integer - */ - public Integer getConnectorId() { - return connectorId; - } - - /** - * Optional. An id to designate a specific connector (on an EVSE) by connector index number. - * - * @param connectorId integer - */ - public void setConnectorId(Integer connectorId) { - this.connectorId = connectorId; - } - - @Override - public boolean validate() { - return true; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - EVSEType that = (EVSEType) o; - return Objects.equals(id, that.id) && Objects.equals(connectorId, that.connectorId); - } - - @Override - public int hashCode() { - return Objects.hash(id, connectorId); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("id", id) - .add("connectorId", connectorId) - .toString(); - } -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/GetVariableDataType.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/GetVariableDataType.java deleted file mode 100644 index ca196b219..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/GetVariableDataType.java +++ /dev/null @@ -1,128 +0,0 @@ -package eu.chargetime.ocpp.model.basic.types; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.model.Validatable; -import eu.chargetime.ocpp.model.validation.RequiredValidator; -import eu.chargetime.ocpp.model.validation.Validator; -import eu.chargetime.ocpp.utilities.MoreObjects; -import java.util.Objects; - -public class GetVariableDataType implements Validatable { - private transient Validator requiredValidator = new RequiredValidator(); - - private AttributeEnumType attributeType; - private ComponentType component; - private VariableType variable; - - /** - * Attribute type for which value is requested. When absent, default Actual is assumed. - * - * @return {@link AttributeEnumType} - */ - public AttributeEnumType getAttributeType() { - return attributeType; - } - - /** - * Optional. Attribute type for which value is requested. When absent, default Actual is assumed. - * - * @param attributeType {@link AttributeEnumType} - */ - public void setAttributeType(AttributeEnumType attributeType) { - this.attributeType = attributeType; - } - - /** - * Component for which the Variable is requested. - * - * @return {@link ComponentType} - */ - public ComponentType getComponent() { - return component; - } - - /** - * Required. Component for which the Variable is requested. - * - * @param component {@link ComponentType} - */ - public void setComponent(ComponentType component) { - requiredValidator.validate(component); - this.component = component; - } - - /** - * Variable for which the attribute value is requested. - * - * @return {@link VariableType} - */ - public VariableType getVariable() { - return variable; - } - - /** - * Required. Variable for which the attribute value is requested. - * - * @param variable {@link VariableType} - */ - public void setVariable(VariableType variable) { - requiredValidator.validate(variable); - this.variable = variable; - } - - @Override - public boolean validate() { - return requiredValidator.safeValidate(component) - && requiredValidator.safeValidate(variable) - && component.validate() - && variable.validate(); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - GetVariableDataType that = (GetVariableDataType) o; - return Objects.equals(attributeType, that.attributeType) - && Objects.equals(component, that.component) - && Objects.equals(variable, that.variable); - } - - @Override - public int hashCode() { - return Objects.hash(attributeType, component, variable); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("attributeType", attributeType) - .add("component", component) - .add("variable", variable) - .toString(); - } -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/GetVariableResultType.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/GetVariableResultType.java deleted file mode 100644 index 307f969fd..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/GetVariableResultType.java +++ /dev/null @@ -1,186 +0,0 @@ -package eu.chargetime.ocpp.model.basic.types; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.model.Validatable; -import eu.chargetime.ocpp.model.validation.OCPP2PrimDatatypes; -import eu.chargetime.ocpp.model.validation.RequiredValidator; -import eu.chargetime.ocpp.model.validation.Validator; -import eu.chargetime.ocpp.model.validation.ValidatorBuilder; -import eu.chargetime.ocpp.utilities.MoreObjects; -import java.util.Objects; - -public class GetVariableResultType implements Validatable { - private transient Validator requiredValidator = new RequiredValidator(); - private transient Validator attributeValueValidator = - new ValidatorBuilder().setRequired(true).addRule(OCPP2PrimDatatypes.string1000()).build(); - - private GetVariableStatusEnumType attributeStatus; - private AttributeEnumType attributeType; - private String attributeValue; - private ComponentType component; - private VariableType variable; - - /** - * Result status of getting the variable. - * - * @return {@link GetVariableStatusEnumType} - */ - public GetVariableStatusEnumType getAttributeStatus() { - return attributeStatus; - } - - /** - * Required. Result status of getting the variable. - * - * @param attributeStatus {@link GetVariableStatusEnumType} - */ - public void setAttributeStatus(GetVariableStatusEnumType attributeStatus) { - requiredValidator.validate(attributeStatus); - - this.attributeStatus = attributeStatus; - } - - /** - * Attribute type for which value is requested. When absent, default Actual is assumed. - * - * @return {@link AttributeEnumType} - */ - public AttributeEnumType getAttributeType() { - return attributeType; - } - - /** - * Optional. Attribute type for which value is requested. When absent, default Actual is assumed. - * - * @param attributeType {@link AttributeEnumType} - */ - public void setAttributeType(AttributeEnumType attributeType) { - this.attributeType = attributeType; - } - - /** - * Value of requested attribute type of componentvariable. - * - * @return String[0..1000] - */ - public String getAttributeValue() { - return attributeValue; - } - - /** - * Optional. Value of requested attribute type of componentvariable. This field can only be empty - * when the given status is NOT accepted. - * - *

The Configuration Variable ValueSize can be used to limit the - * VariableCharacteristicsType.ValueList and all AttributeValue fields. The max size of these - * values will always remain equal. The default max size is set to 1000. - * - * @param attributeValue String[0..1000] - */ - public void setAttributeValue(String attributeValue) { - attributeValueValidator.validate(attributeValue); - - this.attributeValue = attributeValue; - } - - /** - * Component for which the Variable is requested. - * - * @return {@link ComponentType} - */ - public ComponentType getComponent() { - return component; - } - - /** - * Required. Component for which the Variable is requested. - * - * @param component {@link ComponentType} - */ - public void setComponent(ComponentType component) { - requiredValidator.validate(component); - this.component = component; - } - - /** - * Variable for which the attribute value is requested. - * - * @return {@link VariableType} - */ - public VariableType getVariable() { - return variable; - } - - /** - * Required. Variable for which the attribute value is requested. - * - * @param variable {@link VariableType} - */ - public void setVariable(VariableType variable) { - requiredValidator.validate(variable); - this.variable = variable; - } - - @Override - public boolean validate() { - return requiredValidator.safeValidate(attributeStatus) - && (attributeStatus != GetVariableStatusEnumType.Accepted - || requiredValidator.safeValidate(attributeValue)) - && requiredValidator.safeValidate(component) - && requiredValidator.safeValidate(variable) - && component.validate() - && variable.validate(); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - GetVariableResultType that = (GetVariableResultType) o; - return Objects.equals(attributeType, that.attributeType) - && Objects.equals(attributeStatus, that.attributeStatus) - && Objects.equals(attributeValue, that.attributeValue) - && Objects.equals(component, that.component) - && Objects.equals(variable, that.variable); - } - - @Override - public int hashCode() { - return Objects.hash(attributeType, attributeStatus, attributeValue, component, variable); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("attributeType", attributeType) - .add("attributeStatus", attributeStatus) - .add("attributeValue", attributeValue) - .add("component", component) - .add("variable", variable) - .toString(); - } -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/GetVariableStatusEnumType.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/GetVariableStatusEnumType.java deleted file mode 100644 index a2422331b..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/GetVariableStatusEnumType.java +++ /dev/null @@ -1,44 +0,0 @@ -package eu.chargetime.ocpp.model.basic.types; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -/** GetVariableStatusEnumType is used by {@link GetVariableResultType} */ -public enum GetVariableStatusEnumType { - /** Variable successfully set. */ - Accepted, - - /** Request is rejected. */ - Rejected, - - /** Component is not known. */ - UnknownComponent, - - /** Variable is not known. */ - UnknownVariable, - - /** The AttributeType is not supported. */ - NotSupportedAttributeType -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/ModemType.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/ModemType.java deleted file mode 100644 index 47acd4a99..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/ModemType.java +++ /dev/null @@ -1,105 +0,0 @@ -package eu.chargetime.ocpp.model.basic.types; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.model.Validatable; -import eu.chargetime.ocpp.model.validation.OCPP2PrimDatatypes; -import eu.chargetime.ocpp.model.validation.Validator; -import eu.chargetime.ocpp.model.validation.ValidatorBuilder; -import eu.chargetime.ocpp.utilities.MoreObjects; -import java.util.Objects; - -public class ModemType implements Validatable { - private transient Validator validator = - new ValidatorBuilder() - .addRule(OCPP2PrimDatatypes.identifierString()) - .addRule(OCPP2PrimDatatypes.string20()) - .build(); - - private String iccid; - private String imsi; - - /** - * This contains the ICCID of the modem’s SIM card. - * - * @return identifierString[0..20] - */ - public String getIccid() { - return iccid; - } - - /** - * Optional. This contains the ICCID of the modem’s SIM card. - * - * @param iccid identifierString[0..20] - */ - public void setIccid(String iccid) { - validator.validate(iccid); - this.iccid = iccid; - } - - /** - * This contains the IMSI of the modem’s SIM card. - * - * @return identifierString[0..20] - */ - public String getImsi() { - return imsi; - } - - /** - * Optional. This contains the IMSI of the modem’s SIM card. - * - * @param imsi identifierString[0..20] - */ - public void setImsi(String imsi) { - validator.validate(imsi); - this.imsi = imsi; - } - - @Override - public boolean validate() { - return validator.safeValidate(iccid) && validator.safeValidate(imsi); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - ModemType that = (ModemType) o; - return Objects.equals(iccid, that.iccid) && Objects.equals(imsi, that.imsi); - } - - @Override - public int hashCode() { - return Objects.hash(iccid, imsi); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this).add("iccid", iccid).add("imsi", imsi).toString(); - } -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/RegistrationStatusEnumType.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/RegistrationStatusEnumType.java deleted file mode 100644 index 8a4547bef..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/RegistrationStatusEnumType.java +++ /dev/null @@ -1,43 +0,0 @@ -package eu.chargetime.ocpp.model.basic.types; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -public enum RegistrationStatusEnumType { - /** Charging Station is accepted by the CSMS. */ - Accepted, - - /** - * CSMS is not yet ready to accept the Charging Station. CSMS may send messages to retrieve - * information or prepare the Charging Station. - */ - Pending, - - /** - * Charging Station is not accepted by CSMS. This may happen when the Charging Station id is not - * known by CSMS. - */ - Rejected -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/SetVariableDataType.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/SetVariableDataType.java deleted file mode 100644 index bcad49691..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/SetVariableDataType.java +++ /dev/null @@ -1,159 +0,0 @@ -package eu.chargetime.ocpp.model.basic.types; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.model.Validatable; -import eu.chargetime.ocpp.model.validation.OCPP2PrimDatatypes; -import eu.chargetime.ocpp.model.validation.RequiredValidator; -import eu.chargetime.ocpp.model.validation.Validator; -import eu.chargetime.ocpp.model.validation.ValidatorBuilder; -import eu.chargetime.ocpp.utilities.MoreObjects; -import java.util.Objects; - -public class SetVariableDataType implements Validatable { - private transient Validator requiredValidator = new RequiredValidator(); - private transient Validator attributeValueValidator = - new ValidatorBuilder().setRequired(true).addRule(OCPP2PrimDatatypes.string1000()).build(); - - private AttributeEnumType attributeType; - private String attributeValue; - private ComponentType component; - private VariableType variable; - - /** - * Type of attribute: Actual, Target, MinSet, MaxSet. Default is Actual when omitted. - * - * @return {@link AttributeEnumType} - */ - public AttributeEnumType getAttributeType() { - return attributeType; - } - - /** - * Optional. Type of attribute: Actual, Target, MinSet, MaxSet. Default is Actual when omitted. - * - * @param attributeType {@link AttributeEnumType} - */ - public void setAttributeType(AttributeEnumType attributeType) { - this.attributeType = attributeType; - } - - /** - * Value to be assigned to attribute of variable. - * - * @return string[0..1000] - */ - public String getAttributeValue() { - return attributeValue; - } - - /** - * Required. Value to be assigned to attribute of variable. The Configuration Variable ValueSize - * can be used to limit the VariableCharacteristicsType. ValueList and all AttributeValue fields. - * The max size of these values will always remain equal. The default max size is set to 1000. - * - * @param attributeValue string[0..1000] - */ - public void setAttributeValue(String attributeValue) { - attributeValueValidator.validate(attributeValue); - this.attributeValue = attributeValue; - } - - /** - * The component for which the variable data is set. - * - * @return {@link ComponentType} - */ - public ComponentType getComponent() { - return component; - } - - /** - * Required. The component for which the variable data is set. - * - * @param component {@link ComponentType} - */ - public void setComponent(ComponentType component) { - requiredValidator.validate(component); - - this.component = component; - } - - /** - * Specifies the that needs to be set. - * - * @return {@link VariableType} - */ - public VariableType getVariable() { - return variable; - } - - /** - * Required. Specifies the that needs to be set. - * - * @param variable {@link VariableType} - */ - public void setVariable(VariableType variable) { - requiredValidator.validate(variable); - - this.variable = variable; - } - - @Override - public boolean validate() { - return attributeValueValidator.safeValidate(attributeValue) - && requiredValidator.safeValidate(component) - && requiredValidator.safeValidate(variable) - && component.validate() - && variable.validate(); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - SetVariableDataType that = (SetVariableDataType) o; - return Objects.equals(attributeType, that.attributeType) - && Objects.equals(attributeValue, that.attributeValue) - && Objects.equals(component, that.component) - && Objects.equals(variable, that.variable); - } - - @Override - public int hashCode() { - return Objects.hash(attributeType, attributeValue, component, variable); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("attributeType", attributeType) - .add("attributeValue", attributeValue) - .add("component", component) - .add("variable", variable) - .toString(); - } -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/SetVariableResultType.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/SetVariableResultType.java deleted file mode 100644 index e94fb7d12..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/SetVariableResultType.java +++ /dev/null @@ -1,154 +0,0 @@ -package eu.chargetime.ocpp.model.basic.types; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.model.Validatable; -import eu.chargetime.ocpp.model.validation.RequiredValidator; -import eu.chargetime.ocpp.model.validation.Validator; -import eu.chargetime.ocpp.utilities.MoreObjects; -import java.util.Objects; - -/** - * VariableAttributeType is used by {@link eu.chargetime.ocpp.model.basic.SetVariablesConfirmation} - */ -public class SetVariableResultType implements Validatable { - private transient Validator requiredValidator = new RequiredValidator(); - - private AttributeEnumType attributeType; - private SetVariableStatusEnumType attributeStatus; - private ComponentType component; - private VariableType variable; - - /** - * Type of attribute: Actual, Target, MinSet, MaxSet. Default is Actual when omitted. - * - * @return AttributeEnumType - */ - public AttributeEnumType getAttributeType() { - return attributeType; - } - - /** - * Optional. Type of attribute: Actual, Target, MinSet, MaxSet. Default is Actual when omitted. - * - * @param attributeType AttributeEnumType - */ - public void setAttributeType(AttributeEnumType attributeType) { - this.attributeType = attributeType; - } - - /** - * Result status of setting the variable. - * - * @return SetVariableStatusEnumType - */ - public SetVariableStatusEnumType getAttributeStatus() { - return attributeStatus; - } - - /** - * Required. Result status of setting the variable. - * - * @param attributeStatus SetVariableStatusEnumType - */ - public void setAttributeStatus(SetVariableStatusEnumType attributeStatus) { - requiredValidator.validate(attributeStatus); - this.attributeStatus = attributeStatus; - } - - /** - * The component for which result is returned. - * - * @return ComponentType - */ - public ComponentType getComponent() { - return component; - } - - /** - * Required. The component for which result is returned. - * - * @param component ComponentType - */ - public void setComponent(ComponentType component) { - requiredValidator.validate(component); - this.component = component; - } - - /** - * The variable for which the result is returned. - * - * @return VariableType - */ - public VariableType getVariable() { - return variable; - } - - /** - * Required. The variable for which the result is returned. - * - * @param variable VariableType - */ - public void setVariable(VariableType variable) { - requiredValidator.validate(variable); - this.variable = variable; - } - - @Override - public boolean validate() { - return requiredValidator.safeValidate(attributeStatus) - && requiredValidator.safeValidate(component) - && requiredValidator.safeValidate(variable) - && component.validate() - && variable.validate(); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - SetVariableResultType that = (SetVariableResultType) o; - return Objects.equals(attributeType, that.attributeType) - && Objects.equals(attributeStatus, that.attributeStatus) - && Objects.equals(component, that.component) - && Objects.equals(variable, that.variable); - } - - @Override - public int hashCode() { - return Objects.hash(attributeType, attributeStatus, component, variable); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("attributeType", attributeType) - .add("attributeStatus", attributeStatus) - .add("component", component) - .add("variable", variable) - .toString(); - } -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/SetVariableStatusEnumType.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/SetVariableStatusEnumType.java deleted file mode 100644 index fdaf1bb9e..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/SetVariableStatusEnumType.java +++ /dev/null @@ -1,57 +0,0 @@ -package eu.chargetime.ocpp.model.basic.types; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -/** - * SetVariableStatusEnumType is used by {@link - * eu.chargetime.ocpp.model.basic.SetVariablesConfirmation} - */ -public enum SetVariableStatusEnumType { - - /** Variable successfully set. */ - Accepted, - - /** Request is rejected. */ - Rejected, - - /** Value has invalid format for the variable. */ - InvalidValue, - - /** Component is not known. */ - UnknownComponent, - - /** Variable is not known. */ - UnknownVariable, - - /** The AttributeType is not supported. */ - NotSupportedAttributeType, - - /** Value is out of range defined in VariableCharacteristics. */ - OutOfRange, - - /** A reboot is required. */ - RebootRequired -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/VariableType.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/VariableType.java deleted file mode 100644 index 7d91a944f..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/basic/types/VariableType.java +++ /dev/null @@ -1,109 +0,0 @@ -package eu.chargetime.ocpp.model.basic.types; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.model.Validatable; -import eu.chargetime.ocpp.model.validation.OCPP2PrimDatatypes; -import eu.chargetime.ocpp.model.validation.Validator; -import eu.chargetime.ocpp.model.validation.ValidatorBuilder; -import eu.chargetime.ocpp.utilities.MoreObjects; -import java.util.Objects; - -/** Reference key to a component-variable. */ -public class VariableType implements Validatable { - private transient Validator nameValidator = - new ValidatorBuilder().setRequired(true).addRule(OCPP2PrimDatatypes.string50()).build(); - private transient Validator instanceValidator = - new ValidatorBuilder().addRule(OCPP2PrimDatatypes.string50()).build(); - - private String name; - private String instance; - - /** - * Name of the variable. Name should be taken from the list of standardized variable names - * whenever possible. Case Insensitive. strongly advised to use Camel Case. - * - * @return string[0..50] - */ - public String getName() { - return name; - } - - /** - * Required. Name of the variable. Name should be taken from the list of standardized variable - * names whenever possible. Case Insensitive. strongly advised to use Camel Case. - * - * @param name string[0..50] - */ - public void setName(String name) { - nameValidator.validate(name); - this.name = name; - } - - /** - * Name of instance in case the variable exists as multiple instances. Case Insensitive. strongly - * advised to use Camel Case. - * - * @return string[0..50] - */ - public String getInstance() { - return instance; - } - - /** - * Optional. Name of instance in case the variable exists as multiple instances. Case Insensitive. - * strongly advised to use Camel Case. - * - * @param instance string[0..50] - */ - public void setInstance(String instance) { - instanceValidator.validate(instance); - this.instance = instance; - } - - @Override - public boolean validate() { - return nameValidator.safeValidate(name) && instanceValidator.safeValidate(instance); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - VariableType that = (VariableType) o; - return Objects.equals(name, that.name) && Objects.equals(instance, that.instance); - } - - @Override - public int hashCode() { - return Objects.hash(name, instance); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this).add("name", name).add("instance", instance).toString(); - } -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/validation/OCPP2PrimDatatypes.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/validation/OCPP2PrimDatatypes.java deleted file mode 100644 index f378cd0f4..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/validation/OCPP2PrimDatatypes.java +++ /dev/null @@ -1,45 +0,0 @@ -package eu.chargetime.ocpp.model.validation; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -public class OCPP2PrimDatatypes { - - public static IValidationRule string50() { - return new StringMaxLengthValidationRule(50); - } - - public static IValidationRule string20() { - return new StringMaxLengthValidationRule(20); - } - - public static IValidationRule string1000() { - return new StringMaxLengthValidationRule(1000); - } - - public static IValidationRule identifierString() { - return new IdentifierStringValidationRule(); - } -} diff --git a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/validation/StringMaxLengthValidationRule.java b/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/validation/StringMaxLengthValidationRule.java deleted file mode 100644 index bf7126e45..000000000 --- a/ocpp-v2_0/src/main/java/eu/chargetime/ocpp/model/validation/StringMaxLengthValidationRule.java +++ /dev/null @@ -1,45 +0,0 @@ -package eu.chargetime.ocpp.model.validation; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.PropertyConstraintException; - -public class StringMaxLengthValidationRule implements IValidationRule { - - private static final String ERROR_MESSAGE = "Exceeded limit of %s chars"; - private final int maxLength; - - public StringMaxLengthValidationRule(int maxLength) { - this.maxLength = maxLength; - } - - @Override - public void validate(String value) throws PropertyConstraintException { - if (value.length() > maxLength) - throw new PropertyConstraintException( - value.length(), String.format(ERROR_MESSAGE, maxLength)); - } -} diff --git a/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/SetVariablesConfirmationTest.java b/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/SetVariablesConfirmationTest.java deleted file mode 100644 index 61d37a5dd..000000000 --- a/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/SetVariablesConfirmationTest.java +++ /dev/null @@ -1,68 +0,0 @@ -package eu.chargetime.ocpp.model.basic; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import static eu.chargetime.ocpp.utilities.TestUtilities.aList; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import eu.chargetime.ocpp.PropertyConstraintException; -import eu.chargetime.ocpp.model.basic.types.SetVariableResultType; -import org.junit.Assert; -import org.junit.Test; - -public class SetVariablesConfirmationTest { - - @Test(expected = PropertyConstraintException.class) - public void setSetVariableResult_Null_ThrowsPropertyConstraintException() { - SetVariablesConfirmation sut = new SetVariablesConfirmation(); - - sut.setSetVariableResult(null); - } - - @Test - public void validate_default_returnsFalse() { - boolean expected = false; - SetVariablesConfirmation sut = new SetVariablesConfirmation(); - - boolean result = sut.validate(); - - Assert.assertEquals(expected, result); - } - - @Test - public void validate_SetVariableResultIsSet_returnsTrue() { - boolean expected = true; - SetVariableResultType setVariableResultTypeStub = mock(SetVariableResultType.class); - when(setVariableResultTypeStub.validate()).thenReturn(true); - SetVariablesConfirmation sut = new SetVariablesConfirmation(); - sut.setSetVariableResult(aList(setVariableResultTypeStub)); - - boolean result = sut.validate(); - - Assert.assertEquals(expected, result); - } -} diff --git a/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/test/BootNotificationConfirmationTest.java b/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/test/BootNotificationConfirmationTest.java deleted file mode 100644 index 1d68c88fa..000000000 --- a/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/test/BootNotificationConfirmationTest.java +++ /dev/null @@ -1,47 +0,0 @@ -package eu.chargetime.ocpp.model.basic.test; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.PropertyConstraintException; -import eu.chargetime.ocpp.model.basic.BootNotificationConfirmation; -import org.junit.Test; - -public class BootNotificationConfirmationTest { - - @Test(expected = PropertyConstraintException.class) - public void setCurrentTime_null_throwsPropertyConstraintException() { - BootNotificationConfirmation sut = new BootNotificationConfirmation(); - - sut.setCurrentTime(null); - } - - @Test(expected = PropertyConstraintException.class) - public void setStatus_null_throwsPropertyConstraintException() { - BootNotificationConfirmation sut = new BootNotificationConfirmation(); - - sut.setStatus(null); - } -} diff --git a/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/test/BootNotificationRequestTest.java b/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/test/BootNotificationRequestTest.java deleted file mode 100644 index bd001be6e..000000000 --- a/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/test/BootNotificationRequestTest.java +++ /dev/null @@ -1,75 +0,0 @@ -package eu.chargetime.ocpp.model.basic.test; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.when; - -import eu.chargetime.ocpp.PropertyConstraintException; -import eu.chargetime.ocpp.model.basic.BootNotificationRequest; -import eu.chargetime.ocpp.model.basic.types.BootReasonEnumType; -import eu.chargetime.ocpp.model.basic.types.ChargingStationType; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class BootNotificationRequestTest { - - @Mock ChargingStationType chargingStationStub; - - private BootNotificationRequest createSut() { - return new BootNotificationRequest(); - } - - @Test(expected = PropertyConstraintException.class) - public void setReason_null_ThrowsPropertyConstraintException() { - BootNotificationRequest sut = createSut(); - sut.setReason(null); - } - - @Test - public void validate_nothingsSet_returnsFalse() { - boolean expected = false; - BootNotificationRequest sut = createSut(); - boolean result = sut.validate(); - assertEquals(expected, result); - } - - @Test - public void validate_reasonAndChargingStationSet_returnsTrue() { - boolean expected = true; - BootNotificationRequest sut = createSut(); - sut.setReason(BootReasonEnumType.ApplicationReset); - when(chargingStationStub.validate()).thenReturn(true); - sut.setChargingStation(chargingStationStub); - - boolean result = sut.validate(); - - assertEquals(expected, result); - } -} diff --git a/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/test/SetVariablesRequestTest.java b/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/test/SetVariablesRequestTest.java deleted file mode 100644 index 393ff36ba..000000000 --- a/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/test/SetVariablesRequestTest.java +++ /dev/null @@ -1,70 +0,0 @@ -package eu.chargetime.ocpp.model.basic.test; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import static eu.chargetime.ocpp.utilities.TestUtilities.aList; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import eu.chargetime.ocpp.PropertyConstraintException; -import eu.chargetime.ocpp.model.basic.SetVariablesRequest; -import eu.chargetime.ocpp.model.basic.types.SetVariableDataType; -import org.junit.Assert; -import org.junit.Test; - -public class SetVariablesRequestTest { - - @Test(expected = PropertyConstraintException.class) - public void setSetVariableData_Null_ThrowsPropertyConstraintException() { - SetVariablesRequest sut = new SetVariablesRequest(); - - sut.setSetVariableData(null); - } - - @Test - public void validate_default_returnsFalse() { - boolean expected = false; - SetVariablesRequest sut = new SetVariablesRequest(); - - boolean result = sut.validate(); - - Assert.assertEquals(expected, result); - } - - @Test - public void validate_SetVariableDataIsSet_returnsTrue() { - boolean expected = true; - SetVariableDataType setVariableDataTypeStub = mock(SetVariableDataType.class); - when(setVariableDataTypeStub.validate()).thenReturn(true); - - SetVariablesRequest sut = new SetVariablesRequest(); - sut.setSetVariableData(aList(setVariableDataTypeStub)); - - boolean result = sut.validate(); - - Assert.assertEquals(expected, result); - } -} diff --git a/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/test/StatusNotificationRequestTest.java b/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/test/StatusNotificationRequestTest.java deleted file mode 100644 index f0c281d1a..000000000 --- a/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/test/StatusNotificationRequestTest.java +++ /dev/null @@ -1,89 +0,0 @@ -package eu.chargetime.ocpp.model.basic.test; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2021 John Michael Luy - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.PropertyConstraintException; -import eu.chargetime.ocpp.model.basic.StatusNotificationRequest; -import eu.chargetime.ocpp.model.basic.types.ConnectorStatusEnumType; -import java.time.ZonedDateTime; -import org.junit.Assert; -import org.junit.Test; - -public class StatusNotificationRequestTest { - - @Test(expected = PropertyConstraintException.class) - public void setTimestamp_null_throwsPropertyConstraintException() { - StatusNotificationRequest sut = new StatusNotificationRequest(); - - sut.setTimestamp(null); - } - - @Test(expected = PropertyConstraintException.class) - public void setConnectorStatus_null_throwsPropertyConstraintException() { - StatusNotificationRequest sut = new StatusNotificationRequest(); - - sut.setConnectorStatus(null); - } - - @Test(expected = PropertyConstraintException.class) - public void setEvseId_null_throwsPropertyConstraintException() { - StatusNotificationRequest sut = new StatusNotificationRequest(); - - sut.setEvseId(null); - } - - @Test(expected = PropertyConstraintException.class) - public void setConnectorId_null_throwsPropertyConstraintException() { - StatusNotificationRequest sut = new StatusNotificationRequest(); - - sut.setConnectorId(null); - } - - @Test - public void validate_nothingIsSet_returnsFalse() { - boolean expected = false; - StatusNotificationRequest sut = new StatusNotificationRequest(); - - boolean result = sut.validate(); - - Assert.assertEquals(expected, result); - } - - @Test - public void validate_dataIsSet_returnsTrue() { - boolean expected = true; - - StatusNotificationRequest sut = new StatusNotificationRequest(); - sut.setTimestamp(ZonedDateTime.now()); - sut.setConnectorStatus(ConnectorStatusEnumType.Available); - sut.setEvseId(1); - sut.setConnectorId(1); - - boolean result = sut.validate(); - - Assert.assertEquals(expected, result); - } -} diff --git a/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/types/ComponentTypeTest.java b/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/types/ComponentTypeTest.java deleted file mode 100644 index cf89cf750..000000000 --- a/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/types/ComponentTypeTest.java +++ /dev/null @@ -1,78 +0,0 @@ -package eu.chargetime.ocpp.model.basic.types; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import static eu.chargetime.ocpp.utilities.TestUtilities.aString; - -import eu.chargetime.ocpp.PropertyConstraintException; -import org.junit.Assert; -import org.junit.Test; - -public class ComponentTypeTest { - - @Test(expected = PropertyConstraintException.class) - public void setName_Null_throwsPropertyConstraintException() { - VariableType sut = new VariableType(); - - sut.setName(null); - } - - @Test(expected = PropertyConstraintException.class) - public void setName_StringExceeds50_throwsPropertyConstraintException() { - String bitString = aString(51); - VariableType sut = new VariableType(); - - sut.setName(bitString); - } - - @Test - public void setName_StringIs50_nameIsSaved() { - String aString = aString(50); - VariableType sut = new VariableType(); - - sut.setName(aString); - - Assert.assertEquals(aString, sut.getName()); - } - - @Test(expected = PropertyConstraintException.class) - public void setInstance_StringExceeds50_throwsPropertyConstraintException() { - String bitString = aString(51); - VariableType sut = new VariableType(); - - sut.setInstance(bitString); - } - - @Test - public void setInstance_StringIs50_nameIsSaved() { - String aString = aString(50); - VariableType sut = new VariableType(); - - sut.setInstance(aString); - - Assert.assertEquals(aString, sut.getInstance()); - } -} diff --git a/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/types/test/ChargingStationTypeTest.java b/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/types/test/ChargingStationTypeTest.java deleted file mode 100644 index 05d2ed777..000000000 --- a/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/types/test/ChargingStationTypeTest.java +++ /dev/null @@ -1,107 +0,0 @@ -package eu.chargetime.ocpp.model.basic.types.test; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import static eu.chargetime.ocpp.utilities.TestUtilities.aString; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -import eu.chargetime.ocpp.PropertyConstraintException; -import eu.chargetime.ocpp.model.basic.types.ChargingStationType; -import eu.chargetime.ocpp.model.basic.types.ModemType; -import org.junit.Test; - -public class ChargingStationTypeTest { - - private ChargingStationType createSut() { - return new ChargingStationType(); - } - - @Test - public void validate_nothingsSet_returnsFalse() { - boolean expected = false; - ChargingStationType sut = createSut(); - - boolean result = sut.validate(); - - assertEquals(expected, result); - } - - @Test(expected = PropertyConstraintException.class) - public void setFirmwareVersion_above50Chars_throwsPropertyConstraintException() { - String longString = aString(51); - ChargingStationType sut = createSut(); - sut.setFirmwareVersion(longString); - } - - @Test(expected = PropertyConstraintException.class) - public void setVendorName_above50Chars_throwsPropertyConstraintException() { - String longString = aString(51); - ChargingStationType sut = createSut(); - sut.setVendorName(longString); - } - - @Test(expected = PropertyConstraintException.class) - public void setModel_above20Chars_throwsPropertyConstraintException() { - String longString = aString(21); - ChargingStationType sut = createSut(); - sut.setModel(longString); - } - - @Test(expected = PropertyConstraintException.class) - public void setSerialNumber_above20Chars_throwsPropertyConstraintException() { - String longString = aString(21); - ChargingStationType sut = createSut(); - sut.setSerialNumber(longString); - } - - @Test - public void validate_modelAndVendorNameIsSet_returnTrue() { - boolean expected = true; - String someString = "test123"; - ChargingStationType sut = createSut(); - sut.setModel(someString); - sut.setVendorName(someString); - - boolean result = sut.validate(); - - assertEquals(expected, result); - } - - @Test - public void validate_modemSet_validateIsCalledOnModem() { - ChargingStationType sut = createSut(); - sut.setModel(aString(2)); - sut.setVendorName(aString(2)); - ModemType modemTypeMock = mock(ModemType.class); - sut.setModem(modemTypeMock); - - sut.validate(); - - verify(modemTypeMock).validate(); - } -} diff --git a/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/types/test/GetVariableResultTypeTest.java b/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/types/test/GetVariableResultTypeTest.java deleted file mode 100644 index b53962746..000000000 --- a/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/types/test/GetVariableResultTypeTest.java +++ /dev/null @@ -1,93 +0,0 @@ -package eu.chargetime.ocpp.model.basic.types.test; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import eu.chargetime.ocpp.model.basic.types.*; -import org.junit.Assert; -import org.junit.Test; - -public class GetVariableResultTypeTest { - - @Test - public void validate_default_returnsFalse() { - boolean expected = false; - GetVariableResultType sut = new GetVariableResultType(); - - boolean result = sut.validate(); - - Assert.assertEquals(expected, result); - } - - @Test - public void validate_requiredSetAndStatusNotAccepted_returnTrue() { - boolean expected = true; - GetVariableResultType sut = createSut(); - sut.setAttributeStatus(GetVariableStatusEnumType.Rejected); - - boolean result = sut.validate(); - - Assert.assertEquals(expected, result); - } - - @Test - public void validate_StatusAcceptedValueNull_returnFalse() { - boolean expected = false; - GetVariableResultType sut = createSut(); - sut.setAttributeStatus(GetVariableStatusEnumType.Accepted); - - boolean result = sut.validate(); - - Assert.assertEquals(expected, result); - } - - @Test - public void validate_StatusAcceptedValueSet_returnTrue() { - boolean expected = true; - GetVariableResultType sut = createSut(); - sut.setAttributeStatus(GetVariableStatusEnumType.Accepted); - sut.setAttributeValue("Some value"); - - boolean result = sut.validate(); - - Assert.assertEquals(expected, result); - } - - private GetVariableResultType createSut() { - ComponentType componentTypeStub = mock(ComponentType.class); - when(componentTypeStub.validate()).thenReturn(true); - VariableType variableTypeStub = mock(VariableType.class); - when(variableTypeStub.validate()).thenReturn(true); - - GetVariableResultType sut = new GetVariableResultType(); - sut.setComponent(componentTypeStub); - sut.setVariable(variableTypeStub); - - return sut; - } -} diff --git a/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/types/test/SetVariableDataTypeTest.java b/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/types/test/SetVariableDataTypeTest.java deleted file mode 100644 index 0bb8351cc..000000000 --- a/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/types/test/SetVariableDataTypeTest.java +++ /dev/null @@ -1,75 +0,0 @@ -package eu.chargetime.ocpp.model.basic.types.test; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import static eu.chargetime.ocpp.utilities.TestUtilities.aString; - -import eu.chargetime.ocpp.PropertyConstraintException; -import eu.chargetime.ocpp.model.basic.types.SetVariableDataType; -import org.junit.Assert; -import org.junit.Test; - -public class SetVariableDataTypeTest { - - @Test(expected = PropertyConstraintException.class) - public void setAttributeValue_Null_throwsPropertyConstraintException() { - SetVariableDataType sut = new SetVariableDataType(); - - sut.setAttributeValue(null); - } - - @Test(expected = PropertyConstraintException.class) - public void setAttributeValue_StringExceeds1000_throwsPropertyConstraintException() { - String bigString = aString(1001); - SetVariableDataType sut = new SetVariableDataType(); - - sut.setAttributeValue(bigString); - } - - @Test - public void setAttributeValue_StringSubceeds1000_safesAttributeValue() { - String string = aString(1000); - SetVariableDataType sut = new SetVariableDataType(); - - sut.setAttributeValue(string); - - Assert.assertEquals(string, sut.getAttributeValue()); - } - - @Test(expected = PropertyConstraintException.class) - public void setComponent_Null_throwsPropertyConstraintException() { - SetVariableDataType sut = new SetVariableDataType(); - - sut.setComponent(null); - } - - @Test(expected = PropertyConstraintException.class) - public void setVariable_Null_throwsPropertyConstraintException() { - SetVariableDataType sut = new SetVariableDataType(); - - sut.setVariable(null); - } -} diff --git a/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/types/test/VariableTypeTest.java b/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/types/test/VariableTypeTest.java deleted file mode 100644 index f0b9bf6c7..000000000 --- a/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/types/test/VariableTypeTest.java +++ /dev/null @@ -1,79 +0,0 @@ -package eu.chargetime.ocpp.model.basic.types.test; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import static eu.chargetime.ocpp.utilities.TestUtilities.aString; - -import eu.chargetime.ocpp.PropertyConstraintException; -import eu.chargetime.ocpp.model.basic.types.VariableType; -import org.junit.Assert; -import org.junit.Test; - -public class VariableTypeTest { - - @Test(expected = PropertyConstraintException.class) - public void setName_Null_throwsPropertyConstraintException() { - VariableType sut = new VariableType(); - - sut.setName(null); - } - - @Test(expected = PropertyConstraintException.class) - public void setName_StringExceeds50_throwsPropertyConstraintException() { - String bitString = aString(51); - VariableType sut = new VariableType(); - - sut.setName(bitString); - } - - @Test - public void setName_StringIs50_nameIsSaved() { - String aString = aString(50); - VariableType sut = new VariableType(); - - sut.setName(aString); - - Assert.assertEquals(aString, sut.getName()); - } - - @Test(expected = PropertyConstraintException.class) - public void setInstance_StringExceeds50_throwsPropertyConstraintException() { - String bitString = aString(51); - VariableType sut = new VariableType(); - - sut.setInstance(bitString); - } - - @Test - public void setInstance_StringIs50_nameIsSaved() { - String aString = aString(50); - VariableType sut = new VariableType(); - - sut.setInstance(aString); - - Assert.assertEquals(aString, sut.getInstance()); - } -} diff --git a/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/validation/test/IdentifierStringValidationRuleTest.java b/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/validation/test/IdentifierStringValidationRuleTest.java deleted file mode 100644 index 65589542d..000000000 --- a/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/validation/test/IdentifierStringValidationRuleTest.java +++ /dev/null @@ -1,51 +0,0 @@ -package eu.chargetime.ocpp.model.validation.test; -/* - ChargeTime.eu - Java-OCA-OCPP - - MIT License - - Copyright (C) 2018 Thomas Volden - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -import eu.chargetime.ocpp.PropertyConstraintException; -import eu.chargetime.ocpp.model.validation.IdentifierStringValidationRule; -import org.junit.Test; - -public class IdentifierStringValidationRuleTest { - - private IdentifierStringValidationRule createSut() { - return new IdentifierStringValidationRule(); - } - - @Test - public void validate_legalString_nothingHappens() { - String legalString = "abc123ABC_"; - IdentifierStringValidationRule sut = createSut(); - sut.validate(legalString); - } - - @Test(expected = PropertyConstraintException.class) - public void validate_illegalString_throwsException() { - String legalString = "a%c1$3A!C"; - IdentifierStringValidationRule sut = createSut(); - sut.validate(legalString); - } -} diff --git a/pom.xml b/pom.xml index 5cef24eb0..a98a7a295 100644 --- a/pom.xml +++ b/pom.xml @@ -40,8 +40,6 @@ OCPP-J ocpp-v1_6 ocpp-v1_6-test - ocpp-v2_0 - ocpp-v2_0-test ocpp-v2 ocpp-v2-test diff --git a/settings.gradle b/settings.gradle index d406ec038..8cc617507 100644 --- a/settings.gradle +++ b/settings.gradle @@ -8,10 +8,6 @@ project(':common').projectDir = file('ocpp-common') include(':OCPP-J') include(':ocpp-v2') include(':ocpp-v2-test') -include(':v2_0') -include(':v2_0-test') -project(':v2_0').projectDir = file('ocpp-v2_0') -project(':v2_0-test').projectDir = file('ocpp-v2_0-test') include(':v1_6') include(':v1_6-test') project(':v1_6').projectDir = file('ocpp-v1_6')