This is an automated email from the ASF dual-hosted git repository.

adangel pushed a commit to branch pmd7
in repository https://gitbox.apache.org/repos/asf/maven-pmd-plugin.git

commit 9e2d9db87789d9b50955c7b88b3cef10c6ef3839
Author: Andreas Dangel <adan...@apache.org>
AuthorDate: Fri May 19 20:39:19 2023 +0200

    Separate integration test for MPMD-246
---
 .../MPMD-246-processing-errors/invoker.properties  | 19 +++++++++
 src/it/MPMD-246-processing-errors/pom.xml          | 48 ++++++++++++++++++++++
 .../src/main/java/BrokenFile.java                  | 23 +++++++++++
 src/it/MPMD-246-processing-errors/verify.groovy    | 28 +++++++++++++
 4 files changed, 118 insertions(+)

diff --git a/src/it/MPMD-246-processing-errors/invoker.properties 
b/src/it/MPMD-246-processing-errors/invoker.properties
new file mode 100644
index 0000000..ea9f79e
--- /dev/null
+++ b/src/it/MPMD-246-processing-errors/invoker.properties
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+invoker.goals = clean pmd:check
+invoker.maven.version = 3.1.0+
diff --git a/src/it/MPMD-246-processing-errors/pom.xml 
b/src/it/MPMD-246-processing-errors/pom.xml
new file mode 100644
index 0000000..be1cd2b
--- /dev/null
+++ b/src/it/MPMD-246-processing-errors/pom.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.plugins.pmd.its</groupId>
+  <artifactId>MPMD-246-processing-errors</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencies>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>@project.groupId@</groupId>
+        <artifactId>@project.artifactId@</artifactId>
+        <version>@project.version@</version>
+        <configuration>
+          <skipPmdError>true</skipPmdError>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/src/it/MPMD-246-processing-errors/src/main/java/BrokenFile.java 
b/src/it/MPMD-246-processing-errors/src/main/java/BrokenFile.java
new file mode 100644
index 0000000..7ea0203
--- /dev/null
+++ b/src/it/MPMD-246-processing-errors/src/main/java/BrokenFile.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+public class BrokenFile {
+    // This file has a parse error, so PMD will fail to parse it
+    broken!!
+}
diff --git a/src/it/MPMD-246-processing-errors/verify.groovy 
b/src/it/MPMD-246-processing-errors/verify.groovy
new file mode 100644
index 0000000..10de06a
--- /dev/null
+++ b/src/it/MPMD-246-processing-errors/verify.groovy
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+File buildLog = new File( basedir, 'build.log' )
+assert buildLog.exists()
+assert buildLog.text.contains( "PMD processing errors" )
+assert buildLog.text.contains( "ParseException" )
+
+String brokenFilePath = new File( basedir, 'src/main/java/BrokenFile.java' 
).getCanonicalPath()
+
+// processing error should be logged through maven-pmd-plugin, since 
"skipPmdError=true" (MPMD-246)
+assert 1 == buildLog.text.count( "${brokenFilePath}: ParseException: Parse 
exception in file" )

Reply via email to