1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.ws.client.support.destination;
18
19 import java.net.URI;
20 import java.net.URISyntaxException;
21
22 import junit.framework.TestCase;
23
24 import org.springframework.core.io.ClassPathResource;
25 import org.springframework.core.io.Resource;
26
27 public class Wsdl11DestinationProviderTest extends TestCase {
28
29 private Wsdl11DestinationProvider provider;
30
31 protected void setUp() throws Exception {
32 provider = new Wsdl11DestinationProvider();
33 }
34
35 public void testSimple() throws URISyntaxException {
36 Resource wsdl = new ClassPathResource("simple.wsdl", getClass());
37 provider.setWsdl(wsdl);
38
39 URI result = provider.getDestination();
40
41 assertEquals("Invalid URI returned", new URI("http://example.com/myService"), result);
42 }
43
44 public void testComplex() throws URISyntaxException {
45 Resource wsdl = new ClassPathResource("complex.wsdl", getClass());
46 provider.setWsdl(wsdl);
47
48 URI result = provider.getDestination();
49
50 assertEquals("Invalid URI returned", new URI("http://example.com/soap11"), result);
51 }
52
53 public void testCustomExpression() throws URISyntaxException {
54 provider.setLocationExpression("/wsdl:definitions/wsdl:service/wsdl:port/soap12:address/@location");
55 Resource wsdl = new ClassPathResource("complex.wsdl", getClass());
56 provider.setWsdl(wsdl);
57
58 URI result = provider.getDestination();
59
60 assertEquals("Invalid URI returned", new URI("http://example.com/soap12"), result);
61 }
62 }