1 25 package org.objectweb.easybeans.tests.messagedriven.containermanaged.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.TIMER; 31 import static org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType.USER_TRANSACTION; 32 33 import org.objectweb.easybeans.tests.common.ejbs.mdb.containermanaged.context.MDBContext; 34 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.OperationChecker; 35 import org.objectweb.easybeans.tests.common.jms.JMSManager; 36 import org.testng.annotations.AfterClass; 37 import org.testng.annotations.AfterMethod; 38 import org.testng.annotations.BeforeClass; 39 import org.testng.annotations.BeforeMethod; 40 import org.testng.annotations.Test; 41 42 51 public class TestMDBContext { 52 53 56 private JMSManager jmsQueue; 57 58 61 private OperationChecker checker; 62 63 67 @BeforeClass 68 public void startUp00() throws Exception { 69 jmsQueue = new JMSManager(JMSManager.DEFAULT_QUEUE_CONNECTION_FACTORY, JMSManager.DEFAULT_QUEUE); 70 checker = new OperationChecker(); 71 } 72 73 77 @BeforeMethod 78 public void startUp01() throws Exception { 79 checker.deleteAll(); 80 } 81 82 88 @Test 89 public void testCallerPrincipal() throws Exception { 90 jmsQueue.sendControlMessage(MDBContext.MESSAGE_TYPE, GET_CALLER_PRINCIPAL); 91 checker.check(MDBContext.class.getName(), ON_MESSAGE, GET_CALLER_PRINCIPAL); 92 } 93 94 100 @Test 101 public void testGetRollbackOnly() throws Exception { 102 jmsQueue.sendControlMessage(MDBContext.MESSAGE_TYPE, GET_ROLLBACK_ONLY); 103 checker.check(MDBContext.class.getName(), ON_MESSAGE, GET_ROLLBACK_ONLY); 104 } 105 106 112 @Test 113 public void testGetTimerService() throws Exception { 114 jmsQueue.sendControlMessage(MDBContext.MESSAGE_TYPE, TIMER); 115 checker.check(MDBContext.class.getName(), ON_MESSAGE, TIMER); 116 } 117 118 124 @Test 125 public void testUserTransaction() throws Exception { 126 jmsQueue.sendControlMessage(MDBContext.MESSAGE_TYPE, USER_TRANSACTION); 127 checker.check(MDBContext.class.getName(), ON_MESSAGE, USER_TRANSACTION); 128 } 129 130 134 @AfterMethod 135 public void tearDown() throws Exception { 136 checker.deleteAll(); 137 } 138 139 143 @AfterClass 144 public void tearDownClass() throws Exception { 145 jmsQueue.close(); 146 } 147 } 148 | Popular Tags |