]> source.dussan.org Git - poi.git/commitdiff
set forkmode=once for junit tests, it made the build process faster by 5x
authorYegor Kozlov <yegor@apache.org>
Fri, 10 Apr 2009 06:44:54 +0000 (06:44 +0000)
committerYegor Kozlov <yegor@apache.org>
Fri, 10 Apr 2009 06:44:54 +0000 (06:44 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@763881 13f79535-47bb-0310-9956-ffa450edef68

build.xml
src/testcases/org/apache/poi/poifs/storage/TestRawDataBlock.java
src/testcases/org/apache/poi/poifs/storage/TestRawDataBlockList.java

index db8c88ea82b3b90746cdf1fd6b1daa4c65661268..4f98d063947a14a739e99377ade46bd88cd660c8 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -562,7 +562,7 @@ under the License.
 
   <target name="test-main" unless="main.test.notRequired"
     depends="compile-main, -test-main-check, fail-unless-junit-is-available">
-    <junit fork="yes" printsummary="yes" haltonfailure="${halt.on.test.failure}"
+    <junit fork="yes" forkmode="once" printsummary="yes" haltonfailure="${halt.on.test.failure}"
       failureproperty="main.test.failed" showoutput="true">
       <classpath refid="test.classpath"/>
       <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/> 
@@ -676,7 +676,7 @@ under the License.
     </target>
 
     <target name="test-scratchpad" depends="compile-main,compile-scratchpad,-test-scratchpad-check" unless="scratchpad.test.notRequired">
-        <junit printsummary="yes" fork="yes" haltonfailure="${halt.on.test.failure}" failureproperty="scratchpad.test.failed">
+        <junit printsummary="yes" fork="yes" forkmode="once" haltonfailure="${halt.on.test.failure}" failureproperty="scratchpad.test.failed">
             <classpath>
                 <path refid="scratchpad.classpath"/>
                 <pathelement location="${main.output.dir}"/>
@@ -782,7 +782,7 @@ under the License.
     </target>
 
     <target name="test-ooxml" depends="compile-main,compile-ooxml,-test-ooxml-check" unless="ooxml.test.notRequired">
-        <junit printsummary="yes" fork="yes" haltonfailure="${halt.on.test.failure}" failureproperty="ooxml.test.failed">
+        <junit printsummary="yes" fork="yes" forkmode="once" haltonfailure="${halt.on.test.failure}" failureproperty="ooxml.test.failed">
             <classpath refid="test.ooxml.classpath" />
             <sysproperty key="POIFS.testdata.path" file="${main.src.test}/org/apache/poi/poifs/data"/>
             <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
index a4cdb734a602f71bd309bbf4bbdec7ba9067a2d1..4447ceed5d9e8b9922ba00ef98e0a8acfe9aaf54 100644 (file)
@@ -21,9 +21,9 @@ package org.apache.poi.poifs.storage;
 
 import java.io.*;
 import java.util.Random;
+import java.lang.reflect.Field;
 
 import org.apache.poi.util.DummyPOILogger;
-import org.apache.poi.util.POILogFactory;
 
 import junit.framework.*;
 
@@ -115,9 +115,10 @@ public class TestRawDataBlock
     public void testShortConstructor() throws Exception
     {
         // Get the logger to be used
-        DummyPOILogger logger = (DummyPOILogger)POILogFactory.getLogger(
-                       RawDataBlock.class
-        );
+        DummyPOILogger logger = new DummyPOILogger();
+        Field fld = RawDataBlock.class.getDeclaredField("log");
+        fld.setAccessible(true);
+        fld.set(null, logger);
         assertEquals(0, logger.logged.size());
         
         // Test for various data sizes
@@ -168,9 +169,10 @@ public class TestRawDataBlock
      */
     public void testSlowInputStream() throws Exception {
         // Get the logger to be used
-        DummyPOILogger logger = (DummyPOILogger)POILogFactory.getLogger(
-                       RawDataBlock.class
-        );
+        DummyPOILogger logger = new DummyPOILogger();
+        Field fld = RawDataBlock.class.getDeclaredField("log");
+        fld.setAccessible(true);
+        fld.set(null, logger);
         assertEquals(0, logger.logged.size());
         
         // Test for various ok data sizes
index 0f65c0e8a4421ac4f4830f1616d374ca8c674888..81ee0501c4e42a42eda96c9da4f22cf0b6790c44 100644 (file)
 package org.apache.poi.poifs.storage;
 
 import java.io.*;
+import java.lang.reflect.Field;
 
 import org.apache.poi.poifs.common.POIFSConstants;
 import org.apache.poi.util.DummyPOILogger;
-import org.apache.poi.util.POILogFactory;
 
 import junit.framework.*;
 
@@ -91,9 +91,10 @@ public class TestRawDataBlockList
     public void testShortConstructor() throws Exception
     {
         // Get the logger to be used
-        DummyPOILogger logger = (DummyPOILogger)POILogFactory.getLogger(
-                       RawDataBlock.class
-        );
+        DummyPOILogger logger = new DummyPOILogger();
+        Field fld = RawDataBlock.class.getDeclaredField("log");
+        fld.setAccessible(true);
+        fld.set(null, logger);
         assertEquals(0, logger.logged.size());
         
         // Test for various short sizes