Source Code Cross Referenced for AnnotationProviderImplDescriptionTests.java in  » Web-Services-AXIS2 » metadata » org » apache » axis2 » jaxws » description » 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 AXIS2 » metadata » org.apache.axis2.jaxws.description 
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:         */
019:
020:        package org.apache.axis2.jaxws.description;
021:
022:        import junit.framework.TestCase;
023:        import org.apache.log4j.BasicConfigurator;
024:
025:        import javax.jws.WebService;
026:        import javax.xml.soap.SOAPMessage;
027:        import javax.xml.transform.Source;
028:        import javax.xml.ws.BindingType;
029:        import javax.xml.ws.Provider;
030:        import javax.xml.ws.Service;
031:        import javax.xml.ws.ServiceMode;
032:        import javax.xml.ws.WebServiceException;
033:        import javax.xml.ws.WebServiceProvider;
034:
035:        public class AnnotationProviderImplDescriptionTests extends TestCase {
036:            static {
037:                // Note you will probably need to increase the java heap size, for example
038:                // -Xmx512m.  This can be done by setting maven.junit.jvmargs in project.properties.
039:                // To change the settings, edit the log4j.property file
040:                // in the test-resources directory.
041:                BasicConfigurator.configure();
042:            }
043:
044:            public void testBasicProvider() {
045:                // Use the description factory directly; this will be done within the JAX-WS runtime
046:                ServiceDescription serviceDesc = DescriptionFactory
047:                        .createServiceDescription(BasicProviderTestImpl.class);
048:                assertNotNull(serviceDesc);
049:
050:                EndpointDescription[] endpointDesc = serviceDesc
051:                        .getEndpointDescriptions();
052:                assertNotNull(endpointDesc);
053:                assertEquals(1, endpointDesc.length);
054:
055:                // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)?  Currently assumes [0]
056:                EndpointDescriptionJava testEndpointDesc = (EndpointDescriptionJava) endpointDesc[0];
057:                assertNotNull(testEndpointDesc);
058:                assertEquals(Service.Mode.MESSAGE, testEndpointDesc
059:                        .getAnnoServiceModeValue());
060:                assertEquals("http://www.w3.org/2003/05/soap/bindings/HTTP/",
061:                        testEndpointDesc.getAnnoBindingTypeValue());
062:                // The WebServiceProvider annotation specified no values on it.
063:                // TODO: When the Description package changes to provide default values when no annotation present, this may need to change.
064:                assertEquals("", testEndpointDesc
065:                        .getAnnoWebServiceWSDLLocation());
066:                assertEquals("BasicProviderTestImplService", testEndpointDesc
067:                        .getAnnoWebServiceServiceName());
068:                assertEquals("BasicProviderTestImplPort", testEndpointDesc
069:                        .getAnnoWebServicePortName());
070:                assertEquals("http://description.jaxws.axis2.apache.org/",
071:                        testEndpointDesc.getAnnoWebServiceTargetNamespace());
072:            }
073:
074:            public void testWebServiceProvider() {
075:                // Use the description factory directly; this will be done within the JAX-WS runtime
076:                ServiceDescription serviceDesc = DescriptionFactory
077:                        .createServiceDescription(WebServiceProviderTestImpl.class);
078:                assertNotNull(serviceDesc);
079:
080:                EndpointDescription[] endpointDesc = serviceDesc
081:                        .getEndpointDescriptions();
082:                assertNotNull(endpointDesc);
083:                assertEquals(1, endpointDesc.length);
084:
085:                // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)?  Currently assumes [0]
086:                EndpointDescriptionJava testEndpointDesc = (EndpointDescriptionJava) endpointDesc[0];
087:                assertNotNull(testEndpointDesc);
088:                assertEquals(Service.Mode.PAYLOAD, testEndpointDesc
089:                        .getAnnoServiceModeValue());
090:                assertEquals("http://www.w3.org/2003/05/soap/bindings/HTTP/",
091:                        testEndpointDesc.getAnnoBindingTypeValue());
092:
093:                assertEquals("http://wsdl.test", testEndpointDesc
094:                        .getAnnoWebServiceWSDLLocation());
095:                assertEquals("ProviderService", testEndpointDesc
096:                        .getAnnoWebServiceServiceName());
097:                assertEquals("ProviderServicePort", testEndpointDesc
098:                        .getAnnoWebServicePortName());
099:                assertEquals("http://namespace.test", testEndpointDesc
100:                        .getAnnoWebServiceTargetNamespace());
101:            }
102:
103:            public void testDefaultServiceModeProvider() {
104:                // Use the description factory directly; this will be done within the JAX-WS runtime
105:                ServiceDescription serviceDesc = DescriptionFactory
106:                        .createServiceDescription(DefaultServiceModeProviderTestImpl.class);
107:                assertNotNull(serviceDesc);
108:
109:                EndpointDescription[] endpointDesc = serviceDesc
110:                        .getEndpointDescriptions();
111:                assertNotNull(endpointDesc);
112:                assertEquals(1, endpointDesc.length);
113:
114:                // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)?  Currently assumes [0]
115:                EndpointDescriptionJava testEndpointDesc = (EndpointDescriptionJava) endpointDesc[0];
116:                // Default ServiceMode is PAYLOAD per JAXWS p. 80
117:                assertEquals(Service.Mode.PAYLOAD, testEndpointDesc
118:                        .getAnnoServiceModeValue());
119:                assertEquals("http://schemas.xmlsoap.org/wsdl/soap/http",
120:                        testEndpointDesc.getAnnoBindingTypeValue());
121:            }
122:
123:            public void testNoServiceModeProvider() {
124:                // Use the description factory directly; this will be done within the JAX-WS runtime
125:                ServiceDescription serviceDesc = DescriptionFactory
126:                        .createServiceDescription(NoServiceModeProviderTestImpl.class);
127:                assertNotNull(serviceDesc);
128:
129:                EndpointDescription[] endpointDesc = serviceDesc
130:                        .getEndpointDescriptions();
131:                assertNotNull(endpointDesc);
132:                assertEquals(1, endpointDesc.length);
133:
134:                // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)?  Currently assumes [0]
135:                EndpointDescriptionJava testEndpointDesc = (EndpointDescriptionJava) endpointDesc[0];
136:                assertEquals(javax.xml.ws.Service.Mode.PAYLOAD,
137:                        testEndpointDesc.getAnnoServiceModeValue());
138:                assertEquals(javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING,
139:                        testEndpointDesc.getAnnoBindingTypeValue());
140:            }
141:
142:            public void testNoWebServiceProvider() {
143:                // Use the description factory directly; this will be done within the JAX-WS runtime
144:                try {
145:                    DescriptionFactory
146:                            .createServiceDescription(NoWebServiceProviderTestImpl.class);
147:                    fail("Expected WebServiceException not caught");
148:                } catch (WebServiceException e) {
149:                    // This is the expected successful test path
150:                } catch (Exception e) {
151:                    e.printStackTrace();
152:                    fail("Wrong exception caught.  Expected WebServiceException but caught "
153:                            + e);
154:                }
155:            }
156:
157:            public void testBothWebServiceAnnotations() {
158:                // Use the description factory directly; this will be done within the JAX-WS runtime
159:                try {
160:                    DescriptionFactory
161:                            .createServiceDescription(BothWebServiceAnnotationTestImpl.class);
162:                    fail("Expected WebServiceException not caught");
163:                } catch (WebServiceException e) {
164:                    // This is the expected successful test path
165:                } catch (Exception e) {
166:                    fail("Wrong exception caught.  Expected WebServiceException but caught "
167:                            + e);
168:                }
169:            }
170:
171:            public void testServiceModeOnNonProvider() {
172:                // Use the description factory directly; this will be done within the JAX-WS runtime
173:                ServiceDescription serviceDesc = DescriptionFactory
174:                        .createServiceDescription(WebServiceSEITestImpl.class);
175:                assertNotNull(serviceDesc);
176:
177:                EndpointDescription[] endpointDesc = serviceDesc
178:                        .getEndpointDescriptions();
179:                assertNotNull(endpointDesc);
180:                assertEquals(1, endpointDesc.length);
181:
182:                // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)?  Currently assumes [0]
183:                EndpointDescriptionJava testEndpointDesc = (EndpointDescriptionJava) endpointDesc[0];
184:                assertNull(testEndpointDesc.getAnnoServiceModeValue());
185:                assertEquals(javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING,
186:                        testEndpointDesc.getAnnoBindingTypeValue());
187:            }
188:        }
189:
190:        // ===============================================
191:        // Basic Provider service implementation class
192:        // ===============================================
193:
194:        @ServiceMode(value=Service.Mode.MESSAGE)
195:        @WebServiceProvider()
196:        @BindingType(value="http://www.w3.org/2003/05/soap/bindings/HTTP/")
197:        class BasicProviderTestImpl implements  Provider<SOAPMessage> {
198:            public BasicProviderTestImpl() {
199:            }
200:
201:            public SOAPMessage invoke(SOAPMessage obj) {
202:                return null;
203:            }
204:        }
205:
206:        // ===============================================
207:        // WebServiceProvider service implementation class
208:        // ===============================================
209:
210:        @ServiceMode(value=Service.Mode.PAYLOAD)
211:        @WebServiceProvider(serviceName="ProviderService",portName="ProviderServicePort",targetNamespace="http://namespace.test",wsdlLocation="http://wsdl.test")
212:        @BindingType(value="http://www.w3.org/2003/05/soap/bindings/HTTP/")
213:        class WebServiceProviderTestImpl implements  Provider<String> {
214:            public WebServiceProviderTestImpl() {
215:            }
216:
217:            public String invoke(String obj) {
218:                return null;
219:            }
220:        }
221:
222:        // ===============================================
223:        // Default ServiceMode and BindingType Provider service implementation class
224:        // Default is PAYLOAD per JAXWS p. 80
225:        // ===============================================
226:
227:        @ServiceMode()
228:        @WebServiceProvider()
229:        @BindingType()
230:        class DefaultServiceModeProviderTestImpl implements  Provider<String> {
231:            public DefaultServiceModeProviderTestImpl() {
232:            }
233:
234:            public String invoke(String obj) {
235:                return null;
236:            }
237:        }
238:
239:        // ===============================================
240:        // No ServiceMode and no BindingType Provider service implementation class
241:        // ===============================================
242:
243:        @WebServiceProvider()
244:        class NoServiceModeProviderTestImpl implements  Provider<Source> {
245:            public NoServiceModeProviderTestImpl() {
246:            }
247:
248:            public Source invoke(Source obj) {
249:                return null;
250:            }
251:        }
252:
253:        // ===============================================
254:        // NO WebServiceProvider Provider service implementation class
255:        // This is an INVALID service implementation
256:        // ===============================================
257:
258:        @ServiceMode(value=Service.Mode.MESSAGE)
259:        @BindingType(value="http://www.w3.org/2003/05/soap/bindings/HTTP/")
260:        class NoWebServiceProviderTestImpl implements  Provider<SOAPMessage> {
261:            public NoWebServiceProviderTestImpl() {
262:            }
263:
264:            public SOAPMessage invoke(SOAPMessage obj) {
265:                return null;
266:            }
267:        }
268:
269:        // ===============================================
270:        // BOTH WebService and WebServiceProvider Provider service implementation class
271:        // This is an INVALID service implementation
272:        //===============================================
273:
274:        @ServiceMode(value=Service.Mode.MESSAGE)
275:        @WebService()
276:        @WebServiceProvider()
277:        @BindingType(value="http://www.w3.org/2003/05/soap/bindings/HTTP/")
278:        class BothWebServiceAnnotationTestImpl implements  Provider<SOAPMessage> {
279:            public BothWebServiceAnnotationTestImpl() {
280:            }
281:
282:            public SOAPMessage invoke(SOAPMessage obj) {
283:                return null;
284:            }
285:        }
286:
287:        // ===============================================
288:        // WebService service implementation class; not 
289:        // Provider-based
290:        // ===============================================
291:
292:        @WebService()
293:        class WebServiceSEITestImpl {
294:            public String echo(String s) {
295:                return "From WebServiceSEITestImpl " + "s";
296:            }
297:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.