Author: wtam Date: Fri Aug 13 20:57:47 2010 New Revision: 985362 URL: http://svn.apache.org/viewvc?rev=985362&view=rev Log: [CAMEL-3055] camel-cxf component to support SOAP with Attachment in Payload mode
Added: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomDisabledConsumerPayloadModeTest.java (with props) camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomDisabledProducerPayloadModeTest.java (with props) camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomDisabledConsumerPayloadModeTest-context.xml (with props) camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomDisabledProducerPayloadModeTest-context.xml (with props) Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomConsumerPayloadModeTest.java camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomProducerPayloadModeTest.java camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/MtomTestHelper.java camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomConsumerPayloadModeTest-context.xml camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomProducerPayloadModeTest-context.xml Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java?rev=985362&r1=985361&r2=985362&view=diff ============================================================================== --- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java (original) +++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java Fri Aug 13 20:57:47 2010 @@ -24,6 +24,7 @@ import org.apache.camel.Endpoint; import org.apache.camel.component.cxf.spring.CxfEndpointBean; import org.apache.camel.impl.HeaderFilterStrategyComponent; import org.apache.camel.util.CamelContextHelper; +import org.apache.cxf.message.Message; /** * Defines the <a href="http://camel.apache.org/cxf.html">CXF Component</a> @@ -70,6 +71,7 @@ public class CxfComponent extends Header Map<String, Object> copy = new HashMap<String, Object>(); copy.putAll(bean.getProperties()); setProperties(result, copy); + result.setMtomEnabled(Boolean.valueOf((String)copy.get(Message.MTOM_ENABLED))); } } else { Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java?rev=985362&r1=985361&r2=985362&view=diff ============================================================================== --- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java (original) +++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java Fri Aug 13 20:57:47 2010 @@ -27,6 +27,7 @@ import org.apache.cxf.endpoint.Server; import org.apache.cxf.frontend.ServerFactoryBean; import org.apache.cxf.interceptor.Fault; import org.apache.cxf.message.Exchange; +import org.apache.cxf.message.Message; import org.apache.cxf.service.invoker.Invoker; import org.apache.cxf.service.model.BindingOperationInfo; @@ -85,6 +86,8 @@ public class CxfConsumer extends Default + "=" + dataFormat); } + camelExchange.setProperty(Message.MTOM_ENABLED, String.valueOf(endpoint.isMtomEnabled())); + // bind the CXF request into a Camel exchange binding.populateExchangeFromCxfRequest(cxfExchange, camelExchange); Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java?rev=985362&r1=985361&r2=985362&view=diff ============================================================================== --- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java (original) +++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java Fri Aug 13 20:57:47 2010 @@ -96,6 +96,7 @@ public class CxfEndpoint extends Default private boolean isSetDefaultBus; private boolean loggingFeatureEnabled; private String address; + private boolean mtomEnabled; public CxfEndpoint(String remaining, CxfComponent cxfComponent) { super(remaining, cxfComponent); @@ -564,6 +565,14 @@ public class CxfEndpoint extends Default return address; } + public void setMtomEnabled(boolean mtomEnabled) { + this.mtomEnabled = mtomEnabled; + } + + public boolean isMtomEnabled() { + return mtomEnabled; + } + /** * We need to override the {...@link ClientImpl#setParameters} method * to insert parameters into CXF Message for {...@link DataFormat#PAYLOAD} mode. Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java?rev=985362&r1=985361&r2=985362&view=diff ============================================================================== --- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java (original) +++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java Fri Aug 13 20:57:47 2010 @@ -141,6 +141,8 @@ public class CxfProducer extends Default // create invocation context WrappedMessageContext requestContext = new WrappedMessageContext( new HashMap<String, Object>(), null, Scope.APPLICATION); + + camelExchange.setProperty(Message.MTOM_ENABLED, String.valueOf(endpoint.isMtomEnabled())); // set data format mode in exchange DataFormat dataFormat = endpoint.getDataFormat(); Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java?rev=985362&r1=985361&r2=985362&view=diff ============================================================================== --- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java (original) +++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java Fri Aug 13 20:57:47 2010 @@ -94,12 +94,13 @@ public class DefaultCxfBinding implement // propagate attachments Set<Attachment> attachments = null; + boolean isXop = Boolean.valueOf(camelExchange.getProperty(Message.MTOM_ENABLED, String.class)); for (Map.Entry<String, DataHandler> entry : camelExchange.getIn().getAttachments().entrySet()) { if (attachments == null) { attachments = new HashSet<Attachment>(); } AttachmentImpl attachment = new AttachmentImpl(entry.getKey(), entry.getValue()); - attachment.setXOP(true); // only supports MTOM + attachment.setXOP(isXop); attachments.add(attachment); } @@ -329,12 +330,13 @@ public class DefaultCxfBinding implement // propagate attachments Set<Attachment> attachments = null; + boolean isXop = Boolean.valueOf(camelExchange.getProperty(Message.MTOM_ENABLED, String.class)); for (Map.Entry<String, DataHandler> entry : camelExchange.getOut().getAttachments().entrySet()) { if (attachments == null) { attachments = new HashSet<Attachment>(); } AttachmentImpl attachment = new AttachmentImpl(entry.getKey(), entry.getValue()); - attachment.setXOP(true); // only supports MTOM + attachment.setXOP(isXop); attachments.add(attachment); } Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomConsumerPayloadModeTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomConsumerPayloadModeTest.java?rev=985362&r1=985361&r2=985362&view=diff ============================================================================== --- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomConsumerPayloadModeTest.java (original) +++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomConsumerPayloadModeTest.java Fri Aug 13 20:57:47 2010 @@ -62,7 +62,7 @@ public class CxfMtomConsumerPayloadModeT public void process(Exchange exchange) throws Exception { exchange.setPattern(ExchangePattern.InOut); List<Element> elements = new ArrayList<Element>(); - elements.add(DOMUtils.readXml(new StringReader(MtomTestHelper.REQ_MESSAGE)).getDocumentElement()); + elements.add(DOMUtils.readXml(new StringReader(getRequestMessage())).getDocumentElement()); CxfPayload<SoapHeader> body = new CxfPayload<SoapHeader>(new ArrayList<SoapHeader>(), elements); exchange.getIn().setBody(body); @@ -124,4 +124,8 @@ public class CxfMtomConsumerPayloadModeT } // END SNIPPET: consumer + protected String getRequestMessage() { + return MtomTestHelper.REQ_MESSAGE; + } + } Added: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomDisabledConsumerPayloadModeTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomDisabledConsumerPayloadModeTest.java?rev=985362&view=auto ============================================================================== --- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomDisabledConsumerPayloadModeTest.java (added) +++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomDisabledConsumerPayloadModeTest.java Fri Aug 13 20:57:47 2010 @@ -0,0 +1,84 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.cxf.mtom; + +import java.io.StringReader; +import java.util.ArrayList; +import java.util.List; + +import javax.activation.DataHandler; +import javax.mail.util.ByteArrayDataSource; + +import org.w3c.dom.Element; + +import junit.framework.Assert; + +import org.apache.camel.Exchange; +import org.apache.camel.Processor; +import org.apache.camel.component.cxf.CxfPayload; +import org.apache.cxf.binding.soap.SoapHeader; +import org.apache.cxf.helpers.DOMUtils; +import org.apache.cxf.helpers.IOUtils; +import org.springframework.test.context.ContextConfiguration; + +/** +* Unit test for exercising SOAP with Attachment (SwA) feature of a CxfConsumer in PAYLOAD mode. +* That is, testing attachment with MTOM optimization off. +* +* @version $Revision$ +*/ +...@contextconfiguration +public class CxfMtomDisabledConsumerPayloadModeTest extends CxfMtomConsumerPayloadModeTest { + + @Override + protected String getRequestMessage() { + return MtomTestHelper.MTOM_DISABLED_REQ_MESSAGE; + } + + public static class MyProcessor implements Processor { + + @SuppressWarnings("unchecked") + public void process(Exchange exchange) throws Exception { + CxfPayload<SoapHeader> in = exchange.getIn().getBody(CxfPayload.class); + + // verify request + Assert.assertEquals(1, in.getBody().size()); + + DataHandler dr = exchange.getIn().getAttachment(MtomTestHelper.REQ_PHOTO_CID); + Assert.assertEquals("application/octet-stream", dr.getContentType()); + MtomTestHelper.assertEquals(MtomTestHelper.REQ_PHOTO_DATA, IOUtils.readBytesFromStream(dr.getInputStream())); + + dr = exchange.getIn().getAttachment(MtomTestHelper.REQ_IMAGE_CID); + Assert.assertEquals("image/jpeg", dr.getContentType()); + MtomTestHelper.assertEquals(MtomTestHelper.requestJpeg, IOUtils.readBytesFromStream(dr.getInputStream())); + + // create response + List<Element> elements = new ArrayList<Element>(); + elements.add(DOMUtils.readXml(new StringReader(MtomTestHelper.MTOM_DISABLED_RESP_MESSAGE)).getDocumentElement()); + CxfPayload<SoapHeader> body = new CxfPayload<SoapHeader>(new ArrayList<SoapHeader>(), + elements); + exchange.getOut().setBody(body); + exchange.getOut().addAttachment(MtomTestHelper.RESP_PHOTO_CID, + new DataHandler(new ByteArrayDataSource(MtomTestHelper.RESP_PHOTO_DATA, "application/octet-stream"))); + + exchange.getOut().addAttachment(MtomTestHelper.RESP_IMAGE_CID, + new DataHandler(new ByteArrayDataSource(MtomTestHelper.responseJpeg, "image/jpeg"))); + + } + } + +} Propchange: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomDisabledConsumerPayloadModeTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomDisabledConsumerPayloadModeTest.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomDisabledProducerPayloadModeTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomDisabledProducerPayloadModeTest.java?rev=985362&view=auto ============================================================================== --- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomDisabledProducerPayloadModeTest.java (added) +++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomDisabledProducerPayloadModeTest.java Fri Aug 13 20:57:47 2010 @@ -0,0 +1,176 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.cxf.mtom; + +import java.awt.Image; +import java.awt.image.BufferedImage; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.StringReader; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import javax.activation.DataHandler; +import javax.activation.DataSource; +import javax.annotation.Resource; +import javax.imageio.ImageIO; +import javax.mail.util.ByteArrayDataSource; +import javax.xml.ws.Holder; +import javax.xml.ws.WebServiceContext; +import javax.xml.ws.handler.MessageContext; + +import org.w3c.dom.Element; + +import org.apache.camel.Exchange; +import org.apache.camel.ExchangePattern; +import org.apache.camel.Processor; +import org.apache.camel.component.cxf.CxfPayload; +import org.apache.camel.cxf.mtom_feature.Hello; +import org.apache.cxf.attachment.AttachmentDataSource; +import org.apache.cxf.binding.soap.SoapHeader; +import org.apache.cxf.helpers.DOMUtils; +import org.apache.cxf.helpers.IOUtils; +import org.junit.Assert; +import org.springframework.test.context.ContextConfiguration; + +/** + * + * Unit test for exercising SOAP with Attachment (SwA) feature of a CxfProducer in PAYLOAD mode. + * That is, testing attachment with MTOM optimization off. + * + * @version $Revision$ + */ +...@contextconfiguration +public class CxfMtomDisabledProducerPayloadModeTest extends CxfMtomProducerPayloadModeTest { + + @Override + protected boolean isMtomEnabled() { + return false; + } + + @Override + protected Object getServiceImpl() { + return new MyHelloImpl(); + } + + @SuppressWarnings("unchecked") + @Override + public void testProducer() throws Exception { + + if (Boolean.getBoolean("java.awt.headless") || System.getProperty("os.name").startsWith("Mac OS")) { + System.out.println("Running headless. Skipping test as Images may not work."); + return; + } + + Exchange exchange = context.createProducerTemplate().send("direct:testEndpoint", new Processor() { + + public void process(Exchange exchange) throws Exception { + exchange.setPattern(ExchangePattern.InOut); + List<Element> elements = new ArrayList<Element>(); + elements.add(DOMUtils.readXml(new StringReader(MtomTestHelper.MTOM_DISABLED_REQ_MESSAGE)).getDocumentElement()); + CxfPayload<SoapHeader> body = new CxfPayload<SoapHeader>(new ArrayList<SoapHeader>(), + elements); + exchange.getIn().setBody(body); + exchange.getIn().addAttachment(MtomTestHelper.REQ_PHOTO_CID, + new DataHandler(new ByteArrayDataSource(MtomTestHelper.REQ_PHOTO_DATA, "application/octet-stream"))); + + exchange.getIn().addAttachment(MtomTestHelper.REQ_IMAGE_CID, + new DataHandler(new ByteArrayDataSource(MtomTestHelper.requestJpeg, "image/jpeg"))); + + } + + }); + + // process response - verify response attachments + + CxfPayload<SoapHeader> out = exchange.getOut().getBody(CxfPayload.class); + Assert.assertEquals(1, out.getBody().size()); + + + DataHandler dr = exchange.getOut().getAttachment(MtomTestHelper.RESP_PHOTO_CID); + Assert.assertEquals("application/octet-stream", dr.getContentType()); + MtomTestHelper.assertEquals(MtomTestHelper.RESP_PHOTO_DATA, IOUtils.readBytesFromStream(dr.getInputStream())); + + dr = exchange.getOut().getAttachment(MtomTestHelper.RESP_IMAGE_CID); + Assert.assertEquals("image/jpeg", dr.getContentType()); + + BufferedImage image = ImageIO.read(dr.getInputStream()); + Assert.assertEquals(560, image.getWidth()); + Assert.assertEquals(300, image.getHeight()); + + } + + public static class MyHelloImpl extends HelloImpl implements Hello { + + @Resource + WebServiceContext ctx; + + @SuppressWarnings({ + "rawtypes", "unchecked" + }) + @Override + public void detail(Holder<byte[]> photo, Holder<Image> image) { + + // verify request attachments + Map<String, DataHandler> map = (Map) ctx.getMessageContext().get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS); + Assert.assertEquals(2, map.size()); + + DataHandler dh = map.get(MtomTestHelper.REQ_PHOTO_CID); + Assert.assertEquals("application/octet-stream", dh.getContentType()); + byte[] bytes = null; + try { + bytes = IOUtils.readBytesFromStream(dh.getInputStream()); + } catch (IOException e) { + e.printStackTrace(); + } + MtomTestHelper.assertEquals(bytes, MtomTestHelper.REQ_PHOTO_DATA); + + dh = map.get(MtomTestHelper.REQ_IMAGE_CID); + Assert.assertEquals("image/jpeg", dh.getContentType()); + Object content = null; + try { + content = (BufferedImage)dh.getContent(); + } catch (IOException e) { + e.printStackTrace(); + } + Assert.assertEquals(41, ((BufferedImage)content).getWidth()); + Assert.assertEquals(39, ((BufferedImage)content).getHeight()); + + // add output attachments + map = (Map) ctx.getMessageContext().get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS); + + try { + DataSource ds = new AttachmentDataSource("image/jpeg", getClass().getResourceAsStream("/Splash.jpg")); + map.put(MtomTestHelper.RESP_IMAGE_CID, new DataHandler(ds)); + + } catch (IOException e) { + e.printStackTrace(); + } + + try { + DataSource ds = new AttachmentDataSource("application/octet-stream", + new ByteArrayInputStream(MtomTestHelper.RESP_PHOTO_DATA)); + map.put(MtomTestHelper.RESP_PHOTO_CID, new DataHandler(ds)); + + } catch (IOException e) { + e.printStackTrace(); + } + + } + } +} Propchange: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomDisabledProducerPayloadModeTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomDisabledProducerPayloadModeTest.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomProducerPayloadModeTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomProducerPayloadModeTest.java?rev=985362&r1=985361&r2=985362&view=diff ============================================================================== --- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomProducerPayloadModeTest.java (original) +++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomProducerPayloadModeTest.java Fri Aug 13 20:57:47 2010 @@ -59,13 +59,13 @@ public class CxfMtomProducerPayloadModeT @Autowired protected CamelContext context; - private Endpoint endpoint; + protected Endpoint endpoint; @Before public void setUp() throws Exception { - endpoint = Endpoint.publish("http://localhost:9092/jaxws-mtom/hello", new HelloImpl()); + endpoint = Endpoint.publish("http://localhost:9092/jaxws-mtom/hello", getServiceImpl()); SOAPBinding binding = (SOAPBinding)endpoint.getBinding(); - binding.setMTOMEnabled(true); + binding.setMTOMEnabled(isMtomEnabled()); } @After @@ -139,4 +139,12 @@ public class CxfMtomProducerPayloadModeT } + protected boolean isMtomEnabled() { + return true; + } + + protected Object getServiceImpl() { + return new HelloImpl(); + } + } Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/MtomTestHelper.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/MtomTestHelper.java?rev=985362&r1=985361&r2=985362&view=diff ============================================================================== --- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/MtomTestHelper.java (original) +++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/MtomTestHelper.java Fri Aug 13 20:57:47 2010 @@ -44,6 +44,11 @@ public final class MtomTestHelper { + " href=\"cid:" + REQ_PHOTO_CID + "\"/>" + "</photo><image><xop:Include xmlns:xop=\"http://www.w3.org/2004/08/xop/include\"" + " href=\"cid:" + REQ_IMAGE_CID + "\"/></image></Detail>"; + + static final String MTOM_DISABLED_REQ_MESSAGE = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + + "<Detail xmlns=\"http://apache.org/camel/cxf/mtom_feature/types\">" + + "<photo>cid:" + REQ_PHOTO_CID + "</photo>" + + "<image>cid:" + REQ_IMAGE_CID + "</image></Detail>"; static final String RESP_PHOTO_CID = "4c7b78dc-356a-4fca-8877-068ee2f3182...@apache.org"; static final String RESP_IMAGE_CID = "4c7b78dc-356a-4fca-8877-068ee2f3182...@apache.org"; @@ -55,6 +60,11 @@ public final class MtomTestHelper { + "</photo><image><xop:Include xmlns:xop=\"http://www.w3.org/2004/08/xop/include\"" + " href=\"cid:" + RESP_IMAGE_CID + "\"/></image></DetailResponse>"; + static final String MTOM_DISABLED_RESP_MESSAGE = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + + "<DetailResponse xmlns=\"http://apache.org/camel/cxf/mtom_feature/types\">" + + "<photo>cid:" + RESP_PHOTO_CID + "</photo>" + + "<image>cid:" + RESP_IMAGE_CID + "</image></DetailResponse>"; + static byte[] requestJpeg; static byte[] responseJpeg; Modified: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomConsumerPayloadModeTest-context.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomConsumerPayloadModeTest-context.xml?rev=985362&r1=985361&r2=985362&view=diff ============================================================================== --- camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomConsumerPayloadModeTest-context.xml (original) +++ camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomConsumerPayloadModeTest-context.xml Fri Aug 13 20:57:47 2010 @@ -34,15 +34,8 @@ <cxf:properties> <entry key="mtom-enabled" value="true"/> <entry key="dataFormat" value="PAYLOAD"/> + <entry key="loggingFeatureEnabled" value="false"/> </cxf:properties> -<!-- - <cxf:inInterceptors> - <ref bean="logInbound"/> - </cxf:inInterceptors> - <cxf:outInterceptors> - <ref bean="logOutbound"/> - </cxf:outInterceptors> ---> </cxf:cxfEndpoint> <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> @@ -52,10 +45,7 @@ </route> </camelContext> - <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor" /> - <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/> - <bean id="myProcessor" class="org.apache.camel.component.cxf.mtom.CxfMtomConsumerPayloadModeTest$MyProcessor" /> -</beans> \ No newline at end of file +</beans> Added: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomDisabledConsumerPayloadModeTest-context.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomDisabledConsumerPayloadModeTest-context.xml?rev=985362&view=auto ============================================================================== --- camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomDisabledConsumerPayloadModeTest-context.xml (added) +++ camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomDisabledConsumerPayloadModeTest-context.xml Fri Aug 13 20:57:47 2010 @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:cxf="http://camel.apache.org/schema/cxf" + + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd + "> + + <cxf:cxfEndpoint id="consumerEndpoint" address="http://localhost:9091/jaxws-mtom/hello" + wsdlURL="mtom.wsdl" + serviceName="ns:HelloService" + endpointName="ns:HelloPort" + xmlns:ns="http://apache.org/camel/cxf/mtom_feature"> + + <cxf:properties> + <entry key="mtom-enabled" value="false"/> + <entry key="dataFormat" value="PAYLOAD"/> + <entry key="loggingFeatureEnabled" value="false"/> + </cxf:properties> + + </cxf:cxfEndpoint> + + <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> + <route> + <from uri="cxf:bean:consumerEndpoint" /> + <process ref="myProcessor" /> + </route> + </camelContext> + + <bean id="myProcessor" + class="org.apache.camel.component.cxf.mtom.CxfMtomDisabledConsumerPayloadModeTest$MyProcessor" /> + +</beans> Propchange: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomDisabledConsumerPayloadModeTest-context.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomDisabledConsumerPayloadModeTest-context.xml ------------------------------------------------------------------------------ svn:keywords = Rev Date Propchange: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomDisabledConsumerPayloadModeTest-context.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomDisabledProducerPayloadModeTest-context.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomDisabledProducerPayloadModeTest-context.xml?rev=985362&view=auto ============================================================================== --- camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomDisabledProducerPayloadModeTest-context.xml (added) +++ camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomDisabledProducerPayloadModeTest-context.xml Fri Aug 13 20:57:47 2010 @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:cxf="http://camel.apache.org/schema/cxf" + + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd + "> + + <cxf:cxfEndpoint id="serviceEndpoint" address="http://localhost:9092/jaxws-mtom/hello" + wsdlURL="mtom.wsdl" + serviceName="ns:HelloService" + endpointName="ns:HelloPort" + xmlns:ns="http://apache.org/camel/cxf/mtom_feature"> + + <cxf:properties> + <entry key="dataFormat" value="PAYLOAD"/> + <entry key="loggingFeatureEnabled" value="false"/> + </cxf:properties> + + </cxf:cxfEndpoint> + + <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> + <route> + <from uri="direct:testEndpoint" /> + <to uri="cxf:bean:serviceEndpoint" /> + </route> + </camelContext> + +</beans> \ No newline at end of file Propchange: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomDisabledProducerPayloadModeTest-context.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomDisabledProducerPayloadModeTest-context.xml ------------------------------------------------------------------------------ svn:keywords = Rev Date Propchange: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomDisabledProducerPayloadModeTest-context.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Modified: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomProducerPayloadModeTest-context.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomProducerPayloadModeTest-context.xml?rev=985362&r1=985361&r2=985362&view=diff ============================================================================== --- camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomProducerPayloadModeTest-context.xml (original) +++ camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomProducerPayloadModeTest-context.xml Fri Aug 13 20:57:47 2010 @@ -34,15 +34,9 @@ <cxf:properties> <entry key="mtom-enabled" value="true"/> <entry key="dataFormat" value="PAYLOAD"/> + <entry key="loggingFeatureEnabled" value="false"/> </cxf:properties> -<!-- - <cxf:inInterceptors> - <ref bean="logInbound"/> - </cxf:inInterceptors> - <cxf:outInterceptors> - <ref bean="logOutbound"/> - </cxf:outInterceptors> ---> + </cxf:cxfEndpoint> <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> @@ -52,7 +46,4 @@ </route> </camelContext> - <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor" /> - <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/> - -</beans> \ No newline at end of file +</beans>