1
2
3
4
5
6
7
8
9
10
11 package org.mule.test.integration.transport.cxf;
12
13 import org.mule.api.MuleMessage;
14 import org.mule.module.client.MuleClient;
15 import org.mule.tck.AbstractServiceAndFlowTestCase;
16
17 import java.util.Arrays;
18 import java.util.Collection;
19
20 import org.custommonkey.xmlunit.XMLAssert;
21 import org.junit.Test;
22 import org.junit.runners.Parameterized.Parameters;
23
24 import static org.junit.Assert.assertNotNull;
25
26 public class CxfEnvelopePayloadWithWsdlTestCase extends AbstractServiceAndFlowTestCase
27 {
28 private static final String msg = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" "
29 + "xmlns:emop=\"http://www.wcs.com/2010/07/14/emop\">" + " <soapenv:Header>\n"
30 + " <header UserName=\"nothing\" Password=\"important\"/>\n"
31 + " </soapenv:Header>\n" + " <soapenv:Body>\n"
32 + " <emop:ScratchcardValidateAndPayRequestBody>\n"
33 + " <ScratchcardNumber>1</ScratchcardNumber>\n"
34 + " <VirnNumber>2</VirnNumber>\n"
35 + " </emop:ScratchcardValidateAndPayRequestBody>\n" + " </soapenv:Body>\n"
36 + "</soapenv:Envelope>";
37
38 @Parameters
39 public static Collection<Object[]> parameters()
40 {
41 return Arrays.asList(new Object[][]{
42 {ConfigVariant.SERVICE,
43 "org/mule/test/integration/transport/cxf/scratchcard-service-config-service.xml"},
44 {ConfigVariant.FLOW,
45 "org/mule/test/integration/transport/cxf/scratchcard-service-config-flow.xml"}});
46 }
47
48 public CxfEnvelopePayloadWithWsdlTestCase(ConfigVariant variant, String configResources)
49 {
50 super(variant, configResources);
51 }
52
53 @Test
54 public void testEnvelopePayloadIsProcessedWhenMessageAndWsdlContainsHeaders() throws Exception
55 {
56 MuleClient client = new MuleClient(muleContext);
57
58 MuleMessage result = client.send("http://localhost:28182/ScratchCardServiceV1", msg, null);
59
60 assertNotNull("The result shouln't have been null", result);
61 final String payloadAsString = result.getPayloadAsString();
62 XMLAssert.assertXMLEqual(msg, payloadAsString);
63 }
64 }