You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2021/03/04 15:54:38 UTC
[camel] branch camel-3.7.x updated: CAMEL-16305: Make
CamelServiceNowGenerateMojo set @Generated value on generated classes
This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch camel-3.7.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.7.x by this push:
new 4753a37 CAMEL-16305: Make CamelServiceNowGenerateMojo set @Generated value on generated classes
4753a37 is described below
commit 4753a370e107173c7ffebb2d27282b88740c4826
Author: James Netherton <ja...@gmail.com>
AuthorDate: Thu Mar 4 15:15:37 2021 +0000
CAMEL-16305: Make CamelServiceNowGenerateMojo set @Generated value on generated classes
---
components/camel-servicenow/camel-servicenow-component/pom.xml | 5 +++++
.../src/it/simple-it/verify.groovy | 10 +++++++++-
.../org/apache/camel/maven/CamelServiceNowGenerateMojo.java | 4 +++-
3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/components/camel-servicenow/camel-servicenow-component/pom.xml b/components/camel-servicenow/camel-servicenow-component/pom.xml
index 0eee139..7eec0ec 100644
--- a/components/camel-servicenow/camel-servicenow-component/pom.xml
+++ b/components/camel-servicenow/camel-servicenow-component/pom.xml
@@ -106,6 +106,11 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core-catalog</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<scope>test</scope>
diff --git a/components/camel-servicenow/camel-servicenow-maven-plugin/src/it/simple-it/verify.groovy b/components/camel-servicenow/camel-servicenow-maven-plugin/src/it/simple-it/verify.groovy
index 9a1d849..ff84832 100644
--- a/components/camel-servicenow/camel-servicenow-maven-plugin/src/it/simple-it/verify.groovy
+++ b/components/camel-servicenow/camel-servicenow-maven-plugin/src/it/simple-it/verify.groovy
@@ -19,4 +19,12 @@
File sourceDir = new File(basedir, "target/generated-sources/camel-servicenow")
assert sourceDir.isDirectory()
-assert sourceDir.listFiles().length == 1
+
+def files = sourceDir.listFiles()
+assert files.length == 1
+files[0].eachFileRecurse {file ->
+ if (file.name.endsWith(".java")) {
+ assert file.text.contains("public final class Incident")
+ assert file.text.contains("@Generated(\"org.apache.camel.maven.CamelServiceNowGenerateMojo\")")
+ }
+}
diff --git a/components/camel-servicenow/camel-servicenow-maven-plugin/src/main/java/org/apache/camel/maven/CamelServiceNowGenerateMojo.java b/components/camel-servicenow/camel-servicenow-maven-plugin/src/main/java/org/apache/camel/maven/CamelServiceNowGenerateMojo.java
index 16ae2841f..e06618b 100644
--- a/components/camel-servicenow/camel-servicenow-maven-plugin/src/main/java/org/apache/camel/maven/CamelServiceNowGenerateMojo.java
+++ b/components/camel-servicenow/camel-servicenow-maven-plugin/src/main/java/org/apache/camel/maven/CamelServiceNowGenerateMojo.java
@@ -180,7 +180,9 @@ public class CamelServiceNowGenerateMojo extends AbstractMojo {
try {
TypeSpec.Builder typeBuilder = TypeSpec.classBuilder(toCamelCase(name, false))
.addModifiers(Modifier.PUBLIC, Modifier.FINAL)
- .addAnnotation(Generated.class)
+ .addAnnotation(AnnotationSpec.builder(Generated.class)
+ .addMember("value", "$S", CamelServiceNowGenerateMojo.class.getName())
+ .build())
.addAnnotation(AnnotationSpec.builder(ServiceNowSysParm.class)
.addMember("name", "$S", "sysparm_exclude_reference_link")
.addMember("value", "$S", "true")