1 7 package org.jboss.test.aop.regression.jbaop217typedefredeploy; 8 9 10 import java.net.URL ; 11 12 import org.jboss.aop.AspectXmlLoader; 13 import org.jboss.test.aop.AOPTestWithSetup; 14 15 import junit.framework.Test; 16 import junit.framework.TestSuite; 17 18 24 public class TypeDefRedeployTestCase extends AOPTestWithSetup 25 { 26 public static Test suite() 27 { 28 TestSuite suite = new TestSuite("TypeDefRedeployTestCase"); 29 suite.addTestSuite(TypeDefRedeployTestCase.class); 30 return suite; 31 } 32 33 public TypeDefRedeployTestCase(String name) 34 { 35 super(name); 36 } 37 38 public void testRedeployWithTypeDef() throws Exception 39 { 40 POJO pojo = new POJO(); 41 42 TestInterceptor.intercepted = false; 43 pojo.method(); 44 assertTrue(TestInterceptor.intercepted); 45 46 URL url = getUrl(); 47 AspectXmlLoader.undeployXML(url); 48 49 TestInterceptor.intercepted = false; 50 pojo.method(); 51 assertFalse(TestInterceptor.intercepted); 52 53 AspectXmlLoader.deployXML(url); 54 55 TestInterceptor.intercepted = false; 56 pojo.method(); 57 assertTrue(TestInterceptor.intercepted); 58 } 59 60 private URL getUrl() throws Exception 61 { 62 URL url = this.getClass().getProtectionDomain().getCodeSource().getLocation(); 63 System.out.println("class url: " + url); 64 String location = url.toString(); 65 int index = location.indexOf("/output/"); 66 location = location.substring(0, index); 67 68 location = location + "/src/resources/test/regression/jboss-aop.xml"; 69 url = new URL (location); 70 System.out.println("xml url: " + url); 71 return url; 72 } 73 } 74 75 | Popular Tags |