1 25 package org.objectweb.easybeans.tests.deploymentdesc; 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.UNDEFINED; 29 import static org.objectweb.easybeans.tests.common.helper.EJBHelper.getBeanRemoteInstance; 30 31 import java.util.ArrayList ; 32 import java.util.List ; 33 34 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.ItfCallbackLoggerAccess; 35 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.SLSBCallbackLoggerAccess; 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 44 55 public class TestMDBElements { 56 57 60 private static final String MDB_TOPIC_MESSAGE_TYPE = 61 "org.objectweb.easybeans.tests.common.ejbs.base.xmldescriptor.MDBBasicTopicXML"; 62 63 66 private static final String MDB_QUEUE_MESSAGE_TYPE = 67 "org.objectweb.easybeans.tests.common.ejbs.base.xmldescriptor.MDBBasicQueueXML"; 68 69 72 private JMSManager jmsTopic; 73 74 77 private JMSManager jmsQueue; 78 79 82 private ItfCallbackLoggerAccess beanLogger; 83 84 88 @BeforeClass 89 public void startUp00() throws Exception { 90 jmsQueue = new JMSManager(JMSManager.DEFAULT_QUEUE_CONNECTION_FACTORY, JMSManager.DEFAULT_QUEUE); 91 jmsTopic = new JMSManager(JMSManager.DEFAULT_TOPIC_CONNECTION_FACTORY, JMSManager.DEFAULT_TOPIC); 92 beanLogger = getBeanRemoteInstance(SLSBCallbackLoggerAccess.class, ItfCallbackLoggerAccess.class); 93 } 94 95 99 @BeforeMethod 100 public void startUp01() throws Exception { 101 beanLogger.deleteAll(); 102 } 103 104 110 @Test 111 public void testTopic00() throws Exception { 112 jmsTopic.sendControlMessage(MDB_TOPIC_MESSAGE_TYPE, UNDEFINED); 113 114 List <String > arEvent = new ArrayList <String >(); 116 117 arEvent.add(MDB_TOPIC_MESSAGE_TYPE); 118 119 beanLogger.verifyCallbackOrder(MDB_TOPIC_MESSAGE_TYPE, ON_MESSAGE, arEvent.toArray(new String [0])); 120 } 121 122 128 @Test 129 public void testQueue00() throws Exception { 130 jmsQueue.sendControlMessage(MDB_QUEUE_MESSAGE_TYPE, UNDEFINED); 131 132 List <String > arEvent = new ArrayList <String >(); 134 135 arEvent.add(MDB_QUEUE_MESSAGE_TYPE); 136 137 beanLogger.verifyCallbackOrder(MDB_QUEUE_MESSAGE_TYPE, ON_MESSAGE, arEvent.toArray(new String [0])); 138 } 139 140 144 @AfterMethod 145 public void tearDown() throws Exception { 146 beanLogger.deleteAll(); 147 } 148 149 153 @AfterClass 154 public void tearDownClass() throws Exception { 155 jmsQueue.close(); 156 jmsTopic.close(); 157 } 158 } 159 | Popular Tags |