This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
The following commit(s) were added to refs/heads/master by this push:
new d50fee8 [SUREFIRE-2031] Both fields/parameters "includes" and
"excludes" should be in target MOJO class. User names should be unique.
d50fee8 is described below
commit d50fee8e4c19634253ebc4bea91284b8a0b8f37a
Author: tibor.digana <[email protected]>
AuthorDate: Wed Mar 2 20:38:49 2022 +0100
[SUREFIRE-2031] Both fields/parameters "includes" and "excludes" should be
in target MOJO class. User names should be unique.
---
.../maven/plugin/failsafe/IntegrationTestMojo.java | 43 ++++++++++++++++++-
.../plugin/surefire/AbstractSurefireMojo.java | 40 ------------------
.../AbstractSurefireMojoJava7PlusTest.java | 12 ++++++
.../plugin/surefire/AbstractSurefireMojoTest.java | 12 ++++++
.../maven/plugin/surefire/MojoMocklessTest.java | 12 ++++++
.../maven/plugin/surefire/SurefirePlugin.java | 49 ++++++++++++++++++++--
6 files changed, 123 insertions(+), 45 deletions(-)
diff --git
a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
index ee12c6b..11c3e58 100644
---
a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
+++
b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
@@ -225,10 +225,39 @@ public class IntegrationTestMojo
* to the POM property <code>${project.build.testOutputDirectory}</code>,
typically
* <code>{@literal src/test/java}</code> unless overridden.
*/
- @Parameter
+ @Parameter( property = "failsafe.includes" )
+ // TODO use regex for fully qualified class names in 3.0 and change the
filtering abilities
private List<String> includes;
/**
+ * A list of {@literal <exclude>} elements specifying the tests (by
pattern) that should be excluded in testing.
+ * When not specified and when the {@code test} parameter is not
specified, the default excludes will be <br>
+ * <pre><code>
+ * {@literal <excludes>}
+ * {@literal <exclude>}**{@literal /}*$*{@literal </exclude>}
+ * {@literal </excludes>}
+ * </code></pre>
+ * (which excludes all inner classes).
+ * <br>
+ * This parameter is ignored if the TestNG {@code suiteXmlFiles} parameter
is specified.
+ * <br>
+ * Each exclude item may also contain a comma-separated sub-list of items,
which will be treated as multiple
+ * {@literal <exclude>} entries.<br>
+ * Since 2.19 a complex syntax is supported in one parameter (JUnit 4,
JUnit 4.7+, TestNG):
+ * <pre><code>
+ * {@literal <exclude>}%regex[pkg.*Slow.*.class], Unstable*{@literal
</exclude>}
+ * </code></pre>
+ * <br>
+ * <b>Notice that</b> these values are relative to the directory
containing generated test classes of the project
+ * being tested. This directory is declared by the parameter {@code
testClassesDirectory} which defaults
+ * to the POM property <code>${project.build.testOutputDirectory}</code>,
typically
+ * <code>{@literal src/test/java}</code> unless overridden.
+ */
+ @Parameter( property = "failsafe.excludes" )
+ // TODO use regex for fully qualified class names in 3.0 and change the
filtering abilities
+ private List<String> excludes;
+
+ /**
* Option to pass dependencies to the system's classloader instead of
using an isolated class loader when forking.
* Prevents problems with JDKs which implement the service provider lookup
mechanism by using the system's
* classloader.
@@ -898,6 +927,18 @@ public class IntegrationTestMojo
}
@Override
+ public List<String> getExcludes()
+ {
+ return excludes;
+ }
+
+ @Override
+ public void setExcludes( List<String> excludes )
+ {
+ this.excludes = excludes;
+ }
+
+ @Override
public File[] getSuiteXmlFiles()
{
return suiteXmlFiles.clone();
diff --git
a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
index 89f13aa..ed946b6 100644
---
a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
+++
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
@@ -291,34 +291,6 @@ public abstract class AbstractSurefireMojo
private File testSourceDirectory;
/**
- * A list of <exclude> elements specifying the tests (by pattern)
that should be excluded in testing. When not
- * specified and when the {@code test} parameter is not specified, the
default excludes will be <br>
- * <pre><code>
- * {@literal <excludes>}
- * {@literal <exclude>}**{@literal /}*$*{@literal </exclude>}
- * {@literal </excludes>}
- * </code></pre>
- * (which excludes all inner classes).
- * <br>
- * This parameter is ignored if the TestNG {@code suiteXmlFiles} parameter
is specified.
- * <br>
- * Each exclude item may also contain a comma-separated sub-list of items,
which will be treated as multiple
- * <exclude> entries.<br>
- * Since 2.19 a complex syntax is supported in one parameter (JUnit 4,
JUnit 4.7+, TestNG):
- * <pre><code>
- * {@literal <exclude>}%regex[pkg.*Slow.*.class], Unstable*{@literal
</exclude>}
- * </code></pre>
- * <br>
- * <b>Notice that</b> these values are relative to the directory
containing generated test classes of the project
- * being tested. This directory is declared by the parameter {@code
testClassesDirectory} which defaults
- * to the POM property <code>${project.build.testOutputDirectory}</code>,
typically
- * <code>{@literal src/test/java}</code> unless overridden.
- */
- @Parameter
- // TODO use regex for fully qualified class names in 3.0 and change the
filtering abilities
- private List<String> excludes;
-
- /**
* ArtifactRepository of the localRepository. To obtain the directory of
localRepository in unit tests use
* System.getProperty("localRepository").
*/
@@ -3552,18 +3524,6 @@ public abstract class AbstractSurefireMojo
}
@Override
- public List<String> getExcludes()
- {
- return excludes;
- }
-
- @Override
- public void setExcludes( List<String> excludes )
- {
- this.excludes = excludes;
- }
-
- @Override
public ArtifactRepository getLocalRepository()
{
return localRepository;
diff --git
a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java
b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java
index e24c7bd..9c25b2c 100644
---
a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java
+++
b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java
@@ -661,6 +661,18 @@ public class AbstractSurefireMojoJava7PlusTest
}
@Override
+ public List<String> getExcludes()
+ {
+ return null;
+ }
+
+ @Override
+ public void setExcludes( List<String> excludes )
+ {
+
+ }
+
+ @Override
public boolean isPrintSummary()
{
return false;
diff --git
a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java
b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java
index b1afb7f..4cce707 100644
---
a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java
+++
b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java
@@ -2142,6 +2142,18 @@ public class AbstractSurefireMojoTest
}
@Override
+ public List<String> getExcludes()
+ {
+ return null;
+ }
+
+ @Override
+ public void setExcludes( List<String> excludes )
+ {
+
+ }
+
+ @Override
public boolean isPrintSummary()
{
return false;
diff --git
a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/MojoMocklessTest.java
b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/MojoMocklessTest.java
index 5db8639..1548dfd 100644
---
a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/MojoMocklessTest.java
+++
b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/MojoMocklessTest.java
@@ -506,6 +506,18 @@ public class MojoMocklessTest
}
@Override
+ public List<String> getExcludes()
+ {
+ return null;
+ }
+
+ @Override
+ public void setExcludes( List<String> excludes )
+ {
+
+ }
+
+ @Override
public boolean isPrintSummary()
{
return false;
diff --git
a/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
b/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
index 0e3d850..240d2a5 100644
---
a/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
+++
b/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
@@ -183,8 +183,8 @@ public class SurefirePlugin
@SuppressWarnings( "checkstyle:linelength" )
/**
- * A list of <include> elements specifying the tests (by pattern)
that should be included in testing. When not
- * specified and when the {@code test} parameter is not specified, the
default includes will be
+ * A list of {@literal <include>} elements specifying the tests (by
pattern) that should be included in testing.
+ * When not specified and when the {@code test} parameter is not
specified, the default includes will be
* <pre><code>
* {@literal <includes>}
* {@literal <include>}**{@literal /}Test*.java{@literal </include>}
@@ -194,7 +194,7 @@ public class SurefirePlugin
* {@literal </includes>}
* </code></pre>
* Each include item may also contain a comma-separated sub-list of items,
which will be treated as multiple
- * <include> entries.<br>
+ * {@literal <include>} entries.<br>
* Since 2.19 a complex syntax is supported in one parameter (JUnit 4,
JUnit 4.7+, TestNG):
* <pre><code>
* {@literal <include>}%regex[.*[Cat|Dog].*], Basic????,
!Unstable*{@literal </include>}
@@ -208,10 +208,39 @@ public class SurefirePlugin
* to the POM property {@code ${project.build.testOutputDirectory}},
typically
* <code>{@literal src/test/java}</code> unless overridden.
*/
- @Parameter
+ @Parameter( property = "surefire.includes" )
+ // TODO use regex for fully qualified class names in 3.0 and change the
filtering abilities
private List<String> includes;
/**
+ * A list of {@literal <exclude>} elements specifying the tests (by
pattern) that should be excluded in testing.
+ * When not specified and when the {@code test} parameter is not
specified, the default excludes will be <br>
+ * <pre><code>
+ * {@literal <excludes>}
+ * {@literal <exclude>}**{@literal /}*$*{@literal </exclude>}
+ * {@literal </excludes>}
+ * </code></pre>
+ * (which excludes all inner classes).
+ * <br>
+ * This parameter is ignored if the TestNG {@code suiteXmlFiles} parameter
is specified.
+ * <br>
+ * Each exclude item may also contain a comma-separated sub-list of items,
which will be treated as multiple
+ * {@literal <exclude>} entries.<br>
+ * Since 2.19 a complex syntax is supported in one parameter (JUnit 4,
JUnit 4.7+, TestNG):
+ * <pre><code>
+ * {@literal <exclude>}%regex[pkg.*Slow.*.class], Unstable*{@literal
</exclude>}
+ * </code></pre>
+ * <br>
+ * <b>Notice that</b> these values are relative to the directory
containing generated test classes of the project
+ * being tested. This directory is declared by the parameter {@code
testClassesDirectory} which defaults
+ * to the POM property <code>${project.build.testOutputDirectory}</code>,
typically
+ * <code>{@literal src/test/java}</code> unless overridden.
+ */
+ @Parameter( property = "surefire.excludes" )
+ // TODO use regex for fully qualified class names in 3.0 and change the
filtering abilities
+ private List<String> excludes;
+
+ /**
* Option to pass dependencies to the system's classloader instead of
using an isolated class loader when forking.
* Prevents problems with JDKs which implement the service provider lookup
mechanism by using the system's
* ClassLoader.
@@ -823,6 +852,18 @@ public class SurefirePlugin
}
@Override
+ public List<String> getExcludes()
+ {
+ return excludes;
+ }
+
+ @Override
+ public void setExcludes( List<String> excludes )
+ {
+ this.excludes = excludes;
+ }
+
+ @Override
public File[] getSuiteXmlFiles()
{
return suiteXmlFiles.clone();