KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > ejb3 > test > security > unit > ServletUnitTestCase


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
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.ejb3.test.security.unit;
23
24 import java.io.IOException JavaDoc;
25 import java.net.URL JavaDoc;
26
27 import junit.framework.Test;
28
29 import org.apache.commons.httpclient.Header;
30 import org.apache.commons.httpclient.HttpClient;
31 import org.apache.commons.httpclient.HttpMethodBase;
32 import org.apache.commons.httpclient.UsernamePasswordCredentials;
33 import org.jboss.test.JBossTestCase;
34 import org.jboss.ejb3.test.dd.web.util.HttpUtils;
35
36 /** Tests of servlet container integration into the JBoss server. This test
37  requires than a web container be integrated into the JBoss server. The tests
38  currently do NOT use the java.net.HttpURLConnection and associated http client
39  and these do not return valid HTTP error codes so if a failure occurs it
40  is best to connect the webserver using a browser to look for additional error
41  info.
42
43  The secure access tests require a user named 'jduke' with a password of 'theduke'
44  with a role of 'AuthorizedUser' in the servlet container.
45  
46  @author Scott.Stark@jboss.org
47  @version $Revision: 39878 $
48  */

49 public class ServletUnitTestCase extends JBossTestCase
50 {
51    private static String JavaDoc REALM = "JBossTest Servlets";
52    
53    public ServletUnitTestCase(String JavaDoc name)
54    {
55       super(name);
56    }
57    
58    public void testEJBServlet() throws Exception JavaDoc
59    {
60       try {
61          URL JavaDoc url = new URL JavaDoc(HttpUtils.getBaseURL()+"security-web/EJBServlet");
62          HttpUtils.accessURL(url);
63       } catch (Exception JavaDoc e){
64          e.printStackTrace();
65          throw e;
66       }
67    }
68    
69    /**
70     * Setup the test suite.
71     */

72    public static Test suite() throws Exception JavaDoc
73    {
74       return getDeploySetup(ServletUnitTestCase.class, "security.jar, security-web.war");
75    }
76
77
78 }
79
Popular Tags