KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > jbossnet > basic > AxisUnitTestCase


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7
8 // $Id: AxisUnitTestCase.java,v 1.1.1.1.6.3 2005/02/12 17:07:36 tdiesler Exp $
9

10 package org.jboss.test.jbossnet.basic;
11
12 import junit.framework.Test;
13 import junit.framework.TestSuite;
14 import org.jboss.test.jbossnet.JBossNetTestBase;
15
16 import java.io.BufferedReader JavaDoc;
17 import java.io.InputStreamReader JavaDoc;
18 import java.net.URL JavaDoc;
19
20 /**
21  * Tests remote accessibility of the main axis service servlet
22  * @since 11. Oktober 2001
23  * @author <a HREF="mailto:Christoph.Jung@infor.de">Christoph G. Jung</a>
24  * @author Thomas.Diesler@jboss.org
25  * @version $Revision: 1.1.1.1.6.3 $
26  */

27
28 public class AxisUnitTestCase extends JBossNetTestBase
29 {
30
31    // Constructors --------------------------------------------------
32
public AxisUnitTestCase(String JavaDoc name)
33    {
34       super(name);
35    }
36
37    /** tests availability of the servlet under various contexts */
38    public void testServlet() throws Exception JavaDoc
39    {
40       doLegalAccess("Servlet availability", new URL JavaDoc("http://" + getServerHost() + ":8080/jboss-net/servlet/AxisServlet"));
41       doLegalAccess("service availability", new URL JavaDoc("http://" + getServerHost() + ":8080/jboss-net/services"));
42    }
43
44    /** tests a successful http call to the given target */
45    private void doLegalAccess(String JavaDoc message, URL JavaDoc target) throws Exception JavaDoc
46    {
47       BufferedReader JavaDoc reader = new BufferedReader JavaDoc(new InputStreamReader JavaDoc(target.openStream()));
48       try
49       {
50          String JavaDoc line = reader.readLine();
51          assertNotNull(message + " proper response", line);
52       }
53       finally
54       {
55          reader.close();
56       }
57    }
58
59    public static Test suite() throws Exception JavaDoc
60    {
61       // nothing to deploy really
62
return new TestSuite(AxisUnitTestCase.class);
63    }
64 }
65
Popular Tags