cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r660331 - in /cxf/trunk: maven-plugins/wsdl-validator-plugin/src/main/java/org/apache/cxf/maven_plugin/ testutils/ testutils/src/main/resources/wsdl/ tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/ tools/valid...
Date Mon, 26 May 2008 23:08:46 GMT
Author: bimargulies
Date: Mon May 26 16:08:39 2008
New Revision: 660331

URL: http://svn.apache.org/viewvc?rev=660331&view=rev
Log:
Improve the validator plugin, but turn it off in the build. Fix an old 
JIRA about output encodings.

Modified:
    cxf/trunk/maven-plugins/wsdl-validator-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDLValidatorMojo.java
    cxf/trunk/testutils/pom.xml
    cxf/trunk/testutils/src/main/resources/wsdl/hello_world_xml_bare.wsdl
    cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WSDL11Generator.java
    cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/WSDLValidator.java
    cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDL11Validator.java

Modified: cxf/trunk/maven-plugins/wsdl-validator-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDLValidatorMojo.java
URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/wsdl-validator-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDLValidatorMojo.java?rev=660331&r1=660330&r2=660331&view=diff
==============================================================================
--- cxf/trunk/maven-plugins/wsdl-validator-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDLValidatorMojo.java
(original)
+++ cxf/trunk/maven-plugins/wsdl-validator-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDLValidatorMojo.java
Mon May 26 16:08:39 2008
@@ -21,12 +21,13 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
 import org.apache.cxf.helpers.CastUtils;
-import org.apache.cxf.tools.common.toolspec.ToolRunner;
+import org.apache.cxf.tools.common.toolspec.ToolSpec;
 import org.apache.cxf.tools.validator.WSDLValidator;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
@@ -145,12 +146,22 @@
             try {
                 list.add(file.getCanonicalPath());
                 String[] pargs = list.toArray(new String[list.size()]);
-                ToolRunner.runTool(WSDLValidator.class, WSDLValidator.class
-                                   .getResourceAsStream("wsdlvalidator.xml"), false, pargs);
+                
+                InputStream toolspecStream = WSDLValidator.class
+                    .getResourceAsStream("wsdlvalidator.xml");
+                ToolSpec spec = new ToolSpec(toolspecStream, false);
+                toolspecStream.close();
+                WSDLValidator validator = new WSDLValidator(spec);
+                validator.setArguments(pargs);
+                boolean ok = validator.executeForMaven();
+                if (!ok) {
+                    throw new MojoExecutionException("WSDL failed validation: " + file.getName());
+                }
+
                 doneFile.createNewFile();
             } catch (Throwable e) {
-                getLog().debug(e);
-                throw new MojoExecutionException(e.getMessage(), e);
+                throw new MojoExecutionException(file.getName() + ": " 
+                                                 + e.getMessage(), e);
             }
         }
     }

Modified: cxf/trunk/testutils/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/testutils/pom.xml?rev=660331&r1=660330&r2=660331&view=diff
==============================================================================
--- cxf/trunk/testutils/pom.xml (original)
+++ cxf/trunk/testutils/pom.xml Mon May 26 16:08:39 2008
@@ -166,13 +166,13 @@
                    <wsdlRoot>${basedir}/src/main/resources/wsdl</wsdlRoot>
                 </configuration>
                 <executions>
-                    <execution>
+                    <!-- execution>
                         <id>validate</id>
                         <phase>validate</phase>
                         <goals>
                           <goal>wsdlvalidator</goal>
                         </goals>
-                    </execution>
+                    </execution -->
                   </executions>
             </plugin>
             <plugin>

Modified: cxf/trunk/testutils/src/main/resources/wsdl/hello_world_xml_bare.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_xml_bare.wsdl?rev=660331&r1=660330&r2=660331&view=diff
==============================================================================
--- cxf/trunk/testutils/src/main/resources/wsdl/hello_world_xml_bare.wsdl (original)
+++ cxf/trunk/testutils/src/main/resources/wsdl/hello_world_xml_bare.wsdl Mon May 26 16:08:39
2008
@@ -101,11 +101,11 @@
         </wsdl:operation>
         <wsdl:operation name="testTriPart" parameterOrder="in1 in3 in2">
             <wsdl:input message="tns:triPartRequest" name="triPartRequest"/>
-            <wsdl:output message="tns:multiParamPartResponse" name="multiParamPartResponse"/>
+            <wsdl:output message="tns:multiParamPartResponse" name="triPartResponse"/>
         </wsdl:operation>
         <wsdl:operation name="testTriPartNoOrder">
-            <wsdl:input message="tns:triPartRequest" name="triPartRequest"/>
-            <wsdl:output message="tns:multiParamPartResponse" name="multiParamPartResponse"/>
+            <wsdl:input message="tns:triPartRequest" name="triPartNoOrderRequest"/>
+            <wsdl:output message="tns:multiParamPartResponse" name="tryPartNoOrderPartResponse"/>
         </wsdl:operation>
     </wsdl:portType>
 

Modified: cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WSDL11Generator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WSDL11Generator.java?rev=660331&r1=660330&r2=660331&view=diff
==============================================================================
--- cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WSDL11Generator.java
(original)
+++ cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WSDL11Generator.java
Mon May 26 16:08:39 2008
@@ -25,6 +25,7 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
+import java.io.Writer;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
@@ -38,6 +39,7 @@
 import org.apache.cxf.service.model.SchemaInfo;
 import org.apache.cxf.tools.common.ToolException;
 import org.apache.cxf.tools.java2wsdl.generator.AbstractGenerator;
+import org.apache.cxf.tools.util.FileWriterUtil;
 import org.apache.cxf.wsdl11.ServiceWSDLBuilder;
 import org.apache.cxf.wsdl11.WSDLDefinitionBuilder;
 
@@ -58,8 +60,9 @@
         File outputdir = createOutputDir(file);
         Definition def = null;
         try {
-            OutputStream os = new BufferedOutputStream(new FileOutputStream(file));
+            Writer os = FileWriterUtil.getWriter(file);
             WSDLWriter wsdlWriter = WSDLFactory.newInstance().newWSDLWriter();
+
             ServiceWSDLBuilder builder = new ServiceWSDLBuilder(getBus(), getServiceModel());
             builder.setUseSchemaImports(this.allowImports());
 
@@ -90,7 +93,7 @@
 
             for (Map.Entry<String, SchemaInfo> imp : imports.entrySet()) {
                 File impfile = new File(file.getParentFile(), imp.getKey());
-                os = new BufferedOutputStream(new FileOutputStream(impfile));
+                os = FileWriterUtil.getWriter(impfile);
                 imp.getValue().getSchema().write(os);
                 os.close();
             }

Modified: cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/WSDLValidator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/WSDLValidator.java?rev=660331&r1=660330&r2=660331&view=diff
==============================================================================
--- cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/WSDLValidator.java
(original)
+++ cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/WSDLValidator.java
Mon May 26 16:08:39 2008
@@ -48,6 +48,21 @@
         set.add(ToolConstants.CFG_SCHEMA_URL);
         return set;
     }
+    
+    public boolean executeForMaven() {
+        super.execute(false);
+        ToolContext env = getContext();
+        env.setParameters(getParametersMap(getArrayKeys()));
+        if (isVerboseOn()) {
+            env.put(ToolConstants.CFG_VERBOSE, Boolean.TRUE);
+        }
+        env.put(ToolConstants.CFG_VALIDATE_WSDL, Boolean.TRUE);
+        env.put(ToolConstants.CFG_CMD_ARG, getArgument());
+
+      
+        WSDL11Validator wsdlValidator = new WSDL11Validator(null, env, getBus());
+        return wsdlValidator.isValid();
+    }
 
     public void execute(boolean exitOnFinish) {
         try {

Modified: cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDL11Validator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDL11Validator.java?rev=660331&r1=660330&r2=660331&view=diff
==============================================================================
--- cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDL11Validator.java
(original)
+++ cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDL11Validator.java
Mon May 26 16:08:39 2008
@@ -88,7 +88,7 @@
             }
             return XMLUtils.parse(new InputSource(URIParserUtil.getAbsoluteURI(nw)));
         } catch (FileNotFoundException fe) {
-            LOG.log(Level.WARNING, "Can not find the wsdl " + wsdl + "to validate");
+            LOG.log(Level.WARNING, "Cannot find the wsdl " + wsdl + "to validate");
             return null;
         } catch (Exception e) {
             throw new ToolException(e);



Mime
View raw message