Source Code Cross Referenced for WSDL2JavaImplTest.java in  » IDE-Netbeans » mobility » org » netbeans » modules » e2e » wsdl » wsdl2java » 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 » IDE Netbeans » mobility » org.netbeans.modules.e2e.wsdl.wsdl2java 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.netbeans.modules.e2e.wsdl.wsdl2java;
002:
003:        import java.io.File;
004:        import java.util.HashMap;
005:        import java.util.HashSet;
006:        import java.util.List;
007:        import junit.framework.*;
008:        import java.util.Set;
009:        import javax.lang.model.element.ExecutableElement;
010:        import javax.lang.model.element.TypeElement;
011:        import javax.lang.model.type.TypeMirror;
012:        import org.netbeans.modules.e2e.api.wsdl.wsdl2java.WSDL2Java;
013:        import org.openide.filesystems.FileUtil;
014:
015:        /**
016:         *
017:         * @author Lukas Waldmann
018:         */
019:        public class WSDL2JavaImplTest extends TestCase {
020:            final String outputDir = "C:\\WSDL";
021:            final String wsdlFile = "C:\\WSDL\\QuizService.wsdl";
022:            final String pack = "test";
023:
024:            Set<String> generatedFiles;
025:            HashMap<String, Object> report = new HashMap<String, Object>();
026:
027:            public WSDL2JavaImplTest(String testName) {
028:                super (testName);
029:            }
030:
031:            protected void setUp() throws Exception {
032:                WSDL2Java.Configuration conf = new WSDL2Java.Configuration();
033:                conf.setOutputDirectory(outputDir);
034:                conf.setWSDLFileName(wsdlFile);
035:                conf.setPackageName(pack);
036:                org.netbeans.modules.e2e.wsdl.wsdl2java.WSDL2JavaImpl instance = new WSDL2JavaImpl(
037:                        conf);
038:
039:                boolean result = instance.generate();
040:            }
041:
042:            protected void tearDown() throws Exception {
043:            }
044:
045:            /**
046:             * Test of generate method, of class org.netbeans.modules.e2e.wsdl.wsdl2java.WSDL2JavaImpl.
047:             */
048:            public void testGenerate() {
049:                System.out.println("generate");
050:
051:                for (String fName : generatedFiles) {
052:                    HashMap<String, Object> expectedClasses = (HashMap<String, Object>) report
053:                            .remove(fName);
054:                    assertNotNull("File " + fName
055:                            + " was not expected to be generated",
056:                            expectedClasses);
057:
058:                    File file = new File(outputDir + File.separator + fName);
059:                    ClassExplorer explorer = new ClassExplorer(FileUtil
060:                            .toFileObject(file));
061:                    List<TypeElement> generatedTypes = explorer.getClasses();
062:                    assertTrue("Generated classes for file " + fName
063:                            + " doesn't match expected", explorer
064:                            .compareClasses(expectedClasses.keySet(),
065:                                    generatedTypes));
066:                    for (TypeElement type : generatedTypes) {
067:                        HashMap<String, Object> expectedMethods = (HashMap<String, Object>) expectedClasses
068:                                .remove(type.toString());
069:                        Set<String> methods = new HashSet<String>();
070:                        HashMap<String, String> retTypes = new HashMap<String, String>();
071:                        for (String metret : expectedMethods.keySet()) {
072:                            int pos = metret.indexOf('|');
073:                            String method = metret.substring(0, pos - 1);
074:                            methods.add(method);
075:                            retTypes.put(method, metret.substring(pos + 1));
076:                        }
077:                        List<ExecutableElement> generatedMethods = explorer
078:                                .getMethods(type);
079:                        assertTrue("Generated methods for class "
080:                                + type.toString() + " doesn't match expected",
081:                                explorer.compareMethods(methods,
082:                                        generatedMethods));
083:                        for (ExecutableElement method : generatedMethods) {
084:                            //Check return type
085:                            assertEquals("Return type of method "
086:                                    + method.toString()
087:                                    + " doesn't match expected", retTypes
088:                                    .get(method.toString()), explorer
089:                                    .getReturnType(method));
090:
091:                            Set<String> expectedParameters = (Set<String>) expectedMethods
092:                                    .remove(method.toString() + '|'
093:                                            + retTypes.get(method.toString()));
094:                            assertNotNull("Method " + method.toString()
095:                                    + " was not expected to be generated",
096:                                    expectedParameters);
097:
098:                            List<TypeMirror> generatedParameters = explorer
099:                                    .getParameters(method);
100:                            assertTrue("Generated classes for file " + fName
101:                                    + " doesn't match expected", explorer
102:                                    .compareParameters(expectedParameters,
103:                                            generatedParameters));
104:                        }
105:                        if (!expectedMethods.isEmpty()) {
106:                            fail("Following methods "
107:                                    + expectedMethods.keySet() + " of class "
108:                                    + type.toString()
109:                                    + " were not generated for file " + fName);
110:                        }
111:                    }
112:                    if (!expectedClasses.isEmpty()) {
113:                        fail("Following classes " + expectedClasses.keySet()
114:                                + " were not generated for file " + fName);
115:                    }
116:                }
117:                if (!report.isEmpty()) {
118:                    fail("Following files were not generated: "
119:                            + report.keySet());
120:                }
121:            }
122:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.