KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > common > ejbs > base > inheritance > EBaseLocalInheritanceTester00


1 /**
2  * EasyBeans
3  * Copyright (C) 2006 Bull S.A.S.
4  * Contact: easybeans@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: EBaseLocalInheritanceTester00.java 977 2006-07-28 13:18:26Z studzine $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.common.ejbs.base.inheritance;
26
27 import static org.objectweb.easybeans.tests.common.asserts.Assert.assertEquals;
28
29 import java.util.ArrayList JavaDoc;
30 import java.util.List JavaDoc;
31
32 import org.objectweb.easybeans.tests.common.ejbs.base.ItfLocalInheritanceTester00;
33 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.inheritance.SLSBInheritance00;
34 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.inheritance.SLSBInheritance01;
35 import org.objectweb.easybeans.tests.common.inheritance.ItfAddElement;
36 import org.testng.annotations.Test;
37
38 /**
39  * Verifies if the bean inheritance is following the JSR 220 spec.
40  * @author Eduardo Studzinski Estima de Castro
41  * @author Gisele Pinheiro Souza
42  */

43 public class EBaseLocalInheritanceTester00 implements ItfLocalInheritanceTester00 {
44
45     /**
46      * Used to configure the environment used by the tests.
47      * @throws Exception if a problem occurs.
48      */

49     public void startUp() throws Exception JavaDoc{
50     }
51
52     /**
53      * Bean used to implement the test.
54      */

55     private ItfAddElement mtBean00;
56
57     /**
58      * Bean used to implement the test.
59      */

60     private ItfAddElement mtBean01;
61
62     /**
63      * Verifies if the bean business method is running correctly. The bean
64      * business method is implemented by a extended class that implements an
65      * interface. The bean doesn't have any @Local or @Remote.
66      * @input List with no values inside.
67      * @output List with only one value, the value inserted by the method.
68      */

69     @SuppressWarnings JavaDoc("unchecked")
70     @Test(groups = {"withInheritance"})
71     public void test00() {
72         // The arrays used to know what is the interceptor order
73
List JavaDoc<Integer JavaDoc> arResult = new ArrayList JavaDoc<Integer JavaDoc>();
74         List JavaDoc<Integer JavaDoc> arExpected = new ArrayList JavaDoc<Integer JavaDoc>();
75
76         // insert the value of method
77
// there are not interceptors in this class, so only
78
// the method will be executed
79
arExpected.add(SLSBInheritance00.ELEMENT);
80
81         // gets the result
82
arResult = mtBean00.addElement(arResult);
83
84         // compares the two values
85
assertEquals(arExpected, arResult, "The business method is not running correctly.");
86     }
87
88     /**
89      * Verifies if the bean business method is running correctly. The bean
90      * business method is implemented by a extended class that implements an
91      * interface. The bean has a &#64;Local as unique interface implemented.
92      * @input List with no values inside.
93      * @output List with only one value, the value inserted by the method.
94      */

95     @SuppressWarnings JavaDoc("unchecked")
96     @Test(groups = {"withInheritance"})
97     public void test01() {
98         // The arrays used to know what is the interceptor order
99
List JavaDoc<Integer JavaDoc> arResult = new ArrayList JavaDoc<Integer JavaDoc>();
100         List JavaDoc<Integer JavaDoc> arExpected = new ArrayList JavaDoc<Integer JavaDoc>();
101
102         // insert the value of method
103
// there are not interceptors in this class, so only
104
// the method will be executed
105
arExpected.add(SLSBInheritance01.ELEMENT);
106
107         // gets the result
108
arResult = mtBean01.addElement(arResult);
109
110         // compares the two values
111
assertEquals(arExpected, arResult, "The business method is not running correctly.");
112     }
113
114
115     /**
116      * Sets bean(s) used in the tests.
117      * @param bean00 The bean to set.
118      * @param bean01 The bean to set.
119      */

120     public void setBeans(final ItfAddElement bean00, final ItfAddElement bean01) {
121         this.mtBean00 = bean00;
122         this.mtBean01 = bean01;
123     }
124 }
125
Popular Tags