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: TestMandatoryRemoteSFSB.java 1970 2007-10-16 11:49:25Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.ow2.easybeans.tests.transaction.containermanaged.stateful;
025:
026: import java.sql.SQLException;
027:
028: import javax.ejb.EJBTransactionRequiredException;
029:
030: import org.ow2.easybeans.tests.common.ejbs.stateful.containermanaged.transaction.SFSBContainerTransactionMandatory;
031: import org.ow2.easybeans.tests.transaction.containermanaged.base.TestMandatory;
032: import org.testng.annotations.BeforeClass;
033: import org.testng.annotations.BeforeMethod;
034: import org.testng.annotations.Test;
035:
036: /**
037: * Verifies if the container-managed transaction in the stateful bean is
038: * following the JSR 220.The items covered in this test are: 12.6.2.5.
039: * @reference JSR 220-PROPOSED FINAL
040: * @requirement Application Server must be running; the bean
041: * org.ow2.easybeans.tests.common.ejbs.stateful.containermanaged.SFSBContainerTransactionMandatory
042: * must be deployed.
043: * @setup gets the reference of SFSBContainerTransactionMandatory and binds the
044: * databases specified in the EmbeddedTest.
045: * @author Gisele Pinheiro Souza
046: * @author Eduardo Studzinski Estima de Castro
047: */
048: public class TestMandatoryRemoteSFSB extends TestMandatory {
049:
050: /**
051: * Creates a new instance of the bean.
052: * @throws Exception if a lookup error occurs.
053: */
054: @BeforeMethod
055: public void createBean() throws Exception {
056: super .createBean(SFSBContainerTransactionMandatory.class);
057: }
058:
059: /**
060: * @see org.ow2.easybeans.tests.transaction.containermanaged.base.TestMandatory
061: * @throws Exception if an error during the test startup occurs.
062: */
063: @BeforeClass
064: @Override
065: public void setup() throws Exception {
066: super .setup();
067: }
068:
069: /**
070: * @see org.ow2.easybeans.tests.transaction.containermanaged.base.TestMandatory
071: * @throws Exception if an error during the tests occurs.
072: */
073: @Test(groups={"mandatory attribute features"},alwaysRun=true,expectedExceptions=SQLException.class)
074: @Override
075: public void testUsingClientTrans() throws Exception {
076: super .testUsingClientTrans();
077: }
078:
079: /**
080: * @see org.ow2.easybeans.tests.transaction.containermanaged.base.TestMandatory
081: * @throws Exception if an error occurs during the tests.
082: */
083: @Test(groups={"rollback"})
084: @Override
085: public void testSetRollbackOnlyWithUserTransaction()
086: throws Exception {
087: super .testSetRollbackOnlyWithUserTransaction();
088: }
089:
090: /**
091: * @see org.ow2.easybeans.tests.transaction.containermanaged.base.TestMandatory
092: * @throws Exception if an error occurs during the tests.
093: */
094: @Test(groups={"rollback"},expectedExceptions=EJBTransactionRequiredException.class)
095: @Override
096: public void testSetRollbackOnlyWithoutUserTransaction()
097: throws Exception {
098: super .testSetRollbackOnlyWithoutUserTransaction();
099: }
100:
101: /**
102: * @see org.ow2.easybeans.tests.transaction.containermanaged.base.TestMandatory
103: * @throws Exception if an error occurs during the tests.
104: */
105: @Test(groups={"rollback"})
106: @Override
107: public void testGetRollbackOnlyWithUserTransaction()
108: throws Exception {
109: super .testGetRollbackOnlyWithUserTransaction();
110:
111: }
112:
113: /**
114: * @see org.ow2.easybeans.tests.transaction.containermanaged.base.TestMandatory
115: * @throws Exception if an error occurs during the tests.
116: */
117: @Test(groups={"rollback"},expectedExceptions=EJBTransactionRequiredException.class)
118: @Override
119: public void testGetRollbackOnlyWithoutUserTransaction()
120: throws Exception {
121: super .testGetRollbackOnlyWithoutUserTransaction();
122: }
123:
124: /**
125: * @see org.ow2.easybeans.tests.transaction.containermanaged.base.TestMandatory
126: */
127: @BeforeMethod
128: @Override
129: public void deleteTable() {
130: super .deleteTable();
131: }
132:
133: /**
134: * Makes a rollback in the transaction actives.
135: * @throws Exception if a transaction exception occurs.
136: */
137: @BeforeMethod
138: @Override
139: public void cleanTransaction() throws Exception {
140: super .cleanTransaction();
141: }
142:
143: /**
144: * @see org.ow2.easybeans.tests.transaction.containermanaged.base.TestMandatory
145: * @throws Exception if an error during the tests occurs.
146: */
147: @Test(groups={"general attribute features"},expectedExceptions=java.lang.IllegalStateException.class)
148: @Override
149: public void testGetUserTransactionWithEJBContext() throws Exception {
150: super .testGetUserTransactionWithEJBContext();
151: }
152:
153: /**
154: * @see org.ow2.easybeans.tests.transaction.containermanaged.base.TestMandatory
155: * @throws Exception if an error during the tests occurs.
156: */
157: @Test(groups={"general attribute features"},expectedExceptions=javax.naming.NameNotFoundException.class)
158: @Override
159: public void testGetUserTransactionWithLookup() throws Exception {
160: super.testGetUserTransactionWithLookup();
161: }
162: }
|