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: EBaseLocalInheritanceTester00.java 1970 2007-10-16 11:49:25Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.ow2.easybeans.tests.common.ejbs.base.inheritance;
025:
026: import static org.ow2.easybeans.tests.common.asserts.Assert.assertEquals;
027:
028: import java.util.ArrayList;
029: import java.util.List;
030:
031: import org.ow2.easybeans.tests.common.ejbs.base.ItfLocalInheritanceTester00;
032: import org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.inheritance.SLSBInheritance00;
033: import org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.inheritance.SLSBInheritance01;
034: import org.ow2.easybeans.tests.common.inheritance.ItfAddElement;
035: import org.testng.annotations.Test;
036:
037: /**
038: * Verifies if the bean inheritance is following the JSR 220 spec.
039: * @author Eduardo Studzinski Estima de Castro
040: * @author Gisele Pinheiro Souza
041: */
042: public class EBaseLocalInheritanceTester00 implements
043: ItfLocalInheritanceTester00 {
044:
045: /**
046: * Used to configure the environment used by the tests.
047: * @throws Exception if a problem occurs.
048: */
049: public void startUp() throws Exception {
050: }
051:
052: /**
053: * Bean used to implement the test.
054: */
055: private ItfAddElement mtBean00;
056:
057: /**
058: * Bean used to implement the test.
059: */
060: private ItfAddElement mtBean01;
061:
062: /**
063: * Verifies if the bean business method is running correctly. The bean
064: * business method is implemented by a extended class that implements an
065: * interface. The bean doesn't have any @Local or @Remote.
066: * @input List with no values inside.
067: * @output List with only one value, the value inserted by the method.
068: */
069: @SuppressWarnings("unchecked")
070: @Test(groups={"withInheritance"})
071: public void test00() {
072: // The arrays used to know what is the interceptor order
073: List<Integer> arResult = new ArrayList<Integer>();
074: List<Integer> arExpected = new ArrayList<Integer>();
075:
076: // insert the value of method
077: // there are not interceptors in this class, so only
078: // the method will be executed
079: arExpected.add(SLSBInheritance00.ELEMENT);
080:
081: // gets the result
082: arResult = mtBean00.addElement(arResult);
083:
084: // compares the two values
085: assertEquals(arExpected, arResult,
086: "The business method is not running correctly.");
087: }
088:
089: /**
090: * Verifies if the bean business method is running correctly. The bean
091: * business method is implemented by a extended class that implements an
092: * interface. The bean has a @Local as unique interface implemented.
093: * @input List with no values inside.
094: * @output List with only one value, the value inserted by the method.
095: */
096: @SuppressWarnings("unchecked")
097: @Test(groups={"withInheritance"})
098: public void test01() {
099: // The arrays used to know what is the interceptor order
100: List<Integer> arResult = new ArrayList<Integer>();
101: List<Integer> arExpected = new ArrayList<Integer>();
102:
103: // insert the value of method
104: // there are not interceptors in this class, so only
105: // the method will be executed
106: arExpected.add(SLSBInheritance01.ELEMENT);
107:
108: // gets the result
109: arResult = mtBean01.addElement(arResult);
110:
111: // compares the two values
112: assertEquals(arExpected, arResult,
113: "The business method is not running correctly.");
114: }
115:
116: /**
117: * Sets bean(s) used in the tests.
118: * @param bean00 The bean to set.
119: * @param bean01 The bean to set.
120: */
121: public void setBeans(final ItfAddElement bean00,
122: final ItfAddElement bean01) {
123: this.mtBean00 = bean00;
124: this.mtBean01 = bean01;
125: }
126: }
|