1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| |
16 |
| |
17 |
| |
18 |
| |
19 |
| |
20 |
| |
21 |
| |
22 |
| |
23 |
| package org.jboss.cache.pojo; |
24 |
| |
25 |
| import junit.framework.TestCase; |
26 |
| import junit.framework.Test; |
27 |
| import junit.framework.TestSuite; |
28 |
| import org.apache.commons.logging.Log; |
29 |
| import org.apache.commons.logging.LogFactory; |
30 |
| import org.jboss.cache.config.Configuration.CacheMode; |
31 |
| import org.jboss.cache.factories.UnitTestCacheFactory; |
32 |
| import org.jboss.cache.pojo.test.ArrayObject; |
33 |
| import org.jboss.cache.pojo.test.Person; |
34 |
| import org.jboss.cache.pojo.test.EnumPlanet; |
35 |
| |
36 |
| |
37 |
| |
38 |
| |
39 |
| |
40 |
| |
41 |
| |
42 |
| public class EnumTest extends TestCase |
43 |
| { |
44 |
| Log log = LogFactory.getLog(EnumTest.class); |
45 |
| PojoCache cache_, cache1_; |
46 |
| |
47 |
2
| public EnumTest(String name)
|
48 |
| { |
49 |
2
| super(name);
|
50 |
| } |
51 |
| |
52 |
2
| protected void setUp() throws Exception
|
53 |
| { |
54 |
2
| super.setUp();
|
55 |
2
| log.info("setUp() ....");
|
56 |
2
| boolean toStart = true;
|
57 |
2
| cache_ = PojoCacheFactory.createCache(UnitTestCacheFactory.createConfiguration(CacheMode.REPL_SYNC), toStart);
|
58 |
2
| cache1_ = PojoCacheFactory.createCache(UnitTestCacheFactory.createConfiguration(CacheMode.REPL_SYNC), toStart);
|
59 |
| } |
60 |
| |
61 |
2
| protected void tearDown() throws Exception
|
62 |
| { |
63 |
2
| super.tearDown();
|
64 |
2
| cache_.stop();
|
65 |
2
| cache1_.stop();
|
66 |
| } |
67 |
| |
68 |
2
| public void testSimple() throws Exception
|
69 |
| { |
70 |
2
| log.info("testSimple() ....");
|
71 |
| |
72 |
2
| double earthWeight = 165;
|
73 |
2
| double mass = earthWeight / EnumPlanet.EARTH.surfaceGravity();
|
74 |
| |
75 |
2
| cache_.attach("enum", EnumPlanet.EARTH);
|
76 |
| |
77 |
2
| EnumPlanet ep = (EnumPlanet)cache1_.find("enum");
|
78 |
| |
79 |
2
| EnumPlanet.EARTH.setMass(7.0e+24);
|
80 |
| |
81 |
2
| assertEquals("Earth mass ", EnumPlanet.EARTH.mass(), ep.mass());
|
82 |
| } |
83 |
| |
84 |
2
| public static Test suite() throws Exception
|
85 |
| { |
86 |
2
| return new TestSuite(EnumTest.class);
|
87 |
| } |
88 |
| |
89 |
| |
90 |
0
| public static void main(String[] args) throws Exception
|
91 |
| { |
92 |
0
| junit.textui.TestRunner.run(suite());
|
93 |
| } |
94 |
| |
95 |
| } |