1 22 23 package org.jboss.cache.pojo.collection; 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.pojo.PojoCache; 31 import org.jboss.cache.pojo.PojoCacheFactory; 32 import org.jboss.cache.Fqn; 33 34 import java.util.List ; 35 import java.util.ArrayList ; 36 import java.util.Map ; 37 import java.util.HashMap ; 38 39 44 45 public class CachedMapImplTest extends TestCase 46 { 47 Log log = LogFactory.getLog(CachedMapImplTest.class); 48 PojoCache cache_, cache1_; 49 50 public CachedMapImplTest(String name) 51 { 52 super(name); 53 } 54 55 56 protected void setUp() throws Exception 57 { 58 super.setUp(); 59 log.info("setUp() ...."); 60 String configFile = "META-INF/replSync-service.xml"; 61 boolean toStart = true; 62 cache_ = PojoCacheFactory.createCache(configFile, toStart); 63 64 cache1_ = PojoCacheFactory.createCache(configFile, toStart); 65 } 66 67 protected void tearDown() throws Exception 68 { 69 super.tearDown(); 70 cache_.stop(); 71 cache1_.stop(); 72 } 73 74 public void testSimpleRepl() 75 { 76 Map map = new HashMap (); 77 map.put("1", "1"); 78 map.put("2", "2"); 79 80 cache_.attach("map", map); 81 82 map = (Map )cache_.find("map"); 84 85 cache_.getCache().put(Fqn.fromString("test"), "1", map); 87 88 Map m1 = (Map )cache1_.getCache().get(Fqn.fromString("test"), "1"); 89 System.out.println(" map : " +m1); 90 } 91 92 public static Test suite() throws Exception 93 { 94 return new TestSuite(CachedMapImplTest.class); 95 } 96 97 public static void main(String [] args) throws Exception 98 { 99 junit.textui.TestRunner.run(suite()); 100 } 101 102 } 103 | Popular Tags |