1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.ws.soap.addressing.server;
18
19 import java.net.URI;
20
21 import org.springframework.ws.context.DefaultMessageContext;
22 import org.springframework.ws.context.MessageContext;
23 import org.springframework.ws.soap.SoapMessage;
24 import org.springframework.ws.soap.addressing.version.Addressing10;
25 import org.springframework.ws.soap.addressing.version.AddressingVersion;
26 import org.springframework.ws.soap.saaj.SaajSoapMessage;
27 import org.springframework.ws.soap.saaj.SaajSoapMessageFactory;
28
29 import static org.easymock.EasyMock.*;
30 import static org.junit.Assert.assertTrue;
31
32 public class AddressingInterceptor10Test extends AbstractAddressingInterceptorTestCase {
33
34 @Override
35 protected AddressingVersion getVersion() {
36 return new Addressing10();
37 }
38
39 @Override
40 protected String getTestPath() {
41 return "10";
42 }
43
44 public void testNoTo() throws Exception {
45 SaajSoapMessage valid = loadSaajMessage(getTestPath() + "/request-no-to.xml");
46 MessageContext context = new DefaultMessageContext(valid, new SaajSoapMessageFactory(messageFactory));
47 URI messageId = new URI("uid:1234");
48 expect(strategyMock.newMessageId((SoapMessage) context.getResponse())).andReturn(messageId);
49 replay(strategyMock);
50 boolean result = interceptor.handleResponse(context, null);
51 assertTrue("Request with no To not handled", result);
52 assertTrue("Message Context has no response", context.hasResponse());
53 SaajSoapMessage expectedResponse = loadSaajMessage(getTestPath() + "/response-anonymous.xml");
54 assertXMLEqual("Invalid response for message with invalid MAP", expectedResponse,
55 (SaajSoapMessage) context.getResponse());
56 verify(strategyMock);
57 }
58
59 }