asfgit closed pull request #324: RFC introduced: Supress generated date switch for wsdl2java URL: https://github.com/apache/cxf/pull/324
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/Option.java b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/Option.java index 283b6f534fc..bde505c3785 100644 --- a/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/Option.java +++ b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/Option.java @@ -169,6 +169,12 @@ */ Boolean markGenerated; + /** + * Prevents dumping current date as part of @Generated annotation as well as part of + * the javadocs of the Java files generated. + */ + Boolean suppressGeneratedDate; + /** * The WSDL service name to use for the generated code */ @@ -411,6 +417,14 @@ public void setMarkGenerated(Boolean markGenerated) { this.markGenerated = markGenerated; } + public Boolean isSuppressGeneratedDate() { + return suppressGeneratedDate; + } + + public void setSuppressGeneratedDate(Boolean suppressGeneratedDate) { + this.suppressGeneratedDate = suppressGeneratedDate; + } + public Boolean getDefaultExcludesNamespace() { return defaultExcludesNamespace; } @@ -481,6 +495,7 @@ public void copyOptions(Option destination) { destination.setNoTypes(isNoTypes()); destination.setFaultSerialVersionUID(getFaultSerialVersionUID()); destination.setMarkGenerated(isMarkGenerated()); + destination.setSuppressGeneratedDate(isSuppressGeneratedDate()); destination.setAllowElementRefs(isAllowElementRefs()); if (isSetWsdlLocation()) { destination.setWsdlLocation(getWsdlLocation()); @@ -509,6 +524,7 @@ public void merge(Option defaultOptions) { faultSerialVersionUID = setIfNull(faultSerialVersionUID, defaultOptions.faultSerialVersionUID); markGenerated = setIfNull(markGenerated, defaultOptions.markGenerated); + suppressGeneratedDate = setIfNull(suppressGeneratedDate, defaultOptions.suppressGeneratedDate); autoNameResolution = setIfNull(autoNameResolution, defaultOptions.autoNameResolution); noAddressBinding = setIfNull(noAddressBinding, defaultOptions.noAddressBinding); allowElementRefs = setIfNull(allowElementRefs, defaultOptions.allowElementRefs); diff --git a/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WsdlOption.java b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WsdlOption.java index 77d141b8dd4..ec8646484d0 100644 --- a/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WsdlOption.java +++ b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WsdlOption.java @@ -170,6 +170,8 @@ public String toString() { } addIfTrue(list, isMarkGenerated() != null && isMarkGenerated(), "-" + ToolConstants.CFG_MARK_GENERATED); + addIfTrue(list, isSuppressGeneratedDate() != null && isSuppressGeneratedDate(), + "-" + ToolConstants.CFG_SUPPRESS_GENERATED_DATE); addIfNotNull(list, getDefaultExcludesNamespace(), "-dex"); addIfNotNull(list, getDefaultNamespacePackageMapping(), "-dns"); addIfNotNull(list, getServiceName(), "-sn"); diff --git a/tools/common/src/main/java/org/apache/cxf/tools/common/ToolConstants.java b/tools/common/src/main/java/org/apache/cxf/tools/common/ToolConstants.java index 78209026968..5530ef541fe 100644 --- a/tools/common/src/main/java/org/apache/cxf/tools/common/ToolConstants.java +++ b/tools/common/src/main/java/org/apache/cxf/tools/common/ToolConstants.java @@ -101,7 +101,7 @@ public static final String CFG_EXCEPTION_SUPER = "exceptionSuper"; public static final String CFG_SEI_SUPER = "seiSuper"; public static final String CFG_MARK_GENERATED = "mark-generated"; - + public static final String CFG_SUPPRESS_GENERATED_DATE = "suppress-generated-date"; //Internal Flag to generate public static final String CFG_IMPL_CLASS = "implClass"; diff --git a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/wrapperbean.vm b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/wrapperbean.vm index 5aa751cefb4..abb82396026 100644 --- a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/wrapperbean.vm +++ b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/wrapperbean.vm @@ -23,7 +23,9 @@ import ${import}; /** * This class was generated by $fullversion +#if ($suppressGeneratedDate != "true") * $currentdate +#end * Generated source version: $version */ diff --git a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/build.xml.vm b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/build.xml.vm index 623fdc4aa67..8b0b3dfdc24 100644 --- a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/build.xml.vm +++ b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/build.xml.vm @@ -17,9 +17,11 @@ <?xml version="1.0"?> <!-- Generated by Java2WS. - + This file was generated by $fullversion +#if ($suppressGeneratedDate != "true") $currentdate +#end Generated source version: $version --> diff --git a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-client.vm b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-client.vm index d32434e81c8..bc09a75ebea 100644 --- a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-client.vm +++ b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-client.vm @@ -27,9 +27,11 @@ import javax.xml.ws.soap.SOAPBinding; /** * This class was generated by $fullversion +#if ($suppressGeneratedDate != "true") * $currentdate +#end * Generated source version: $version - * + * */ public class ${intf.Name}Client { @@ -39,9 +41,9 @@ public class ${intf.Name}Client { Service service = Service.create(serviceName); service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, - "${address}"); + "${address}"); ${intf.FullClassName} client = service.getPort(portName, ${intf.FullClassName}.class); - + // Insert code to invoke methods on the client here } diff --git a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-impl.vm b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-impl.vm index cac050a7320..03fd36d9c03 100644 --- a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-impl.vm +++ b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-impl.vm @@ -25,15 +25,17 @@ import javax.jws.WebService; /** * This class was generated by $fullversion +#if ($suppressGeneratedDate != "true") * $currentdate +#end * Generated source version: $version - * + * */ -@WebService(endpointInterface = "${intf.FullClassName}", serviceName = "${service.LocalPart}") +@WebService(endpointInterface = "${intf.FullClassName}", serviceName = "${service.LocalPart}") public class ${intf.Name}Impl implements $intf.Name { #foreach ($method in $intf.Methods) - public $method.return.ClassName ${method.Name}(#if($method.ParameterList.size() == 0))#end#if($method.ParameterList.size() != 0)#foreach ($param in ${method.ParameterList})$param#end)#end#if($method.Exceptions.size() > 0) throws#foreach($exception in $method.Exceptions) $exception.ClassName#if($method.Exceptions.size() != $foreach.count),#end#end#end { + public $method.return.ClassName ${method.Name}(#if($method.ParameterList.size() == 0))#end#if($method.ParameterList.size() != 0)#foreach ($param in ${method.ParameterList})$param#end)#end#if($method.Exceptions.size() > 0) throws#foreach($exception in $method.Exceptions) $exception.ClassName#if($method.Exceptions.size() != $foreach.count),#end#end#end { #foreach ($parameter in $method.Parameters) #if ($parameter.Style.toString() == "IN") System.out.println($parameter.Name);#end#end @@ -42,7 +44,7 @@ public class ${intf.Name}Impl implements $intf.Name { #set($paramValueName = "${parameter.Name}Value") ${parameter.writeDefaultValue(${out}, " ", ${method.Name}, ${paramValueName})} ${parameter.Name}.value = ${paramValueName}; - #end + #end #end #if ($method.return.ClassName != "void")try { @@ -54,7 +56,7 @@ public class ${intf.Name}Impl implements $intf.Name { } #end -#if ($method.Exceptions.size() > 0) +#if ($method.Exceptions.size() > 0) #foreach($exception in $method.Exceptions) //throw new ${exception.ClassName}("${exception.Name}..."); #end diff --git a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-sei.vm b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-sei.vm index 1307df9c042..2207126e4c5 100644 --- a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-sei.vm +++ b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-sei.vm @@ -28,9 +28,11 @@ import ${import}; /** * This class was generated by $fullversion +#if ($suppressGeneratedDate != "true") * $currentdate +#end * Generated source version: $version - * + * */ @WebService diff --git a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-server.vm b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-server.vm index f44299ad1e6..d957d491ef4 100644 --- a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-server.vm +++ b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-server.vm @@ -21,11 +21,13 @@ import javax.xml.ws.Endpoint; /** * This class was generated by $fullversion +#if ($suppressGeneratedDate != "true") * $currentdate +#end * Generated source version: $version - * + * */ - + public class ${intf.Name}Server{ protected ${intf.Name}Server() throws Exception { @@ -34,15 +36,14 @@ public class ${intf.Name}Server{ String address = "${address}"; Endpoint.publish(address, implementor); } - - public static void main(String args[]) throws Exception { + + public static void main(String args[]) throws Exception { new ${intf.Name}Server(); - System.out.println("Server ready..."); - - Thread.sleep(5 * 60 * 1000); + System.out.println("Server ready..."); + + Thread.sleep(5 * 60 * 1000); System.out.println("Server exiting"); System.exit(0); } } - - \ No newline at end of file + diff --git a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/client.vm b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/client.vm index e8984b27e46..b0236055a4c 100644 --- a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/client.vm +++ b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/client.vm @@ -28,11 +28,13 @@ import org.apache.cxf.aegis.databinding.AegisDatabinding; /** * This class was generated by $fullversion +#if ($suppressGeneratedDate != "true") * $currentdate +#end * Generated source version: $version */ public class ${intf.Name}Client { - + public static void main(String[] args) throws Exception { ClientProxyFactoryBean proxyFactory = new ClientProxyFactoryBean(); ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean(); @@ -42,8 +44,8 @@ import org.apache.cxf.aegis.databinding.AegisDatabinding; clientBean.setServiceClass(${seiClass}.class); proxyFactory.getServiceFactory().setDataBinding(new AegisDatabinding()); ${seiClass} client = (${seiClass})proxyFactory.create(); - + // Insert code to invoke methods on the client here } - + } \ No newline at end of file diff --git a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/impl.vm b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/impl.vm index ddc3235cf32..6e8153dcecd 100644 --- a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/impl.vm +++ b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/impl.vm @@ -24,15 +24,17 @@ package $intf.PackageName; /** * This class was generated by $fullversion +#if ($suppressGeneratedDate != "true") * $currentdate +#end * Generated source version: $version - * + * */ - + public class ${intf.Name}Impl implements ${seiClass} { #foreach ($method in $intf.Methods) - public $method.return.ClassName ${method.Name}(#if($method.ParameterList.size() == 0))#end#if($method.ParameterList.size() != 0)#foreach ($param in ${method.ParameterList})$param#end)#end#if($method.Exceptions.size() > 0) throws#foreach($exception in $method.Exceptions) $exception.ClassName#if($method.Exceptions.size() != $foreach.count),#end#end#end { + public $method.return.ClassName ${method.Name}(#if($method.ParameterList.size() == 0))#end#if($method.ParameterList.size() != 0)#foreach ($param in ${method.ParameterList})$param#end)#end#if($method.Exceptions.size() > 0) throws#foreach($exception in $method.Exceptions) $exception.ClassName#if($method.Exceptions.size() != $foreach.count),#end#end#end { #foreach ($parameter in $method.Parameters) #if ($parameter.Style.toString() == "IN") System.out.println($parameter.Name);#end#end @@ -41,7 +43,7 @@ public class ${intf.Name}Impl implements ${seiClass} { #set($paramValueName = "${parameter.Name}Value") ${parameter.writeDefaultValue(${out}, " ", ${method.Name}, ${paramValueName})} ${parameter.Name}.value = ${paramValueName}; - #end + #end #end #if ($method.return.ClassName != "void")try { @@ -53,7 +55,7 @@ public class ${intf.Name}Impl implements ${seiClass} { } #end -#if ($method.Exceptions.size() > 0) +#if ($method.Exceptions.size() > 0) #foreach($exception in $method.Exceptions) //throw new ${exception.ClassName}("${exception.Name}..."); #end diff --git a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/sei.vm b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/sei.vm index b0ce9bad0e1..b83fd726906 100644 --- a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/sei.vm +++ b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/sei.vm @@ -28,9 +28,11 @@ import ${import}; /** * This class was generated by $fullversion +#if ($suppressGeneratedDate != "true") * $currentdate +#end * Generated source version: $version - * + * */ diff --git a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/server.vm b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/server.vm index 38f3876dc8c..88ac5eaac90 100644 --- a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/server.vm +++ b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/server.vm @@ -27,9 +27,11 @@ import org.apache.cxf.aegis.databinding.AegisDatabinding; /** * This class was generated by $fullversion +#if ($suppressGeneratedDate != "true") * $currentdate +#end * Generated source version: $version - * + * */ public class ${intf.Name}Server { @@ -45,5 +47,5 @@ public class ${intf.Name}Server { svrBean.create(); System.out.println("Server started"); } - + } \ No newline at end of file diff --git a/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/AbstractGenerator.java b/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/AbstractGenerator.java index c1adf8f12f5..82ee3ac4ef3 100644 --- a/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/AbstractGenerator.java +++ b/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/AbstractGenerator.java @@ -117,6 +117,7 @@ protected void setCommonAttributes() { setAttributes("fullversion", Version.getCompleteVersionString()); setAttributes("name", Version.getName()); setAttributes("markGenerated", env.optionSet(ToolConstants.CFG_MARK_GENERATED)); + setAttributes("suppressGeneratedDate", env.optionSet(ToolConstants.CFG_SUPPRESS_GENERATED_DATE)); if (env.optionSet(ToolConstants.CFG_FRONTEND)) { setAttributes("frontend", env.get(ToolConstants.CFG_FRONTEND)); } diff --git a/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java b/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java index b4b2e73ee22..098ca983dfc 100644 --- a/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java +++ b/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java @@ -437,24 +437,10 @@ public void initialize(ToolContext c) throws ToolException { throw new ToolException(e); } } + addSchemas(opts, schemaCompiler, schemas); addBindingFiles(opts, jaxbBindings, schemas); - - - for (String ns : context.getNamespacePackageMap().keySet()) { - File file = JAXBUtils.getPackageMappingSchemaBindingFile(ns, context.mapPackageName(ns)); - try { - InputSource ins = new InputSource(file.toURI().toString()); - schemaCompiler.parseSchema(ins); - } finally { - FileUtils.delete(file); - } - } - - if (context.getPackageName() != null) { - schemaCompiler.setDefaultPackageName(context.getPackageName()); - } - + parseSchemas(schemaCompiler); rawJaxbModelGenCode = schemaCompiler.bind(); @@ -480,6 +466,22 @@ public void initialize(ToolContext c) throws ToolException { initialized = true; } + private void parseSchemas(SchemaCompiler schemaCompiler) { + for (String ns : context.getNamespacePackageMap().keySet()) { + File file = JAXBUtils.getPackageMappingSchemaBindingFile(ns, context.mapPackageName(ns)); + try { + InputSource ins = new InputSource(file.toURI().toString()); + schemaCompiler.parseSchema(ins); + } finally { + FileUtils.delete(file); + } + } + + if (context.getPackageName() != null) { + schemaCompiler.setDefaultPackageName(context.getPackageName()); + } + } + private boolean isJAXB22() { return org.apache.cxf.common.jaxb.JAXBUtils.isJAXB22(); } diff --git a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml index a8339e109fa..8684c4538d8 100644 --- a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml +++ b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml @@ -91,8 +91,8 @@ Examples: <option id="reserveClass" maxOccurs="unbounded"> <annotation> Reserve a class name to keep the code generator from generating - a class of the given name. In name cases, a binding file or - use of -autoNameResolution flag may be necessary for the + a class of the given name. In name cases, a binding file or + use of -autoNameResolution flag may be necessary for the code generator to completely generate usable code. </annotation> <switch>reserveClass</switch> @@ -167,7 +167,7 @@ Examples: </option> <option id="autoNameResolution" maxOccurs="1"> <annotation> - Specifies that the tool will attempt to resolve class naming conflicts + Specifies that the tool will attempt to resolve class naming conflicts without requiring the use of binding customizations. </annotation> <switch>autoNameResolution</switch> @@ -184,8 +184,8 @@ Examples: </option> <option id="defaultValues" maxOccurs="1"> <annotation> - Specifies that default values are generated for the dummy implementation and client. - You can specify the name of the class to provide the default values. The default is + Specifies that default values are generated for the dummy implementation and client. + You can specify the name of the class to provide the default values. The default is RandomValueProvider. </annotation> <switch>defaultValues</switch> @@ -245,10 +245,10 @@ Examples: </option> <option id="validate" maxOccurs="1"> <annotation> - Specifies that the WSDL is validated before generating the code. Using + Specifies that the WSDL is validated before generating the code. Using this option is highly recommended. By default, only very basic validation is done to make sure the WSDL meets the WSI-BasicProfile standards that - CXF requires. -validate=none can turn off those checks while -validate or + CXF requires. -validate=none can turn off those checks while -validate or -validate=all turns on additional schema validation and other checks. </annotation> <associatedArgument placement="immediate"> @@ -274,12 +274,12 @@ Examples: <option id="xjc" maxOccurs="unbounded"> <annotation> Specifies a comma separated list of arguments that are passed directly to XJC when the - JAXB data binding is used. This option causes XJC to load additional plugins that - augment code generation. For example to load the toString(ts) plugin that will add a toString() - method to all generated types the following <xjc arguments> would + JAXB data binding is used. This option causes XJC to load additional plugins that + augment code generation. For example to load the toString(ts) plugin that will add a toString() + method to all generated types the following <xjc arguments> would be used: -xjc-Xts - A list of available XJC plugins can be obtained by using -xjc-X. + A list of available XJC plugins can be obtained by using -xjc-X. </annotation> <associatedArgument placement="immediate"> <annotation>xjc-arguments</annotation> @@ -310,7 +310,7 @@ Examples: </option> <option id="mimeMethods" maxOccurs="unbounded"> <annotation> - Specifies a comma separated list of methods where the + Specifies a comma separated list of methods where the mime:content information is used to generate the type. </annotation> <associatedArgument placement="immediate"> @@ -320,7 +320,7 @@ Examples: </option> <option id="noAddressBinding" maxOccurs="1"> <annotation> - Specifies that the generator should not use the address jaxb binding file to map wsa:EndpointReferenceType + Specifies that the generator should not use the address jaxb binding file to map wsa:EndpointReferenceType or wsa:EndpointReference to javax.xml.ws.wsaddressing.W3CEndpointReference. </annotation> <switch>noAddressBinding</switch> @@ -329,7 +329,7 @@ Examples: <annotation> Specifies how to generate fault Exception's SUID, can use NONE|TIMESTAMP|FQCN|####", the default is NONE. FQCN uses a hash of the fully qualified class name. #### would be any valid Long to - use as the SUID. + use as the SUID. </annotation> <switch>faultSerialVersionUID</switch> <associatedArgument placement="afterSpace"> @@ -338,7 +338,7 @@ Examples: </option> <option id="encoding" maxOccurs="1"> <annotation> - Specifies the charset encoding to use when generating java sources + Specifies the charset encoding to use when generating java sources </annotation> <switch>encoding</switch> <associatedArgument placement="afterSpace"> @@ -369,6 +369,12 @@ Examples: </annotation> <switch>mark-generated</switch> </option> + <option id="suppressGeneratedDate" maxOccurs="1"> + <annotation> + Prevents dumping current date as part of javadocs of the Java files generated. + </annotation> + <switch>suppress-generated-date</switch> + </option> </optionGroup> <optionGroup id="common_options"> <option id="help" maxOccurs="1"> @@ -401,9 +407,9 @@ Examples: <option id="wsdlList" maxOccurs="1"> <annotation> Indicates the wsdlurl is a plain text list of wsdlurls that are new line delimited. - As an example the wsdlurl might point to - http://127.0.0.1:8080/context_path/ws?formatted=false&wsdlList=true on a cxf - server. + As an example the wsdlurl might point to + http://127.0.0.1:8080/context_path/ws?formatted=false&wsdlList=true on a cxf + server. </annotation> <switch>wsdlList</switch> </option> diff --git a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/build.vm b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/build.vm index bf40bdfec6a..257c60ea1af 100644 --- a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/build.vm +++ b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/build.vm @@ -17,9 +17,11 @@ <?xml version="1.0"?> <!-- Generated by WSDLToJava Compiler. - + This class was generated by $fullversion +#if ($suppressGeneratedDate != "true") $currentdate +#end Generated source version: $version --> @@ -100,7 +102,7 @@ <path id="cxf.classpath"> - <pathelement location="${home.dir}" /> + <pathelement location="${home.dir}" /> <pathelement location="${build.classes.dir}"/> <pathelement location="${cxfManifest.jar.file}"/> <fileset dir="${cxf.endorsed.dir}"> @@ -113,7 +115,7 @@ <property name="param" value=""/> <cxfrun classname="$clientClassNamesMap.get($targetName)" #if ($wsdlLocation.startsWith("classpath:")) - /> + /> #else param1="$wsdlLocation"/> #end @@ -124,7 +126,7 @@ <target name="${target}" description="Run $serverClassNamesMap.get($target)" depends="compile"> <cxfrun classname="$serverClassNamesMap.get($target)" #if ($wsdlLocation.startsWith("classpath:")) - /> + /> #else param1="$wsdlLocation"/> #end diff --git a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/client.vm b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/client.vm index 5b9f1873a79..1854c5df81b 100644 --- a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/client.vm +++ b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/client.vm @@ -29,7 +29,7 @@ import java.net.URL; import javax.annotation.Generated; #end import javax.xml.namespace.QName; -#if ($service.PackageName != $intf.PackageName) +#if ($service.PackageName != $intf.PackageName) import ${service.PackageName}.${service.Name}; #end #foreach ($import in $intf.Imports) @@ -38,9 +38,11 @@ import ${import}; /** * This class was generated by $fullversion +#if ($suppressGeneratedDate != "true") * $currentdate +#end * Generated source version: $version - * + * */ #if ($markGenerated == "true") @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate", comments = "$fullversion") @@ -63,7 +65,7 @@ public final class ${clientClassName} { #end public static void main(String args[]) throws java.lang.Exception { URL wsdlURL = ${service.Name}.WSDL_LOCATION; - if (args.length > 0 && args[0] != null && !"".equals(args[0])) { + if (args.length > 0 && args[0] != null && !"".equals(args[0])) { File wsdlFile = new File(args[0]); try { if (wsdlFile.exists()) { @@ -75,10 +77,10 @@ public final class ${clientClassName} { e.printStackTrace(); } } - + $service.Name ss = new ${service.Name}(wsdlURL, SERVICE_NAME); - $intf.Name port = ss.${port.MethodName}(); - + $intf.Name port = ss.${port.MethodName}(); + #foreach ($method in $intf.Methods) { System.out.println("Invoking ${method.Name}..."); @@ -86,14 +88,14 @@ public final class ${clientClassName} { #set($paramValueName = "_${method.Name}_${parameter.Name}") #if ($parameter.Style.toString() == "IN") ${parameter.writeDefaultValue(${out}, " ", ${method.Name}, ${paramValueName})} -#elseif ($parameter.Style.toString() == "INOUT") +#elseif ($parameter.Style.toString() == "INOUT") #set($paramValueName2 = "${paramValueName}Val") ${parameter.writeDefaultValue(${out}, " ", ${method.Name}, ${paramValueName2})} javax.xml.ws.Holder<${parameter.ClassName}> $paramValueName = new javax.xml.ws.Holder<${parameter.ClassName}>(${paramValueName2}); -#elseif ($parameter.Style.toString() == "OUT") +#elseif ($parameter.Style.toString() == "OUT") javax.xml.ws.Holder<${parameter.ClassName}> $paramValueName = new javax.xml.ws.Holder<${parameter.ClassName}>(); -#end -#end +#end +#end #set($indent = " ") #if($method.Exceptions.size() > 0) #set($indent = " ") @@ -113,11 +115,11 @@ ${indent}System.out.println("${method.Name}.${paramValueName}=" + ${paramValueNa #end #if($method.Exceptions.size() > 0) }#foreach($exception in $method.Exceptions) - catch ($exception.ClassName e) { + catch ($exception.ClassName e) { System.out.println("Expected exception: $exception.Name has occurred."); System.out.println(e.toString()); }#end -#end +#end ${indent}} #end diff --git a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/fault.vm b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/fault.vm index 0d2208f909e..9f4cea85b0c 100644 --- a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/fault.vm +++ b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/fault.vm @@ -30,9 +30,11 @@ import ${import}; #if ($expClass.classJavaDoc != "") $expClass.classJavaDoc * -#end +#end * This class was generated by $fullversion +#if ($suppressGeneratedDate != "true") * $currentdate +#end * Generated source version: $version */ @@ -50,7 +52,7 @@ public class $expClass.Name extends $exceptionSuperclass { public static final long serialVersionUID = ${suid}L; #end #foreach ($field in $expClass.Fields) - + #if ($markGenerated == "true") @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate") #end @@ -62,14 +64,14 @@ public class $expClass.Name extends $exceptionSuperclass { public ${expClass.Name}() { super(); } - + #if ($markGenerated == "true") @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate") #end public ${expClass.Name}(String message) { super(message); } - + #if ($markGenerated == "true") @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate") #end diff --git a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/impl.vm b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/impl.vm index fdc8ce4e149..775176eaf93 100644 --- a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/impl.vm +++ b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/impl.vm @@ -32,26 +32,28 @@ import ${import}; /** * This class was generated by $fullversion +#if ($suppressGeneratedDate != "true") * $currentdate +#end * Generated source version: $version - * + * */ @javax.jws.WebService( -#if ($service.ServiceName != "") +#if ($service.ServiceName != "") serviceName = "$service.ServiceName", #end -#if ($port != "") +#if ($port != "") portName = "$port", #end -#if ($service.Namespace != "") +#if ($service.Namespace != "") targetNamespace = "$service.Namespace", #end -#if ($intf.Location != "") +#if ($intf.Location != "") wsdlLocation = "$intf.Location", #end endpointInterface = "$intf.PackageName.$intf.Name") - + #if ($markGenerated == "true") @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate", comments = "$fullversion") #end @@ -69,7 +71,7 @@ public class ${implName} implements $intf.Name { #if ($markGenerated == "true") @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate") #end - public $method.return.ClassName ${method.Name}(#if($method.ParameterListWithoutAnnotation.size() == 0))#end#if($method.ParameterListWithoutAnnotation.size() != 0)#foreach($param in ${method.ParameterListWithoutAnnotation})$param#if($foreach.count != $method.ParameterListWithoutAnnotation.size()) #end#end)#end#if($method.Exceptions.size() > 0) throws #foreach($exception in $method.Exceptions)$exception.ClassName#if($foreach.count != $method.Exceptions.size()), #end #end #end { + public $method.return.ClassName ${method.Name}(#if($method.ParameterListWithoutAnnotation.size() == 0))#end#if($method.ParameterListWithoutAnnotation.size() != 0)#foreach($param in ${method.ParameterListWithoutAnnotation})$param#if($foreach.count != $method.ParameterListWithoutAnnotation.size()) #end#end)#end#if($method.Exceptions.size() > 0) throws #foreach($exception in $method.Exceptions)$exception.ClassName#if($foreach.count != $method.Exceptions.size()), #end #end #end { #if ($method.Async) return null; /* not called */ @@ -78,7 +80,7 @@ public class ${implName} implements $intf.Name { #foreach ($parameter in $method.Parameters) #if ($parameter.Style.toString() == "IN") System.out.println($parameter.Name); -#elseif ($parameter.Style.toString() == "INOUT") +#elseif ($parameter.Style.toString() == "INOUT") System.out.println(${parameter.Name}.value); #end #end @@ -88,7 +90,7 @@ public class ${implName} implements $intf.Name { #set($paramValueName = "${parameter.Name}Value") ${parameter.writeDefaultValue(${out}, " ", ${method.Name}, ${paramValueName})} ${parameter.Name}.value = ${paramValueName}; -#end +#end #end #if ($method.return.ClassName != "void") ${method.return.writeDefaultValue(${out}, " ", ${method.Name}, "_return")} @@ -98,7 +100,7 @@ public class ${implName} implements $intf.Name { ex.printStackTrace(); throw new RuntimeException(ex); } -#if ($method.Exceptions.size() > 0) +#if ($method.Exceptions.size() > 0) #foreach($exception in $method.Exceptions) //throw new ${exception.ClassName}("${exception.Name}..."); #end diff --git a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/sei.vm b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/sei.vm index 4e033a9abf6..045e8dfd9b0 100644 --- a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/sei.vm +++ b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/sei.vm @@ -34,9 +34,11 @@ $intf.classJavaDoc * #end * This class was generated by $fullversion +#if ($suppressGeneratedDate != "true") * $currentdate +#end * Generated source version: $version - * + * */ #foreach ($annotation in $intf.Annotations) $annotation diff --git a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/server.vm b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/server.vm index 1c43bd34bc9..1d7353bc555 100644 --- a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/server.vm +++ b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/server.vm @@ -24,11 +24,13 @@ import javax.xml.ws.Endpoint; /** * This class was generated by $fullversion +#if ($suppressGeneratedDate != "true") * $currentdate +#end * Generated source version: $version - * + * */ - + #if ($markGenerated == "true") @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate", comments = "$fullversion") #end @@ -43,15 +45,15 @@ public class ${serverClassName}{ String address = "${address}"; Endpoint.publish(address, implementor); } - + #if ($markGenerated == "true") @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate") #end - public static void main(String args[]) throws java.lang.Exception { + public static void main(String args[]) throws java.lang.Exception { new ${serverClassName}(); - System.out.println("Server ready..."); - - Thread.sleep(5 * 60 * 1000); + System.out.println("Server ready..."); + + Thread.sleep(5 * 60 * 1000); System.out.println("Server exiting"); System.exit(0); } diff --git a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm index 57a2526f277..7362e777476 100644 --- a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm +++ b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm @@ -32,7 +32,7 @@ import javax.xml.namespace.QName; import javax.xml.ws.WebEndpoint; import javax.xml.ws.WebServiceClient; import javax.xml.ws.WebServiceFeature; -#foreach ($import in ${service.Imports}) +#foreach ($import in ${service.Imports}) import ${import}; #end #if ($serviceTarget == "cxf") @@ -46,15 +46,17 @@ $service.classJavaDoc * #end * This class was generated by $fullversion + #if ($suppressGeneratedDate != "true") * $currentdate +#end * Generated source version: $version - * + * */ -@WebServiceClient(name = "${service.ServiceName}", +@WebServiceClient(name = "${service.ServiceName}", #if ($wsdlLocation != "") wsdlLocation = "$wsdlLocation", #end - targetNamespace = "$service.Namespace") + targetNamespace = "$service.Namespace") #foreach ($annotation in $service.Annotations) $annotation #end @@ -81,7 +83,7 @@ public class ${service.Name} extends ${serviceSuperclass} { static { #if ($wsdlLocation == "") WSDL_LOCATION = null; -#elseif ($wsdlLocation == "null") +#elseif ($wsdlLocation == "null") WSDL_LOCATION = null; #elseif ($wsdlLocation.startsWith("classpath:")) URL url = ${service.Name}.class.getClassLoader().getResource("$wsdlLocation.substring(10)"); @@ -89,31 +91,31 @@ public class ${service.Name} extends ${serviceSuperclass} { if (url == null) { url = ${service.Name}.class.getClassLoader().getResource("$wsdlLocation.substring(11)"); } -#end +#end if (url == null) { #if ($serviceTarget == "cxf") LogUtils.getL7dLogger(${service.Name}.class) #else java.util.logging.Logger.getLogger(${service.Name}.class.getName()) #end - .log(java.util.logging.Level.INFO, + .log(java.util.logging.Level.INFO, "Can not initialize the default wsdl from {0}", "$wsdlLocation"); - } - WSDL_LOCATION = url; + } + WSDL_LOCATION = url; #elseif ($useGetResource) URL url = ${service.Name}.class.getResource("$wsdlLocation"); if (url == null) { url = ${service.Name}.class.getClassLoader().getResource("$wsdlLocation"); - } + } if (url == null) { #if ($serviceTarget == "cxf") LogUtils.getL7dLogger(${service.Name}.class) #else java.util.logging.Logger.getLogger(${service.Name}.class.getName()) #end - .log(java.util.logging.Level.INFO, + .log(java.util.logging.Level.INFO, "Can not initialize the default wsdl from {0}", "$wsdlLocation"); - } + } WSDL_LOCATION = url; #else URL url = null; @@ -125,7 +127,7 @@ public class ${service.Name} extends ${serviceSuperclass} { #else java.util.logging.Logger.getLogger(${service.Name}.class.getName()) #end - .log(java.util.logging.Level.INFO, + .log(java.util.logging.Level.INFO, "Can not initialize the default wsdl from {0}", "$wsdlLocation"); } WSDL_LOCATION = url; @@ -152,7 +154,7 @@ public class ${service.Name} extends ${serviceSuperclass} { #end public ${service.Name}(Bus bus, URL wsdlLocation, QName serviceName, WebServiceFeature ... features) { super(bus, wsdlLocation, serviceName, features); - } + } #else #if ($markGenerated == "true") @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate") @@ -174,8 +176,8 @@ public class ${service.Name} extends ${serviceSuperclass} { public ${service.Name}() { super(WSDL_LOCATION, SERVICE); } -#end - +#end + #if ($jaxws22 || $serviceTarget == "cxf") #if ($markGenerated == "true") @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate") @@ -196,14 +198,14 @@ public class ${service.Name} extends ${serviceSuperclass} { #end public ${service.Name}(URL wsdlLocation, QName serviceName, WebServiceFeature ... features) { super(wsdlLocation, serviceName, features); - } + } #end #if ($frontend == "cxf") #foreach ($portClassName in $cxfPortClassnames) /** * Proxy interface the extends ${portClassName} to also provide useful methods - * without having to cast to the appropriate interface. + * without having to cast to the appropriate interface. */ #if ($markGenerated == "true") @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate") @@ -215,7 +217,7 @@ public class ${service.Name} extends ${serviceSuperclass} { #foreach ($port in $service.Ports) #set($portClassName = ${port.InterfaceClass}) -#if ($portClassName == ${service.Name}) +#if ($portClassName == ${service.Name}) #set($portClassName = ${port.fullClassName}) #end @@ -243,7 +245,7 @@ $port.javaDoc #if ($port.javaDoc != "") $port.javaDoc #end - * + * * @param features * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values. * @return diff --git a/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenOptionTest.java b/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenOptionTest.java index c288541d660..d079d93ba78 100644 --- a/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenOptionTest.java +++ b/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenOptionTest.java @@ -294,6 +294,92 @@ private int countGeneratedAnnotations(String str) { return count; } + /** + * Tests that, when 'suppress-generated-date' option is set, javadocs + * won't contain the current date in all the generated java classes. + */ + @Test + public void testSuppressGeneratedDatePresentOption() throws Exception { + env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/hello_world.wsdl")); + env.put(ToolConstants.CFG_SUPPRESS_GENERATED_DATE, "true"); + env.put(ToolConstants.CFG_COMPILE, null); + env.put(ToolConstants.CFG_CLASSDIR, null); + processor.setContext(env); + processor.execute(); + + File dir = new File(output, "org"); + assertTrue("org directory is not found", dir.exists()); + dir = new File(dir, "apache"); + assertTrue("apache directory is not found", dir.exists()); + assertTrue("apache directory is not found", dir.exists()); + dir = new File(dir, "cxf"); + assertTrue("cxf directory is not found", dir.exists()); + dir = new File(dir, "w2j"); + assertTrue("w2j directory is not found", dir.exists()); + dir = new File(dir, "hello_world_soap_http"); + assertTrue("hello_world_soap_http directory is not found", dir.exists()); + File types = new File(dir, "types"); + assertTrue("types directory is not found", dir.exists()); + + String str = IOUtils.readStringFromStream(new FileInputStream(new File(dir, "Greeter.java"))); + assertFalse(currentDatePresent(str)); + str = IOUtils.readStringFromStream(new FileInputStream(new File(types, "SayHi.java"))); + assertFalse(currentDatePresent(str)); + str = IOUtils.readStringFromStream(new FileInputStream(new File(types, "SayHiResponse.java"))); + assertFalse(currentDatePresent(str)); + } + + /** + * Tests that, when 'suppress-generated-date' option is not present, javadocs + * will contain the current date in all the generated java classes. + */ + @Test + public void testSuppressGeneratedDateNotPresentOption() throws Exception { + env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/hello_world.wsdl")); + env.put(ToolConstants.CFG_MARK_GENERATED, "true"); + env.put(ToolConstants.CFG_COMPILE, null); + env.put(ToolConstants.CFG_CLASSDIR, null); + processor.setContext(env); + processor.execute(); + + File dir = new File(output, "org"); + assertTrue("org directory is not found", dir.exists()); + dir = new File(dir, "apache"); + assertTrue("apache directory is not found", dir.exists()); + dir = new File(dir, "cxf"); + assertTrue("cxf directory is not found", dir.exists()); + dir = new File(dir, "w2j"); + assertTrue("w2j directory is not found", dir.exists()); + dir = new File(dir, "hello_world_soap_http"); + assertTrue("hello_world_soap_http directory is not found", dir.exists()); + File types = new File(dir, "types"); + assertTrue("types directory is not found", dir.exists()); + + String str = IOUtils.readStringFromStream(new FileInputStream(new File(dir, "Greeter.java"))); + assertTrue(currentDatePresent(str)); + str = IOUtils.readStringFromStream(new FileInputStream(new File(types, "SayHi.java"))); + assertFalse(currentDatePresent(str)); + str = IOUtils.readStringFromStream(new FileInputStream(new File(types, "SayHiResponse.java"))); + assertFalse(currentDatePresent(str)); + } + + private boolean currentDatePresent(String str) { + String[] lines = str.split(System.getProperty("line.separator")); + boolean expectDate = false; + + for (String line : lines) { + if (expectDate) { + if (line.contains("Generated source version")) { + break; + } else { + return true; + } + } + expectDate = line.contains("This class was generated by"); + } + + return false; + } @Test public void testResourceURLForWsdlLocation() throws Exception { ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services