01: package org.shiftone.cache.test;
02:
03: import junit.framework.TestCase;
04:
05: import org.shiftone.cache.Cache;
06: import org.shiftone.cache.CacheFactory;
07: import org.shiftone.cache.CacheProxy;
08: import org.shiftone.cache.policy.single.SingleCacheFactory;
09:
10: import java.util.ArrayList;
11: import java.util.List;
12:
13: public class ProxyTestCase extends TestCase {
14:
15: public void testProxy() throws Exception {
16:
17: List list = new ArrayList();
18: CacheFactory factory = new SingleCacheFactory();
19: Cache cache = factory.newInstance("proxyTest", 1000, 1);
20: List plist = (List) CacheProxy.newProxyInstance(list,
21: List.class, cache);
22:
23: System.out.println(plist.size());
24: System.out.println(plist.add("test1"));
25: System.out.println(plist.add("test2"));
26: System.out.println(plist.add("test1"));
27: System.out.println(plist.size());
28: System.out.println(plist.size());
29: System.out.println(plist.size());
30: }
31: }
|