[jboss-cvs] JBossAS SVN: r92250 - in branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/cluster: testutil and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Aug 12 00:07:49 EDT 2009


Author: bstansberry at jboss.com
Date: 2009-08-12 00:07:48 -0400 (Wed, 12 Aug 2009)
New Revision: 92250

Modified:
   branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/JBossCacheManagerConfigurationUnitTestCase.java
   branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/SessionCountUnitTestCase.java
   branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/cluster/testutil/CacheConfigTestSetup.java
   branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/cluster/testutil/SessionTestUtil.java
Log:
[JBPAPP-2452] Do a better job cleaning up files

Modified: branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/JBossCacheManagerConfigurationUnitTestCase.java
===================================================================
--- branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/JBossCacheManagerConfigurationUnitTestCase.java	2009-08-12 02:11:09 UTC (rev 92249)
+++ branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/JBossCacheManagerConfigurationUnitTestCase.java	2009-08-12 04:07:48 UTC (rev 92250)
@@ -55,7 +55,6 @@
    private static long testCount = System.currentTimeMillis();
 
    private Set<PojoCache> caches = new HashSet<PojoCache>();
-   private String tempDir;
    
    /**
     * Create a new SessionCountUnitTestCase.
@@ -103,15 +102,6 @@
       }
       
       caches.clear();
-      
-      if (tempDir != null)
-      {
-         File dir = new File(tempDir);
-         if (dir.exists())
-            dir.delete();
-         if (dir.exists())
-            dir.deleteOnExit();
-      }
    }
    
    public void testUseJK() throws Exception

Modified: branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/SessionCountUnitTestCase.java
===================================================================
--- branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/SessionCountUnitTestCase.java	2009-08-12 02:11:09 UTC (rev 92249)
+++ branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/SessionCountUnitTestCase.java	2009-08-12 04:07:48 UTC (rev 92250)
@@ -129,11 +129,7 @@
          
          if (tempDir != null)
          {
-            File dir = new File(tempDir);
-            if (dir.exists())
-               dir.delete();
-            if (dir.exists())
-               dir.deleteOnExit();
+            SessionTestUtil.cleanPassivationDir(new File(tempDir));
          }
       }
    }
@@ -718,11 +714,11 @@
          caches.remove(cache);
          
          passDir = getPassivationDir(testCount, 1);
-         jbcm = SessionTestUtil.createManager("test" + testCount, 5, true, passDir, false, false, null, caches);
+         jbcm = SessionTestUtil.createManager("test" + testCount, 300, true, passDir, false, false, null, caches);
       }
       else
       {
-         jbcm = SessionTestUtil.createManager("test" + testCount, 5, cache, null);
+         jbcm = SessionTestUtil.createManager("test" + testCount, 300, cache, null);
       }
       jbcm.init("test.war", webMetaData);
       

Modified: branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/cluster/testutil/CacheConfigTestSetup.java
===================================================================
--- branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/cluster/testutil/CacheConfigTestSetup.java	2009-08-12 02:11:09 UTC (rev 92249)
+++ branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/cluster/testutil/CacheConfigTestSetup.java	2009-08-12 04:07:48 UTC (rev 92250)
@@ -115,6 +115,11 @@
             }
          }         
       }
+      
+      if (passivationDir != null)
+      {
+    	  SessionTestUtil.cleanPassivationDir(new File(passivationDir));
+      }
    }
 
 }

Modified: branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/cluster/testutil/SessionTestUtil.java
===================================================================
--- branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/cluster/testutil/SessionTestUtil.java	2009-08-12 02:11:09 UTC (rev 92249)
+++ branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/cluster/testutil/SessionTestUtil.java	2009-08-12 04:07:48 UTC (rev 92250)
@@ -21,6 +21,7 @@
  */
 package org.jboss.test.cluster.testutil;
 
+import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
@@ -503,6 +504,24 @@
    {
       return Integer.valueOf(value);
    }
+   
+   public static void cleanPassivationDir(File root)
+   {
+	   if (root.exists())
+	   {
+		   if (root.isDirectory())
+		   {
+			   for (File child : root.listFiles())
+			   {
+				   cleanPassivationDir(child);
+			   }
+		   }
+		   if (!root.delete())
+		   {
+			   root.deleteOnExit();
+		   }
+	   }
+   }
 
    private SessionTestUtil() {}
 }




More information about the jboss-cvs-commits mailing list