Source Code Cross Referenced for ExtensionTest.java in  » Web-Services-apache-cxf-2.0.1 » core » org » apache » cxf » bus » extension » 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 apache cxf 2.0.1 » core » org.apache.cxf.bus.extension 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Licensed to the Apache Software Foundation (ASF) under one
003:         * or more contributor license agreements. See the NOTICE file
004:         * distributed with this work for additional information
005:         * regarding copyright ownership. The ASF licenses this file
006:         * to you under the Apache License, Version 2.0 (the
007:         * "License"); you may not use this file except in compliance
008:         * with the License. You may obtain a copy of the License at
009:         *
010:         * http://www.apache.org/licenses/LICENSE-2.0
011:         *
012:         * Unless required by applicable law or agreed to in writing,
013:         * software distributed under the License is distributed on an
014:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015:         * KIND, either express or implied. See the License for the
016:         * specific language governing permissions and limitations
017:         * under the License.
018:         */package org.apache.cxf.bus.extension;
019:
020:        import org.junit.Assert;
021:        import org.junit.Test;
022:
023:        public class ExtensionTest extends Assert {
024:
025:            @Test
026:            public void testMutators() {
027:                Extension e = new Extension();
028:
029:                String className = "org.apache.cxf.bindings.soap.SoapBinding";
030:                e.setClassname(className);
031:                assertEquals("Unexpected class name.", className, e
032:                        .getClassname());
033:                assertNull("Unexpected interface name.", e.getInterfaceName());
034:
035:                String interfaceName = "org.apache.cxf.bindings.Binding";
036:                e.setInterfaceName(interfaceName);
037:                assertEquals("Unexpected interface name.", interfaceName, e
038:                        .getInterfaceName());
039:
040:                assertTrue("Extension is deferred.", !e.isDeferred());
041:                e.setDeferred(true);
042:                assertTrue("Extension is not deferred.", e.isDeferred());
043:
044:                assertEquals("Unexpected size of namespace list.", 0, e
045:                        .getNamespaces().size());
046:            }
047:
048:            @Test
049:            public void testLoad() throws ExtensionException {
050:                Extension e = new Extension();
051:                ClassLoader cl = Thread.currentThread().getContextClassLoader();
052:                e.setClassname("no.such.Extension");
053:                try {
054:                    e.load(cl);
055:                } catch (ExtensionException ex) {
056:                    assertTrue(
057:                            "ExtensionException does not wrap ClassNotFoundException",
058:                            ex.getCause() instanceof  ClassNotFoundException);
059:                }
060:
061:                e.setClassname("java.lang.System");
062:                try {
063:                    e.load(cl);
064:                } catch (ExtensionException ex) {
065:                    assertTrue(
066:                            "ExtensionException does not wrap IllegalAccessException",
067:                            ex.getCause() instanceof  IllegalAccessException);
068:                }
069:                e.setClassname(MyServiceConstructorThrowsException.class
070:                        .getName());
071:                try {
072:                    e.load(cl);
073:                } catch (ExtensionException ex) {
074:                    assertTrue(
075:                            "ExtensionException does not wrap InstantiationException",
076:                            ex.getCause() instanceof  InstantiationException);
077:                }
078:                e.setClassname("java.lang.String");
079:                Object obj = e.load(cl);
080:                assertTrue("Object is not type String", obj instanceof  String);
081:            }
082:
083:            @Test
084:            public void testLoadInterface() {
085:                Extension e = new Extension();
086:                ClassLoader cl = Thread.currentThread().getContextClassLoader();
087:                e.setInterfaceName("no.such.Extension");
088:                try {
089:                    e.loadInterface(cl);
090:                } catch (ExtensionException ex) {
091:                    assertTrue(
092:                            "ExtensionException does not wrap ClassNotFoundException",
093:                            ex.getCause() instanceof  ClassNotFoundException);
094:                }
095:
096:                e.setInterfaceName(Assert.class.getName());
097:                Class<?> cls = e.loadInterface(cl);
098:                assertTrue("Object is not type Class", cls instanceof  Class);
099:            }
100:
101:            class MyServiceConstructorThrowsException {
102:                public MyServiceConstructorThrowsException() {
103:                    throw new IllegalArgumentException();
104:                }
105:            }
106:
107:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.