javadoc
This commit is contained in:
@@ -54,6 +54,47 @@ import static org.springframework.ws.test.support.AssertionErrors.fail;
|
||||
* <p/>
|
||||
* For example:
|
||||
* <blockquote><pre>
|
||||
* import org.junit.*;
|
||||
* import org.springframework.beans.factory.annotation.Autowired;
|
||||
* import org.springframework.context.ApplicationContext;
|
||||
* import org.springframework.test.context.ContextConfiguration;
|
||||
* import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
* import org.springframework.xml.transform.StringSource;
|
||||
* <strong>import org.springframework.ws.test.server.MockWebServiceClient</strong>;
|
||||
* <strong>import static org.springframework.ws.test.server.RequestCreators.*</strong>;
|
||||
* <strong>import static org.springframework.ws.test.server.ResponseMatchers.*</strong>;
|
||||
*
|
||||
* @RunWith(SpringJUnit4ClassRunner.class)
|
||||
* @ContextConfiguration("applicationContext.xml")
|
||||
* public class MyWebServiceIntegrationTest {
|
||||
*
|
||||
* // a standard MessageDispatcherServlet application context, containing endpoints, mappings, etc.
|
||||
* @Autowired
|
||||
* private ApplicationContext applicationContext;
|
||||
*
|
||||
* private MockWebServiceClient mockClient;
|
||||
*
|
||||
* @Before
|
||||
* public void createClient() throws Exception {
|
||||
* <strong>mockClient = MockWebServiceClient.createClient(applicationContext)</strong>;
|
||||
* }
|
||||
*
|
||||
* // test the CustomerCountEndpoint, which is wired up in the application context above
|
||||
* // and handles <customerCount/> messages
|
||||
* @Test
|
||||
* public void customerCountEndpoint() throws Exception {
|
||||
* Source requestPayload = new StringSource(
|
||||
* "<customerCountRequest xmlns='http://springframework.org/spring-ws'>" +
|
||||
* "<customerName>John Doe</customerName>" +
|
||||
* "</customerCountRequest>");
|
||||
* Source expectedResponsePayload = new StringSource(
|
||||
* "<customerCountResponse xmlns='http://springframework.org/spring-ws'>" +
|
||||
* "<customerCount>42</customerCount>" +
|
||||
* "</customerCountResponse>");
|
||||
*
|
||||
* <strong>mockClient.sendMessage(withPayload(requestPayload)).andExpect(payload(expectedResponsePayload))</strong>;
|
||||
* }
|
||||
* }
|
||||
* </pre></blockquote>
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
|
||||
@@ -30,7 +30,6 @@ import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.springframework.ws.test.server.RequestCreators.withPayload;
|
||||
import static org.springframework.ws.test.server.ResponseMatchers.noFault;
|
||||
import static org.springframework.ws.test.server.ResponseMatchers.payload;
|
||||
|
||||
/**
|
||||
@@ -54,11 +53,11 @@ public class ServerIntegrationTest {
|
||||
public void basic() throws Exception {
|
||||
Source requestPayload = new StringSource("<customerCountRequest xmlns='http://springframework.org/spring-ws'>" +
|
||||
"<customerName>John Doe</customerName>" + "</customerCountRequest>");
|
||||
Source responsePayload = new StringSource(
|
||||
Source expectedResponsePayload = new StringSource(
|
||||
"<customerCountResponse xmlns='http://springframework.org/spring-ws'>" +
|
||||
"<customerCount>42</customerCount>" + "</customerCountResponse>");
|
||||
|
||||
mockClient.sendMessage(withPayload(requestPayload)).andExpect(payload(responsePayload)).andExpect(noFault());
|
||||
mockClient.sendMessage(withPayload(requestPayload)).andExpect(payload(expectedResponsePayload));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user