1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.ws.soap.server.endpoint.mapping;
18
19 import javax.xml.soap.MessageFactory;
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.saaj.SaajSoapMessageFactory;
25
26 import org.junit.Assert;
27 import org.junit.Before;
28 import org.junit.Test;
29
30 public class SoapActionEndpointMappingTest {
31
32 private SoapActionEndpointMapping mapping;
33
34 private MessageContext context;
35
36 @Before
37 public void setUp() throws Exception {
38 mapping = new SoapActionEndpointMapping();
39 context = new DefaultMessageContext(new SaajSoapMessageFactory(MessageFactory.newInstance()));
40 }
41
42 @Test
43 public void testGetLookupKeyForMessage() throws Exception {
44 String soapAction = "http://springframework.org/spring-ws/SoapAction";
45 ((SoapMessage) context.getRequest()).setSoapAction(soapAction);
46 Assert.assertEquals("Invalid lookup key", soapAction, mapping.getLookupKeyForMessage(context));
47 }
48
49 @Test
50 public void testGetLookupKeyForMessageQuoted() throws Exception {
51 String soapAction = "http://springframework.org/spring-ws/SoapAction";
52 ((SoapMessage) context.getRequest()).setSoapAction(soapAction);
53 Assert.assertEquals("Invalid lookup key", soapAction, mapping.getLookupKeyForMessage(context));
54 }
55
56 @Test
57 public void testValidateLookupKey() throws Exception {
58 Assert.assertTrue("Soapaction not valid", mapping.validateLookupKey("SoapAction"));
59 }
60 }