This is an automated email from the ASF dual-hosted git repository.
reta pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/main by this push:
new fd537c0a81 [CXF-9030] suppress date on '@Generated' when set (#1929)
fd537c0a81 is described below
commit fd537c0a81f58a67605e335db56eff953d3e9018
Author: Benjamin Marwell <[email protected]>
AuthorDate: Thu Jun 20 14:17:14 2024 +0200
[CXF-9030] suppress date on '@Generated' when set (#1929)
* [CXF-9030] suppress date on '@Generated' when set
* [CXF-9030] test for @Generated with date in each line
* Fix checkstyle violation
* Fix CodeGenOptionTest tests
---------
Co-authored-by: Andriy Redko <[email protected]>
---
.../tools/wsdlto/frontend/jaxws/template/client.vm | 8 +++---
.../tools/wsdlto/frontend/jaxws/template/fault.vm | 18 ++++++------
.../tools/wsdlto/frontend/jaxws/template/impl.vm | 6 ++--
.../tools/wsdlto/frontend/jaxws/template/sei.vm | 4 +--
.../tools/wsdlto/frontend/jaxws/template/server.vm | 6 ++--
.../wsdlto/frontend/jaxws/template/service.vm | 32 +++++++++++-----------
.../cxf/tools/wsdlto/jaxws/CodeGenOptionTest.java | 21 ++++++++++++--
7 files changed, 56 insertions(+), 39 deletions(-)
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 dec957a296..416ece4513 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
@@ -45,23 +45,23 @@ import ${import};
*
*/
#if ($markGenerated == "true")
-@Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate", comments = "$fullversion")
+@Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end, comments =
"$fullversion")
#end
public final class ${clientClassName} {
#if ($markGenerated == "true")
- @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#end
private static final QName SERVICE_NAME = new QName("$service.Namespace",
"$service.ServiceName");
#if ($markGenerated == "true")
- @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#end
private ${clientClassName}() {
}
#if ($markGenerated == "true")
- @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#end
public static void main(String args[]) throws java.lang.Exception {
URL wsdlURL = ${service.Name}.WSDL_LOCATION;
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 ee353d40ae..c989eef5e0 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
@@ -42,45 +42,45 @@ $expClass.classJavaDoc
@WebFault(name = "$field.Name", targetNamespace = "$field.TargetNamespace")
#end
#if ($markGenerated == "true")
-@Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate", comments = "$fullversion")
+@Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end, comments =
"$fullversion")
#end
public class $expClass.Name extends $exceptionSuperclass {
#if (${suid} != "")
#if ($markGenerated == "true")
- @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#end
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")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#end
$field.Modifier $field.ClassName faultInfo;
#if ($markGenerated == "true")
- @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#end
public ${expClass.Name}() {
super();
}
#if ($markGenerated == "true")
- @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#end
public ${expClass.Name}(String message) {
super(message);
}
#if ($markGenerated == "true")
- @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#end
public ${expClass.Name}(String message, java.lang.Throwable cause) {
super(message, cause);
}
#if ($markGenerated == "true")
- @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#end
public ${expClass.Name}(String message, $field.ClassName $paraName) {
super(message);
@@ -88,7 +88,7 @@ public class $expClass.Name extends $exceptionSuperclass {
}
#if ($markGenerated == "true")
- @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#end
public ${expClass.Name}(String message, $field.ClassName $paraName,
java.lang.Throwable cause) {
super(message, cause);
@@ -96,7 +96,7 @@ public class $expClass.Name extends $exceptionSuperclass {
}
#if ($markGenerated == "true")
- @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#end
public $field.ClassName getFaultInfo() {
return this.faultInfo;
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 3052f05d56..e28e6fa88f 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
@@ -55,12 +55,12 @@ import ${import};
endpointInterface = "$intf.PackageName.$intf.Name")
#if ($markGenerated == "true")
-@Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate", comments = "$fullversion")
+@Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end, comments =
"$fullversion")
#end
public class ${implName} implements $intf.Name {
#if ($markGenerated == "true")
- @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#end
private static final Logger LOG =
Logger.getLogger(${implName}.class.getName());
@@ -69,7 +69,7 @@ public class ${implName} implements $intf.Name {
* @see $intf.PackageName.$intf.Name#${method.Name}(#foreach ($parameter
in $method.Parameters)$parameter.ClassName $parameter.Name#if ($foreach.count
!= $method.getParameters().size()), #end#end)*
*/
#if ($markGenerated == "true")
- @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#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)
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 887a9415d4..0f72815aef 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
@@ -44,7 +44,7 @@ $intf.classJavaDoc
$annotation
#end
#if ($markGenerated == "true")
-@Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate", comments = "$fullversion")
+@Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end, comments =
"$fullversion")
#end
public interface $intf.Name ${seiSuperinterfaceString}{
#foreach ($method in $intf.Methods)
@@ -58,7 +58,7 @@ ${method.JavaDoc}
$annotation
#end
#if ($markGenerated == "true")
- @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#end
public $method.returnValue ${method.Name}(#if($method.ParameterList.size()
== 0))#end
#if($method.ParameterList.size() != 0)
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 dee883187b..3be2581bf4 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
@@ -32,12 +32,12 @@ import jakarta.xml.ws.Endpoint;
*/
#if ($markGenerated == "true")
-@Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate", comments = "$fullversion")
+@Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end, comments =
"$fullversion")
#end
public class ${serverClassName}{
#if ($markGenerated == "true")
- @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#end
protected ${serverClassName}() throws java.lang.Exception {
System.out.println("Starting Server");
@@ -47,7 +47,7 @@ public class ${serverClassName}{
}
#if ($markGenerated == "true")
- @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#end
public static void main(String args[]) throws java.lang.Exception {
new ${serverClassName}();
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 2d1b969f3e..5c10fe28d1 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
@@ -62,22 +62,22 @@ $service.classJavaDoc
$annotation
#end
#if ($markGenerated == "true")
-@Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate", comments = "$fullversion")
+@Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end, comments =
"$fullversion")
#end
public class ${service.Name} extends ${serviceSuperclass} {
#if ($markGenerated == "true")
- @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#end
public static final URL WSDL_LOCATION;
#if ($markGenerated == "true")
- @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#end
public static final QName SERVICE = new QName("$service.Namespace",
"$service.ServiceName");
#foreach ($port in ${service.Ports})
#if ($markGenerated == "true")
- @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#end
public static final QName $port.Name = new QName("$service.Namespace",
"$port.PortName");
#end
@@ -137,42 +137,42 @@ public class ${service.Name} extends ${serviceSuperclass}
{
#if ($serviceTarget == "cxf")
#if ($markGenerated == "true")
- @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#end
public ${service.Name}(Bus bus, WebServiceFeature ... features) {
super(bus, WSDL_LOCATION, SERVICE, features);
}
#if ($markGenerated == "true")
- @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#end
public ${service.Name}(Bus bus, URL wsdlLocation, WebServiceFeature ...
features) {
super(bus, wsdlLocation, SERVICE, features);
}
#if ($markGenerated == "true")
- @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#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")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#end
public ${service.Name}(URL wsdlLocation) {
super(wsdlLocation, SERVICE);
}
#if ($markGenerated == "true")
- @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#end
public ${service.Name}(URL wsdlLocation, QName serviceName) {
super(wsdlLocation, serviceName);
}
#if ($markGenerated == "true")
- @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#end
public ${service.Name}() {
super(WSDL_LOCATION, SERVICE);
@@ -181,21 +181,21 @@ public class ${service.Name} extends ${serviceSuperclass}
{
#if ($jaxws22 || $serviceTarget == "cxf")
#if ($markGenerated == "true")
- @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#end
public ${service.Name}(WebServiceFeature ... features) {
super(WSDL_LOCATION, SERVICE, features);
}
#if ($markGenerated == "true")
- @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#end
public ${service.Name}(URL wsdlLocation, WebServiceFeature ... features) {
super(wsdlLocation, SERVICE, features);
}
#if ($markGenerated == "true")
- @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#end
public ${service.Name}(URL wsdlLocation, QName serviceName,
WebServiceFeature ... features) {
super(wsdlLocation, serviceName, features);
@@ -209,7 +209,7 @@ public class ${service.Name} extends ${serviceSuperclass} {
* without having to cast to the appropriate interface.
*/
#if ($markGenerated == "true")
- @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#end
public interface ${portClassName}Proxy extends ${portClassName},
AutoCloseable, BindingProvider, Client {
}
@@ -236,7 +236,7 @@ $port.javaDoc
*/
@WebEndpoint(name = "${port.PortName}")
#if ($markGenerated == "true")
- @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#end
public ${portClassName} ${port.MethodName}() {
return super.getPort($port.Name, ${portClassName}.class);
@@ -254,7 +254,7 @@ $port.javaDoc
*/
@WebEndpoint(name = "${port.PortName}")
#if ($markGenerated == "true")
- @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date =
"$currentdate")
+ @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava"#if
($suppressGeneratedDate != "true"), date = "$currentdate"#end)
#end
public ${portClassName} ${port.MethodName}(WebServiceFeature... features) {
return super.getPort($port.Name, ${portClassName}.class, features);
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 c511bce742..f55819123a 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
@@ -45,7 +45,6 @@ import static org.junit.Assert.fail;
public class CodeGenOptionTest extends AbstractCodeGenTest {
-
@Test
public void testFlagForGenStandAlone() throws Exception {
env.put(ToolConstants.CFG_GEN_TYPES, ToolConstants.CFG_GEN_TYPES);
@@ -329,10 +328,13 @@ public class CodeGenOptionTest extends
AbstractCodeGenTest {
String str = IOUtils.readStringFromStream(new FileInputStream(new
File(dir, "Greeter.java")));
assertFalse(currentDatePresent(str));
+ assertFalse(currentDateInGeneratedAnnotationPresent(str));
str = IOUtils.readStringFromStream(new FileInputStream(new File(types,
"SayHi.java")));
assertFalse(currentDatePresent(str));
+ assertFalse(currentDateInGeneratedAnnotationPresent(str));
str = IOUtils.readStringFromStream(new FileInputStream(new File(types,
"SayHiResponse.java")));
assertFalse(currentDatePresent(str));
+ assertFalse(currentDateInGeneratedAnnotationPresent(str));
}
/**
@@ -363,10 +365,13 @@ public class CodeGenOptionTest extends
AbstractCodeGenTest {
String str = IOUtils.readStringFromStream(new FileInputStream(new
File(dir, "Greeter.java")));
assertTrue(currentDatePresent(str));
+ assertTrue(currentDateInGeneratedAnnotationPresent(str));
str = IOUtils.readStringFromStream(new FileInputStream(new File(types,
"SayHi.java")));
assertFalse(currentDatePresent(str));
+ assertTrue(currentDateInGeneratedAnnotationPresent(str));
str = IOUtils.readStringFromStream(new FileInputStream(new File(types,
"SayHiResponse.java")));
assertFalse(currentDatePresent(str));
+ assertTrue(currentDateInGeneratedAnnotationPresent(str));
}
private boolean currentDatePresent(String str) {
@@ -387,6 +392,18 @@ public class CodeGenOptionTest extends AbstractCodeGenTest
{
return false;
}
+ private boolean currentDateInGeneratedAnnotationPresent(String str) {
+ String[] lines = str.split(System.lineSeparator());
+
+ for (String line : lines) {
+ if (line.contains("@Generated(") && line.contains("date = \"")) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
@Test
public void testResourceURLForWsdlLocation() throws Exception {
env.put(ToolConstants.CFG_WSDLURL,
getLocation("/wsdl2java_wsdl/hello_world.wsdl"));
@@ -447,4 +464,4 @@ public class CodeGenOptionTest extends AbstractCodeGenTest {
}
}
-}
\ No newline at end of file
+}