001: /**
002: * EasyBeans
003: * Copyright (C) 2006 Bull S.A.S.
004: * Contact: easybeans@ow2.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: TestRequiredRemoteMDB.java 1970 2007-10-16 11:49:25Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.ow2.easybeans.tests.transaction.containermanaged.mdb;
025:
026: import static org.ow2.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackType.ON_MESSAGE;
027:
028: import org.ow2.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType;
029: import org.ow2.easybeans.tests.common.ejbs.mdb.containermanaged.transaction.MDBCMTRequired;
030: import org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.CallbackChecker;
031: import org.ow2.easybeans.tests.common.jms.JMSManager;
032: import org.testng.annotations.AfterClass;
033: import org.testng.annotations.AfterMethod;
034: import org.testng.annotations.BeforeClass;
035: import org.testng.annotations.Test;
036:
037: /**
038: * Verifies if message-driven bean with container-managed transaction is
039: * following the JSR 220. The items covered in this test are: 5.4.12
040: * @reference JSR 220-PROPOSED FINAL
041: * @requirement Application Server must be running.<br>
042: * MDB:<li>org.ow2.easybeans.tests.common.ejbs.mdb.containermanaged.transaction.MDBCMTRequired</li>
043: * SLSB: <li>org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.inheritance.SLSBCMTInheritance</li>
044: * (Ant task: install.jar.tests.transaction)
045: * @author Eduardo Studzinski Estima de Castro
046: * @author Gisele Pinheiro Souza
047: *
048: */
049: public class TestRequiredRemoteMDB {
050:
051: /**
052: * JMS Manager.
053: */
054: private JMSManager jmsQueue;
055:
056: /**
057: * Log checker.
058: */
059: private CallbackChecker checker;
060:
061: /**
062: * Creates the JMS manager.
063: * @throws Exception if there is a problem.
064: */
065: @BeforeClass
066: public void startUp00() throws Exception {
067: jmsQueue = new JMSManager(
068: JMSManager.DEFAULT_QUEUE_CONNECTION_FACTORY,
069: JMSManager.DEFAULT_QUEUE);
070: checker = new CallbackChecker();
071: }
072:
073: /**
074: * Verifies if the container-managed transaction in the
075: * message-driven bean with transaction attribute REQUIRED is working properly.
076: * @input a message
077: * @output a logged onMessage() event
078: * @throws Exception if a problem occurs.
079: */
080: @Test
081: public void testRequired00() throws Exception {
082: jmsQueue.sendControlMessage(MDBCMTRequired.MESSAGE_TYPE,
083: OperationType.UNDEFINED);
084: checker.check(MDBCMTRequired.class.getName(), ON_MESSAGE);
085: }
086:
087: /**
088: * Clears logs.
089: * @throws Exception if a problem occurs.
090: */
091: @AfterMethod
092: public void tearDown() throws Exception {
093: checker.deleteAll();
094: }
095:
096: /**
097: * Clears logs.
098: * @throws Exception if a problem occurs.
099: */
100: @AfterClass
101: public void tearDownClass() throws Exception {
102: jmsQueue.close();
103: }
104: }
|