[jboss-cvs] JBossAS SVN: r61913 - in branches/Branch_4_2/testsuite: src/main/org/jboss/test/web/test and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Mar 30 16:16:34 EDT 2007
Author: stan.silvert at jboss.com
Date: 2007-03-30 16:16:33 -0400 (Fri, 30 Mar 2007)
New Revision: 61913
Added:
branches/Branch_4_2/testsuite/src/main/org/jboss/test/web/test/RootContextUnitTestCase.java
branches/Branch_4_2/testsuite/src/resources/web/root-context/
branches/Branch_4_2/testsuite/src/resources/web/root-context/jboss-web.xml
Modified:
branches/Branch_4_2/testsuite/imports/sections/web.xml
Log:
JBAS-3162
Modified: branches/Branch_4_2/testsuite/imports/sections/web.xml
===================================================================
--- branches/Branch_4_2/testsuite/imports/sections/web.xml 2007-03-30 19:29:33 UTC (rev 61912)
+++ branches/Branch_4_2/testsuite/imports/sections/web.xml 2007-03-30 20:16:33 UTC (rev 61913)
@@ -532,5 +532,19 @@
<zipfileset dir="${build.resources}/web/form-auth"
includes="jboss-service.xml"/>
</zip>
+
+ <!-- JBAS-3162 Root Context Tests -->
+ <war destfile="${build.lib}/root-context.war"
+ webxml="${build.resources}/web/WEB-INF/root-web.xml">
+ <webinf dir="${build.resources}/web/root-context">
+ <include name="jboss-web.xml"/>
+ </webinf>
+
+ <fileset dir="${build.resources}/web/html/root">
+ <include name="index.html"/>
+ </fileset>
+
+ </war>
+
</target>
</project>
Added: branches/Branch_4_2/testsuite/src/main/org/jboss/test/web/test/RootContextUnitTestCase.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/web/test/RootContextUnitTestCase.java (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/web/test/RootContextUnitTestCase.java 2007-03-30 20:16:33 UTC (rev 61913)
@@ -0,0 +1,94 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.web.test;
+
+import java.net.URL;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.test.JBossTestCase;
+import org.jboss.test.JBossTestSetup;
+import org.jboss.test.util.web.HttpUtils;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.methods.GetMethod;
+
+/**
+ * This class tests a root context deployed as an EAR or
+ * a WAR.
+ *
+ * @author Stan.Silvert at jboss.org
+ */
+public class RootContextUnitTestCase extends JBossTestCase
+{
+ private String baseURL = HttpUtils.getBaseURL();
+ private HttpClient client = new HttpClient();
+
+ public RootContextUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void testRootContextWAR() throws Exception
+ {
+ String response = hitRootContext("root-context.war");
+ assertTrue(response.contains("A Root Context Page"));
+ }
+
+ public void testRootContextEAR() throws Exception
+ {
+ String response = hitRootContext("root-context.war");
+ assertTrue(response.contains("A Root Context Page"));
+ }
+
+ /**
+ * Access http://localhost/
+ */
+ private String hitRootContext(String deploymentUnit) throws Exception
+ {
+ deploy(deploymentUnit);
+
+ try {
+ HttpMethodBase request = new GetMethod(baseURL);
+ client.executeMethod(request);
+
+ String responseBody = request.getResponseBodyAsString();
+ if (responseBody == null) {
+ throw new Exception("Unable to get response from server.");
+ }
+
+ return responseBody;
+ } finally {
+ undeploy(deploymentUnit);
+ }
+ }
+
+ public static Test suite() throws Exception
+ {
+ TestSuite suite = new TestSuite();
+ suite.addTest(new TestSuite(RootContextUnitTestCase.class));
+ return suite;
+ }
+
+
+}
Added: branches/Branch_4_2/testsuite/src/resources/web/root-context/jboss-web.xml
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/web/root-context/jboss-web.xml (rev 0)
+++ branches/Branch_4_2/testsuite/src/resources/web/root-context/jboss-web.xml 2007-03-30 20:16:33 UTC (rev 61913)
@@ -0,0 +1,3 @@
+<jboss-web>
+ <context-root />
+</jboss-web>
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list