1 25 package org.objectweb.easybeans.tests.common.ejbs.stateful.containermanaged.ejb2view; 26 27 import static org.testng.Assert.assertEquals; 28 29 import java.rmi.RemoteException ; 30 import java.util.List ; 31 32 import javax.ejb.CreateException ; 33 import javax.ejb.EJB ; 34 import javax.ejb.RemoveException ; 35 import javax.ejb.Stateful ; 36 37 import org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackLogger; 38 import org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackType; 39 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.ItfCallbackLoggerAccess; 40 41 47 @Stateful 48 public class SFSBEjb2ClientLifecycle implements ItfEjb2ClientLifecycle { 49 50 53 @EJB (beanName = "SimpleEjb2LifecycleBean") 54 private SimpleEjb2Home beanHome; 55 56 59 @EJB (beanName = "SLSBCallbackLoggerAccess") 60 private ItfCallbackLoggerAccess clBean; 61 62 65 public void verifyPassivate() { 66 throw new RuntimeException ("Test not implemented yet."); 68 } 69 70 73 public void verifyActivate() { 74 throw new RuntimeException ("Test not implemented yet."); 76 } 77 78 84 public void verifyRemove() throws RemoteException , CreateException , RemoveException { 85 List lstResultDelete = clBean.findCallbackEventByCallbackMethod(SimpleEjb2LifecycleBean.class.getName(), 87 CallbackType.PRE_DESTROY, SimpleEjb2LifecycleBean.class.getName()); 88 for (Object obj : lstResultDelete) { 89 CallbackLogger log = (CallbackLogger) obj; 90 clBean.deleteCallbackEvent(log.getId()); 91 } 92 SimpleEjb2 bean = beanHome.create(); 94 95 beanHome.remove(bean); 97 98 List lstResult = clBean.findCallbackEventByCallbackMethod(SimpleEjb2LifecycleBean.class.getName(), 100 CallbackType.PRE_DESTROY, SimpleEjb2LifecycleBean.class.getName()); 101 assertEquals(1, lstResult.size(), "The lifecycle callback was not called or it was called more then once."); 102 } 103 104 } 105 | Popular Tags |