Fixed the unit test issue of upgrade to CXF 2.7.12
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3bf3aefa Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3bf3aefa Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3bf3aefa Branch: refs/remotes/origin/camel-2.13.x Commit: 3bf3aefa3cb21230b36cda933746635c88f51a23 Parents: 84aa5c6 Author: Willem Jiang <willem.ji...@gmail.com> Authored: Wed Jul 16 15:42:51 2014 +0800 Committer: Willem Jiang <willem.ji...@gmail.com> Committed: Mon Sep 29 22:14:20 2014 +0800 ---------------------------------------------------------------------- .../cxf/mtom/CxfMtomProducerPayloadModeTest.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/3bf3aefa/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomProducerPayloadModeTest.java ---------------------------------------------------------------------- diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomProducerPayloadModeTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomProducerPayloadModeTest.java index f1a70a1..794e39e 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomProducerPayloadModeTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomProducerPayloadModeTest.java @@ -18,6 +18,7 @@ package org.apache.camel.component.cxf.mtom; import java.awt.image.BufferedImage; import java.io.StringReader; +import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -124,16 +125,17 @@ public class CxfMtomProducerPayloadModeTest extends AbstractJUnit4SpringContextT Element ele = (Element)xu.getValue("//ns:DetailResponse/ns:photo/xop:Include", oute, XPathConstants.NODE); String photoId = ele.getAttribute("href").substring(4); // skip "cid:" - + ele = (Element)xu.getValue("//ns:DetailResponse/ns:image/xop:Include", oute, XPathConstants.NODE); String imageId = ele.getAttribute("href").substring(4); // skip "cid:" - DataHandler dr = exchange.getOut().getAttachment(photoId); + + DataHandler dr = exchange.getOut().getAttachment(decodingReference(photoId)); Assert.assertEquals("application/octet-stream", dr.getContentType()); MtomTestHelper.assertEquals(MtomTestHelper.RESP_PHOTO_DATA, IOUtils.readBytesFromStream(dr.getInputStream())); - dr = exchange.getOut().getAttachment(imageId); + dr = exchange.getOut().getAttachment(decodingReference(imageId)); Assert.assertEquals("image/jpeg", dr.getContentType()); BufferedImage image = ImageIO.read(dr.getInputStream()); @@ -144,6 +146,11 @@ public class CxfMtomProducerPayloadModeTest extends AbstractJUnit4SpringContextT } + // CXF encoding the XOP reference since 3.0.1 + private String decodingReference(String reference) throws UnsupportedEncodingException { + return java.net.URLDecoder.decode(reference, "UTF-8"); + } + protected boolean isMtomEnabled() { return true; }