1 package org.jboss.cache.loader; 2 3 import junit.framework.Test; 4 import junit.framework.TestSuite; 5 6 import java.io.File ; 7 import java.io.FileFilter ; 8 9 15 public class JdbmCacheLoaderTest extends CacheLoaderTestsBase 16 { 17 18 private String tmp_location = System.getProperty("java.io.tmpdir", "/tmp"); 19 private File dir = new File (tmp_location); 20 21 public JdbmCacheLoaderTest() 22 { 23 if (!dir.exists()) dir.mkdirs(); 24 } 25 26 protected void configureCache() throws Exception 27 { 28 29 class MyFilter implements FileFilter 30 { 31 public boolean accept(File file) 32 { 33 return file.getName().endsWith(".db"); 34 } 35 } 36 37 File [] files = dir.listFiles(new MyFilter()); 38 if (files != null) 39 { 40 for (int i = 0; i < files.length; i += 1) 41 { 42 File file = files[i]; 43 if (file.isFile()) 44 { 45 if (!file.delete()) 46 { 47 System.err.println("Unable to delete: " + file); 48 } 49 } 50 } 51 } 52 53 cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.jdbm.JdbmCacheLoader", "", false, true, false)); 54 } 55 56 public static Test suite() 57 { 58 return new TestSuite(JdbmCacheLoaderTest.class); 59 } 60 61 public static void main(String [] args) 62 { 63 junit.textui.TestRunner.run(suite()); 64 } 65 66 } 67 | Popular Tags |