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: TestMDBTimeoutAccess.java 1970 2007-10-16 11:49:25Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.ow2.easybeans.tests.timerservice.timeout.mdb.containermanaged;
025:
026: import org.ow2.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType;
027: import org.ow2.easybeans.tests.common.ejbs.mdb.containermanaged.timer.MDBTimeoutCallbackAccess00;
028: import org.ow2.easybeans.tests.common.jms.JMSManager;
029: import org.ow2.easybeans.tests.timerservice.timeout.base.BaseTestTimeout;
030: import org.testng.annotations.AfterClass;
031: import org.testng.annotations.AfterMethod;
032: import org.testng.annotations.BeforeClass;
033: import org.testng.annotations.Test;
034:
035: /**
036: * Verifies if the timeout callback can perform the operations defined by the specification.
037: * @reference JSR 220 - EJB 3.0 Core - Chapter 5 - Table 3
038: * @requirement Application Server must be running.<br>
039: * MDBs:<li>org.ow2.easybeans.tests.common.ejbs.mdb.containermanaged.timer.MDBTimeoutCallbackAccess00</li>
040: * (Ant task: install.jar.tests.timerservice)
041: * @author Eduardo Studzinski Estima de Castro
042: * @author Gisele Pinheiro Souza
043: */
044: public class TestMDBTimeoutAccess extends BaseTestTimeout {
045:
046: /**
047: * JMS Manager.
048: */
049: private JMSManager jmsQueue;
050:
051: /**
052: * MDB which must perform the access.
053: * @return name
054: */
055: @Override
056: public String getBeanName() {
057: return MDBTimeoutCallbackAccess00.class.getName();
058: }
059:
060: /**
061: * Creates the JMS manager.
062: * @throws Exception if there is a problem.
063: */
064: @Override
065: @BeforeClass
066: public void startUp() throws Exception {
067: super .startUp();
068: jmsQueue = new JMSManager(
069: JMSManager.DEFAULT_QUEUE_CONNECTION_FACTORY,
070: JMSManager.DEFAULT_QUEUE);
071: }
072:
073: /**
074: * Tests if a timeout callback method is allowed to access an EJB.
075: * @throws Exception if a problem occurs.
076: */
077: @Override
078: @Test
079: public void testAccessEJB00() throws Exception {
080: super .testAccessEJB00();
081: }
082:
083: /**
084: * Tests if a timeout callback method is allowed to access the Resource
085: * Manager.
086: * @throws Exception if a problem occurs.
087: */
088: @Override
089: @Test
090: public void testAccessResourceManager00() throws Exception {
091: super .testAccessResourceManager00();
092: }
093:
094: /**
095: * Tests if a timeout callback method is allowed to access the Entity
096: * Manager.
097: * @throws Exception if a problem occurs.
098: */
099: @Override
100: @Test
101: public void testAccessEntityManager00() throws Exception {
102: super .testAccessEntityManager00();
103: }
104:
105: /**
106: * Tests if a timeout callback method is allowed to access the Entity
107: * Manager Factory.
108: * @throws Exception if a problem occurs.
109: */
110: @Override
111: @Test
112: public void testAccessEntityManagerFactory00() throws Exception {
113: super .testAccessEntityManagerFactory00();
114: }
115:
116: /**
117: * Tests if a timeout callback method is allowed to access the Timer
118: * Service.
119: * @throws Exception if a problem occurs.
120: */
121: @Override
122: @Test
123: public void testAccessTimerService00() throws Exception {
124: super .testAccessTimerService00();
125: }
126:
127: /**
128: * Tests if a timeout callback method is allowed to access the
129: * UserTransaction.
130: * @throws Exception if a problem occurs.
131: */
132: @Override
133: @Test
134: public void testAccessUserTransaction00() throws Exception {
135: super .testAccessUserTransaction00();
136: }
137:
138: /**
139: * Clears logs.
140: * @throws Exception if a problem occurs.
141: */
142: @Override
143: @AfterMethod
144: public void tearDownMethod() throws Exception {
145: super .tearDownMethod();
146: }
147:
148: /**
149: * Closes the JMS Queue.
150: * @throws Exception if a problem occurs.
151: */
152: @AfterClass
153: public void tearDownClass() throws Exception {
154: jmsQueue.close();
155: }
156:
157: /**
158: * Starts the timer.
159: * @param type operation type
160: * @throws Exception if a problem occurs.
161: */
162: @Override
163: public void requestStartTimer(final OperationType type)
164: throws Exception {
165: jmsQueue.sendControlMessage(getBeanName(), type);
166: }
167:
168: }
|