1 package org.apache.maven.plugin.surefire;
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 java.io.File;
23 import java.util.HashMap;
24 import java.util.List;
25 import java.util.Map;
26 import java.util.Properties;
27 import org.apache.maven.artifact.factory.ArtifactFactory;
28 import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
29 import org.apache.maven.artifact.repository.ArtifactRepository;
30 import org.apache.maven.artifact.resolver.ArtifactResolver;
31 import org.apache.maven.execution.MavenSession;
32 import org.apache.maven.plugin.MojoExecutionException;
33 import org.apache.maven.plugin.MojoFailureException;
34 import org.apache.maven.plugin.surefire.booterclient.ChecksumCalculator;
35 import org.apache.maven.project.MavenProject;
36 import org.apache.maven.surefire.suite.RunResult;
37 import org.apache.maven.toolchain.ToolchainManager;
38 import org.codehaus.plexus.util.StringUtils;
39
40 /**
41 * Run tests using Surefire.
42 *
43 * @author Jason van Zyl
44 * @version $Id: SurefirePlugin.java 1208125 2011-11-29 22:57:02Z krosenvold $
45 * @requiresDependencyResolution test
46 * @goal test
47 * @phase test
48 * @threadSafe
49 * @noinspection JavaDoc
50 */
51 public class SurefirePlugin
52 extends AbstractSurefireMojo
53 implements SurefireReportParameters
54 {
55
56 /**
57 * Set this to "true" to skip running tests, but still compile them. Its use is NOT RECOMMENDED, but quite
58 * convenient on occasion.
59 *
60 * @parameter default-value="false" expression="${skipTests}"
61 * @since 2.4
62 */
63 private boolean skipTests;
64
65 /**
66 * This old parameter is just like <code>skipTests</code>, but bound to the old property "maven.test.skip.exec".
67 *
68 * @parameter expression="${maven.test.skip.exec}"
69 * @since 2.3
70 * @deprecated Use skipTests instead.
71 */
72 private boolean skipExec;
73
74 /**
75 * Set this to "true" to bypass unit tests entirely. Its use is NOT RECOMMENDED, especially if you enable it using
76 * the "maven.test.skip" property, because maven.test.skip disables both running the tests and compiling the tests.
77 * Consider using the <code>skipTests</code> parameter instead.
78 *
79 * @parameter default-value="false" expression="${maven.test.skip}"
80 */
81 private boolean skip;
82
83 /**
84 * Set this to "true" to ignore a failure during testing. Its use is NOT RECOMMENDED, but quite convenient on
85 * occasion.
86 *
87 * @parameter default-value="false" expression="${maven.test.failure.ignore}"
88 */
89 private boolean testFailureIgnore;
90
91 /**
92 * The base directory of the project being tested. This can be obtained in your unit test via
93 * System.getProperty("basedir").
94 *
95 * @parameter default-value="${basedir}"
96 */
97 private File basedir;
98
99 /**
100 * The directory containing generated test classes of the project being tested. This will be included at the
101 * beginning of the test classpath. *
102 *
103 * @parameter default-value="${project.build.testOutputDirectory}"
104 */
105 private File testClassesDirectory;
106
107 /**
108 * The directory containing generated classes of the project being tested. This will be included after the test
109 * classes in the test classpath.
110 *
111 * @parameter default-value="${project.build.outputDirectory}"
112 */
113 private File classesDirectory;
114
115 /**
116 * The Maven Project Object.
117 *
118 * @parameter default-value="${project}"
119 * @readonly
120 */
121 private MavenProject project;
122
123 /**
124 * List of dependencies to exclude from the test classpath. Each dependency string must follow the format
125 * <i>groupId:artifactId</i>. For example: <i>org.acme:project-a</i>
126 *
127 * @parameter
128 * @since 2.6
129 */
130 private List classpathDependencyExcludes;
131
132 /**
133 * A dependency scope to exclude from the test classpath. The scope can be one of the following scopes:
134 * <p/>
135 * <ul>
136 * <li><i>compile</i> - system, provided, compile
137 * <li><i>runtime</i> - compile, runtime
138 * <li><i>test</i> - system, provided, compile, runtime, test
139 * </ul>
140 *
141 * @parameter default-value=""
142 * @since 2.6
143 */
144 private String classpathDependencyScopeExclude;
145
146 /**
147 * Additional elements to be appended to the classpath.
148 *
149 * @parameter
150 * @since 2.4
151 */
152 private List additionalClasspathElements;
153
154 /**
155 * Base directory where all reports are written to.
156 *
157 * @parameter default-value="${project.build.directory}/surefire-reports"
158 */
159 private File reportsDirectory;
160
161 /**
162 * The test source directory containing test class sources.
163 *
164 * @parameter default-value="${project.build.testSourceDirectory}"
165 * @required
166 * @since 2.2
167 */
168 private File testSourceDirectory;
169
170 /**
171 * Specify this parameter to run individual tests by file name, overriding the <code>includes/excludes</code>
172 * parameters. Each pattern you specify here will be used to create an include pattern formatted like
173 * <code>**/${test}.java</code>, so you can just type "-Dtest=MyTest" to run a single test called
174 * "foo/MyTest.java".<br/>
175 * This parameter overrides the <code>includes/excludes</code> parameters, and the TestNG <code>suiteXmlFiles</code>
176 * parameter.
177 * <p/>
178 * Since 2.7.3, you can execute a limited number of methods in the test by adding #myMethod or #my*ethod. For example,
179 * "-Dtest=MyTest#myMethod". This is supported for junit 4.x and testNg.
180 *
181 * @parameter expression="${test}"
182 */
183 private String test;
184
185 /**
186 * A list of <include> elements specifying the tests (by pattern) that should be included in testing. When not
187 * specified and when the <code>test</code> parameter is not specified, the default includes will be <code><br/>
188 * <includes><br/>
189 * <include>**/Test*.java</include><br/>
190 * <include>**/*Test.java</include><br/>
191 * <include>**/*TestCase.java</include><br/>
192 * </includes><br/>
193 * </code> This parameter is ignored if the TestNG <code>suiteXmlFiles</code> parameter is specified.
194 *
195 * @parameter
196 */
197 private List includes;
198
199 /**
200 * A list of <exclude> elements specifying the tests (by pattern) that should be excluded in testing. When not
201 * specified and when the <code>test</code> parameter is not specified, the default excludes will be <code><br/>
202 * <excludes><br/>
203 * <exclude>**/*$*</exclude><br/>
204 * </excludes><br/>
205 * </code> (which excludes all inner classes).<br>
206 * This parameter is ignored if the TestNG <code>suiteXmlFiles</code> parameter is specified.
207 *
208 * @parameter
209 */
210 private List excludes;
211
212 /**
213 * ArtifactRepository of the localRepository. To obtain the directory of localRepository in unit tests use
214 * System.getProperty("localRepository").
215 *
216 * @parameter expression="${localRepository}"
217 * @required
218 * @readonly
219 */
220 private ArtifactRepository localRepository;
221
222 /**
223 * List of System properties to pass to the JUnit tests.
224 *
225 * @parameter
226 * @deprecated Use systemPropertyVariables instead.
227 */
228 private Properties systemProperties;
229
230 /**
231 * List of System properties to pass to the JUnit tests.
232 *
233 * @parameter
234 * @since 2.5
235 */
236 private Map systemPropertyVariables;
237
238 /**
239 * List of System properties, loaded from a file, to pass to the JUnit tests.
240 *
241 * @parameter
242 * @since 2.8.2
243 */
244 private File systemPropertiesFile;
245
246 /**
247 * List of properties for configuring all TestNG related configurations. This is the new preferred method of
248 * configuring TestNG.
249 *
250 * @parameter
251 * @since 2.4
252 */
253 private Properties properties;
254
255 /**
256 * Map of plugin artifacts.
257 *
258 * @parameter expression="${plugin.artifactMap}"
259 * @required
260 * @readonly
261 */
262 private Map pluginArtifactMap;
263
264 /**
265 * Map of project artifacts.
266 *
267 * @parameter expression="${project.artifactMap}"
268 * @required
269 * @readonly
270 */
271 private Map projectArtifactMap;
272
273 /**
274 * Option to print summary of test suites or just print the test cases that have errors.
275 *
276 * @parameter expression="${surefire.printSummary}" default-value="true"
277 */
278 private boolean printSummary;
279
280 /**
281 * Selects the formatting for the test report to be generated. Can be set as "brief" or "plain".
282 *
283 * @parameter expression="${surefire.reportFormat}" default-value="brief"
284 */
285 private String reportFormat;
286
287 /**
288 * Add custom text into report filename: TEST-testClassName-reportNameSuffix.xml,
289 * testClassName-reportNameSuffix.txt and testClassName-reportNameSuffix-output.txt.
290 * File TEST-testClassName-reportNameSuffix.xml has changed attributes 'testsuite'--'name'
291 * and 'testcase'--'classname' - reportNameSuffix is added to the attribute value.
292 *
293 * @parameter expression="${surefire.reportNameSuffix}" default-value=""
294 */
295 private String reportNameSuffix;
296
297 /**
298 * Option to generate a file test report or just output the test report to the console.
299 *
300 * @parameter expression="${surefire.useFile}" default-value="true"
301 */
302 private boolean useFile;
303
304 /**
305 * Set this to "true" to redirect the unit test standard output to a file (found in
306 * reportsDirectory/testName-output.txt).
307 *
308 * @parameter expression="${maven.test.redirectTestOutputToFile}" default-value="false"
309 * @since 2.3
310 */
311 private boolean redirectTestOutputToFile;
312
313 /**
314 * Set this to "true" to cause a failure if there are no tests to run. Defaults to "false".
315 *
316 * @parameter expression="${failIfNoTests}"
317 * @since 2.4
318 */
319 private Boolean failIfNoTests;
320
321 /**
322 * Option to specify the forking mode. Can be "never", "once" or "always". "none" and "pertest" are also accepted
323 * for backwards compatibility. "always" forks for each test-class.
324 *
325 * @parameter expression="${forkMode}" default-value="once"
326 * @since 2.1
327 */
328 private String forkMode;
329
330 /**
331 * Option to specify the jvm (or path to the java executable) to use with the forking options. For the default, the
332 * jvm will be a new instance of the same VM as the one used to run Maven. JVM settings are not inherited from
333 * MAVEN_OPTS.
334 *
335 * @parameter expression="${jvm}"
336 * @since 2.1
337 */
338 private String jvm;
339
340 /**
341 * Arbitrary JVM options to set on the command line.
342 *
343 * @parameter expression="${argLine}"
344 * @since 2.1
345 */
346 private String argLine;
347
348 /**
349 * Attach a debugger to the forked JVM. If set to "true", the process will suspend and wait for a debugger to attach
350 * on port 5005. If set to some other string, that string will be appended to the argLine, allowing you to configure
351 * arbitrary debuggability options (without overwriting the other options specified through the <code>argLine</code>
352 * parameter).
353 *
354 * @parameter expression="${maven.surefire.debug}"
355 * @since 2.4
356 */
357 private String debugForkedProcess;
358
359 /**
360 * Kill the forked test process after a certain number of seconds. If set to 0, wait forever for the process, never
361 * timing out.
362 *
363 * @parameter expression="${surefire.timeout}"
364 * @since 2.4
365 */
366 private int forkedProcessTimeoutInSeconds;
367
368 /**
369 * Additional environment variables to set on the command line.
370 *
371 * @parameter
372 * @since 2.1.3
373 */
374 private Map environmentVariables = new HashMap();
375
376 /**
377 * Command line working directory.
378 *
379 * @parameter expression="${basedir}"
380 * @since 2.1.3
381 */
382 private File workingDirectory;
383
384 /**
385 * When false it makes tests run using the standard classloader delegation instead of the default Maven isolated
386 * classloader. Only used when forking (forkMode is not "none").<br/>
387 * Setting it to false helps with some problems caused by conflicts between xml parsers in the classpath and the
388 * Java 5 provider parser.
389 *
390 * @parameter expression="${childDelegation}" default-value="false"
391 * @since 2.1
392 */
393 private boolean childDelegation;
394
395 /**
396 * (TestNG/JUnit47 provider with JUnit4.8+ only) Groups for this test. Only classes/methods/etc decorated with one of the groups specified here will
397 * be included in test run, if specified. <br/>For JUnit, this parameter forces the use of the 4.7 provider<br/>
398 * This parameter is ignored if the <code>suiteXmlFiles</code> parameter is specified.
399 * .
400 *
401 * @parameter expression="${groups}"
402 * @since 2.2
403 */
404 private String groups;
405
406 /**
407 * (TestNG/JUnit47 provider with JUnit4.8+ only) Excluded groups. Any methods/classes/etc with one of the groups specified in this list will
408 * specifically not be run.<br/>For JUnit, this parameter forces the use of the 4.7 provider<br/>
409 * This parameter is ignored if the <code>suiteXmlFiles</code> parameter is specified.
410 *
411 * @parameter expression="${excludedGroups}"
412 * @since 2.2
413 */
414 private String excludedGroups;
415
416 /**
417 * (TestNG) List of <suiteXmlFile> elements specifying TestNG suite xml file locations. Note that
418 * <code>suiteXmlFiles</code> is incompatible with several other parameters of this plugin, like
419 * <code>includes/excludes</code>.<br/>
420 * This parameter is ignored if the <code>test</code> parameter is specified (allowing you to run a single test
421 * instead of an entire suite).
422 *
423 * @parameter
424 * @since 2.2
425 */
426 private File[] suiteXmlFiles;
427
428 /**
429 * Allows you to specify the name of the JUnit artifact. If not set, <code>junit:junit</code> will be used.
430 *
431 * @parameter expression="${junitArtifactName}" default-value="junit:junit"
432 * @since 2.3.1
433 */
434 private String junitArtifactName;
435
436 /**
437 * Allows you to specify the name of the TestNG artifact. If not set, <code>org.testng:testng</code> will be used.
438 *
439 * @parameter expression="${testNGArtifactName}" default-value="org.testng:testng"
440 * @since 2.3.1
441 */
442 private String testNGArtifactName;
443
444 /**
445 * (TestNG/JUnit 4.7 provider only) The attribute thread-count allows you to specify how many threads should be
446 * allocated for this execution. Only makes sense to use in conjunction with the <code>parallel</code> parameter.
447 *
448 * @parameter expression="${threadCount}"
449 * @since 2.2
450 */
451 private int threadCount;
452
453 /**
454 * (JUnit 4.7 provider) Indicates that threadCount is per cpu core.
455 *
456 * @parameter expression="${perCoreThreadCount}" default-value="true"
457 * @since 2.5
458 */
459 private boolean perCoreThreadCount;
460
461 /**
462 * (JUnit 4.7 provider) Indicates that the thread pool will be unlimited. The <code>parallel</code> parameter and
463 * the actual number of classes/methods will decide. Setting this to "true" effectively disables
464 * <code>perCoreThreadCount</code> and <code>threadCount</code>. Defaults to "false".
465 *
466 * @parameter expression="${useUnlimitedThreads}" default-value="false"
467 * @since 2.5
468 */
469 private boolean useUnlimitedThreads;
470
471 /**
472 * (TestNG only) When you use the <code>parallel</code> attribute, TestNG will try to run all your test methods in
473 * separate threads, except for methods that depend on each other, which will be run in the same thread in order to
474 * respect their order of execution.
475 * <p/>
476 * (JUnit 4.7 provider) Supports values "classes"/"methods"/"both" to run in separate threads, as controlled by
477 * <code>threadCount</code>.
478 *
479 * @parameter expression="${parallel}"
480 * @since 2.2
481 */
482 private String parallel;
483
484 /**
485 * Whether to trim the stack trace in the reports to just the lines within the test, or show the full trace.
486 *
487 * @parameter expression="${trimStackTrace}" default-value="true"
488 * @since 2.2
489 */
490 private boolean trimStackTrace;
491
492 /**
493 * Resolves the artifacts needed.
494 *
495 * @component
496 */
497 private ArtifactResolver artifactResolver;
498
499 /**
500 * Creates the artifact.
501 *
502 * @component
503 */
504 private ArtifactFactory artifactFactory;
505
506 /**
507 * The remote plugin repositories declared in the POM.
508 *
509 * @parameter expression="${project.pluginArtifactRepositories}"
510 * @since 2.2
511 */
512 private List remoteRepositories;
513
514 /**
515 * For retrieval of artifact's metadata.
516 *
517 * @component
518 */
519 private ArtifactMetadataSource metadataSource;
520
521 private Properties originalSystemProperties;
522
523 /**
524 * systemPropertyVariables + systemProperties
525 */
526 private Properties internalSystemProperties = new Properties();
527
528 /**
529 * Flag to disable the generation of report files in xml format.
530 *
531 * @parameter expression="${disableXmlReport}" default-value="false"
532 * @since 2.2
533 */
534 private boolean disableXmlReport;
535
536 /**
537 * Option to pass dependencies to the system's classloader instead of using an isolated class loader when forking.
538 * Prevents problems with JDKs which implement the service provider lookup mechanism by using the system's
539 * classloader.
540 *
541 * @parameter expression="${surefire.useSystemClassLoader}" default-value="true"
542 * @since 2.3
543 */
544 private boolean useSystemClassLoader;
545
546 /**
547 * By default, Surefire forks your tests using a manifest-only JAR; set this parameter to "false" to force it to
548 * launch your tests with a plain old Java classpath. (See
549 * http://maven.apache.org/plugins/maven-surefire-plugin/examples/class-loading.html for a more detailed explanation
550 * of manifest-only JARs and their benefits.)
551 * <p/>
552 * Beware, setting this to "false" may cause your tests to fail on Windows if your classpath is too long.
553 *
554 * @parameter expression="${surefire.useManifestOnlyJar}" default-value="true"
555 * @since 2.4.3
556 */
557 private boolean useManifestOnlyJar;
558
559 /**
560 * By default, Surefire enables JVM assertions for the execution of your test cases. To disable the assertions, set
561 * this flag to "false".
562 *
563 * @parameter expression="${enableAssertions}" default-value="true"
564 * @since 2.3.1
565 */
566 private boolean enableAssertions;
567
568 /**
569 * The current build session instance.
570 *
571 * @parameter expression="${session}"
572 * @required
573 * @readonly
574 */
575 private MavenSession session;
576
577 /**
578 * (TestNG only) Define the factory class used to create all test instances.
579 *
580 * @parameter expression="${objectFactory}"
581 * @since 2.5
582 */
583 private String objectFactory;
584
585 /**
586 * @parameter default-value="${session.parallel}"
587 * @readonly
588 * @noinspection UnusedDeclaration
589 */
590 private Boolean parallelMavenExecution;
591
592 /**
593 * Defines the order the tests will be run in. Supported values are "alphabetical", "reversealphabetical", "random",
594 * "hourly" (alphabetical on even hours, reverse alphabetical on odd hours), "failedfirst", "balanced" and "filesystem".
595 * <p/>
596 * <p/>
597 * Odd/Even for hourly is determined at the time the of scanning the classpath, meaning it could change during a
598 * multi-module build.
599 * <p/>
600 * Failed first will run tests that failed on previous run first, as well as new tests for this run.
601 * <p/>
602 * Balanced is only relevant with parallel=classes, and will try to optimize the run-order of the tests to
603 * make all tests complete at the same time, reducing the overall execution time.
604 * <p/>
605 * Note that the statistics are stored in a file named .surefire-XXXXXXXXX beside pom.xml, and should not
606 * be checked into version control. The "XXXXX" is the SHA1 checksum of the entire surefire configuration,
607 * so different configurations will have different statistics files, meaning if you change any config
608 * settings you will re-run once before new statistics data can be established.
609 *
610 * @parameter default-value="filesystem"
611 * @since 2.7
612 */
613 private String runOrder;
614
615 /**
616 * @component
617 */
618 private ToolchainManager toolchainManager;
619
620 protected void handleSummary( Summary summary )
621 throws MojoExecutionException, MojoFailureException
622 {
623 assertNoException( summary );
624 assertNoFailureOrTimeout( summary );
625 writeSummary( summary );
626 }
627
628 private void assertNoException( Summary summary )
629 throws MojoExecutionException
630 {
631 if ( !summary.isErrorFree() )
632 {
633 Exception cause = summary.getFirstException();
634 throw new MojoExecutionException( cause.getMessage(), cause );
635 }
636 }
637
638 private void assertNoFailureOrTimeout( Summary summary )
639 throws MojoExecutionException
640 {
641 if ( summary.isFailureOrTimeout() )
642 {
643 throw new MojoExecutionException( "Failure or timeout" );
644 }
645 }
646
647 private void writeSummary( Summary summary )
648 throws MojoFailureException
649 {
650 RunResult result = summary.getResultOfLastSuccessfulRun();
651 SurefireHelper.reportExecution( this, result, getLog() );
652 }
653
654 protected boolean isSkipExecution()
655 {
656 return isSkip() || isSkipTests() || isSkipExec();
657 }
658
659 protected String getPluginName()
660 {
661 return "surefire";
662 }
663
664 protected String[] getDefaultIncludes()
665 {
666 return new String[]{ "**/Test*.java", "**/*Test.java", "**/*TestCase.java" };
667 }
668
669 // now for the implementation of the field accessors
670
671 public boolean isSkipTests()
672 {
673 return skipTests;
674 }
675
676 public void setSkipTests( boolean skipTests )
677 {
678 this.skipTests = skipTests;
679 }
680
681 /**
682 * @noinspection deprecation
683 */
684 public boolean isSkipExec()
685 {
686 return skipExec;
687 }
688
689 /**
690 * @noinspection deprecation
691 */
692 public void setSkipExec( boolean skipExec )
693 {
694 this.skipExec = skipExec;
695 }
696
697 public boolean isSkip()
698 {
699 return skip;
700 }
701
702 public void setSkip( boolean skip )
703 {
704 this.skip = skip;
705 }
706
707 public boolean isTestFailureIgnore()
708 {
709 return testFailureIgnore;
710 }
711
712 public void setTestFailureIgnore( boolean testFailureIgnore )
713 {
714 this.testFailureIgnore = testFailureIgnore;
715 }
716
717 public File getBasedir()
718 {
719 return basedir;
720 }
721
722 public void setBasedir( File basedir )
723 {
724 this.basedir = basedir;
725 }
726
727 public File getTestClassesDirectory()
728 {
729 return testClassesDirectory;
730 }
731
732 public void setTestClassesDirectory( File testClassesDirectory )
733 {
734 this.testClassesDirectory = testClassesDirectory;
735 }
736
737 public File getClassesDirectory()
738 {
739 return classesDirectory;
740 }
741
742 public void setClassesDirectory( File classesDirectory )
743 {
744 this.classesDirectory = classesDirectory;
745 }
746
747 public MavenProject getProject()
748 {
749 return project;
750 }
751
752 public void setProject( MavenProject project )
753 {
754 this.project = project;
755 }
756
757 public List getClasspathDependencyExcludes()
758 {
759 return classpathDependencyExcludes;
760 }
761
762 public void setClasspathDependencyExcludes( List classpathDependencyExcludes )
763 {
764 this.classpathDependencyExcludes = classpathDependencyExcludes;
765 }
766
767 public String getClasspathDependencyScopeExclude()
768 {
769 return classpathDependencyScopeExclude;
770 }
771
772 public void setClasspathDependencyScopeExclude( String classpathDependencyScopeExclude )
773 {
774 this.classpathDependencyScopeExclude = classpathDependencyScopeExclude;
775 }
776
777 public List getAdditionalClasspathElements()
778 {
779 return additionalClasspathElements;
780 }
781
782 public void setAdditionalClasspathElements( List additionalClasspathElements )
783 {
784 this.additionalClasspathElements = additionalClasspathElements;
785 }
786
787 public File getReportsDirectory()
788 {
789 return reportsDirectory;
790 }
791
792 public void setReportsDirectory( File reportsDirectory )
793 {
794 this.reportsDirectory = reportsDirectory;
795 }
796
797 public File getTestSourceDirectory()
798 {
799 return testSourceDirectory;
800 }
801
802 public void setTestSourceDirectory( File testSourceDirectory )
803 {
804 this.testSourceDirectory = testSourceDirectory;
805 }
806
807 public String getTest()
808 {
809 if ( StringUtils.isBlank( test ) )
810 {
811 return null;
812 }
813 int index = test.indexOf( '#' );
814 if ( index >= 0 )
815 {
816 return test.substring( 0, index );
817 }
818 return test;
819 }
820
821 /**
822 * @since 2.7.3
823 */
824 public String getTestMethod()
825 {
826 if ( StringUtils.isBlank( test ) )
827 {
828 return null;
829 }
830 int index = this.test.indexOf( '#' );
831 if ( index >= 0 )
832 {
833 return this.test.substring( index + 1, this.test.length() );
834 }
835 return null;
836 }
837
838 public void setTest( String test )
839 {
840 this.test = test;
841 }
842
843 public List getIncludes()
844 {
845 return includes;
846 }
847
848 public void setIncludes( List includes )
849 {
850 this.includes = includes;
851 }
852
853 public List getExcludes()
854 {
855 return excludes;
856 }
857
858 public void setExcludes( List excludes )
859 {
860 this.excludes = excludes;
861 }
862
863 public ArtifactRepository getLocalRepository()
864 {
865 return localRepository;
866 }
867
868 public void setLocalRepository( ArtifactRepository localRepository )
869 {
870 this.localRepository = localRepository;
871 }
872
873 /**
874 * @noinspection deprecation
875 */
876 public Properties getSystemProperties()
877 {
878 return systemProperties;
879 }
880
881 /**
882 * @noinspection deprecation
883 */
884 public void setSystemProperties( Properties systemProperties )
885 {
886 this.systemProperties = systemProperties;
887 }
888
889 public Map getSystemPropertyVariables()
890 {
891 return systemPropertyVariables;
892 }
893
894 public void setSystemPropertyVariables( Map systemPropertyVariables )
895 {
896 this.systemPropertyVariables = systemPropertyVariables;
897 }
898
899 public File getSystemPropertiesFile()
900 {
901 return systemPropertiesFile;
902 }
903
904 public void setSystemPropertiesFile( File systemPropertiesFile )
905 {
906 this.systemPropertiesFile = systemPropertiesFile;
907 }
908
909 public Properties getProperties()
910 {
911 return properties;
912 }
913
914 public void setProperties( Properties properties )
915 {
916 this.properties = properties;
917 }
918
919 public Map getPluginArtifactMap()
920 {
921 return pluginArtifactMap;
922 }
923
924 public void setPluginArtifactMap( Map pluginArtifactMap )
925 {
926 this.pluginArtifactMap = pluginArtifactMap;
927 }
928
929 public Map getProjectArtifactMap()
930 {
931 return projectArtifactMap;
932 }
933
934 public void setProjectArtifactMap( Map projectArtifactMap )
935 {
936 this.projectArtifactMap = projectArtifactMap;
937 }
938
939 public boolean isPrintSummary()
940 {
941 return printSummary;
942 }
943
944 public void setPrintSummary( boolean printSummary )
945 {
946 this.printSummary = printSummary;
947 }
948
949 public String getReportFormat()
950 {
951 return reportFormat;
952 }
953
954 public void setReportFormat( String reportFormat )
955 {
956 this.reportFormat = reportFormat;
957 }
958
959 public String getReportNameSuffix()
960 {
961 return reportNameSuffix;
962 }
963
964 public void setReportNameSuffix( String reportNameSuffix )
965 {
966 this.reportNameSuffix = reportNameSuffix;
967 }
968
969 public boolean isUseFile()
970 {
971 return useFile;
972 }
973
974 public void setUseFile( boolean useFile )
975 {
976 this.useFile = useFile;
977 }
978
979 public boolean isRedirectTestOutputToFile()
980 {
981 return redirectTestOutputToFile;
982 }
983
984 public void setRedirectTestOutputToFile( boolean redirectTestOutputToFile )
985 {
986 this.redirectTestOutputToFile = redirectTestOutputToFile;
987 }
988
989 public Boolean getFailIfNoTests()
990 {
991 return failIfNoTests;
992 }
993
994 public void setFailIfNoTests( Boolean failIfNoTests )
995 {
996 this.failIfNoTests = failIfNoTests;
997 }
998
999 public String getForkMode()
1000 {
1001 return forkMode;
1002 }
1003
1004 public void setForkMode( String forkMode )
1005 {
1006 this.forkMode = forkMode;
1007 }
1008
1009 public String getJvm()
1010 {
1011 return jvm;
1012 }
1013
1014 public void setJvm( String jvm )
1015 {
1016 this.jvm = jvm;
1017 }
1018
1019 public String getArgLine()
1020 {
1021 return argLine;
1022 }
1023
1024 public void setArgLine( String argLine )
1025 {
1026 this.argLine = argLine;
1027 }
1028
1029 public String getDebugForkedProcess()
1030 {
1031 return debugForkedProcess;
1032 }
1033
1034 public void setDebugForkedProcess( String debugForkedProcess )
1035 {
1036 this.debugForkedProcess = debugForkedProcess;
1037 }
1038
1039 public int getForkedProcessTimeoutInSeconds()
1040 {
1041 return forkedProcessTimeoutInSeconds;
1042 }
1043
1044 public void setForkedProcessTimeoutInSeconds( int forkedProcessTimeoutInSeconds )
1045 {
1046 this.forkedProcessTimeoutInSeconds = forkedProcessTimeoutInSeconds;
1047 }
1048
1049 public Map getEnvironmentVariables()
1050 {
1051 return environmentVariables;
1052 }
1053
1054 public void setEnvironmentVariables( Map environmentVariables )
1055 {
1056 this.environmentVariables = environmentVariables;
1057 }
1058
1059 public File getWorkingDirectory()
1060 {
1061 return workingDirectory;
1062 }
1063
1064 public void setWorkingDirectory( File workingDirectory )
1065 {
1066 this.workingDirectory = workingDirectory;
1067 }
1068
1069 public boolean isChildDelegation()
1070 {
1071 return childDelegation;
1072 }
1073
1074 public void setChildDelegation( boolean childDelegation )
1075 {
1076 this.childDelegation = childDelegation;
1077 }
1078
1079 public String getGroups()
1080 {
1081 return groups;
1082 }
1083
1084 public void setGroups( String groups )
1085 {
1086 this.groups = groups;
1087 }
1088
1089 public String getExcludedGroups()
1090 {
1091 return excludedGroups;
1092 }
1093
1094 public void setExcludedGroups( String excludedGroups )
1095 {
1096 this.excludedGroups = excludedGroups;
1097 }
1098
1099 public File[] getSuiteXmlFiles()
1100 {
1101 return suiteXmlFiles;
1102 }
1103
1104 public void setSuiteXmlFiles( File[] suiteXmlFiles )
1105 {
1106 this.suiteXmlFiles = suiteXmlFiles;
1107 }
1108
1109 public String getJunitArtifactName()
1110 {
1111 return junitArtifactName;
1112 }
1113
1114 public void setJunitArtifactName( String junitArtifactName )
1115 {
1116 this.junitArtifactName = junitArtifactName;
1117 }
1118
1119 public String getTestNGArtifactName()
1120 {
1121 return testNGArtifactName;
1122 }
1123
1124 public void setTestNGArtifactName( String testNGArtifactName )
1125 {
1126 this.testNGArtifactName = testNGArtifactName;
1127 }
1128
1129 public int getThreadCount()
1130 {
1131 return threadCount;
1132 }
1133
1134 public void setThreadCount( int threadCount )
1135 {
1136 this.threadCount = threadCount;
1137 }
1138
1139 public boolean getPerCoreThreadCount()
1140 {
1141 return perCoreThreadCount;
1142 }
1143
1144 public void setPerCoreThreadCount( boolean perCoreThreadCount )
1145 {
1146 this.perCoreThreadCount = perCoreThreadCount;
1147 }
1148
1149 public boolean getUseUnlimitedThreads()
1150 {
1151 return useUnlimitedThreads;
1152 }
1153
1154 public void setUseUnlimitedThreads( boolean useUnlimitedThreads )
1155 {
1156 this.useUnlimitedThreads = useUnlimitedThreads;
1157 }
1158
1159 public String getParallel()
1160 {
1161 return parallel;
1162 }
1163
1164 public void setParallel( String parallel )
1165 {
1166 this.parallel = parallel;
1167 }
1168
1169 public boolean isTrimStackTrace()
1170 {
1171 return trimStackTrace;
1172 }
1173
1174 public void setTrimStackTrace( boolean trimStackTrace )
1175 {
1176 this.trimStackTrace = trimStackTrace;
1177 }
1178
1179 public ArtifactResolver getArtifactResolver()
1180 {
1181 return artifactResolver;
1182 }
1183
1184 public void setArtifactResolver( ArtifactResolver artifactResolver )
1185 {
1186 this.artifactResolver = artifactResolver;
1187 }
1188
1189 public ArtifactFactory getArtifactFactory()
1190 {
1191 return artifactFactory;
1192 }
1193
1194 public void setArtifactFactory( ArtifactFactory artifactFactory )
1195 {
1196 this.artifactFactory = artifactFactory;
1197 }
1198
1199 public List getRemoteRepositories()
1200 {
1201 return remoteRepositories;
1202 }
1203
1204 public void setRemoteRepositories( List remoteRepositories )
1205 {
1206 this.remoteRepositories = remoteRepositories;
1207 }
1208
1209 public ArtifactMetadataSource getMetadataSource()
1210 {
1211 return metadataSource;
1212 }
1213
1214 public void setMetadataSource( ArtifactMetadataSource metadataSource )
1215 {
1216 this.metadataSource = metadataSource;
1217 }
1218
1219 public Properties getOriginalSystemProperties()
1220 {
1221 return originalSystemProperties;
1222 }
1223
1224 public void setOriginalSystemProperties( Properties originalSystemProperties )
1225 {
1226 this.originalSystemProperties = originalSystemProperties;
1227 }
1228
1229 public Properties getInternalSystemProperties()
1230 {
1231 return internalSystemProperties;
1232 }
1233
1234 public void setInternalSystemProperties( Properties internalSystemProperties )
1235 {
1236 this.internalSystemProperties = internalSystemProperties;
1237 }
1238
1239 public boolean isDisableXmlReport()
1240 {
1241 return disableXmlReport;
1242 }
1243
1244 public void setDisableXmlReport( boolean disableXmlReport )
1245 {
1246 this.disableXmlReport = disableXmlReport;
1247 }
1248
1249 public boolean isUseSystemClassLoader()
1250 {
1251 return useSystemClassLoader;
1252 }
1253
1254 public void setUseSystemClassLoader( boolean useSystemClassLoader )
1255 {
1256 this.useSystemClassLoader = useSystemClassLoader;
1257 }
1258
1259 public boolean isUseManifestOnlyJar()
1260 {
1261 return useManifestOnlyJar;
1262 }
1263
1264 public void setUseManifestOnlyJar( boolean useManifestOnlyJar )
1265 {
1266 this.useManifestOnlyJar = useManifestOnlyJar;
1267 }
1268
1269 public boolean isEnableAssertions()
1270 {
1271 return enableAssertions;
1272 }
1273
1274 public void setEnableAssertions( boolean enableAssertions )
1275 {
1276 this.enableAssertions = enableAssertions;
1277 }
1278
1279 public MavenSession getSession()
1280 {
1281 return session;
1282 }
1283
1284 public void setSession( MavenSession session )
1285 {
1286 this.session = session;
1287 }
1288
1289 public String getObjectFactory()
1290 {
1291 return objectFactory;
1292 }
1293
1294 public void setObjectFactory( String objectFactory )
1295 {
1296 this.objectFactory = objectFactory;
1297 }
1298
1299 public ToolchainManager getToolchainManager()
1300 {
1301 return toolchainManager;
1302 }
1303
1304 public void setToolchainManager( ToolchainManager toolchainManager )
1305 {
1306 this.toolchainManager = toolchainManager;
1307 }
1308
1309 public boolean isMavenParallel()
1310 {
1311 return parallelMavenExecution != null && parallelMavenExecution.booleanValue();
1312 }
1313
1314 public String getRunOrder()
1315 {
1316 return runOrder;
1317 }
1318
1319 public void setRunOrder( String runOrder )
1320 {
1321 this.runOrder = runOrder;
1322 }
1323
1324 protected void addPluginSpecificChecksumItems( ChecksumCalculator checksum )
1325 {
1326 }
1327
1328 }