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: TestEjb2DeployDescLocal.java 1970 2007-10-16 11:49:25Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.ow2.easybeans.tests.ejb2view;
025:
026: import org.ow2.easybeans.tests.common.ejbs.stateful.containermanaged.ejb2view.ItfEjb2LocalClient;
027: import org.ow2.easybeans.tests.common.ejbs.stateful.containermanaged.ejb2view.SFSBEjb2LocalClientDeployDesc;
028: import org.ow2.easybeans.tests.common.helper.EJBHelper;
029: import org.testng.annotations.BeforeMethod;
030: import org.testng.annotations.Test;
031:
032: /**
033: * Verifies the compatibility between the ejb 2.1 and the ejb 3.0. More
034: * specifically, it verifies if the access to the local home works properly.
035: * All interfaces are defined by deployment descriptor.
036: * @reference JSR 220-FINAL RELEASE
037: * @requirement Application Server must be running; the beans SFSBEjb2LocalClient
038: * and SimpleEjb2BeanBase with the xml file(that is in the same package where the class is) must be deployed.
039: * @setup gets a reference of the bean SFSBEjb2LocalClient.
040: * @author Gisele Pinheiro Souza
041: * @author Eduardo Studzinski Estima de Castro
042: */
043: public class TestEjb2DeployDescLocal {
044:
045: /**
046: * Bean that access the bean with ejb 2.1 remote view.
047: */
048: private ItfEjb2LocalClient bean;
049:
050: /**
051: * Gets an instance of the bean.
052: * @throws Exception if an error occurs.
053: */
054: @BeforeMethod
055: public void setup() throws Exception {
056: // Gets a bean instance.
057: bean = EJBHelper.getBeanRemoteInstance(
058: SFSBEjb2LocalClientDeployDesc.class,
059: ItfEjb2LocalClient.class);
060: }
061:
062: /**
063: * Tests if the definition of the create method as ejbCreate in the bean
064: * class works. The interface home here is goten by the annotation ejb.
065: * @input -
066: * @output the correct method execution.
067: * @throws Exception If an error occurs during the test.
068: */
069: @Test
070: public void verifyCreateWithDefaultName() throws Exception {
071: bean.createWithIntParameter();
072: }
073:
074: /**
075: * Tests if the definition of the create method with the annotation init in
076: * the bean class works. The interface home here is goten by the annotation
077: * ejb.
078: * @input -
079: * @output the correct method execution.
080: * @throws Exception If an error occurs during the test.
081: */
082: @Test
083: public void verifyCreateWithAnnotationInit() throws Exception {
084: bean.createWithStrParameter();
085: }
086:
087: /**
088: * Verifies if the method isIdentical that is defined in the EJBLocalObject
089: * interface.
090: * @input -
091: * @output the correct method execution.
092: * @throws Exception If an error occurs during the test.
093: */
094: @Test
095: public void verifyIsIdentical() throws Exception {
096: bean.verifyIdentity();
097: }
098:
099: /**
100: * Verifies if the method remove from the interface EJBLocalHome works.
101: * @input -
102: * @output the correct method execution.
103: * @throws Exception If an error occurs during the test.
104: */
105: @Test
106: public void verifyRemove() throws Exception {
107: bean.removeObject();
108: }
109:
110: /**
111: * Verifies if the client can get a bean by lookup.
112: * @input -
113: * @output the correct method execution.
114: * @throws Exception If an error occurs during the test.
115: */
116: @Test
117: public void verifyLookup() throws Exception {
118: bean.getBeanByLookup();
119: }
120: }
|