[jboss-cvs] JBossAS SVN: r61976 - in trunk/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
Sun Apr 1 15:22:59 EDT 2007
Author: stan.silvert at jboss.com
Date: 2007-04-01 15:22:59 -0400 (Sun, 01 Apr 2007)
New Revision: 61976
Added:
trunk/testsuite/src/main/org/jboss/test/web/test/RootContextUnitTestCase.java
trunk/testsuite/src/resources/web/root-context/
trunk/testsuite/src/resources/web/root-context/jboss-web.xml
Modified:
trunk/testsuite/imports/sections/web.xml
Log:
JBAS-3162
Modified: trunk/testsuite/imports/sections/web.xml
===================================================================
--- trunk/testsuite/imports/sections/web.xml 2007-04-01 18:34:16 UTC (rev 61975)
+++ trunk/testsuite/imports/sections/web.xml 2007-04-01 19:22:59 UTC (rev 61976)
@@ -594,5 +594,17 @@
<include name="org/jboss/test/web/mock/**"/>
</fileset>
</jar>
+
+ <!-- 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: trunk/testsuite/src/main/org/jboss/test/web/test/RootContextUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/web/test/RootContextUnitTestCase.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/web/test/RootContextUnitTestCase.java 2007-04-01 19:22:59 UTC (rev 61976)
@@ -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("jbosstest-web.ear");
+ 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: trunk/testsuite/src/resources/web/root-context/jboss-web.xml
===================================================================
--- trunk/testsuite/src/resources/web/root-context/jboss-web.xml (rev 0)
+++ trunk/testsuite/src/resources/web/root-context/jboss-web.xml 2007-04-01 19:22:59 UTC (rev 61976)
@@ -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