KickJava   Java API By Example, From Geeks To Geeks.

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


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_WsEarSample.java,v 1.10 2005/05/12 13:17:06 benoitf 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 import com.meterware.httpunit.WebResponse;
34
35 /**
36  * Define a class to test the webServices examples
37  * Test WebServices deployment OK and test Call on deployed WebService
38  * @author Guillaume Sauthier
39  */

40 public class F_WsEarSample extends A_WebServicesEndpoint {
41
42     /**
43      * URL of the wsEarSample page
44      */

45     private static final String JavaDoc URL_WSEARSAMPLE = "/axis-ws/";
46
47     /**
48      * Main method
49      * @param args the arguments
50      */

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

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

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

91     public F_WsEarSample(String JavaDoc s) {
92         super(s, URL_WSEARSAMPLE);
93     }
94
95     /**
96      * Check if services page is accessible
97      * @throws Exception if an error occurs
98      */

99     public void testDeploymentCompleted() throws Exception JavaDoc {
100
101         WebResponse wr = wc.getResponse(url + "ssbEndpoint");
102         assertNotNull("no homepage", wr);
103     }
104
105     /**
106      * Check if WSDL is generated
107      * @throws Exception if an error occurs
108      */

109     public void testAxisWSDL() throws Exception JavaDoc {
110
111         // for wsEarSample axis generated WSDL link is in second place (1)
112
checkAxisWSDL("ssbEndpoint/WSBeanEndpointLocal?JWSDL");
113     }
114
115     /**
116      * Check if WSDL has been published
117      * @throws Exception if an error occurs
118      */

119     public void testWSDLPublication() throws Exception JavaDoc {
120
121         checkWSDLPublication("My Web Services" + File.separator + "ssbEndpoint.wsdl",
122                              "http://ws.beans.wssample.objectweb.org",
123                              "WSBeanEndpointLocalService",
124                              "WSBeanEndpointLocal",
125                              url + "ssbEndpoint/WSBeanEndpointLocal");
126     }
127
128
129 }
130
Popular Tags