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