cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject svn commit: r590568 - in /incubator/cxf/trunk/tools: validator/src/main/java/org/apache/cxf/tools/validator/ validator/src/main/java/org/apache/cxf/tools/validator/internal/ wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/
Date Wed, 31 Oct 2007 06:00:33 GMT
Author: mmao
Date: Tue Oct 30 23:00:32 2007
New Revision: 590568

URL: http://svn.apache.org/viewvc?rev=590568&view=rev
Log:
CXF-1153 
 * WSDLValidator support recursive imports


Modified:
    incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/WSDLValidator.java
    incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
    incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java

Modified: incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/WSDLValidator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/WSDLValidator.java?rev=590568&r1=590567&r2=590568&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/WSDLValidator.java
(original)
+++ incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/WSDLValidator.java
Tue Oct 30 23:00:32 2007
@@ -58,7 +58,6 @@
                     env.put(ToolConstants.CFG_VERBOSE, Boolean.TRUE);
                 }
                 env.put(ToolConstants.CFG_VALIDATE_WSDL, Boolean.TRUE);
-                System.out.println("1########: " + env.optionSet(ToolConstants.CFG_VALIDATE_WSDL));
                 env.put(ToolConstants.CFG_CMD_ARG, getArgument());
 
               

Modified: incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java?rev=590568&r1=590567&r2=590568&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
(original)
+++ incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
Tue Oct 30 23:00:32 2007
@@ -74,6 +74,7 @@
 
     private Set<QName> portTypeRefNames = new HashSet<QName>();
     private Set<QName> messageRefNames = new HashSet<QName>();
+    private Map<QName, Service> services = new HashMap<QName, Service>();
 
     private ValidationResult vResults = new ValidationResult();
 
@@ -96,7 +97,6 @@
         WSDLDefinitionBuilder wsdlBuilder = new WSDLDefinitionBuilder();
         try {
             this.definition = wsdlBuilder.build(wsdl);
-            
             if (wsdlBuilder.getImportedDefinitions().size() > 0) {
                 importedDefinitions = new ArrayList<Definition>();
                 importedDefinitions.addAll(wsdlBuilder.getImportedDefinitions());
@@ -183,6 +183,7 @@
 
     public boolean isValid() {
         try {
+            loadServices();
 
             collectValidationPoints();
 
@@ -207,14 +208,21 @@
         return vResults.isSuccessful();
     }
 
-    private Map<QName, Service> getServices() {
-        Map<QName, Service> services = new HashMap<QName, Service>();
-        Iterator sNames = definition.getAllServices().keySet().iterator();
+    private void addServices(final Definition wsdlDef) {
+        Iterator sNames = wsdlDef.getServices().keySet().iterator();
         while (sNames.hasNext()) {
             QName sName = (QName) sNames.next();
             services.put(sName, definition.getService(sName));
         }
-        return services;
+    }
+
+    private void loadServices() {
+        addServices(this.definition);
+        if (importedDefinitions != null) {
+            for (Definition d : importedDefinitions) {
+                addServices(d);
+            }
+        }
     }
 
     private Map<QName, XNode> getBindings(Service service) {
@@ -333,7 +341,7 @@
 
     @SuppressWarnings("unchecked")
     private void collectValidationPoints() {
-        if (getServices().size() == 0) {
+        if (services.size() == 0) {
             addWarning("WSDL document does not define any services");
             portTypeRefNames.addAll(this.definition.getAllPortTypes().keySet());
         } else {
@@ -346,7 +354,7 @@
 
     private void collectValidationPointsForBindings() {
         Map<QName, XNode> vBindingNodes = new HashMap<QName, XNode>();
-        for (Service service : getServices().values()) {
+        for (Service service : services.values()) {
             vBindingNodes.putAll(getBindings(service));
         }
 

Modified: incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?rev=590568&r1=590567&r2=590568&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
Tue Oct 30 23:00:32 2007
@@ -40,7 +40,6 @@
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.validator.UniqueBodyValidator;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.mortbay.jetty.Server;
 import org.mortbay.jetty.handler.ResourceHandler;
@@ -559,7 +558,6 @@
     }
     
     @Test
-    @Ignore("WsdlValidator failed with the wsdl")
     public void testRecursiveImport() throws Exception {
         env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/cxf778/hello_world_recursive.wsdl"));
         processor.setContext(env);



Mime
View raw message