KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > examples > clients > webservices > F_WsWarSample


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999-2005 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or 1any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: F_WsWarSample.java,v 1.8 2005/03/09 10:26:42 sauthieg Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.jonas.examples.clients.webservices;
27
28
29 import java.io.File JavaDoc;
30
31 import junit.framework.TestSuite;
32
33
34 /**
35  * Define a class to test the webServices examples wsWarExample
36  * Test WebServices deployment OK and test Call on deployed WebService
37  * @author Guillaume Sauthier
38  */

39 public class F_WsWarSample extends A_WebServicesEndpoint {
40
41     /**
42      * URL of the wsWarSample page
43      */

44     private static final String JavaDoc URL_WSWARSAMPLE = "/wswarsample/";
45
46     /**
47      * Main method
48      * @param args the arguments
49      */

50     public static void main(String JavaDoc[] args) {
51
52         String JavaDoc testtorun = null;
53         // Get args
54
for (int argn = 0; argn < args.length; argn++) {
55             String JavaDoc sArg = args[argn];
56             if (sArg.equals("-n")) {
57                 testtorun = args[++argn];
58             }
59         }
60
61         if (testtorun == null) {
62             junit.textui.TestRunner.run(suite());
63         } else {
64             junit.textui.TestRunner.run(new F_WsWarSample(testtorun));
65         }
66     }
67
68     /**
69      * Get a new TestSuite for this class
70      * @return a new TestSuite for this class
71      */

72     public static TestSuite suite() {
73         return new TestSuite(F_WsWarSample.class);
74     }
75
76     /**
77      * Setup need for these tests
78      * earsample is required
79      * @throws Exception if it fails
80      */

81     protected void setUp() throws Exception JavaDoc {
82         super.setUp();
83         useWar("wswarsample");
84     }
85
86     /**
87      * Constructor with a specified name
88      * @param s name
89      */

90     public F_WsWarSample(String JavaDoc s) {
91         super(s, URL_WSWARSAMPLE);
92     }
93
94     /**
95      * Check if home page is accessible
96      * @throws Exception if an error occurs
97      */

98     public void testDeploymentCompleted() throws Exception JavaDoc {
99         // 3 links + 3 logo links on homepage
100
checkDeploymentCompleted(3+3);
101     }
102
103     /**
104      * Check if Axis is Running
105      * @throws Exception if an error occurs
106      */

107     public void testAxisServicesAccessible() throws Exception JavaDoc {
108
109         // links to /jaxrpcEndpoint1/* in first place (0)
110
checkAxisServicesAccessible(3, "jaxrpcEndpoint1", "JaxRpcEndpoint1");
111     }
112
113     /**
114      * Check if WSDL is generated
115      * @throws Exception if an error occurs
116      */

117     public void testAxisWSDL() throws Exception JavaDoc {
118
119         // for wsWarSample axis generated WSDL link is in second place (1)
120
checkAxisWSDL("jaxrpcEndpoint1/JaxRpcEndpoint1?JWSDL");
121     }
122
123     /**
124      * Check if deployed WebService is running
125      * @throws Exception if an error occurs
126      */

127     public void testDeployedWebService() throws Exception JavaDoc {
128
129         checkDeployedWebService("jaxrpcTest.html",
130                                 url + "jaxrpcEndpoint1/JaxRpcEndpoint1",
131                                 "JOnAS",
132                                 "JOnAS JaxRpc WebService Test Page");
133     }
134
135     /**
136      * Check if WSDL has been published
137      * @throws Exception if an error occurs
138      */

139     public void testWSDLPublication() throws Exception JavaDoc {
140
141         checkWSDLPublication("MyWebService" + File.separator + "jaxrpcEndpoint.wsdl",
142                              "http://ws.servlets.wssample.objectweb.org",
143                              "JaxRpcEndpointInterfaceService",
144                              "JaxRpcEndpoint1",
145                              url + "jaxrpcEndpoint1/JaxRpcEndpoint1");
146
147     }
148
149
150 }
151
Popular Tags