01: package org.shiftone.cache.decorator.cluster;
02:
03: import junit.framework.TestCase;
04: import org.shiftone.cache.Cache;
05: import org.shiftone.cache.CacheConfiguration;
06: import org.shiftone.cache.CacheFactory;
07: import org.shiftone.cache.util.Log;
08:
09: /**
10: * @version $Revision: 1.4 $
11: * @author <a href="mailto:jeff@shiftone.org">Jeff Drost</a>
12: */
13: public class ClusterTestCase extends TestCase {
14:
15: private static final Log LOG = new Log(ClusterTestCase.class);
16:
17: public void testCluster() throws Exception {
18:
19: CacheConfiguration config = new CacheConfiguration();
20: CacheFactory factoryA = config.getCacheFactory("clusterA");
21: CacheFactory factoryB = config.getCacheFactory("clusterB");
22: Cache oneA = factoryA.newInstance("one", 1000, 1000);
23: Cache oneB = factoryB.newInstance("one", 1000, 1000);
24:
25: for (int i = 0; i < 1000; i++) {
26: oneA.addObject("key" + i, "value");
27: oneB.addObject("key" + i, "value");
28: }
29:
30: for (int i = 0; i < 1000; i++) {
31: oneA.remove("key" + i);
32: }
33:
34: LOG.info("sleeping...");
35: Thread.sleep(2000);
36: }
37: }
|