maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From steph...@apache.org
Subject svn commit: r897127 [2/3] - in /maven/surefire/trunk: ./ maven-failsafe-plugin/ maven-failsafe-plugin/src/ maven-failsafe-plugin/src/it/ maven-failsafe-plugin/src/it/jetty-war-test-failing/ maven-failsafe-plugin/src/it/jetty-war-test-failing/src/ maven...
Date Fri, 08 Jan 2010 08:03:53 GMT
Added: maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java?rev=897127&view=auto
==============================================================================
--- maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java (added)
+++ maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java Fri Jan  8 08:03:49 2010
@@ -0,0 +1,1338 @@
+package org.apache.maven.plugin.failsafe;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;               
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
+import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter;
+import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
+import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
+import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
+import org.apache.maven.artifact.versioning.VersionRange;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.surefire.booter.ForkConfiguration;
+import org.apache.maven.surefire.booter.SurefireBooter;
+import org.apache.maven.surefire.booter.SurefireBooterForkException;
+import org.apache.maven.surefire.booter.SurefireExecutionException;
+import org.apache.maven.surefire.report.BriefConsoleReporter;
+import org.apache.maven.surefire.report.BriefFileReporter;
+import org.apache.maven.surefire.report.ConsoleReporter;
+import org.apache.maven.surefire.report.DetailedConsoleReporter;
+import org.apache.maven.surefire.report.FileReporter;
+import org.apache.maven.surefire.report.ForkingConsoleReporter;
+import org.apache.maven.surefire.report.XMLReporter;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.ReaderFactory;
+import org.codehaus.plexus.util.FileUtils;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.FileOutputStream;
+import java.io.Writer;
+import java.io.OutputStreamWriter;
+import java.io.BufferedOutputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.toolchain.Toolchain;
+import org.apache.maven.toolchain.ToolchainManager;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+import org.apache.maven.surefire.failsafe.model.io.xpp3.FailsafeSummaryXpp3Writer;
+import org.apache.maven.surefire.failsafe.model.FailsafeSummary;
+
+/**
+ * Run integration tests using Surefire.
+ *
+ * @author Jason van Zyl
+ * @author Stephen Connolly
+ * @requiresProject true
+ * @requiresDependencyResolution test
+ * @goal integration-test
+ * @phase integration-test
+ */
+public class IntegrationTestMojo
+    extends AbstractMojo
+{
+
+    /**
+     * Set this to 'true' to skip running tests, but still compile them. Its use is NOT RECOMMENDED, but quite
+     * convenient on occasion.
+     *
+     * @parameter expression="${skipTests}"
+     * @since 2.4
+     */
+    private boolean skipTests;
+
+    /**
+     * Set this to 'true' to skip running integration tests, but still compile them. Its use is NOT RECOMMENDED, but quite
+     * convenient on occasion.
+     *
+     * @parameter expression="${skipITs}"
+     * @since 2.4.3-alpha-2
+     */
+    private boolean skipITs;
+
+    /**
+     * DEPRECATED This old parameter is just like skipTests, but bound to the old property maven.test.skip.exec.
+     * Use -DskipTests instead; it's shorter.
+     *
+     * @parameter expression="${maven.test.skip.exec}"
+     * @since 2.3
+     * @deprecated
+     */
+    private boolean skipExec;
+
+    /**
+     * Set this to 'true' to bypass unit tests entirely. Its use is NOT RECOMMENDED, especially if you
+     * enable it using the "maven.test.skip" property, because maven.test.skip disables both running the
+     * tests and compiling the tests.  Consider using the skipTests parameter instead.
+     *
+     * @parameter expression="${maven.test.skip}"
+     */
+    private boolean skip;
+
+    /**
+     * The base directory of the project being tested. This can be obtained in your unit test by
+     * System.getProperty("basedir").
+     *
+     * @parameter expression="${basedir}"
+     * @required
+     */
+    private File basedir;
+
+    /**
+     * The directory containing generated test classes of the project being tested.
+     * This will be included at the beginning the test classpath.
+     *
+     * @parameter default-value="${project.build.testOutputDirectory}"
+     * @required
+     */
+    private File testClassesDirectory;
+
+    /**
+     * The directory containing generated classes of the project being tested.
+     * This will be included after the test classes in the test classpath.
+     *
+     * @parameter default-value="${project.build.outputDirectory}"
+     * @required
+     */
+    private File classesDirectory;
+
+    /**
+     * The Maven Project Object
+     *
+     * @parameter expression="${project}"
+     * @required
+     * @readonly
+     */
+    protected MavenProject project;
+
+    /**
+     * The classpath elements of the project being tested.
+     *
+     * @parameter expression="${project.testClasspathElements}"
+     * @required
+     * @readonly
+     */
+    private List classpathElements;
+
+    /**
+     * Additional elements to be appended to the classpath.
+     *
+     * @parameter
+     * @since 2.4
+     */
+    private List additionalClasspathElements;
+
+    /**
+     * Base directory where all reports are written to.
+     *
+     * @parameter expression="${project.build.directory}/failsafe-reports"
+     */
+    private File reportsDirectory;
+
+    /**
+     * The test source directory containing test class sources.
+     *
+     * @parameter expression="${project.build.testSourceDirectory}"
+     * @required
+     * @since 2.2
+     */
+    private File testSourceDirectory;
+
+    /**
+     * Specify this parameter to run individual tests by file name, overriding the <code>includes/excludes</code>
+     * parameters.  Each pattern you specify here will be used to create an
+     * include pattern formatted like <code>**&#47;${test}.java</code>, so you can just type "-Dtest=MyTest"
+     * to run a single test called "foo/MyTest.java".  This parameter will override the TestNG suiteXmlFiles
+     * parameter.
+     *
+     * @parameter expression="${it.test}"
+     */
+    private String test;
+
+    /**
+     * List of patterns (separated by commas) used to specify the tests that should be included in testing. When not
+     * specified and when the <code>test</code> parameter is not specified, the default includes will be
+     * <code>**&#47;IT*.java   **&#47;*IT.java   **&#47;*ITCase.java</code>.  This parameter is ignored if
+     * TestNG suiteXmlFiles are specified.
+     *
+     * @parameter
+     */
+    private List includes;
+
+    /**
+     * List of patterns (separated by commas) used to specify the tests that should be excluded in testing. When not
+     * specified and when the <code>test</code> parameter is not specified, the default excludes will be
+     * <code>**&#47;*$*</code> (which excludes all inner classes).  This parameter is ignored if
+     * TestNG suiteXmlFiles are specified.
+     *
+     * @parameter
+     */
+    private List excludes;
+
+    /**
+     * ArtifactRepository of the localRepository. To obtain the directory of localRepository in unit tests use
+     * System.setProperty( "localRepository").
+     *
+     * @parameter expression="${localRepository}"
+     * @required
+     * @readonly
+     */
+    private ArtifactRepository localRepository;
+
+    /**
+     * List of System properties to pass to the JUnit tests.
+     * @deprecated use systemPropertyVariables instead
+     * @parameter
+     */
+    private Properties systemProperties;
+
+    /**
+     * List of System properties to pass to the JUnit tests.
+     *
+     * @parameter
+     * @since 2.5
+     */
+    private Map systemPropertyVariables;
+
+    /**
+     * List of properties for configuring all TestNG related configurations. This is the new
+     * preferred method of configuring TestNG.
+     *
+     * @parameter
+     * @since 2.4
+     */
+    private Properties properties;
+
+    /**
+     * Map of of plugin artifacts.
+     *
+     * @parameter expression="${plugin.artifactMap}"
+     * @required
+     * @readonly
+     */
+    private Map pluginArtifactMap;
+
+    /**
+     * Map of of project artifacts.
+     *
+     * @parameter expression="${project.artifactMap}"
+     * @required
+     * @readonly
+     */
+    private Map projectArtifactMap;
+
+    /**
+     * The summary file to write integration test results to.
+     * @parameter expression="${project.build.directory}/failsafe-reports/failsafe-summary.xml"
+     * @required
+     */
+    private File summaryFile;
+
+    /**
+     * Option to print summary of test suites or just print the test cases that has errors.
+     *
+     * @parameter expression="${failsafe.printSummary}" default-value="true"
+     */
+    private boolean printSummary;
+
+    /**
+     * Selects the formatting for the test report to be generated. Can be set as brief or plain.
+     *
+     * @parameter expression="${failsafe.reportFormat}" default-value="brief"
+     */
+    private String reportFormat;
+
+    /**
+     * Option to generate a file test report or just output the test report to the console.
+     *
+     * @parameter expression="${failsafe.useFile}" default-value="true"
+     */
+    private boolean useFile;
+
+    /**
+     * When forking, set this to true to redirect the unit test standard output to a file (found in
+     * reportsDirectory/testName-output.txt).
+     *
+     * @parameter expression="${maven.test.redirectTestOutputToFile}" default-value="false"
+     * @since 2.3
+     */
+    private boolean redirectTestOutputToFile;
+
+    /**
+     * Set this to "true" to cause a failure if there are no tests to run. Defaults to false.
+     *
+     * @parameter expression="${failIfNoTests}"
+     * @since 2.4
+     */
+    private Boolean failIfNoTests;
+
+    /**
+     * Option to specify the forking mode. Can be "never", "once" or "always". "none" and "pertest" are also accepted
+     * for backwards compatibility.
+     *
+     * @parameter expression="${forkMode}" default-value="once"
+     * @since 2.1
+     */
+    private String forkMode;
+
+    /**
+     * Option to specify the jvm (or path to the java executable) to use with the forking options. For the default, the
+     * jvm will be the same as the one used to run Maven.
+     *
+     * @parameter expression="${jvm}"
+     * @since 2.1
+     */
+    private String jvm;
+
+    /**
+     * Arbitrary JVM options to set on the command line.
+     *
+     * @parameter expression="${argLine}"
+     * @since 2.1
+     */
+    private String argLine;
+
+    /**
+     * Attach a debugger to the forked JVM.  If set to "true", the process will suspend and
+     * wait for a debugger to attach on port 5005.  If set to some other string, that
+     * string will be appended to the argLine, allowing you to configure arbitrary
+     * debuggability options (without overwriting the other options specified in the argLine).
+     *
+     * @parameter expression="${maven.failsafe.debug}"
+     * @since 2.4
+     */
+    private String debugForkedProcess;
+
+    /**
+     * Kill the forked test process after a certain number of seconds.  If set to 0,
+     * wait forever for the process, never timing out.
+     *
+     * @parameter expression="${failsafe.timeout}"
+     * @since 2.4
+     */
+    private int forkedProcessTimeoutInSeconds;
+
+    /**
+     * Additional environments to set on the command line.
+     *
+     * @parameter
+     * @since 2.1.3
+     */
+    private Map environmentVariables = new HashMap();
+
+    /**
+     * Command line working directory.
+     *
+     * @parameter expression="${basedir}"
+     * @since 2.1.3
+     */
+    private File workingDirectory;
+
+    /**
+     * When false it makes tests run using the standard classloader delegation instead of the default Maven isolated
+     * classloader. Only used when forking (forkMode is not "none").<br/> Setting it to false helps with some problems
+     * caused by conflicts between xml parsers in the classpath and the Java 5 provider parser.
+     *
+     * @parameter expression="${childDelegation}" default-value="false"
+     * @since 2.1
+     */
+    private boolean childDelegation;
+
+    /**
+     * (TestNG only) Groups for this test. Only classes/methods/etc decorated with one of the groups specified here will be included
+     * in test run, if specified.  This parameter is overridden if suiteXmlFiles are specified.
+     *
+     * @parameter expression="${groups}"
+     * @since 2.2
+     */
+    private String groups;
+
+    /**
+     * (TestNG only) Excluded groups. Any methods/classes/etc with one of the groups specified in this list will specifically not be
+     * run.  This parameter is overridden if suiteXmlFiles are specified.
+     *
+     * @parameter expression="${excludedGroups}"
+     * @since 2.2
+     */
+    private String excludedGroups;
+
+    /**
+     * (TestNG only) List of TestNG suite xml file locations, seperated by commas. Note that suiteXmlFiles is incompatible
+     * with several other parameters on this plugin, like includes/excludes.  This parameter is ignored if
+     * the "test" parameter is specified (allowing you to run a single test instead of an entire suite).
+     *
+     * @parameter
+     * @since 2.2
+     */
+    private File[] suiteXmlFiles;
+
+    /**
+     * Allows you to specify the name of the JUnit artifact. If not set, <code>junit:junit</code> will be used.
+     *
+     * @parameter expression="${junitArtifactName}" default-value="junit:junit"
+     * @since 2.3.1
+     */
+    private String junitArtifactName;
+
+    /**
+     * Allows you to specify the name of the TestNG artifact. If not set, <code>org.testng:testng</code> will be used.
+     *
+     * @parameter expression="${testNGArtifactName}" default-value="org.testng:testng"
+     * @since 2.3.1
+     */
+    private String testNGArtifactName;
+
+    /**
+     * (TestNG only) The attribute thread-count allows you to specify how many threads should be allocated for this execution. Only
+     * makes sense to use in conjunction with parallel.
+     *
+     * @parameter expression="${threadCount}"
+     * @since 2.2
+     */
+    private int threadCount;
+
+    /**
+     * (junitcore only) Indicates that threadCount is per cpu core. Defaults to true
+     *
+     * @parameter expression="${perCoreThreadCount}"
+     * @since 2.5
+     */
+    private String perCoreThreadCount;
+
+    /**
+     * (junitcore only) Indicates that the thread pool will be unlimited. paralell setting and the actual number of classes/methods
+     * will decide. Setting this to true effectively disables perCoreThreadCount and  threadCount
+     *
+     * @parameter expression="${useUnlimitedThreads}"
+     * @since 2.5
+     */
+    private String useUnlimitedThreads;
+    /**
+     * (TestNG only) When you use the parallel attribute, TestNG will try to run all your test methods in separate threads, except for
+     * methods that depend on each other, which will be run in the same thread in order to respect their order of
+     * execution.
+     *
+     * JUNIT4.6 Values are classes/methods/both to run in separate threads, as controlled by threadCount.
+     *
+     * @parameter expression="${parallel}"
+     * @todo test how this works with forking, and console/file output parallelism
+     * @since 2.2
+     */
+    private String parallel;
+
+    /**
+     * Whether to trim the stack trace in the reports to just the lines within the test, or show the full trace.
+     *
+     * @parameter expression="${trimStackTrace}" default-value="true"
+     * @since 2.2
+     */
+    private boolean trimStackTrace;
+
+    /**
+     * Resolves the artifacts needed.
+     *
+     * @component
+     */
+    private ArtifactResolver artifactResolver;
+
+    /**
+     * Creates the artifact
+     *
+     * @component
+     */
+    private ArtifactFactory artifactFactory;
+
+    /**
+     * The plugin remote repositories declared in the pom.
+     *
+     * @parameter expression="${project.pluginArtifactRepositories}"
+     * @since 2.2
+     */
+    private List remoteRepositories;
+
+    /**
+     * For retrieval of artifact's metadata.
+     *
+     * @component
+     */
+    private ArtifactMetadataSource metadataSource;
+
+    
+    
+    private static final String BRIEF_REPORT_FORMAT = "brief";
+
+    private static final String PLAIN_REPORT_FORMAT = "plain";
+
+    private Properties originalSystemProperties;
+
+    /**
+     * systemPropertyVariables + systemProperties
+     */
+    private Properties internalSystemProperties = new Properties();
+
+    /**
+     * Flag to disable the generation of report files in xml format.
+     *
+     * @parameter expression="${disableXmlReport}" default-value="false"
+     * @since 2.2
+     */
+    private boolean disableXmlReport;
+
+    /**
+     * Option to pass dependencies to the system's classloader instead of using an isolated class loader when forking.
+     * Prevents problems with JDKs which implement the service provider lookup mechanism by using the system's
+     * classloader.  Default value is "true".
+     *
+     * @parameter expression="${failsafe.useSystemClassLoader}"
+     * @since 2.3
+     */
+    private Boolean useSystemClassLoader;
+
+    /**
+     * By default, Surefire forks your tests using a manifest-only jar; set this parameter
+     * to "false" to force it to launch your tests with a plain old Java classpath.
+     * (See http://maven.apache.org/plugins/maven-surefire-plugin/examples/class-loading.html
+     * for a more detailed explanation of manifest-only jars and their benefits.)
+     *
+     * Default value is "true".  Beware, setting this to "false" may cause your tests to
+     * fail on Windows if your classpath is too long.
+     *
+     * @parameter expression="${failsafe.useManifestOnlyJar}" default-value="true"
+     * @since 2.4.3
+     */
+    private boolean useManifestOnlyJar;
+
+    /**
+     * By default, Surefire enables JVM assertions for the execution of your test cases. To disable the assertions, set
+     * this flag to <code>false</code>.
+     *
+     * @parameter expression="${enableAssertions}" default-value="true"
+     * @since 2.3.1
+     */
+    private boolean enableAssertions;
+
+    /**
+     * The current build session instance.
+     *
+     * @parameter expression="${session}"
+     * @required
+     * @readonly
+     */
+    private MavenSession session;
+
+    /**
+     * (TestNG only) Define the factory class used to create all test instances
+     *
+     * @parameter expression="${objectFactory}"
+     * @since 2.5
+     */
+    private String objectFactory;
+
+    /**
+     * The character encoding scheme to be applied.
+     *
+     * @parameter expression="${encoding}" default-value="${project.reporting.outputEncoding}"
+     */
+    protected String encoding;
+
+    /** @component */
+    private ToolchainManager toolchainManager;
+    
+    
+    public void execute()
+        throws MojoExecutionException, MojoFailureException
+    {
+        if ( verifyParameters() )
+        {
+            SurefireBooter surefireBooter = constructSurefireBooter();
+
+            getLog().info( "Failsafe report directory: " + reportsDirectory );
+
+            FailsafeSummary result = new FailsafeSummary();
+            try
+            {
+                result.setResult(surefireBooter.run());
+            }
+            catch ( SurefireBooterForkException e )
+            {
+                throw new MojoExecutionException( e.getMessage(), e );
+            }
+            catch ( SurefireExecutionException e )
+            {
+                throw new MojoExecutionException( e.getMessage(), e );
+            }
+
+            if ( originalSystemProperties != null && !surefireBooter.isForking() )
+            {
+                // restore system properties, only makes sense when not forking..
+                System.setProperties( originalSystemProperties );
+            }
+
+            if (!summaryFile.getParentFile().isDirectory()) {
+                summaryFile.getParentFile().mkdirs();
+            }
+
+            try {
+                String encoding;
+                if ( StringUtils.isEmpty( this.encoding ) )
+                {
+                    getLog().warn(
+                        "File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING
+                            + ", i.e. build is platform dependent!" );
+                    encoding = ReaderFactory.FILE_ENCODING;
+                } else {
+                    encoding = this.encoding;
+                }
+
+                FileOutputStream fileOutputStream = new FileOutputStream( summaryFile );
+                BufferedOutputStream bufferedOutputStream = new BufferedOutputStream( fileOutputStream);
+                Writer writer = new OutputStreamWriter( bufferedOutputStream, encoding );
+                FailsafeSummaryXpp3Writer xpp3Writer = new FailsafeSummaryXpp3Writer();
+                xpp3Writer.write( writer, result );
+                writer.close();
+                bufferedOutputStream.close();
+                fileOutputStream.close();
+            } catch ( IOException e ) {
+                throw new MojoExecutionException( e.getMessage(), e );
+            }
+        }
+    }
+
+    private boolean verifyParameters()
+        throws MojoFailureException
+    {
+        if ( skip || skipTests || skipITs || skipExec )
+        {
+            getLog().info( "Tests are skipped." );
+            return false;
+        }
+
+        if ( !testClassesDirectory.exists() )
+        {
+            if ( failIfNoTests != null && failIfNoTests.booleanValue() )
+            {
+                throw new MojoFailureException( "No tests to run!" );
+            }
+            getLog().info( "No tests to run." );
+            return false;
+        }
+
+        if ( useSystemClassLoader != null && ForkConfiguration.FORK_NEVER.equals( forkMode ) )
+        {
+            getLog().warn( "useSystemClassloader setting has no effect when not forking" );
+        }
+
+        return true;
+    }
+
+    /**
+     * Converts old TestNG configuration parameters over to new properties based configuration
+     * method. (if any are defined the old way)
+     */
+    private void convertTestNGParameters()
+    {
+        if ( properties == null )
+        {
+            properties = new Properties();
+        }
+
+        if ( this.parallel != null )
+        {
+            properties.setProperty( "parallel", this.parallel );
+        }
+        if ( this.excludedGroups != null )
+        {
+            properties.setProperty( "excludegroups", this.excludedGroups );
+        }
+        if ( this.groups != null )
+        {
+            properties.setProperty( "groups", this.groups );
+        }
+
+        if ( this.threadCount > 0 )
+        {
+            properties.setProperty( "threadcount", new Integer( this.threadCount ).toString() );
+        }
+        if ( this.objectFactory != null )
+        {
+            properties.setProperty( "objectfactory", this.objectFactory );
+        }
+    }
+
+    /**
+     * Converts old TestNG configuration parameters over to new properties based configuration
+     * method. (if any are defined the old way)
+     */
+    private void convertJunitCoreParameters()
+    {
+        if ( properties == null )
+        {
+            properties = new Properties();
+        }
+
+        if ( this.parallel != null )
+        {
+            properties.setProperty( "parallel", this.parallel );
+        }
+        if ( this.threadCount > 0 )
+        {
+            properties.setProperty( "threadCount", new Integer( this.threadCount ).toString() );
+        }
+        if ( this.perCoreThreadCount != null )
+        {
+            properties.setProperty( "perCoreThreadCount", perCoreThreadCount);
+        }
+        if ( this.useUnlimitedThreads != null )
+        {
+            properties.setProperty( "useUnlimitedThreads", useUnlimitedThreads);
+        }
+        Artifact configurableParallelComputer = (Artifact) projectArtifactMap.get("org.jdogma.junit:configurable-parallel-computer");
+        properties.setProperty("configurableParallelComputerPresent", Boolean.toString(configurableParallelComputer != null));
+
+    }
+
+    private boolean isJunit47Compatible(Artifact artifact) throws MojoExecutionException {
+        return isWithinVersionSpec(artifact, "[4.7,)");
+    }
+    
+    private boolean isJunit40to46(Artifact artifact)  throws MojoExecutionException {
+        return isWithinVersionSpec(artifact, "[4.0,4.7)");
+    }
+
+    private boolean isWithinVersionSpec(Artifact artifact, String versionSpec) throws MojoExecutionException {
+        if ( artifact == null )
+        {
+            return false;
+        }
+        try {
+            VersionRange  range = VersionRange.createFromVersionSpec( versionSpec);
+            return range.containsVersion( artifact.getSelectedVersion());
+        } catch (InvalidVersionSpecificationException e) {
+            throw new MojoExecutionException("Bug in junit 4.7 plugin. Please report with stacktrace");
+        } catch (OverConstrainedVersionException e) {
+            throw new MojoExecutionException("Bug in junit 4.7 plugin. Please report with stacktrace");
+        }
+    }
+
+
+    private SurefireBooter constructSurefireBooter()
+        throws MojoExecutionException, MojoFailureException
+    {
+        SurefireBooter surefireBooter = new SurefireBooter();
+
+        Artifact surefireArtifact = (Artifact) pluginArtifactMap.get( "org.apache.maven.surefire:surefire-booter" );
+        if ( surefireArtifact == null )
+        {
+            throw new MojoExecutionException( "Unable to locate surefire-booter in the list of plugin artifacts" );
+        }
+
+        surefireArtifact.isSnapshot(); // MNG-2961: before Maven 2.0.8, fixes getBaseVersion to be -SNAPSHOT if needed
+
+        Artifact junitArtifact;
+        Artifact testNgArtifact;
+        try
+        {
+            addArtifact( surefireBooter, surefireArtifact );
+
+            junitArtifact = (Artifact) projectArtifactMap.get( junitArtifactName );
+            // SUREFIRE-378, junit can have an alternate artifact name
+            if ( junitArtifact == null && "junit:junit".equals( junitArtifactName ) )
+            {
+                junitArtifact = (Artifact) projectArtifactMap.get( "junit:junit-dep" );
+            }
+
+            // TODO: this is pretty manual, but I'd rather not require the plugin > dependencies section right now
+            testNgArtifact = (Artifact) projectArtifactMap.get( testNGArtifactName );
+
+            if ( testNgArtifact != null )
+            {
+                VersionRange range = VersionRange.createFromVersionSpec( "[4.7,)" );
+                if ( !range.containsVersion( new DefaultArtifactVersion(testNgArtifact.getVersion()) ) )
+                {
+                    throw new MojoFailureException(
+                                                    "TestNG support requires version 4.7 or above. You have declared version " +
+                                                        testNgArtifact.getVersion() );
+                }
+
+                convertTestNGParameters();
+
+                if ( this.testClassesDirectory != null )
+                {
+                    properties.setProperty( "testng.test.classpath", testClassesDirectory.getAbsolutePath() );
+                }
+
+                addArtifact( surefireBooter, testNgArtifact );
+
+                // The plugin uses a JDK based profile to select the right testng. We might be explicity using a
+                // different one since its based on the source level, not the JVM. Prune using the filter.
+                addProvider( surefireBooter, "surefire-testng", surefireArtifact.getBaseVersion(), testNgArtifact );
+            }
+            else if ( isJunit47Compatible( junitArtifact))
+            {
+                convertJunitCoreParameters();                
+                addProvider( surefireBooter, "surefire-junit47", surefireArtifact.getBaseVersion(), null );
+            }
+            else if ( isJunit40to46( junitArtifact ))
+            {
+                addProvider( surefireBooter, "surefire-junit4", surefireArtifact.getBaseVersion(), null );
+            }
+            else
+            {
+                // add the JUnit provider as default - it doesn't require JUnit to be present,
+                // since it supports POJO tests.
+                addProvider( surefireBooter, "surefire-junit", surefireArtifact.getBaseVersion(), null );
+            }
+        }
+        catch ( ArtifactNotFoundException e )
+        {
+            throw new MojoExecutionException( "Unable to locate required surefire provider dependency: " +
+                e.getMessage(), e );
+        }
+        catch ( InvalidVersionSpecificationException e )
+        {
+            throw new MojoExecutionException( "Error determining the TestNG version requested: " + e.getMessage(), e );
+        }
+        catch ( ArtifactResolutionException e )
+        {
+            throw new MojoExecutionException( "Error to resolving surefire provider dependency: " + e.getMessage(), e );
+        }
+
+        if ( suiteXmlFiles != null && suiteXmlFiles.length > 0 && test == null )
+        {
+            if ( testNgArtifact == null )
+            {
+                throw new MojoExecutionException( "suiteXmlFiles is configured, but there is no TestNG dependency" );
+            }
+
+            // TODO: properties should be passed in here too
+            surefireBooter.addTestSuite( "org.apache.maven.surefire.testng.TestNGXmlTestSuite", new Object[]{
+                suiteXmlFiles, testSourceDirectory.getAbsolutePath(), testNgArtifact.getVersion(), testNgArtifact.getClassifier(), properties, reportsDirectory} );
+        }
+        else
+        {
+            List includes;
+            List excludes;
+
+            if ( test != null )
+            {
+                // Check to see if we are running a single test. The raw parameter will
+                // come through if it has not been set.
+
+                // FooTest -> **/FooTest.java
+
+                includes = new ArrayList();
+
+                excludes = new ArrayList();
+
+                if ( failIfNoTests == null )
+                {
+                    failIfNoTests = Boolean.TRUE;
+                }
+
+                String[] testRegexes = StringUtils.split( test, "," );
+
+                for ( int i = 0; i < testRegexes.length; i++ )
+                {
+                    String testRegex = testRegexes[i];
+                    if ( testRegex.endsWith( ".java" ) )
+                    {
+                        testRegex = testRegex.substring( 0, testRegex.length() - 5 );
+                    }
+                    // Allow paths delimited by '.' or '/'
+                    testRegex = testRegex.replace( '.', '/' );
+                    includes.add( "**/" + testRegex + ".java" );
+                }
+            }
+            else
+            {
+                includes = this.includes;
+
+                excludes = this.excludes;
+
+                // defaults here, qdox doesn't like the end javadoc value
+                // Have to wrap in an ArrayList as surefire expects an ArrayList instead of a List for some reason
+                if ( includes == null || includes.size() == 0 )
+                {
+                    includes = new ArrayList( Arrays.asList( new String[]{"**/IT*.java", "**/*IT.java",
+                        "**/*ITCase.java"} ) );
+                }
+                if ( excludes == null || excludes.size() == 0 )
+                {
+                    excludes = new ArrayList( Arrays.asList( new String[]{"**/*$*"} ) );
+                }
+            }
+
+            if ( testNgArtifact != null )
+            {
+                surefireBooter.addTestSuite("org.apache.maven.surefire.testng.TestNGDirectoryTestSuite", new Object[]{
+                        testClassesDirectory, includes, excludes, testSourceDirectory.getAbsolutePath(),
+                        testNgArtifact.getVersion(), testNgArtifact.getClassifier(), properties, reportsDirectory});
+            }
+            else
+            {
+                String junitDirectoryTestSuite;
+                if ( isJunit47Compatible( junitArtifact ) )
+                {
+                    junitDirectoryTestSuite = "org.apache.maven.surefire.junitcore.JUnitCoreDirectoryTestSuite";
+                    getLog().warn( "Props are" + properties.toString() );
+                    surefireBooter.addTestSuite( junitDirectoryTestSuite,
+                                                 new Object[]{testClassesDirectory, includes, excludes, properties} );
+                }
+                else
+                {
+                    if ( isJunit40to46( junitArtifact ) )
+                    {
+                        junitDirectoryTestSuite = "org.apache.maven.surefire.junit4.JUnit4DirectoryTestSuite";
+                    }
+                    else
+                    {
+                        // fall back to JUnit, which also contains POJO support. Also it can run
+                        // classes compiled against JUnit since it has a dependency on JUnit itself.
+                        junitDirectoryTestSuite = "org.apache.maven.surefire.junit.JUnitDirectoryTestSuite";
+                        junitDirectoryTestSuite = "org.apache.maven.surefire.junit.JUnitDirectoryTestSuite";
+                    }
+                    surefireBooter.addTestSuite( junitDirectoryTestSuite,
+                                                 new Object[]{testClassesDirectory, includes, excludes} );
+                }
+            }
+        }
+
+        // ----------------------------------------------------------------------
+        //
+        // ----------------------------------------------------------------------
+
+        // Check if we need to add configured classes/test classes directories here.
+        // If they are configured, we should remove the default to avoid conflicts.
+        File projectClassesDirectory = new File ( project.getBuild().getOutputDirectory() );
+        if ( ! projectClassesDirectory.equals( classesDirectory ) )
+        {
+            int indexToReplace = classpathElements.indexOf( project.getBuild().getOutputDirectory() );
+            if ( indexToReplace != -1 )
+            {
+                classpathElements.remove( indexToReplace );
+                classpathElements.add( indexToReplace, classesDirectory.getAbsolutePath() );
+            }
+            else
+            {
+                classpathElements.add( 1, classesDirectory.getAbsolutePath() );
+            }
+        }
+
+        File projectTestClassesDirectory = new File( project.getBuild().getTestOutputDirectory() );
+        if ( !projectTestClassesDirectory.equals( testClassesDirectory ) )
+        {
+            int indexToReplace = classpathElements.indexOf( project.getBuild().getTestOutputDirectory() );
+            if ( indexToReplace != -1 )
+            {
+                classpathElements.remove( indexToReplace );
+                classpathElements.add( indexToReplace, testClassesDirectory.getAbsolutePath() );
+            }
+            else
+            {
+                classpathElements.add( 0, testClassesDirectory.getAbsolutePath() );
+            }
+        }
+
+        getLog().debug( "Test Classpath :" );
+
+        for ( Iterator i = classpathElements.iterator(); i.hasNext(); )
+        {
+            String classpathElement = (String) i.next();
+
+            getLog().debug( "  " + classpathElement );
+
+            surefireBooter.addClassPathUrl( classpathElement );
+        }
+
+        Toolchain tc = getToolchain();
+
+        if ( tc != null )
+        {
+            getLog().info( "Toolchain in failsafe-plugin: " + tc );
+            if ( ForkConfiguration.FORK_NEVER.equals( forkMode ) )
+            {
+                forkMode = ForkConfiguration.FORK_ONCE;
+            }
+            if ( jvm != null )
+            {
+                getLog().warn( "Toolchains are ignored, 'executable' parameter is set to " + jvm );
+            }
+            else
+            {
+                jvm = tc.findTool( "java" ); //NOI18N
+            }
+        }
+
+        if ( additionalClasspathElements != null )
+        {
+            for ( Iterator i = additionalClasspathElements.iterator(); i.hasNext(); )
+            {
+                String classpathElement = (String) i.next();
+
+                getLog().debug( "  " + classpathElement );
+
+                surefireBooter.addClassPathUrl( classpathElement );
+            }
+        }
+
+        // ----------------------------------------------------------------------
+        // Forking
+        // ----------------------------------------------------------------------
+
+        ForkConfiguration fork = new ForkConfiguration();
+
+        fork.setForkMode( forkMode );
+
+        processSystemProperties( !fork.isForking() );
+
+        if ( getLog().isDebugEnabled() )
+        {
+            showMap( internalSystemProperties, "system property" );
+        }
+
+        if ( fork.isForking() )
+        {
+            useSystemClassLoader = useSystemClassLoader == null ? Boolean.TRUE : useSystemClassLoader;
+            fork.setUseSystemClassLoader( useSystemClassLoader.booleanValue() );
+            fork.setUseManifestOnlyJar( useManifestOnlyJar );
+
+            fork.setSystemProperties( internalSystemProperties );
+
+            if ( "true".equals( debugForkedProcess ) )
+            {
+                debugForkedProcess = "-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005";
+            }
+
+            fork.setDebugLine( debugForkedProcess );
+
+            if ( jvm == null || "".equals( jvm ) )
+            {
+                // use the same JVM as the one used to run Maven (the "java.home" one)
+                jvm = System.getProperty( "java.home" ) + File.separator + "bin" + File.separator + "java";
+                getLog().debug( "Using JVM: " + jvm );
+            }
+
+            fork.setJvmExecutable( jvm );
+
+            if ( workingDirectory != null )
+            {
+                fork.setWorkingDirectory( workingDirectory );
+            }
+            else
+            {
+                fork.setWorkingDirectory( basedir );
+            }
+
+            fork.setArgLine( argLine );
+
+            fork.setEnvironmentVariables( environmentVariables );
+
+            if ( getLog().isDebugEnabled() )
+            {
+                showMap( environmentVariables, "environment variable" );
+
+                fork.setDebug( true );
+            }
+
+            if ( argLine != null )
+            {
+                List args = Arrays.asList( argLine.split( " " ) );
+                if ( args.contains( "-da" ) || args.contains( "-disableassertions" ) )
+                {
+                    enableAssertions = false;
+                }
+            }
+        }
+
+        surefireBooter.setFailIfNoTests( failIfNoTests == null ? false : failIfNoTests.booleanValue() );
+
+        surefireBooter.setForkedProcessTimeoutInSeconds( forkedProcessTimeoutInSeconds );
+
+        surefireBooter.setRedirectTestOutputToFile( redirectTestOutputToFile );
+
+        surefireBooter.setForkConfiguration( fork );
+
+        surefireBooter.setChildDelegation( childDelegation );
+
+        surefireBooter.setEnableAssertions( enableAssertions );
+
+        surefireBooter.setReportsDirectory( reportsDirectory );
+
+        addReporters( surefireBooter, fork.isForking() );
+
+        return surefireBooter;
+    }
+    
+    private void showMap( Map map, String setting )
+    {
+        for ( Iterator i = map.keySet().iterator(); i.hasNext(); )
+        {
+            String key = (String) i.next();
+            String value = (String) map.get( key );
+            getLog().debug( "Setting " + setting + " [" + key + "]=[" + value + "]" );
+        }
+    }
+
+    private void addProvider( SurefireBooter surefireBooter, String provider, String version, Artifact filteredArtifact )
+        throws ArtifactNotFoundException, ArtifactResolutionException
+    {
+        Artifact providerArtifact = artifactFactory.createDependencyArtifact( "org.apache.maven.surefire", provider,
+                                                                              VersionRange.createFromVersion( version ),
+                                                                              "jar", null, Artifact.SCOPE_TEST );
+        ArtifactResolutionResult result = resolveArtifact( filteredArtifact, providerArtifact );
+
+        for ( Iterator i = result.getArtifacts().iterator(); i.hasNext(); )
+        {
+            Artifact artifact = (Artifact) i.next();
+
+            getLog().debug( "Adding to surefire test classpath: " + artifact.getFile().getAbsolutePath() );
+
+            surefireBooter.addSurefireClassPathUrl( artifact.getFile().getAbsolutePath() );
+        }
+    }
+
+    private ArtifactResolutionResult resolveArtifact( Artifact filteredArtifact, Artifact providerArtifact )
+        throws ArtifactResolutionException, ArtifactNotFoundException
+    {
+        ArtifactFilter filter = null;
+        if ( filteredArtifact != null )
+        {
+            filter =
+                new ExcludesArtifactFilter( Collections.singletonList( filteredArtifact.getGroupId() + ":" +
+                    filteredArtifact.getArtifactId() ) );
+        }
+
+        Artifact originatingArtifact = artifactFactory.createBuildArtifact( "dummy", "dummy", "1.0", "jar" );
+
+        return artifactResolver.resolveTransitively( Collections.singleton( providerArtifact ), originatingArtifact,
+                                                     localRepository, remoteRepositories, metadataSource, filter );
+    }
+
+    private void addArtifact( SurefireBooter surefireBooter, Artifact surefireArtifact )
+        throws ArtifactNotFoundException, ArtifactResolutionException
+    {
+        ArtifactResolutionResult result = resolveArtifact( null, surefireArtifact );
+
+        for ( Iterator i = result.getArtifacts().iterator(); i.hasNext(); )
+        {
+            Artifact artifact = (Artifact) i.next();
+
+            getLog().debug( "Adding to surefire booter test classpath: " + artifact.getFile().getAbsolutePath() );
+
+            surefireBooter.addSurefireBootClassPathUrl( artifact.getFile().getAbsolutePath() );
+        }
+    }
+
+    protected void processSystemProperties( boolean setInSystem )
+    {
+        if ( this.systemProperties != null )
+        {
+            for ( Iterator i = systemProperties.keySet().iterator(); i.hasNext(); )
+            {
+                String key = (String) i.next();
+                String value = (String) systemProperties.get( key );
+                internalSystemProperties.setProperty( key, value );
+            }
+        }
+
+        if ( this.systemPropertyVariables != null )
+        {
+            for ( Iterator i = systemPropertyVariables.keySet().iterator(); i.hasNext(); )
+            {
+                String key = (String) i.next();
+                String value = (String) systemPropertyVariables.get( key );
+                //java Properties does not accept null value
+                if ( value != null )
+                {
+                    internalSystemProperties.setProperty( key, value );
+                }
+            }
+        }
+
+        originalSystemProperties = (Properties) System.getProperties().clone();
+
+        // We used to take all of our system properties and dump them in with the
+        // user specified properties for SUREFIRE-121, causing SUREFIRE-491.
+        // Not gonna do THAT any more... but I'm leaving this code here in case
+        // we need it later when we try to fix SUREFIRE-121 again.
+
+        // Get the properties from the MavenSession instance to make embedded use work correctly
+        Properties userSpecifiedProperties = (Properties) session.getExecutionProperties().clone();
+        userSpecifiedProperties.putAll( internalSystemProperties );
+        //systemProperties = userSpecifiedProperties;
+
+        internalSystemProperties.setProperty( "basedir", basedir.getAbsolutePath() );
+        internalSystemProperties.setProperty( "user.dir", workingDirectory.getAbsolutePath() );
+
+        internalSystemProperties.setProperty( "localRepository", localRepository.getBasedir() );
+
+        if ( setInSystem )
+        {
+            // Add all system properties configured by the user
+            Iterator iter = internalSystemProperties.keySet().iterator();
+
+            while ( iter.hasNext() )
+            {
+                String key = (String) iter.next();
+
+                String value = internalSystemProperties.getProperty( key );
+
+                System.setProperty( key, value );
+            }
+        }
+    }
+
+    /**
+     * <p>
+     * Adds Reporters that will generate reports with different formatting.
+     * <p>
+     * The Reporter that will be added will be based on the value of the parameter useFile, reportFormat, and
+     * printSummary.
+     *
+     * @param surefireBooter The surefire booter that will run tests.
+     * @param forking
+     */
+    private void addReporters( SurefireBooter surefireBooter, boolean forking )
+    {
+        Boolean trimStackTrace = Boolean.valueOf( this.trimStackTrace );
+        if ( useFile )
+        {
+            if ( printSummary )
+            {
+                if ( forking )
+                {
+                    surefireBooter.addReport( ForkingConsoleReporter.class.getName(), new Object[] { trimStackTrace } );
+                }
+                else
+                {
+                    surefireBooter.addReport( ConsoleReporter.class.getName(), new Object[] { trimStackTrace } );
+                }
+            }
+
+            if ( BRIEF_REPORT_FORMAT.equals( reportFormat ) )
+            {
+                surefireBooter.addReport( BriefFileReporter.class.getName(), new Object[] { reportsDirectory,
+                    trimStackTrace } );
+            }
+            else if ( PLAIN_REPORT_FORMAT.equals( reportFormat ) )
+            {
+                surefireBooter.addReport( FileReporter.class.getName(),
+                                          new Object[] { reportsDirectory, trimStackTrace } );
+            }
+        }
+        else
+        {
+            if ( BRIEF_REPORT_FORMAT.equals( reportFormat ) )
+            {
+                surefireBooter.addReport( BriefConsoleReporter.class.getName(), new Object[] { trimStackTrace } );
+            }
+            else if ( PLAIN_REPORT_FORMAT.equals( reportFormat ) )
+            {
+                surefireBooter.addReport( DetailedConsoleReporter.class.getName(), new Object[] { trimStackTrace } );
+            }
+        }
+
+        if ( !disableXmlReport )
+        {
+            surefireBooter.addReport( XMLReporter.class.getName(), new Object[] { reportsDirectory, trimStackTrace } );
+        }
+    }
+
+    /**
+     * @return SurefirePlugin Returns the skipExec.
+     */
+    public boolean isSkipExec()
+    {
+        return this.skipTests;
+    }
+
+    /**
+     * @param skipExec the skipExec to set
+     */
+    public void setSkipExec( boolean skipExec )
+    {
+        this.skipTests = skipExec;
+    }
+
+    //TODO remove the part with ToolchainManager lookup once we depend on
+    //2.0.9 (have it as prerequisite). Define as regular component field then.
+    private Toolchain getToolchain()
+    {
+        Toolchain tc = null;
+        
+        if ( toolchainManager != null )
+        {
+            tc = toolchainManager.getToolchainFromBuildContext( "jdk", session );
+        }
+        
+        return tc;
+    }
+}

Propchange: maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/VerifyMojo.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/VerifyMojo.java?rev=897127&view=auto
==============================================================================
--- maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/VerifyMojo.java (added)
+++ maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/VerifyMojo.java Fri Jan  8 08:03:49 2010
@@ -0,0 +1,290 @@
+package org.apache.maven.plugin.failsafe;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
+import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter;
+import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
+import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
+import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
+import org.apache.maven.artifact.versioning.VersionRange;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.surefire.booter.ForkConfiguration;
+import org.apache.maven.surefire.booter.SurefireBooter;
+import org.apache.maven.surefire.booter.SurefireBooterForkException;
+import org.apache.maven.surefire.booter.SurefireExecutionException;
+import org.apache.maven.surefire.report.BriefConsoleReporter;
+import org.apache.maven.surefire.failsafe.model.io.xpp3.FailsafeSummaryXpp3Writer;
+import org.apache.maven.surefire.failsafe.model.io.xpp3.FailsafeSummaryXpp3Reader;
+import org.apache.maven.surefire.failsafe.model.FailsafeSummary;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.ReaderFactory;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.BufferedOutputStream;
+import java.io.Writer;
+import java.io.OutputStreamWriter;
+import java.io.IOException;
+import java.io.FileInputStream;
+import java.io.BufferedInputStream;
+import java.io.Reader;
+import java.io.InputStreamReader;
+import java.util.List;
+import java.util.Properties;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * Verify integration tests ran using Surefire.
+ *
+ * @author Stephen Connolly
+ * @author Jason van Zyl
+ * @requiresProject true
+ * @goal verify
+ * @phase verify
+ */
+public class VerifyMojo
+    extends AbstractMojo
+{
+
+    /**
+     * Set this to 'true' to skip running tests, but still compile them. Its use is NOT RECOMMENDED, but quite
+     * convenient on occasion.
+     *
+     * @parameter expression="${skipTests}"
+     * @since 2.4
+     */
+    private boolean skipTests;
+
+    /**
+     * Set this to 'true' to skip running integration tests, but still compile them. Its use is NOT RECOMMENDED, but quite
+     * convenient on occasion.
+     *
+     * @parameter expression="${skipITs}"
+     * @since 2.4.3-alpha-2
+     */
+    private boolean skipITs;
+
+    /**
+     * DEPRECATED This old parameter is just like skipTests, but bound to the old property maven.test.skip.exec.
+     * Use -DskipTests instead; it's shorter.
+     *
+     * @parameter expression="${maven.test.skip.exec}"
+     * @since 2.3
+     * @deprecated
+     */
+    private boolean skipExec;
+
+    /**
+     * Set this to 'true' to bypass unit tests entirely. Its use is NOT RECOMMENDED, especially if you
+     * enable it using the "maven.test.skip" property, because maven.test.skip disables both running the
+     * tests and compiling the tests.  Consider using the skipTests parameter instead.
+     *
+     * @parameter expression="${maven.test.skip}"
+     */
+    private boolean skip;
+
+    /**
+     * Set this to true to ignore a failure during testing. Its use is NOT RECOMMENDED, but quite convenient on
+     * occasion.
+     *
+     * @parameter expression="${maven.test.failure.ignore}"
+     */
+    private boolean testFailureIgnore;
+
+    /**
+     * The base directory of the project being tested. This can be obtained in your unit test by
+     * System.getProperty("basedir").
+     *
+     * @parameter expression="${basedir}"
+     */
+    private File basedir;
+
+    /**
+     * The directory containing generated test classes of the project being tested.
+     * This will be included at the beginning the test classpath.
+     *
+     * @parameter default-value="${project.build.testOutputDirectory}"
+     * @required
+     */
+    private File testClassesDirectory;
+
+    /**
+     * Base directory where all reports are written to.
+     *
+     * @parameter expression="${project.build.directory}/failsafe-reports"
+     */
+    private File reportsDirectory;
+
+    /**
+     * The summary file to write integration test results to.
+     *
+     * @parameter expression="${project.build.directory}/failsafe-reports/failsafe-summary.xml"
+     * @required
+     */
+    private File summaryFile;
+
+    /**
+     * Set this to "true" to cause a failure if there are no tests to run. Defaults to false.
+     *
+     * @parameter expression="${failIfNoTests}"
+     * @since 2.4
+     */
+    private Boolean failIfNoTests;
+
+    /**
+     * The character encoding scheme to be applied.
+     *
+     * @parameter expression="${encoding}" default-value="${project.reporting.outputEncoding}"
+     */
+    protected String encoding;
+
+
+    public void execute()
+        throws MojoExecutionException, MojoFailureException
+    {
+        if ( verifyParameters() )
+        {
+            getLog().info( "Failsafe report directory: " + reportsDirectory );
+
+            int result;
+            try
+            {
+                String encoding;
+                if ( StringUtils.isEmpty( this.encoding ) )
+                {
+                    getLog().warn(
+                        "File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING
+                            + ", i.e. build is platform dependent!" );
+                    encoding = ReaderFactory.FILE_ENCODING;
+                }
+                else
+                {
+                    encoding = this.encoding;
+                }
+
+                FileInputStream fos = new FileInputStream( summaryFile );
+                BufferedInputStream bos = new BufferedInputStream( fos );
+                Reader w = new InputStreamReader( bos, encoding );
+                FailsafeSummaryXpp3Reader reader = new FailsafeSummaryXpp3Reader();
+                final FailsafeSummary summary = reader.read( w );
+                result = summary.getResult();
+                w.close();
+                bos.close();
+                fos.close();
+            }
+            catch ( IOException e )
+            {
+                throw new MojoExecutionException( e.getMessage(), e );
+            }
+            catch ( XmlPullParserException e )
+            {
+                throw new MojoExecutionException( e.getMessage(), e );
+            }
+
+            if ( result == 0 )
+            {
+                return;
+            }
+
+            String msg;
+
+            if ( result == SurefireBooter.NO_TESTS_EXIT_CODE )
+            {
+                if ( ( failIfNoTests == null ) || !failIfNoTests.booleanValue() )
+                {
+                    return;
+                }
+                // TODO: i18n
+                throw new MojoFailureException(
+                    "No tests were executed!  (Set -DfailIfNoTests=false to ignore this error.)" );
+            }
+            else
+            {
+                // TODO: i18n
+                msg = "There are test failures.\n\nPlease refer to " + reportsDirectory
+                    + " for the individual test results.";
+
+            }
+
+            if ( testFailureIgnore )
+            {
+                getLog().error( msg );
+            }
+            else
+            {
+                throw new MojoFailureException( msg );
+            }
+        }
+    }
+
+    private boolean verifyParameters()
+        throws MojoFailureException
+    {
+        if ( skip || skipTests || skipITs || skipExec )
+        {
+            getLog().info( "Tests are skipped." );
+            return false;
+        }
+
+        if ( !testClassesDirectory.exists() )
+        {
+            if ( failIfNoTests != null && failIfNoTests.booleanValue() )
+            {
+                throw new MojoFailureException( "No tests to run!" );
+            }
+            getLog().info( "No tests to run." );
+            return false;
+        }
+
+        return true;
+    }
+
+
+}

Propchange: maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/VerifyMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/VerifyMojo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/package.html
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/package.html?rev=897127&view=auto
==============================================================================
--- maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/package.html (added)
+++ maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/package.html Fri Jan  8 08:03:49 2010
@@ -0,0 +1,9 @@
+<html>
+<body>
+
+<p>
+    Provides Mojo goals for running integration tests and subsequently failing the build in a safe way.
+</p>
+
+</body>
+</html>
\ No newline at end of file

Propchange: maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/package.html
------------------------------------------------------------------------------
    svn:mime-type = text/html

Added: maven/surefire/trunk/maven-failsafe-plugin/src/main/mdo/failsafe-summary.mdo
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-failsafe-plugin/src/main/mdo/failsafe-summary.mdo?rev=897127&view=auto
==============================================================================
--- maven/surefire/trunk/maven-failsafe-plugin/src/main/mdo/failsafe-summary.mdo (added)
+++ maven/surefire/trunk/maven-failsafe-plugin/src/main/mdo/failsafe-summary.mdo Fri Jan  8 08:03:49 2010
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<model xsd.namespace="http://mojo.codehaus.org/plugins/failsafe-maven-plugin/failsafe-summary/2.4.3"
+       xsd.targetNamespace="http://mojo.codehaus.org/plugins/failsafe-maven-plugin/failsafe-summary/2.4.3">
+  <id>failsafe-summary</id>
+  <name>FailsafeSummary</name>
+  <description>
+    A summary of tests executed by the Failsafe Maven Plugin.
+  </description>
+  <defaults>
+    <default>
+      <key>package</key>
+      <value>org.apache.maven.surefire.failsafe.model</value>
+    </default>
+  </defaults>
+  <versionDefinition>
+    <type>namespace</type>
+  </versionDefinition>
+  <classes>
+    <class rootElement="true" xml.tagName="failsafe-summary">
+      <name>FailsafeSummary</name>
+      <description>
+        Describes the results of executing tests
+      </description>
+      <version>2.4.3</version>
+      <fields>
+        <field xml.attribute="true">
+          <name>result</name>
+          <version>2.4.3</version>
+          <required>true</required>
+          <type>int</type>
+          <description>The surefire result code</description>
+        </field>
+        <field>
+          <name>exception</name>
+          <version>2.4.3</version>
+          <required>false</required>
+          <type>String</type>
+          <description>The exception that caused surefire to bomb out</description>
+        </field>
+      </fields>
+    </class>
+  </classes>
+</model>

Propchange: maven/surefire/trunk/maven-failsafe-plugin/src/main/mdo/failsafe-summary.mdo
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/surefire/trunk/maven-failsafe-plugin/src/main/mdo/failsafe-summary.mdo
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/additional-classpath.apt.vm
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/additional-classpath.apt.vm?rev=897127&view=auto
==============================================================================
--- maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/additional-classpath.apt.vm (added)
+++ maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/additional-classpath.apt.vm Fri Jan  8 08:03:49 2010
@@ -0,0 +1,54 @@
+  ------
+  Additional Classpath
+  ------
+  Pascal Lambert
+  ------
+  March 2008
+  ------
+
+Additional Classpath Elements
+
+  If you need to put more stuff in your classpath when Surefire executes (e.g some funky resources or a container special jar),
+  we normally recommend you add it to your classpath as a dependency.  Consider deploying shared jars to a private remote repository for your
+  organization.
+  
+  But, if you must, you can use the <<<additionalClasspathElements>>> element to add custom resources/jars to your classpath.
+  This will be treated as an absolute file system path, so you may want use ${basedir} or another property combined with a relative path.
+  Note that additional classpath elements are added to the end of the classpath, so you cannot use these to 
+  override project dependencies or resources.
+
++---+
+<project>
+  [...]
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-failsafe-plugin</artifactId>
+        <version>${project.version}</version>
+        <configuration>
+          <additionalClasspathElements>
+            <additionalClasspathElement>path/to/additional/resources</additionalClasspathElement>
+            <additionalClasspathElement>path/to/additional/jar</additionalClasspathElement>
+          </additionalClasspathElements>
+        </configuration>
+        <executions>
+          <execution>
+            <id>integration-test</id>
+            <goals>
+              <goal>integration-test</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>verify</id>
+            <goals>
+              <goal>verify</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  [...]
+</project>
++---+

Propchange: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/additional-classpath.apt.vm
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/additional-classpath.apt.vm
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/class-loading.apt.vm
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/class-loading.apt.vm?rev=897127&view=auto
==============================================================================
--- maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/class-loading.apt.vm (added)
+++ maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/class-loading.apt.vm Fri Jan  8 08:03:49 2010
@@ -0,0 +1,162 @@
+  ------
+  Classloading and Forking
+  ------
+  Dan Fabulich
+  ------
+  May 2008
+  ------
+
+Classloading and Forking in Maven Surefire/Failsafe
+
+ This page discusses classloading and forking under Maven Surefire/Failsafe, with an eye
+ towards troubleshooting problems.
+
+* Executive Summary
+
+ If you're having problems, you'll probably want to tinker with these three settings: forkMode, useSystemClassLoader, and useManifestOnlyJar.
+
+* What problem does Surefire solve?
+
+ Initially, the problem seems simple enough. Just launch Java with a classpath, like this:
+ 
++---+
+java -classpath foo.jar:bar.jar MyApp
++---+
+ 
+ But there's a problem here: on some operating systems (Windows), there's a limit on how long you can make
+ your command line, and therefore a limit on how long you can make your classpath. The limit is different
+ on different versions of Windows; in some versions only a few hundred characters are allowed, in others
+ a few thousand, but the limit can be pretty severe in either case.
+ 
+* How do people solve this problem in general?
+
+ There are two "tricks" you can use to workaround this problem; both of them are can cause other problems in some cases.
+
+ 1. <<Isolated Classloader>>: One workaround is to use an isolated classloader.
+ Instead of launching MyApp directly, we can launch some other app (a "booter")
+ with a much shorter classpath. We can then create a new java.lang.ClassLoader
+ (usually a java.net.URLClassLoader) with your classpath configured. The booter
+ can then load up MyApp from the classloader; when MyApp refers to other classes,
+ they will be automatically loaded from our isolated classloader.
+ 
+ The problem with using an isolated classloader is that your classpath isn't
+ <really> correct, and some apps can detect this and object. For example, the
+ system property "java.class.path" won't include your jars; if your app notices
+ this, it could cause a problem.
+ 
+ There's another similar problem with using an isolated classloader: any class
+ may call the static method ClassLoader.getSystemClassLoader() and attempt to
+ load classes out of that classloader, instead of using the default classloader.
+ Classes often do this if they need to create classloaders of their own....
+ Unfortunately, Java-based web application servers like Jetty, Tomcat, BEA
+ WebLogic and IBM WebSphere are very likely to try to escape the confines of an
+ isolated classloader.
+ 
+ 2. <<Manifest-Only Jar>>: Another workaround is to use a "manifest-only jar." In
+ this case, you create a temporary jar that's almost completely empty, except for
+ a META-INF/MANIFEST.MF file. Java manifests can contain attributes that the Java
+ VM will honor as directives; for example, you can have a "Class-Path" attribute,
+ which contains a list of other jars to add to the classpath. So then you can run
+ your code like this:
+ 
++---+
+java -classpath booter.jar MyApp
++---+
+  
+ This is a bit more realistic, because in this case the system classloader, the
+ thread context classloader and the default classloader are all the same; there's
+ no possibility of "escaping" the classloader. But this is still a weird
+ simulation of a "normal" classpath, and it's still possible for apps to notice
+ this. Again, java.class.path may not be what you'd expect ("why does it contain
+ only one jar?"). Additionally, it's possible to query the system classloader to
+ get the list of jars back out of it; your app may be confused if it finds only
+ our booter.jar there!
+
+* Advantages/Disadvantages of each solution
+
+ If your app tries to interrogate its own classloader for a list of jars, it may
+ work better under an isolated classloader than it would with a manifest-only
+ jar.  However, if your app tries to escape its default classloader, it may not
+ work under an isolated classloader at all.
+
+ One advantage of using an isolated classloader is that it's the only way to use
+ an isolated classloader without forking a separate process, running all of the
+ tests in the same process as Maven itself.  But that itself can be pretty risky,
+ especially if Maven is running embedded in your IDE!
+ 
+ Finally, of course, you could just try to wire up a plain old Java classpath and hope
+ it's short enough.  The worst case there is that your classpath might work
+ on some machines and not others.  Windows boxes would behave differently from
+ Linux boxes; users with short user names might have more success than users
+ with long user names, etc.  For this reason, we chose not to make the basic
+ classpath the default, though we do provide it as an option (mostly as a last
+ resort).
+ 
+* What does Surefire do?
+
+ Surefire provides a mechanism for using multiple strategies.  The main parameter that
+ determines this is called "useSystemClassLoader".  If useSystemClassLoader is
+ true, then we use a manifest-only jar; otherwise, we use an isolated
+ classloader.  If you want to use a basic plain old Java classpath, you can set
+ useManifestOnlyJar=false which only has an effect when useSystemClassLoader=true.
+ 
+ (The default value for useSystemClassLoader changed between Surefire 2.3 and
+ Surefire 2.4, which was a pretty significant change.  In Surefire 2.3,
+ useSystemClassLoader was false by default, and we used an isolated classloader. 
+ In Surefire 2.4, useSystemClassLoader is true by default.  No value works for
+ everyone, but we think this default is an improvement; a bunch of
+ hard-to-diagnose bugs get better when we useSystemClassLoader=true.)
+ 
+ Unfortunately, if useSystemClassLoader is set incorrectly for your app, you're going to
+ have a problem on your hands that can be quite difficult to diagnose.  You might
+ even be forced to read a long doc page like this one.  ;-)
+ 
+ If you're having problems loading classes, try setting useSystemClassLoader=false
+ to see if that helps.  You can do that with the POM snippet below, or by setting
+ "-Dsurefire.useSystemClassLoader=false".  If that doesn't work, try setting
+ useSystemClassLoader back to true and setting useManifestOnlyJar to false.
+ 
++---+
+<project>
+  [...]
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-failsafe-plugin</artifactId>
+        <version>${project.version}</version>
+        <configuration>
+          <useSystemClassLoader>false</useSystemClassLoader>
+        </configuration>
+        <executions>
+          <execution>
+            <id>integration-test</id>
+            <goals>
+              <goal>integration-test</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>verify</id>
+            <goals>
+              <goal>verify</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  [...]
+</project>
++---+
+
+* Debugging Classpath Problems
+
+ If you've read this far, you're probably fully equipped to diagnose problems that may occur during classloading.  Here's some general tips to try:
+
+ * Run mvn with --debug (aka -X) to get more detailed output
+
+ * Check your forkMode.  If forkMode=never, it's impossible to use the system classloader or a plain old Java classpath; we have to use an isolated classloader.
+
+ * If you're using the defaults, useSystemClassLoader=true and useManifestOnlyJar=false.  In that case, look at the generated manifest-only surefire booter jar.  Open it up (it's just a zip) and read its manifest.
+
+ * Run mvn with -Dmaven.failsafe.debug, and attach to the running process with a debugger.
\ No newline at end of file

Propchange: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/class-loading.apt.vm
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/class-loading.apt.vm
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/debugging.apt
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/debugging.apt?rev=897127&view=auto
==============================================================================
--- maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/debugging.apt (added)
+++ maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/debugging.apt Fri Jan  8 08:03:49 2010
@@ -0,0 +1,48 @@
+  ------
+  Debugging Tests
+  ------
+  Dan Fabulich
+  ------
+  January 2008
+  ------
+
+Debugging Tests
+
+  Sometimes you need to debug the tests exactly as Maven ran them.  Here's how!
+  
+Forked Tests
+
+  By default, Maven runs your tests in a separate ("forked") process.  You can use the <<<maven.failsafe.debug>>> property
+  to debug your forked tests remotely, like this:
+
++---+
+mvn -Dmaven.failsafe.debug verify
++---+
+
+  The tests will automatically pause and await a remote debugger on port 5005.  You can then attach to the running tests
+  using Eclipse.  You can setup a "Remote Java Application" launch configuration via the menu
+  command "Run" > "Open Debug Dialog..."
+
+  If you need to configure a different port, you may pass a more detailed value.  For example, the value below will use port 8000
+  instead of port 5005.
+
++---+
+mvn -Dmaven.failsafe.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Xnoagent -Djava.compiler=NONE" verify
++---+
+
+Non-forked Tests
+
+  You can force Maven not to fork tests by configuring the <<<forkMode>>> configuration parameter.
+
++---+
+mvn -DforkMode=never test
++---+
+
+  Then all you need to do is debug Maven itself.  Since Maven 2.0.8, Maven has shipped with a "mvnDebug" shell script that you can
+  use to launch Maven with convenient debugging options:
+  
++---+
+mvnDebug -DforkMode=never test
++---+
+
+  Then you can attach Eclipse to Maven itself, which may be easier/more convenient than debugging the forked executable.
\ No newline at end of file

Propchange: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/debugging.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/debugging.apt
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/inclusion-exclusion.apt.vm
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/inclusion-exclusion.apt.vm?rev=897127&view=auto
==============================================================================
--- maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/inclusion-exclusion.apt.vm (added)
+++ maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/inclusion-exclusion.apt.vm Fri Jan  8 08:03:49 2010
@@ -0,0 +1,108 @@
+  ------
+  Inclusions and Exclusions of Tests
+  ------
+  Allan Ramirez
+  ------
+  July 2006
+  ------
+
+Inclusions and Exclusions of Tests
+
+* Inclusions
+
+  By default, the Failsafe Plugin will automatically include all test classes
+  with the following wildcard patterns:
+
+   * <"**/IT*.java"> - includes all of its subdirectory and all java
+   filenames that start with "IT".
+
+   * <"**/*IT.java"> - includes all of its subdirectory and all java
+   filenames that end with "IT".
+
+   * <"**/*ITCase.java"> - includes all of its subdirectory and all java
+   filenames that end with "ITCase".
+
+   []
+
+  If the test classes does not go with the naming convention, then configure
+  Failsafe Plugin and specify the tests you want to include.
+
++---+
+<project>
+  [...]
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-failsafe-plugin</artifactId>
+        <version>${project.version}</version>
+        <configuration>
+          <includes>
+            <include>Sample.java</include>
+          </includes>
+        </configuration>
+        <executions>
+          <execution>
+            <id>integration-test</id>
+            <phase>integration-test</phase>
+            <goals>
+              <goal>integration-test</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>verify</id>
+            <phase>verify</phase>
+            <goals>
+              <goal>verify</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  [...]
+</project>
++---+
+
+* Exclusions
+
+  There are certain times when some tests are causing the build to fail.
+  Excluding them is one of the best workarounds to continue the build.
+  Exclusions can be done by configuring the <<excludes>> property of the
+  plugin.
+
++---+
+<project>
+  [...]
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-failsafe-plugin</artifactId>
+        <version>${project.version}</version>
+        <configuration>
+          <excludes>
+            <exclude>**/CircleIT.java</exclude>
+            <exclude>**/SquareIT.java</exclude>
+          </excludes>
+        </configuration>
+        <executions>
+          <execution>
+            <id>integration-test</id>
+            <goals>
+              <goal>integration-test</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>verify</id>
+            <goals>
+              <goal>verify</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  [...]
+</project>
++---+
\ No newline at end of file

Propchange: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/inclusion-exclusion.apt.vm
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/inclusion-exclusion.apt.vm
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/single-test.apt
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/single-test.apt?rev=897127&view=auto
==============================================================================
--- maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/single-test.apt (added)
+++ maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/single-test.apt Fri Jan  8 08:03:49 2010
@@ -0,0 +1,30 @@
+  ------
+  Running a Single Test
+  ------
+  Allan Ramirez
+  ------
+  July 2006
+  ------
+
+Running a Single Test
+
+  During development, you may run a single test class repeatedly. To run this
+  through Maven, set the <<<it.test>>> property to a specific test case.
+
++---+
+mvn -Dit.test=ITCircle verify
++---+
+
+  The value for the <<<it.test>>> parameter is the name of the test class (without the extension; we'll strip off the extension if you accidentally provide one).
+
+  You may also use patterns to run a number of tests:
+
++---+
+mvn -Dit.test=ITCi*le verify
++---+
+
+  And you may use multiple names/patterns, separated by commas:
+
++---+
+mvn -Dit.test=ITSquare,ITCi*le verify
++---+

Propchange: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/single-test.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/single-test.apt
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/skipping-test.apt.vm
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/skipping-test.apt.vm?rev=897127&view=auto
==============================================================================
--- maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/skipping-test.apt.vm (added)
+++ maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/skipping-test.apt.vm Fri Jan  8 08:03:49 2010
@@ -0,0 +1,54 @@
+  ------
+  Skipping Test
+  ------
+  Johnny Ruiz
+  Brett Porter
+  Allan Ramirez
+  ------
+  July 2006
+  ------
+
+Skipping Tests
+
+ To skip running the tests for a particular project, set the <<skipTests>>
+ property to <<true>>.
+
++---+
+<project>
+  [...]
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-failsafe-plugin</artifactId>
+        <version>${project.version}</version>
+        <configuration>
+          <skipTests>true</skipTests>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  [...]
+</project>
++---+
+
+ You can also skip the tests via command line by executing the following command:
+
++---+
+mvn install -DskipTests
++---+
+
+ Since <<<skipTests>>> is also followed by the Surefire Plugin, this will have the effect
+ of not running any tests.  If, instead, you want to skip only the integration tests
+ being run by the Failsafe Plugin, you would use the <<<skipITs>>> property
+ 
++---+
+mvn install -DskipITs
++---+
+
+ If you absolutely must, you can also use the <<<maven.test.skip>>> property to skip compiling the tests.
+ <<<maven.test.skip>>> is honored by Surefire, Failsafe and the Compiler Plugin.
+
++---+
+mvn install -Dmaven.test.skip=true
++---+
\ No newline at end of file

Propchange: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/skipping-test.apt.vm
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/skipping-test.apt.vm
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision



Mime
View raw message