Skip to content

Commit 309a905

Browse files
committed
Removed unnecessary handlers.
1 parent 1c3f8ae commit 309a905

File tree

7 files changed

+24
-114
lines changed

7 files changed

+24
-114
lines changed

ocpp-v1_6-test/src/main/java/eu/chargetime/ocpp/test/FakeCentralSystem.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package eu.chargetime.ocpp.test;
22

33
import eu.chargetime.ocpp.*;
4-
import eu.chargetime.ocpp.feature.profile.*;
4+
import eu.chargetime.ocpp.feature.profile.ServerCoreEventHandler;
5+
import eu.chargetime.ocpp.feature.profile.ServerCoreProfile;
6+
import eu.chargetime.ocpp.feature.profile.ServerRemoteTriggerProfile;
7+
import eu.chargetime.ocpp.feature.profile.ServerSmartChargingProfile;
58
import eu.chargetime.ocpp.model.Confirmation;
69
import eu.chargetime.ocpp.model.Request;
710
import eu.chargetime.ocpp.model.core.*;
@@ -37,8 +40,7 @@ of this software and associated documentation files (the "Software"), to deal
3740
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3841
SOFTWARE.
3942
*/
40-
public class FakeCentralSystem
41-
{
43+
public class FakeCentralSystem {
4244
private Request receivedRequest;
4345
private Confirmation receivedConfirmation;
4446
private Server server;
@@ -49,14 +51,15 @@ public class FakeCentralSystem
4951
private boolean isRigged;
5052
private String currentIdentifier;
5153

52-
public static FakeCentralSystem getInstance () {
54+
public static FakeCentralSystem getInstance() {
5355
if (instance == null)
5456
instance = new FakeCentralSystem();
5557

5658
return instance;
5759
}
5860

59-
private FakeCentralSystem() { }
61+
private FakeCentralSystem() {
62+
}
6063

6164
private <T extends Confirmation> T failurePoint(T confirmation) {
6265
if (isRigged) {
@@ -74,15 +77,13 @@ public void clientLost() {
7477
server.closeSession(currentSessionIndex);
7578
}
7679

77-
public enum serverType {JSON, SOAP}
80+
public enum serverType {JSON, SOAP;}
7881

79-
public void started() throws Exception
80-
{
82+
public void started() throws Exception {
8183
started(serverType.JSON);
8284
}
8385

84-
private boolean matchServerType(serverType type)
85-
{
86+
private boolean matchServerType(serverType type) {
8687
boolean result = false;
8788
switch (type) {
8889
case JSON:
@@ -94,8 +95,7 @@ private boolean matchServerType(serverType type)
9495
return result;
9596
}
9697

97-
public void started(serverType type) throws Exception
98-
{
98+
public void started(serverType type) throws Exception {
9999
if (server != null) {
100100
if (matchServerType(type)) {
101101
return;
@@ -180,13 +180,9 @@ public StopTransactionConfirmation handleStopTransactionRequest(UUID sessionInde
180180
}
181181
});
182182

183-
ServerSmartChargingProfile smartChargingProfile = new ServerSmartChargingProfile(new ServerSmartChargingHandler() {
184-
185-
});
183+
ServerSmartChargingProfile smartChargingProfile = new ServerSmartChargingProfile();
186184

187-
ServerRemoteTriggerProfile remoteTriggerProfile = new ServerRemoteTriggerProfile(new ServerRemoteTriggerHandler() {
188-
189-
});
185+
ServerRemoteTriggerProfile remoteTriggerProfile = new ServerRemoteTriggerProfile();
190186

191187
int port = 0;
192188
switch (type) {
@@ -221,6 +217,10 @@ public void lostSession(UUID identity) {
221217
});
222218
}
223219

220+
public boolean hasReceivedGetDiagnosticsConfirmation() {
221+
return false;
222+
}
223+
224224
public boolean hasHandledAuthorizeRequest() {
225225
return receivedRequest instanceof AuthorizeRequest;
226226
}

ocpp-v1_6/src/main/java/eu/chargetime/ocpp/feature/profile/ServerRemoteTriggerHandler.java

Lines changed: 0 additions & 33 deletions
This file was deleted.

ocpp-v1_6/src/main/java/eu/chargetime/ocpp/feature/profile/ServerRemoteTriggerProfile.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,9 @@ of this software and associated documentation files (the "Software"), to deal
4040

4141
public class ServerRemoteTriggerProfile implements Profile {
4242

43-
private final ServerRemoteTriggerHandler handler;
4443
private HashSet<Feature> features;
4544

46-
public ServerRemoteTriggerProfile(ServerRemoteTriggerHandler handler) {
47-
this.handler = handler;
45+
public ServerRemoteTriggerProfile() {
4846

4947
features = new HashSet<>();
5048
features.add(new TriggerMessageFeature(this));

ocpp-v1_6/src/main/java/eu/chargetime/ocpp/feature/profile/ServerSmartChargingHandler.java

Lines changed: 0 additions & 40 deletions
This file was deleted.

ocpp-v1_6/src/main/java/eu/chargetime/ocpp/feature/profile/ServerSmartChargingProfile.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
package eu.chargetime.ocpp.feature.profile;
22

33
import eu.chargetime.ocpp.PropertyConstraintException;
4-
import eu.chargetime.ocpp.feature.*;
4+
import eu.chargetime.ocpp.feature.Feature;
5+
import eu.chargetime.ocpp.feature.SetChargingProfileFeature;
56
import eu.chargetime.ocpp.model.Confirmation;
67
import eu.chargetime.ocpp.model.Request;
78
import eu.chargetime.ocpp.model.core.ChargingProfile;
@@ -38,12 +39,9 @@
3839

3940
public class ServerSmartChargingProfile implements Profile {
4041

41-
private final ServerSmartChargingHandler handler;
4242
private HashSet<Feature> features;
4343

44-
public ServerSmartChargingProfile(ServerSmartChargingHandler handler) {
45-
this.handler = handler;
46-
44+
public ServerSmartChargingProfile() {
4745
features = new HashSet<>();
4846
features.add(new SetChargingProfileFeature(this));
4947
}

ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ServerRemoteTriggerProfileTest.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,17 @@
22

33
import eu.chargetime.ocpp.feature.Feature;
44
import eu.chargetime.ocpp.feature.TriggerMessageFeature;
5-
import eu.chargetime.ocpp.feature.profile.ServerRemoteTriggerHandler;
65
import eu.chargetime.ocpp.feature.profile.ServerRemoteTriggerProfile;
76
import eu.chargetime.ocpp.model.remotetrigger.TriggerMessageRequest;
87
import eu.chargetime.ocpp.model.remotetrigger.TriggerMessageRequestType;
98
import org.junit.Before;
109
import org.junit.Test;
1110
import org.junit.runner.RunWith;
12-
import org.mockito.Mock;
1311
import org.mockito.runners.MockitoJUnitRunner;
1412

1513
import static org.hamcrest.CoreMatchers.instanceOf;
1614
import static org.hamcrest.CoreMatchers.is;
1715
import static org.junit.Assert.assertThat;
18-
import static org.mockito.Mockito.mock;
1916

2017
/*
2118
* ChargeTime.eu - Java-OCA-OCPP
@@ -48,12 +45,9 @@ public class ServerRemoteTriggerProfileTest {
4845

4946
private ServerRemoteTriggerProfile profile;
5047

51-
@Mock
52-
private ServerRemoteTriggerHandler handler;
53-
5448
@Before
5549
public void setup() {
56-
profile = new ServerRemoteTriggerProfile(handler);
50+
profile = new ServerRemoteTriggerProfile();
5751
}
5852

5953
@Test

ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ServerSmartChargingProfileTest.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,17 @@
22

33
import eu.chargetime.ocpp.feature.Feature;
44
import eu.chargetime.ocpp.feature.SetChargingProfileFeature;
5-
import eu.chargetime.ocpp.feature.profile.ServerSmartChargingHandler;
65
import eu.chargetime.ocpp.feature.profile.ServerSmartChargingProfile;
76
import eu.chargetime.ocpp.model.core.*;
87
import eu.chargetime.ocpp.model.smartcharging.SetChargingProfileRequest;
98
import org.junit.Before;
109
import org.junit.Test;
1110
import org.junit.runner.RunWith;
12-
import org.mockito.Mock;
1311
import org.mockito.runners.MockitoJUnitRunner;
1412

1513
import static org.hamcrest.CoreMatchers.instanceOf;
1614
import static org.hamcrest.CoreMatchers.is;
1715
import static org.junit.Assert.assertThat;
18-
import static org.mockito.Matchers.eq;
19-
import static org.mockito.Mockito.mock;
2016

2117
/*
2218
* ChargeTime.eu - Java-OCA-OCPP
@@ -49,12 +45,9 @@ public class ServerSmartChargingProfileTest {
4945

5046
private ServerSmartChargingProfile smartCharging;
5147

52-
@Mock
53-
private ServerSmartChargingHandler handler;
54-
5548
@Before
5649
public void setup() {
57-
smartCharging = new ServerSmartChargingProfile(handler);
50+
smartCharging = new ServerSmartChargingProfile();
5851
}
5952

6053
@Test

0 commit comments

Comments
 (0)