Source Code Cross Referenced for TestJ2eedoJ2ee.java in  » Database-ORM » Speedo_1.4.5 » org » objectweb » speedo » j2eedo » 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 » Database ORM » Speedo_1.4.5 » org.objectweb.speedo.j2eedo 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Speedo: an implementation of JDO compliant personality on top of JORM
003:         * generic I/O sub-system. Copyright (C) 2001-2004 France Telecom R&D
004:         * 
005:         * This library is free software; you can redistribute it and/or modify it
006:         * under the terms of the GNU Lesser General Public License as published by the
007:         * Free Software Foundation; either version 2 of the License, or (at your
008:         * option) any later version.
009:         * 
010:         * This library is distributed in the hope that it will be useful, but WITHOUT
011:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
012:         * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
013:         * for more details.
014:         * 
015:         * You should have received a copy of the GNU Lesser General Public License
016:         * along with this library; if not, write to the Free Software Foundation,
017:         * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018:         * 
019:         * Release: 1.0
020:         * 
021:         * Created on Apr 9, 2004 @author fmillevi@yahoo.com
022:         *  
023:         */
024:        package org.objectweb.speedo.j2eedo;
025:
026:        import javax.jdo.JDOException;
027:        import javax.jdo.JDOFatalException;
028:
029:        import org.objectweb.speedo.j2eedo.common.HTTPTools;
030:        import org.objectweb.speedo.j2eedo.web.ApplicationServlet;
031:        import org.objectweb.util.monolog.api.BasicLevel;
032:
033:        /**
034:         * This class defines junit application tests. The different actions are
035:         * performed throulaunch an HTTP request on a J2EE application server.
036:         * <p>
037:         * <b>It's assume that the j2eedo application have been deployed on it.</b>
038:         * 
039:         * @author fmillevi@yahoo.com
040:         * @see TestJ2eedoApplication
041:         */
042:        public class TestJ2eedoJ2ee extends TestJ2eedoApplication {
043:            protected final String TESTJ2EE = getLoggerName() + ".j2ee";
044:            protected final String URL = getLoggerName() + ".url";
045:            protected final String HTTPPARAMS = getLoggerName() + ".httpParams";
046:
047:            protected String url = null;
048:            protected String httpParams = null;
049:
050:            /**
051:             * Empty constructor, call the TestJ2eedoApplication constructor and gets
052:             * the specific parameters for J2EE application test
053:             * 
054:             * @param s
055:             *            name of class
056:             */
057:            public TestJ2eedoJ2ee(String s) {
058:                super (s);
059:                this .url = System.getProperty(this .URL,
060:                        "http://localhost:9000/j2eedo/");
061:                this .httpParams = System
062:                        .getProperty(this .HTTPPARAMS,
063:                                ApplicationServlet.WITH_TRANSACTION_PARAMETER
064:                                        + "=true");
065:            }
066:
067:            protected void setUp() {
068:                super .setUp();
069:                if (null == this .url)
070:                    return;
071:                try {
072:                    logger.log(BasicLevel.INFO, HTTPTools.getURL(this .url
073:                            + "evictall.do",
074:                            this .httpParams + "&"
075:                                    + ApplicationServlet.PARAMETER_ACTION
076:                                    + "=evictall", "GET", logger));
077:                } catch (Exception e) {
078:                    logger.log(BasicLevel.ERROR, "");
079:                }
080:
081:            }
082:
083:            protected void displayTestParameters() {
084:                if (!logger.isLoggable(BasicLevel.INFO))
085:                    return;
086:                super .displayTestParameters();
087:
088:                logger.log(BasicLevel.INFO, "\n\tJ2EE application URL: "
089:                        + this .url + "\n\tHTTP default parameters : "
090:                        + this .httpParams);
091:            }
092:
093:            /**
094:             * This method executes the action pass as parameters throught an HTTP get
095:             * URL call.
096:             * 
097:             * @param action
098:             *            defines the type of action to be performed.
099:             * @exception Exception
100:             *                in case of error detected during HTTP call
101:             * @exception
102:             * @see org.objectweb.speedo.j2eedo.bo.DatabaseImpl
103:             * @see org.objectweb.speedo.j2eedo.TestJ2eedoApplication#performMethod(java.lang.String)
104:             */
105:            protected String performMethod(String action) throws Exception,
106:                    JDOException, JDOFatalException {
107:                String str = "";
108:                try {
109:                    return HTTPTools.getURL(this .url + action + ".do",
110:                            this .httpParams + "&"
111:                                    + ApplicationServlet.PARAMETER_ACTION + "="
112:                                    + action, "GET", logger);
113:                } catch (Exception e) {
114:                    logger.log(BasicLevel.ERROR, "HTTP:The call \"" + this .url
115:                            + action + ".do?" + this .httpParams + "&"
116:                            + ApplicationServlet.PARAMETER_ACTION + "="
117:                            + action + "\" throws Exception ", e);
118:                    assertTrue(
119:                            "HTTP:The call \"" + this .url + action + ".do?"
120:                                    + this .httpParams + "&"
121:                                    + ApplicationServlet.PARAMETER_ACTION + "="
122:                                    + action + "\" throws Exception :\n"
123:                                    + e.toString(), false);
124:                    throw e;
125:                }
126:            }
127:
128:            /**
129:             * This method calls action of the DatabaseImpl class throught an HTTP call
130:             * using an <b>EJB session container</b>
131:             * 
132:             * @see org.objectweb.speedo.j2eedo.bo.DatabaseImpl
133:             */
134:            public void testHTTPCallSessionContainer() {
135:                if (this .simpleTestOnly)
136:                    return;
137:                if (null == this .url)
138:                    return;
139:                this .httpParams = ApplicationServlet.WITH_TRANSACTION_PARAMETER
140:                        + "=false&"
141:                        + ApplicationServlet.TYPE_CONTAINER_PARAMETER
142:                        + "=true&" + ApplicationServlet.JDOTX + "=false";
143:                this .perform();
144:            }
145:
146:            /**
147:             * This method calls action of the DatabaseImpl class throught an HTTP call
148:             * using an <b>EJB session container</b>. , the servlet <b>gets the
149:             * persistence manager</b>
150:             * 
151:             * @see org.objectweb.speedo.j2eedo.bo.DatabaseImpl
152:             */
153:            public void testHTTPCallSessionContainerWithJdoTx() {
154:                if (this .simpleTestOnly)
155:                    return;
156:                if (null == this .url)
157:                    return;
158:                this .httpParams = ApplicationServlet.WITH_TRANSACTION_PARAMETER
159:                        + "=false&"
160:                        + ApplicationServlet.TYPE_CONTAINER_PARAMETER
161:                        + "=true&" + ApplicationServlet.JDOTX + "=true";
162:                this .perform();
163:            }
164:
165:            /**
166:             * This method calls action of the DatabaseImpl class throught an HTTP call
167:             * <b>without any transaction</b> is started, the servlet <b>gets the
168:             * persistence manager</b>
169:             * 
170:             * @see org.objectweb.speedo.j2eedo.bo.DatabaseImpl
171:             */
172:            public void testHTTPWithTransWithJdoTx() {
173:                if (this .simpleTestOnly)
174:                    return;
175:                if (null == this .url)
176:                    return;
177:                this .httpParams = ApplicationServlet.WITH_TRANSACTION_PARAMETER
178:                        + "=true&" + ApplicationServlet.JDOTX + "=true";
179:                this.perform();
180:            }
181:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.