View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.plugin.surefire;
20  
21  import java.io.File;
22  import java.util.Arrays;
23  import java.util.Collections;
24  import java.util.List;
25  
26  import org.apache.maven.plugin.MojoExecutionException;
27  import org.apache.maven.plugin.MojoFailureException;
28  import org.apache.maven.plugin.surefire.booterclient.ChecksumCalculator;
29  import org.apache.maven.plugins.annotations.LifecyclePhase;
30  import org.apache.maven.plugins.annotations.Mojo;
31  import org.apache.maven.plugins.annotations.Parameter;
32  import org.apache.maven.plugins.annotations.ResolutionScope;
33  import org.apache.maven.surefire.api.suite.RunResult;
34  import org.apache.maven.surefire.extensions.ForkNodeFactory;
35  
36  import static org.apache.maven.plugin.surefire.SurefireHelper.reportExecution;
37  
38  /**
39   * Run tests using Surefire.
40   *
41   * @author Jason van Zyl
42   */
43  @Mojo(
44          name = "test",
45          defaultPhase = LifecyclePhase.TEST,
46          threadSafe = true,
47          requiresDependencyResolution = ResolutionScope.TEST)
48  public class SurefirePlugin extends AbstractSurefireMojo implements SurefireReportParameters {
49  
50      /**
51       * The directory containing generated classes of the project being tested. This will be included after the test
52       * classes in the test classpath.
53       */
54      @Parameter(defaultValue = "${project.build.outputDirectory}")
55      private File classesDirectory;
56  
57      /**
58       * Set this to "true" to ignore a failure during testing. Its use is NOT RECOMMENDED, but quite convenient on
59       * occasion.
60       */
61      @Parameter(property = "maven.test.failure.ignore", defaultValue = "false")
62      private boolean testFailureIgnore;
63  
64      /**
65       * Base directory where all reports are written to.
66       */
67      @Parameter(defaultValue = "${project.build.directory}/surefire-reports")
68      private File reportsDirectory;
69  
70      @SuppressWarnings("checkstyle:linelength")
71      /**
72       * Specify this parameter to run individual tests by file name, overriding the parameter {@code includes} and
73       * {@code excludes}. Each pattern you specify here will be used to create an include pattern formatted like
74       * <code>**{@literal /}${test}.java</code>, so you can just type {@code -Dtest=MyTest} to run a single test called
75       * "foo/MyTest.java". The test patterns prefixed with a <em>!</em> will be excluded.
76       * <br>
77       * This parameter overrides the parameter {@code includes}, {@code excludes}, and the TestNG parameter
78       * {@code suiteXmlFiles}.
79       * <br>
80       * Since 2.7.3, you can execute a limited number of methods in the test by adding <i>#myMethod</i> or
81       * <i>#my*ethod</i>. For example, {@code -Dtest=MyTest#myMethod}. This is supported for junit 4.x and TestNg.<br>
82       * <br>
83       * Since 2.19 a complex syntax is supported in one parameter (JUnit 4, JUnit 4.7+, TestNG):
84       * <pre><code>"-Dtest=???Test, !Unstable*, pkg{@literal /}**{@literal /}Ci*leTest.java, *Test#test*One+testTwo?????, #fast*+slowTest"</code></pre>
85       * or e.g.
86       * <pre><code>"-Dtest=Basic*, !%regex[.*.Unstable.*], !%regex[.*.MyTest.class#one.*|two.*], %regex[#fast.*|slow.*]"</code></pre>
87       * <br>
88       * The Parameterized JUnit runner {@code describes} test methods using an index in brackets, so the non-regex
89       * method pattern would become: {@code #testMethod[*]}.
90       * If using <code>@Parameters(name="{index}: fib({0})={1}")</code> and selecting the index e.g. 5 in pattern, the
91       * non-regex method pattern would become {@code #testMethod[5:*]}.
92       */
93      @Parameter(property = "test")
94      private String test;
95  
96      /**
97       * Option to print summary of test suites or just print the test cases that have errors.
98       */
99      @Parameter(property = "surefire.printSummary", defaultValue = "true")
100     private boolean printSummary;
101 
102     /**
103      * Selects the formatting for the test report to be generated. Can be set as "brief" or "plain".
104      * Only applies to the output format of the output files  (target/surefire-reports/testName.txt)
105      */
106     @Parameter(property = "surefire.reportFormat", defaultValue = "brief")
107     private String reportFormat;
108 
109     /**
110      * Option to generate a file test report or just output the test report to the console.
111      */
112     @Parameter(property = "surefire.useFile", defaultValue = "true")
113     private boolean useFile;
114 
115     /**
116      * Set this to "true" to cause a failure if none of the tests specified in -Dtest=... are run. Defaults to
117      * "true".
118      *
119      * @since 2.12
120      */
121     @Parameter(property = "surefire.failIfNoSpecifiedTests", defaultValue = "true")
122     private boolean failIfNoSpecifiedTests;
123 
124     /**
125      * Attach a debugger to the forked JVM. If set to "true", the process will suspend and wait for a debugger to attach
126      * on port 5005. If set to some other string, that string will be appended to the argLine, allowing you to configure
127      * arbitrary debuggability options (without overwriting the other options specified through the {@code argLine}
128      * parameter).
129      *
130      * @since 2.4
131      */
132     @Parameter(property = "maven.surefire.debug")
133     private String debugForkedProcess;
134 
135     /**
136      * Kill the forked test process after a certain number of seconds. If set to 0, wait forever for the process, never
137      * timing out.
138      *
139      * @since 2.4
140      */
141     @Parameter(property = "surefire.timeout")
142     private int forkedProcessTimeoutInSeconds;
143 
144     /**
145      * Forked process is normally terminated without any significant delay after given tests have completed.
146      * If the particular tests started non-daemon Thread(s), the process hangs instead of been properly terminated
147      * by {@code System.exit()}. Use this parameter in order to determine the timeout of terminating the process.
148      * <a href="http://maven.apache.org/surefire/maven-surefire-plugin/examples/shutdown.html">see the documentation:
149      * http://maven.apache.org/surefire/maven-surefire-plugin/examples/shutdown.html</a>
150      * Turns to default fallback value of 30 seconds if negative integer.
151      *
152      * @since 2.20
153      */
154     @Parameter(property = "surefire.exitTimeout", defaultValue = "30")
155     private int forkedProcessExitTimeoutInSeconds;
156 
157     /**
158      * Stop executing queued parallel JUnit tests after a certain number of seconds.
159      * <br>
160      * Example values: "3.5", "4"<br>
161      * <br>
162      * If set to 0, wait forever, never timing out.
163      * Makes sense with specified {@code parallel} different from "none".
164      *
165      * @since 2.16
166      */
167     @Parameter(property = "surefire.parallel.timeout")
168     private double parallelTestsTimeoutInSeconds;
169 
170     /**
171      * Stop executing queued parallel JUnit tests
172      * and {@code interrupt} currently running tests after a certain number of seconds.
173      * <br>
174      * Example values: "3.5", "4"<br>
175      * <br>
176      * If set to 0, wait forever, never timing out.
177      * Makes sense with specified {@code parallel} different from "none".
178      *
179      * @since 2.16
180      */
181     @Parameter(property = "surefire.parallel.forcedTimeout")
182     private double parallelTestsTimeoutForcedInSeconds;
183 
184     @SuppressWarnings("checkstyle:linelength")
185     /**
186      * A list of {@literal <include>} elements specifying the tests (by pattern) that should be included in testing.
187      * When not specified and when the {@code test} parameter is not specified, the default includes will be
188      * <pre><code>
189      * {@literal <includes>}
190      *     {@literal <include>}**{@literal /}Test*.java{@literal </include>}
191      *     {@literal <include>}**{@literal /}*Test.java{@literal </include>}
192      *     {@literal <include>}**{@literal /}*Tests.java{@literal </include>}
193      *     {@literal <include>}**{@literal /}*TestCase.java{@literal </include>}
194      * {@literal </includes>}
195      * </code></pre>
196      * Each include item may also contain a comma-separated sub-list of items, which will be treated as multiple
197      * {@literal <include>} entries.<br>
198      * Since 2.19 a complex syntax is supported in one parameter (JUnit 4, JUnit 4.7+, TestNG):
199      * <pre><code>
200      * {@literal <include>}%regex[.*[Cat|Dog].*], Basic????, !Unstable*{@literal </include>}
201      * {@literal <include>}%regex[.*[Cat|Dog].*], !%regex[pkg.*Slow.*.class], pkg{@literal /}**{@literal /}*Fast*.java{@literal </include>}
202      * </code></pre>
203      * <br>
204      * This parameter is ignored if the TestNG {@code suiteXmlFiles} parameter is specified.<br>
205      * <br>
206      * <b>Notice that</b> these values are relative to the directory containing generated test classes of the project
207      * being tested. This directory is declared by the parameter {@code testClassesDirectory} which defaults
208      * to the POM property {@code ${project.build.testOutputDirectory}}, typically
209      * <code>{@literal src/test/java}</code> unless overridden.
210      */
211     @Parameter(property = "surefire.includes")
212     // TODO use regex for fully qualified class names in 3.0 and change the filtering abilities
213     private List<String> includes;
214 
215     /**
216      * A list of {@literal <exclude>} elements specifying the tests (by pattern) that should be excluded in testing.
217      * When not specified and when the {@code test} parameter is not specified, the default excludes will be <br>
218      * <pre><code>
219      * {@literal <excludes>}
220      *     {@literal <exclude>}**{@literal /}*$*{@literal </exclude>}
221      * {@literal </excludes>}
222      * </code></pre>
223      * (which excludes all inner classes).
224      * <br>
225      * This parameter is ignored if the TestNG {@code suiteXmlFiles} parameter is specified.
226      * <br>
227      * Each exclude item may also contain a comma-separated sub-list of items, which will be treated as multiple
228      * {@literal <exclude>} entries.<br>
229      * Since 2.19 a complex syntax is supported in one parameter (JUnit 4, JUnit 4.7+, TestNG):
230      * <pre><code>
231      * {@literal <exclude>}%regex[pkg.*Slow.*.class], Unstable*{@literal </exclude>}
232      * </code></pre>
233      * <br>
234      * <b>Notice that</b> these values are relative to the directory containing generated test classes of the project
235      * being tested. This directory is declared by the parameter {@code testClassesDirectory} which defaults
236      * to the POM property <code>${project.build.testOutputDirectory}</code>, typically
237      * <code>{@literal src/test/java}</code> unless overridden.
238      */
239     @Parameter(property = "surefire.excludes")
240     // TODO use regex for fully qualified class names in 3.0 and change the filtering abilities
241     private List<String> excludes;
242 
243     /**
244      * Option to pass dependencies to the system's classloader instead of using an isolated class loader when forking.
245      * Prevents problems with JDKs which implement the service provider lookup mechanism by using the system's
246      * ClassLoader.
247      *
248      * @since 2.3
249      */
250     @Parameter(property = "surefire.useSystemClassLoader", defaultValue = "true")
251     private boolean useSystemClassLoader;
252 
253     /**
254      * By default, Surefire forks your tests using a manifest-only JAR; set this parameter to "false" to force it to
255      * launch your tests with a plain old Java classpath. (See the
256      * <a href="http://maven.apache.org/plugins/maven-surefire-plugin/examples/class-loading.html">
257      *     http://maven.apache.org/plugins/maven-surefire-plugin/examples/class-loading.html</a>
258      * for a more detailed explanation of manifest-only JARs and their benefits.)
259      * <br>
260      * Beware, setting this to "false" may cause your tests to fail on Windows if your classpath is too long.
261      *
262      * @since 2.4.3
263      */
264     @Parameter(property = "surefire.useManifestOnlyJar", defaultValue = "true")
265     private boolean useManifestOnlyJar;
266 
267     /**
268      * The character encoding scheme to be applied while generating test report
269      * files (see target/surefire-reports/yourTestName.txt).
270      * The report output files (*-out.txt) are encoded in UTF-8 if not set otherwise.
271      *
272      * @since 3.0.0-M1
273      */
274     @Parameter(property = "surefire.encoding", defaultValue = "${project.reporting.outputEncoding}")
275     private String encoding;
276 
277     /**
278      * (JUnit 4+ providers and JUnit 5+ providers since 3.0.0-M4)
279      * The number of times each failing test will be rerun. If set larger than 0, rerun failing tests immediately after
280      * they fail. If a failing test passes in any of those reruns, it will be marked as pass and reported as a "flake".
281      * However, all the failing attempts will be recorded.
282      */
283     @Parameter(property = "surefire.rerunFailingTestsCount", defaultValue = "0")
284     private int rerunFailingTestsCount;
285 
286     /**
287      * Set this to a value greater than 0 to fail the whole test set if the cumulative number of flakes reaches
288      * this threshold. Set to 0 to allow an unlimited number of flakes.
289      *
290      * @since 3.0.0-M6
291      */
292     @Parameter(property = "surefire.failOnFlakeCount", defaultValue = "0")
293     private int failOnFlakeCount;
294 
295     /**
296      * (TestNG) List of &lt;suiteXmlFile&gt; elements specifying TestNG suite xml file locations. Note that
297      * {@code suiteXmlFiles} is incompatible with several other parameters of this plugin, like
298      * {@code includes} and {@code excludes}.<br>
299      * This parameter is ignored if the {@code test} parameter is specified (allowing you to run a single test
300      * instead of an entire suite).
301      *
302      * @since 2.2
303      */
304     @Parameter(property = "surefire.suiteXmlFiles")
305     private File[] suiteXmlFiles;
306 
307     /**
308      * Defines the order the tests will be run in. Supported values are {@code alphabetical},
309      * {@code reversealphabetical}, {@code random}, {@code hourly} (alphabetical on even hours, reverse alphabetical
310      * on odd hours), {@code failedfirst}, {@code balanced} and {@code filesystem}.
311      * <br>
312      * <br>
313      * Odd/Even for hourly is determined at the time the of scanning the classpath, meaning it could change during a
314      * multi-module build.
315      * <br>
316      * <br>
317      * Failed first will run tests that failed on previous run first, as well as new tests for this run.
318      * <br>
319      * <br>
320      * Balanced is only relevant with parallel=classes, and will try to optimize the run-order of the tests reducing the
321      * overall execution time. Initially a statistics file is created and every next test run will reorder classes.
322      * <br>
323      * <br>
324      * Note that the statistics are stored in a file named <b>.surefire-XXXXXXXXX</b> beside <i>pom.xml</i> and
325      * should not be checked into version control. The "XXXXX" is the SHA1 checksum of the entire surefire
326      * configuration, so different configurations will have different statistics files, meaning if you change any
327      * configuration settings you will re-run once before new statistics data can be established.
328      *
329      * @since 2.7
330      */
331     @Parameter(property = "surefire.runOrder", defaultValue = "filesystem")
332     private String runOrder;
333 
334     /**
335      * Sets the random seed that will be used to order the tests if {@code surefire.runOrder} is set to {@code random}.
336      * <br>
337      * <br>
338      * If no seeds are set and {@code surefire.runOrder} is set to {@code random}, then the seed used will be
339      * outputted (search for "To reproduce ordering use flag -Dsurefire.runOrder.random.seed").
340      * <br>
341      * <br>
342      * To deterministically reproduce any random test order that was run before, simply set the seed to
343      * be the same value.
344      *
345      * @since 3.0.0-M6
346      */
347     @Parameter(property = "surefire.runOrder.random.seed")
348     private Long runOrderRandomSeed;
349 
350     /**
351      * A file containing include patterns. Blank lines, or lines starting with # are ignored. If {@code includes} are
352      * also specified, these patterns are appended. Example with path, simple and regex includes:
353      * <pre><code>
354      * *{@literal /}test{@literal /}*
355      * **{@literal /}NotIncludedByDefault.java
356      * %regex[.*Test.*|.*Not.*]
357      * </code></pre>
358      * <br>
359      * Since 3.0.0-M6, method filtering support is provided in the inclusions file as well, example:
360      * <pre><code>
361      * pkg.SomeTest#testMethod
362      * </code></pre>
363      *
364      * @since 2.13
365      */
366     @Parameter(property = "surefire.includesFile")
367     private File includesFile;
368 
369     /**
370      * A file containing exclude patterns. Blank lines, or lines starting with # are ignored. If {@code excludes} are
371      * also specified, these patterns are appended. Example with path, simple and regex excludes:<br>
372      * <pre><code>
373      * *{@literal /}test{@literal /}*
374      * **{@literal /}DontRunTest.*
375      * %regex[.*Test.*|.*Not.*]
376      * </code></pre>
377      *
378      * Since 3.0.0-M6, method filtering support is provided in the exclusions file as well, example:
379      * <pre><code>
380      * pkg.SomeTest#testMethod
381      * </code></pre>
382      *
383      * @since 2.13
384      */
385     @Parameter(property = "surefire.excludesFile")
386     private File excludesFile;
387 
388     /**
389      * Set to error/failure count in order to skip remaining tests.
390      * Due to race conditions in parallel/forked execution this may not be fully guaranteed.<br>
391      * Enable with system property {@code -Dsurefire.skipAfterFailureCount=1} or any number greater than zero.
392      * Defaults to "0".<br>
393      * See the prerequisites and limitations in documentation:<br>
394      * <a href="http://maven.apache.org/plugins/maven-surefire-plugin/examples/skip-after-failure.html">
395      *     http://maven.apache.org/plugins/maven-surefire-plugin/examples/skip-after-failure.html</a>
396      *
397      * @since 2.19
398      */
399     @Parameter(property = "surefire.skipAfterFailureCount", defaultValue = "0")
400     private int skipAfterFailureCount;
401 
402     /**
403      * After the plugin process is shutdown by sending <i>SIGTERM signal (CTRL+C)</i>, <i>SHUTDOWN command</i> is
404      * received by every forked JVM.
405      * <br>
406      * The value is set to ({@code shutdown=exit}) by default (changed in version 3.0.0-M4).
407      * <br>
408      * The parameter can be configured with other two values {@code testset} and {@code kill}.
409      * <br>
410      * With({@code shutdown=testset}) the test set may still continue to run in forked JVM.
411      * <br>
412      * Using {@code exit} forked JVM executes {@code System.exit(1)} after the plugin process has received
413      * <i>SIGTERM signal</i>.
414      * <br>
415      * Using {@code kill} the JVM executes {@code Runtime.halt(1)} and kills itself.
416      *
417      * @since 2.19
418      */
419     @Parameter(property = "surefire.shutdown", defaultValue = "exit")
420     private String shutdown;
421 
422     /**
423      * When {@code true}, uses the modulepath when executing with JDK 9+ and <i>module-info.java</i> is
424      * present. When {@code false}, always uses the classpath.
425      * <br>
426      * Defaults to {@code true}.
427      *
428      * @since 3.0.0-M2
429      */
430     @Parameter(property = "surefire.useModulePath", defaultValue = "true")
431     private boolean useModulePath;
432 
433     /**
434      * This parameter configures the forked node. Currently, you can select the communication protocol, i.e. process
435      * pipes or TCP/IP sockets.
436      * The plugin uses process pipes by default which will be turned to TCP/IP in the version 3.0.0.
437      * Alternatively, you can implement your own factory and SPI.
438      * <br>
439      * See the documentation for more details:<br>
440      * <a href="https://maven.apache.org/plugins/maven-surefire-plugin/examples/process-communication.html">
441      *     https://maven.apache.org/plugins/maven-surefire-plugin/examples/process-communication.html</a>
442      *
443      * @since 3.0.0-M5
444      */
445     @Parameter(property = "surefire.forkNode")
446     private ForkNodeFactory forkNode;
447 
448     /**
449      * You can selectively exclude individual environment variables by enumerating their keys.
450      * <br>
451      * The environment is a system-dependent mapping from keys to values which is inherited from the Maven process
452      * to the forked Surefire processes. The keys must literally (case sensitive) match in order to exclude
453      * their environment variable.
454      * <br>
455      * Example to exclude three environment variables:
456      * <br>
457      * <i>mvn test -Dsurefire.excludedEnvironmentVariables=ACME1,ACME2,ACME3</i>
458      *
459      * @since 3.0.0-M4
460      */
461     @Parameter(property = "surefire.excludedEnvironmentVariables")
462     private String[] excludedEnvironmentVariables;
463 
464     /**
465      * Since 3.0.0-M4 the process checkers are disabled.
466      * You can enable them namely by setting {@code ping} and {@code native} or {@code all} in this parameter.
467      * <br>
468      * The checker is useful in situations when you kill the build on a CI system and you want the Surefire forked JVM
469      * to kill the tests asap and free all handlers on the file system been previously used by the JVM and by the tests.
470      *
471      * <br>
472      *
473      * The {@code ping} should be safely used together with ZGC or Shenandoah Garbage Collector.
474      * Due to the {@code ping} relies on timing of the PING (triggered every 30 seconds), slow GCs may pause
475      * the timers and pretend that the parent process of the forked JVM does not exist.
476      *
477      * <br>
478      *
479      * The {@code native} is very fast checker.
480      * It is useful mechanism on Unix based systems, Linux distributions and Alpine/BusyBox Linux.
481      * See the JIRA <a href="https://issues.apache.org/jira/browse/SUREFIRE-1631">SUREFIRE-1631</a> for Windows issues.
482      *
483      * <br>
484      *
485      * Another useful configuration parameter is {@code forkedProcessTimeoutInSeconds}.
486      * <br>
487      * See the Frequently Asked Questions page with more details:<br>
488      * <a href="http://maven.apache.org/surefire/maven-surefire-plugin/faq.html#kill-jvm">
489      *     http://maven.apache.org/surefire/maven-surefire-plugin/faq.html#kill-jvm</a>
490      * <br>
491      * <a href="http://maven.apache.org/surefire/maven-failsafe-plugin/faq.html#kill-jvm">
492      *     http://maven.apache.org/surefire/maven-failsafe-plugin/faq.html#kill-jvm</a>
493      *
494      * <br>
495      *
496      * Example of use:
497      * <br>
498      * <i>mvn test -Dsurefire.enableProcessChecker=all</i>
499      *
500      * @since 3.0.0-M4
501      */
502     @Parameter(property = "surefire.enableProcessChecker")
503     private String enableProcessChecker;
504 
505     @Parameter(property = "surefire.systemPropertiesFile")
506     private File systemPropertiesFile;
507 
508     /**
509      * Provide the ID/s of an JUnit engine to be included in the test run.
510      *
511      * @since 3.0.0-M6
512      */
513     @Parameter(property = "surefire.includeJUnit5Engines")
514     private String[] includeJUnit5Engines;
515 
516     /**
517      * Provide the ID/s of an JUnit engine to be excluded in the test run.
518      *
519      * @since 3.0.0-M6
520      */
521     @Parameter(property = "surefire.excludeJUnit5Engines")
522     private String[] excludeJUnit5Engines;
523 
524     @Override
525     protected int getRerunFailingTestsCount() {
526         return rerunFailingTestsCount;
527     }
528 
529     @Override
530     public int getFailOnFlakeCount() {
531         return failOnFlakeCount;
532     }
533 
534     @Override
535     public void setFailOnFlakeCount(int failOnFlakeCount) {
536         this.failOnFlakeCount = failOnFlakeCount;
537     }
538 
539     @Override
540     protected void handleSummary(RunResult summary, Exception firstForkException)
541             throws MojoExecutionException, MojoFailureException {
542         reportExecution(this, summary, getConsoleLogger(), firstForkException);
543     }
544 
545     @Override
546     protected boolean isSkipExecution() {
547         return isSkip() || isSkipTests() || isSkipExec();
548     }
549 
550     @Override
551     protected String getPluginName() {
552         return "surefire";
553     }
554 
555     @Override
556     protected String[] getDefaultIncludes() {
557         return new String[] {"**/Test*.java", "**/*Test.java", "**/*Tests.java", "**/*TestCase.java"};
558     }
559 
560     @Override
561     protected String getReportSchemaLocation() {
562         return "https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report-3.0.xsd";
563     }
564 
565     public File getSystemPropertiesFile() {
566         return systemPropertiesFile;
567     }
568 
569     public void setSystemPropertiesFile(File systemPropertiesFile) {
570         this.systemPropertiesFile = systemPropertiesFile;
571     }
572 
573     // now for the implementation of the field accessors
574 
575     @Override
576     public boolean isSkipTests() {
577         return skipTests;
578     }
579 
580     @Override
581     public void setSkipTests(boolean skipTests) {
582         this.skipTests = skipTests;
583     }
584 
585     @Override
586     @Deprecated
587     public boolean isSkipExec() {
588         return skipExec;
589     }
590 
591     @Override
592     @Deprecated
593     public void setSkipExec(boolean skipExec) {
594         this.skipExec = skipExec;
595     }
596 
597     @Override
598     public boolean isSkip() {
599         return skip;
600     }
601 
602     @Override
603     public void setSkip(boolean skip) {
604         this.skip = skip;
605     }
606 
607     @Override
608     public boolean isTestFailureIgnore() {
609         return testFailureIgnore;
610     }
611 
612     @Override
613     public void setTestFailureIgnore(boolean testFailureIgnore) {
614         this.testFailureIgnore = testFailureIgnore;
615     }
616 
617     @Override
618     public File getBasedir() {
619         return basedir;
620     }
621 
622     @Override
623     public void setBasedir(File basedir) {
624         this.basedir = basedir;
625     }
626 
627     @Override
628     public File getTestClassesDirectory() {
629         return testClassesDirectory;
630     }
631 
632     @Override
633     public void setTestClassesDirectory(File testClassesDirectory) {
634         this.testClassesDirectory = testClassesDirectory;
635     }
636 
637     @Override
638     public File getMainBuildPath() {
639         return classesDirectory;
640     }
641 
642     @Override
643     public void setMainBuildPath(File mainBuildPath) {
644         classesDirectory = mainBuildPath;
645     }
646 
647     @Override
648     public File getReportsDirectory() {
649         return reportsDirectory;
650     }
651 
652     @Override
653     public void setReportsDirectory(File reportsDirectory) {
654         this.reportsDirectory = reportsDirectory;
655     }
656 
657     @Override
658     public String getTest() {
659         return test;
660     }
661 
662     @Override
663     public boolean isUseSystemClassLoader() {
664         return useSystemClassLoader;
665     }
666 
667     @Override
668     public void setUseSystemClassLoader(boolean useSystemClassLoader) {
669         this.useSystemClassLoader = useSystemClassLoader;
670     }
671 
672     @Override
673     public boolean isUseManifestOnlyJar() {
674         return useManifestOnlyJar;
675     }
676 
677     @Override
678     public void setUseManifestOnlyJar(boolean useManifestOnlyJar) {
679         this.useManifestOnlyJar = useManifestOnlyJar;
680     }
681 
682     @Override
683     public String getEncoding() {
684         return encoding;
685     }
686 
687     @Override
688     public void setEncoding(String encoding) {
689         this.encoding = encoding;
690     }
691 
692     @Override
693     public boolean getFailIfNoSpecifiedTests() {
694         return failIfNoSpecifiedTests;
695     }
696 
697     @Override
698     public void setFailIfNoSpecifiedTests(boolean failIfNoSpecifiedTests) {
699         this.failIfNoSpecifiedTests = failIfNoSpecifiedTests;
700     }
701 
702     @Override
703     public int getSkipAfterFailureCount() {
704         return skipAfterFailureCount;
705     }
706 
707     @Override
708     public String getShutdown() {
709         return shutdown;
710     }
711 
712     @Override
713     public boolean isPrintSummary() {
714         return printSummary;
715     }
716 
717     @Override
718     public void setPrintSummary(boolean printSummary) {
719         this.printSummary = printSummary;
720     }
721 
722     @Override
723     public String getReportFormat() {
724         return reportFormat;
725     }
726 
727     @Override
728     public void setReportFormat(String reportFormat) {
729         this.reportFormat = reportFormat;
730     }
731 
732     @Override
733     public boolean isUseFile() {
734         return useFile;
735     }
736 
737     @Override
738     public void setUseFile(boolean useFile) {
739         this.useFile = useFile;
740     }
741 
742     @Override
743     public String getDebugForkedProcess() {
744         return debugForkedProcess;
745     }
746 
747     @Override
748     public void setDebugForkedProcess(String debugForkedProcess) {
749         this.debugForkedProcess = debugForkedProcess;
750     }
751 
752     @Override
753     public int getForkedProcessTimeoutInSeconds() {
754         return forkedProcessTimeoutInSeconds;
755     }
756 
757     @Override
758     public void setForkedProcessTimeoutInSeconds(int forkedProcessTimeoutInSeconds) {
759         this.forkedProcessTimeoutInSeconds = forkedProcessTimeoutInSeconds;
760     }
761 
762     @Override
763     public int getForkedProcessExitTimeoutInSeconds() {
764         return forkedProcessExitTimeoutInSeconds;
765     }
766 
767     @Override
768     public void setForkedProcessExitTimeoutInSeconds(int forkedProcessExitTimeoutInSeconds) {
769         this.forkedProcessExitTimeoutInSeconds = forkedProcessExitTimeoutInSeconds;
770     }
771 
772     @Override
773     public double getParallelTestsTimeoutInSeconds() {
774         return parallelTestsTimeoutInSeconds;
775     }
776 
777     @Override
778     public void setParallelTestsTimeoutInSeconds(double parallelTestsTimeoutInSeconds) {
779         this.parallelTestsTimeoutInSeconds = parallelTestsTimeoutInSeconds;
780     }
781 
782     @Override
783     public double getParallelTestsTimeoutForcedInSeconds() {
784         return parallelTestsTimeoutForcedInSeconds;
785     }
786 
787     @Override
788     public void setParallelTestsTimeoutForcedInSeconds(double parallelTestsTimeoutForcedInSeconds) {
789         this.parallelTestsTimeoutForcedInSeconds = parallelTestsTimeoutForcedInSeconds;
790     }
791 
792     @Override
793     public void setTest(String test) {
794         this.test = test;
795     }
796 
797     @Override
798     public List<String> getIncludes() {
799         return includes;
800     }
801 
802     @Override
803     public void setIncludes(List<String> includes) {
804         this.includes = includes;
805     }
806 
807     @Override
808     public List<String> getExcludes() {
809         return excludes;
810     }
811 
812     @Override
813     public void setExcludes(List<String> excludes) {
814         this.excludes = excludes;
815     }
816 
817     @Override
818     public File[] getSuiteXmlFiles() {
819         return suiteXmlFiles.clone();
820     }
821 
822     @Override
823     @SuppressWarnings("UnusedDeclaration")
824     public void setSuiteXmlFiles(File[] suiteXmlFiles) {
825         this.suiteXmlFiles = suiteXmlFiles.clone();
826     }
827 
828     @Override
829     public String getRunOrder() {
830         return runOrder;
831     }
832 
833     @Override
834     @SuppressWarnings("UnusedDeclaration")
835     public void setRunOrder(String runOrder) {
836         this.runOrder = runOrder;
837     }
838 
839     @Override
840     public Long getRunOrderRandomSeed() {
841         return runOrderRandomSeed;
842     }
843 
844     @Override
845     public void setRunOrderRandomSeed(Long runOrderRandomSeed) {
846         this.runOrderRandomSeed = runOrderRandomSeed;
847     }
848 
849     @Override
850     public File getIncludesFile() {
851         return includesFile;
852     }
853 
854     @Override
855     public File getExcludesFile() {
856         return excludesFile;
857     }
858 
859     @Override
860     protected boolean useModulePath() {
861         return useModulePath;
862     }
863 
864     @Override
865     protected void setUseModulePath(boolean useModulePath) {
866         this.useModulePath = useModulePath;
867     }
868 
869     @Override
870     protected final List<File> suiteXmlFiles() {
871         return hasSuiteXmlFiles() ? Arrays.asList(suiteXmlFiles) : Collections.<File>emptyList();
872     }
873 
874     @Override
875     protected final boolean hasSuiteXmlFiles() {
876         return suiteXmlFiles != null && suiteXmlFiles.length != 0;
877     }
878 
879     @Override
880     protected final String[] getExcludedEnvironmentVariables() {
881         return excludedEnvironmentVariables == null ? new String[0] : excludedEnvironmentVariables;
882     }
883 
884     void setExcludedEnvironmentVariables(String[] excludedEnvironmentVariables) {
885         this.excludedEnvironmentVariables = excludedEnvironmentVariables;
886     }
887 
888     @Override
889     protected final String getEnableProcessChecker() {
890         return enableProcessChecker;
891     }
892 
893     @Override
894     protected final ForkNodeFactory getForkNode() {
895         return forkNode;
896     }
897 
898     @Override
899     protected void warnIfIllegalFailOnFlakeCount() throws MojoFailureException {
900         if (failOnFlakeCount < 0) {
901             throw new MojoFailureException("Parameter \"failOnFlakeCount\" should not be negative.");
902         }
903         if (failOnFlakeCount > 0 && rerunFailingTestsCount < 1) {
904             throw new MojoFailureException("\"failOnFlakeCount\" requires rerunFailingTestsCount to be at least 1.");
905         }
906     }
907 
908     @Override
909     protected void addPluginSpecificChecksumItems(ChecksumCalculator checksum) {
910         checksum.add(skipAfterFailureCount);
911     }
912 
913     public String[] getIncludeJUnit5Engines() {
914         return includeJUnit5Engines;
915     }
916 
917     @SuppressWarnings("UnusedDeclaration")
918     public void setIncludeJUnit5Engines(String[] includeJUnit5Engines) {
919         this.includeJUnit5Engines = includeJUnit5Engines;
920     }
921 
922     public String[] getExcludeJUnit5Engines() {
923         return excludeJUnit5Engines;
924     }
925 
926     @SuppressWarnings("UnusedDeclaration")
927     public void setExcludeJUnit5Engines(String[] excludeJUnit5Engines) {
928         this.excludeJUnit5Engines = excludeJUnit5Engines;
929     }
930 }