[jboss-cvs] JBoss Messaging SVN: r2910 - in trunk/tests/src/org/jboss/test/messaging: core/paging and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jul 19 12:11:48 EDT 2007


Author: timfox
Date: 2007-07-19 12:11:48 -0400 (Thu, 19 Jul 2007)
New Revision: 2910

Modified:
   trunk/tests/src/org/jboss/test/messaging/core/JDBCPersistenceManagerTest.java
   trunk/tests/src/org/jboss/test/messaging/core/paging/PagingStateTestBase.java
   trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_2PCTest.java
   trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_NTTest.java
   trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_TTest.java
   trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_2PCTest.java
   trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_NTTest.java
   trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_TTest.java
   trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
   trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java
Log:
Speeded up paging tests


Modified: trunk/tests/src/org/jboss/test/messaging/core/JDBCPersistenceManagerTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/JDBCPersistenceManagerTest.java	2007-07-19 14:13:15 UTC (rev 2909)
+++ trunk/tests/src/org/jboss/test/messaging/core/JDBCPersistenceManagerTest.java	2007-07-19 16:11:48 UTC (rev 2910)
@@ -122,8 +122,7 @@
       ms.stop();
       super.tearDown();
    }
-   
-   
+      
    public void testAddRemoveGetReferences_Batch() throws Throwable
    {
       addRemoveGetReferences(true);
@@ -134,9 +133,6 @@
       addRemoveGetReferences(false);
    }
    
-   
-   
-         
    public void testAddRemoveReference() throws Throwable
    {
       doSetup(false, false, false, 100);

Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/PagingStateTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/PagingStateTestBase.java	2007-07-19 14:13:15 UTC (rev 2909)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/PagingStateTestBase.java	2007-07-19 16:11:48 UTC (rev 2910)
@@ -100,7 +100,7 @@
                   true, true, true, false, 100);  
       ((JDBCPersistenceManager)pm).injectNodeID(1);
       pm.start();
-      
+ 
       idm = new IDManager("TRANSACTION_ID", 10, pm);
       idm.start();
       
@@ -108,7 +108,7 @@
       ms.start();
       
       tr = new TransactionRepository(pm, ms, idm);
-      tr.start();            
+      tr.start();          
    }
    
    
@@ -117,8 +117,7 @@
       pm.stop();
       tr.stop();
       ms.stop();
-      sc.stop();
-      
+      sc.stop();     
       super.tearDown();
    }
    
@@ -355,9 +354,6 @@
       queue.deliver();
       r.acknowledge();
       queue.getLocalDistributor().remove(r);
-      //Need to give enough time for the call to handle to complete and return
-      //thus removing the ref
-      Thread.sleep(500);
    }
    
    protected void consumeInTx(Queue queue, int consumeCount,
@@ -369,9 +365,6 @@
       queue.deliver();
       r.acknowledge();
       queue.getLocalDistributor().remove(r);
-      //Need to give enough time for the call to handle to complete and return
-      //thus removing the ref
-      Thread.sleep(500);
    }
    
    protected void consumeIn2PCTx(Queue queue, int consumeCount,
@@ -385,7 +378,7 @@
       queue.getLocalDistributor().remove(r);
       //Need to give enough time for the call to handle to complete and return
       //thus removing the ref
-      Thread.sleep(500);
+    //  Thread.sleep(500);
    }
    
    protected SimpleDelivery[] getDeliveries(Queue queue, int number) throws Exception
@@ -397,7 +390,7 @@
       queue.getLocalDistributor().remove(r1);
       //Need to give enough time for the call to handle to complete and return
       //thus removing the ref
-      Thread.sleep(500);      
+    //  Thread.sleep(500);      
       
       return dels;
    }
@@ -411,7 +404,7 @@
       queue.getLocalDistributor().remove(r1);
       //Need to give enough time for the call to handle to complete and return
       //thus removing the ref
-      Thread.sleep(500);      
+     // Thread.sleep(500);      
    }
    
    

Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_2PCTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_2PCTest.java	2007-07-19 14:13:15 UTC (rev 2909)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_2PCTest.java	2007-07-19 16:11:48 UTC (rev 2910)
@@ -827,9 +827,6 @@
          dels[i].cancel();   
       }
       
-      //Cancel is asynch, so need to wait a bit
-      Thread.sleep(250);
-      
       //This should cause the refs corresponding to the deliveries to go the front of the in memory quuee
       //and the oldest refs in memory evicted off the end into the down cache
       
@@ -861,9 +858,6 @@
          dels[i].cancel();
       }
       
-//    Cancel is asynch, so need to wait a bit
-      Thread.sleep(250);
-      
       //This should cause the down cache to be flushed
       
       //verify 10 ref in storage
@@ -898,9 +892,6 @@
          dels[i].cancel();
       }
       
-      // Cancel is asynch, so need to wait a bit
-      Thread.sleep(250);      
-
       //This should cause the down cache to be flushed
       
       //verify 20 ref in storage

Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_NTTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_NTTest.java	2007-07-19 14:13:15 UTC (rev 2909)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_NTTest.java	2007-07-19 16:11:48 UTC (rev 2910)
@@ -779,9 +779,6 @@
          dels[i].cancel();  
       }
       
-      // Cancel is asynch, so need to wait a bit
-      Thread.sleep(250);       
-      
       //This should cause the refs corresponding to the deliveries to go the front of the in memory quuee
       //and the oldest refs in memory evicted off the end into the down cache
       
@@ -814,10 +811,7 @@
       {
          dels[i].cancel();
       }
-      
-      // Cancel is asynch, so need to wait a bit
-      Thread.sleep(250);       
-      
+         
       //This should cause the down cache to be flushed
       
       //verify 10 ref in storage
@@ -851,11 +845,7 @@
       {
          dels[i].cancel();
       }
-      // Cancel is asynch, so need to wait a bit
-      Thread.sleep(250);       
-      
-      //consumeCount += 20;
-      
+
       //This should cause the down cache to be flushed
       
       //verify 20 ref in storage

Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_TTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_TTest.java	2007-07-19 14:13:15 UTC (rev 2909)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_TTest.java	2007-07-19 16:11:48 UTC (rev 2910)
@@ -817,9 +817,6 @@
          dels[i].cancel();  
       }
       
-      // Cancel is asynch, so need to wait a bit
-      Thread.sleep(250);       
-      
       //This should cause the refs corresponding to the deliveries to go the front of the in memory quuee
       //and the oldest refs in memory evicted off the end into the down cache
       
@@ -853,9 +850,6 @@
          dels[i].cancel();
       }
       
-      // Cancel is asynch, so need to wait a bit
-      Thread.sleep(250);       
-      
       //This should cause the down cache to be flushed
       
       //verify 10 ref in storage
@@ -890,10 +884,6 @@
          dels[i].cancel();
       }
       
-      
-      // Cancel is asynch, so need to wait a bit
-      Thread.sleep(250);       
-      
       //This should cause the down cache to be flushed
       
       //verify 20 ref in storage

Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_2PCTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_2PCTest.java	2007-07-19 14:13:15 UTC (rev 2909)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_2PCTest.java	2007-07-19 16:11:48 UTC (rev 2910)
@@ -923,10 +923,7 @@
       {
          dels[i].cancel(); 
       }
-      
-      // Cancel is asynch, so need to wait a bit
-      Thread.sleep(250);       
-      
+       
       //This should cause the refs corresponding to the deliveries to go the front of the in memory quuee
       //and the oldest refs in memory evicted off the end into the down cache
       
@@ -965,10 +962,7 @@
       {
          dels[i].cancel();
       }
-      
-      // Cancel is asynch, so need to wait a bit
-      Thread.sleep(250);       
-      
+       
       //This should cause the down cache to be flushed
       
       //verify 10 ref in storage
@@ -1008,11 +1002,6 @@
          dels[i].cancel();
       }
       
-      // Cancel is asynch, so need to wait a bit
-      Thread.sleep(250);       
-      
-      //consumeCount += 20;
-      
       //This should cause the down cache to be flushed
       
       //verify 20 ref in storage

Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_NTTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_NTTest.java	2007-07-19 14:13:15 UTC (rev 2909)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_NTTest.java	2007-07-19 16:11:48 UTC (rev 2910)
@@ -877,10 +877,7 @@
       {
          dels[i].cancel();
       }
-      
-      // Cancel is asynch, so need to wait a bit
-      Thread.sleep(250);       
-      
+
       //This should cause the refs corresponding to the deliveries to go the front of the in memory quuee
       //and the oldest refs in memory evicted off the end into the down cache
       
@@ -919,9 +916,7 @@
       {
          dels[i].cancel();
       }
-      // Cancel is asynch, so need to wait a bit
-      Thread.sleep(250);       
-      
+
       //This should cause the down cache to be flushed
       
       //verify 10 ref in storage
@@ -961,11 +956,6 @@
          dels[i].cancel();
       }
            
-      // Cancel is asynch, so need to wait a bit
-      Thread.sleep(250);     
-      
-      //consumeCount += 20;
-      
       //This should cause the down cache to be flushed
       
       //verify 20 ref in storage

Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_TTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_TTest.java	2007-07-19 14:13:15 UTC (rev 2909)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_TTest.java	2007-07-19 16:11:48 UTC (rev 2910)
@@ -911,9 +911,6 @@
          dels[i].cancel();   
       }
       
-      // Cancel is asynch, so need to wait a bit
-      Thread.sleep(250); 
-      
       //This should cause the refs corresponding to the deliveries to go the front of the in memory quuee
       //and the oldest refs in memory evicted off the end into the down cache
       
@@ -953,9 +950,6 @@
          dels[i].cancel();
       }
       
-      // Cancel is asynch, so need to wait a bit
-      Thread.sleep(250);       
-      
       //This should cause the down cache to be flushed
       
       //verify 10 ref in storage
@@ -995,11 +989,6 @@
          dels[i].cancel();
       }
       
-      // Cancel is asynch, so need to wait a bit
-      Thread.sleep(250);       
-      
-      //consumeCount += 20;
-      
       //This should cause the down cache to be flushed
       
       //verify 20 ref in storage

Modified: trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java	2007-07-19 14:13:15 UTC (rev 2909)
+++ trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java	2007-07-19 16:11:48 UTC (rev 2910)
@@ -389,11 +389,15 @@
       sb.append("-Dtest.bind.address=localhost").append(' ');
 
       String jgroupsBindAddr = System.getProperty(org.jgroups.Global.BIND_ADDR);
-      if (jgroupsBindAddr != null)
+      
+      //If not found default to localhost
+      if (jgroupsBindAddr == null)
       {
-         sb.append("-D").append(org.jgroups.Global.BIND_ADDR).append("=")
-            .append(jgroupsBindAddr).append(' ');
+      	jgroupsBindAddr = "localhost";
       }
+      
+      sb.append("-D").append(org.jgroups.Global.BIND_ADDR).append("=")
+         .append(jgroupsBindAddr).append(' ');      
 
       String database = System.getProperty("test.database");
       if (database != null)

Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java	2007-07-19 14:13:15 UTC (rev 2909)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java	2007-07-19 16:11:48 UTC (rev 2910)
@@ -342,9 +342,6 @@
 
    // Public ---------------------------------------------------------------------------------------
 
-   /**
-    * By default, starting the container DELETES ALL DATA previously existing in the database.
-    */
    public void start() throws Exception
    {
       start(true);
@@ -449,8 +446,8 @@
          if (database && (transaction || jbossjta) && jca && cleanDatabase)
          {
             // We make sure the database is clean (only if we have all dependencies the database,
-            // othewise we'll get an access error)
-            dropAllTables();
+            // otherwise we'll get an access error)
+            deleteAllData();
          }
 
          if (remoting)
@@ -487,6 +484,11 @@
          throw new Exception("Failed to start ServiceContainer", e);
       }
    }
+   
+   public void dropTables() throws Exception
+   {
+   	dropAllTables();
+   }
 
    public void startConnectionFactories(ServiceAttributeOverrides attrOverrides) throws Exception
    {
@@ -645,7 +647,7 @@
          Properties sqlProperties = new Properties();
 
          sqlProperties.load(is);
-
+         
          return sqlProperties;
       }
       else
@@ -1515,9 +1517,45 @@
          mgr.resume(txOld);
       }
 
-      log.debug("done with the database");
+      log.debug("done with dropping tables");
    }
+   
+   protected void deleteAllData() throws Exception
+   {
+      log.info("DELETING ALL DATA FROM DATABASE!");
 
+      InitialContext ctx = new InitialContext();
+      
+      // We need to execute each drop in its own transaction otherwise postgresql will not execute
+      // further commands after one fails
+
+      TransactionManager mgr = (TransactionManager)ctx.lookup(TransactionManagerService.JNDI_NAME);
+      DataSource ds = (DataSource)ctx.lookup("java:/DefaultDS");
+
+      javax.transaction.Transaction txOld = mgr.suspend();
+                  
+      executeStatement(mgr, ds, "DELETE FROM JBM_POSTOFFICE");
+      
+      executeStatement(mgr, ds, "DELETE FROM JBM_MSG_REF");
+
+      executeStatement(mgr, ds, "DELETE FROM JBM_MSG");
+     
+      executeStatement(mgr, ds, "DELETE FROM JBM_TX");
+      
+      executeStatement(mgr, ds, "DELETE FROM JBM_COUNTER");
+      
+      executeStatement(mgr, ds, "DELETE FROM JBM_USER");
+      
+      executeStatement(mgr, ds, "DELETE FROM JBM_ROLE");
+      
+      if (txOld != null)
+      {
+         mgr.resume(txOld);
+      }
+
+      log.debug("done with the deleting data");
+   }
+
    private void startMultiplexer() throws Exception
    {
       log.debug("Starting multiplexer");




More information about the jboss-cvs-commits mailing list