|
1 | 1 | Dear Spring community, |
2 | 2 |
|
3 | | -I'm pleased to announce that Spring Web Services 2.0 Milestone 1 has been |
| 3 | +I'm pleased to announce that Spring Web Services 2.0 Milestone 3 has been |
4 | 4 | released! |
5 | 5 |
|
6 | | -This is the first milestone release in the 2.0 release cycle. It does not |
7 | | -introduce any new features (yet), but does add the following: |
| 6 | +This is the third milestone release in the 2.0 release cycle. The most |
| 7 | +important new feature in this release is inclusion of a client-side |
| 8 | +Web service testing framework. This testing framework is very similar to |
| 9 | +EasyMock 2, offering a 'fluent' API for all you testing needs! |
| 10 | +For example: |
8 | 11 |
|
9 | | -- Usage of Spring's OXM |
10 | | -- Java 5 API (including generics, varargs, etc) |
| 12 | +import org.junit.Before; |
| 13 | +import org.junit.Test; |
| 14 | +import org.junit.runner.RunWith; |
| 15 | +import org.springframework.beans.factory.annotation.Autowired; |
| 16 | +import org.springframework.test.context.ContextConfiguration; |
| 17 | +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
| 18 | +import org.springframework.xml.transform.StringSource; |
| 19 | +import static org.springframework.ws.mock.client.WebServiceMock.*; |
11 | 20 |
|
12 | | -Please see the changelog for details. |
13 | 21 |
|
14 | | -Spring Web Services 2.0 is due in the second quarter of 2010. |
| 22 | +@RunWith(SpringJUnit4ClassRunner.class) |
| 23 | +@ContextConfiguration("applicationContext.xml") |
| 24 | +public class IntegrationTest { |
| 25 | + |
| 26 | + // AirlineClient extends WebServiceGatewaySupport, and is configured in applicationContext.xml |
| 27 | + @Autowired |
| 28 | + private MyWebServiceClient client; |
| 29 | + |
| 30 | + @Before |
| 31 | + public void setUpMocks() throws Exception { |
| 32 | + mockWebServiceTemplate(client.getWebServiceTemplate()); |
| 33 | + } |
| 34 | + |
| 35 | + @Test |
| 36 | + public void getCustomerCount() throws Exception { |
| 37 | + Source requestPayload = |
| 38 | + new StringSource("<customerCountRequest xmlns='http://springframework.org/spring-ws/test' />"; |
| 39 | + Source responsePayload = new StringSource("<customerCountResponse xmlns='http://springframework.org/spring-wstest'>" + |
| 40 | + "<customerCount>10</customerCount>" + |
| 41 | + "</customerCountResponse>"); |
| 42 | + |
| 43 | + expect(payload(requestPayload)).andRespond(withPayload(responsePayload)); |
| 44 | + |
| 45 | + // client.getCustomerCount() uses the WebServiceTemplate |
| 46 | + int customerCount = client.getCustomerCount(); |
| 47 | + assertEquals(10, response.getCustomerCount()); |
| 48 | + |
| 49 | + verifyConnections(); |
| 50 | + } |
| 51 | +} |
| 52 | + |
| 53 | +The WebServiceMock API has a lot more features than I can describe here, |
| 54 | +I suggest you try out the new testing module today! Please leave feedback |
| 55 | +through JIRA or on the forums. |
| 56 | + |
| 57 | +Many thanks to Lukáš Křečan for helping out with this testing framework. It |
| 58 | +would not have been possible without him. |
| 59 | + |
| 60 | +Please see the changelog for more details. |
| 61 | + |
| 62 | +Spring Web Services 2.0 is due in the third quarter of 2010. |
15 | 63 |
|
16 | 64 | For more information, see http://static.springframework.org/spring-ws/site/ |
0 commit comments