Return-Path: Delivered-To: apmail-incubator-cxf-commits-archive@locus.apache.org Received: (qmail 29039 invoked from network); 12 Dec 2007 04:32:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Dec 2007 04:32:05 -0000 Received: (qmail 51194 invoked by uid 500); 12 Dec 2007 04:31:53 -0000 Delivered-To: apmail-incubator-cxf-commits-archive@incubator.apache.org Received: (qmail 51128 invoked by uid 500); 12 Dec 2007 04:31:53 -0000 Mailing-List: contact cxf-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cxf-dev@incubator.apache.org Delivered-To: mailing list cxf-commits@incubator.apache.org Received: (qmail 51119 invoked by uid 99); 12 Dec 2007 04:31:53 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Dec 2007 20:31:53 -0800 X-ASF-Spam-Status: No, hits=-98.5 required=10.0 tests=ALL_TRUSTED,WEIRD_PORT X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Dec 2007 04:32:02 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 1E0BA1A9832; Tue, 11 Dec 2007 20:31:40 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r603457 - in /incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom_bindingtype: ./ HelloImpl.java MTOMBindingTypeTest.java Server.java Date: Wed, 12 Dec 2007 04:31:39 -0000 To: cxf-commits@incubator.apache.org From: mmao@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071212043140.1E0BA1A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mmao Date: Tue Dec 11 20:31:39 2007 New Revision: 603457 URL: http://svn.apache.org/viewvc?rev=603457&view=rev Log: CXF-1196 @BindingType(SOAP11HTTP_MTOM_BINDING) is not activating MTOM Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom_bindingtype/ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom_bindingtype/HelloImpl.java incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom_bindingtype/MTOMBindingTypeTest.java incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom_bindingtype/Server.java Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom_bindingtype/HelloImpl.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom_bindingtype/HelloImpl.java?rev=603457&view=auto ============================================================================== --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom_bindingtype/HelloImpl.java (added) +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom_bindingtype/HelloImpl.java Tue Dec 11 20:31:39 2007 @@ -0,0 +1,37 @@ +/** + * 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.cxf.systest.mtom_bindingtype; + +import java.awt.Image; +import javax.xml.ws.BindingType; +import javax.xml.ws.Holder; + +import org.apache.cxf.systest.mtom_feature.Hello; + +@BindingType(value = javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_MTOM_BINDING) +public class HelloImpl implements Hello { + public void detail(Holder photo, Holder image) { + // echo through Holder + } + + public void echoData(Holder data) { + // echo through Holder + } +} Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom_bindingtype/MTOMBindingTypeTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom_bindingtype/MTOMBindingTypeTest.java?rev=603457&view=auto ============================================================================== --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom_bindingtype/MTOMBindingTypeTest.java (added) +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom_bindingtype/MTOMBindingTypeTest.java Tue Dec 11 20:31:39 2007 @@ -0,0 +1,126 @@ +/** + * 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.cxf.systest.mtom_bindingtype; + +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; +import javax.xml.ws.BindingProvider; +import javax.xml.ws.Holder; +import javax.xml.ws.soap.SOAPBinding; + +import org.apache.cxf.interceptor.LoggingInInterceptor; +import org.apache.cxf.interceptor.LoggingOutInterceptor; +import org.apache.cxf.systest.mtom_feature.Hello; +import org.apache.cxf.systest.mtom_feature.HelloService; +import org.apache.cxf.systest.mtom_feature.ImageHelper; +import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +public class MTOMBindingTypeTest extends AbstractBusClientServerTestBase { + + private final QName serviceName = new QName("http://apache.org/cxf/systest/mtom_feature", + "HelloService"); + //private Hello port = getPort(); + + @Before + public void setUp() throws Exception { + createBus(); + } + + @BeforeClass + public static void startServers() throws Exception { + assertTrue("server did not launch correctly", launchServer(Server.class)); + } + + protected ByteArrayOutputStream setupInLogging() { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + PrintWriter writer = new PrintWriter(bos, true); + LoggingInInterceptor in = new LoggingInInterceptor(writer); + this.bus.getInInterceptors().add(in); + return bos; + } + + protected ByteArrayOutputStream setupOutLogging() { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + PrintWriter writer = new PrintWriter(bos, true); + + LoggingOutInterceptor out = new LoggingOutInterceptor(writer); + this.bus.getOutInterceptors().add(out); + + return bos; + } + + @Test + public void testDetail() throws Exception { + ByteArrayOutputStream input = setupInLogging(); + ByteArrayOutputStream output = setupOutLogging(); + + Holder photo = new Holder("CXF".getBytes()); + Holder image = new Holder(getImage("/java.jpg")); + + Hello port = getPort(); + + SOAPBinding binding = (SOAPBinding) ((BindingProvider)port).getBinding(); + binding.setMTOMEnabled(true); + + + port.detail(photo, image); + + String expected = " image = new Holder(bytes); + + Hello port = getPort(); + SOAPBinding binding = (SOAPBinding) ((BindingProvider)port).getBinding(); + binding.setMTOMEnabled(true); + + port.echoData(image); + assertNotNull(image); + } + + private Image getImage(String name) throws Exception { + return ImageIO.read(getClass().getResource(name)); + } + + private Hello getPort() { + URL wsdl = getClass().getResource("/wsdl/mtom.wsdl"); + assertNotNull("WSDL is null", wsdl); + + HelloService service = new HelloService(wsdl, serviceName); + assertNotNull("Service is null ", service); + return service.getHelloPort(); + } +} Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom_bindingtype/Server.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom_bindingtype/Server.java?rev=603457&view=auto ============================================================================== --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom_bindingtype/Server.java (added) +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom_bindingtype/Server.java Tue Dec 11 20:31:39 2007 @@ -0,0 +1,45 @@ +/** + * 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.cxf.systest.mtom_bindingtype; + +import javax.xml.ws.Endpoint; + +import org.apache.cxf.testutil.common.AbstractBusTestServerBase; + +public class Server extends AbstractBusTestServerBase { + + protected void run() { + Object implementor = new HelloImpl(); + String address = "http://localhost:9090/jaxws-mtom/hello"; + Endpoint.publish(address, implementor); + } + + public static void main(String[] args) { + try { + Server s = new Server(); + s.start(); + } catch (Exception ex) { + ex.printStackTrace(); + System.exit(-1); + } finally { + System.out.println("done!"); + } + } +}