Source Code Cross Referenced for F_WsGen.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas » jtests » clients » wsgen » 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.wsgen 
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: F_WsGen.java 7517 2005-10-18 08:14:02Z sauthieg $
023:         * --------------------------------------------------------------------------
024:         */package org.objectweb.jonas.jtests.clients.wsgen;
025:
026:        import java.io.File;
027:        import java.util.Enumeration;
028:        import java.util.jar.JarFile;
029:        import java.util.zip.ZipEntry;
030:
031:        import junit.framework.Test;
032:        import junit.framework.TestSuite;
033:
034:        /**
035:         * test case for WsGen
036:         */
037:        public class F_WsGen extends A_WsGen {
038:
039:            public F_WsGen(String name) {
040:                super (name);
041:            }
042:
043:            public static Test suite() {
044:                return new TestSuite(F_WsGen.class);
045:            }
046:
047:            public void setUp() throws Exception {
048:                super .setUp();
049:            }
050:
051:            public void tearDown() throws Exception {
052:                super .tearDown();
053:            }
054:
055:            /*
056:             * Tests :
057:             * - webapps (endpoint, clients, both, none) (various Schemas, DTD)
058:             * - ejbjars (endpoint, clients, both, none) (various Schemas, DTD)
059:             * - apps (combine above examples) + ()
060:             */
061:
062:            public void testWebappEndpointAlone() throws Exception {
063:
064:                // Check entries in JarFile
065:                String[] entries = new String[] {
066:                        "META-INF/MANIFEST.MF",
067:                        "WEB-INF/wsdl/AddressBookPort.wsdl",
068:                        "WEB-INF/wsdl/AddressBook.xsd",
069:                        "WEB-INF/web.xml",
070:                        "WEB-INF/webservices.xml",
071:                        "WEB-INF/jonas-webservices.xml",
072:                        "WEB-INF/mapping.xml",
073:                        "WEB-INF/classes/org/objectweb/jonas/jtests/servlets/endpoint/Address.class",
074:                        "WEB-INF/classes/org/objectweb/jonas/jtests/servlets/endpoint/AddressBook.class",
075:                        "WEB-INF/classes/org/objectweb/jonas/jtests/servlets/endpoint/AddressBookImpl.class",
076:                        "WEB-INF/classes/org/objectweb/jonas/jtests/servlets/endpoint/AddressBookException.class" };
077:
078:                JarFile alone = new JarFile(getJonasBaseFile("webapps"
079:                        + File.separator + "webendpoint.war"));
080:
081:                checkEntries(entries, alone);
082:
083:                assertEquals("entries number doesn't match", entries.length,
084:                        countEntries(alone));
085:
086:            }
087:
088:            public void testWsClientEjb() throws Exception {
089:
090:                // Check entries in JarFile
091:                String path = "org/objectweb/jonas/jtests/beans/wsclient/";
092:                String[] entries = new String[] { "META-INF/MANIFEST.MF",
093:                        "META-INF/jonas-ejb-jar.xml", "META-INF/ejb-jar.xml",
094:                        "META-INF/wsdl/query.wsdl" };
095:
096:                JarFile wsclient = new JarFile(getJonasBaseFile("ejbjars"
097:                        + File.separator + "wsclient.jar"));
098:
099:                checkEntries(entries, wsclient);
100:
101:            }
102:
103:            public void testTimeEndpoint() throws Exception {
104:                // Check entries in JarFile (Wrapping Application)
105:                String[] entries = new String[] { "META-INF/application.xml",
106:                        "META-INF/MANIFEST.MF", "time.war", "time.jar",
107:                        "time-client.jar" };
108:
109:                JarFile time = new JarFile(getJonasBaseFile("apps"
110:                        + File.separator + "time-test.ear"));
111:
112:                checkEntries(entries, time);
113:
114:                assertEquals("entries number doesn't match", 5,
115:                        countEntries(time));
116:
117:                // Check entries in JarFile (Wrapped WebApp)
118:                String tmp = unpackJar(time);
119:
120:                // Check war correctly created
121:                JarFile web = new JarFile(tmp + File.separator + "time.war");
122:                String[] webEntries = new String[] { "META-INF/MANIFEST.MF",
123:                        "WEB-INF/web.xml", "WEB-INF/web-jetty.xml",
124:                        "META-INF/context.xml",
125:                        "WEB-INF/sources/deploy-server-0.wsdd",
126:                        "WEB-INF/deploy-server-0.wsdd" };
127:
128:                // TODO should improve entries check : deploy-server-0 may be deploy-server-25 !!
129:                //checkEntries(webEntries, web);
130:                assertEquals("web entries number doesn't match",
131:                        webEntries.length, countEntries(web));
132:
133:                deleteDirectory(tmp);
134:
135:            }
136:
137:            public void checkEntries(String[] entries, JarFile file) {
138:
139:                for (int i = 0; i < entries.length; i++) {
140:                    ZipEntry ze = file.getEntry(entries[i]);
141:                    assertNotNull("missing entry '" + entries[i] + "' in '"
142:                            + file.getName() + "'", ze);
143:                }
144:            }
145:
146:            public int countEntries(JarFile file) {
147:                Enumeration e = file.entries();
148:                int count = 0;
149:                while (e.hasMoreElements()) {
150:                    ZipEntry ze = (ZipEntry) e.nextElement();
151:                    // not a directory
152:                    if (!ze.getName().endsWith("/")) {
153:                        count++;
154:                    }
155:
156:                }
157:                return count;
158:            }
159:
160:            public static void main(String args[]) {
161:                String testtorun = null;
162:                // Get args
163:                for (int argn = 0; argn < args.length; argn++) {
164:                    String s_arg = args[argn];
165:                    if (s_arg.equals("-n")) {
166:                        testtorun = args[++argn];
167:                    }
168:                }
169:                if (testtorun == null) {
170:                    junit.textui.TestRunner.run(suite());
171:                } else {
172:                    junit.textui.TestRunner.run(new F_WsGen(testtorun));
173:                }
174:            }
175:
176:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.