Skip to content

Commit 93a23cc

Browse files
committed
update ApplicationTest to contain ocpp 1.6
1 parent b6bd18c commit 93a23cc

1 file changed

Lines changed: 56 additions & 25 deletions

File tree

src/test/java/de/rwth/idsg/steve/ApplicationTest.java

Lines changed: 56 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
import ocpp.cs._2010._08.AuthorizeResponse;
77
import ocpp.cs._2010._08.BootNotificationRequest;
88
import ocpp.cs._2010._08.BootNotificationResponse;
9+
import ocpp.cs._2012._06.CentralSystemService;
910
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
1011
import org.apache.cxf.ws.addressing.WSAddressingFeature;
1112
import org.junit.Assert;
13+
import org.junit.BeforeClass;
1214
import org.junit.Ignore;
1315
import org.junit.Test;
1416

@@ -27,48 +29,71 @@ public class ApplicationTest {
2729

2830
private static final String path = getPath();
2931

30-
/**
31-
* Tests that the SOAP code paths are working.
32-
*/
32+
@BeforeClass
33+
public static void init() throws Exception {
34+
Application app = new Application();
35+
app.start();
36+
}
37+
3338
@Test
34-
public void testSoapPipeline() throws Exception {
35-
startApp();
39+
public void testOcpp12() {
40+
ocpp.cs._2010._08.CentralSystemService client = getForOcpp12();
3641

37-
BootNotificationResponse boot12 = getForOcpp12().bootNotification(
42+
BootNotificationResponse boot = client.bootNotification(
3843
new BootNotificationRequest()
3944
.withChargePointVendor(getRandomString())
4045
.withChargePointModel(getRandomString()),
4146
getRandomString());
42-
Assert.assertNotNull(boot12);
43-
Assert.assertEquals(ocpp.cs._2010._08.RegistrationStatus.REJECTED, boot12.getStatus());
47+
Assert.assertNotNull(boot);
48+
Assert.assertEquals(ocpp.cs._2010._08.RegistrationStatus.REJECTED, boot.getStatus());
4449

45-
ocpp.cs._2012._06.BootNotificationResponse boot15 = getForOcpp15().bootNotification(
50+
AuthorizeResponse auth = client.authorize(
51+
new AuthorizeRequest()
52+
.withIdTag(getRandomString()),
53+
getRandomString());
54+
Assert.assertNotNull(auth);
55+
Assert.assertEquals(AuthorizationStatus.INVALID, auth.getIdTagInfo().getStatus());
56+
}
57+
58+
@Test
59+
public void testOcpp15() {
60+
CentralSystemService client = getForOcpp15();
61+
62+
ocpp.cs._2012._06.BootNotificationResponse boot = client.bootNotification(
4663
new ocpp.cs._2012._06.BootNotificationRequest()
4764
.withChargePointVendor(getRandomString())
4865
.withChargePointModel(getRandomString()),
4966
getRandomString());
50-
Assert.assertNotNull(boot15);
51-
Assert.assertEquals(ocpp.cs._2012._06.RegistrationStatus.REJECTED, boot15.getStatus());
52-
53-
AuthorizeResponse auth12 = getForOcpp12().authorize(
54-
new AuthorizeRequest()
55-
.withIdTag(getRandomString()),
56-
getRandomString());
57-
Assert.assertNotNull(auth12);
58-
Assert.assertEquals(AuthorizationStatus.INVALID, auth12.getIdTagInfo().getStatus());
67+
Assert.assertNotNull(boot);
68+
Assert.assertEquals(ocpp.cs._2012._06.RegistrationStatus.REJECTED, boot.getStatus());
5969

60-
ocpp.cs._2012._06.AuthorizeResponse auth15 = getForOcpp15().authorize(
70+
ocpp.cs._2012._06.AuthorizeResponse auth = client.authorize(
6171
new ocpp.cs._2012._06.AuthorizeRequest()
6272
.withIdTag(getRandomString()),
6373
getRandomString());
64-
Assert.assertNotNull(auth15);
65-
Assert.assertEquals(ocpp.cs._2012._06.AuthorizationStatus.INVALID, auth15.getIdTagInfo().getStatus());
74+
Assert.assertNotNull(auth);
75+
Assert.assertEquals(ocpp.cs._2012._06.AuthorizationStatus.INVALID, auth.getIdTagInfo().getStatus());
6676
}
6777

68-
private Application startApp() throws Exception {
69-
Application app = new Application();
70-
app.start();
71-
return app;
78+
79+
@Test
80+
public void testOcpp16() {
81+
ocpp.cs._2015._10.CentralSystemService client = getForOcpp16();
82+
83+
ocpp.cs._2015._10.BootNotificationResponse boot = client.bootNotification(
84+
new ocpp.cs._2015._10.BootNotificationRequest()
85+
.withChargePointVendor(getRandomString())
86+
.withChargePointModel(getRandomString()),
87+
getRandomString());
88+
Assert.assertNotNull(boot);
89+
Assert.assertEquals(ocpp.cs._2015._10.RegistrationStatus.REJECTED, boot.getStatus());
90+
91+
ocpp.cs._2015._10.AuthorizeResponse auth = client.authorize(
92+
new ocpp.cs._2015._10.AuthorizeRequest()
93+
.withIdTag(getRandomString()),
94+
getRandomString());
95+
Assert.assertNotNull(auth);
96+
Assert.assertEquals(ocpp.cs._2015._10.AuthorizationStatus.INVALID, auth.getIdTagInfo().getStatus());
7297
}
7398

7499
private static String getRandomString() {
@@ -93,6 +118,12 @@ private static String getPath() {
93118
}
94119
}
95120

121+
private static ocpp.cs._2015._10.CentralSystemService getForOcpp16() {
122+
JaxWsProxyFactoryBean f = getBean(path);
123+
f.setServiceClass(ocpp.cs._2015._10.CentralSystemService.class);
124+
return (ocpp.cs._2015._10.CentralSystemService) f.create();
125+
}
126+
96127
private static ocpp.cs._2012._06.CentralSystemService getForOcpp15() {
97128
JaxWsProxyFactoryBean f = getBean(path);
98129
f.setServiceClass(ocpp.cs._2012._06.CentralSystemService.class);

0 commit comments

Comments
 (0)