1 |
| package org.jboss.cache.loader; |
2 |
| |
3 |
| import junit.framework.Test; |
4 |
| import junit.framework.TestSuite; |
5 |
| import org.jboss.cache.Fqn; |
6 |
| import org.jboss.cache.misc.TestingUtil; |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| public class BdbjeCacheLoaderTest extends CacheLoaderTestsBase |
15 |
| { |
16 |
62
| protected void configureCache() throws Exception
|
17 |
| { |
18 |
62
| String tmpDir = System.getProperty("java.io.tmpdir", "/tmp");
|
19 |
62
| String tmpCLLoc = tmpDir + "/JBossCache-FileCacheLoaderTest";
|
20 |
| |
21 |
62
| cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.bdbje.BdbjeCacheLoader", "location=" + tmpCLLoc, false, true, false));
|
22 |
62
| TestingUtil.recursiveFileRemove(tmpCLLoc);
|
23 |
| } |
24 |
| |
25 |
1
| public void testTransaction() throws Exception
|
26 |
| { |
27 |
| |
28 |
| |
29 |
| |
30 |
1
| Fqn fqn = Fqn.fromString("/a/b/c");
|
31 |
1
| String key = "key", value = "value";
|
32 |
| |
33 |
1
| cache.put(fqn, key, value);
|
34 |
1
| cache.getTransactionManager().begin();
|
35 |
1
| assertEquals(value, cache.get(fqn, key));
|
36 |
1
| cache.getTransactionManager().commit();
|
37 |
| |
38 |
| |
39 |
| |
40 |
1
| cache.getTransactionManager().begin();
|
41 |
1
| assertEquals(value, cache.get(fqn, key));
|
42 |
1
| cache.getTransactionManager().commit();
|
43 |
| } |
44 |
| |
45 |
1
| public static Test suite()
|
46 |
| { |
47 |
1
| return new TestSuite(BdbjeCacheLoaderTest.class);
|
48 |
| } |
49 |
| |
50 |
0
| public static void main(String[] args)
|
51 |
| { |
52 |
0
| junit.textui.TestRunner.run(suite());
|
53 |
| } |
54 |
| |
55 |
| } |