KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > itests > naming > war > ServletTest


1 /**
2  *
3  * Copyright 2003-2004 The Apache Software Foundation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.geronimo.itests.naming.war;
18
19 import junit.framework.TestCase;
20 import org.apache.commons.httpclient.HttpClient;
21 import org.apache.commons.httpclient.methods.GetMethod;
22
23 /**
24  * @version $Rev: $ $Date: $
25  */

26 public class ServletTest extends TestCase {
27
28     public void testWebService() throws Exception JavaDoc {
29         HttpClient httpClient = new HttpClient();
30         GetMethod getMethod = new GetMethod("http://localhost:8080/geronimo/itests/naming/NamingTestServlet");
31         httpClient.executeMethod(getMethod);
32         String JavaDoc response = getMethod.getResponseBodyAsString();
33 // System.out.println(response);
34
if (response != null && !response.equals("")) {
35             fail("Received output " + response);
36         }
37     }
38
39 }
40
Popular Tags