Source Code Cross Referenced for A_BasicHomeInterfaceEC.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas » jtests » clients » entity » 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.entity 
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_BasicHomeInterfaceEC.java 5474 2004-09-22 07:20:50Z durieuxp $
023:         * --------------------------------------------------------------------------
024:         */
025:
026:        package org.objectweb.jonas.jtests.clients.entity;
027:
028:        import java.util.Enumeration;
029:
030:        import javax.ejb.FinderException;
031:
032:        import org.objectweb.jonas.jtests.beans.ebasic.Simple;
033:
034:        /**
035:         * This set of test are basic tests on CMP entity home interface.
036:         * Only specific tests to CMP are here, all tests common to CMP and BMP
037:         * are in the inherited class A_BasicHomeInterface.
038:         * @author Philippe Coq, Philippe Durieux, Helene Joanin. (jonas team)
039:         */
040:        public abstract class A_BasicHomeInterfaceEC extends
041:                A_BasicHomeInterface {
042:
043:            public A_BasicHomeInterfaceEC(String name) {
044:                super (name);
045:            }
046:
047:            // --------------------------------------------------------------------
048:            // tests on clause where for CMP finder methods
049:            // These tests are specific to CMP 
050:            // ---------------------------------------------------------------------
051:
052:            /**
053:             * testFinderBetween  verify a finder method that return a Enumeration
054:             * whith a where clause :
055:             *  where ?1 <= c_info and c_info <= ?2 and ?1 <= c_numtest and c_numtest <= ?2
056:             * the purpose of this test is to verify the correct interpretation of parameters
057:             * ?1 ?2
058:             */
059:            public void testFinderBetween() throws Exception {
060:                int value = 991959;
061:                getHome().create("991959_1", value, value);
062:                getHome().create("991959_2", value, value);
063:                Simple entity = null;
064:                Enumeration eList = null;
065:                eList = getHome().findInfo_beetwen(value, value);
066:                int nb = 0;
067:                while (eList.hasMoreElements()) {
068:                    entity = (Simple) javax.rmi.PortableRemoteObject.narrow(
069:                            eList.nextElement(), Simple.class);
070:                    nb++;
071:                    assertEquals("Wrong Info value", entity.getInfo(), value);
072:                    assertEquals("Wrong NumTest value", entity.getNumTest(),
073:                            value);
074:                }
075:                assertEquals("Wrong number of entities found", 2, nb);
076:                getHome().remove("991959_1");
077:                getHome().remove("991959_2");
078:            }
079:
080:            /**
081:             * testFinderEqualOne  verify a finder method that return a Enumeration
082:             * whith a where clause :
083:             *   where c_info = ?1 and c_numtest = ?1
084:             * the object of this test is to verify the correct interpretation of parameters
085:             * ?1 ?2
086:             */
087:            public void testFinderEqualOne() throws Exception {
088:                Simple entity = null;
089:                Enumeration eList = null;
090:                eList = getHome().findEqualOne(80);
091:                int nb = 0;
092:                while (eList.hasMoreElements()) {
093:                    entity = (Simple) javax.rmi.PortableRemoteObject.narrow(
094:                            eList.nextElement(), Simple.class);
095:                    nb++;
096:                    assertEquals(80, entity.getInfo());
097:                    assertEquals(80, entity.getNumTest());
098:                }
099:                assertEquals(2, nb);
100:            }
101:
102:            /**
103:             * testFinderEqualTwo  verify a finder method that return a Enumeration
104:             * whith a where clause :
105:             *   where c_info = ? and c_numtest = ?
106:             * the object of this test is to verify the correct interpretation of parameters
107:             * ?1 ?2
108:             */
109:            public void testFinderEqualTwo() throws Exception {
110:                Simple entity = null;
111:                Enumeration eList = null;
112:                eList = getHome().findEqualTwo(100, 90);
113:                int nb = 0;
114:                while (eList.hasMoreElements()) {
115:                    entity = (Simple) javax.rmi.PortableRemoteObject.narrow(
116:                            eList.nextElement(), Simple.class);
117:                    nb++;
118:                    assertEquals(100, entity.getInfo());
119:                    assertEquals(90, entity.getNumTest());
120:                }
121:                assertEquals(1, nb);
122:            }
123:
124:            /**
125:             * Execute an finder method defined to expect a single object with the result
126:             * set that returns more than one.
127:             * Ensure that a FinderException is thrown.
128:             */
129:            public void testFindOneByNum() throws Exception {
130:                try {
131:                    Simple p = getHome().findOneByNum(4);
132:                } catch (FinderException e) {
133:                    // Pass
134:                    return;
135:                }
136:                fail("FinderException not thrown as expected");
137:            }
138:
139:            /**
140:             * testManyOperations verify many various operation calls.
141:             *  N times (create, finderXXX, getXXX, remove)
142:             * (do not launch systematicaly this test because it's long)
143:             */
144:            public void testManyOperations() throws Exception {
145:                for (int i = 0; i < 100; i++) {
146:                    getHome().create("pkmany" + i, 20, 6);
147:                    Simple entity2 = getHome().findByTestName("pkmany" + i);
148:                    assertEquals(20, entity2.getInfo());
149:                    // cleaning
150:                    entity2.remove();
151:                }
152:            }
153:
154:            /**
155:             * test of allowed operation on home method
156:             * THis test fails today (bug #300413)
157:             */
158:            public void testHomeMethod() throws Exception {
159:                getHome().globalOpe();
160:            }
161:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.