From 8e3525bede66dc112e47512dd2b7ad4560a9a4c8 Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Wed, 3 Nov 2010 14:06:10 +0000 Subject: [PATCH] Updating airline client to use new API --- .../airline/client/sws/GetFlightsTest.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/samples/airline/client/spring-ws/src/test/java/org/springframework/ws/samples/airline/client/sws/GetFlightsTest.java b/samples/airline/client/spring-ws/src/test/java/org/springframework/ws/samples/airline/client/sws/GetFlightsTest.java index eb1df7d0..39eff19d 100644 --- a/samples/airline/client/spring-ws/src/test/java/org/springframework/ws/samples/airline/client/sws/GetFlightsTest.java +++ b/samples/airline/client/spring-ws/src/test/java/org/springframework/ws/samples/airline/client/sws/GetFlightsTest.java @@ -29,7 +29,10 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import static org.springframework.ws.test.client.WebServiceMock.*; +import org.springframework.ws.test.client.MockWebServiceServer; +import static org.springframework.ws.test.client.RequestMatchers.*; +import static org.springframework.ws.test.client.ResponseCreators.*; + /** * This test illustrates the use of the client-side testing API, introduced in Spring-WS 2.0. @@ -42,6 +45,8 @@ public class GetFlightsTest { @Autowired GetFlights getFlights; + + private MockWebServiceServer mockServer; private static final String MESSAGES_NS = "http://www.springframework.org/spring-ws/samples/airline/schemas/messages"; @@ -50,7 +55,7 @@ public class GetFlightsTest { @Before public void setUpMocks() throws Exception { - mockWebServiceTemplate(getFlights.getWebServiceTemplate()); + mockServer = MockWebServiceServer.createServer(getFlights); } @Test @@ -70,7 +75,7 @@ public class GetFlightsTest { "" + "" + flightInfo + "" + ""); - expect(payload(getFlightsRequest)).andRespond(withPayload(getFlightsResponse)); + mockServer.expect(payload(getFlightsRequest)).andRespond(withPayload(getFlightsResponse)); Source bookFlightResponse = new StringSource( "" + "4" + @@ -80,14 +85,14 @@ public class GetFlightsTest { Map namespaces = Collections.singletonMap("m", MESSAGES_NS); - expect(xpath("/m:BookFlightRequest/m:flightNumber", namespaces).exists()) + mockServer.expect(xpath("/m:BookFlightRequest/m:flightNumber", namespaces).exists()) .andExpect(xpath("/m:BookFlightRequest/m:departureTime", namespaces).exists()) .andExpect(xpath("/m:BookFlightRequest/m:passengers", namespaces).exists()) .andRespond(withPayload(bookFlightResponse)); getFlights.getFlights(); - verifyConnections(); + mockServer.verify(); }