Skip to content

Commit bbfe957

Browse files
committed
adding schema
1 parent 11bd420 commit bbfe957

File tree

4 files changed

+56
-4
lines changed

4 files changed

+56
-4
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"data" : {
3+
"pairs" : [ {
4+
"request" : {
5+
"path" : [ {
6+
"matcher" : "exact",
7+
"value" : "/passengers/login/walker"
8+
} ],
9+
"method" : [ {
10+
"matcher" : "exact",
11+
"value" : "GET"
12+
} ],
13+
"destination" : [ {
14+
"matcher" : "exact",
15+
"value" : "passenger-management:80"
16+
} ],
17+
"scheme" : [ {
18+
"matcher" : "exact",
19+
"value" : "http"
20+
} ],
21+
"body" : [ {
22+
"matcher" : "exact",
23+
"value" : ""
24+
} ]
25+
},
26+
"response" : {
27+
"status" : 200,
28+
"body" : "{\"id\":1,\"name\":\"Paul Walker\",\"login\":\"walker\",\"phoneNo\":\"550660770\",\"balance\":1000,\"homeLocationX\":40,\"homeLocationY\":20,\"discount\":0}",
29+
"encodedBody" : false,
30+
"templated" : false,
31+
"headers" : {
32+
"Content-Length" : [ "134" ],
33+
"Content-Type" : [ "application/json;charset=UTF-8" ],
34+
"Date" : [ "Tue, 04 Sep 2018 20:58:24 GMT" ],
35+
"Hoverfly" : [ "Was-Here" ]
36+
}
37+
}
38+
} ],
39+
"globalActions" : {
40+
"delays" : [ ]
41+
}
42+
},
43+
"meta" : {
44+
"schemaVersion" : "v5",
45+
"hoverflyVersion" : "v0.17.1",
46+
"timeExported" : "2018-09-04T22:58:24+02:00"
47+
}
48+
}

trip-management/src/test/java/pl/piomin/services/trip/TripComponentTests.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import com.fasterxml.jackson.core.JsonProcessingException;
44
import com.fasterxml.jackson.databind.ObjectMapper;
5+
import io.specto.hoverfly.junit.api.HoverflyClient;
6+
import io.specto.hoverfly.junit.core.HoverflyConfig;
57
import io.specto.hoverfly.junit.core.SimulationSource;
68
import io.specto.hoverfly.junit.dsl.HoverflyDsl;
79
import io.specto.hoverfly.junit.dsl.HttpBodyConverter;
@@ -57,7 +59,7 @@ public class TripComponentTests {
5759
.willReturn(ResponseCreators.success(HttpBodyConverter.jsonWithSingleQuotes("{'id':1,'name':'David Smith','currentLocationX': 15,'currentLocationY':25}")))
5860
.put(HoverflyMatchers.startsWith("/drivers")).anyBody()
5961
.willReturn(ResponseCreators.success(HttpBodyConverter.jsonWithSingleQuotes("{'id':1,'name':'David Smith','currentLocationX': 15,'currentLocationY':25}")))
60-
)).printSimulationData();
62+
), HoverflyConfig.remoteConfigs().host("192.168.99.100").adminPort(8888)).printSimulationData();
6163

6264
@Test
6365
public void test1CreateNewTrip() throws Exception {

trip-management/src/test/java/pl/piomin/services/trip/TripDiffIntegrationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class TripDiffIntegrationTests {
4949
hoverflyRule = HoverflyRule.inDiffMode(SimulationSource.dsl(
5050
HoverflyDsl.service(HoverflyMatchers.startsWith(InetAddress.getLocalHost().getHostName()))
5151
.get(HoverflyMatchers.startsWith("/passengers/"))
52-
.willReturn(ResponseCreators.success(HttpBodyConverter.jsonWithSingleQuotes("{'id':1,'name':'John Smith','login':'{{ Request.Path.[2] }}'}")).header("Content-Type", "application/json;charset=UTF-8")),
52+
.willReturn(ResponseCreators.success(HttpBodyConverter.jsonWithSingleQuotes("{'id':1,'name':'Paul Walker','login':'{{ Request.Path.[2] }}'}")).header("Content-Type", "application/json;charset=UTF-8")),
5353
HoverflyDsl.service(HoverflyMatchers.startsWith(InetAddress.getLocalHost().getHostName()))
5454
.get(HoverflyMatchers.startsWith("/drivers/"))
5555
.willReturn(ResponseCreators.success(HttpBodyConverter.jsonWithSingleQuotes("{'id':1,'name':'David Smith','currentLocationX': 15,'currentLocationY':25}")))

trip-management/src/test/java/pl/piomin/services/trip/TripHoverflyIntegrationTests.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package pl.piomin.services.trip;
22

3+
import io.specto.hoverfly.junit.api.HoverflyClient;
4+
import io.specto.hoverfly.junit.core.HoverflyConfig;
35
import io.specto.hoverfly.junit.core.SimulationSource;
46
import io.specto.hoverfly.junit.rule.HoverflyRule;
57
import org.junit.ClassRule;
@@ -24,13 +26,13 @@ public class TripHoverflyIntegrationTests {
2426

2527
@ClassRule
2628
public static HoverflyRule hoverflyRule = HoverflyRule
27-
.inCaptureOrSimulationMode("passenger-management.json")
29+
.inCaptureMode("passenger-management.json")
2830
// .inSpyMode(SimulationSource.file(Paths.get("src/test/resources/hoverfly","passenger-management.json")))
2931
.printSimulationData();
3032

3133
@Test
3234
public void testGetPassengerByLogin() {
33-
final String login = "walker2";
35+
final String login = "walker";
3436
Passenger passenger = passengerManagementClient.getPassenger(login);
3537
Assert.notNull(passenger, "No passenger");
3638
Assert.notNull(passenger.getId(), "No passenger id");

0 commit comments

Comments
 (0)