Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6DF4F9539 for ; Thu, 14 Mar 2013 13:25:15 +0000 (UTC) Received: (qmail 10087 invoked by uid 500); 14 Mar 2013 13:25:15 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 10035 invoked by uid 500); 14 Mar 2013 13:25:14 -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 10021 invoked by uid 99); 14 Mar 2013 13:25:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Mar 2013 13:25:14 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.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, 14 Mar 2013 13:25:12 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id CE5D1238890D; Thu, 14 Mar 2013 13:23:07 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r1456419 - in /cxf/branches/2.5.x-fixes: ./ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ systests/uncategorized/src/test/java/org/apache/cxf/cxf2006/ systests/uncategorized/src/test/resources/wsdl_systest/ Date: Thu, 14 Mar 2013 13:23:07 -0000 To: commits@cxf.apache.org From: ffang@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130314132307.CE5D1238890D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ffang Date: Thu Mar 14 13:23:07 2013 New Revision: 1456419 URL: http://svn.apache.org/r1456419 Log: Merged revisions 1456416 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes ................ r1456416 | ffang | 2013-03-14 21:14:16 +0800 (四, 14 3 2013) | 16 lines Merged revisions 1456405 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes ................ r1456405 | ffang | 2013-03-14 20:37:14 +0800 (四, 14 3 2013) | 9 lines Merged revisions 1456402 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r1456402 | ffang | 2013-03-14 20:26:25 +0800 (四, 14 3 2013) | 1 line [CXF-4876]CXF RespectBinding feature does not support the customized binding info under operation and its sub element ........ ................ ................ Added: cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/resources/wsdl_systest/cxf_operation_input_respectbing.wsdl - copied unchanged from r1456416, cxf/branches/2.6.x-fixes/systests/uncategorized/src/test/resources/wsdl_systest/cxf_operation_input_respectbing.wsdl cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/resources/wsdl_systest/cxf_operation_output_respectbing.wsdl - copied unchanged from r1456416, cxf/branches/2.6.x-fixes/systests/uncategorized/src/test/resources/wsdl_systest/cxf_operation_output_respectbing.wsdl cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/resources/wsdl_systest/cxf_operation_respectbing.wsdl - copied unchanged from r1456416, cxf/branches/2.6.x-fixes/systests/uncategorized/src/test/resources/wsdl_systest/cxf_operation_respectbing.wsdl Modified: cxf/branches/2.5.x-fixes/ (props changed) cxf/branches/2.5.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/cxf2006/RespectBindingFeatureClientServerTest.java cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/cxf2006/Server.java Propchange: cxf/branches/2.5.x-fixes/ ------------------------------------------------------------------------------ Merged /cxf/branches/2.7.x-fixes:r1456405 Merged /cxf/trunk:r1456402 Merged /cxf/branches/2.6.x-fixes:r1456416 Propchange: cxf/branches/2.5.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.5.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java?rev=1456419&r1=1456418&r2=1456419&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java (original) +++ cxf/branches/2.5.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java Thu Mar 14 13:23:07 2013 @@ -21,6 +21,7 @@ package org.apache.cxf.jaxws.support; import java.lang.reflect.Method; import java.util.ArrayList; +import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.logging.Logger; @@ -77,9 +78,13 @@ import org.apache.cxf.jaxws.interceptors import org.apache.cxf.jaxws.spi.ProviderImpl; import org.apache.cxf.message.Message; import org.apache.cxf.service.Service; +import org.apache.cxf.service.model.BindingFaultInfo; import org.apache.cxf.service.model.BindingInfo; +import org.apache.cxf.service.model.BindingMessageInfo; +import org.apache.cxf.service.model.BindingOperationInfo; import org.apache.cxf.service.model.DescriptionInfo; import org.apache.cxf.service.model.EndpointInfo; +import org.apache.cxf.service.model.Extensible; import org.apache.cxf.staxutils.W3CDOMStreamWriter; import org.apache.cxf.ws.addressing.EndpointReferenceType; import org.apache.cxf.ws.addressing.JAXWSAConstants; @@ -90,6 +95,7 @@ import org.apache.cxf.ws.policy.PolicyCo import org.apache.cxf.wsdl.WSDLManager; import org.apache.neethi.Constants; + /** * A JAX-WS specific implementation of the CXF {@link org.apache.cxf.endpoint.Endpoint} interface. * Extends the interceptor provider functionality of its base class by adding @@ -200,11 +206,41 @@ public class JaxWsEndpointImpl extends E } private void extractWsdlExtensibilities(EndpointInfo endpoint) { - List bindingExtensors - = endpoint.getBinding().getExtensors(ExtensibilityElement.class); - List portExtensors - = endpoint.getExtensors(ExtensibilityElement.class); + List portExtensors = getExtensors(endpoint); + List bindingExtensors = getExtensors(endpoint.getBinding()); + + //check the extensions under checkRespectBindingFeature(bindingExtensors); + + Collection bindingOperations = endpoint.getBinding().getOperations(); + if (null != bindingOperations) { + Iterator iterator = bindingOperations.iterator(); + while (iterator.hasNext()) { + BindingOperationInfo operationInfo = iterator.next(); + BindingMessageInfo inputInfo = operationInfo.getInput(); + BindingMessageInfo outputnfo = operationInfo.getOutput(); + Collection faults = operationInfo.getFaults(); + + //check the extensions under + checkRespectBindingFeature(getExtensors(operationInfo)); + //check the extensions under + checkRespectBindingFeature(getExtensors(inputInfo)); + //check the extensions under + checkRespectBindingFeature(getExtensors(outputnfo)); + if (null != faults) { + Iterator faultIterator = faults.iterator(); + while (faultIterator.hasNext()) { + BindingFaultInfo faultInfo = faultIterator.next(); + + //check the extensions under + checkRespectBindingFeature(getExtensors(faultInfo)); + } + } + + } + } + + if (hasUsingAddressing(bindingExtensors) || hasUsingAddressing(portExtensors)) { WSAddressingFeature feature = new WSAddressingFeature(); if (addressingRequired(bindingExtensors) @@ -216,6 +252,10 @@ public class JaxWsEndpointImpl extends E extractWsdlEprs(endpoint); } + private List getExtensors(Extensible extensibleInfo) { + return (null != extensibleInfo) ? extensibleInfo.getExtensors(ExtensibilityElement.class) : null; + } + private void checkRespectBindingFeature(List bindingExtensors) { if (bindingExtensors != null) { Iterator extensionElements = bindingExtensors.iterator(); Modified: cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/cxf2006/RespectBindingFeatureClientServerTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/cxf2006/RespectBindingFeatureClientServerTest.java?rev=1456419&r1=1456418&r2=1456419&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/cxf2006/RespectBindingFeatureClientServerTest.java (original) +++ cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/cxf2006/RespectBindingFeatureClientServerTest.java Thu Mar 14 13:23:07 2013 @@ -21,25 +21,42 @@ package org.apache.cxf.cxf2006; import javax.xml.namespace.QName; import javax.xml.ws.RespectBindingFeature; + import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase; +import org.apache.cxf.testutil.common.ServerLauncher; import org.apache.hello_world_rpclit.GreeterRPCLit; import org.apache.hello_world_rpclit.SOAPServiceRPCLit; -import org.junit.BeforeClass; +import org.junit.After; import org.junit.Test; public class RespectBindingFeatureClientServerTest extends AbstractBusClientServerTestBase { public static final String PORT = Server.PORT; private final QName portName = new QName("http://apache.org/hello_world_rpclit", "SoapPortRPCLit"); private SOAPServiceRPCLit service = new SOAPServiceRPCLit(); - - @BeforeClass - public static void startServers() throws Exception { - assertTrue("server did not launch correctly", launchServer(Server.class, true)); + private ServerLauncher serverLauncher; + + @After + public void tearDown() throws Exception { + if (null != serverLauncher) { + serverLauncher.signalStop(); + serverLauncher.stopServer(); + } + } + + private void startServers(String wsdlLocation) throws Exception { + String[] args = new String[] {wsdlLocation}; + + serverLauncher = new ServerLauncher(Server.class.getName(), null, args, true); + boolean isServerReady = serverLauncher.launchServer(); + + assertTrue("server did not launch correctly", isServerReady); createStaticBus(); } @Test public void testRespectBindingFeature() throws Exception { + startServers("/wsdl_systest/cxf2006.wsdl"); + try { GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class, new RespectBindingFeature(true)); @@ -52,10 +69,62 @@ public class RespectBindingFeatureClient ex.getMessage().indexOf("extension with required=true attribute") > -1); } } - + + @Test + public void testOperationRespectBindingFeature() throws Exception { + startServers("/wsdl_systest/cxf_operation_respectbing.wsdl"); + + try { + GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class, + new RespectBindingFeature(true)); + updateAddressPort(greeter, PORT); + greeter.greetMe("hello"); + fail("WebServiceException is expected"); + } catch (Exception ex) { + assertTrue("WebServiceException is expected", ex instanceof javax.xml.ws.WebServiceException); + assertTrue("RespectBindingFeature message is expected: " + ex.getMessage(), + ex.getMessage().indexOf("extension with required=true attribute") > -1); + } + } + + @Test + public void testOperationInputRespectBindingFeature() throws Exception { + startServers("/wsdl_systest/cxf_operation_input_respectbing.wsdl"); + + try { + GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class, + new RespectBindingFeature(true)); + updateAddressPort(greeter, PORT); + greeter.greetMe("hello"); + fail("WebServiceException is expected"); + } catch (Exception ex) { + assertTrue("WebServiceException is expected", ex instanceof javax.xml.ws.WebServiceException); + assertTrue("RespectBindingFeature message is expected: " + ex.getMessage(), + ex.getMessage().indexOf("extension with required=true attribute") > -1); + } + } + + @Test + public void testOperationOutputRespectBindingFeature() throws Exception { + startServers("/wsdl_systest/cxf_operation_output_respectbing.wsdl"); + + try { + GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class, + new RespectBindingFeature(true)); + updateAddressPort(greeter, PORT); + greeter.greetMe("hello"); + fail("WebServiceException is expected"); + } catch (Exception ex) { + assertTrue("WebServiceException is expected", ex instanceof javax.xml.ws.WebServiceException); + assertTrue("RespectBindingFeature message is expected: " + ex.getMessage(), + ex.getMessage().indexOf("extension with required=true attribute") > -1); + } + } + @Test public void testRespectBindingFeatureFalse() throws Exception { - + startServers("/wsdl_systest/cxf2006.wsdl"); + GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class, new RespectBindingFeature(false)); updateAddressPort(greeter, PORT); Modified: cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/cxf2006/Server.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/cxf2006/Server.java?rev=1456419&r1=1456418&r2=1456419&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/cxf2006/Server.java (original) +++ cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/cxf2006/Server.java Thu Mar 14 13:23:07 2013 @@ -32,6 +32,15 @@ import org.apache.hello_world_soap_http. public class Server extends AbstractBusTestServerBase { public static final String PORT = allocatePort(Server.class); Endpoint ep; + String wsdlLocation; + + public Server() { + this(new String[] {"/wsdl_systest/cxf2006.wsdl"}); + } + + public Server(String[] args) { + wsdlLocation = args.length > 0 ? args[0] : "/wsdl_systest/cxf2006.wsdl"; + } protected void run() { String address; @@ -39,7 +48,7 @@ public class Server extends AbstractBusT address = "http://localhost:" + PORT + "/SOAPServiceRPCLit/SoapPort"; ep = Endpoint.create(implementor); - URL wsdl = getClass().getResource("/wsdl_systest/cxf2006.wsdl"); + URL wsdl = getClass().getResource(wsdlLocation); ((EndpointImpl)ep).setWsdlLocation(wsdl.toString()); ((EndpointImpl)ep).getInInterceptors().add(new LoggingInInterceptor()); ((EndpointImpl)ep).getOutInterceptors().add(new LoggingOutInterceptor());