View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.module.cxf;
8   
9   import static org.junit.Assert.assertTrue;
10  import org.mule.api.MuleMessage;
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  public class ProxyWithValidationTestCase extends FunctionalTestCase
18  {
19  
20      public static final String SAMPLE_REQUEST = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
21                                                  + "<soap:Body> " +
22                                                  "<echo xmlns=\"http://www.muleumo.org\">" +
23                                                  "  <echo><![CDATA[bla]]></echo>" +
24                                                  "</echo>"
25                                                  + "</soap:Body>"
26                                                  + "</soap:Envelope>";
27  
28      @Rule
29      public final DynamicPort httpPort = new DynamicPort("port1");
30  
31      @Override
32      protected String getConfigResources()
33      {
34          return "proxy-with-validation-config.xml";
35      }
36  
37      @Test
38      public void acceptsRequestWithCData() throws Exception
39      {
40          MuleMessage response = muleContext.getClient().send("http://localhost:" + httpPort.getNumber(), SAMPLE_REQUEST, null);
41  
42          assertTrue(response.getPayloadAsString().contains("bla"));
43      }
44  }