[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/loader ...
Manik Surtani
msurtani at jboss.com
Thu Feb 1 11:33:10 EST 2007
User: msurtani
Date: 07/02/01 11:33:10
Modified: tests/functional/org/jboss/cache/loader
JdbmCacheLoaderTest.java FileCacheLoaderTest.java
BdbjeCacheLoaderTest.java
ChainingCacheLoaderFullTest.java
Log:
Updated to clean up tmp dirs before running test
Revision Changes Path
1.7 +7 -36 JBossCache/tests/functional/org/jboss/cache/loader/JdbmCacheLoaderTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: JdbmCacheLoaderTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/loader/JdbmCacheLoaderTest.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- JdbmCacheLoaderTest.java 6 Nov 2006 23:34:09 -0000 1.6
+++ JdbmCacheLoaderTest.java 1 Feb 2007 16:33:10 -0000 1.7
@@ -6,51 +6,22 @@
import java.io.File;
import java.io.FileFilter;
+import org.jboss.cache.misc.TestingUtil;
+
/**
* Tests {@link org.jboss.cache.loader.jdbm.JdbmCacheLoader}.
*
* @author Elias Ross
- * @version $Id: JdbmCacheLoaderTest.java,v 1.6 2006/11/06 23:34:09 genman Exp $
+ * @version $Id: JdbmCacheLoaderTest.java,v 1.7 2007/02/01 16:33:10 msurtani Exp $
*/
public class JdbmCacheLoaderTest extends CacheLoaderTestsBase
{
-
- private String tmp_location = System.getProperty("java.io.tmpdir", "/tmp");
- private File dir = new File(tmp_location);
-
- public JdbmCacheLoaderTest()
- {
- if (!dir.exists()) dir.mkdirs();
- }
-
protected void configureCache() throws Exception
{
-
- class MyFilter implements FileFilter
- {
- public boolean accept(File file)
- {
- return file.getName().endsWith(".db");
- }
- }
-
- File[] files = dir.listFiles(new MyFilter());
- if (files != null)
- {
- for (int i = 0; i < files.length; i += 1)
- {
- File file = files[i];
- if (file.isFile())
- {
- if (!file.delete())
- {
- System.err.println("Unable to delete: " + file);
- }
- }
- }
- }
-
- cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.jdbm.JdbmCacheLoader", "", false, true, false));
+ String tmpDir = System.getProperty("java.io.tmpdir", "/tmp");
+ String tmpCLLoc = tmpDir + "/JBossCache-FileCacheLoaderTest";
+ cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.jdbm.JdbmCacheLoader", "location=" + tmpCLLoc, false, true, false));
+ TestingUtil.recursiveFileRemove(tmpCLLoc);
}
public static Test suite()
1.12 +5 -2 JBossCache/tests/functional/org/jboss/cache/loader/FileCacheLoaderTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: FileCacheLoaderTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/loader/FileCacheLoaderTest.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- FileCacheLoaderTest.java 16 Nov 2006 17:24:46 -0000 1.11
+++ FileCacheLoaderTest.java 1 Feb 2007 16:33:10 -0000 1.12
@@ -3,6 +3,7 @@
import junit.framework.Test;
import junit.framework.TestSuite;
import org.jboss.cache.Fqn;
+import org.jboss.cache.misc.TestingUtil;
/**
* Created by IntelliJ IDEA.
@@ -12,10 +13,12 @@
*/
public class FileCacheLoaderTest extends CacheLoaderTestsBase
{
-
protected void configureCache() throws Exception
{
- cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.FileCacheLoader", "", false, true, false));
+ String tmpDir = System.getProperty("java.io.tmpdir", "/tmp");
+ String tmpCLLoc = tmpDir + "/JBossCache-FileCacheLoaderTest";
+ cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.FileCacheLoader", "location=" + tmpCLLoc, false, true, false));
+ TestingUtil.recursiveFileRemove(tmpCLLoc);
}
public void testIsCharacterPortableLocation()
1.19 +10 -30 JBossCache/tests/functional/org/jboss/cache/loader/BdbjeCacheLoaderTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BdbjeCacheLoaderTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/loader/BdbjeCacheLoaderTest.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- BdbjeCacheLoaderTest.java 6 Nov 2006 23:34:09 -0000 1.18
+++ BdbjeCacheLoaderTest.java 1 Feb 2007 16:33:10 -0000 1.19
@@ -6,42 +6,22 @@
import java.io.File;
import java.io.FileFilter;
+import org.jboss.cache.misc.TestingUtil;
+
/**
* Runs the same tests as {@link FileCacheLoaderTest}, but with Berkeley DB instead of a file-based CacheLoader
* @author Bela Ban
- * @version $Id: BdbjeCacheLoaderTest.java,v 1.18 2006/11/06 23:34:09 genman Exp $
+ * @version $Id: BdbjeCacheLoaderTest.java,v 1.19 2007/02/01 16:33:10 msurtani Exp $
*/
-public class BdbjeCacheLoaderTest extends CacheLoaderTestsBase {
-
- private String tmp_location = System.getProperty("java.io.tmpdir", "c:\\tmp");
- private File dir = new File(tmp_location);
-
- public BdbjeCacheLoaderTest()
+public class BdbjeCacheLoaderTest extends CacheLoaderTestsBase
+{
+ protected void configureCache() throws Exception
{
- if (!dir.exists()) dir.mkdirs();
- }
-
- protected void configureCache() throws Exception {
-
- class MyFilter implements FileFilter {
- public boolean accept(File file) {
- return file.getName().endsWith(".jdb");
- }
- }
-
- File[] files=dir.listFiles(new MyFilter());
- if (files != null) {
- for (int i = 0; i < files.length; i += 1) {
- File file = files[i];
- if (file.isFile()) {
- if (!file.delete()) {
- System.err.println("Unable to delete: " + file);
- }
- }
- }
- }
+ String tmpDir = System.getProperty("java.io.tmpdir", "/tmp");
+ String tmpCLLoc = tmpDir + "/JBossCache-FileCacheLoaderTest";
- cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.bdbje.BdbjeCacheLoader", "", false, true, false));
+ cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.bdbje.BdbjeCacheLoader", "location=" + tmpCLLoc, false, true, false));
+ TestingUtil.recursiveFileRemove(tmpCLLoc);
}
public static Test suite() {
1.12 +5 -0 JBossCache/tests/functional/org/jboss/cache/loader/ChainingCacheLoaderFullTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ChainingCacheLoaderFullTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/loader/ChainingCacheLoaderFullTest.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- ChainingCacheLoaderFullTest.java 11 Jan 2007 13:49:06 -0000 1.11
+++ ChainingCacheLoaderFullTest.java 1 Feb 2007 16:33:10 -0000 1.12
@@ -13,6 +13,7 @@
import org.jboss.cache.CacheImpl;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
+import org.jboss.cache.misc.TestingUtil;
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.factories.XmlConfigurationParser;
import org.jboss.cache.xml.XmlHelper;
@@ -52,6 +53,10 @@
{
cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(loc1, loc2, ignoreMods1, ignoreMods2));
+
+ TestingUtil.recursiveFileRemove(loc1);
+ TestingUtil.recursiveFileRemove(loc2);
+
cache.getConfiguration().setCacheMode("local");
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
cache.start();
More information about the jboss-cvs-commits
mailing list