KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > environment > reference > simpleentry > TestSimpleEnvironmentEntryMethodInjection


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: TestSimpleEnvironmentEntryMethodInjection.java 978 2006-07-28 13:19:14Z studzine $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.environment.reference.simpleentry;
26
27 import static org.objectweb.easybeans.tests.common.enhancer.ClassesEnhancer.EXT_CLASS;
28 import static org.objectweb.easybeans.tests.common.enhancer.ClassesEnhancer.enhanceNewClassLoader;
29 import static org.objectweb.easybeans.tests.common.helper.EJBHelper.getBeanRemoteInstance;
30
31 import java.io.File JavaDoc;
32 import java.util.ArrayList JavaDoc;
33 import java.util.List JavaDoc;
34
35 import org.objectweb.easybeans.tests.common.ejbs.base.ItfOneMethod01;
36 import org.objectweb.easybeans.tests.common.ejbs.base.ItfSimpleEnvEntry;
37 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.simpleentry.SLSBSimpleEnvEntryMethodInjection00;
38 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.simpleentry.wrongspecification.SLSBStaticMethodEntry;
39 import org.objectweb.easybeans.tests.common.enhancer.ClassesEnhancer.TYPE;
40 import org.testng.annotations.BeforeMethod;
41 import org.testng.annotations.Test;
42
43 /**
44  * Verifies if the simple environment entries injection using setXXX() method is following the JSR 220.
45  * The items covered in this test are: 16.4
46  * @reference JSR 220-PROPOSED FINAL
47  * @requirement Application Server must be running; the bean
48  * org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.simpleentry.*
49  * must be deployed. (Ant task: install.jar.tests.simple.environment.session)
50  * @setup gets the reference of the bean
51  * @author Eduardo Studzinski Estima de Castro
52  * @author Gisele Pinheiro Souza
53  */

54 public class TestSimpleEnvironmentEntryMethodInjection {
55
56     /**
57      * Bean used in tests.
58      */

59     private ItfSimpleEnvEntry bean;
60
61
62     /**
63      * Gets bean instances used in the tests.
64      * @throws Exception if there is a problem with the bean initialization.
65      */

66     @BeforeMethod
67     public void startUp() throws Exception JavaDoc {
68         bean = getBeanRemoteInstance(SLSBSimpleEnvEntryMethodInjection00.class, ItfSimpleEnvEntry.class);
69
70     }
71
72     /**
73      * Tests if a string value was correctly injected.
74      * @input -
75      * @output -
76      */

77     @Test
78     public void testString00() {
79         bean.checkString00();
80     }
81
82     /**
83      * Tests if a character value was correctly injected.
84      * @input -
85      * @output -
86      */

87     @Test
88     public void testCharacter00() {
89         bean.checkCharacter00();
90     }
91
92     /**
93      * Tests if an integer value was correctly injected.
94      * @input -
95      * @output -
96      */

97     @Test
98     public void testInteger00() {
99         bean.checkInteger00();
100     }
101
102     /**
103      * Tests if a boolean value was correctly injected.
104      * @input -
105      * @output -
106      */

107     @Test
108     public void testBoolean00() {
109         bean.checkBoolean00();
110     }
111
112     /**
113      * Tests if a double value was correctly injected.
114      * @input -
115      * @output -
116      */

117     @Test
118     public void testDouble00() {
119         bean.checkDouble00();
120     }
121
122     /**
123      * Tests if a byte value was correctly injected.
124      * @input -
125      * @output -
126      */

127     @Test
128     public void testByte00() {
129         bean.checkByte00();
130     }
131
132     /**
133      * Tests if a short value was correctly injected.
134      * @input -
135      * @output -
136      */

137     @Test
138     public void testShort00() {
139         bean.checkByte00();
140     }
141
142     /**
143      * Tests if a byte value was correctly injected.
144      * @input -
145      * @output -
146      */

147     @Test
148     public void testLong00() {
149         bean.checkLong00();
150     }
151
152     /**
153      * Tests if a float value was correctly injected.
154      * @input -
155      * @output -
156      */

157     @Test
158     public void testFloat00() {
159         bean.checkFloat00();
160     }
161
162     /**
163      * This test should cause an enhancer exception. The @Resource is annoted in a final field, it is denied by the
164      * specification.
165      * @input -
166      * @output -
167      * @throws Exception if there is an enhancer exception.
168      */

169     @Test(groups = {"withWrongSpecification"}, expectedExceptions = IllegalStateException JavaDoc.class)
170     public void testWrongSpec00() throws Exception JavaDoc {
171         List JavaDoc<String JavaDoc> lstFiles = new ArrayList JavaDoc<String JavaDoc>();
172
173         lstFiles.add(ItfOneMethod01.class.getName().replace(".", File.separator) + EXT_CLASS);
174         lstFiles.add(SLSBStaticMethodEntry.class.getName().replace(".", File.separator) + EXT_CLASS);
175         enhanceNewClassLoader(lstFiles, TYPE.ALL);
176     }
177 }
178
Popular Tags