KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > transaction > containermanaged > mdb > TestRequiredRemoteMDB


1 /**
2  * EasyBeans
3  * Copyright (C) 2006 Bull S.A.S.
4  * Contact: easybeans@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: TestRequiredRemoteMDB.java 980 2006-07-28 13:20:32Z studzine $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.transaction.containermanaged.mdb;
26
27 import static org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackType.ON_MESSAGE;
28
29 import org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType;
30 import org.objectweb.easybeans.tests.common.ejbs.mdb.containermanaged.transaction.MDBCMTRequired;
31 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.CallbackChecker;
32 import org.objectweb.easybeans.tests.common.jms.JMSManager;
33 import org.testng.annotations.AfterClass;
34 import org.testng.annotations.AfterMethod;
35 import org.testng.annotations.BeforeClass;
36 import org.testng.annotations.Test;
37
38
39 /**
40  * Verifies if message-driven bean with container-managed transaction is
41  * following the JSR 220. The items covered in this test are: 5.4.12
42  * @reference JSR 220-PROPOSED FINAL
43  * @requirement Application Server must be running.<br>
44  * MDB:<li>org.objectweb.easybeans.tests.common.ejbs.mdb.containermanaged.transaction.MDBCMTRequired</li>
45  * SLSB: <li>org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.inheritance.SLSBCMTInheritance</li>
46  * (Ant task: install.jar.tests.transaction)
47  * @author Eduardo Studzinski Estima de Castro
48  * @author Gisele Pinheiro Souza
49  *
50  */

51 public class TestRequiredRemoteMDB {
52
53     /**
54      * JMS Manager.
55      */

56     private JMSManager jmsQueue;
57
58     /**
59      * Log checker.
60      */

61     private CallbackChecker checker;
62
63     /**
64      * Creates the JMS manager.
65      * @throws Exception if there is a problem.
66      */

67     @BeforeClass
68     public void startUp00() throws Exception JavaDoc {
69         jmsQueue = new JMSManager(JMSManager.DEFAULT_QUEUE_CONNECTION_FACTORY, JMSManager.DEFAULT_QUEUE);
70         checker = new CallbackChecker();
71     }
72
73     /**
74      * Verifies if the container-managed transaction in the
75      * message-driven bean with transaction attribute REQUIRED is working properly.
76      * @input a message
77      * @output a logged onMessage() event
78      * @throws Exception if a problem occurs.
79      */

80     @Test
81     public void testRequired00() throws Exception JavaDoc {
82         jmsQueue.sendControlMessage(MDBCMTRequired.MESSAGE_TYPE, OperationType.UNDEFINED);
83         checker.check(MDBCMTRequired.class.getName(), ON_MESSAGE);
84     }
85
86     /**
87      * Clears logs.
88      * @throws Exception if a problem occurs.
89      */

90     @AfterMethod
91     public void tearDown() throws Exception JavaDoc {
92         checker.deleteAll();
93     }
94
95     /**
96      * Clears logs.
97      * @throws Exception if a problem occurs.
98      */

99     @AfterClass
100     public void tearDownClass() throws Exception JavaDoc {
101         jmsQueue.close();
102     }
103 }
104
Popular Tags