[jboss-cvs] JBossAS SVN: r58506 - trunk/testsuite/src/main/org/jboss/test

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Nov 17 19:03:46 EST 2006


Author: bstansberry at jboss.com
Date: 2006-11-17 19:03:45 -0500 (Fri, 17 Nov 2006)
New Revision: 58506

Modified:
   trunk/testsuite/src/main/org/jboss/test/JBossClusteredTestCase.java
   trunk/testsuite/src/main/org/jboss/test/JBossTestClusteredServices.java
   trunk/testsuite/src/main/org/jboss/test/JBossTestClusteredSetup.java
Log:
Adapt to setup changes in jbosstest

Modified: trunk/testsuite/src/main/org/jboss/test/JBossClusteredTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/JBossClusteredTestCase.java	2006-11-17 22:13:49 UTC (rev 58505)
+++ trunk/testsuite/src/main/org/jboss/test/JBossClusteredTestCase.java	2006-11-18 00:03:45 UTC (rev 58506)
@@ -37,20 +37,34 @@
 public class JBossClusteredTestCase extends JBossTestCase
 {
    JBossTestClusteredServices clusterServices;
+   
+   // Static --------------------------------------------------------
+   
+   /**
+    * Overriden to return JBossTestServices as the test delegate.
+    */
+   public static AbstractTestDelegate getDelegate(Class clazz) throws Exception
+   {
+      AbstractTestDelegate delegate = new JBossTestClusteredServices(clazz);
+      return delegate;
+   }
 
    public JBossClusteredTestCase(String name)
    {
       super(name);
    }
-
-   public void initDelegate()
+   
+   @Override
+   protected void setUp() throws Exception
    {
-      clusterServices = new JBossTestClusteredServices(getClass().getName());
-      delegate = clusterServices;
+      super.setUp();
+      clusterServices = (JBossTestClusteredServices) delegate;
    }
    
    // Public --------------------------------------------------------
    
+   
+
    public void testServerFound() throws Exception
    {
       if (deploymentException != null)
@@ -100,40 +114,7 @@
    public static Test getDeploySetup(final Test test, final String jarName)
       throws Exception
    {
-      JBossTestSetup wrapper = new JBossTestClusteredSetup(test)
-      {
-
-         protected void setUp() throws Exception
-         {
-            if (jarName == null) return;
-            deploymentException = null;
-            try
-            {
-               this.deploy(jarName);
-               this.getLog().debug("deployed package: " + jarName);
-            }
-            catch (Exception ex)
-            {
-               // Throw this in testServerFound() instead.
-               deploymentException = ex;
-            }
-                
-            // wait a few seconds so that the cluster stabilize
-            synchronized (this)
-            {
-               wait(2000);
-            }
-         }
-
-         protected void tearDown() throws Exception
-         {
-            if (jarName == null) return;
-            this.getLog().debug("Attempt undeploy of " + jarName);
-            this.undeploy(jarName);
-            this.getLog().debug("undeployed package: " + jarName);
-         }
-      };
-      return wrapper;
+      return new JBossTestClusteredSetup(test, jarName);
    }
 
    public static Test getDeploySetup(final Class clazz, final String jarName)

Modified: trunk/testsuite/src/main/org/jboss/test/JBossTestClusteredServices.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/JBossTestClusteredServices.java	2006-11-17 22:13:49 UTC (rev 58505)
+++ trunk/testsuite/src/main/org/jboss/test/JBossTestClusteredServices.java	2006-11-18 00:03:45 UTC (rev 58506)
@@ -48,11 +48,27 @@
    
    // Constructors --------------------------------------------------
    
-   public JBossTestClusteredServices(String className)
+   public JBossTestClusteredServices(Class clazz)
    {
-      super(className);
+      super(clazz);
    }
+   
+   
 
+   @Override
+   public void setUp() throws Exception
+   {
+      super.setUp();
+   }
+
+   @Override
+   public void tearDown() throws Exception
+   {
+      super.tearDown();
+   }
+
+
+
    int getServerCount()
    {
       return servers.size();
@@ -60,28 +76,28 @@
 
    RMIAdaptor[] getAdaptors() throws Exception
    {
-      init();
+//      init();
       RMIAdaptor[] tmp = new RMIAdaptor[adaptors.size()];
       adaptors.toArray(tmp);
       return tmp;
    }
    RMIAdaptor getAdaptor(int index) throws Exception
    {
-      init();
+//      init();
       RMIAdaptor adaptor = (RMIAdaptor) adaptors.get(index);
       return adaptor;
    }
 
    String[] getServers() throws Exception
    {
-      init();
+//      init();
       String[] tmp = new String[servers.size()];
       servers.toArray(tmp);
       return tmp;
    }
    String getServer(int index) throws Exception
    {
-      init();
+//      init();
       String server = (String) servers.get(index);
       return server;
    }
@@ -92,14 +108,14 @@
     */ 
    String[] getNamingURLs() throws Exception
    {
-      init();
+//      init();
       String[] tmp = new String[namingURLs.size()];
       namingURLs.toArray(tmp);
       return tmp;
    }
    String getNamingURL(int index) throws Exception
    {
-      init();
+//      init();
       String server = (String) namingURLs.get(index);
       return server;
    }
@@ -110,14 +126,14 @@
     */ 
    String[] getHANamingURLs() throws Exception
    {
-      init();
+//      init();
       String[] tmp = new String[namingURLsHA.size()];
       namingURLsHA.toArray(tmp);
       return tmp;
    }
    String getHANamingURL(int index) throws Exception
    {
-      init();
+//      init();
       String server = (String) namingURLsHA.get(index);
       return server;
    }
@@ -128,14 +144,14 @@
     */ 
    String[] getHttpURLs() throws Exception
    {
-      init();
+//      init();
       String[] tmp = new String[httpURLs.size()];
       httpURLs.toArray(tmp);
       return tmp;
    }
    String getHttpURL(int index) throws Exception
    {
-      init();
+//      init();
       String server = (String) httpURLs.get(index);
       return server;
    }
@@ -233,6 +249,8 @@
 
    public void init() throws Exception
    {
+      super.init();
+      
       if (initialContext == null)
       {
          initialContext = new InitialContext();

Modified: trunk/testsuite/src/main/org/jboss/test/JBossTestClusteredSetup.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/JBossTestClusteredSetup.java	2006-11-17 22:13:49 UTC (rev 58505)
+++ trunk/testsuite/src/main/org/jboss/test/JBossTestClusteredSetup.java	2006-11-18 00:03:45 UTC (rev 58506)
@@ -46,13 +46,15 @@
    
    // Attributes ----------------------------------------------------
    
+   private String jarName;
    // Static --------------------------------------------------------
    
    // Constructors --------------------------------------------------
    
-   public JBossTestClusteredSetup(Test test) throws Exception
+   public JBossTestClusteredSetup(Test test, String jar) throws Exception
    {
-      super(test);
+      super(JBossClusteredTestCase.class, test);
+      jarName = jar;
    }
    
    
@@ -68,9 +70,53 @@
    
    protected JBossTestServices createTestServices()
    {
-      return new JBossTestClusteredServices(getClass().getName());
+      return new JBossTestClusteredServices(getClass());
    }
+   
+   protected void setUp() throws Exception
+   {      
+      super.setUp();
+      
+      if (jarName == null) return;
+      JBossTestCase.deploymentException = null;
+      try
+      {
+         this.deploy(jarName);
+         this.getLog().debug("deployed package: " + jarName);
+      }
+      catch (Exception ex)
+      {
+         // Throw this in testServerFound() instead.
+         JBossTestCase.deploymentException = ex;
+      }
+          
+      // wait a few seconds so that the cluster stabilize
+      synchronized (this)
+      {
+         wait(2000);
+      }
+   }
 
+   protected void tearDown() throws Exception
+   {
+      try
+      {
+         if (jarName != null)
+         {
+            this.getLog().debug("Attempt undeploy of " + jarName);
+            this.undeploy(jarName);
+            this.getLog().debug("undeployed package: " + jarName);
+         }
+         super.tearDown();
+      }
+      finally
+      {
+         AbstractTestSetup.delegate = null;
+      }
+     
+   }
+   
+
    // Private -------------------------------------------------------
    
    // Inner classes -------------------------------------------------




More information about the jboss-cvs-commits mailing list