1 22 package org.jboss.ejb3.test.regression.ejbthree376.unit; 23 24 import org.jboss.ejb3.test.regression.ejbthree376.StatelessRemote; 25 import org.jboss.ejb3.test.regression.ejbthree376.StatusRemote; 26 import org.jboss.test.JBossTestCase; 27 import junit.framework.Test; 28 29 35 36 public class InterceptorTestCase 37 extends JBossTestCase 38 { 39 org.jboss.logging.Logger log = getLog(); 40 41 static boolean deployed = false; 42 static int test = 0; 43 44 public InterceptorTestCase(String name) 45 { 46 47 super(name); 48 49 } 50 51 public void testInterceptionWithNoSuperClassAroundInvoke() throws Exception 52 { 53 StatelessRemote slWithInterceptor = (StatelessRemote) getInitialContext().lookup("StatelessBean/remote"); 54 StatusRemote status = (StatusRemote)getInitialContext().lookup("StatusBean/remote"); 55 56 status.clear(); 57 slWithInterceptor.method(); 58 assertTrue(status.getInterceptorIntercepted()); 59 assertFalse(status.getBeanIntercepted()); 60 61 status.clear(); 62 slWithInterceptor.superMethod(); 63 assertTrue(status.getInterceptorIntercepted()); 64 assertFalse(status.getBeanIntercepted()); 65 } 66 67 public void testInterceptionWithSuperClassAroundInvoke() throws Exception 68 { 69 StatelessRemote slWithInterceptorAndBean = (StatelessRemote) getInitialContext().lookup("StatelessWithBeanInterceptorBean/remote"); 70 StatusRemote status = (StatusRemote)getInitialContext().lookup("StatusBean/remote"); 71 72 status.clear(); 73 slWithInterceptorAndBean.method(); 74 assertTrue(status.getInterceptorIntercepted()); 75 assertTrue(status.getBeanIntercepted()); 76 77 status.clear(); 78 slWithInterceptorAndBean.superMethod(); 79 assertTrue(status.getInterceptorIntercepted()); 80 assertTrue(status.getBeanIntercepted()); 81 } 82 83 84 public static Test suite() throws Exception 85 { 86 return getDeploySetup(InterceptorTestCase.class, "regression-ejbthree376.jar"); 87 } 88 89 } 90 | Popular Tags |