1 package org.jboss.cache.pojo.collection; 2 3 import junit.framework.Test; 4 import junit.framework.TestCase; 5 import junit.framework.TestSuite; 6 import org.apache.commons.logging.Log; 7 import org.apache.commons.logging.LogFactory; 8 import org.jboss.cache.pojo.PojoCache; 9 import org.jboss.cache.pojo.PojoCacheFactory; 10 import org.jboss.cache.Fqn; 11 12 import java.util.List ; 13 import java.util.ArrayList ; 14 15 20 21 public class CachedListImplTest extends TestCase 22 { 23 Log log = LogFactory.getLog(CachedListImplTest.class); 24 PojoCache cache_, cache1_; 25 26 public CachedListImplTest(String name) 27 { 28 super(name); 29 } 30 31 32 protected void setUp() throws Exception 33 { 34 super.setUp(); 35 log.info("setUp() ...."); 36 String configFile = "META-INF/replSync-service.xml"; 37 boolean toStart = true; 38 cache_ = PojoCacheFactory.createCache(configFile, toStart); 39 40 cache1_ = PojoCacheFactory.createCache(configFile, toStart); 41 } 42 43 protected void tearDown() throws Exception 44 { 45 super.tearDown(); 46 cache_.stop(); 47 cache1_.stop(); 48 } 49 50 public void testSimpleRepl() 51 { 52 List list = new ArrayList (); 53 list.add("1"); 54 list.add("2"); 55 56 cache_.attach("list", list); 57 58 list = (List )cache_.find("list"); 60 61 cache_.getCache().put(Fqn.fromString("test"), "1", list); 63 64 ArrayList l1 = (ArrayList )cache1_.getCache().get(Fqn.fromString("test"), "1"); 65 System.out.println(" list : " +l1); 66 } 67 68 public static Test suite() throws Exception 69 { 70 return new TestSuite(CachedListImplTest.class); 71 } 72 73 public static void main(String [] args) throws Exception 74 { 75 junit.textui.TestRunner.run(suite()); 76 } 77 78 } 79 80 | Popular Tags |