KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > sessionbean > stateless > context > TestSLSessionContextMethods00


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: TestSLSessionContextMethods00.java 979 2006-07-28 13:19:50Z studzine $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.sessionbean.stateless.context;
26
27 import static org.objectweb.easybeans.tests.common.helper.EJBHelper.getBeanRemoteInstance;
28 import static org.objectweb.easybeans.tests.common.helper.ExceptionHelper.checkCause;
29 import static org.testng.Assert.fail;
30
31 import javax.ejb.EJBException JavaDoc;
32
33 import org.objectweb.easybeans.tests.common.ejbs.base.sessioncontext.ItfSessionContextBMT;
34 import org.objectweb.easybeans.tests.common.ejbs.base.sessioncontext.ItfSessionContextCMT;
35 import org.objectweb.easybeans.tests.common.ejbs.base.sessioncontext.ItfSessionContextEJB3;
36 import org.objectweb.easybeans.tests.common.ejbs.base.sessioncontext.ItfSessionContextTimer;
37 import org.objectweb.easybeans.tests.common.ejbs.base.sessioncontext.ItfSessionContextWS;
38 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.sessioncontext.SLSBSessionCtxMethods;
39 import org.testng.annotations.BeforeMethod;
40 import org.testng.annotations.Test;
41
42 /**
43  * Verifies the SessionContext's method invocation.The tests for the methods
44  * isCallerPrincipal, isCallerInRole and getCallerIdentity are defined in the
45  * security package.
46  * @reference JSR 220-PROPOSED FINAL
47  * @requirement Application Server must be running; the beans
48  * org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.sessioncontext.*
49  * must be deployed.
50  * @author Eduardo Studzinski Estima de Castro
51  * @author Gisele Pinheiro Souza
52  */

53 public class TestSLSessionContextMethods00 implements ItfSessionContextBMT, ItfSessionContextCMT,
54         ItfSessionContextEJB3, ItfSessionContextTimer, ItfSessionContextWS {
55
56     /**
57      * Bean.
58      */

59     private ItfSessionContextBMT beanBMT;
60
61     /**
62      * Bean.
63      */

64     private ItfSessionContextCMT beanCMT;
65
66     /**
67      * Bean.
68      */

69     private ItfSessionContextEJB3 beanEJB3;
70
71
72     /**
73      * Bean.
74      */

75     private ItfSessionContextTimer beanTimer;
76
77     /**
78      * Bean.
79      */

80     private ItfSessionContextWS beanWS;
81
82     /**
83      * Gets bean instances used in the tests.
84      * @throws Exception if there is a problem with bean initialization.
85      */

86     @BeforeMethod
87     public void startUp() throws Exception JavaDoc {
88         beanBMT = getBeanRemoteInstance(SLSBSessionCtxMethods.class, ItfSessionContextBMT.class);
89         beanCMT = getBeanRemoteInstance(SLSBSessionCtxMethods.class, ItfSessionContextCMT.class);
90         beanEJB3 = getBeanRemoteInstance(SLSBSessionCtxMethods.class, ItfSessionContextEJB3.class);
91         beanTimer = getBeanRemoteInstance(SLSBSessionCtxMethods.class, ItfSessionContextTimer.class);
92      // beanWS = getBeanRemoteInstance(SLSBSessionCtxMethods.class, ItfSessionContextWS.class);
93
}
94
95     /**
96      * @see org.objectweb.easybeans.tests.common.ejbs.base.sessioncontext.ItfSessionContextBMT
97      * @input -
98      * @output IllegalStateException encapsulated into an EJBException.
99      */

100     @Test
101     public void verifyGetUserTransaction() {
102         try {
103             beanBMT.verifyGetUserTransaction();
104             fail("The bean must throw an exception.");
105         } catch (EJBException JavaDoc e) {
106             checkCause(e, IllegalStateException JavaDoc.class);
107         }
108     }
109
110     /**
111      * @see org.objectweb.easybeans.tests.common.ejbs.base.sessioncontext.ItfSessionContextEJB3
112      * @input -
113      * @output -
114      */

115     @Test
116     public void verifyGetBusinessObject() {
117         beanEJB3.verifyGetBusinessObject();
118     }
119
120     /**
121      * @see org.objectweb.easybeans.tests.common.ejbs.base.sessioncontext.ItfSessionContextEJB3
122      * @input -
123      * @output -
124      */

125     @Test
126     public void verifyGetInvokedBusinessInterface() {
127         beanEJB3.verifyGetInvokedBusinessInterface();
128     }
129
130     /**
131      * @see org.objectweb.easybeans.tests.common.ejbs.base.sessioncontext.ItfSessionContextTimer
132      * @input -
133      * @output -
134      */

135     @Test
136     public void verifyGetTimerService() {
137         beanTimer.verifyGetTimerService();
138     }
139
140     /**
141      * @see org.objectweb.easybeans.tests.common.ejbs.base.sessioncontext.ItfSessionContextTimer
142      * @input -
143      * @output -
144      */

145     @Test
146     public void verifySetRollbackOnly() {
147         beanCMT.verifySetRollbackOnly();
148     }
149
150     /**
151      * @see org.objectweb.easybeans.tests.common.ejbs.base.sessioncontext.ItfSessionContextTimer
152      * @input -
153      * @output -
154      */

155     @Test
156     public void verifyGetRollbackOnly() {
157         beanCMT.verifyGetRollbackOnly();
158     }
159
160
161     /**
162      * @see org.objectweb.easybeans.tests.common.ejbs.base.sessioncontext.ItfSessionContextTimer
163      * @input -
164      * @output -
165      */

166     // @Test
167
public void verifyGetMessageContext() {
168         // TODO: implement
169
}
170
171 }
172
Popular Tags