KickJava   Java API By Example, From Geeks To Geeks.

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


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.logging.Logger;
31 import org.jboss.test.JBossTestCase;
32 import org.jboss.test.util.web.HttpUtils;
33
34 /** Tests of a web app java:comp/env jndi settings specified via the
35  * web.xml/jboss-web.xml descriptors.
36  
37  @author Scott.Stark@jboss.org
38  @version $Revision: 58500 $
39  */

40 public class EncXmlUnitTestCase extends JBossTestCase
41 {
42    private String JavaDoc baseURL = HttpUtils.getBaseURL();
43    Logger log = getLog();
44    
45    public static Test suite() throws Exception JavaDoc
46    {
47       return getDeploySetup(EncXmlUnitTestCase.class, "simple-xmlonly.beans,simple-xmlonly.war");
48    }
49
50    public EncXmlUnitTestCase(String JavaDoc name)
51    {
52       super(name);
53    }
54
55    /** Access the http://{host}/simple-xmlonly/ENCServlet
56     */

57    public void testAltRequestInfoServlet()
58       throws Exception JavaDoc
59    {
60       URL JavaDoc url = new URL JavaDoc(baseURL+"simple-xmlonly/ENCServlet");
61       HttpMethodBase request = HttpUtils.accessURL(url);
62       Header errors = request.getResponseHeader("X-Exception");
63       log.info("X-Exception: "+errors);
64       assertTrue("X-Exception("+errors+") is null", errors == null);
65    }
66
67 }
68
Popular Tags