Source Code Cross Referenced for A_ClientView.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas » jtests » clients » local » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » JOnAS 4.8.6 » org.objectweb.jonas.jtests.clients.local 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 1999 Bull S.A.
004:         * Contact: jonas-team@objectweb.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: A_ClientView.java 7540 2005-10-20 13:15:22Z durieuxp $
023:         * --------------------------------------------------------------------------
024:         */
025:
026:        package org.objectweb.jonas.jtests.clients.local;
027:
028:        import javax.ejb.EJBException;
029:        import javax.ejb.NoSuchObjectLocalException;
030:        import javax.ejb.RemoveException;
031:        import javax.rmi.PortableRemoteObject;
032:
033:        import org.objectweb.jonas.jtests.beans.local.TargetLocal;
034:        import org.objectweb.jonas.jtests.beans.local.TargetSLHome;
035:        import org.objectweb.jonas.jtests.beans.local.TargetSLLocalHome;
036:        import org.objectweb.jonas.jtests.util.JTestCase;
037:
038:        /**
039:         * This Class defines Test cases that can be run either SF or SL bean.
040:         * These tests are related to the "Client View of a Session Bean"
041:         * A session bean that supports both Local & Remote interface is used
042:         * (TargetSL oe TargetSF in beans/local)
043:         * Here are testcases taht must be run remotly
044:         * @see  EJB2.0 specification Chapter 6.
045:         * @author Ph Coq, Ph Durieux
046:         */
047:
048:        public abstract class A_ClientView extends JTestCase {
049:
050:            public A_ClientView(String name) {
051:                super (name);
052:            }
053:
054:            /**
055:             * @return TargetSLLocalHome
056:             */
057:            public abstract TargetSLLocalHome getLocalHome() throws Exception;
058:
059:            /**
060:             * Lookup a LocalHome Object
061:             *
062:             * This test verify that we can look up a LocalHome Object
063:             * via the root context
064:             */
065:
066:            public void testLocalLookup() throws Exception {
067:                TargetSLLocalHome h = null;
068:                h = getLocalHome();
069:                assertTrue(h != null);
070:            }
071:
072:            /**
073:             * EJB Reference
074:             *
075:             * This test verify that we can look up a Home Object of a bean in the same ejbjar file
076:             * via the java:comp/env subcontext using an ejb-reference contains an ejb-link.
077:             */
078:            public void testEjbRef() throws Exception {
079:
080:                TargetSLHome home = null;
081:                String bName = "java:comp/env/ejb/targetremotelink";
082:                home = (TargetSLHome) PortableRemoteObject.narrow(ictx
083:                        .lookup(bName), TargetSLHome.class);
084:                assertTrue(home != null);
085:            }
086:
087:            /**
088:             * EJB Reference
089:             *
090:             * This test verify that we can look up a Home Object of a bean (in the same ejbjar file)
091:             * via the java:comp/env subcontext using an ejb-reference with a jonas-ejb-reference.
092:             */
093:            public void testEjbRefWithJonasEjbRef() throws Exception {
094:
095:                TargetSLHome home = null;
096:                String bName = "java:comp/env/ejb/targetremotenolink";
097:                home = (TargetSLHome) PortableRemoteObject.narrow(ictx
098:                        .lookup(bName), TargetSLHome.class);
099:                assertTrue(home != null);
100:            }
101:
102:            /**
103:             * EJBLocal Reference
104:             *
105:             * This test verify that we can look up a LocalHome Object
106:             * via the java:comp/env subcontext
107:             */
108:
109:            public void testEjbLocalRef() throws Exception {
110:
111:                TargetSLLocalHome home = null;
112:                String bName = "java:comp/env/ejb/targetlocal";
113:                home = (TargetSLLocalHome) ictx.lookup(bName);
114:                assertTrue(home != null);
115:            }
116:
117:            /**
118:             * This test verify we can create a Local session bean and remove it
119:             */
120:            public void testLocalCreateRemove() throws Exception {
121:                TargetLocal tl = getLocalHome().create();
122:                tl.remove();
123:            }
124:
125:            /**
126:             * This test verify we can create a Local session , access to the bean
127:             * via its local interface and remove it
128:             * It verifies we cannot access to the bean after remove
129:             */
130:            public void testLocalBusinessMethod1() throws Exception {
131:                TargetLocal tl = getLocalHome().create();
132:                assertEquals(20, tl.getTwenty());
133:                tl.remove();
134:                try {
135:                    tl.lmethod2("Bye");
136:                    fail("NoSuchObjectLocalException must be raised");
137:                } catch (NoSuchObjectLocalException e) {
138:                }
139:            }
140:
141:            /**
142:             * Same test than testLocalBusinessMethod1 but two calls to businessmethod
143:             */
144:            public void testLocalBusinessMethod2() throws Exception {
145:                TargetLocal tl = getLocalHome().create();
146:                assertEquals(20, tl.getTwenty());
147:                assertEquals(20, tl.getTwenty());
148:                tl.remove();
149:            }
150:
151:            /**
152:             * test 3 Local Business Methods
153:             */
154:            public void testLocalBusinessMethod3() throws Exception {
155:                TargetLocal tl = getLocalHome().create();
156:                assertEquals(20, tl.getTwenty());
157:                tl.lmethod2("Hello");
158:                assertEquals(20, tl.getTwenty());
159:                tl.remove();
160:            }
161:
162:            /**
163:             * test EJBLocalObject.isIdentical on the same bean
164:             */
165:            public void testLocalIsIdenticalOnSameBean() throws Exception {
166:                TargetLocal tl = getLocalHome().create();
167:                assertTrue(tl.isIdentical(tl));
168:                tl.remove();
169:            }
170:
171:            /**
172:             * test EJBLocalObject.getPrimary Key
173:             * This test verify that an  EJB Exception must be catched
174:             */
175:            public void testLocalGetPrimaryKey() throws Exception {
176:                TargetLocal tl = getLocalHome().create();
177:                try {
178:                    tl.getPrimaryKey();
179:                    fail("getPrimaryKey should raise EJBException on a session bean");
180:                } catch (EJBException e) {
181:                } finally {
182:                    tl.remove();
183:                }
184:            }
185:
186:            /**
187:             * test that EJBLocalHome.remove(pk) should raise EJBException (API) or
188:             * RemoveException (spec EJB 2.0 6.3.2)
189:             */
190:            public void testLocalRemoveByPK() throws Exception {
191:                Object pk = null;
192:                try {
193:                    getLocalHome().remove(pk);
194:                    fail("getPrimaryKey should raise Exception on a session bean");
195:                } catch (EJBException e) {
196:                } catch (RemoveException e) {
197:                }
198:            }
199:
200:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.