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