[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/passivation ...
Manik Surtani
msurtani at jboss.com
Tue Oct 31 12:33:36 EST 2006
User: msurtani
Date: 06/10/31 12:33:36
Modified: tests/functional/org/jboss/cache/passivation
ConcurrentPassivationTest.java
Log:
Added file location + cleanup
Revision Changes Path
1.3 +24 -8 JBossCache/tests/functional/org/jboss/cache/passivation/ConcurrentPassivationTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ConcurrentPassivationTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/passivation/ConcurrentPassivationTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- ConcurrentPassivationTest.java 26 Oct 2006 04:06:12 -0000 1.2
+++ ConcurrentPassivationTest.java 31 Oct 2006 17:33:35 -0000 1.3
@@ -10,16 +10,18 @@
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-
import org.jboss.cache.Fqn;
import org.jboss.cache.TreeCache;
import org.jboss.cache.factories.XmlConfigurationParser;
+import org.jboss.cache.loader.FileCacheLoaderConfig;
+
+import java.io.File;
/**
* Tests cache behavior in the presence of concurrent passivation.
*
* @author Brian Stansberry
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class ConcurrentPassivationTest extends TestCase
{
@@ -43,6 +45,7 @@
void initCaches() throws Exception
{
+ removeStaleFiles();
cache_ = new TreeCache();
cache_.setConfiguration(new XmlConfigurationParser().parseFile("META-INF/local-passivation-service.xml")); // read in generic local xml
cache_.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
@@ -52,7 +55,20 @@
public void tearDown() throws Exception
{
super.tearDown();
+ removeStaleFiles();
cache_.stop();
+ cache_ = null;
+ }
+
+ private void removeStaleFiles()
+ {
+ File file = new File(cache_ == null ? "/tmp/JBossCacheFileCacheLoader" : ((FileCacheLoaderConfig) cache_.getCacheLoader().getConfig()).getLocation());
+ if (file.exists())
+ {
+ System.out.println("Deleting file " + file);
+ file.deleteOnExit();
+ System.out.println(file.delete());
+ }
}
public void testConcurrentPassivation() throws Exception
More information about the jboss-cvs-commits
mailing list