Source Code Cross Referenced for ValidationClientServerTest.java in  » ESB » celtix-1.0 » org » objectweb » celtix » systest » schema_validation » 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 » ESB » celtix 1.0 » org.objectweb.celtix.systest.schema_validation 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.objectweb.celtix.systest.schema_validation;
002:
003:        import java.io.Serializable;
004:        import java.net.URL;
005:        import java.util.List;
006:
007:        import javax.xml.namespace.QName;
008:        import javax.xml.ws.ProtocolException;
009:
010:        import junit.framework.Test;
011:        import junit.framework.TestSuite;
012:
013:        import org.objectweb.celtix.systest.common.ClientServerSetupBase;
014:        import org.objectweb.celtix.systest.common.ClientServerTestBase;
015:        import org.objectweb.schema_validation.SchemaValidation;
016:        import org.objectweb.schema_validation.SchemaValidationService;
017:        import org.objectweb.schema_validation.types.ComplexStruct;
018:        import org.objectweb.schema_validation.types.OccuringStruct;
019:
020:        public class ValidationClientServerTest extends ClientServerTestBase {
021:
022:            private final QName serviceName = new QName(
023:                    "http://objectweb.org/schema_validation",
024:                    "SchemaValidationService");
025:            private final QName portName = new QName(
026:                    "http://objectweb.org/schema_validation", "SoapPort");
027:
028:            public static Test suite() throws Exception {
029:                TestSuite suite = new TestSuite(
030:                        ValidationClientServerTest.class);
031:                return new ClientServerSetupBase(suite) {
032:                    public void startServers() throws Exception {
033:                        assertTrue("server did not launch correctly",
034:                                launchServer(ValidationServer.class));
035:                    }
036:
037:                    public void setUp() throws Exception {
038:                        // set up configuration to enable schema validation
039:                        URL url = getClass().getResource("celtix-config.xml");
040:                        assertNotNull("cannot find test resource", url);
041:                        configFileName = url.toString();
042:                        super .setUp();
043:                    }
044:                };
045:            }
046:
047:            // TODO : Change this test so that we test the combinations of
048:            // client and server with schema validation enabled/disabled...
049:            public void testSchemaValidation() throws Exception {
050:                URL wsdl = getClass().getResource(
051:                        "/wsdl/schema_validation.wsdl");
052:                assertNotNull(wsdl);
053:
054:                SchemaValidationService service = new SchemaValidationService(
055:                        wsdl, serviceName);
056:                assertNotNull(service);
057:
058:                SchemaValidation validation = service.getPort(portName,
059:                        SchemaValidation.class);
060:
061:                ComplexStruct complexStruct = new ComplexStruct();
062:                complexStruct.setElem1("one");
063:                // Don't initialize a member of the structure.  Validation should throw
064:                // an exception.
065:                // complexStruct.setElem2("two");
066:                complexStruct.setElem3(3);
067:                try {
068:                    /*boolean result =*/validation
069:                            .setComplexStruct(complexStruct);
070:                    fail("Set ComplexStruct hould have thrown ProtocolException");
071:                } catch (ProtocolException e) {
072:                    //System.out.println(e.getMessage()); 
073:                }
074:
075:                OccuringStruct occuringStruct = new OccuringStruct();
076:                // Populate the list in the wrong order.  Validation should throw
077:                // an exception.
078:                List<Serializable> floatIntStringList = occuringStruct
079:                        .getVarFloatAndVarIntAndVarString();
080:                floatIntStringList.add(new Integer(42));
081:                floatIntStringList.add(new Float(4.2f));
082:                floatIntStringList.add("Goofus and Gallant");
083:                try {
084:                    /*boolean result =*/validation
085:                            .setOccuringStruct(occuringStruct);
086:                    fail("Set OccuringStruct hould have thrown ProtocolException");
087:                } catch (ProtocolException e) {
088:                    //System.out.println(e.getMessage());
089:                }
090:
091:                try {
092:                    // The server will attempt to return an invalid ComplexStruct
093:                    /*complexStruct =*/validation.getComplexStruct("Hello");
094:                    // This would throw an exception if validation is disabled on
095:                    // the server and enabled on the client.
096:                    //fail("Get ComplexStruct should have thrown ProtocolException");
097:                } catch (ProtocolException e) {
098:                    //System.out.println(e.getMessage()); 
099:                }
100:
101:                try {
102:                    // The server will attempt to return an invalid OccuringStruct
103:                    /*occuringStruct =*/validation.getOccuringStruct("World");
104:                    // This would throw an exception if validation is disabled on
105:                    // the server and enabled on the client.
106:                    //fail("Get OccuringStruct should have thrown ProtocolException");
107:                } catch (ProtocolException e) {
108:                    //System.out.println(e.getMessage()); 
109:                }
110:            }
111:
112:            public static void main(String[] args) {
113:                junit.textui.TestRunner.run(ValidationClientServerTest.class);
114:            }
115:
116:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.