KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > cache > pojo > ArrayTest


1 /*
2  * JBoss, Home of Professional Open Source
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
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  * Basic PojoCache test case.
20  *
21  * @author Ben Wang
22  */

23
24 public class ArrayTest extends TestCase
25 {
26    Log log = LogFactory.getLog(ArrayTest.class);
27    PojoCache cache_;
28
29    public ArrayTest(String JavaDoc name)
30    {
31       super(name);
32    }
33
34    protected void setUp() throws Exception JavaDoc
35    {
36       super.setUp();
37       log.info("setUp() ....");
38       String JavaDoc configFile = "META-INF/local-service.xml";
39       boolean toStart = false;
40       cache_ = PojoCacheFactory.createCache(configFile, toStart);
41       cache_.start();
42    }
43
44    protected void tearDown() throws Exception JavaDoc
45    {
46       super.tearDown();
47       cache_.stop();
48    }
49
50    public void testSimple() throws Exception JavaDoc
51    {
52       log.info("testSimple() ....");
53       ArrayObject ao = new ArrayObject();
54       Person joe = new Person();
55       joe.setName("Joe");
56       joe.setAge(19);
57
58       Person ben = new Person();
59       ben.setName("Ben");
60       ben.setAge(19);
61
62       ao.setPerson(0, joe);
63
64       cache_.attach("ao", ao);
65
66       // TODO This should trigger a write on team but instead it does a read only. Why?
67
ao.setPerson(1, ben);
68
69    }
70
71    public static Test suite() throws Exception JavaDoc
72    {
73       return new TestSuite(ArrayTest.class);
74    }
75
76
77    public static void main(String JavaDoc[] args) throws Exception JavaDoc
78    {
79       junit.textui.TestRunner.run(ArrayTest.suite());
80    }
81
82 }
83
Popular Tags