|
1 | | -package eu.chargetime.ocpp.test.core |
| 1 | +package eu.chargetime.ocpp.test.core.json |
2 | 2 |
|
3 | 3 | import eu.chargetime.ocpp.test.FakeCentralSystem |
4 | 4 | import eu.chargetime.ocpp.test.FakeChargePoint |
5 | 5 | import spock.lang.Shared |
6 | 6 | import spock.lang.Specification |
7 | 7 | import spock.util.concurrent.PollingConditions |
8 | 8 |
|
9 | | -class DataTransferSpec extends Specification |
| 9 | +class JSONDataTransferSpec extends Specification |
10 | 10 | { |
11 | 11 | @Shared |
12 | | - FakeCentralSystem centralSystem = FakeCentralSystem.getInstance(); |
13 | | - @Shared FakeChargePoint chargePoint = new FakeChargePoint(); |
| 12 | + FakeCentralSystem centralSystem = FakeCentralSystem.getInstance() |
| 13 | + @Shared |
| 14 | + FakeChargePoint chargePoint = new FakeChargePoint() |
14 | 15 |
|
15 | 16 | def setupSpec() { |
16 | 17 | // When a Central System is running |
17 | | - centralSystem.started(); |
| 18 | + centralSystem.started() |
18 | 19 | } |
19 | 20 |
|
20 | 21 | def setup() { |
21 | | - chargePoint.connect(); |
| 22 | + chargePoint.connect() |
22 | 23 | } |
23 | 24 |
|
24 | 25 | def cleanup() { |
25 | | - chargePoint.disconnect(); |
| 26 | + chargePoint.disconnect() |
26 | 27 | } |
27 | 28 |
|
28 | 29 | def "Central System sends a DataTransfer request and receives a response"() { |
29 | 30 | def conditions = new PollingConditions(timeout: 1) |
30 | 31 |
|
31 | 32 | when: |
32 | | - centralSystem.sendDataTransferRequest("VendorId", "messageId", "data"); |
| 33 | + centralSystem.sendDataTransferRequest("VendorId", "messageId", "data") |
33 | 34 |
|
34 | 35 | then: |
35 | 36 | conditions.eventually { |
36 | | - assert chargePoint.hasHandledDataTransferRequest(); |
37 | | - assert centralSystem.hasReceivedDataTransferConfirmation(); |
| 37 | + assert chargePoint.hasHandledDataTransferRequest() |
| 38 | + assert centralSystem.hasReceivedDataTransferConfirmation() |
38 | 39 | } |
39 | 40 | } |
40 | 41 |
|
41 | 42 | def "Charge point sends a DataTransfer request and receives a response"() { |
42 | 43 | def conditions = new PollingConditions(timeout: 1) |
43 | 44 |
|
44 | 45 | when: |
45 | | - chargePoint.sendDataTransferRequest("VendorId", "messageId", "data"); |
| 46 | + chargePoint.sendDataTransferRequest("VendorId", "messageId", "data") |
46 | 47 |
|
47 | 48 | then: |
48 | 49 | conditions.eventually { |
49 | | - assert centralSystem.hasHandledDataTransferRequest(); |
| 50 | + assert centralSystem.hasHandledDataTransferRequest() |
50 | 51 | } |
51 | 52 |
|
52 | 53 | then: |
53 | 54 | conditions.eventually { |
54 | | - assert chargePoint.hasReceivedDataTransferConfirmation("Accepted"); |
| 55 | + assert chargePoint.hasReceivedDataTransferConfirmation("Accepted") |
55 | 56 | } |
56 | 57 | } |
57 | 58 | } |
0 commit comments