cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1001676 - in /cxf/branches/2.2.x-fixes: ./ rt/core/src/main/java/org/apache/cxf/wsdl11/ rt/core/src/test/java/org/apache/cxf/wsdl11/
Date Mon, 27 Sep 2010 11:40:18 GMT
Author: ningjiang
Date: Mon Sep 27 11:40:17 2010
New Revision: 1001676

URL: http://svn.apache.org/viewvc?rev=1001676&view=rev
Log:
Merged revisions 1001649 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1001649 | ningjiang | 2010-09-27 17:53:15 +0800 (Mon, 27 Sep 2010) | 1 line
  
  CXF-3007 WSDLServiceFactory should throw exception if the service factory cannot build the
service with a wrong port name
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/Messages.properties
    cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceFactory.java
    cxf/branches/2.2.x-fixes/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 27 11:40:17 2010
@@ -1 +1 @@
-/cxf/trunk:998736,1001520,1001619
+/cxf/trunk:998736,1001520,1001619,1001649

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

Modified: cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/Messages.properties?rev=1001676&r1=1001675&r2=1001676&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/Messages.properties
(original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/Messages.properties
Mon Sep 27 11:40:17 2010
@@ -26,6 +26,7 @@ WSDL_GENERATION_BAD_RESULT_MSG = Generat
 EXTENSION_ADD_FAILED_MSG = Failed to add extension element.
 SERVICE_CREATION_MSG = Failed to create service.
 NO_SUCH_SERVICE_EXC = Could not find definition for service {0}.
+NO_SUCH_ENDPOINT_EXC = Could not find definition for port {0}.
 FAIL_TO_CREATE_WSDL_DEFINITION = Fail to create wsdl definition from : {0}\r\nCaused by :
{1} 
 MISSING_DESTINATION_FACTORY = Cannot find the destination factory, check the port //wsdl:port[@name=''{0}'']
 MISSING_SERVICE= No definition of service {0} in the WSDL.

Modified: cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceFactory.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceFactory.java?rev=1001676&r1=1001675&r2=1001676&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceFactory.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceFactory.java
Mon Sep 27 11:40:17 2010
@@ -129,6 +129,10 @@ public class WSDLServiceFactory extends 
                 services = new WSDLServiceBuilder(getBus()).buildServices(definition, 
                                                                           wsdlService,
                                                                           endpointName);
+                if (services.size() == 0) {
+                    throw new ServiceConstructionException(
+                        new Message("NO_SUCH_ENDPOINT_EXC", LOG, endpointName));
+                }
             } catch (XmlSchemaException ex) {
                 throw new ServiceConstructionException(new Message("SERVICE_CREATION_MSG",
LOG), ex);
             }

Modified: cxf/branches/2.2.x-fixes/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java?rev=1001676&r1=1001675&r2=1001676&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java
Mon Sep 27 11:40:17 2010
@@ -69,6 +69,7 @@ import org.apache.cxf.wsdl.EndpointRefer
 import org.apache.ws.commons.schema.XmlSchemaElement;
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;
+
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -104,8 +105,13 @@ public class WSDLServiceBuilderTest exte
     public void setUpBasic() throws Exception {
         setUpWSDL(WSDL_PATH, 0);
     }
-
+    
     private void setUpWSDL(String wsdl, int serviceSeq) throws Exception {
+        setUpDefinition(wsdl, serviceSeq);
+        buildService();
+    }
+    
+    private void setUpDefinition(String wsdl, int serviceSeq) throws Exception {
         URL url = getClass().getResource(wsdl);
         assertNotNull("could not find wsdl " + wsdl, url);
         String wsdlUrl = url.toString();
@@ -127,7 +133,13 @@ public class WSDLServiceBuilderTest exte
                 }
             }
         }
+    }
+    
+    private void buildService() throws Exception {
+        buildService(null);       
+    }
 
+    private void buildService(QName endpointName) throws Exception {
         control = EasyMock.createNiceControl();
         bus = control.createMock(Bus.class);
         bindingFactoryManager = control.createMock(BindingFactoryManager.class);
@@ -148,10 +160,23 @@ public class WSDLServiceBuilderTest exte
         
 
         control.replay();
-        serviceInfos = wsdlServiceBuilder.buildServices(def, service);
-        serviceInfo = serviceInfos.get(0);
+        serviceInfos = wsdlServiceBuilder.buildServices(def, service, endpointName);
+        if (serviceInfos.size() > 0) {
+            serviceInfo = serviceInfos.get(0);
+        } else {
+            serviceInfo = null;
+        }
 
     }
+    
+    @Test 
+    public void testBuildServiceWithWrongEndpointName() throws Exception {
+        setUpWSDL(WSDL_PATH, 0);
+        buildService(new QName("http://apache.org/hello_world_soap_http",
+                "NoExitSoapPort"));
+        assertEquals("Should not build any serviceInfo.", 0, serviceInfos.size());
+        assertEquals("Should not build any serviceInfo.", null, serviceInfo);
+    }
 
     @Test
     public void testMultiPorttype() throws Exception {



Mime
View raw message