KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > interceptors > business > messagedriven > containermanaged > TestMDBInvocationOrder


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: TestMDBInvocationOrder.java 978 2006-07-28 13:19:14Z studzine $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.interceptors.business.messagedriven.containermanaged;
26
27 import static org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackType.AROUND_INVOKE;
28 import static org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType.UNDEFINED;
29
30 import org.objectweb.easybeans.tests.common.ejbs.mdb.containermanaged.interceptororder.MDBInvocationOrder00;
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.BeforeMethod;
37 import org.testng.annotations.Test;
38
39
40 /**
41  * Tests the interceptor invocation order for Message-Driven Beans.
42  * @reference JSR 220 - EJB 3.0 Core - 12.3.1
43  * @requirement Application Server must be running.<br>
44  * MDB:<li>org.objectweb.easybeans.tests.common.ejbs.mdb.containermanaged.interceptororder.MDBInvocationOrder00</li>
45  * (Ant task: install.jar.tests.interceptor.business)
46  * @setup gets the reference of JMS manager and bean logger.
47  * @author Eduardo Studzinski Estima de Castro
48  * @author Gisele Pinheiro Souza
49  */

50 public class TestMDBInvocationOrder {
51
52     /**
53      * JMS Manager.
54      */

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

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

66     @BeforeClass
67     public void startUp00() throws Exception JavaDoc {
68         jmsQueue = new JMSManager(JMSManager.DEFAULT_QUEUE_CONNECTION_FACTORY, JMSManager.DEFAULT_QUEUE);
69         checker = new CallbackChecker();
70     }
71
72     /**
73      * Gets the bean logger instance and clears previous tests information.
74      * @throws Exception if there is a problem with the bean initialization.
75      */

76     @BeforeMethod
77     public void startUp01() throws Exception JavaDoc {
78         checker.deleteAll();
79     }
80
81     /**
82      * Verifies if business interceptors can be used with MDBs.
83      * @input a message
84      * @output a logged onMessage() event
85      * @throws Exception if a problem occurs.
86      */

87     @Test
88     public void testQueue00() throws Exception JavaDoc {
89         jmsQueue.sendControlMessage(MDBInvocationOrder00.MESSAGE_TYPE, UNDEFINED);
90         checker.check(MDBInvocationOrder00.class.toString(), AROUND_INVOKE);
91     }
92
93     /**
94      * Clears logs.
95      * @throws Exception if a problem occurs.
96      */

97     @AfterMethod
98     public void tearDown() throws Exception JavaDoc {
99         checker.deleteAll();
100     }
101
102     /**
103      * Clears logs.
104      * @throws Exception if a problem occurs.
105      */

106     @AfterClass
107     public void tearDownClass() throws Exception JavaDoc {
108         jmsQueue.close();
109     }
110 }
111
Popular Tags