1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| package org.jboss.cache.pojo; |
9 |
| |
10 |
| import junit.framework.TestCase; |
11 |
| import junit.framework.Test; |
12 |
| import junit.framework.TestSuite; |
13 |
| import org.apache.commons.logging.Log; |
14 |
| import org.apache.commons.logging.LogFactory; |
15 |
| import org.jboss.cache.pojo.test.Person; |
16 |
| import org.jboss.cache.pojo.test.ArrayObject; |
17 |
| |
18 |
| |
19 |
| |
20 |
| |
21 |
| |
22 |
| |
23 |
| |
24 |
| public class ArrayTest extends TestCase |
25 |
| { |
26 |
| Log log = LogFactory.getLog(ArrayTest.class); |
27 |
| PojoCache cache_; |
28 |
| |
29 |
2
| public ArrayTest(String name)
|
30 |
| { |
31 |
2
| super(name);
|
32 |
| } |
33 |
| |
34 |
2
| protected void setUp() throws Exception
|
35 |
| { |
36 |
2
| super.setUp();
|
37 |
2
| log.info("setUp() ....");
|
38 |
2
| String configFile = "META-INF/local-service.xml";
|
39 |
2
| boolean toStart = false;
|
40 |
2
| cache_ = PojoCacheFactory.createCache(configFile, toStart);
|
41 |
2
| cache_.start();
|
42 |
| } |
43 |
| |
44 |
2
| protected void tearDown() throws Exception
|
45 |
| { |
46 |
2
| super.tearDown();
|
47 |
2
| cache_.stop();
|
48 |
| } |
49 |
| |
50 |
2
| public void testSimple() throws Exception
|
51 |
| { |
52 |
2
| log.info("testSimple() ....");
|
53 |
2
| ArrayObject ao = new ArrayObject();
|
54 |
2
| Person joe = new Person();
|
55 |
2
| joe.setName("Joe");
|
56 |
2
| joe.setAge(19);
|
57 |
| |
58 |
2
| Person ben = new Person();
|
59 |
2
| ben.setName("Ben");
|
60 |
2
| ben.setAge(19);
|
61 |
| |
62 |
2
| ao.setPerson(0, joe);
|
63 |
| |
64 |
2
| cache_.attach("ao", ao);
|
65 |
| |
66 |
| |
67 |
2
| ao.setPerson(1, ben);
|
68 |
| |
69 |
| } |
70 |
| |
71 |
2
| public static Test suite() throws Exception
|
72 |
| { |
73 |
2
| return new TestSuite(ArrayTest.class);
|
74 |
| } |
75 |
| |
76 |
| |
77 |
0
| public static void main(String[] args) throws Exception
|
78 |
| { |
79 |
0
| junit.textui.TestRunner.run(ArrayTest.suite());
|
80 |
| } |
81 |
| |
82 |
| } |