avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject svn commit: rev 53763 - in avalon/trunk/tools/magic: . src/main/org/apache/avalon/tools/tasks
Date Mon, 04 Oct 2004 23:15:13 GMT
Author: niclas
Date: Mon Oct  4 16:15:12 2004
New Revision: 53763

Modified:
   avalon/trunk/tools/magic/build.xml
   avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/JUnitTestTask.java
Log:
Patch from Steve to allow better forking control in JUnit task.

Modified: avalon/trunk/tools/magic/build.xml
==============================================================================
--- avalon/trunk/tools/magic/build.xml	(original)
+++ avalon/trunk/tools/magic/build.xml	Mon Oct  4 16:15:12 2004
@@ -21,6 +21,12 @@
   </target>
   -->
 
+  <!--
+  <target name="build" depends="standard.build">
+    <x:artifact factory="xyz"/>
+  </target>
+  -->
+
   <target name="package" depends="standard.package">
     <x:bar/>
   </target>

Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/JUnitTestTask.java
==============================================================================
--- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/JUnitTestTask.java	(original)
+++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/JUnitTestTask.java	Mon
Oct  4 16:15:12 2004
@@ -62,6 +62,8 @@
     public static final String HALT_ON_ERROR_KEY = "project.test.halt-on-error";
     public static final boolean HALT_ON_ERROR_VALUE = false;
 
+    public static final String TEST_FORK_MODE_KEY = "project.test.fork.mode";
+
     public static final String HALT_ON_FAILURE_KEY = "project.test.halt-on-failure";
     public static final boolean HALT_ON_FAILURE_VALUE = true;
 
@@ -214,7 +216,7 @@
     private void test( final File src, final Path classpath, File working )
     {
         final Project project = getProject();
-        project.log( "MAGIC TEST CLASSPATH: " + classpath, Project.MSG_VERBOSE );
+        log( "Test classpath: " + classpath, Project.MSG_VERBOSE );
 
         final FileSet fileset = new FileSet();
         fileset.setDir( src );
@@ -222,7 +224,7 @@
         final String excludes = getContext().getTestExcludes();
         createIncludes(fileset, includes);
         createExcludes(fileset, excludes);
-        project.log( "MAGIC TEST FILTERS: includes=" + includes + ", excludes=" + excludes,
Project.MSG_VERBOSE );
+        log( "Test filters: includes=" + includes + ", excludes=" + excludes, Project.MSG_VERBOSE
);
 
         final JUnitTask junit = (JUnitTask) getProject().createTask( "junit" );
         junit.init();
@@ -288,12 +290,18 @@
         junit.setErrorProperty( ERROR_KEY );
         junit.setFailureProperty( FAILURE_KEY );
         junit.setTaskName( getTaskName() );
-	if( getForkProperty() )
+	  if( getForkProperty() )
         {
+            JUnitTask.ForkMode mode = getForkMode();
+            log( "Executing forked test with mode: '" + mode + "'." );
             junit.setFork( true );
             junit.setDir( project.getBaseDir() );
+            junit.setForkMode( mode );
+        }
+        else
+        {
+            log( "executing in local jvm" );
         }
-        
         junit.execute();
     }
     
@@ -350,6 +358,19 @@
     private boolean getForkProperty()
     {
         return getBooleanProperty( FORK_KEY, FORK_VALUE );
+    }
+
+    private JUnitTask.ForkMode getForkMode()
+    {
+        final String value = getProject().getProperty( TEST_FORK_MODE_KEY );
+        if( null == value )
+        {
+            return new JUnitTask.ForkMode( JUnitTask.ForkMode.ONCE );
+        }
+        else 
+        {
+            return new JUnitTask.ForkMode( value );
+        }
     }
 
     private boolean getBooleanProperty( final String key, final boolean fallback )

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message