Repository: camel Updated Branches: refs/heads/master ea61e8657 -> 2799822b0
CAMEL-8663 Fixed the CS errors of camel-cxf Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d6ff143f Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d6ff143f Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d6ff143f Branch: refs/heads/master Commit: d6ff143f160ff618b235f1064a56c602303d01d8 Parents: ef1df28 Author: Willem Jiang <willem.ji...@gmail.com> Authored: Fri May 8 19:37:31 2015 +0800 Committer: Willem Jiang <willem.ji...@gmail.com> Committed: Fri May 8 19:43:25 2015 +0800 ---------------------------------------------------------------------- ...fPayloadConsumerNamespaceOnEnvelopeTest.java | 24 ++++++++++++-------- ...fPayloadProducerNamespaceOnEnvelopeTest.java | 23 +++++++++++-------- 2 files changed, 28 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/d6ff143f/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadConsumerNamespaceOnEnvelopeTest.java ---------------------------------------------------------------------- diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadConsumerNamespaceOnEnvelopeTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadConsumerNamespaceOnEnvelopeTest.java index e4b6f5d..063fbeb 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadConsumerNamespaceOnEnvelopeTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadConsumerNamespaceOnEnvelopeTest.java @@ -17,6 +17,8 @@ package org.apache.camel.component.cxf; +import org.w3c.dom.Document; + import org.apache.camel.CamelContext; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.spring.SpringCamelContext; @@ -24,13 +26,12 @@ import org.apache.camel.test.junit4.CamelTestSupport; import org.apache.camel.util.IOHelper; import org.junit.After; import org.junit.Before; -import org.junit.Test; import org.springframework.context.support.AbstractXmlApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; -import org.w3c.dom.Document; + + public class CxfPayloadConsumerNamespaceOnEnvelopeTest extends CamelTestSupport { - private AbstractXmlApplicationContext applicationContext; /* * The request message is generated directly. The issue here is that the xsi * and xs namespaces are defined on the SOAP envelope but are used within @@ -41,10 +42,15 @@ public class CxfPayloadConsumerNamespaceOnEnvelopeTest extends CamelTestSupport * If some CXF proxy is used to send the message the namespaces will be * defined within the payload (and everything works fine). */ - private static final String responsePayload = "<ns2:getTokenResponse xmlns:ns2=\"http://camel.apache.org/cxf/namespace\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"><return xsi:type=\"xs:string\">Return Value</return></ns2:getTokenResponse>"; - private static final String requestMessage = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"><soap:Body>" - + "<ns2:getToken xmlns:ns2=\"http://camel.apache.org/cxf/namespace\"><arg0 xsi:type=\"xs:string\">Send</arg0></ns2:getToken>" - + "</soap:Body></soap:Envelope>"; + private static final String RESPONSE_PAYLOAD = "<ns2:getTokenResponse xmlns:ns2=\"http://camel.apache.org/cxf/namespace\"" + + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + + " xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"><return xsi:type=\"xs:string\">Return Value</return></ns2:getTokenResponse>"; + private static final String REQUEST_MESSAGE = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" " + + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"><soap:Body>" + + "<ns2:getToken xmlns:ns2=\"http://camel.apache.org/cxf/namespace\"><arg0 xsi:type=\"xs:string\">Send</arg0></ns2:getToken>" + + "</soap:Body></soap:Envelope>"; + + private AbstractXmlApplicationContext applicationContext; // Don't remove this, it initializes the CXFTestSupport class static { @@ -85,7 +91,7 @@ public class CxfPayloadConsumerNamespaceOnEnvelopeTest extends CamelTestSupport // Convert the CxfPayload to a String to trigger the issue .convertBodyTo(String.class) // Parse to DOM to make sure it's still valid XML - .convertBodyTo(Document.class).setBody().constant(responsePayload); + .convertBodyTo(Document.class).setBody().constant(RESPONSE_PAYLOAD); } }; } @@ -93,7 +99,7 @@ public class CxfPayloadConsumerNamespaceOnEnvelopeTest extends CamelTestSupport // need cxf-3.0.6 // @Test public void testInvokeRouter() { - Object returnValue = template.requestBody("direct:router", requestMessage); + Object returnValue = template.requestBody("direct:router", REQUEST_MESSAGE); assertNotNull(returnValue); assertTrue(returnValue instanceof String); assertTrue(((String) returnValue).contains("Return Value")); http://git-wip-us.apache.org/repos/asf/camel/blob/d6ff143f/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadProducerNamespaceOnEnvelopeTest.java ---------------------------------------------------------------------- diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadProducerNamespaceOnEnvelopeTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadProducerNamespaceOnEnvelopeTest.java index 872dd98..b1a26e2 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadProducerNamespaceOnEnvelopeTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadProducerNamespaceOnEnvelopeTest.java @@ -17,6 +17,8 @@ package org.apache.camel.component.cxf; +import org.w3c.dom.Document; + import org.apache.camel.CamelContext; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.spring.SpringCamelContext; @@ -24,13 +26,11 @@ import org.apache.camel.test.junit4.CamelTestSupport; import org.apache.camel.util.IOHelper; import org.junit.After; import org.junit.Before; -import org.junit.Test; import org.springframework.context.support.AbstractXmlApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; -import org.w3c.dom.Document; + public class CxfPayloadProducerNamespaceOnEnvelopeTest extends CamelTestSupport { - private AbstractXmlApplicationContext applicationContext; /* * The response message is generated directly. The issue here is that the * xsi and xs namespaces are defined on the SOAP envelope but are used @@ -41,11 +41,14 @@ public class CxfPayloadProducerNamespaceOnEnvelopeTest extends CamelTestSupport * If some CXF implementation bean is used as the service the namespaces * will be defined within the payload (and everything works fine). */ - private static final String responseMessage = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"><soap:Body>" - + "<ns2:getTokenResponse xmlns:ns2=\"http://camel.apache.org/cxf/namespace\"><return xsi:type=\"xs:string\">Return Value</return></ns2:getTokenResponse>" - + "</soap:Body></soap:Envelope>"; - private static final String requestPayload = "<ns2:getToken xmlns:ns2=\"http://camel.apache.org/cxf/namespace\"/>"; + private static final String RESPONSE_MESSAGE = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"" + + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"><soap:Body>" + + "<ns2:getTokenResponse xmlns:ns2=\"http://camel.apache.org/cxf/namespace\"><return xsi:type=\"xs:string\">Return Value</return></ns2:getTokenResponse>" + + "</soap:Body></soap:Envelope>"; + private static final String REQUEST_PAYLOAD = "<ns2:getToken xmlns:ns2=\"http://camel.apache.org/cxf/namespace\"/>"; + private AbstractXmlApplicationContext applicationContext; + // Don't remove this, it initializes the CXFTestSupport class static { CXFTestSupport.getPort1(); @@ -87,15 +90,15 @@ public class CxfPayloadProducerNamespaceOnEnvelopeTest extends CamelTestSupport // easier .convertBodyTo(String.class); // This route just returns the test message - from("cxf:bean:serviceEndpoint?DataFormat=MESSAGE").setBody().constant(responseMessage); + from("cxf:bean:serviceEndpoint?DataFormat=MESSAGE").setBody().constant(RESPONSE_MESSAGE); } }; } // need cxf-3.0.6 // @Test - public void testInvokeRouter() { - Object returnValue = template.requestBody("direct:router", requestPayload); + public void testInvokeRouter() { + Object returnValue = template.requestBody("direct:router", REQUEST_PAYLOAD); assertNotNull(returnValue); assertTrue(returnValue instanceof String); assertTrue(((String) returnValue).contains("Return Value"));