1 7 package org.jboss.test.cache.test.standAloneAop; 8 9 import junit.framework.Test; 10 import junit.framework.TestCase; 11 import junit.framework.TestSuite; 12 import org.jboss.logging.Logger; 13 import org.jboss.cache.aop.CachedMapInterceptor; 14 import org.jboss.cache.aop.TreeCacheAop; 15 import org.jboss.cache.PropertyConfigurator; 16 import org.jboss.aop.proxy.ClassProxy; 17 18 import java.util.Set ; 19 import java.util.Map ; 20 import java.util.HashMap ; 21 22 23 28 29 public class NonAspectizedAopTest extends TestCase 30 { 31 Logger log_ = Logger.getLogger(NonAspectizedAopTest.class); 32 TreeCacheAop cache_; 33 34 public NonAspectizedAopTest(String name) 35 { 36 super(name); 37 } 38 39 protected void setUp() throws Exception 40 { 41 super.setUp(); 42 log_.info("setUp() ...."); 43 String configFile = "META-INF/local-service.xml"; 44 cache_ = new TreeCacheAop(); 45 PropertyConfigurator config = new PropertyConfigurator(); 46 config.configure(cache_, configFile); cache_.start(); 48 } 49 50 protected void tearDown() throws Exception 51 { 52 super.tearDown(); 53 cache_.stop(); 54 } 55 56 58 public void testPutPrimitive() throws Exception 59 { 60 log_.info("testPutPrimitive() ...."); 61 String test = "test"; 62 cache_.putObject("/a", test); 63 String result = (String )cache_.getObject("/a"); 64 assertEquals("test string ", "test", result); 65 cache_.removeObject("/a"); 66 assertNull("Object should be null ", cache_.getObject("/a")); 67 } 68 69 public void testPutSerializable() throws Exception 70 { 71 log_.info("testPutSerializable() ...."); 72 SerializedAddress test = new SerializedAddress(); 73 test.setCity("Sunnyvale"); 74 test.setZip(94086); 75 cache_.putObject("/a", test); 76 SerializedAddress result = (SerializedAddress)cache_.getObject("/a"); 77 assertEquals("test SerializedAddress ", test, result); 78 cache_.removeObject("/a"); 79 assertNull("Object should be null ", cache_.getObject("/a")); 80 } 81 82 public static Test suite() throws Exception 83 { 84 return new TestSuite(NonAspectizedAopTest.class); 85 } 86 87 88 public static void main(String [] args) throws Exception 89 { 90 junit.textui.TestRunner.run(suite()); 91 } 92 93 } 94 95 | Popular Tags |