cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r1456405 - in /cxf/branches/2.7.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 12:37:14 GMT
Author: ffang
Date: Thu Mar 14 12:37:14 2013
New Revision: 1456405

URL: http://svn.apache.org/r1456405
Log:
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.7.x-fixes/systests/uncategorized/src/test/resources/wsdl_systest/cxf_operation_input_respectbing.wsdl
      - copied unchanged from r1456402, cxf/trunk/systests/uncategorized/src/test/resources/wsdl_systest/cxf_operation_input_respectbing.wsdl
    cxf/branches/2.7.x-fixes/systests/uncategorized/src/test/resources/wsdl_systest/cxf_operation_output_respectbing.wsdl
      - copied unchanged from r1456402, cxf/trunk/systests/uncategorized/src/test/resources/wsdl_systest/cxf_operation_output_respectbing.wsdl
    cxf/branches/2.7.x-fixes/systests/uncategorized/src/test/resources/wsdl_systest/cxf_operation_respectbing.wsdl
      - copied unchanged from r1456402, cxf/trunk/systests/uncategorized/src/test/resources/wsdl_systest/cxf_operation_respectbing.wsdl
Modified:
    cxf/branches/2.7.x-fixes/   (props changed)
    cxf/branches/2.7.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java
    cxf/branches/2.7.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/cxf2006/RespectBindingFeatureClientServerTest.java
    cxf/branches/2.7.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/cxf2006/Server.java

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1456402

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java?rev=1456405&r1=1456404&r2=1456405&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java
Thu Mar 14 12:37:14 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;
@@ -78,9 +79,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;
@@ -88,6 +93,7 @@ import org.apache.cxf.ws.addressing.Name
 import org.apache.cxf.ws.addressing.WSAddressingFeature;
 import org.apache.cxf.wsdl.WSDLManager;
 
+
 /**
  * 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 
@@ -202,11 +208,41 @@ public class JaxWsEndpointImpl extends E
     }
     
     private void extractWsdlExtensibilities(EndpointInfo endpoint) {
-        List<ExtensibilityElement> bindingExtensors 
-            = endpoint.getBinding().getExtensors(ExtensibilityElement.class);
-        List<ExtensibilityElement> portExtensors 
-            = endpoint.getExtensors(ExtensibilityElement.class);
+        List<ExtensibilityElement> portExtensors = getExtensors(endpoint);
+        List<ExtensibilityElement> bindingExtensors = getExtensors(endpoint.getBinding());
       
+        
+        //check the extensions under <wsdl:binding>
         checkRespectBindingFeature(bindingExtensors);
+        
+        Collection<BindingOperationInfo> bindingOperations = endpoint.getBinding().getOperations();
+        if (null != bindingOperations) {
+            Iterator<BindingOperationInfo> iterator = bindingOperations.iterator();
+            while (iterator.hasNext()) {
+                BindingOperationInfo operationInfo = iterator.next();
+                BindingMessageInfo inputInfo = operationInfo.getInput();
+                BindingMessageInfo outputnfo = operationInfo.getOutput();
+                Collection<BindingFaultInfo> faults = operationInfo.getFaults();
+                
+                //check the extensions under <wsdl:operation>
+                checkRespectBindingFeature(getExtensors(operationInfo));
+                //check the extensions under <wsdl:input>
+                checkRespectBindingFeature(getExtensors(inputInfo));
+                //check the extensions under <wsdl:output>
+                checkRespectBindingFeature(getExtensors(outputnfo));
+                if (null != faults) {
+                    Iterator<BindingFaultInfo> faultIterator = faults.iterator();
+                    while (faultIterator.hasNext()) {
+                        BindingFaultInfo faultInfo = faultIterator.next();
+                        
+                        //check the extensions under <wsdl:fault>
+                        checkRespectBindingFeature(getExtensors(faultInfo));
+                    }
+                }
+                
+            }
+        }
+
+        
         if (hasUsingAddressing(bindingExtensors) || hasUsingAddressing(portExtensors)) {
             WSAddressingFeature feature = new WSAddressingFeature();
             if (addressingRequired(bindingExtensors)
@@ -218,6 +254,10 @@ public class JaxWsEndpointImpl extends E
         extractWsdlEprs(endpoint);
     }
     
+    private List<ExtensibilityElement> getExtensors(Extensible extensibleInfo) {
+        return (null != extensibleInfo) ? extensibleInfo.getExtensors(ExtensibilityElement.class)
: null;
+    }
+    
     private void checkRespectBindingFeature(List<ExtensibilityElement> bindingExtensors)
{
         if (bindingExtensors != null) {
             Iterator<ExtensibilityElement> extensionElements = bindingExtensors.iterator();

Modified: cxf/branches/2.7.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/cxf2006/RespectBindingFeatureClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/cxf2006/RespectBindingFeatureClientServerTest.java?rev=1456405&r1=1456404&r2=1456405&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/cxf2006/RespectBindingFeatureClientServerTest.java
(original)
+++ cxf/branches/2.7.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/cxf2006/RespectBindingFeatureClientServerTest.java
Thu Mar 14 12:37:14 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.7.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/cxf2006/Server.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/cxf2006/Server.java?rev=1456405&r1=1456404&r2=1456405&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/cxf2006/Server.java
(original)
+++ cxf/branches/2.7.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/cxf2006/Server.java
Thu Mar 14 12:37:14 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());



Mime
View raw message