maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krosenv...@apache.org
Subject svn commit: r1062048 - in /maven/surefire/trunk/surefire-providers: common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/ surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/ surefire-junit47/src/main/java/org/apache/maven/sur...
Date Fri, 21 Jan 2011 22:17:55 GMT
Author: krosenvold
Date: Fri Jan 21 22:17:55 2011
New Revision: 1062048

URL: http://svn.apache.org/viewvc?rev=1062048&view=rev
Log:
o Moved common code to common module

Added:
    maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4RunListenerFactory.java
  (with props)
Modified:
    maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
    maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java

Added: maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4RunListenerFactory.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4RunListenerFactory.java?rev=1062048&view=auto
==============================================================================
--- maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4RunListenerFactory.java
(added)
+++ maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4RunListenerFactory.java
Fri Jan 21 22:17:55 2011
@@ -0,0 +1,52 @@
+package org.apache.maven.surefire.common.junit4;
+
+/*
+ * 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.util.ReflectionUtils;
+import org.junit.runner.notification.RunListener;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * @author Kristian Rosenvold
+ */
+public class JUnit4RunListenerFactory
+{
+    public static List<RunListener> createCustomListeners( String listenerProperty
)
+    {
+        List<RunListener> result = new LinkedList<RunListener>();
+        if ( listenerProperty == null )
+        {
+            return result;
+        }
+
+        for ( String thisListenerName : listenerProperty.split( "," ) )
+        {
+            RunListener customRunListener =
+                (RunListener) ReflectionUtils.instantiate( Thread.currentThread().getContextClassLoader(),
+                                                           thisListenerName );
+            result.add( customRunListener );
+        }
+
+        return result;
+    }
+
+}

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

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=1062048&r1=1062047&r2=1062048&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
Fri Jan 21 22:17:55 2011
@@ -21,6 +21,7 @@ package org.apache.maven.surefire.junit4
 
 import org.apache.maven.surefire.Surefire;
 import org.apache.maven.surefire.common.junit4.JUnit4RunListener;
+import org.apache.maven.surefire.common.junit4.JUnit4RunListenerFactory;
 import org.apache.maven.surefire.common.junit4.JUnit4TestChecker;
 import org.apache.maven.surefire.providerapi.ProviderParameters;
 import org.apache.maven.surefire.providerapi.SurefireProvider;
@@ -34,17 +35,14 @@ import org.apache.maven.surefire.suite.R
 import org.apache.maven.surefire.testset.TestSetFailedException;
 import org.apache.maven.surefire.util.DefaultDirectoryScanner;
 import org.apache.maven.surefire.util.DirectoryScanner;
-import org.apache.maven.surefire.util.ReflectionUtils;
 import org.apache.maven.surefire.util.TestsToRun;
+import org.junit.runner.notification.RunListener;
+import org.junit.runner.notification.RunNotifier;
 
 import java.util.Iterator;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.ResourceBundle;
 
-import org.junit.runner.notification.RunListener;
-import org.junit.runner.notification.RunNotifier;
-
 
 /**
  * @author Kristian Rosenvold
@@ -73,7 +71,7 @@ public class JUnit4Provider
         this.reporterFactory = booterParameters.getReporterFactory();
         this.testClassLoader = booterParameters.getTestClassLoader();
         this.directoryScanner = booterParameters.getDirectoryScanner();
-        customRunListeners =
+        customRunListeners = JUnit4RunListenerFactory.
             createCustomListeners( booterParameters.getProviderProperties().getProperty(
"listener" ) );
         jUnit4TestChecker = new JUnit4TestChecker( testClassLoader );
 
@@ -196,23 +194,4 @@ public class JUnit4Provider
     {
         return Boolean.TRUE;
     }
-
-    private List<RunListener> createCustomListeners( String listenerProperty )
-    {
-        List<RunListener> result = new LinkedList<RunListener>();
-        if ( listenerProperty == null )
-        {
-            return result;
-        }
-
-        for ( String thisListenerName : listenerProperty.split( "," ) )
-        {
-            RunListener customRunListener =
-                (RunListener) ReflectionUtils.instantiate( Thread.currentThread().getContextClassLoader(),
-                                                           thisListenerName );
-            result.add( customRunListener );
-        }
-
-        return result;
-    }
 }

Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java?rev=1062048&r1=1062047&r2=1062048&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
(original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
Fri Jan 21 22:17:55 2011
@@ -19,7 +19,7 @@ package org.apache.maven.surefire.junitc
  * under the License.
  */
 
-import org.apache.maven.surefire.NonAbstractClassFilter;
+import org.apache.maven.surefire.common.junit4.JUnit4RunListenerFactory;
 import org.apache.maven.surefire.common.junit4.JUnit4TestChecker;
 import org.apache.maven.surefire.providerapi.ProviderParameters;
 import org.apache.maven.surefire.providerapi.SurefireProvider;
@@ -30,18 +30,15 @@ import org.apache.maven.surefire.report.
 import org.apache.maven.surefire.suite.RunResult;
 import org.apache.maven.surefire.testset.TestSetFailedException;
 import org.apache.maven.surefire.util.DirectoryScanner;
-import org.apache.maven.surefire.util.ReflectionUtils;
 import org.apache.maven.surefire.util.ScannerFilter;
 import org.apache.maven.surefire.util.TestsToRun;
+import org.junit.runner.notification.RunListener;
 
 import java.util.Iterator;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
-import org.junit.runner.notification.RunListener;
-
 /**
  * @author Kristian Rosenvold
  */
@@ -73,7 +70,7 @@ public class JUnitCoreProvider
         this.directoryScanner = booterParameters.getDirectoryScanner();
         this.jUnitCoreParameters = new JUnitCoreParameters( booterParameters.getProviderProperties()
);
         this.scannerFilter = new JUnit4TestChecker(testClassLoader);
-        customRunListeners =
+        customRunListeners = JUnit4RunListenerFactory.
             createCustomListeners( booterParameters.getProviderProperties().getProperty(
"listener" ) );
 
     }
@@ -116,25 +113,4 @@ public class JUnitCoreProvider
     {
         return directoryScanner.locateTestClasses( testClassLoader, scannerFilter );
     }
-
-    // Todo; We really need a shared java-5 language level module for the providers.
-    private List<RunListener> createCustomListeners( String listenerProperty )
-    {
-        List<RunListener> result = new LinkedList<RunListener>();
-        if ( listenerProperty == null )
-        {
-            return result;
-        }
-
-        for ( String thisListenerName : listenerProperty.split( "," ) )
-        {
-            RunListener customRunListener =
-                (RunListener) ReflectionUtils.instantiate( Thread.currentThread().getContextClassLoader(),
-                                                           thisListenerName );
-            result.add( customRunListener );
-        }
-
-        return result;
-    }
-
 }



Mime
View raw message