1
2
3
4
5
6
7 package org.mule.module.cxf;
8
9 import org.mule.api.MuleMessage;
10 import org.mule.api.client.MuleClient;
11 import org.mule.tck.junit4.FunctionalTestCase;
12 import org.mule.tck.junit4.rule.DynamicPort;
13
14 import org.junit.Rule;
15 import org.junit.Test;
16
17 import static org.junit.Assert.assertTrue;
18
19 public class ProxySoapVersionTestCase extends FunctionalTestCase
20 {
21 String doGoogleSearch = "<urn:doGoogleSearch xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:urn=\"urn:GoogleSearch\">";
22
23
24 String msgWithComment = "<soap12:Envelope xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\">"
25 + "<!-- comment 1 -->"
26 + "<soap12:Header>"
27 + "<!-- comment 2 -->"
28 + "</soap12:Header>"
29 + "<!-- comment 3 -->"
30 + "<soap12:Body>"
31 + "<!-- comment 4 -->"
32 + doGoogleSearch
33 + "<!-- this comment breaks it -->"
34 + "<key>1</key>"
35 + "<!-- comment 5 -->"
36 + "<q>a</q>"
37 + "<start>0</start>"
38 + "<maxResults>1</maxResults>"
39 + "<filter>false</filter>"
40 + "<restrict>a</restrict>"
41 + "<safeSearch>true</safeSearch>"
42 + "<lr>a</lr>"
43 + "<ie>b</ie>"
44 + "<oe>c</oe>"
45 + "</urn:doGoogleSearch>"
46 + "<!-- comment 6 -->"
47 + "</soap12:Body>"
48 + "<!-- comment 7 -->"
49 + "</soap12:Envelope>";
50
51 @Rule
52 public DynamicPort dynamicPort = new DynamicPort("port1");
53
54 @Override
55 protected String getConfigResources()
56 {
57 return "proxy-soap-version-conf-flow.xml";
58 }
59
60 @Test
61 public void testProxyWithCommentInRequest() throws Exception
62 {
63 MuleClient client = muleContext.getClient();
64 MuleMessage result = client.send("http://localhost:" + dynamicPort.getNumber() + "/services/proxy-soap-version", msgWithComment, null);
65 String resString = result.getPayloadAsString();
66 assertTrue(resString.contains(doGoogleSearch));
67 }
68 }