Source Code Cross Referenced for ServiceEndpointTest.java in  » Web-Services » crispy » test » crispy » server » 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 » Web Services » crispy » test.crispy.server 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        package test.crispy.server;
02:
03:        import junit.framework.TestCase;
04:        import net.sf.crispy.ExceptionWrapper;
05:        import net.sf.crispy.InterceptorHandler;
06:        import net.sf.crispy.interceptor.StopWatchInterceptor;
07:        import net.sf.crispy.server.ServiceEndpoint;
08:        import net.sf.crispy.server.ServiceEndpointImpl;
09:        import test.crispy.JUnitTestException;
10:        import test.crispy.example.SubServiceEndpoint;
11:        import test.crispy.example.interceptor.WaitInterceptor;
12:        import test.crispy.example.service.EchoImpl;
13:
14:        public class ServiceEndpointTest extends TestCase {
15:
16:            public void testDoInvoke() throws Exception {
17:                ServiceEndpoint lvEndpoint = new ServiceEndpointImpl();
18:                Object lvResult = lvEndpoint.doInvoke(new EchoImpl(),
19:                        EchoImpl.class.getMethod("ping", null), null, null);
20:                assertEquals(EchoImpl.PING_STRING, lvResult);
21:            }
22:
23:            public void testDoInvoke_2() throws Exception {
24:                ServiceEndpoint lvEndpoint = new ServiceEndpointImpl();
25:                Object lvResult = lvEndpoint.doInvoke(new EchoImpl(),
26:                        EchoImpl.class.getMethod("echo",
27:                                new Class[] { String.class }),
28:                        new Object[] { "My Echo" }, null);
29:                assertEquals("My Echo", lvResult);
30:            }
31:
32:            public void testInterceptorHandler() throws Exception {
33:                ServiceEndpoint lvEndpoint = new ServiceEndpointImpl();
34:                assertNotNull(lvEndpoint.createNewInterceptorHandlerInstance());
35:            }
36:
37:            public void testInterceptorHandler_2() throws Exception {
38:                SubServiceEndpoint lvEndpoint = new SubServiceEndpoint();
39:                assertNotNull(lvEndpoint.createNewInterceptorHandlerInstance());
40:
41:                StopWatchInterceptor lvStopWatchInterceptor = lvEndpoint
42:                        .getStopWatchInterceptor();
43:                assertTrue(lvStopWatchInterceptor.getStopTimeInvokeMethod() < 0);
44:
45:                lvEndpoint.doInvoke(new EchoImpl(), EchoImpl.class.getMethod(
46:                        "echo", new Class[] { String.class }),
47:                        new Object[] { "My Echo" }, null);
48:                assertTrue(lvStopWatchInterceptor.getStopTimeInvokeMethod() > 20);
49:                assertEquals(2, lvEndpoint
50:                        .createNewInterceptorHandlerInstance()
51:                        .getInterceptorSize());
52:            }
53:
54:            public void testInterceptorHandler_3() throws Exception {
55:                ServiceEndpoint lvEndpoint = new ServiceEndpointImpl();
56:                assertNotNull(lvEndpoint.createNewInterceptorHandlerInstance());
57:
58:                StopWatchInterceptor lvStopWatch = new StopWatchInterceptor();
59:                InterceptorHandler lvHandler = new InterceptorHandler();
60:                lvHandler.addInterceptor(new WaitInterceptor());
61:                lvHandler.addInterceptor(lvStopWatch);
62:
63:                Object lvResult = lvEndpoint
64:                        .doInvoke(new EchoImpl(), EchoImpl.class.getMethod(
65:                                "ping", null), null, lvHandler);
66:                assertEquals(EchoImpl.PING_STRING, lvResult);
67:                assertTrue(lvStopWatch.getStopTimeInvokeMethod() > 20);
68:            }
69:
70:            public void testException() throws Exception {
71:                ServiceEndpoint lvEndpoint = new ServiceEndpointImpl();
72:
73:                String lvMessage = "Test-Message";
74:                Object lvResult = lvEndpoint.doInvoke(new EchoImpl(),
75:                        EchoImpl.class.getMethod("throwException",
76:                                new Class[] { String.class }),
77:                        new String[] { lvMessage }, null);
78:                assertNotNull(lvResult);
79:                assertTrue(lvResult instanceof  ExceptionWrapper);
80:                ExceptionWrapper lvExceptionWrapper = (ExceptionWrapper) lvResult;
81:                assertEquals(JUnitTestException.class.getName(),
82:                        lvExceptionWrapper.getExceptionClassName());
83:                assertEquals("Test Exception: " + lvMessage, lvExceptionWrapper
84:                        .getMessage());
85:
86:                assertTrue(lvExceptionWrapper.getStackTraceByteArray().length > 0);
87:                assertTrue(lvExceptionWrapper.getStackTraceElementWrapperList()
88:                        .size() > 0);
89:            }
90:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.