1 8 9 package org.jboss.test.cache.test.standAloneAop; 10 11 import junit.framework.Test; 12 import junit.framework.TestCase; 13 import junit.framework.TestSuite; 14 import org.jboss.cache.CacheException; 15 import org.jboss.cache.PropertyConfigurator; 16 import org.jboss.cache.TreeCache; 17 import org.jboss.cache.aop.TreeCacheAop; 18 import org.jboss.cache.lock.IsolationLevel; 19 import org.jboss.cache.lock.LockStrategyFactory; 20 import org.jboss.cache.transaction.DummyTransactionManager; 21 22 import javax.naming.Context ; 23 import java.util.ArrayList ; 24 import java.util.Properties ; 25 import java.util.Random ; 26 27 28 34 public class CollectionProxyAopTest extends TestCase 35 { 36 static TreeCacheAop cache_; 37 int cachingMode_ = TreeCache.LOCAL; 38 39 public CollectionProxyAopTest(String name) 40 { 41 super(name); 42 } 43 44 public void setUp() throws Exception 45 { 46 super.setUp(); 47 initCaches(TreeCache.LOCAL); 48 49 log("LocalConcurrentTestCase: cacheMode=TRANSIENT, one cache"); 50 } 51 52 public void tearDown() throws Exception 53 { 54 super.tearDown(); 55 destroyCaches(); 56 } 57 58 void initCaches(int caching_mode) throws Exception 59 { 60 cachingMode_ = caching_mode; 61 cache_ = new TreeCacheAop(); 62 PropertyConfigurator config = new PropertyConfigurator(); 63 config.configure(cache_, "META-INF/local-aop-eviction-service.xml"); cache_.createService(); 65 cache_.startService(); 66 } 67 68 void destroyCaches() throws Exception 69 { 70 cache_.stopService(); 71 cache_ = null; 72 } 73 74 public void testListSubClass() throws Exception 75 { 76 String node = "/aop/list"; 77 MyList list = new MyList(); 78 list.add("Ben"); 79 cache_.putObject(node, list); 80 } 81 82 public static Test suite() throws Exception 83 { 84 return new TestSuite(CollectionProxyAopTest.class); 85 } 86 87 private static void log(String str) 88 { 89 System.out.println("Thread: " + Thread.currentThread() + ": " + str); 90 } 92 93 public static class MyList extends ArrayList 94 { 95 public MyList() 96 { 97 super(); 98 } 99 } 101 } 102 | Popular Tags |