1 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 23 24 public class ArrayTest extends TestCase 25 { 26 Log log = LogFactory.getLog(ArrayTest.class); 27 PojoCache cache_; 28 29 public ArrayTest(String name) 30 { 31 super(name); 32 } 33 34 protected void setUp() throws Exception 35 { 36 super.setUp(); 37 log.info("setUp() ...."); 38 String 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 45 { 46 super.tearDown(); 47 cache_.stop(); 48 } 49 50 public void testSimple() throws Exception 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 ao.setPerson(1, ben); 68 69 } 70 71 public static Test suite() throws Exception 72 { 73 return new TestSuite(ArrayTest.class); 74 } 75 76 77 public static void main(String [] args) throws Exception 78 { 79 junit.textui.TestRunner.run(ArrayTest.suite()); 80 } 81 82 } 83 | Popular Tags |