You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2012/07/06 19:20:32 UTC

svn commit: r1358307 - in /maven/surefire/trunk: ./ surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/ surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/ surefire-providers/surefire-t...

Author: olamy
Date: Fri Jul  6 17:20:32 2012
New Revision: 1358307

URL: http://svn.apache.org/viewvc?rev=1358307&view=rev
Log:
[SUREFIRE-880] ObjectFactory no longer works with TestNG 6.5.2
Submitted by Marvin Froeder.

Added:
    maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNG652Configurator.java   (with props)
    maven/surefire/trunk/surefire-providers/surefire-testng/src/test/java/org/apache/maven/surefire/testng/conf/TestNG652ConfiguratorTest.java   (with props)
Modified:
    maven/surefire/trunk/pom.xml
    maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java

Modified: maven/surefire/trunk/pom.xml
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/pom.xml?rev=1358307&r1=1358306&r2=1358307&view=diff
==============================================================================
--- maven/surefire/trunk/pom.xml (original)
+++ maven/surefire/trunk/pom.xml Fri Jul  6 17:20:32 2012
@@ -41,6 +41,10 @@
     <contributor>
       <name>Jesse Kuhnert</name>
     </contributor>
+    <contributor>
+      <name>Marvin Froeder</name>
+      <email>marvin@marvinformatics.com</email>
+    </contributor>
   </contributors>
 
   <mailingLists>

Modified: maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java?rev=1358307&r1=1358306&r2=1358307&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java Fri Jul  6 17:20:32 2012
@@ -33,6 +33,7 @@ import org.apache.maven.surefire.report.
 import org.apache.maven.surefire.testng.conf.Configurator;
 import org.apache.maven.surefire.testng.conf.TestNG4751Configurator;
 import org.apache.maven.surefire.testng.conf.TestNG52Configurator;
+import org.apache.maven.surefire.testng.conf.TestNG652Configurator;
 import org.apache.maven.surefire.testng.conf.TestNGMapConfigurator;
 import org.apache.maven.surefire.testset.TestSetFailedException;
 import org.apache.maven.surefire.util.NestedRuntimeException;
@@ -192,11 +193,16 @@ public class TestNGExecutor
             {
                 return new TestNG52Configurator();
             }
-            range = VersionRange.createFromVersionSpec( "[5.3,)" );
+            range = VersionRange.createFromVersionSpec( "[5.3,6.4]" );
             if ( range.containsVersion( version ) )
             {
                 return new TestNGMapConfigurator();
             }
+            range = VersionRange.createFromVersionSpec( "[6.5,)" );
+            if ( range.containsVersion( version ) )
+            {
+                return new TestNG652Configurator();
+            }
 
             throw new TestSetFailedException( "Unknown TestNG version " + version );
         }

Added: maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNG652Configurator.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNG652Configurator.java?rev=1358307&view=auto
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNG652Configurator.java (added)
+++ maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNG652Configurator.java Fri Jul  6 17:20:32 2012
@@ -0,0 +1,54 @@
+package org.apache.maven.surefire.testng.conf;
+
+/*
+ * 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.testset.TestSetFailedException;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+
+/**
+ * TestNG 6.5.2 configurator. Changed objectFactory type to String
+ *
+ * @author <a href='mailto:marvin[at]marvinformatics[dot]com'>Marvin Froeder</a>
+ */
+public class TestNG652Configurator
+    extends TestNGMapConfigurator
+{
+
+    Map getConvertedOptions( Map options )
+        throws TestSetFailedException
+    {
+        Map convertedOptions = super.getConvertedOptions( options );
+        for ( Iterator iterator = convertedOptions.entrySet().iterator(); iterator.hasNext(); )
+        {
+            Entry entry = (Entry) iterator.next();
+            String key = (String) entry.getKey();
+            if ( "-objectfactory".equals( key ) )
+            {
+                Class value = (Class) entry.getValue();
+                convertedOptions.put( key, value.getName() );
+                break;
+            }
+        }
+        return convertedOptions;
+    }
+}
\ No newline at end of file

Propchange: maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNG652Configurator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNG652Configurator.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/surefire/trunk/surefire-providers/surefire-testng/src/test/java/org/apache/maven/surefire/testng/conf/TestNG652ConfiguratorTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-testng/src/test/java/org/apache/maven/surefire/testng/conf/TestNG652ConfiguratorTest.java?rev=1358307&view=auto
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-testng/src/test/java/org/apache/maven/surefire/testng/conf/TestNG652ConfiguratorTest.java (added)
+++ maven/surefire/trunk/surefire-providers/surefire-testng/src/test/java/org/apache/maven/surefire/testng/conf/TestNG652ConfiguratorTest.java Fri Jul  6 17:20:32 2012
@@ -0,0 +1,44 @@
+package org.apache.maven.surefire.testng.conf;
+
+/*
+ * 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 junit.framework.TestCase;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href='mailto:marvin[at]marvinformatics[dot]com'>Marvin Froeder</a>
+ */
+public class TestNG652ConfiguratorTest
+    extends TestCase
+{
+
+    public void testGetConvertedOptions()
+        throws Exception
+    {
+        TestNGMapConfigurator testNGMapConfigurator = new TestNG652Configurator();
+        Map raw = new HashMap();
+        raw.put( "objectfactory", "java.lang.String" );
+        Map convertedOptions = testNGMapConfigurator.getConvertedOptions( raw );
+        String objectfactory = (String) convertedOptions.get( "-objectfactory" );
+        assertNotNull( objectfactory );
+    }
+}

Propchange: maven/surefire/trunk/surefire-providers/surefire-testng/src/test/java/org/apache/maven/surefire/testng/conf/TestNG652ConfiguratorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/surefire/trunk/surefire-providers/surefire-testng/src/test/java/org/apache/maven/surefire/testng/conf/TestNG652ConfiguratorTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision