KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > web > test > ClasspathUnitTestCase


1 /*
2  * JBoss, Home of Professional Open Source
3  * Copyright 2006, Red Hat Middleware LLC, and individual contributors
4  * by the @authors tag. See the copyright.txt in the distribution for a
5  * full listing of individual contributors.
6  *
7  * This is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as
9  * published by the Free Software Foundation; either version 2.1 of
10  * the License, or (at your option) any later version.
11  *
12  * This software is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this software; if not, write to the Free
19  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21  */

22 package org.jboss.test.web.test;
23
24 import java.net.URL JavaDoc;
25
26 import junit.framework.Test;
27
28 import org.apache.commons.httpclient.Header;
29 import org.apache.commons.httpclient.HttpMethodBase;
30 import org.jboss.test.JBossTestCase;
31 import org.jboss.test.util.web.HttpUtils;
32
33 /** Tests of web app classpath issues
34  
35  @author Scott.Stark@jboss.org
36  @version $Revision: 42698 $
37  */

38 public class ClasspathUnitTestCase extends JBossTestCase
39 {
40    private String JavaDoc baseURL = HttpUtils.getBaseURL();
41    
42    public static Test suite() throws Exception JavaDoc
43    {
44       return getDeploySetup(ClasspathUnitTestCase.class, "manifest-web.ear");
45    }
46
47    public ClasspathUnitTestCase(String JavaDoc name)
48    {
49       super(name);
50    }
51
52    /** Test of a war that accesses classes referred to via the war manifest
53     * classpath. Access the http://{host}/manifest/classpath.jsp
54     */

55    public void testWarManifest() throws Exception JavaDoc
56    {
57       URL JavaDoc url = new URL JavaDoc(baseURL+"manifest/classpath.jsp");
58       HttpMethodBase request = HttpUtils.accessURL(url);
59       Header errors = request.getResponseHeader("X-Exception");
60       log.info("X-Exception: "+errors);
61       assertTrue("X-Exception("+errors+") is null", errors == null);
62    }
63
64    /** Access the http://{host}/manifest/ClassesServlet
65     */

66    public void testClassesServlet()
67       throws Exception JavaDoc
68    {
69       URL JavaDoc url = new URL JavaDoc(baseURL+"manifest/ClassesServlet");
70       HttpMethodBase request = HttpUtils.accessURL(url);
71       Header errors = request.getResponseHeader("X-Exception");
72       log.info("X-Exception: "+errors);
73       assertTrue("X-Exception("+errors+") is null", errors == null);
74    }
75
76    /** Access the http://{host}/manifest/LibServlet
77     */

78    public void testLibServlet()
79       throws Exception JavaDoc
80    {
81       URL JavaDoc url = new URL JavaDoc(baseURL+"manifest/LibServlet");
82       HttpMethodBase request = HttpUtils.accessURL(url);
83       Header errors = request.getResponseHeader("X-Exception");
84       log.info("X-Exception: "+errors);
85       assertTrue("X-Exception("+errors+") is null", errors == null);
86    }
87 }
88
Popular Tags