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: TestEjb2DeployDescRemote.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.ItfEjb2Client;
027: import org.ow2.easybeans.tests.common.ejbs.stateful.containermanaged.ejb2view.SFSBEjb2ClientDeployDesc;
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 remote home works properly.
035: * All interfaces are defined by deployemnt descriptor.
036: * @reference JSR 220-FINAL RELEASE
037: * @requirement Application Server must be running; the beans SFSBEjb2ClientDeployDesc
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 SFSBEjb2ClientDeployDesc.
040: * @author Gisele Pinheiro Souza
041: * @author Eduardo Studzinski Estima de Castro
042: */
043: public class TestEjb2DeployDescRemote {
044:
045: /**
046: * Bean that access the bean with ejb 2.1 remote view.
047: */
048: private ItfEjb2Client 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: SFSBEjb2ClientDeployDesc.class, ItfEjb2Client.class);
059: }
060:
061: /**
062: * Tests if the definition of the create method as ejbCreate in the bean
063: * class works. The interface home here is goten by the annotation ejb.
064: * @input -
065: * @output the correct method execution.
066: * @throws Exception If an error occurs during the test.
067: */
068: @Test
069: public void testCreateWithoutParameters() throws Exception {
070: bean.createWithoutParameters();
071: }
072:
073: /**
074: * Tests if the definition of the create method with the annotation init in
075: * the bean class works. The interface home here is goten by the annotation
076: * ejb.
077: * @input -
078: * @output the correct method execution.
079: * @throws Exception If an error occurs during the test.
080: */
081: @Test
082: public void testCreateWithParameters() throws Exception {
083: bean.createWithParameters();
084: }
085:
086: /**
087: * Verifies if theclient can get a bean by lookup.
088: * @input -
089: * @output the correct method execution.
090: * @throws Exception If an error occurs during the test.
091: */
092: @Test
093: public void testGetBeanByLookup() throws Exception {
094: bean.getBeanByLookup();
095: }
096:
097: /**
098: * Verifies if the method isIdentical that is defined in the EJBObject
099: * interface.
100: * @input -
101: * @output the correct method execution.
102: * @throws Exception If an error occurs during the test.
103: */
104: @Test
105: public void testIsIdentical() throws Exception {
106: bean.verifyIdentity();
107: }
108:
109: /**
110: * Verifies if the method remove from the interface EJBHome works.
111: * @input -
112: * @output the correct method execution.
113: * @throws Exception If an error occurs during the test.
114: */
115: @Test
116: public void testRemove() throws Exception {
117: bean.removeObject();
118: }
119:
120: /**
121: * Verifies if the method getMetaData from the interface EJBHome works.
122: * @input -
123: * @output the correct method execution.
124: * @throws Exception If an error occurs during the test.
125: */
126: @Test
127: public void testMetadata() throws Exception {
128: bean.getEJBMetaData();
129: }
130: }
|