[SUREFIRE] TestNG652ConfiguratorTest should become TestNG60ConfiguratorTest due to -objectfactory and -testrunfactory
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/b249b9e0 Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/b249b9e0 Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/b249b9e0 Branch: refs/heads/master Commit: b249b9e048e3285c84ca921ca83749170e6e5069 Parents: 6494afb Author: Tibor17 <[email protected]> Authored: Wed Oct 14 00:44:39 2015 +0200 Committer: Tibor17 <[email protected]> Committed: Wed Oct 14 00:44:39 2015 +0200 ---------------------------------------------------------------------- .../plugin/surefire/AbstractSurefireMojo.java | 4 +- .../testng/conf/TestNG60Configurator.java | 53 ++++++++++++++++++++ .../testng/conf/TestNG652Configurator.java | 52 ------------------- .../testng/conf/TestNG60ConfiguratorTest.java | 44 ++++++++++++++++ .../testng/conf/TestNG652ConfiguratorTest.java | 44 ---------------- 5 files changed, 99 insertions(+), 98 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b249b9e0/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java ---------------------------------------------------------------------- diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java index 05fee27..6159263 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java @@ -1133,10 +1133,10 @@ public abstract class AbstractSurefireMojo { return "org.apache.maven.surefire.testng.conf.TestNG510Configurator"; } - range = VersionRange.createFromVersionSpec( "[6.5,)" ); + range = VersionRange.createFromVersionSpec( "[6.0,)" ); if ( range.containsVersion( version ) ) { - return "org.apache.maven.surefire.testng.conf.TestNG652Configurator"; + return "org.apache.maven.surefire.testng.conf.TestNG60Configurator"; } throw new MojoExecutionException( "Unknown TestNG version " + version ); http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b249b9e0/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNG60Configurator.java ---------------------------------------------------------------------- diff --git a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNG60Configurator.java b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNG60Configurator.java new file mode 100644 index 0000000..531d85e --- /dev/null +++ b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNG60Configurator.java @@ -0,0 +1,53 @@ +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 java.util.Map; +import java.util.Map.Entry; +import org.apache.maven.surefire.testset.TestSetFailedException; + +/** + * TestNG 6.0 configurator. Changed objectFactory type to String. + * Configuring -objectfactory and -testrunfactory. + * + * @author <a href='mailto:marvin[at]marvinformatics[dot]com'>Marvin Froeder</a> + * @since 2.13 + */ +public class TestNG60Configurator + extends TestNG510Configurator +{ + + Map<String, Object> getConvertedOptions( Map<String, String> options ) + throws TestSetFailedException + { + Map<String, Object> convertedOptions = super.getConvertedOptions( options ); + for ( Entry<String, Object> entry : convertedOptions.entrySet() ) + { + String key = entry.getKey(); + if ( "-objectfactory".equals( key ) || "-testrunfactory".equals( key ) ) + { + Class value = (Class) entry.getValue(); + convertedOptions.put( key, value.getName() ); + break; + } + } + return convertedOptions; + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b249b9e0/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNG652Configurator.java ---------------------------------------------------------------------- diff --git a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNG652Configurator.java b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNG652Configurator.java deleted file mode 100644 index e963659..0000000 --- a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNG652Configurator.java +++ /dev/null @@ -1,52 +0,0 @@ -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 java.util.Map; -import java.util.Map.Entry; -import org.apache.maven.surefire.testset.TestSetFailedException; - -/** - * TestNG 6.5.2 configurator. Changed objectFactory type to String - * - * @author <a href='mailto:marvin[at]marvinformatics[dot]com'>Marvin Froeder</a> - * @since 2.13 - */ -public class TestNG652Configurator - extends TestNG510Configurator -{ - - Map<String, Object> getConvertedOptions( Map<String, String> options ) - throws TestSetFailedException - { - Map<String, Object> convertedOptions = super.getConvertedOptions( options ); - for ( Entry<String, Object> entry : convertedOptions.entrySet() ) - { - String key = entry.getKey(); - if ( "-objectfactory".equals( key ) ) - { - Class value = (Class) entry.getValue(); - convertedOptions.put( key, value.getName() ); - break; - } - } - return convertedOptions; - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b249b9e0/surefire-providers/surefire-testng/src/test/java/org/apache/maven/surefire/testng/conf/TestNG60ConfiguratorTest.java ---------------------------------------------------------------------- diff --git a/surefire-providers/surefire-testng/src/test/java/org/apache/maven/surefire/testng/conf/TestNG60ConfiguratorTest.java b/surefire-providers/surefire-testng/src/test/java/org/apache/maven/surefire/testng/conf/TestNG60ConfiguratorTest.java new file mode 100644 index 0000000..2e3af91 --- /dev/null +++ b/surefire-providers/surefire-testng/src/test/java/org/apache/maven/surefire/testng/conf/TestNG60ConfiguratorTest.java @@ -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 java.util.HashMap; +import java.util.Map; + +import junit.framework.TestCase; + +/** + * @author <a href='mailto:marvin[at]marvinformatics[dot]com'>Marvin Froeder</a> + */ +public class TestNG60ConfiguratorTest + extends TestCase +{ + + public void testGetConvertedOptions() + throws Exception + { + TestNGMapConfigurator testNGMapConfigurator = new TestNG60Configurator(); + Map raw = new HashMap(); + raw.put( "objectfactory", "java.lang.String" ); + Map convertedOptions = testNGMapConfigurator.getConvertedOptions( raw ); + String objectfactory = (String) convertedOptions.get( "-objectfactory" ); + assertNotNull( objectfactory ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b249b9e0/surefire-providers/surefire-testng/src/test/java/org/apache/maven/surefire/testng/conf/TestNG652ConfiguratorTest.java ---------------------------------------------------------------------- diff --git a/surefire-providers/surefire-testng/src/test/java/org/apache/maven/surefire/testng/conf/TestNG652ConfiguratorTest.java b/surefire-providers/surefire-testng/src/test/java/org/apache/maven/surefire/testng/conf/TestNG652ConfiguratorTest.java deleted file mode 100644 index 6a0c583..0000000 --- a/surefire-providers/surefire-testng/src/test/java/org/apache/maven/surefire/testng/conf/TestNG652ConfiguratorTest.java +++ /dev/null @@ -1,44 +0,0 @@ -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 java.util.HashMap; -import java.util.Map; - -import junit.framework.TestCase; - -/** - * @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 ); - } -}
