maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apope...@apache.org
Subject svn commit: r537691 [2/11] - in /maven/sandbox/branches/surefire/surefire-collab2: ./ maven-surefire-plugin/ maven-surefire-plugin/src/ maven-surefire-plugin/src/it/ maven-surefire-plugin/src/it/test1/ maven-surefire-plugin/src/it/test1/src/ maven-sure...
Date Mon, 14 May 2007 01:34:18 GMT
Added: maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/it/test8/src/test/java/TestNGTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/it/test8/src/test/java/TestNGTest.java?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/it/test8/src/test/java/TestNGTest.java (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/it/test8/src/test/java/TestNGTest.java Sun May 13 18:33:45 2007
@@ -0,0 +1,52 @@
+import org.testng.annotations.AfterSuite;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+
+/**
+ * Tests grouping/threading/parallel functionality of TestNG.
+ * 
+ * @author jkuhnert
+ */
+public class TestNGTest {
+
+	static int m_testCount = 0;
+	
+	/**
+	 * Sets up testObject
+	 */
+	@BeforeClass(groups = "functional")
+	public void configureTest()
+	{
+		testObject = new Object();
+	}
+	
+	@AfterSuite(alwaysRun = true, groups = "functional")
+	public void check_Test_Count()
+	{
+		System.out.println("check_Test_Count(): " + m_testCount);
+		
+		assert m_testCount == 3 : "Expected 3 tests to be run but local count was " + m_testCount;
+	}
+	
+	Object testObject;
+	
+	/**
+	 * Tests reporting an error
+	 */
+	@Test(groups = {"functional", "notincluded"})
+	public void isTestObjectNull()
+	{
+		m_testCount++;
+		assert testObject != null : "testObject is null";
+	}
+	
+	/**
+	 * Sample method that shouldn't be run by test suite.
+	 */
+	@Test(groups = "notincluded")
+	public void shouldNotRun()
+	{
+		assert false == true : "Group specified by test shouldnt be run.";
+	}
+}
\ No newline at end of file

Added: maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/it/testArgLine/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/it/testArgLine/pom.xml?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/it/testArgLine/pom.xml (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/it/testArgLine/pom.xml Sun May 13 18:33:45 2007
@@ -0,0 +1,53 @@
+<?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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.plugins.surefire</groupId>
+  <artifactId>testArgLine</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <name>Test for argLine configuration</name>
+  <description>Test for argLine configuration parameter</description>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <argLine>"-Djava.library.path=foo foo/foo/bar/1.0"</argLine>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

Added: maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/it/testArgLine/src/test/java/SurefireTest1.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/it/testArgLine/src/test/java/SurefireTest1.java?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/it/testArgLine/src/test/java/SurefireTest1.java (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/it/testArgLine/src/test/java/SurefireTest1.java Sun May 13 18:33:45 2007
@@ -0,0 +1,66 @@
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class SurefireTest1
+    extends TestCase
+{
+
+    private boolean setUpCalled = false;
+
+    private static boolean tearDownCalled = false;
+
+    public SurefireTest1( String name, String extraName )
+    {
+        super( name );
+    }
+
+    public static Test suite()
+    {
+        TestSuite suite = new TestSuite();
+        Test test = new SurefireTest1( "testSetUp", "dummy" );
+        suite.addTest( test );
+        TestSetup setup = new TestSetup( suite )
+        {
+
+            protected void setUp()
+            {
+                //oneTimeSetUp();
+            }
+
+            protected void tearDown()
+            {
+                oneTimeTearDown();
+            }
+
+        };
+
+        return setup;
+    }
+
+    protected void setUp()
+    {
+        setUpCalled = true;
+        tearDownCalled = false;
+        System.out.println( "Called setUp" );
+    }
+
+    protected void tearDown()
+    {
+        setUpCalled = false;
+        tearDownCalled = true;
+        System.out.println( "Called tearDown" );
+    }
+
+    public void testSetUp()
+    {
+        assertTrue( "setUp was not called", setUpCalled );
+    }
+
+    public static void oneTimeTearDown()
+    {
+        assertTrue( "tearDown was not called", tearDownCalled );
+    }
+
+}

Added: maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java Sun May 13 18:33:45 2007
@@ -0,0 +1,868 @@
+package org.apache.maven.plugin.surefire;
+
+/*
+ * 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 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.InvalidVersionSpecificationException;
+import org.apache.maven.artifact.versioning.VersionRange;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+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 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;
+
+/**
+ * Run tests using Surefire.
+ *
+ * @author Jason van Zyl
+ * @version $Id: SurefirePlugin.java 513614 2007-03-02 04:18:18Z jvanzyl $
+ * @requiresDependencyResolution test
+ * @goal test
+ * @phase test
+ */
+public class SurefirePlugin
+    extends AbstractMojo
+{
+    /**
+     * Set this to 'true' to bypass unit tests entirely. Its use is NOT RECOMMENDED, but quite convenient on occasion.
+     *
+     * @parameter expression="${maven.test.skip}"
+     */
+    private boolean skip;
+
+    /**
+     * Set this to 'true' to bypass unit tests execution, but still compile them. Its use is NOT RECOMMENDED, but quite convenient on occasion.
+     *
+     * @parameter expression="${maven.test.skip.exec}"
+     */
+    private boolean skipExec;
+
+    /**
+     * 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}"
+     * @required
+     */
+    private File basedir;
+
+    /**
+     * The directory containing generated test classes of the project being tested.
+     *
+     * @parameter expression="${project.build.testOutputDirectory}"
+     * @required
+     */
+    private File testClassesDirectory;
+
+    /**
+     * The classpath elements of the project being tested.
+     *
+     * @parameter expression="${project.testClasspathElements}"
+     * @required
+     * @readonly
+     */
+    private List classpathElements;
+
+    /**
+     * Base directory where all reports are written to.
+     *
+     * @parameter expression="${project.build.directory}/surefire-reports"
+     */
+    private File reportsDirectory;
+
+    /**
+     * The test source directory containing test class sources.
+     *
+     * @parameter expression="${project.build.testSourceDirectory}"
+     * @required
+     */
+    private File testSourceDirectory;
+
+    /**
+     * Specify this parameter(can be a comma separated list) if you want to use the test pattern matching notation, Ant pattern matching, to select tests to run.
+     * The Ant pattern will be used to create an include pattern formatted like <code>**&#47;${test}.java</code>
+     * When used, the <code>includes</code> and <code>excludes</code> patterns parameters are ignored.
+     *
+     * @parameter expression="${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;Test*.java   **&#47;*Test.java   **&#47;*TestCase.java</code>
+     *
+     * @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;Abstract*Test.java  **&#47;Abstract*TestCase.java **&#47;*$*</code>
+     *
+     * @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.
+     *
+     * @parameter
+     */
+    private Properties systemProperties;
+
+    /**
+     * List of properties for configuring all TestNG related configurations. This is the new
+     * preferred method of configuring TestNG.
+     *
+     * @parameter
+     */
+    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;
+
+    /**
+     * Option to print summary of test suites or just print the test cases that has errors.
+     *
+     * @parameter expression="${surefire.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="${surefire.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="${surefire.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"
+     */
+    private boolean redirectTestOutputToFile;
+
+    /**
+     * 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"
+     */
+    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}"
+     */
+    private String jvm;
+
+    /**
+     * Arbitrary options to set on the command line.
+     *
+     * @parameter expression="${argLine}"
+     */
+    private String argLine;
+
+    /**
+     * Additional environments to set on the command line.
+     *
+     * @parameter
+     */
+    private Map environmentVariables = new HashMap();
+
+    /**
+     * Command line working directory.
+     *
+     * @parameter
+     */
+    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"
+     */
+    private boolean childDelegation;
+
+    /**
+     * Groups for this test. Only classes/methods/etc decorated with one of the
+     * groups specified here will be included in test run, if specified.
+     *
+     * @parameter expression="${groups}"
+     */
+    private String groups;
+
+    /**
+     * Excluded groups. Any methods/classes/etc with one of the groups specified in this
+     * list will specifically not be run.
+     *
+     * @parameter expression="${excludedGroups}"
+     */
+    private String excludedGroups;
+
+    /**
+     * List of TestNG suite xml file locations, seperated by commas. It should be noted that
+     * if suiteXmlFiles is specified, <b>no</b> other tests will be run, ignoring other parameters,
+     * like includes and excludes.
+     *
+     * @parameter
+     */
+    private File[] suiteXmlFiles;
+
+    /**
+     * 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}"
+     * default-value="5"
+     */
+    private int threadCount;
+
+    /**
+     * 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.
+     *
+     * @parameter expression="${parallel}"
+     * default-value="false"
+     *
+     * @todo test how this works with forking, and console/file output parallelism
+     */
+    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"
+     */
+    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}"
+     */
+    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;
+
+    /**
+     * Flag to disable the generation of report files in xml format.
+     *
+     * @parameter expression="${disableXmlReport}" default-value="false"
+     */
+    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.
+     *
+     * @parameter expression="${surefire.useSystemClassLoader}" default-value="false"
+     */
+    private boolean useSystemClassLoader;
+
+    public void execute()
+        throws MojoExecutionException, MojoFailureException
+    {
+        if ( verifyParameters() )
+        {
+            SurefireBooter surefireBooter = constructSurefireBooter();
+
+            getLog().info( "Surefire report directory: " + reportsDirectory );
+
+            boolean success;
+            try
+            {
+                success = surefireBooter.run();
+            }
+            catch ( SurefireBooterForkException e )
+            {
+                throw new MojoExecutionException( e.getMessage(), e );
+            }
+            catch ( SurefireExecutionException e )
+            {
+                throw new MojoExecutionException( e.getMessage(), e );
+            }
+
+            if ( originalSystemProperties != null )
+            {
+                // restore system properties
+                System.setProperties( originalSystemProperties );
+            }
+
+            if ( !success )
+            {
+                String msg = "There are test failures.";
+
+                if ( testFailureIgnore )
+                {
+                    getLog().error( msg );
+                }
+                else
+                {
+                    throw new MojoFailureException( msg );
+                }
+            }
+        }
+    }
+
+    private boolean verifyParameters()
+        throws MojoFailureException
+    {
+        if ( skip || skipExec )
+        {
+            getLog().info( "Tests are skipped." );
+            return false;
+        }
+        
+        if ( !testClassesDirectory.exists() )
+        {
+            getLog().info( "No tests to run." );
+            return false;
+        }
+
+        if ( useSystemClassLoader && ForkConfiguration.FORK_NEVER.equals( forkMode ) )
+        {
+            getLog().warn( "useSystemClassloader=true 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 Map convertTestNGParameters()
+    {
+        if ( properties == null )
+        {
+            properties = new Properties();
+        }
+
+        if (this.parallel != null)
+            properties.put("parallel", this.parallel);
+        if (this.excludedGroups != null)
+            properties.put("excludegroups", this.excludedGroups);
+        if (this.groups != null)
+            properties.put("groups", this.groups);
+
+        if (this.threadCount > 0)
+            properties.put("threadcount", new Integer(this.threadCount));
+
+        if (this.testClassesDirectory != null)
+            properties.put("testng.test.classpath", testClassesDirectory.getAbsolutePath());
+        
+        return this.properties;
+    }
+
+    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(); // TODO: this is ridiculous, but it fixes getBaseVersion to be -SNAPSHOT if needed
+
+        Artifact junitArtifact;
+        Artifact testNgArtifact;
+        try
+        {
+            addArtifact( surefireBooter, surefireArtifact );
+
+            junitArtifact = (Artifact) projectArtifactMap.get( "junit:junit" );
+
+            // TODO: this is pretty manual, but I'd rather not require the plugin > dependencies section right now
+            testNgArtifact = (Artifact) projectArtifactMap.get( "org.testng:testng" );
+
+            if ( testNgArtifact != null )
+            {
+                VersionRange range = VersionRange.createFromVersionSpec( "[4.7,)" );
+                if ( !range.containsVersion( testNgArtifact.getSelectedVersion() ) )
+                {
+                    throw new MojoFailureException(
+                        "TestNG support requires version 4.7 or above. You have declared version " +
+                            testNgArtifact.getVersion() );
+                }
+
+                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 ( junitArtifact != null && junitArtifact.getBaseVersion().startsWith( "4" ) )
+            {
+                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 )
+        {
+            if ( testNgArtifact == null )
+            {
+                throw new MojoExecutionException( "suiteXmlFiles is configured, but there is no TestNG dependency" );
+            }
+            surefireBooter.addTestSuite( "org.apache.maven.surefire.testng.TestNGXmlTestSuite",
+            		new Object[]{suiteXmlFiles, 
+            			testSourceDirectory.getAbsolutePath(),
+            			testNgArtifact.getVersion()} );
+
+        }
+        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();
+
+                String[] testRegexes = StringUtils.split( test, "," );
+
+                for ( int i = 0; i < testRegexes.length; i++ )
+                {
+                    includes.add( "**/" + testRegexes[i] + ".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[]{"**/Test*.java", "**/*Test.java", "**/*TestCase.java"} ) );
+                }
+                if ( excludes == null || excludes.size() == 0 )
+                {
+                    excludes = new ArrayList(
+                        Arrays.asList( new String[]{"**/Abstract*Test.java", "**/Abstract*TestCase.java", "**/*$*"} ) );
+                }
+            }
+
+            if ( testNgArtifact != null )
+            {
+                convertTestNGParameters();
+                surefireBooter.addTestSuite( "org.apache.maven.surefire.testng.TestNGDirectoryTestSuite", 
+                		new Object[]{testClassesDirectory, includes, excludes, testSourceDirectory.getAbsolutePath(), 
+                			testNgArtifact.getVersion(), 
+                			convertTestNGParameters()}); 
+            }
+            else
+            {
+                String junitDirectoryTestSuite;
+                if ( junitArtifact != null && junitArtifact.getBaseVersion() != null && junitArtifact.getBaseVersion().startsWith( "4" ) )
+                {
+                    junitDirectoryTestSuite = "org.apache.maven.surefire.junit4.JUnit4DirectoryTestSuite";
+                }
+                else
+                {
+                    junitDirectoryTestSuite = "org.apache.maven.surefire.junit.JUnitDirectoryTestSuite";
+                }
+
+                // 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.
+                surefireBooter.addTestSuite( junitDirectoryTestSuite,
+                                             new Object[]{testClassesDirectory, includes, excludes} );
+            }
+        }
+
+        // ----------------------------------------------------------------------
+        //
+        // ----------------------------------------------------------------------
+
+        getLog().debug( "Test Classpath :" );
+
+        // no need to add classes/test classes directory here - they are in the classpath elements already
+
+        for ( Iterator i = classpathElements.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( systemProperties, "system property" );
+        }
+
+        if ( fork.isForking() )
+        {
+            fork.setSystemProperties( systemProperties );
+
+            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 );
+            }
+        }
+
+        surefireBooter.setRedirectTestOutputToFile( redirectTestOutputToFile );
+
+        surefireBooter.setForkConfiguration( fork );
+
+        surefireBooter.setChildDelegation( childDelegation );
+
+        surefireBooter.setReportsDirectory( reportsDirectory );
+
+        surefireBooter.setUseSystemClassLoader( useSystemClassLoader );
+
+        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 ( systemProperties == null )
+        {
+            systemProperties = new Properties();
+        }
+
+        originalSystemProperties = (Properties) System.getProperties().clone();
+
+        systemProperties.setProperty( "basedir", basedir.getAbsolutePath() );
+
+        systemProperties.setProperty( "localRepository", localRepository.getBasedir() );
+
+        if ( setInSystem )
+        {
+            // Add all system properties configured by the user
+            Iterator iter = systemProperties.keySet().iterator();
+
+            while ( iter.hasNext() )
+            {
+                String key = (String) iter.next();
+
+                String value = systemProperties.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.skipExec;
+    }
+
+    /**
+     * @param skipExec the skipExec to set
+     */
+    public void setSkipExec( boolean skipExec )
+    {
+        this.skipExec = skipExec;
+    }
+}

Added: maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/main/java/org/apache/maven/test/SurefirePlugin.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/main/java/org/apache/maven/test/SurefirePlugin.java?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/main/java/org/apache/maven/test/SurefirePlugin.java (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/main/java/org/apache/maven/test/SurefirePlugin.java Sun May 13 18:33:45 2007
@@ -0,0 +1,34 @@
+package org.apache.maven.test;
+
+/*
+ * 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.
+ */
+
+/**
+ * Run tests using Surefire
+ *
+ * @author Jason van Zyl
+ * @version $Id: SurefirePlugin.java 510866 2007-02-23 08:13:49Z brett $
+ * @see org.apache.maven.plugin.surefire.SurefirePlugin
+ * @deprecated use org.apache.maven.plugins.surefire.SurefirePlugin instead
+ */
+public class SurefirePlugin
+    extends org.apache.maven.plugin.surefire.SurefirePlugin
+{
+
+}

Added: maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/examples/class-loading.apt
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/examples/class-loading.apt?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/examples/class-loading.apt (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/examples/class-loading.apt Sun May 13 18:33:45 2007
@@ -0,0 +1,40 @@
+  ------
+  Class Loading Issues
+  ------
+  Brett Porter
+  ------
+  July 2006
+  ------
+
+Class Loading Issues
+
+ By default, Surefire loads classes using the default Java mechanism. However,
+ it can be set to use "child first" classloading, like a web application -
+ meaning your dependencies take precedence over those in the JDK. Classes in
+ the java.* and javax.* packages can never be overridden. The only use for
+ this is so that code in the test classpath can override stuff present in the
+ JDK or its "standard extensions" directory which is not in these restricted
+ packages. This means effectively implementations of the various "service provider"
+ interfaces in java such as the xml parser implementation used by jaxp,
+ the cryptography providers, the socket implementation class.
+
+ If you find this is necessary, you can do so by setting the <<<childDelegation>>>
+ property to <<true>>:
+
++---+
+<project>
+  [...]
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <childDelegation>true</childDelegation>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  [...]
+</project>
++---+
\ No newline at end of file

Added: maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/examples/forking.apt
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/examples/forking.apt?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/examples/forking.apt (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/examples/forking.apt Sun May 13 18:33:45 2007
@@ -0,0 +1,38 @@
+  ------
+  Forking
+  ------
+  Brett Porter
+  ------
+  July 2006
+  ------
+
+Forking
+
+ If you need to run your tests in a new JVM process you can use the <<<forkMode>>> option to start a new
+ JVM process once for all your tests, or start a new JVM process for each of your tests. You can also set
+ any arbitrary options like <<<-enableassertions>>> or any other JVM options. Here's an example of what
+ this might look like:
+
++---+
+<project>
+  [...]
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <forkMode>pertest</forkMode>
+          <argLine>-enableassertions</argLine>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  [...]
+</project>
++---+
+
+ <<Note:>> You do not need to manually enable assertions if you are using them in your unit tests - Surefire enables
+ them on your test classes automatically under JDK 1.4+.
+
+ The default setting is <<<once>>>. It can also be set to <<<never>>> to run in process for a small performance improvement.
\ No newline at end of file

Added: maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/examples/inclusion-exclusion.apt
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/examples/inclusion-exclusion.apt?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/examples/inclusion-exclusion.apt (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/examples/inclusion-exclusion.apt Sun May 13 18:33:45 2007
@@ -0,0 +1,76 @@
+  ------
+  Inclusions and Exclusions of Tests
+  ------
+  Allan Ramirez
+  ------
+  July 2006
+  ------
+
+Inclusions and Exclusions of Tests
+
+* Inclusions
+
+  By default, the surefire plugin will automatically include all test classes
+  with the following wildcard patterns:
+
+   * <"**/Test*.java"> - includes all of its subdirectory and all java
+   filenames that start with "Test".
+
+   * <"**/*Test.java"> - includes all of its subdirectory and all java
+   filenames that end with "Test".
+
+   * <"**/*TestCase.java"> - includes all of its subdirectory and all java
+   filenames that end with "TestCase".
+
+   []
+
+  If the test classes does not go with the naming convention, then configure
+  surefire plugin and specify the tests you want to include.
+
++---+
+<project>
+  [...]
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <includes>
+            <include>Sample.java</include>
+          </includes>
+        </configuration>
+      </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-surefire-plugin</artifactId>
+        <configuration>
+          <excludes>
+            <exclude>**/TestCircle.java</exclude>
+            <exclude>**/TestSquare.java</exclude>
+          </excludes>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  [...]
+</project>
++---+
\ No newline at end of file

Added: maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/examples/single-test.apt
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/examples/single-test.apt?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/examples/single-test.apt (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/examples/single-test.apt Sun May 13 18:33:45 2007
@@ -0,0 +1,19 @@
+  ------
+  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 <<<test>>> property to a specific test case.
+
++---+
+mvn -Dtest=TestCircle test
++---+
+
+  The value for the <<<test>>> parameter is the name of the test class(without
+  the extension).
\ No newline at end of file

Added: maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/examples/skipping-test.apt
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/examples/skipping-test.apt?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/examples/skipping-test.apt (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/examples/skipping-test.apt Sun May 13 18:33:45 2007
@@ -0,0 +1,39 @@
+  ------
+  Skipping Test
+  ------
+  Johnny Ruiz
+  Brett Porter
+  Allan Ramirez
+  ------
+  July 2006
+  ------
+
+Skipping Tests
+
+ To skip running the tests for a particular project, set the <<skip>>
+ property to <<true>>.
+
++---+
+<project>
+  [...]
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  [...]
+</project>
++---+
+
+ You can also skip the tests via command line by executing the following command:
+
++---+
+mvn install -Dmaven.test.skip=true
++---+
+

Added: maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/examples/system-properties.apt
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/examples/system-properties.apt?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/examples/system-properties.apt (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/examples/system-properties.apt Sun May 13 18:33:45 2007
@@ -0,0 +1,65 @@
+  ------
+  Using System Properties
+  ------
+  Allan Ramirez
+  ------
+  July 2006
+  ------
+
+Using System Properties
+
+  To add a System property, use the following configuration:
+
++---+
+<project>
+  [...]
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <systemProperties>
+            <property>
+              <name>propertyName</name>
+              <value>propertyValue</value>
+            </property>
+          </systemProperties>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  [...]
+</project>
++---+
+
+  Take note that <<String valued>> properties can only be passed as system
+  properties. Any attempt to pass any other maven variable type (i.e. List
+  or a URL variable) will cause the variable expression to be passed
+  literally (unevaluated). So having an example below:
+
++---+
+<project>
+  [...]
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <systemProperties>
+            <property>
+              <name>buildDir</name>
+              <value>${project.build.outputDirectory}</value>
+            </property>
+          </systemProperties>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  [...]
+</project>
++---+
+
+  will literally pass <<${project.build.outputDirectory}>> because the value
+  of that expression is a File, not a String.
\ No newline at end of file

Added: maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/examples/testng.apt
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/examples/testng.apt?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/examples/testng.apt (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/examples/testng.apt Sun May 13 18:33:45 2007
@@ -0,0 +1,100 @@
+ ------
+ Using TestNG
+ ------
+ Brett Porter <brett@apache.org>
+ ------
+ 2 May 2006
+ ------
+
+Using TestNG
+
+* Configuring TestNG
+
+  To get started with TestNG, include the following dependency in your project:
+
++---+
+[...]
+  <dependency>
+    <groupId>org.testng</groupId>
+    <artifactId>testng</artifactId>
+    <version>4.7</version>
+    <scope>test</scope>
+    <classifier>jdk15</classifier>
+  </dependency>
+[...]
++---+
+
+  <<Note:>> if you are using JDK 1.4 Javadoc annotations for your TestNG tests, replace jdk15 with jdk14 above.
+
+  This is the only step that is required to get started - you can now create tests in your test source directory
+  (eg, <<<src/test/java>>>, and as long as they are named using the defaults such as *Test.java they will be run
+  by Surefire as TestNG tests.
+
+  If you'd like to use a different naming scheme, you can change the <<<includes>>> parameter, as discussed in the
+  {{{inclusion-exclusion.html}Inclusions and Exclusions of Tests}} example.
+
+* Using Suite XML Files
+
+  Another alternative is to use test NG suite XML files. This allows flexible configuration of the tests to be run.
+  These files are created as normal, and then added to the Surefire plugin configuration:
+
++---+
+[...]
+  <plugin>
+    <groupId>org.apache.maven.plugins</groupId>
+    <artifactId>maven-surefire-plugin</artifactId>
+    <configuration>
+      <suiteXmlFiles>
+        <suiteXmlFile>testng.xml</suiteXmlFile>
+      </suiteXmlFiles>
+    </configuration>
+  </plugin>
+[...]
++---+
+
+  This configuration will override the includes and excludes patterns and run all tests in the suite files.
+
+* Using Groups
+
+  TestNG allows you to group your tests. You can then execute a specific group or groups. To do this with Surefire,
+  use the <<<groups>>> parameter, for example:
+
++---+
+[...]
+  <plugin>
+    <groupId>org.apache.maven.plugins</groupId>
+    <artifactId>maven-surefire-plugin</artifactId>
+    <configuration>
+      <groups>functest,perftest</groups>
+    </configuration>
+  </plugin>
+[...]
++---+
+
+  Likewise, the <<<excludedGroups>>> parameter can be used to run all but a certain set of groups.
+
+* Running tests in parallel
+
+  TestNG allows you to run your tests in parallel, including JUnit tests. To do this, you must enable the
+  <<<parallel>>> parameter, and may change the <<<threadCount>>> parameter if the default of 5 is not sufficient.
+  For example:
+
++---+
+[...]
+  <plugin>
+    <groupId>org.apache.maven.plugins</groupId>
+    <artifactId>maven-surefire-plugin</artifactId>
+    <configuration>
+      <parallel>true</parallel>
+      <threadCount>10</threadCount>
+    </configuration>
+  </plugin>
+[...]
++---+
+
+  This is particularly useful for slow tests that can have high concurrency, or to quickly and roughly assess the independance
+  and thread safety of your tests and code.
+
+  For more information on TestNG, see the project {{{http://www.testng.org} web site}}.
+
+

Added: maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/index.apt?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/index.apt (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/index.apt Sun May 13 18:33:45 2007
@@ -0,0 +1,56 @@
+  ------
+  Introduction
+  ------
+  Allan Ramirez
+  ------
+  July 2006
+  ------
+
+Maven Surefire Plugin
+
+  The surefire plugin is used during the <<<test>>> phase of the build
+  lifecycle to execute the unit tests of an application. It generates reports
+  in 2 different file formats:
+
+  * Plain text files (*.txt)
+
+  * Xml files (*.xml)
+
+  []
+
+  By default, these files are generated at <<<${basedir}/target/surefire-reports>>>.
+
+  For an html format of the report, please see the
+  {{{http://maven.apache.org/plugins/maven-surefire-report-plugin/}maven-surefire-report-plugin}}.
+
+* Goals Overview
+
+  The surefire plugin has only 1 goal:
+
+  * {{{test-mojo.html}surefire:test}} runs the unit tests of an application.
+
+  []
+
+* Usage
+
+  Instructions on how to use the surefire plugin can be found {{{usage.html}here}}.
+
+* Examples
+
+  The following examples show how to use the surefire plugin in more advanced use-cases:
+
+  * {{{examples/skipping-test.html}Skipping Tests}}
+
+  * {{{examples/inclusion-exclusion.html}Inclusions and Exclusions of Tests}}
+
+  * {{{examples/single-test.html}Running a Single Test}}
+
+  * {{{examples/class-loading.html}Class Loading Issues}}
+
+  * {{{examples/forking.html}Forking}}
+
+  * {{{examples/system-properties.html}Using System Properties}}
+
+  * {{{examples/testng.html}Using TestNG}}
+
+  []

Added: maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/introduction.apt
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/introduction.apt?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/introduction.apt (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/introduction.apt Sun May 13 18:33:45 2007
@@ -0,0 +1,16 @@
+ ------
+ Maven 2 Surefire Plugin 
+ ------
+ Johnny R. Ruiz III
+ <jruiz@exist.com>
+ ------
+ September 19, 2005
+
+Introduction
+
+ This plugin runs the junit tests in an isolated classloader.  By default, this plugin will be executed in 
+ "test" phase of m2 lifecycle.  
+
+ This plugin generates 2 types of report, Text File Report and XML File Report. Both files will be generated in the
+ <<<${basedir}/target/surefire-report>>>.  For an HTML version of the report, please see the Maven Surefire Report Plugin. 
+

Added: maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/testng.apt
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/testng.apt?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/testng.apt (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/testng.apt Sun May 13 18:33:45 2007
@@ -0,0 +1,100 @@
+ ------
+ Using TestNG
+ ------
+ Brett Porter <brett@apache.org>
+ ------
+ 2 May 2006
+ ------
+
+Using TestNG
+
+* Configuring TestNG
+
+  To get started with TestNG, include the following dependency in your project:
+
+-----
+...
+  <dependency>
+    <groupId>org.testng</groupId>
+    <artifactId>testng</artifactId>
+    <version>4.7</version>
+    <scope>test</scope>
+    <classifier>jdk15</classifier>
+  </dependency>
+...
+-----
+
+  <<Note:>> if you are using JDK 1.4 Javadoc annotations for your TestNG tests, replace jdk15 with jdk14 above.
+
+  This is the only step that is required to get started - you can now create tests in your test source directory
+  (eg, <<<src/test/java>>>, and as long as they are named using the defaults such as *Test.java they will be run
+  by Surefire as TestNG tests.
+
+  If you'd like to use a different naming scheme, you can change the <<<includes>>> parameter, as discussed in the
+  {{{howto.html} How to Use}} page.
+
+* Using Suite XML Files
+
+  Another alternative is to use test NG suite XML files. This allows flexbile configuration of the tests to be run.
+  These files are created as normal, and then added to the Surefire plugin configuration:
+
+-----
+...
+  <plugin>
+    <groupId>org.apache.maven.plugins</groupId>
+    <artifactId>maven-surefire-plugin</artifactId>
+    <configuration>
+      <suiteXmlFiles>
+        <suiteXmlFile>testng.xml</suiteXmlFile>
+      </suiteXmlFiles>
+    </configuration>
+  </plugin>
+...
+-----
+
+  This configuration will override the includes and excludes patterns and run all tests in the suite files.
+
+* Using Groups
+
+  TestNG allows you to group your tests. You can then execute a specific group or groups. To do this with Surefire,
+  use the <<<groups>>> parameter, for example:
+
+-----
+...
+  <plugin>
+    <groupId>org.apache.maven.plugins</groupId>
+    <artifactId>maven-surefire-plugin</artifactId>
+    <configuration>
+      <groups>functest,perftest</groups>
+    </configuration>
+  </plugin>
+...
+-----
+
+  Likewise, the <<<excludedGroups>>> parameter can be used to run all but a certain set of groups.
+
+* Running tests in parallel
+
+  TestNG allows you to run your tests in parallel, including JUnit tests. To do this, you must enable the
+  <<<parallel>>> parameter, and may change the <<<threadCount>>> parameter if the default of 5 is not sufficient.
+  For example:
+
+-----
+...
+  <plugin>
+    <groupId>org.apache.maven.plugins</groupId>
+    <artifactId>maven-surefire-plugin</artifactId>
+    <configuration>
+      <parallel>true</parallel>
+      <threadCount>10</threadCount>
+    </configuration>
+  </plugin>
+...
+-----
+
+  This is particularly useful for slow tests that can have high concurrency, or to quickly and roughly assess the independance
+  and thread safety of your tests and code.
+
+  For more information on TestNG, see the project {{{http://www.testng.org} web site}}.
+
+

Added: maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/usage.apt
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/usage.apt?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/usage.apt (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/apt/usage.apt Sun May 13 18:33:45 2007
@@ -0,0 +1,51 @@
+  ------
+  Usage
+  ------
+  Brett Porter
+  Allan Ramirez
+  ------
+  July 2006
+  ------
+
+Usage
+
+  The surefire plugin can be invoked by calling the <<<test>>> phase of the
+  build lifecycle.
+
++---+
+mvn test
++---+
+
+* Using different testing providers
+
+  Tests in your test source directory can be any combination of the following:
+
+   * TestNG
+
+   * JUnit
+
+   * POJO
+
+  Which providers are available is controlled simply by the inclusion of the
+  appropriate dependencies (ie, junit:junit for JUnit, org.testng:testng 4.7+
+  for TestNG). Since this is required to compile the test classes anyway, no
+  additional configuration is required.
+
+  Note that any normal Surefire integration works identically no matter which
+  providers are in use - so you can still produce a Cobertura report and a
+  Surefire results report on your project web site for your TestNG tests,
+  for example.
+
+  The POJO provider above allows you to write tests that do not depend on
+  JUnit. They behave in the same way, running all <<<test*>>> methods that are
+  public in the class, but the API dependency is not required. To perform
+  assertions, the JDK 1.4 <<<assert>>> keyword can be used, or you can use
+  <<<org.apache.maven.surefire.assertion.Assert>>>.
+
+  All of the providers support the surefire plugin parameter configurations.
+  However, there are additional options available if you are running TestNG
+  tests (including if you are using TestNG to execute your JUnit tests, which
+  occurs by default if both are present in Surefire).
+
+  See {{{examples/testng.html} Using TestNG}} for more information.
+

Added: maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/fml/faq.fml
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/fml/faq.fml?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/fml/faq.fml (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/fml/faq.fml Sun May 13 18:33:45 2007
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+  ~ 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.
+  -->
+
+<faqs id="FAQ" title="Frequently Asked Questions">
+  <part id="General">
+    <faq id="reuse-test-code">
+      <question>How can I reuse my test code in other modules?</question>
+      <answer>
+        <p>
+          Visit this link for your reference,
+          <a href="http://maven.apache.org/guides/mini/guide-attached-tests.html">
+            Attaching tests
+          </a>
+        </p>
+      </answer>
+    </faq>
+  </part>
+</faqs>

Added: maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/site.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/site.xml?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/site.xml (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-plugin/src/site/site.xml Sun May 13 18:33:45 2007
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!--
+  ~ 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.
+  -->
+
+<project>
+  <body>
+    <menu name="Overview">
+      <item name="Introduction" href="index.html"/>
+      <item name="Goals" href="plugin-info.html"/>
+      <item name="Usage" href="usage.html"/>
+      <item name="FAQ" href="faq.html"/>
+    </menu>
+    <menu name="Examples">
+      <item name="Skipping Tests" href="examples/skipping-test.html"/>
+      <item name="Inclusions and Exclusions of Tests" href="examples/inclusion-exclusion.html"/>
+      <item name="Running a Single Test" href="examples/single-test.html"/>
+      <item name="Class Loading Issues" href="examples/class-loading.html"/>
+      <item name="Forking" href="examples/forking.html"/>
+      <item name="Using System Properties" href="examples/system-properties.html"/>
+      <item name="Using TestNG" href="examples/testng.html"/>
+    </menu>
+  </body>
+</project>

Added: maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-report-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-report-plugin/pom.xml?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-report-plugin/pom.xml (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-report-plugin/pom.xml Sun May 13 18:33:45 2007
@@ -0,0 +1,126 @@
+<?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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <artifactId>surefire</artifactId>
+    <groupId>org.apache.maven.surefire</groupId>
+    <version>2.4-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>maven-surefire-report-plugin</artifactId>
+  <groupId>org.apache.maven.plugins</groupId>
+  <packaging>maven-plugin</packaging>
+  <name>Maven Surefire Report Plugin</name>
+  <prerequisites>
+    <maven>2.0.3</maven>
+  </prerequisites>
+  <developers>
+    <developer>
+      <id>jruiz</id>
+      <name>Johnny Ruiz III</name>
+      <email>jruiz@exist.com</email>
+    </developer>
+  </developers>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.reporting</groupId>
+      <artifactId>maven-reporting-api</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.reporting</groupId>
+      <artifactId>maven-reporting-impl</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.shared</groupId>
+      <artifactId>maven-plugin-testing-harness</artifactId>
+      <scope>test</scope>
+      <version>1.0-beta-1</version>
+    </dependency>
+  </dependencies>
+
+  <profiles>
+    <!-- Force JDK 1.4 for this one, plugins can never be built on 1.3 -->
+    <profile>
+      <id>jdk1.3</id>
+      <build>
+        <pluginManagement>
+          <plugins>
+            <plugin>
+              <artifactId>maven-compiler-plugin</artifactId>
+              <configuration>
+                <fork>false</fork>
+                <compilerVersion>1.4</compilerVersion>
+              </configuration>
+            </plugin>
+            <plugin>
+              <artifactId>maven-surefire-plugin</artifactId>
+              <configuration>
+                <forkMode>once</forkMode>
+                <childDelegation>true</childDelegation>
+                <jvm>${java.home}/bin/java</jvm>
+              </configuration>
+            </plugin>
+          </plugins>
+        </pluginManagement>
+      </build>
+    </profile>
+    <profile>
+      <id>ci</id>
+      <activation>
+        <property>
+          <name>enableCiProfile</name>
+          <value>true</value>
+        </property>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <artifactId>maven-docck-plugin</artifactId>
+            <version>1.0-beta-1</version>
+            <executions>
+              <execution>
+                <goals>
+                  <goal>check</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+  <distributionManagement>
+    <site>
+      <id>apache.website</id>
+      <url>scp://people.apache.org/www/maven.apache.org/plugins/maven-surefire-report-plugin</url>
+    </site>
+  </distributionManagement>
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-plugin-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </reporting>
+</project>

Added: maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/ReportTestCase.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/ReportTestCase.java?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/ReportTestCase.java (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/ReportTestCase.java Sun May 13 18:33:45 2007
@@ -0,0 +1,100 @@
+package org.apache.maven.plugins.surefire.report;
+
+/*
+ * 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.util.HashMap;
+import java.util.Map;
+
+public class ReportTestCase
+{
+    private String fullClassName;
+
+    private String className;
+
+    private String fullName;
+
+    private String name;
+
+    private float time;
+
+    private Map failure;
+
+    public String getName()
+    {
+        return name;
+    }
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    public String getFullClassName()
+    {
+        return fullClassName;
+    }
+
+    public void setFullClassName( String name )
+    {
+        this.fullClassName = name;
+    }
+
+    public String getClassName()
+    {
+        return className;
+    }
+
+    public void setClassName( String name )
+    {
+        this.className = name;
+    }
+
+    public float getTime()
+    {
+        return time;
+    }
+
+    public void setTime( float time )
+    {
+        this.time = time;
+    }
+
+    public Map getFailure()
+    {
+        return failure;
+    }
+
+    public String getFullName()
+    {
+        return fullName;
+    }
+
+    public void setFullName( String fullName )
+    {
+        this.fullName = fullName;
+    }
+
+    public void addFailure( String message, String type )
+    {
+        failure = new HashMap();
+        failure.put( "message", message );
+        failure.put( "type", type );
+    }
+}

Added: maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/ReportTestSuite.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/ReportTestSuite.java?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/ReportTestSuite.java (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/ReportTestSuite.java Sun May 13 18:33:45 2007
@@ -0,0 +1,322 @@
+package org.apache.maven.plugins.surefire.report;
+
+/*
+ * 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 org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import java.io.File;
+import java.io.IOException;
+import java.text.NumberFormat;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+public class ReportTestSuite
+    extends DefaultHandler
+{
+    private List testCases;
+
+    private int numberOfErrors;
+
+    private int numberOfFailures;
+
+    private int numberOfSkipped;
+
+    private int numberOfTests;
+
+    private String name;
+
+    private String fullClassName;
+
+    private String packageName;
+
+    private float timeElapsed;
+
+    private NumberFormat numberFormat = NumberFormat.getInstance();
+
+    /**
+     * @noinspection StringBufferField
+     */
+    private StringBuffer currentElement;
+
+    private ReportTestCase testCase;
+
+    public void parse( String xmlPath )
+        throws ParserConfigurationException, SAXException, IOException
+    {
+        SAXParserFactory factory = SAXParserFactory.newInstance();
+
+        SAXParser saxParser = factory.newSAXParser();
+
+        saxParser.parse( new File( xmlPath ), this );
+    }
+
+
+    private int getAttributeAsInt( Attributes attributes, String name )
+    {
+        // may or may not exist
+        String valueAsString = attributes.getValue( name );
+        if ( valueAsString != null )
+        {
+            return Integer.parseInt( valueAsString );
+        }
+        return 0;
+    }
+
+    public void startElement( String uri, String localName, String qName, Attributes attributes )
+        throws SAXException
+    {
+        try
+        {
+            if ( "testsuite".equals( qName ) )
+            {
+                numberOfErrors = getAttributeAsInt( attributes, "errors" );
+                numberOfFailures = getAttributeAsInt( attributes, "failures" );
+                numberOfSkipped = getAttributeAsInt( attributes, "skipped" );
+                numberOfTests = getAttributeAsInt( attributes, "tests" );
+
+                Number time = numberFormat.parse( attributes.getValue( "time" ) );
+
+                timeElapsed = time.floatValue();
+
+                //check if group attribute is existing
+                if ( attributes.getValue( "group" ) != null && !"".equals( attributes.getValue( "group" ) ) )
+                {
+                    packageName = attributes.getValue( "group" );
+
+                    name = attributes.getValue( "name" );
+
+                    fullClassName = packageName + "." + name;
+                }
+                else
+                {
+                    fullClassName = attributes.getValue( "name" );
+
+                    name = fullClassName.substring( fullClassName.lastIndexOf( "." ) + 1, fullClassName.length() );
+
+                    int lastDotPosition = fullClassName.lastIndexOf( "." );
+                    if ( lastDotPosition < 0 )
+                    {
+                        /* no package name */
+                        packageName = "";
+                    }
+                    else
+                    {
+                        packageName = fullClassName.substring( 0, lastDotPosition );
+                    }
+                }
+
+                testCases = new ArrayList();
+            }
+            else if ( "testcase".equals( qName ) )
+            {
+                currentElement = new StringBuffer();
+
+                testCase = new ReportTestCase();
+
+                testCase.setFullClassName( fullClassName );
+
+                testCase.setName( attributes.getValue( "name" ) );
+
+                testCase.setClassName( name );
+
+                String timeAsString = attributes.getValue( "time" );
+
+                Number time = new Integer( 0 );
+
+                if ( timeAsString != null )
+                {
+                    time = numberFormat.parse( timeAsString );
+                }
+
+                testCase.setTime( time.floatValue() );
+
+                testCase.setFullName( packageName + "." + name + "." + testCase.getName() );
+            }
+            else if ( "failure".equals( qName ) )
+            {
+                testCase.addFailure( attributes.getValue( "message" ), attributes.getValue( "type" ) );
+            }
+            else if ( "error".equals( qName ) )
+            {
+                testCase.addFailure( attributes.getValue( "message" ), attributes.getValue( "type" ) );
+            }
+        }
+        catch ( ParseException e )
+        {
+            throw new SAXException( e.getMessage(), e );
+        }
+    }
+
+    public void endElement( String uri, String localName, String qName )
+        throws SAXException
+    {
+        if ( "testcase".equals( qName ) )
+        {
+            testCases.add( testCase );
+        }
+        else if ( "failure".equals( qName ) )
+        {
+            Map failure = testCase.getFailure();
+
+            failure.put( "detail", parseCause( currentElement.toString() ) );
+        }
+        else if ( "error".equals( qName ) )
+        {
+            Map error = testCase.getFailure();
+
+            error.put( "detail", parseCause( currentElement.toString() ) );
+        }
+    }
+
+    public void characters( char[] ch, int start, int length )
+        throws SAXException
+    {
+        String s = new String( ch, start, length );
+
+        if ( !"".equals( s.trim() ) )
+        {
+            currentElement.append( s );
+        }
+    }
+
+    public List getTestCases()
+    {
+        return this.testCases;
+    }
+
+    public int getNumberOfErrors()
+    {
+        return numberOfErrors;
+    }
+
+    public void setNumberOfErrors( int numberOfErrors )
+    {
+        this.numberOfErrors = numberOfErrors;
+    }
+
+    public int getNumberOfFailures()
+    {
+        return numberOfFailures;
+    }
+
+    public void setNumberOfFailures( int numberOfFailures )
+    {
+        this.numberOfFailures = numberOfFailures;
+    }
+
+    public int getNumberOfSkipped()
+    {
+        return numberOfSkipped;
+    }
+
+    public void setNumberOfSkipped( int numberOfSkipped )
+    {
+        this.numberOfSkipped = numberOfSkipped;
+    }
+
+    public int getNumberOfTests()
+    {
+        return numberOfTests;
+    }
+
+    public void setNumberOfTests( int numberOfTests )
+    {
+        this.numberOfTests = numberOfTests;
+    }
+
+    public String getName()
+    {
+        return name;
+    }
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    public String getFName()
+    {
+        return name;
+    }
+
+    public void setFName( String name )
+    {
+        this.name = name;
+    }
+
+    public String getPackageName()
+    {
+        return packageName;
+    }
+
+    public void setPackageName( String packageName )
+    {
+        this.packageName = packageName;
+    }
+
+    public float getTimeElapsed()
+    {
+        return this.timeElapsed;
+    }
+
+    public void setTimeElapsed( float timeElapsed )
+    {
+        this.timeElapsed = timeElapsed;
+    }
+
+    private List parseCause( String detail )
+    {
+        String fullName = testCase.getFullName();
+        String name = fullName.substring( fullName.lastIndexOf( "." ) + 1 );
+        return parseCause( detail, name );
+    }
+
+    private List parseCause( String detail, String compareTo )
+    {
+        StringTokenizer stringTokenizer = new StringTokenizer( detail, "\n" );
+        List parsedDetail = new ArrayList( stringTokenizer.countTokens() );
+
+        while ( stringTokenizer.hasMoreTokens() )
+        {
+            String lineString = stringTokenizer.nextToken().trim();
+            parsedDetail.add( lineString );
+            if ( lineString.indexOf( compareTo ) >= 0 )
+            {
+                break;
+            }
+        }
+
+        return parsedDetail;
+    }
+
+    public void setTestCases( List testCases )
+    {
+        this.testCases = Collections.unmodifiableList( testCases );
+    }
+}



Mime
View raw message