1 |
| package org.jboss.cache; |
2 |
| |
3 |
| import junit.framework.Test; |
4 |
| import junit.framework.TestCase; |
5 |
| import junit.framework.TestSuite; |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| public class TreeNodeTest extends TestCase |
14 |
| { |
15 |
| CacheImpl cache; |
16 |
| |
17 |
1
| protected void setUp() throws Exception
|
18 |
| { |
19 |
1
| super.setUp();
|
20 |
1
| cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache();
|
21 |
| } |
22 |
| |
23 |
1
| protected void tearDown() throws Exception
|
24 |
| { |
25 |
1
| super.tearDown();
|
26 |
1
| stopCache(cache);
|
27 |
| } |
28 |
| |
29 |
1
| public void testChildExist() throws Exception
|
30 |
| { |
31 |
1
| Object key = 1;
|
32 |
1
| cache.put("/a/b/c", key, "test");
|
33 |
1
| Node node;
|
34 |
1
| node = cache.get("/a/b");
|
35 |
1
| assertFalse(node.getChildren().isEmpty());
|
36 |
1
| assertTrue(node.getChild(new Fqn("c")) != null);
|
37 |
| |
38 |
1
| Fqn fqn = Fqn.fromString("/e/f");
|
39 |
1
| cache.put(fqn, "1", "1");
|
40 |
1
| node = cache.get("/e");
|
41 |
1
| assertFalse(node.getChildren().isEmpty());
|
42 |
1
| assertTrue(node.getChild(new Fqn("f")) != null);
|
43 |
| |
44 |
| } |
45 |
| |
46 |
| |
47 |
1
| void stopCache(CacheImpl c)
|
48 |
| { |
49 |
1
| c.stop();
|
50 |
1
| c.destroy();
|
51 |
| } |
52 |
| |
53 |
1
| public static Test suite()
|
54 |
| { |
55 |
1
| return new TestSuite(TreeNodeTest.class);
|
56 |
| } |
57 |
| |
58 |
0
| public static void main(String[] args)
|
59 |
| { |
60 |
0
| junit.textui.TestRunner.run(suite());
|
61 |
| } |
62 |
| |
63 |
| } |