Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 881CEC992 for ; Thu, 3 May 2012 20:33:07 +0000 (UTC) Received: (qmail 55068 invoked by uid 500); 3 May 2012 20:33:07 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 55018 invoked by uid 500); 3 May 2012 20:33:07 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 55010 invoked by uid 99); 3 May 2012 20:33:07 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 May 2012 20:33:07 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 May 2012 20:33:05 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 61CC42388847; Thu, 3 May 2012 20:32:45 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1333608 - in /cxf/trunk: maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/ maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/ systests/jaxws/ tools/common/src/main/java/org/apach... Date: Thu, 03 May 2012 20:32:44 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120503203245.61CC42388847@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dkulp Date: Thu May 3 20:32:43 2012 New Revision: 1333608 URL: http://svn.apache.org/viewvc?rev=1333608&view=rev Log: [CXF-4287] Modify -validate switch to allow completely turning off all validation. Modified: cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/Option.java cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WsdlOption.java cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/Option.java cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WsdlOption.java cxf/trunk/systests/jaxws/pom.xml cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.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 cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/AbstractWSDLToProcessor.java Modified: cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/Option.java URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/Option.java?rev=1333608&r1=1333607&r2=1333608&view=diff ============================================================================== --- cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/Option.java (original) +++ cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/Option.java Thu May 3 20:32:43 2012 @@ -139,7 +139,7 @@ public class Option { /** * Enables validating the WSDL before generating the code. */ - Boolean validateWsdl; + String validateWsdl; /** @@ -340,13 +340,18 @@ public class Option { this.extendedSoapHeaders = extendedSoapHeaders; } - public boolean isValidateWsdl() { - return validateWsdl == null ? false : validateWsdl; + public String getValidateWsdl() { + return validateWsdl; } - public void setValidateWsdl(boolean validateWsdl) { + public void setValidateWsdl(String validateWsdl) { + System.out.println("Validate: " + validateWsdl); this.validateWsdl = validateWsdl; } + public void setValidate(String v) { + System.out.println("Validate: " + v); + this.validateWsdl = v; + } public boolean isNoTypes() { return noTypes == null ? false : noTypes; @@ -446,7 +451,7 @@ public class Option { destination.setOutputDir(getOutputDir()); destination.setPackagenames(getPackagenames()); destination.setServiceName(getServiceName()); - destination.setValidateWsdl(isValidateWsdl()); + destination.setValidateWsdl(getValidateWsdl()); destination.setNoTypes(isNoTypes()); destination.setFaultSerialVersionUID(getFaultSerialVersionUID()); destination.setMarkGenerated(isMarkGenerated()); Modified: cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WsdlOption.java URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WsdlOption.java?rev=1333608&r1=1333607&r2=1333608&view=diff ============================================================================== --- cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WsdlOption.java (original) +++ cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WsdlOption.java Thu May 3 20:32:43 2012 @@ -165,7 +165,9 @@ public class WsdlOption extends Option i } addIfTrue(list, isNoTypes(), "-noTypes"); addIfTrue(list, isAllowElementRefs(), "-" + ToolConstants.CFG_ALLOW_ELEMENT_REFS); - addIfTrue(list, isValidateWsdl(), "-" + ToolConstants.CFG_VALIDATE_WSDL); + if (getValidateWsdl() != null) { + list.add("-validate=" + getValidateWsdl()); + } addIfTrue(list, isMarkGenerated() != null && isMarkGenerated(), "-" + ToolConstants.CFG_MARK_GENERATED); addIfNotNull(list, getDefaultExcludesNamespace(), "-dex"); Modified: cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/Option.java URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/Option.java?rev=1333608&r1=1333607&r2=1333608&view=diff ============================================================================== --- cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/Option.java (original) +++ cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/Option.java Thu May 3 20:32:43 2012 @@ -81,7 +81,7 @@ public class Option { /** * Whether to validate the WSDL. */ - Boolean validate; + String validate; /** * The wsdl version. */ @@ -103,7 +103,7 @@ public class Option { output = other.getOutput(); } if (validate == null) { - validate = other.isValidate(); + validate = other.getValidate(); } if (wsdlVersion == null) { wsdlVersion = other.getWsdlVersion(); @@ -159,15 +159,15 @@ public class Option { /** * @return Validating the WSDL? */ - public Boolean isValidate() { + public String getValidate() { return validate; } /** * Control WSDL validation. - * @param validate true to validate. + * @param validate true or all to validate. */ - public void setValidate(Boolean validate) { + public void setValidate(String validate) { this.validate = validate; } Modified: cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WsdlOption.java URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WsdlOption.java?rev=1333608&r1=1333607&r2=1333608&view=diff ============================================================================== --- cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WsdlOption.java (original) +++ cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WsdlOption.java Thu May 3 20:32:43 2012 @@ -98,8 +98,8 @@ public class WsdlOption extends Option i } else { options.add(outputDirFile.getAbsolutePath()); } - if (validate != null && validate) { - options.add("-validate"); + if (validate != null) { + options.add("-validate=" + validate); } if (debug) { options.add("-v"); Modified: cxf/trunk/systests/jaxws/pom.xml URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/pom.xml?rev=1333608&r1=1333607&r2=1333608&view=diff ============================================================================== --- cxf/trunk/systests/jaxws/pom.xml (original) +++ cxf/trunk/systests/jaxws/pom.xml Thu May 3 20:32:43 2012 @@ -46,6 +46,9 @@ ${cxf.codegenplugin.forkmode} ${basedir}/target/generated/src/test/java ${basedir}/src/test/resources/wsdl_systest_jaxws + + basic + wsdl2java Modified: cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java URL: http://svn.apache.org/viewvc/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java?rev=1333608&r1=1333607&r2=1333608&view=diff ============================================================================== --- cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java (original) +++ cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java Thu May 3 20:32:43 2012 @@ -167,9 +167,25 @@ public class ToolContext { } // REVIST: Prefer using optionSet, to keep the context clean - public boolean validateWSDL() { - return get(ToolConstants.CFG_VALIDATE_WSDL) != null; - + public boolean fullValidateWSDL() { + Object s = get(ToolConstants.CFG_VALIDATE_WSDL); + if (s instanceof String && ((String)s).length() > 0 && ((String)s).charAt(0) == '=') { + s = ((String)s).substring(1); + } + if (s == null || "none".equals(s) || "false".equals(s) || "basic".equals(s)) { + return false; + } + return true; + } + public boolean basicValidateWSDL() { + Object s = get(ToolConstants.CFG_VALIDATE_WSDL); + if (s instanceof String && ((String)s).length() > 0 && ((String)s).charAt(0) == '=') { + s = ((String)s).substring(1); + } + if ("none".equals(s) || "false".equals(s)) { + return false; + } + return true; } public void addNamespacePackageMap(String namespace, String pn) { 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=1333608&r1=1333607&r2=1333608&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 Thu May 3 20:32:43 2012 @@ -56,7 +56,7 @@ public class WSDLValidator extends Abstr if (isVerboseOn()) { env.put(ToolConstants.CFG_VERBOSE, Boolean.TRUE); } - env.put(ToolConstants.CFG_VALIDATE_WSDL, Boolean.TRUE); + env.put(ToolConstants.CFG_VALIDATE_WSDL, "all"); env.put(ToolConstants.CFG_CMD_ARG, getArgument()); @@ -73,7 +73,7 @@ public class WSDLValidator extends Abstr if (isVerboseOn()) { env.put(ToolConstants.CFG_VERBOSE, Boolean.TRUE); } - env.put(ToolConstants.CFG_VALIDATE_WSDL, Boolean.TRUE); + env.put(ToolConstants.CFG_VALIDATE_WSDL, "all"); env.put(ToolConstants.CFG_CMD_ARG, getArgument()); 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=1333608&r1=1333607&r2=1333608&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 Thu May 3 20:32:43 2012 @@ -121,7 +121,8 @@ public class WSDL11Validator extends Abs wsdlRefValidator.setSuppressWarnings(env.optionSet(ToolConstants.CFG_SUPPRESS_WARNINGS)); validators.add(wsdlRefValidator); - if (env.optionSet(ToolConstants.CFG_VALIDATE_WSDL)) { + + if (env.fullValidateWSDL()) { validators.add(new UniqueBodyPartsValidator(this.def)); validators.add(new WSIBPValidator(this.def)); validators.add(new MIMEBindingValidator(this.def)); @@ -139,7 +140,7 @@ public class WSDL11Validator extends Abs } // By default just use WsdlRefValidator - if (!env.optionSet(ToolConstants.CFG_VALIDATE_WSDL)) { + if (!env.fullValidateWSDL()) { return true; } Modified: cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java?rev=1333608&r1=1333607&r2=1333608&view=diff ============================================================================== --- cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java (original) +++ cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java Thu May 3 20:32:43 2012 @@ -242,10 +242,11 @@ public class WSDLToJavaContainer extends generateTypes(); for (ServiceInfo service : serviceList) { - context.put(ServiceInfo.class, service); - validate(service); + if (context.basicValidateWSDL()) { + validate(service); + } // Build the JavaModel from the ServiceModel processor.setEnvironment(context); Modified: cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java?rev=1333608&r1=1333607&r2=1333608&view=diff ============================================================================== --- cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java (original) +++ cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java Thu May 3 20:32:43 2012 @@ -578,7 +578,7 @@ public class JAXBDataBinding implements } Element ele = docs[0].getDocumentElement(); ele = removeImportElement(ele, key, catalog); - if (context.get(ToolConstants.CFG_VALIDATE_WSDL) != null) { + if (context.fullValidateWSDL()) { String uri = null; try { uri = docs[0].getDocumentURI(); @@ -653,7 +653,7 @@ public class JAXBDataBinding implements ids.add(key); Element ele = sci.getElement(); ele = removeImportElement(ele, key, catalog); - if (context.get(ToolConstants.CFG_VALIDATE_WSDL) != null) { + if (context.fullValidateWSDL()) { validateSchema(ele, sci.getSystemId(), catalog); } InputSource is = new InputSource((InputStream)null); Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml?rev=1333608&r1=1333607&r2=1333608&view=diff ============================================================================== --- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml (original) +++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml Thu May 3 20:32:43 2012 @@ -265,8 +265,14 @@ Examples: Modified: cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/AbstractWSDLToProcessor.java URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/AbstractWSDLToProcessor.java?rev=1333608&r1=1333607&r2=1333608&view=diff ============================================================================== --- cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/AbstractWSDLToProcessor.java (original) +++ cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/AbstractWSDLToProcessor.java Thu May 3 20:32:43 2012 @@ -115,7 +115,7 @@ public class AbstractWSDLToProcessor imp } WSDLDefinitionBuilder builder = new WSDLDefinitionBuilder(bus); wsdlDefinition = builder.build(wsdlURL); - if (env.optionSet(ToolConstants.CFG_VALIDATE_WSDL)) { + if (env.fullValidateWSDL()) { validate(wsdlDefinition, env, bus); } WSDLManager mgr = bus.getExtension(WSDLManager.class); @@ -154,7 +154,7 @@ public class AbstractWSDLToProcessor imp } public void validateWSDL() throws ToolException { - if (env.validateWSDL()) { + if (env.fullValidateWSDL()) { WSDL11Validator validator = new WSDL11Validator(this.wsdlDefinition, this.env); validator.isValid(); }