Return-Path: Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: (qmail 17567 invoked from network); 11 Nov 2010 21:01:15 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 11 Nov 2010 21:01:15 -0000 Received: (qmail 85086 invoked by uid 500); 11 Nov 2010 21:01:47 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 84980 invoked by uid 500); 11 Nov 2010 21:01:46 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 84973 invoked by uid 99); 11 Nov 2010 21:01:46 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Nov 2010 21:01:46 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Nov 2010 21:01:40 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 7D97E2388A64; Thu, 11 Nov 2010 21:00:22 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1034119 - in /cxf/branches/2.2.x-fixes: ./ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_feature/MtomFeatureClientServerTest.java Date: Thu, 11 Nov 2010 21:00:22 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101111210022.7D97E2388A64@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dkulp Date: Thu Nov 11 21:00:22 2010 New Revision: 1034119 URL: http://svn.apache.org/viewvc?rev=1034119&view=rev Log: Merged revisions 1030831 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.3.x-fixes ................ r1030831 | ema | 2010-11-04 00:21:57 -0400 (Thu, 04 Nov 2010) | 9 lines Merged revisions 1029537 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r1029537 | ema | 2010-11-01 11:24:42 +0800 (Mon, 01 Nov 2010) | 1 line [CXF-3104]:Enable threshold value configuration via @MTOM and @MTOMFeature ........ ................ Modified: cxf/branches/2.2.x-fixes/ (props changed) cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java cxf/branches/2.2.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_feature/MtomFeatureClientServerTest.java Propchange: cxf/branches/2.2.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java?rev=1034119&r1=1034118&r2=1034119&view=diff ============================================================================== --- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java (original) +++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java Thu Nov 11 21:00:22 2010 @@ -181,6 +181,9 @@ public class JaxWsServiceFactoryBean ext s.put(ENDPOINT_CLASS, implInfo.getEndpointClass()); + if (s.getDataBinding() != null) { + setMTOMThreshold(s.getDataBinding()); + } return s; } @@ -632,6 +635,17 @@ public class JaxWsServiceFactoryBean ext return Collections.emptySet(); } + private void setMTOMThreshold(DataBinding databinding) { + if (this.wsFeatures != null) { + for (WebServiceFeature wsf : this.wsFeatures) { + if (wsf instanceof MTOMFeature && ((MTOMFeature)wsf).getThreshold() > 0) { + databinding.setMtomThreshold(((MTOMFeature)wsf).getThreshold()); + } + + } + } + } + @Override protected void buildServiceFromClass() { super.buildServiceFromClass(); Modified: cxf/branches/2.2.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_feature/MtomFeatureClientServerTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_feature/MtomFeatureClientServerTest.java?rev=1034119&r1=1034118&r2=1034119&view=diff ============================================================================== --- cxf/branches/2.2.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_feature/MtomFeatureClientServerTest.java (original) +++ cxf/branches/2.2.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_feature/MtomFeatureClientServerTest.java Thu Nov 11 21:00:22 2010 @@ -20,6 +20,8 @@ package org.apache.cxf.systest.mtom_feature; import java.awt.Image; +import java.io.ByteArrayOutputStream; +import java.io.PrintWriter; import java.net.URL; import javax.imageio.ImageIO; import javax.xml.namespace.QName; @@ -29,8 +31,11 @@ import javax.xml.ws.Holder; import javax.xml.ws.Service; import javax.xml.ws.soap.MTOMFeature; +import org.apache.cxf.interceptor.LoggingOutInterceptor; import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase; import org.apache.cxf.transport.local.LocalConduit; + +import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -44,6 +49,11 @@ public class MtomFeatureClientServerTest public static void startServers() throws Exception { assertTrue("server did not launch correctly", launchServer(Server.class, true)); } + + @Before + public void setUp() throws Exception { + this.createBus(); + } @Test public void testDetail() throws Exception { @@ -112,19 +122,57 @@ public class MtomFeatureClientServerTest assertEquals("CXF", new String(photo.value)); assertNotNull(image.value); } + + @Test + public void testEchoWithLowThreshold() throws Exception { + ByteArrayOutputStream bout = this.setupOutLogging(); + byte[] bytes = ImageHelper.getImageBytes(getImage("/java.jpg"), "image/jpeg"); + Holder image = new Holder(bytes); + Hello hello = this.getPort(500); + hello.echoData(image); + assertTrue("MTOM should be enabled", bout.toString().indexOf(" -1); + } + + @Test + public void testEchoWithHighThreshold() throws Exception { + ByteArrayOutputStream bout = this.setupOutLogging(); + byte[] bytes = ImageHelper.getImageBytes(getImage("/java.jpg"), "image/jpeg"); + Holder image = new Holder(bytes); + Hello hello = this.getPort(2000); + hello.echoData(image); + assertTrue("MTOM should not be enabled", bout.toString().indexOf(" 0) { + mtomFeature = new MTOMFeature(true, threshold); + } + Hello hello = service.getHelloPort(mtomFeature); + try { updateAddressPort(hello, PORT); } catch (Exception e) {