1 25 package org.objectweb.easybeans.tests.interceptors.lifecycle.messagedriven.containermanaged; 26 27 import static org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackType.POST_CONSTRUCT; 28 import static org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackType.PRE_DESTROY; 29 import static org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType.UNDEFINED; 30 import static org.objectweb.easybeans.tests.common.helper.EJBHelper.getBeanRemoteInstance; 31 32 import java.util.ArrayList ; 33 import java.util.List ; 34 35 import org.objectweb.easybeans.tests.common.ejbs.mdb.containermanaged.lifecallback.MDBLifecycle00; 36 import org.objectweb.easybeans.tests.common.ejbs.mdb.containermanaged.lifecallback.PostConstructMDB; 37 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.ItfCallbackLoggerAccess; 38 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.SLSBCallbackLoggerAccess; 39 import org.objectweb.easybeans.tests.common.interceptors.lifecycle.predestroy.PreDestroyLogger00; 40 import org.objectweb.easybeans.tests.common.jms.JMSManager; 41 import org.testng.annotations.AfterClass; 42 import org.testng.annotations.BeforeClass; 43 import org.testng.annotations.Test; 44 45 46 55 public class TestMDBAllCallback { 56 57 60 private JMSManager jmsQueue; 61 62 65 private ItfCallbackLoggerAccess beanLogger; 66 67 71 @BeforeClass 72 public void startUp00() throws Exception { 73 jmsQueue = new JMSManager(JMSManager.DEFAULT_QUEUE_CONNECTION_FACTORY, JMSManager.DEFAULT_QUEUE); 74 beanLogger = getBeanRemoteInstance(SLSBCallbackLoggerAccess.class, ItfCallbackLoggerAccess.class); 75 jmsQueue.sendControlMessage(MDBLifecycle00.MESSAGE_TYPE, UNDEFINED); 76 } 77 78 84 @Test 85 public void testPostConstruct() throws Exception { 86 List <String > arLife = new ArrayList <String >(); 88 89 arLife.add(PostConstructMDB.class.getName()); 90 arLife.add(MDBLifecycle00.class.getName()); 91 92 beanLogger.verifyCallbackOrder(MDBLifecycle00.class, POST_CONSTRUCT, 93 arLife.toArray(new String [0])); 94 } 95 96 102 public void testPreDestroy() throws Exception { 104 105 106 List <String > arLife = new ArrayList <String >(); 108 109 arLife.add(PreDestroyLogger00.class.getName()); 110 arLife.add(MDBLifecycle00.class.getName()); 111 112 beanLogger.verifyCallbackOrder(MDBLifecycle00.class, PRE_DESTROY, 113 arLife.toArray(new String [0])); 114 } 115 116 120 @AfterClass 121 public void tearDown() throws Exception { 122 beanLogger.deleteAll(); 123 jmsQueue.close(); 124 } 125 } 126 | Popular Tags |