1 25 package org.objectweb.easybeans.tests.messagedriven.beanmanaged.context; 26 27 import static org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackType.ON_MESSAGE; 28 import static org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType.GET_CALLER_PRINCIPAL; 29 import static org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType.GET_ROLLBACK_ONLY; 30 import static org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType.SET_ROLLBACK_ONLY; 31 import static org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType.TIMER; 32 import static org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType.USER_TRANSACTION; 33 34 import org.objectweb.easybeans.tests.common.ejbs.mdb.beanmanaged.context.MDBBeanManagedContext; 35 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.OperationChecker; 36 import org.objectweb.easybeans.tests.common.jms.JMSManager; 37 import org.testng.annotations.AfterClass; 38 import org.testng.annotations.AfterMethod; 39 import org.testng.annotations.BeforeClass; 40 import org.testng.annotations.BeforeMethod; 41 import org.testng.annotations.Test; 42 43 52 public class TestMDBBeanManagedContext { 53 54 57 private JMSManager jmsQueue; 58 59 62 private OperationChecker checker; 63 64 68 @BeforeClass 69 public void startUp00() throws Exception { 70 jmsQueue = new JMSManager(JMSManager.DEFAULT_QUEUE_CONNECTION_FACTORY, JMSManager.DEFAULT_QUEUE); 71 checker = new OperationChecker(); 72 } 73 74 78 @BeforeMethod 79 public void startUp01() throws Exception { 80 checker.deleteAll(); 81 } 82 83 89 @Test 90 public void testCallerPrincipal() throws Exception { 91 jmsQueue.sendControlMessage(MDBBeanManagedContext.MESSAGE_TYPE, GET_CALLER_PRINCIPAL); 92 checker.check(MDBBeanManagedContext.class.getName(), ON_MESSAGE, GET_CALLER_PRINCIPAL); 93 } 94 95 101 @Test 102 public void testGetRollbackOnly() throws Exception { 103 jmsQueue.sendControlMessage(MDBBeanManagedContext.MESSAGE_TYPE, GET_ROLLBACK_ONLY); 104 checker.check(MDBBeanManagedContext.class.getName(), ON_MESSAGE, GET_ROLLBACK_ONLY); 105 } 106 107 113 @Test 114 public void testSetRollbackOnly() throws Exception { 115 jmsQueue.sendControlMessage(MDBBeanManagedContext.MESSAGE_TYPE, SET_ROLLBACK_ONLY); 116 checker.check(MDBBeanManagedContext.class.getName(), ON_MESSAGE, SET_ROLLBACK_ONLY); 117 } 118 119 125 @Test 126 public void testGetTimerService() throws Exception { 127 jmsQueue.sendControlMessage(MDBBeanManagedContext.MESSAGE_TYPE, TIMER); 128 checker.check(MDBBeanManagedContext.class.getName(), ON_MESSAGE, TIMER); 129 } 130 131 137 @Test 138 public void testUserTransaction() throws Exception { 139 jmsQueue.sendControlMessage(MDBBeanManagedContext.MESSAGE_TYPE, USER_TRANSACTION); 140 checker.check(MDBBeanManagedContext.class.getName(), ON_MESSAGE, USER_TRANSACTION); 141 } 142 143 147 @AfterMethod 148 public void tearDown() throws Exception { 149 checker.deleteAll(); 150 } 151 152 156 @AfterClass 157 public void tearDownClass() throws Exception { 158 jmsQueue.close(); 159 } 160 } 161 | Popular Tags |