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: TestOverriden00.java 1970 2007-10-16 11:49:25Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.ow2.easybeans.tests.deploymentdesc;
025:
026: import javax.naming.NamingException;
027: import javax.transaction.HeuristicMixedException;
028: import javax.transaction.HeuristicRollbackException;
029: import javax.transaction.NotSupportedException;
030: import javax.transaction.RollbackException;
031: import javax.transaction.SystemException;
032:
033: import org.ow2.easybeans.tests.common.ejbs.stateful.containermanaged.xmldescriptor.ItfOverrideTester00;
034: import org.ow2.easybeans.tests.common.ejbs.stateful.containermanaged.xmldescriptor.SFSBOverrideTester00;
035: import org.ow2.easybeans.tests.common.helper.EJBHelper;
036: import org.testng.annotations.BeforeMethod;
037: import org.testng.annotations.Test;
038:
039: /**
040: * Verifies if the deployment descriptor overrides the bean annotation.
041: * @reference JSR 220 - FINAL RELEASE
042: * @requirement the bean SFSBOverrideTester must be deployed to make the tests,
043: * and, the SFSBSimpleBeanOverrided with the deployment descriptor
044: * must be deployed too.
045: * @setup gets an instance of the SFSBOverrideTester.
046: * @author Gisele Pinheiro Souza
047: * @author Eduardo Studzinski Estima de Castro
048: */
049: public class TestOverriden00 {
050:
051: /**
052: * Bean used to verify the local access.
053: */
054: private ItfOverrideTester00 tester;
055:
056: /**
057: * Creates the stateful bean used during the tests.
058: * @throws Exception if an error occurs during the lookup.
059: */
060: @BeforeMethod
061: public void setup() throws Exception {
062: tester = EJBHelper.getBeanRemoteInstance(
063: SFSBOverrideTester00.class, ItfOverrideTester00.class);
064: }
065:
066: /**
067: * Verifies if the injection works when the local interface and the bean
068: * name are used. The bean has a different name defined in the annotation
069: * and in the deployment descriptor,and the local interface defined in the
070: * deployment descriptor is different too. The test uses the values defined
071: * in the deployment descriptor.
072: * @input -
073: * @output the correct method execution.
074: */
075: @Test
076: public void testLocalInjection() {
077: tester.testLocalInjection();
078: }
079:
080: /**
081: * Verifies if the injection works when the remotel interface and the bean
082: * name are used. The bean has a different name defined in the annotation
083: * and in the deployment descriptor,and the remote interface defined in the
084: * deployment descriptor is different too. The test uses the values defined
085: * in the deployment descriptor.
086: * @input -
087: * @output the correct method execution.
088: */
089: @Test
090: public void testRemoteInjection() {
091: tester.testRemoteInjection();
092: }
093:
094: /**
095: * Verififes if the lookup works when a local interface is used. The
096: * interface defined as local in the deployment descriptor is different of
097: * the interface defined in the bean class. The test uses the values defined
098: * in the deployment descriptor.
099: * @input -
100: * @output the correct method execution.
101: * @throws Exception if a lookup error occurs.
102: */
103: @Test
104: public void testLookupLocal() throws Exception {
105: tester.testLookupLocal();
106: }
107:
108: /**
109: * Verififes if the lookup works when a local interface is used. The
110: * interface defined as remote in the deployment descriptor is different of
111: * the interface defined in the bean class. The test uses the values defined
112: * in the deployment descriptor.
113: * @input -
114: * @output the correct method execution.
115: * @throws Exception if a lookup error occurs.
116: */
117: @Test
118: public void testLookupRemote() throws Exception {
119: tester.testLookupRemote();
120: }
121:
122: /**
123: * Verifies if the container overrides the transaction type when a
124: * deployment descriptor is used. The transaction type defined in the bean
125: * is container managed, but the transaction type defined in the deployment
126: * descriptor is bean managed.The bean gets an instance of an user
127: * transaction. If the transaction is bean managed, the operation must not
128: * throw an exception.
129: * @input -
130: * @output the correct method execution.
131: * @throws NamingException if a lookup error occurs.
132: * @throws SystemException if an unexpected error occurs.
133: * @throws NotSupportedException if the resquest cannot be made.
134: * @throws HeuristicRollbackException if a heuristic decision was made and
135: * some relevant update was rolled back.
136: * @throws RollbackException if the transaction was rolled back instead of
137: * committed.
138: * @throws HeuristicMixedException if a heuristic decision was made and some
139: * relevant update was commited and others rolled back.
140: * @throws IllegalStateException if there is an illegal state
141: * @throws SecurityException if there is a security exception
142: */
143: @Test
144: public void testTransactionType() throws IllegalStateException,
145: SecurityException, HeuristicMixedException,
146: HeuristicRollbackException, RollbackException,
147: SystemException, NotSupportedException, NamingException {
148: tester.testTransactionType();
149: }
150:
151: }
|