Author: krosenvold
Date: Wed Jan 26 22:03:27 2011
New Revision: 1063890

URL: http://svn.apache.org/viewvc?rev=1063890&view=rev
Log:
o Cleaned out unused code

Modified:
    
maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManagerFactory.java
    
maven/surefire/trunk/surefire-providers/surefire-junit3/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/JUnitTestSet.java
    
maven/surefire/trunk/surefire-providers/surefire-junit3/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/TestListenerInvocationHandler.java

Modified: 
maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManagerFactory.java
URL: 
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManagerFactory.java?rev=1063890&r1=1063889&r2=1063890&view=diff
==============================================================================
--- 
maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManagerFactory.java
 (original)
+++ 
maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManagerFactory.java
 Wed Jan 26 22:03:27 2011
@@ -39,7 +39,7 @@ import java.util.Timer;
  * is allocated, but none of the subsequent managers.
  *
  * @author Jason van Zyl
- * @author Kristian Rosenvold (extracted factory)
+ * @author Kristian Rosenvold
  */
 
 /**
@@ -68,11 +68,9 @@ public class ReporterManagerFactory
 
     private final Timer timer;
 
-
-    public ReporterManagerFactory( List reportDefinitions, ClassLoader 
surefireClassLoader,
-                                   ReporterConfiguration reporterConfiguration 
)
+    public ReporterManagerFactory( ClassLoader surefireClassLoader, 
ReporterConfiguration reporterConfiguration )
     {
-        this.reportDefinitions = reportDefinitions;
+        this.reportDefinitions = reporterConfiguration.getReports();
         this.surefireClassLoader = surefireClassLoader;
         this.reporterConfiguration = reporterConfiguration;
         this.reports = instantiateReportsNewStyle( reportDefinitions, 
reporterConfiguration, surefireClassLoader );
@@ -87,12 +85,6 @@ public class ReporterManagerFactory
             timer = null;
         }
 
-
-    }
-
-    public ReporterManagerFactory( ClassLoader surefireClassLoader, 
ReporterConfiguration reporterConfiguration )
-    {
-        this( reporterConfiguration.getReports(), surefireClassLoader, 
reporterConfiguration );
     }
 
     public RunStatistics getGlobalRunStatistics()

Modified: 
maven/surefire/trunk/surefire-providers/surefire-junit3/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?rev=1063890&r1=1063889&r2=1063890&view=diff
==============================================================================
--- 
maven/surefire/trunk/surefire-providers/surefire-junit3/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
 Wed Jan 26 22:03:27 2011
@@ -54,7 +54,6 @@ public class JUnit3Provider
 
     private final JUnit3Reflector reflector;
 
-
     private TestsToRun testsToRun;
 
     public JUnit3Provider( ProviderParameters booterParameters )
@@ -114,7 +113,6 @@ public class JUnit3Provider
         return directoryScanner.locateTestClasses( testClassLoader, 
testChecker );
     }
 
-
     public Iterator getSuites()
     {
         testsToRun = scanClassPath();

Modified: 
maven/surefire/trunk/surefire-providers/surefire-junit3/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?rev=1063890&r1=1063889&r2=1063890&view=diff
==============================================================================
--- 
maven/surefire/trunk/surefire-providers/surefire-junit3/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
 Wed Jan 26 22:03:27 2011
@@ -30,7 +30,7 @@ import java.lang.reflect.Proxy;
 public final class JUnitTestSet
     implements SurefireTestSet
 {
-    private Method runMethod;
+    private final Method runMethod;
 
     private final Class testClass;
 
@@ -72,7 +72,7 @@ public final class JUnitTestSet
     }
 
 
-    public void execute( Reporter reportManager, ClassLoader loader )
+    public void execute( Reporter reporter, ClassLoader loader )
         throws TestSetFailedException
     {
         Class testClass = getTestClass();
@@ -83,8 +83,7 @@ public final class JUnitTestSet
 
             Object instanceOfTestResult = 
reflector.getTestResultClass().newInstance();
 
-            TestListenerInvocationHandler invocationHandler =
-                new TestListenerInvocationHandler( reportManager, 
instanceOfTestResult, loader );
+            TestListenerInvocationHandler invocationHandler = new 
TestListenerInvocationHandler( reporter );
 
             Object testListener =
                 Proxy.newProxyInstance( loader, 
reflector.getInterfacesImplementedByDynamicProxy(), invocationHandler );

Modified: 
maven/surefire/trunk/surefire-providers/surefire-junit3/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?rev=1063890&r1=1063889&r2=1063890&view=diff
==============================================================================
--- 
maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java
 (original)
+++ 
maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java
 Wed Jan 26 22:03:27 2011
@@ -22,7 +22,6 @@ package org.apache.maven.surefire.junit;
 import org.apache.maven.surefire.report.PojoStackTraceWriter;
 import org.apache.maven.surefire.report.ReportEntry;
 import org.apache.maven.surefire.report.Reporter;
-import org.apache.maven.surefire.report.ReporterManager;
 import org.apache.maven.surefire.report.SimpleReportEntry;
 import org.apache.maven.surefire.testset.TestSetFailedException;
 
@@ -40,15 +39,15 @@ public class PojoTestSet
 
     private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
 
-    private Object testObject;
+    private final Object testObject;
 
-    protected List testMethods;
+    private List testMethods;
     
-    protected Method setUpMethod;
+    private Method setUpMethod;
     
-    protected Method tearDownMethod;
+    private Method tearDownMethod;
 
-    private Class testClass;
+    private final Class testClass;
 
     public PojoTestSet( Class testClass )
         throws TestSetFailedException
@@ -85,7 +84,7 @@ public class PojoTestSet
         executeTestMethods( reportManager );
     }
 
-    protected void executeTestMethods( Reporter reportManager )
+    private void executeTestMethods( Reporter reportManager )
     {
         if ( reportManager == null )
         {
@@ -105,10 +104,7 @@ public class PojoTestSet
         }
     }
 
-    /**
-     * @noinspection CatchGenericClass, OverlyBroadCatchBlock, 
MethodWithMultipleReturnPoints
-     */
-    protected boolean executeTestMethod( Method method, Object[] args, 
Reporter reportManager )
+    private boolean executeTestMethod( Method method, Object[] args, Reporter 
reportManager )
     {
         if ( method == null || args == null || reportManager == null )
         {
@@ -139,7 +135,7 @@ public class PojoTestSet
                                             new PojoStackTraceWriter( 
testObject.getClass().getName(), method.getName(),
                                                                       e ) );
 
-            ( (ReporterManager) reportManager ).testFailed( report );
+            reportManager.testFailed( report );
 
             // A return value of true indicates to this class's 
executeTestMethods
             // method that it should abort and not attempt to execute
@@ -166,7 +162,7 @@ public class PojoTestSet
                                             new PojoStackTraceWriter( 
testObject.getClass().getName(), method.getName(),
                                                                       t ) );
 
-            ( (ReporterManager) reportManager ).testFailed( report );
+            reportManager.testFailed( report );
             // Don't return  here, because tearDownFixture should be called 
even
             // if the test method throws an exception.
         }
@@ -176,7 +172,7 @@ public class PojoTestSet
                                             new PojoStackTraceWriter( 
testObject.getClass().getName(), method.getName(),
                                                                       t ) );
 
-            ( (ReporterManager) reportManager ).testFailed( report );
+            reportManager.testFailed( report );
             // Don't return  here, because tearDownFixture should be called 
even
             // if the test method throws an exception.
         }
@@ -192,7 +188,7 @@ public class PojoTestSet
                                             new PojoStackTraceWriter( 
testObject.getClass().getName(), method.getName(),
                                                                       t ) );
 
-            ( (ReporterManager) reportManager ).testFailed( report );
+            reportManager.testFailed( report );
 
             // A return value of true indicates to this class's 
executeTestMethods
             // method that it should abort and not attempt to execute
@@ -210,7 +206,7 @@ public class PojoTestSet
         return false;
     }
 
-    public String getTestName( String testMethodName )
+    private String getTestName( String testMethodName )
     {
         if ( testMethodName == null )
         {
@@ -220,12 +216,12 @@ public class PojoTestSet
         return getTestClass().getName() + "." + testMethodName;
     }
 
-    public void setUpFixture() throws Throwable
+    private void setUpFixture() throws Throwable
     {
        if (setUpMethod != null) setUpMethod.invoke( testObject, new Object[0] 
);        
     }
 
-    public void tearDownFixture() throws Throwable
+    private void tearDownFixture() throws Throwable
     {
        if (tearDownMethod != null) tearDownMethod.invoke( testObject, new 
Object[0] );        
     }

Modified: 
maven/surefire/trunk/surefire-providers/surefire-junit3/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?rev=1063890&r1=1063889&r2=1063890&view=diff
==============================================================================
--- 
maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/TestListenerInvocationHandler.java
 (original)
+++ 
maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/TestListenerInvocationHandler.java
 Wed Jan 26 22:03:27 2011
@@ -21,7 +21,6 @@ package org.apache.maven.surefire.junit;
 
 import org.apache.maven.surefire.report.ReportEntry;
 import org.apache.maven.surefire.report.Reporter;
-import org.apache.maven.surefire.report.ReporterManager;
 import org.apache.maven.surefire.report.SimpleReportEntry;
 
 import java.lang.reflect.InvocationHandler;
@@ -44,7 +43,7 @@ public class TestListenerInvocationHandl
 
     private Set failedTestsSet = new HashSet();
 
-    private ReporterManager reportManager;  // todo: Switch to ReportWriter 
for 2.7.2
+    private Reporter reporter;
 
     private static final Class[] EMPTY_CLASS_ARRAY = new Class[]{ };
 
@@ -104,24 +103,14 @@ public class TestListenerInvocationHandl
         }
     }
 
-    public TestListenerInvocationHandler( Reporter reportManager, Object 
instanceOfTestResult, ClassLoader loader )
+    public TestListenerInvocationHandler( Reporter reporter )
     {
-        if ( reportManager == null )
+        if ( reporter == null )
         {
-            throw new NullPointerException( "reportManager is null" );
+            throw new NullPointerException( "reporter is null" );
         }
 
-        if ( instanceOfTestResult == null )
-        {
-            throw new NullPointerException( "instanceOfTestResult is null" );
-        }
-
-        if ( loader == null )
-        {
-            throw new NullPointerException( "loader is null" );
-        }
-
-        this.reportManager = (ReporterManager) reportManager;
+        this.reporter = reporter;
     }
 
     public Object invoke( Object proxy, Method method, Object[] args )
@@ -154,7 +143,7 @@ public class TestListenerInvocationHandl
     {
         ReportEntry report = new SimpleReportEntry( 
args[0].getClass().getName(), args[0].toString() );
 
-        reportManager.testStarting( report );
+        reporter.testStarting( report );
     }
 
     // Handler for TestListener.addFailure(Test, Throwable)
@@ -164,7 +153,7 @@ public class TestListenerInvocationHandl
         ReportEntry report =
             new SimpleReportEntry( args[0].getClass().getName(), 
args[0].toString(), getStackTraceWriter( args ) );
 
-        ( (ReporterManager) reportManager ).testError( report );
+        reporter.testError( report );
 
         failedTestsSet.add( new FailedTest( args[0], Thread.currentThread() ) 
);
     }
@@ -193,7 +182,7 @@ public class TestListenerInvocationHandl
         ReportEntry report =
             new SimpleReportEntry( args[0].getClass().getName(), 
args[0].toString(), getStackTraceWriter( args ) );
 
-        reportManager.testFailed( report );
+        reporter.testFailed( report );
 
         failedTestsSet.add( new FailedTest( args[0], Thread.currentThread() ) 
);
     }
@@ -206,7 +195,7 @@ public class TestListenerInvocationHandl
         {
             ReportEntry report = new SimpleReportEntry( 
args[0].getClass().getName(), args[0].toString() );
 
-            reportManager.testSucceeded( report );
+            reporter.testSucceeded( report );
         }
     }
 }


Reply via email to