1 package org.shiftone.cache.decorator.cluster; 2 3 4 5 import junit.framework.TestCase; 6 import org.shiftone.cache.Cache; 7 import org.shiftone.cache.CacheConfiguration; 8 import org.shiftone.cache.CacheFactory; 9 import org.shiftone.cache.util.Log; 10 11 12 16 public class ClusterTestCase extends TestCase 17 { 18 19 private static final Log LOG = new Log(ClusterTestCase.class); 20 21 public void testCluster() throws Exception 22 { 23 24 CacheConfiguration config = new CacheConfiguration(); 25 CacheFactory factoryA = config.getCacheFactory("clusterA"); 26 CacheFactory factoryB = config.getCacheFactory("clusterB"); 27 Cache oneA = factoryA.newInstance("one", 1000, 1000); 28 Cache oneB = factoryB.newInstance("one", 1000, 1000); 29 30 for (int i = 0; i < 1000; i++) 31 { 32 oneA.addObject("key" + i, "value"); 33 oneB.addObject("key" + i, "value"); 34 } 35 36 for (int i = 0; i < 1000; i++) 37 { 38 oneA.remove("key" + i); 39 } 40 41 LOG.info("sleeping..."); 42 Thread.sleep(2000); 43 } 44 } 45 | Popular Tags |