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 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| public class BdbjeCacheLoaderTest extends CacheLoaderTestsBase { |
15 |
| |
16 |
| private String tmp_location = System.getProperty("java.io.tmpdir", "c:\\tmp"); |
17 |
| private File dir = new File(tmp_location); |
18 |
| |
19 |
59
| public BdbjeCacheLoaderTest()
|
20 |
| { |
21 |
0
| if (!dir.exists()) dir.mkdirs();
|
22 |
| } |
23 |
| |
24 |
59
| protected void configureCache() throws Exception {
|
25 |
| |
26 |
| class MyFilter implements FileFilter { |
27 |
4130
| public boolean accept(File file) {
|
28 |
4130
| return file.getName().endsWith(".jdb");
|
29 |
| } |
30 |
| } |
31 |
| |
32 |
59
| File[] files=dir.listFiles(new MyFilter());
|
33 |
59
| if (files != null) {
|
34 |
59
| for (int i = 0; i < files.length; i += 1) {
|
35 |
59
| File file = files[i];
|
36 |
59
| if (file.isFile()) {
|
37 |
59
| if (!file.delete()) {
|
38 |
0
| System.err.println("Unable to delete: " + file);
|
39 |
| } |
40 |
| } |
41 |
| } |
42 |
| } |
43 |
| |
44 |
59
| cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.bdbje.BdbjeCacheLoader", "", false, true, false));
|
45 |
| } |
46 |
| |
47 |
1
| public static Test suite() {
|
48 |
1
| return new TestSuite(BdbjeCacheLoaderTest.class);
|
49 |
| } |
50 |
| |
51 |
0
| public static void main(String[] args)
|
52 |
| { |
53 |
0
| junit.textui.TestRunner.run(suite());
|
54 |
| } |
55 |
| |
56 |
| } |