cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r1171503 - in /cxf/branches/2.3.x-fixes: ./ tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/ tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/ tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/...
Date Fri, 16 Sep 2011 10:59:26 GMT
Author: ffang
Date: Fri Sep 16 10:59:25 2011
New Revision: 1171503

URL: http://svn.apache.org/viewvc?rev=1171503&view=rev
Log:
Merged revisions 1171498 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.4.x-fixes

................
  r1171498 | ffang | 2011-09-16 18:50:33 +0800 (五, 16  9 2011) | 9 lines
  
  Merged revisions 1171492 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r1171492 | ffang | 2011-09-16 18:26:25 +0800 (五, 16  9 2011) | 1 line
    
    [CXF-3125]Add -validate option to wsdl2service
  ........
................

Added:
    cxf/branches/2.3.x-fixes/tools/wsdlto/misc/src/test/resources/misctools_wsdl/hello_world_mixed_style.wsdl
      - copied unchanged from r1171498, cxf/branches/2.4.x-fixes/tools/wsdlto/misc/src/test/resources/misctools_wsdl/hello_world_mixed_style.wsdl
Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/AbstractWSDLToProcessor.java
    cxf/branches/2.3.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/wsdl2service.xml
    cxf/branches/2.3.x-fixes/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessorTest.java

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

Modified: cxf/branches/2.3.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/AbstractWSDLToProcessor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/AbstractWSDLToProcessor.java?rev=1171503&r1=1171502&r2=1171503&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/AbstractWSDLToProcessor.java
(original)
+++ cxf/branches/2.3.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/AbstractWSDLToProcessor.java
Fri Sep 16 10:59:25 2011
@@ -115,6 +115,9 @@ public class AbstractWSDLToProcessor imp
         }
         WSDLDefinitionBuilder builder = new WSDLDefinitionBuilder(bus);
         wsdlDefinition = builder.build(wsdlURL);
+        if (env.optionSet(ToolConstants.CFG_VALIDATE_WSDL)) {
+            validate(wsdlDefinition, env, bus);
+        }
         WSDLManager mgr = bus.getExtension(WSDLManager.class);
         mgr.removeDefinition(wsdlDefinition);
         
@@ -194,5 +197,9 @@ public class AbstractWSDLToProcessor imp
             System.err.println("Parsing schema warning " + exception.toString());
         }
     }
+    
+    public boolean validate(final Definition def, ToolContext context, Bus bus) throws ToolException
{
+        return new WSDL11Validator(def, context, bus).isValid();
+    }
 
 }

Modified: cxf/branches/2.3.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/wsdl2service.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/wsdl2service.xml?rev=1171503&r1=1171502&r2=1171503&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/wsdl2service.xml
(original)
+++ cxf/branches/2.3.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/wsdl2service.xml
Fri Sep 16 10:59:25 2011
@@ -233,6 +233,14 @@ wsdl2service -transport http -e servicen
 				<switch>quiet</switch>
 				<switch>q</switch>
 		    </option>
+                    <option id="validate" maxOccurs="1">
+                        <annotation>
+                            To validate the wsdl before generating the wsdl service part.
 Usage of
+                            this option is highly recommended.
+                        </annotation>
+                        <switch>validate</switch>
+                    </option>
+
 		</optionGroup>
 		
 		<argument id="wsdlurl" minOccurs="1" maxOccurs="1">

Modified: cxf/branches/2.3.x-fixes/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessorTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessorTest.java?rev=1171503&r1=1171502&r2=1171503&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessorTest.java
(original)
+++ cxf/branches/2.3.x-fixes/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessorTest.java
Fri Sep 16 10:59:25 2011
@@ -350,4 +350,30 @@ public class WSDLToServiceProcessorTest 
             }
         }
     }
+    
+    @Test
+    public void testWSDLValidation() throws Exception {
+        //intend to use a wsdl which will break WSIBPValidator
+        
+        WSDLToServiceProcessor processor = new WSDLToServiceProcessor();
+
+        env.put(ToolConstants.CFG_WSDLURL, getLocation("/misctools_wsdl/hello_world_mixed_style.wsdl"));
+        env.put(ToolConstants.CFG_TRANSPORT, new String("soap"));
+        env.put(ToolConstants.CFG_BINDING_ATTR, new String("Greeter_SOAPBinding"));
+        env.put(ToolConstants.CFG_SERVICE, new String("serviceins"));
+        env.put(ToolConstants.CFG_PORT, new String("portins"));
+        env.put(ToolConstants.CFG_VALIDATE_WSDL, ToolConstants.CFG_VALIDATE_WSDL);
+        processor.setEnvironment(env);
+        
+        try {
+            processor.process();
+            fail("Do not catch expected tool exception for breaking WSIBPValidator!");
+        } catch (Exception e) {
+            if (!(e instanceof ToolException && e.toString()
+                .indexOf("Mixed style, invalid WSDL") >= 0)) {
+                fail("Do not catch tool exception for breaking WSIBPValidator!, "
+                     + "catch other unexpected exception!");
+            }
+        }
+    }
 }



Mime
View raw message