maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krosenv...@apache.org
Subject svn commit: r1056827 - in /maven/surefire/trunk/surefire-providers: ./ common-junit3/ common-junit3/src/ common-junit3/src/main/ common-junit3/src/main/java/ common-junit3/src/main/java/org/ common-junit3/src/main/java/org/apache/ common-junit3/src/mai...
Date Sat, 08 Jan 2011 22:44:26 GMT
Author: krosenvold
Date: Sat Jan  8 22:44:23 2011
New Revision: 1056827

URL: http://svn.apache.org/viewvc?rev=1056827&view=rev
Log:
o Extracted 2 common code modules to reduce code duplication

Added:
    maven/surefire/trunk/surefire-providers/common-junit3/
    maven/surefire/trunk/surefire-providers/common-junit3/pom.xml
      - copied, changed from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit/pom.xml
    maven/surefire/trunk/surefire-providers/common-junit3/src/
    maven/surefire/trunk/surefire-providers/common-junit3/src/main/
    maven/surefire/trunk/surefire-providers/common-junit3/src/main/java/
    maven/surefire/trunk/surefire-providers/common-junit3/src/main/java/org/
    maven/surefire/trunk/surefire-providers/common-junit3/src/main/java/org/apache/
    maven/surefire/trunk/surefire-providers/common-junit3/src/main/java/org/apache/maven/
    maven/surefire/trunk/surefire-providers/common-junit3/src/main/java/org/apache/maven/surefire/
    maven/surefire/trunk/surefire-providers/common-junit3/src/main/java/org/apache/maven/surefire/common/
    maven/surefire/trunk/surefire-providers/common-junit3/src/main/java/org/apache/maven/surefire/common/junit3/
    maven/surefire/trunk/surefire-providers/common-junit3/src/main/java/org/apache/maven/surefire/common/junit3/JUnit3Reflector.java   (contents, props changed)
      - copied, changed from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnit3Reflector.java
    maven/surefire/trunk/surefire-providers/common-junit3/src/main/java/org/apache/maven/surefire/common/junit3/JUnit3TestChecker.java   (contents, props changed)
      - copied, changed from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnit3TestChecker.java
    maven/surefire/trunk/surefire-providers/common-junit3/src/test/
    maven/surefire/trunk/surefire-providers/common-junit3/src/test/java/
    maven/surefire/trunk/surefire-providers/common-junit3/src/test/java/org/
    maven/surefire/trunk/surefire-providers/common-junit3/src/test/java/org/apache/
    maven/surefire/trunk/surefire-providers/common-junit3/src/test/java/org/apache/maven/
    maven/surefire/trunk/surefire-providers/common-junit3/src/test/java/org/apache/maven/surefire/
    maven/surefire/trunk/surefire-providers/common-junit3/src/test/java/org/apache/maven/surefire/common/
    maven/surefire/trunk/surefire-providers/common-junit3/src/test/java/org/apache/maven/surefire/common/junit3/
    maven/surefire/trunk/surefire-providers/common-junit3/src/test/java/org/apache/maven/surefire/common/junit3/JUnit3TestCheckerTest.java   (with props)
    maven/surefire/trunk/surefire-providers/common-junit4/
    maven/surefire/trunk/surefire-providers/common-junit4/pom.xml
      - copied, changed from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit4/pom.xml
    maven/surefire/trunk/surefire-providers/common-junit4/src/
    maven/surefire/trunk/surefire-providers/common-junit4/src/main/
    maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/
    maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/
    maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/
    maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/
    maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/
    maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/
    maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/
    maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4StackTraceWriter.java   (contents, props changed)
      - copied, changed from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4StackTraceWriter.java
    maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4TestChecker.java   (contents, props changed)
      - copied, changed from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestChecker.java
    maven/surefire/trunk/surefire-providers/common-junit4/src/test/
    maven/surefire/trunk/surefire-providers/common-junit4/src/test/java/
    maven/surefire/trunk/surefire-providers/common-junit4/src/test/java/org/
    maven/surefire/trunk/surefire-providers/common-junit4/src/test/java/org/apache/
    maven/surefire/trunk/surefire-providers/common-junit4/src/test/java/org/apache/maven/
    maven/surefire/trunk/surefire-providers/common-junit4/src/test/java/org/apache/maven/surefire/
    maven/surefire/trunk/surefire-providers/common-junit4/src/test/java/org/apache/maven/surefire/junit4/
    maven/surefire/trunk/surefire-providers/common-junit4/src/test/java/org/apache/maven/surefire/junit4/JUnit4TestCheckerTest.java   (contents, props changed)
      - copied, changed from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit4/src/test/java/org/apache/maven/surefire/junit4/JUnit4TestCheckerTest.java
    maven/surefire/trunk/surefire-providers/surefire-junit3/
    maven/surefire/trunk/surefire-providers/surefire-junit3/pom.xml   (contents, props changed)
      - copied, changed from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit/pom.xml
    maven/surefire/trunk/surefire-providers/surefire-junit3/src/
    maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/
    maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/
    maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/
    maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/
    maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/
    maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/
    maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/
    maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java   (contents, props changed)
      - copied, changed from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java
    maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnitStackTraceWriter.java   (contents, props changed)
      - copied, changed from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnitStackTraceWriter.java
    maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnitTestSet.java   (contents, props changed)
      - copied, changed from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnitTestSet.java
    maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoAndJUnit3Checker.java   (with props)
    maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java   (contents, props changed)
      - copied, changed from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java
    maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/SurefireTestSet.java   (contents, props changed)
      - copied, changed from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/SurefireTestSet.java
    maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/TestListenerInvocationHandler.java   (contents, props changed)
      - copied, changed from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/TestListenerInvocationHandler.java
    maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/resources/
    maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/resources/META-INF/
    maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/resources/META-INF/services/
    maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/resources/META-INF/services/org.apache.maven.surefire.providerapi.SurefireProvider
      - copied, changed from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit/src/main/resources/META-INF/services/org.apache.maven.surefire.providerapi.SurefireProvider
Removed:
    maven/surefire/trunk/surefire-providers/surefire-junit/pom.xml
    maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java
    maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnit3Reflector.java
    maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnit3TestChecker.java
    maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnitStackTraceWriter.java
    maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnitTestSet.java
    maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java
    maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/SurefireTestSet.java
    maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/TestListenerInvocationHandler.java
    maven/surefire/trunk/surefire-providers/surefire-junit/src/main/resources/META-INF/services/org.apache.maven.surefire.providerapi.SurefireProvider
    maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4StackTraceWriter.java
    maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestChecker.java
    maven/surefire/trunk/surefire-providers/surefire-junit4/src/test/java/org/apache/maven/surefire/junit4/JUnit4TestCheckerTest.java
    maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreStackTraceWriter.java
Modified:
    maven/surefire/trunk/surefire-providers/pom.xml
    maven/surefire/trunk/surefire-providers/surefire-junit4/pom.xml
    maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
    maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSetReporter.java
    maven/surefire/trunk/surefire-providers/surefire-junit47/pom.xml
    maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/TestMethod.java

Copied: maven/surefire/trunk/surefire-providers/common-junit3/pom.xml (from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit/pom.xml)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/common-junit3/pom.xml?p2=maven/surefire/trunk/surefire-providers/common-junit3/pom.xml&p1=maven/surefire/trunk/surefire-providers/surefire-junit/pom.xml&r1=1056680&r2=1056827&rev=1056827&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit/pom.xml (original)
+++ maven/surefire/trunk/surefire-providers/common-junit3/pom.xml Sat Jan  8 22:44:23 2011
@@ -17,7 +17,8 @@
   ~ 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/xsd/maven-4.0.0.xsd">
+<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/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
@@ -27,19 +28,9 @@
     <relativePath>../pom.xml</relativePath>
   </parent>
 
-  <artifactId>surefire-junit3</artifactId>
+  <artifactId>common-junit3</artifactId>
+  <name>Shared JUnit3 provider code</name>
 
-  <name>SureFire JUnit Runner</name>
-
-    <build>
-    <resources>
-      <resource>
-        <directory>src/main/resources/META-INF</directory>
-        <targetPath>META-INF</targetPath>
-      </resource>
-    </resources>
-
-    </build>
   <dependencies>
     <dependency>
       <groupId>junit</groupId>
@@ -48,4 +39,15 @@
       <scope>provided</scope>
     </dependency>
   </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-deploy-plugin</artifactId>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
 </project>

Copied: maven/surefire/trunk/surefire-providers/common-junit3/src/main/java/org/apache/maven/surefire/common/junit3/JUnit3Reflector.java (from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnit3Reflector.java)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/common-junit3/src/main/java/org/apache/maven/surefire/common/junit3/JUnit3Reflector.java?p2=maven/surefire/trunk/surefire-providers/common-junit3/src/main/java/org/apache/maven/surefire/common/junit3/JUnit3Reflector.java&p1=maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnit3Reflector.java&r1=1056680&r2=1056827&rev=1056827&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnit3Reflector.java (original)
+++ maven/surefire/trunk/surefire-providers/common-junit3/src/main/java/org/apache/maven/surefire/common/junit3/JUnit3Reflector.java Sat Jan  8 22:44:23 2011
@@ -1,4 +1,4 @@
-package org.apache.maven.surefire.junit;
+package org.apache.maven.surefire.common.junit3;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -115,7 +115,7 @@ public final class JUnit3Reflector
     }
 
 
-    Object constructTestObject( Class testClass )
+    public Object constructTestObject( Class testClass )
         throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, InstantiationException,
         ClassNotFoundException
     {

Propchange: maven/surefire/trunk/surefire-providers/common-junit3/src/main/java/org/apache/maven/surefire/common/junit3/JUnit3Reflector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: maven/surefire/trunk/surefire-providers/common-junit3/src/main/java/org/apache/maven/surefire/common/junit3/JUnit3TestChecker.java (from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnit3TestChecker.java)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/common-junit3/src/main/java/org/apache/maven/surefire/common/junit3/JUnit3TestChecker.java?p2=maven/surefire/trunk/surefire-providers/common-junit3/src/main/java/org/apache/maven/surefire/common/junit3/JUnit3TestChecker.java&p1=maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnit3TestChecker.java&r1=1056680&r2=1056827&rev=1056827&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnit3TestChecker.java (original)
+++ maven/surefire/trunk/surefire-providers/common-junit3/src/main/java/org/apache/maven/surefire/common/junit3/JUnit3TestChecker.java Sat Jan  8 22:44:23 2011
@@ -1,4 +1,4 @@
-package org.apache.maven.surefire.junit;
+package org.apache.maven.surefire.common.junit3;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -55,9 +55,9 @@ public class JUnit3TestChecker
         return nonAbstractClassFilter.accept( testClass ) && isValidJUnit3Test( testClass );
     }
 
-    public boolean isValidJUnit3Test( Class testClass )
+    private boolean isValidJUnit3Test( Class testClass )
     {
-        return isJunit3Test( testClass ) || isPojoTest( testClass );
+        return junitClass != null && ( junitClass.isAssignableFrom( testClass ) || isSuiteOnly( testClass ) );
     }
 
     public boolean isSuiteOnly( Class testClass )
@@ -75,21 +75,4 @@ public class JUnit3TestChecker
         return false;
     }
 
-    public boolean isJunit3Test( Class testClass )
-    {
-        return junitClass != null && ( junitClass.isAssignableFrom( testClass ) || isSuiteOnly( testClass ) );
-    }
-
-    private boolean isPojoTest( Class testClass )
-    {
-        try
-        {
-            testClass.getConstructor( new Class[0] );
-            return true;
-        }
-        catch ( Exception e )
-        {
-            return false;
-        }
-    }
 }

Propchange: maven/surefire/trunk/surefire-providers/common-junit3/src/main/java/org/apache/maven/surefire/common/junit3/JUnit3TestChecker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/surefire/trunk/surefire-providers/common-junit3/src/test/java/org/apache/maven/surefire/common/junit3/JUnit3TestCheckerTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/common-junit3/src/test/java/org/apache/maven/surefire/common/junit3/JUnit3TestCheckerTest.java?rev=1056827&view=auto
==============================================================================
--- maven/surefire/trunk/surefire-providers/common-junit3/src/test/java/org/apache/maven/surefire/common/junit3/JUnit3TestCheckerTest.java (added)
+++ maven/surefire/trunk/surefire-providers/common-junit3/src/test/java/org/apache/maven/surefire/common/junit3/JUnit3TestCheckerTest.java Sat Jan  8 22:44:23 2011
@@ -0,0 +1,125 @@
+package org.apache.maven.surefire.common.junit3;
+
+import junit.framework.TestCase;
+import junit.framework.TestResult;
+import org.apache.maven.surefire.testset.TestSetFailedException;
+
+/**
+ * @author Kristian Rosenvold
+ */
+public class JUnit3TestCheckerTest
+    extends TestCase {
+    JUnit3TestChecker jUnit3TestChecker = new JUnit3TestChecker( this.getClass().getClassLoader() );
+
+    public void testValidJunit4Annotated()
+        throws TestSetFailedException
+    {
+        assertTrue( jUnit3TestChecker.accept( JUnit3TestCheckerTest.class ) );
+    }
+
+    public void testValidJunit4itsAJunit3Test()
+        throws TestSetFailedException
+    {
+        assertTrue( jUnit3TestChecker.accept( AlsoValid.class ) );
+    }
+
+    public void testValidJunitSubclassWithoutOwnTestmethods()
+        throws TestSetFailedException
+    {
+        assertTrue( jUnit3TestChecker.accept( SubClassWithoutOwnTestMethods.class ) );
+    }
+
+    public void testInvalidTest()
+        throws TestSetFailedException
+    {
+        assertFalse( jUnit3TestChecker.accept( NotValidTest.class ) );
+    }
+
+    public void testDontAcceptAbstractClasses()
+    {
+        assertFalse( jUnit3TestChecker.accept( BaseClassWithTest.class ) );
+    }
+
+    public void testSuiteOnlyTest()
+    {
+        assertTrue( jUnit3TestChecker.accept( SuiteOnlyTest.class ) );
+    }
+
+    public void testCustomSuiteOnlyTest()
+    {
+        assertTrue( jUnit3TestChecker.accept( CustomSuiteOnlyTest.class ) );
+    }
+
+    public void testIinnerClassNotAutomaticallyTc(){
+        assertTrue( jUnit3TestChecker.accept( NestedTC.class));
+        assertFalse( jUnit3TestChecker.accept( NestedTC.Inner.class));
+    }
+
+
+    public static class AlsoValid
+        extends TestCase
+    {
+        public void testSomething()
+        {
+
+        }
+    }
+
+    public static class SuiteOnlyTest
+    {
+        public static junit.framework.Test suite()
+        {
+            return null;
+        }
+    }
+
+    public static class CustomSuiteOnlyTest
+    {
+        public static MySuite2 suite()
+        {
+            return null;
+        }
+    }
+
+    public static class MySuite2
+        implements junit.framework.Test
+    {
+        public int countTestCases()
+        {
+            return 0;
+        }
+
+        public void run( TestResult testResult )
+        {
+        }
+    }
+
+
+    public static class NotValidTest
+    {
+        /** @noinspection UnusedDeclaration*/
+        public void testSomething()
+        {
+        }
+    }
+
+    public abstract static class BaseClassWithTest extends TestCase
+    {
+        /** @noinspection UnusedDeclaration*/
+        public void testWeAreAlsoATest()
+        {
+        }
+    }
+
+    public static class SubClassWithoutOwnTestMethods
+        extends BaseClassWithTest
+    {
+    }
+
+    class NestedTC extends TestCase {
+        public class Inner {
+
+        }
+    }
+
+}

Propchange: maven/surefire/trunk/surefire-providers/common-junit3/src/test/java/org/apache/maven/surefire/common/junit3/JUnit3TestCheckerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: maven/surefire/trunk/surefire-providers/common-junit4/pom.xml (from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit4/pom.xml)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/common-junit4/pom.xml?p2=maven/surefire/trunk/surefire-providers/common-junit4/pom.xml&p1=maven/surefire/trunk/surefire-providers/surefire-junit4/pom.xml&r1=1056680&r2=1056827&rev=1056827&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit4/pom.xml (original)
+++ maven/surefire/trunk/surefire-providers/common-junit4/pom.xml Sat Jan  8 22:44:23 2011
@@ -17,7 +17,8 @@
   ~ 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/xsd/maven-4.0.0.xsd">
+<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/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
@@ -27,9 +28,9 @@
     <relativePath>../pom.xml</relativePath>
   </parent>
 
-  <artifactId>surefire-junit4</artifactId>
+  <artifactId>common-junit4</artifactId>
 
-  <name>SureFire JUnit4 Runner</name>
+  <name>Shared Junit4 Provider Code</name>
 
   <dependencies>
     <dependency>
@@ -38,16 +39,14 @@
       <version>4.0</version>
       <scope>provided</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.maven.surefire</groupId>
+      <artifactId>common-junit3</artifactId>
+      <version>${project.version}</version>
+    </dependency>
   </dependencies>
 
   <build>
-    <resources>
-      <resource>
-        <directory>src/main/resources/META-INF</directory>
-        <targetPath>META-INF</targetPath>
-      </resource>
-    </resources>
-
     <plugins>
       <plugin>
         <artifactId>maven-compiler-plugin</artifactId>
@@ -57,9 +56,9 @@
         </configuration>
       </plugin>
       <plugin>
-        <artifactId>maven-surefire-plugin</artifactId>
+        <artifactId>maven-deploy-plugin</artifactId>
         <configuration>
-          <jvm>${java.home}/bin/java</jvm>
+          <skip>true</skip>
         </configuration>
       </plugin>
     </plugins>

Copied: maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4StackTraceWriter.java (from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4StackTraceWriter.java)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4StackTraceWriter.java?p2=maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4StackTraceWriter.java&p1=maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4StackTraceWriter.java&r1=1056680&r2=1056827&rev=1056827&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4StackTraceWriter.java (original)
+++ maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4StackTraceWriter.java Sat Jan  8 22:44:23 2011
@@ -1,4 +1,4 @@
-package org.apache.maven.surefire.junit4;
+package org.apache.maven.surefire.common.junit4;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one

Propchange: maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4StackTraceWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4StackTraceWriter.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Copied: maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4TestChecker.java (from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestChecker.java)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4TestChecker.java?p2=maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4TestChecker.java&p1=maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestChecker.java&r1=1056680&r2=1056827&rev=1056827&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestChecker.java (original)
+++ maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4TestChecker.java Sat Jan  8 22:44:23 2011
@@ -1,4 +1,4 @@
-package org.apache.maven.surefire.junit4;
+package org.apache.maven.surefire.common.junit4;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -20,12 +20,12 @@ package org.apache.maven.surefire.junit4
  */
 
 import org.apache.maven.surefire.NonAbstractClassFilter;
+import org.apache.maven.surefire.common.junit3.JUnit3TestChecker;
 import org.apache.maven.surefire.util.ReflectionUtils;
 import org.apache.maven.surefire.util.ScannerFilter;
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
 
 /**
  * @author Kristian Rosenvold
@@ -33,38 +33,32 @@ import java.lang.reflect.Modifier;
 public class JUnit4TestChecker
     implements ScannerFilter
 {
-    private final Class junitClass;
-
     private final NonAbstractClassFilter nonAbstractClassFilter;
 
     private final Class runWith;
 
-    private static final Class[] EMPTY_CLASS_ARRAY = new Class[0];
+    private final JUnit3TestChecker jUnit3TestChecker;
 
 
     public JUnit4TestChecker( ClassLoader testClassLoader )
     {
-        this.junitClass = getJUnitClass( testClassLoader, junit.framework.Test.class.getName() );
+        this.jUnit3TestChecker = new JUnit3TestChecker( testClassLoader );
         this.runWith = getJUnitClass( testClassLoader, org.junit.runner.RunWith.class.getName() );
         this.nonAbstractClassFilter = new NonAbstractClassFilter();
     }
 
     public boolean accept( Class testClass )
     {
-        return isValidJUnit4Test( testClass );
+        return jUnit3TestChecker.accept( testClass ) || isValidJUnit4Test( testClass );
     }
 
     @SuppressWarnings( { "unchecked" } )
-    public boolean isValidJUnit4Test( Class testClass )
+    private boolean isValidJUnit4Test( Class testClass )
     {
         if ( !nonAbstractClassFilter.accept( testClass ) )
         {
             return false;
         }
-        if ( junitClass != null && ( junitClass.isAssignableFrom( testClass ) || isSuiteOnly( testClass ) ) )
-        {
-            return true;
-        }
 
         Annotation runWithAnnotation = testClass.getAnnotation( runWith );
         if ( runWithAnnotation != null )
@@ -99,21 +93,6 @@ public class JUnit4TestChecker
         return false;
     }
 
-    public boolean isSuiteOnly( Class testClass )
-    {
-        final Method suite = ReflectionUtils.tryGetMethod( testClass, "suite", EMPTY_CLASS_ARRAY );
-        if ( suite != null )
-        {
-
-            final int modifiers = suite.getModifiers();
-            if ( Modifier.isPublic( modifiers ) && Modifier.isStatic( modifiers ) )
-            {
-                return junit.framework.Test.class.isAssignableFrom( suite.getReturnType() );
-            }
-        }
-        return false;
-    }
-
     private Class getJUnitClass( ClassLoader classLoader, String className )
     {
         return ReflectionUtils.tryLoadClass( classLoader, className );

Propchange: maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4TestChecker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: maven/surefire/trunk/surefire-providers/common-junit4/src/test/java/org/apache/maven/surefire/junit4/JUnit4TestCheckerTest.java (from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit4/src/test/java/org/apache/maven/surefire/junit4/JUnit4TestCheckerTest.java)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/common-junit4/src/test/java/org/apache/maven/surefire/junit4/JUnit4TestCheckerTest.java?p2=maven/surefire/trunk/surefire-providers/common-junit4/src/test/java/org/apache/maven/surefire/junit4/JUnit4TestCheckerTest.java&p1=maven/surefire/trunk/surefire-providers/surefire-junit4/src/test/java/org/apache/maven/surefire/junit4/JUnit4TestCheckerTest.java&r1=1056680&r2=1056827&rev=1056827&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit4/src/test/java/org/apache/maven/surefire/junit4/JUnit4TestCheckerTest.java (original)
+++ maven/surefire/trunk/surefire-providers/common-junit4/src/test/java/org/apache/maven/surefire/junit4/JUnit4TestCheckerTest.java Sat Jan  8 22:44:23 2011
@@ -20,6 +20,7 @@ package org.apache.maven.surefire.junit4
 
 import junit.framework.TestCase;
 import junit.framework.TestResult;
+import org.apache.maven.surefire.common.junit4.JUnit4TestChecker;
 import org.apache.maven.surefire.testset.TestSetFailedException;
 import org.junit.Test;
 import org.junit.internal.runners.InitializationError;
@@ -43,73 +44,73 @@ public class JUnit4TestCheckerTest
     public void validJunit4Annotated()
         throws TestSetFailedException
     {
-        assertTrue( jUnit4TestChecker.isValidJUnit4Test( JUnit4TestCheckerTest.class ) );
+        assertTrue( jUnit4TestChecker.accept( JUnit4TestCheckerTest.class ) );
     }
 
     @Test
     public void validJunit4itsAJunit3Test()
         throws TestSetFailedException
     {
-        assertTrue( jUnit4TestChecker.isValidJUnit4Test( AlsoValid.class ) );
+        assertTrue( jUnit4TestChecker.accept( AlsoValid.class ) );
     }
 
     @Test
     public void validJunitSubclassWithoutOwnTestmethods()
         throws TestSetFailedException
     {
-        assertTrue( jUnit4TestChecker.isValidJUnit4Test( SubClassWithoutOwnTestMethods.class ) );
+        assertTrue( jUnit4TestChecker.accept( SubClassWithoutOwnTestMethods.class ) );
     }
 
     @Test
     public void validSuite()
         throws TestSetFailedException
     {
-        assertTrue( jUnit4TestChecker.isValidJUnit4Test( SuiteValid1.class ) );
+        assertTrue( jUnit4TestChecker.accept( SuiteValid1.class ) );
     }
 
     @Test
     public void validCustomSuite()
         throws TestSetFailedException
     {
-        assertTrue( jUnit4TestChecker.isValidJUnit4Test( SuiteValid2.class ) );
+        assertTrue( jUnit4TestChecker.accept( SuiteValid2.class ) );
     }
 
     @Test
     public void validCustomRunner()
         throws TestSetFailedException
     {
-        assertTrue( jUnit4TestChecker.isValidJUnit4Test( SuiteValidCustomRunner.class ) );
+        assertTrue( jUnit4TestChecker.accept( SuiteValidCustomRunner.class ) );
     }
 
     @Test
     public void invalidTest()
         throws TestSetFailedException
     {
-        assertFalse( jUnit4TestChecker.isValidJUnit4Test( NotValidTest.class ) );
+        assertFalse( jUnit4TestChecker.accept( NotValidTest.class ) );
     }
 
     @Test
     public void dontAcceptAbstractClasses()
     {
-        assertFalse( jUnit4TestChecker.isValidJUnit4Test( BaseClassWithTest.class ) );
+        assertFalse( jUnit4TestChecker.accept( BaseClassWithTest.class ) );
     }
 
     @Test
     public void suiteOnlyTest()
     {
-        assertTrue( jUnit4TestChecker.isValidJUnit4Test( SuiteOnlyTest.class ) );
+        assertTrue( jUnit4TestChecker.accept( SuiteOnlyTest.class ) );
     }
 
     @Test
     public void customSuiteOnlyTest()
     {
-        assertTrue( jUnit4TestChecker.isValidJUnit4Test( CustomSuiteOnlyTest.class ) );
+        assertTrue( jUnit4TestChecker.accept( CustomSuiteOnlyTest.class ) );
     }
 
     @Test
     public void innerClassNotAutomaticallyTc(){
-        assertTrue( jUnit4TestChecker.isValidJUnit4Test( NestedTC.class));
-        assertFalse( jUnit4TestChecker.isValidJUnit4Test( NestedTC.Inner.class));
+        assertTrue( jUnit4TestChecker.accept( NestedTC.class));
+        assertFalse( jUnit4TestChecker.accept( NestedTC.Inner.class));
     }
 
 

Propchange: maven/surefire/trunk/surefire-providers/common-junit4/src/test/java/org/apache/maven/surefire/junit4/JUnit4TestCheckerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/surefire/trunk/surefire-providers/pom.xml
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/pom.xml?rev=1056827&r1=1056826&r2=1056827&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/pom.xml (original)
+++ maven/surefire/trunk/surefire-providers/pom.xml Sat Jan  8 22:44:23 2011
@@ -34,7 +34,9 @@
   <name>SureFire Providers</name>
 
   <modules>
-    <module>surefire-junit</module>
+    <module>common-junit3</module>
+    <module>common-junit4</module>
+    <module>surefire-junit3</module>
     <module>surefire-junit4</module>
     <module>surefire-junit47</module>
     <module>surefire-testng</module>

Copied: maven/surefire/trunk/surefire-providers/surefire-junit3/pom.xml (from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit/pom.xml)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit3/pom.xml?p2=maven/surefire/trunk/surefire-providers/surefire-junit3/pom.xml&p1=maven/surefire/trunk/surefire-providers/surefire-junit/pom.xml&r1=1056680&r2=1056827&rev=1056827&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit/pom.xml (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit3/pom.xml Sat Jan  8 22:44:23 2011
@@ -38,7 +38,29 @@
         <targetPath>META-INF</targetPath>
       </resource>
     </resources>
+     <plugins>
+       <plugin>
+         <groupId>org.apache.maven.plugins</groupId>
+         <artifactId>maven-shade-plugin</artifactId>
+         <version>1.4</version>
+         <executions>
+           <execution>
+             <phase>package</phase>
+             <goals>
+               <goal>shade</goal>
+             </goals>
+             <configuration>
+               <artifactSet>
+                 <includes>
+                   <include>org.apache.maven.surefire:common-junit3</include>
+                 </includes>
+               </artifactSet>
+             </configuration>
+           </execution>
+         </executions>
+       </plugin>
 
+     </plugins>
     </build>
   <dependencies>
     <dependency>
@@ -47,5 +69,10 @@
       <version>3.8.1</version>
       <scope>provided</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.maven.surefire</groupId>
+      <artifactId>common-junit3</artifactId>
+      <version>${project.version}</version>
+    </dependency>
   </dependencies>
 </project>

Propchange: maven/surefire/trunk/surefire-providers/surefire-junit3/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/surefire/trunk/surefire-providers/surefire-junit3/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Copied: maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java (from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java?p2=maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java&p1=maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java&r1=1056680&r2=1056827&rev=1056827&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java Sat Jan  8 22:44:23 2011
@@ -19,6 +19,8 @@ package org.apache.maven.surefire.junit;
  * under the License.
  */
 
+import org.apache.maven.surefire.common.junit3.JUnit3Reflector;
+import org.apache.maven.surefire.common.junit3.JUnit3TestChecker;
 import org.apache.maven.surefire.providerapi.ProviderParameters;
 import org.apache.maven.surefire.providerapi.SurefireProvider;
 import org.apache.maven.surefire.report.ReportEntry;
@@ -46,6 +48,8 @@ public class JUnit3Provider
 
     private final DirectoryScanner directoryScanner;
 
+    private final PojoAndJUnit3Checker testChecker;
+
     private final JUnit3TestChecker jUnit3TestChecker;
 
     private final JUnit3Reflector reflector;
@@ -59,7 +63,8 @@ public class JUnit3Provider
         this.testClassLoader = booterParameters.getTestClassLoader();
         this.directoryScanner = booterParameters.getDirectoryScanner();
         this.reflector = new JUnit3Reflector( testClassLoader );
-        this.jUnit3TestChecker = new JUnit3TestChecker( testClassLoader ); // Todo; use reflector
+        jUnit3TestChecker = new JUnit3TestChecker( testClassLoader );
+        this.testChecker = new PojoAndJUnit3Checker( jUnit3TestChecker ); // Todo; use reflector
     }
 
     public RunResult invoke( Object forkTestSet )
@@ -85,7 +90,7 @@ public class JUnit3Provider
     private SurefireTestSet createTestSet( Class clazz )
         throws TestSetFailedException
     {
-        return reflector.isJUnit3Available() && jUnit3TestChecker.isJunit3Test( clazz )
+        return reflector.isJUnit3Available() && jUnit3TestChecker.accept( clazz )
             ? new JUnitTestSet( clazz, reflector )
             : (SurefireTestSet) new PojoTestSet( clazz );
 
@@ -108,7 +113,7 @@ public class JUnit3Provider
 
     private TestsToRun scanClassPath()
     {
-        return directoryScanner.locateTestClasses( testClassLoader, jUnit3TestChecker );
+        return directoryScanner.locateTestClasses( testClassLoader, testChecker );
     }
 
 

Propchange: maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnitStackTraceWriter.java (from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnitStackTraceWriter.java)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnitStackTraceWriter.java?p2=maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnitStackTraceWriter.java&p1=maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnitStackTraceWriter.java&r1=1056680&r2=1056827&rev=1056827&view=diff
==============================================================================
    (empty)

Propchange: maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnitStackTraceWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnitStackTraceWriter.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnitTestSet.java (from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnitTestSet.java)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnitTestSet.java?p2=maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnitTestSet.java&p1=maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnitTestSet.java&r1=1056680&r2=1056827&rev=1056827&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnitTestSet.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnitTestSet.java Sat Jan  8 22:44:23 2011
@@ -19,6 +19,7 @@ package org.apache.maven.surefire.junit;
  * under the License.
  */
 
+import org.apache.maven.surefire.common.junit3.JUnit3Reflector;
 import org.apache.maven.surefire.report.ReporterManager;
 import org.apache.maven.surefire.testset.TestSetFailedException;
 

Propchange: maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnitTestSet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnitTestSet.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoAndJUnit3Checker.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoAndJUnit3Checker.java?rev=1056827&view=auto
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoAndJUnit3Checker.java (added)
+++ maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoAndJUnit3Checker.java Sat Jan  8 22:44:23 2011
@@ -0,0 +1,60 @@
+package org.apache.maven.surefire.junit;
+
+/*
+ * 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.surefire.NonAbstractClassFilter;
+import org.apache.maven.surefire.common.junit3.JUnit3TestChecker;
+import org.apache.maven.surefire.util.ScannerFilter;
+
+/**
+ * @author Kristian Rosenvold
+ */
+public class PojoAndJUnit3Checker
+    implements ScannerFilter
+{
+    private final JUnit3TestChecker jUnit3TestChecker;
+
+    private final NonAbstractClassFilter nonAbstractClassFilter = new NonAbstractClassFilter();
+
+    public PojoAndJUnit3Checker( JUnit3TestChecker jUnit3TestChecker )
+    {
+        this.jUnit3TestChecker = jUnit3TestChecker;
+    }
+
+    public boolean accept( Class testClass )
+    {
+        return jUnit3TestChecker.accept( testClass ) || nonAbstractClassFilter.accept( testClass ) && isPojoTest(
+            testClass );
+    }
+
+    private boolean isPojoTest( Class testClass )
+    {
+        try
+        {
+            testClass.getConstructor( new Class[0] );
+            return true;
+        }
+        catch ( Exception e )
+        {
+            return false;
+        }
+    }
+
+}

Propchange: maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoAndJUnit3Checker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java (from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java?p2=maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java&p1=maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java&r1=1056680&r2=1056827&rev=1056827&view=diff
==============================================================================
    (empty)

Propchange: maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/SurefireTestSet.java (from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/SurefireTestSet.java)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/SurefireTestSet.java?p2=maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/SurefireTestSet.java&p1=maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/SurefireTestSet.java&r1=1056680&r2=1056827&rev=1056827&view=diff
==============================================================================
    (empty)

Propchange: maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/SurefireTestSet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/SurefireTestSet.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/TestListenerInvocationHandler.java (from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/TestListenerInvocationHandler.java)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/TestListenerInvocationHandler.java?p2=maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/TestListenerInvocationHandler.java&p1=maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/TestListenerInvocationHandler.java&r1=1056680&r2=1056827&rev=1056827&view=diff
==============================================================================
    (empty)

Propchange: maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/TestListenerInvocationHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/TestListenerInvocationHandler.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/resources/META-INF/services/org.apache.maven.surefire.providerapi.SurefireProvider (from r1056680, maven/surefire/trunk/surefire-providers/surefire-junit/src/main/resources/META-INF/services/org.apache.maven.surefire.providerapi.SurefireProvider)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/resources/META-INF/services/org.apache.maven.surefire.providerapi.SurefireProvider?p2=maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/resources/META-INF/services/org.apache.maven.surefire.providerapi.SurefireProvider&p1=maven/surefire/trunk/surefire-providers/surefire-junit/src/main/resources/META-INF/services/org.apache.maven.surefire.providerapi.SurefireProvider&r1=1056680&r2=1056827&rev=1056827&view=diff
==============================================================================
    (empty)

Modified: maven/surefire/trunk/surefire-providers/surefire-junit4/pom.xml
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit4/pom.xml?rev=1056827&r1=1056826&r2=1056827&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit4/pom.xml (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit4/pom.xml Sat Jan  8 22:44:23 2011
@@ -17,7 +17,8 @@
   ~ 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/xsd/maven-4.0.0.xsd">
+<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/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
@@ -38,6 +39,11 @@
       <version>4.0</version>
       <scope>provided</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.maven.surefire</groupId>
+      <artifactId>common-junit4</artifactId>
+      <version>${project.version}</version>
+    </dependency>
   </dependencies>
 
   <build>
@@ -62,6 +68,27 @@
           <jvm>${java.home}/bin/java</jvm>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-shade-plugin</artifactId>
+        <version>1.4</version>
+        <executions>
+          <execution>
+            <phase>package</phase>
+            <goals>
+              <goal>shade</goal>
+            </goals>
+            <configuration>
+              <artifactSet>
+                <includes>
+                  <include>org.apache.maven.surefire:common-junit3</include>
+                  <include>org.apache.maven.surefire:common-junit4</include>
+                </includes>
+              </artifactSet>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 </project>

Modified: maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java?rev=1056827&r1=1056826&r2=1056827&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java Sat Jan  8 22:44:23 2011
@@ -33,6 +33,7 @@ import org.apache.maven.surefire.util.De
 import org.apache.maven.surefire.util.DirectoryScanner;
 import org.apache.maven.surefire.util.ReflectionUtils;
 import org.apache.maven.surefire.util.TestsToRun;
+import org.apache.maven.surefire.common.junit4.JUnit4TestChecker;
 import org.junit.runner.notification.RunListener;
 import org.junit.runner.notification.RunNotifier;
 

Modified: maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSetReporter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSetReporter.java?rev=1056827&r1=1056826&r2=1056827&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSetReporter.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSetReporter.java Sat Jan  8 22:44:23 2011
@@ -19,6 +19,7 @@ package org.apache.maven.surefire.junit4
  * under the License.
  */
 
+import org.apache.maven.surefire.common.junit4.JUnit4StackTraceWriter;
 import org.apache.maven.surefire.report.ReportEntry;
 import org.apache.maven.surefire.report.ReporterManager;
 import org.apache.maven.surefire.report.SimpleReportEntry;

Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/pom.xml
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/pom.xml?rev=1056827&r1=1056826&r2=1056827&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/pom.xml (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/pom.xml Sat Jan  8 22:44:23 2011
@@ -17,64 +17,91 @@
   ~ 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/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.apache.maven.surefire</groupId>
-        <artifactId>surefire-providers</artifactId>
-        <version>2.7.2-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-
-    <artifactId>surefire-junit47</artifactId>
-
-    <name>SureFire JUnitCore Runner</name>
-
-    <dependencies>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <version>4.8.1</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.codehaus.plexus</groupId>
-            <artifactId>plexus-utils</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.mockito</groupId>
-            <artifactId>mockito-all</artifactId>
-            <version>1.7</version>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
-    <build>
-           <resources>
-             <resource>
-               <directory>src/main/resources/META-INF</directory>
-               <targetPath>META-INF</targetPath>
-             </resource>
-           </resources>
-
-        <plugins>
-            <plugin>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <configuration>
-                    <fork>true</fork>
-                    <compilerVersion>1.5</compilerVersion>
-                    <source>1.5</source>
-                    <target>1.5</target>
-                </configuration>
-            </plugin>
-            <plugin>
-                <artifactId>maven-surefire-plugin</artifactId>
-                <configuration>
-                    <jvm>${java.home}/bin/java</jvm>
-                    <redirectTestOutputToFile>true</redirectTestOutputToFile>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
+<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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.maven.surefire</groupId>
+    <artifactId>surefire-providers</artifactId>
+    <version>2.7.2-SNAPSHOT</version>
+    <relativePath>../pom.xml</relativePath>
+  </parent>
+
+  <artifactId>surefire-junit47</artifactId>
+
+  <name>SureFire JUnitCore Runner</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.8.1</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-all</artifactId>
+      <version>1.7</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.surefire</groupId>
+      <artifactId>common-junit4</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <resources>
+      <resource>
+        <directory>src/main/resources/META-INF</directory>
+        <targetPath>META-INF</targetPath>
+      </resource>
+    </resources>
+
+    <plugins>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <fork>true</fork>
+          <compilerVersion>1.5</compilerVersion>
+          <source>1.5</source>
+          <target>1.5</target>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <jvm>${java.home}/bin/java</jvm>
+          <redirectTestOutputToFile>true</redirectTestOutputToFile>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-shade-plugin</artifactId>
+        <version>1.4</version>
+        <executions>
+          <execution>
+            <phase>package</phase>
+            <goals>
+              <goal>shade</goal>
+            </goals>
+            <configuration>
+              <artifactSet>
+                <includes>
+                  <include>org.apache.maven.surefire:common-junit3</include>
+                  <include>org.apache.maven.surefire:common-junit4</include>
+                </includes>
+              </artifactSet>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
 </project>

Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/TestMethod.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/TestMethod.java?rev=1056827&r1=1056826&r2=1056827&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/TestMethod.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/TestMethod.java Sat Jan  8 22:44:23 2011
@@ -20,6 +20,7 @@ package org.apache.maven.surefire.junitc
  */
 
 import org.apache.maven.surefire.Surefire;
+import org.apache.maven.surefire.common.junit4.JUnit4StackTraceWriter;
 import org.apache.maven.surefire.report.ReportEntry;
 import org.apache.maven.surefire.report.Reporter;
 import org.apache.maven.surefire.report.SimpleReportEntry;
@@ -148,7 +149,7 @@ class TestMethod
     private ReportEntry createFailureEntry( Failure failure )
     {
         return new SimpleReportEntry( failure.getDescription().getTestClass().getCanonicalName(),
-                                      failure.getTestHeader(), new JUnitCoreStackTraceWriter( failure ), getElapsed() );
+                                      failure.getTestHeader(), new JUnit4StackTraceWriter( failure ), getElapsed() );
     }
 
 



Mime
View raw message