Source Code Cross Referenced for DescriptionBuilderTests.java in  » Web-Services-AXIS2 » metadata » org » apache » axis2 » jaxws » description » builder » 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.builder 
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.builder;
021:
022:        import junit.framework.TestCase;
023:
024:        import javax.jws.WebParam.Mode;
025:
026:        /**
027:         * Directly test the Description classes built via annotations without a WSDL file. These tests
028:         * focus on combinations of the following: - A generic service (no annotations) - A generated
029:         * service (annotations) - An SEI
030:         */
031:        public class DescriptionBuilderTests extends TestCase {
032:
033:            /* 
034:             * ========================================================================
035:             * ServiceDescription Tests
036:             * ========================================================================
037:             */
038:            public void testCreateWebServiceAnnot() {
039:                String name = "EchoServiceAnnotated";
040:                String targetNamespace = "http://description.jaxws.axis2.apache.org/";
041:                String serviceName = "EchoServiceName";
042:                String wsdlLocation = "http://EchoService/wsdl";
043:                String endpointInterface = "EchoServiceEndpointInterface";
044:                String portName = "EchoServiceAnnotatedPort";
045:
046:                WebServiceAnnot webServiceAnnotImpl1 = WebServiceAnnot
047:                        .createWebServiceAnnotImpl();
048:
049:                WebServiceAnnot webServiceAnnotImpl2 = WebServiceAnnot
050:                        .createWebServiceAnnotImpl(name, targetNamespace,
051:                                serviceName, wsdlLocation, endpointInterface,
052:                                portName);
053:
054:                DescriptionBuilderComposite descriptionBuilderComposite = new DescriptionBuilderComposite();
055:
056:                descriptionBuilderComposite
057:                        .setWebServiceAnnot(webServiceAnnotImpl2);
058:
059:                WebServiceAnnot webServiceAnnotImpl3 = descriptionBuilderComposite
060:                        .getWebServiceAnnot();
061:
062:                assertNotNull("WebService name not set", webServiceAnnotImpl3
063:                        .name());
064:                assertNotNull("WebService targetNamespace not set",
065:                        webServiceAnnotImpl3.targetNamespace());
066:                assertNotNull("WebService serviceName not set",
067:                        webServiceAnnotImpl3.serviceName());
068:                assertNotNull("WebService wsdlLocation not set",
069:                        webServiceAnnotImpl3.wsdlLocation());
070:                assertNotNull("WebService endpointInterface not set",
071:                        webServiceAnnotImpl3.endpointInterface());
072:
073:                System.out.println("WebService name:"
074:                        + webServiceAnnotImpl3.name());
075:            }
076:
077:            public void testCreateWebServiceProviderAnnot() {
078:                String name = "EchoServiceAnnotated";
079:                String targetNamespace = "http://description.jaxws.axis2.apache.org/";
080:                String serviceName = "EchoServiceName";
081:                String wsdlLocation = "http://EchoService/wsdl";
082:                String endpointInterface = "EchoServiceEndpointInterface";
083:                String portName = "EchoServiceAnnotatedPort";
084:
085:                WebServiceProviderAnnot webServiceProviderAnnot = WebServiceProviderAnnot
086:                        .createWebServiceAnnotImpl();
087:
088:                webServiceProviderAnnot.setPortName(portName);
089:                webServiceProviderAnnot.setServiceName(serviceName);
090:                webServiceProviderAnnot.setTargetNamespace(targetNamespace);
091:                webServiceProviderAnnot.setWsdlLocation(wsdlLocation);
092:
093:                DescriptionBuilderComposite descriptionBuilderComposite = new DescriptionBuilderComposite();
094:
095:                descriptionBuilderComposite
096:                        .setWebServiceProviderAnnot(webServiceProviderAnnot);
097:
098:                WebServiceProviderAnnot webServiceProviderAnnot3 = descriptionBuilderComposite
099:                        .getWebServiceProviderAnnot();
100:
101:                assertEquals("WebServiceProvider port name not set properly",
102:                        webServiceProviderAnnot3.portName(), portName);
103:                assertEquals(
104:                        "WebServiceProvider targetNamespace not set properly",
105:                        webServiceProviderAnnot3.targetNamespace(),
106:                        targetNamespace);
107:                assertEquals("WebServiceProvider serviceName not set properly",
108:                        webServiceProviderAnnot3.serviceName(), serviceName);
109:                assertEquals(
110:                        "WebServiceProvider wsdlLocation not set properly",
111:                        webServiceProviderAnnot3.wsdlLocation(), wsdlLocation);
112:                System.out.println("WebService name:"
113:                        + webServiceProviderAnnot3.portName());
114:            }
115:
116:            public void testCreateWebMethodAnnot() {
117:                String operationName = "echoStringMethod";
118:                String action = "urn:EchoStringMethod";
119:                boolean exclude = true;
120:
121:                WebMethodAnnot webMethodAnnot = WebMethodAnnot
122:                        .createWebMethodAnnotImpl();
123:
124:                webMethodAnnot.setOperationName(operationName);
125:                webMethodAnnot.setAction(action);
126:                webMethodAnnot.setExclude(exclude);
127:
128:                DescriptionBuilderComposite dbc = new DescriptionBuilderComposite();
129:                MethodDescriptionComposite mdc = new MethodDescriptionComposite();
130:
131:                mdc.setWebMethodAnnot(webMethodAnnot);
132:                mdc.setMethodName(operationName);
133:                dbc.addMethodDescriptionComposite(mdc);
134:
135:                WebMethodAnnot webMethodAnnot3 = dbc
136:                        .getMethodDescriptionComposite(operationName, 1)
137:                        .getWebMethodAnnot();
138:
139:                assertEquals("WebMethod operation name not set properly",
140:                        webMethodAnnot3.operationName(), operationName);
141:                assertEquals("WebMethod action not set properly",
142:                        webMethodAnnot3.action(), action);
143:                assertEquals("WebMethod exclude flag not set properly",
144:                        webMethodAnnot3.exclude(), exclude);
145:            }
146:
147:            public void testCreateWebParamAnnot() {
148:
149:                String name = "arg0";
150:                String partName = "sku";
151:                String targetNamespace = "http://description.jaxws.axis2.apache.org/";
152:                Mode mode = Mode.IN;
153:                boolean header = true;
154:
155:                WebParamAnnot webParamAnnot = WebParamAnnot
156:                        .createWebParamAnnotImpl();
157:
158:                webParamAnnot.setName(name);
159:                webParamAnnot.setPartName(partName);
160:                webParamAnnot.setMode(mode);
161:                webParamAnnot.setTargetNamespace(targetNamespace);
162:                webParamAnnot.setHeader(header);
163:
164:                DescriptionBuilderComposite dbc = new DescriptionBuilderComposite();
165:
166:                ParameterDescriptionComposite pdc = new ParameterDescriptionComposite();
167:                pdc.setWebParamAnnot(webParamAnnot);
168:                pdc.setParameterType("int");
169:
170:                MethodDescriptionComposite mdc = new MethodDescriptionComposite();
171:                mdc.setMethodName("TestMethod1");
172:
173:                try {
174:                    //First test adds this pdc out of bounds
175:                    mdc.addParameterDescriptionComposite(pdc, 1);
176:                } catch (IndexOutOfBoundsException e) {
177:                    // Expected flow
178:                } catch (Exception e) {
179:                    fail("Caught unexpected exception" + e);
180:                }
181:
182:                try {
183:                    //Now, add it at the proper position
184:                    mdc.addParameterDescriptionComposite(pdc, 0);
185:                } catch (IndexOutOfBoundsException e) {
186:                    // Expected flow
187:                } catch (Exception e) {
188:                    fail("Caught unexpected exception" + e);
189:                }
190:
191:                dbc.addMethodDescriptionComposite(mdc);
192:
193:                WebParamAnnot webParamAnnot3 = dbc
194:                        .getMethodDescriptionComposite("TestMethod1", 1)
195:                        .getParameterDescriptionComposite(0).getWebParamAnnot();
196:
197:                assertEquals("WebMethod name not set properly", webParamAnnot3
198:                        .name(), name);
199:                assertEquals("WebMethod PartName not set properly",
200:                        webParamAnnot3.partName(), partName);
201:                assertEquals("WebMethod Mode flag not set properly",
202:                        webParamAnnot3.mode(), mode);
203:                assertEquals("WebMethod Target Namespace not set properly",
204:                        webParamAnnot3.targetNamespace(), targetNamespace);
205:                assertEquals("WebMethod Header not set properly",
206:                        webParamAnnot3.header(), header);
207:
208:                assertEquals("Unable to convert string to parameterTypeClass",
209:                        pdc.getParameterTypeClass().getName(), "int");
210:            }
211:
212:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.