Modified: maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/AbstractDirectConfigurator.java URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/AbstractDirectConfigurator.java?rev=1235805&r1=1235804&r2=1235805&view=diff ============================================================================== --- maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/AbstractDirectConfigurator.java (original) +++ maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/AbstractDirectConfigurator.java Wed Jan 25 16:12:14 2012 @@ -27,11 +27,6 @@ import java.util.List; import java.util.Map; import org.apache.maven.surefire.booter.ProviderParameterNames; -import org.apache.maven.surefire.group.match.AndGroupMatcher; -import org.apache.maven.surefire.group.match.GroupMatcher; -import org.apache.maven.surefire.group.parse.GroupMatcherParser; -import org.apache.maven.surefire.group.parse.ParseException; -import org.apache.maven.surefire.testng.group.GroupMatcherMethodSelector; import org.apache.maven.surefire.testset.TestSetFailedException; import org.apache.maven.surefire.util.NestedRuntimeException; import org.testng.TestNG; @@ -56,6 +51,7 @@ public abstract class AbstractDirectConf public void configure( TestNG testng, Map options ) throws TestSetFailedException { + System.out.println( "\n\n\n\nCONFIGURING TESTNG\n\n\n\n" ); // kind of ugly, but listeners are configured differently final String listeners = (String) options.remove( "listener" ); // DGF In 4.7, default listeners dump XML files in the surefire-reports directory, @@ -83,52 +79,6 @@ public abstract class AbstractDirectConf } // TODO: we should have the Profile so that we can decide if this is needed or not testng.setListenerClasses( loadListenerClasses( listeners ) ); - - loadGroupMatcher( testng, options ); - } - - private void loadGroupMatcher( TestNG testng, Map options ) - throws TestSetFailedException - { - String includes = (String) options.get( ProviderParameterNames.TESTNG_GROUPS_PROP ); - String excludes = (String) options.get( ProviderParameterNames.TESTNG_EXCLUDEDGROUPS_PROP ); - - try - { - GroupMatcher in = includes == null ? null : new GroupMatcherParser( includes ).parse(); - GroupMatcher ex = excludes == null ? null : new GroupMatcherParser( excludes ).parse(); - - GroupMatcher matcher = null; - if ( in != null ) - { - if ( ex != null ) - { - matcher = new AndGroupMatcher( new GroupMatcher[] { in, ex } ); - } - else - { - matcher = in; - } - } - else if ( ex != null ) - { - matcher = ex; - } - - if ( matcher != null ) - { - // HORRIBLE hack, but TNG doesn't allow us to setup a method selector instance directly. - // Need some good way of setting the group-matching object / expression, and the test execution - // should always be in-process from this point on... - GroupMatcherMethodSelector.setGroupMatcher( matcher ); - testng.addMethodSelector( GroupMatcherMethodSelector.class.getName(), 0 ); - } - } - catch ( ParseException e ) - { - throw new TestSetFailedException( "Cannot parse group includes/excludes expression(s):\nIncludes: " - + includes + "\nExcludes: " + excludes, e ); - } } public static List loadListenerClasses( String listenerClasses )
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=1235805&r1=1235804&r2=1235805&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 Jan 25 16:12:14 2012 @@ -24,31 +24,29 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.Map; + import org.apache.maven.surefire.booter.ProviderParameterNames; import org.apache.maven.surefire.testset.TestSetFailedException; - import org.testng.TestNG; /** - * TestNG configurator for 5.3+ versions. TestNG exposes - * a {@link org.testng.TestNG#configure(java.util.Map)} method. + * TestNG configurator for 5.3+ versions. TestNG exposes a {@link org.testng.TestNG#configure(java.util.Map)} method. * All suppported TestNG options are passed in String format, except * <code>TestNGCommandLineArgs.LISTENER_COMMAND_OPT</code> which is <code>List>Class<</code>, * <code>TestNGCommandLineArgs.JUNIT_DEF_OPT</code> which is a <code>Boolean</code>, * <code>TestNGCommandLineArgs.SKIP_FAILED_INVOCATION_COUNT_OPT</code> which is a <code>Boolean</code>, * <code>TestNGCommandLineArgs.OBJECT_FACTORY_COMMAND_OPT</code> which is a <code>Class</code>, * <code>TestNGCommandLineArgs.REPORTERS_LIST</code> which is a <code>List>ReporterConfig<</code>. - * * <p/> - * Test classes and/or suite files are not passed along as options parameters, but - * configured separately. - * + * Test classes and/or suite files are not passed along as options parameters, but configured separately. + * * @author <a href='mailto:the[dot]mindstorm[at]gmail[dot]com'>Alex Popescu</a> */ public class TestNGMapConfigurator implements Configurator { - public void configure( TestNG testng, Map options ) throws TestSetFailedException + public void configure( TestNG testng, Map options ) + throws TestSetFailedException { Map convertedOptions = new HashMap(); for ( Iterator it = options.entrySet().iterator(); it.hasNext(); ) @@ -74,7 +72,8 @@ public class TestNGMapConfigurator if ( "junit".equals( key ) ) { val = convert( val, Boolean.class ); - } else if ( "skipfailedinvocationcounts".equals( key ) ) + } + else if ( "skipfailedinvocationcounts".equals( key ) ) { val = convert( val, Boolean.class ); } @@ -94,7 +93,6 @@ public class TestNGMapConfigurator } testng.configure( convertedOptions ); - } // ReporterConfig only became available in later versions of TestNG