[jboss-cvs] JBossAS SVN: r74993 - trunk/testsuite/src/main/org/jboss/test/web/test.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jun 24 11:34:00 EDT 2008


Author: adrian at jboss.org
Date: 2008-06-24 11:33:59 -0400 (Tue, 24 Jun 2008)
New Revision: 74993

Modified:
   trunk/testsuite/src/main/org/jboss/test/web/test/RootContextUnitTestCase.java
Log:
[JBAS-5626] - Suspend the default root context while running the tests for root context deployment

Modified: trunk/testsuite/src/main/org/jboss/test/web/test/RootContextUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/web/test/RootContextUnitTestCase.java	2008-06-24 15:33:54 UTC (rev 74992)
+++ trunk/testsuite/src/main/org/jboss/test/web/test/RootContextUnitTestCase.java	2008-06-24 15:33:59 UTC (rev 74993)
@@ -21,6 +21,9 @@
 */
 package org.jboss.test.web.test;
 
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
@@ -63,21 +66,34 @@
     */
    private String hitRootContext(String deploymentUnit) throws Exception
    {
-      deploy(deploymentUnit);
+      // We need to suspend the default root context when running these tests
+      ObjectName root = new ObjectName("jboss.web.deployment:war=/ROOT"); 
+      MBeanServerConnection connection = getServer();
+      connection.invoke(root, "stop", null, null);
+      try
+      {
+         deploy(deploymentUnit);
+         try
+         {
+            HttpMethodBase request = new GetMethod(baseURL);
+            client.executeMethod(request);
 
-      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.");
+            }
 
-         String responseBody = request.getResponseBodyAsString();
-         if (responseBody == null) {
-            throw new Exception("Unable to get response from server.");
+            return responseBody;
          }
-
-         return responseBody;
-      } finally {
-         undeploy(deploymentUnit);
+         finally
+         {
+            undeploy(deploymentUnit);
+         }
       }
+      finally
+      {
+         connection.invoke(root, "start", null, null);
+      }
    }   
 
    public static Test suite() throws Exception
@@ -86,6 +102,4 @@
       suite.addTest(new TestSuite(RootContextUnitTestCase.class));
       return suite;
    }
-   
-
 }




More information about the jboss-cvs-commits mailing list