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