Author: krosenvold
Date: Wed Jun 20 20:10:08 2012
New Revision: 1352293
URL: http://svn.apache.org/viewvc?rev=1352293&view=rev
Log:
[SUREFIRE-877] Surefire doesn't support mixed TestNG 6.5.x config parameter
Fixed with testcase
Added:
maven/surefire/trunk/surefire-providers/surefire-testng/src/test/java/org/apache/maven/surefire/testng/
maven/surefire/trunk/surefire-providers/surefire-testng/src/test/java/org/apache/maven/surefire/testng/conf/
maven/surefire/trunk/surefire-providers/surefire-testng/src/test/java/org/apache/maven/surefire/testng/conf/TestNGMapConfiguratorTest.java
(with props)
Modified:
maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNGMapConfigurator.java
(contents, props changed)
Modified:
maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNGMapConfigurator.java
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNGMapConfigurator.java?rev=1352293&r1=1352292&r2=1352293&view=diff
==============================================================================
---
maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNGMapConfigurator.java
(original)
+++
maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNGMapConfigurator.java
Wed Jun 20 20:10:08 2012
@@ -48,6 +48,13 @@ public class TestNGMapConfigurator
public void configure( TestNG testng, Map options )
throws TestSetFailedException
{
+ Map convertedOptions = getConvertedOptions(options);
+ testng.configure( convertedOptions );
+ }
+
+ Map getConvertedOptions(Map options )
+ throws TestSetFailedException
+ {
Map convertedOptions = new HashMap();
for ( Iterator it = options.entrySet().iterator(); it.hasNext(); )
{
@@ -77,6 +84,10 @@ public class TestNGMapConfigurator
{
val = convert( val, Boolean.class );
}
+ else if ( "mixed".equals( key ) )
+ {
+ val = convert( val, Boolean.class );
+ }
else if ( ProviderParameterNames.THREADCOUNT_PROP.equals( key ) )
{
val = convert( val, String.class );
@@ -91,8 +102,7 @@ public class TestNGMapConfigurator
convertedOptions.put( "-" + key, val );
}
}
-
- testng.configure( convertedOptions );
+ return convertedOptions;
}
// ReporterConfig only became available in later versions of TestNG
Propchange:
maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNGMapConfigurator.java
------------------------------------------------------------------------------
svn:executable = *
Added:
maven/surefire/trunk/surefire-providers/surefire-testng/src/test/java/org/apache/maven/surefire/testng/conf/TestNGMapConfiguratorTest.java
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-testng/src/test/java/org/apache/maven/surefire/testng/conf/TestNGMapConfiguratorTest.java?rev=1352293&view=auto
==============================================================================
---
maven/surefire/trunk/surefire-providers/surefire-testng/src/test/java/org/apache/maven/surefire/testng/conf/TestNGMapConfiguratorTest.java
(added)
+++
maven/surefire/trunk/surefire-providers/surefire-testng/src/test/java/org/apache/maven/surefire/testng/conf/TestNGMapConfiguratorTest.java
Wed Jun 20 20:10:08 2012
@@ -0,0 +1,40 @@
+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 Kristian Rosenvold
+ */
+public class TestNGMapConfiguratorTest extends TestCase {
+ public void testGetConvertedOptions() throws Exception {
+ TestNGMapConfigurator testNGMapConfigurator = new
TestNGMapConfigurator();
+ Map raw = new HashMap();
+ raw.put("mixed", "true");
+ Map convertedOptions = testNGMapConfigurator.getConvertedOptions(raw);
+ Boolean bool = (Boolean) convertedOptions.get("-mixed");
+ assertTrue(bool.booleanValue());
+
+ }
+}
Propchange:
maven/surefire/trunk/surefire-providers/surefire-testng/src/test/java/org/apache/maven/surefire/testng/conf/TestNGMapConfiguratorTest.java
------------------------------------------------------------------------------
svn:executable = *