[hornetq-commits] JBoss hornetq SVN: r11685 - in trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration: replication and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Nov 10 06:08:03 EST 2011


Author: borges
Date: 2011-11-10 06:08:03 -0500 (Thu, 10 Nov 2011)
New Revision: 11685

Modified:
   trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupSyncJournalTest.java
   trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
   trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/PagingFailoverTest.java
   trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/ReplicatedPagingFailoverTest.java
   trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/replication/ReplicationTest.java
Log:
Fix wait for 'shared journal' backup.

Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupSyncJournalTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupSyncJournalTest.java	2011-11-10 11:07:46 UTC (rev 11684)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupSyncJournalTest.java	2011-11-10 11:08:03 UTC (rev 11685)
@@ -65,12 +65,12 @@
       backupServer.start();
 
       // Deliver messages with Backup in-sync
-      waitForBackup(sessionFactory, BACKUP_WAIT_TIME, false, backupServer.getServer());
+      waitForRemoteBackup(sessionFactory, BACKUP_WAIT_TIME, false, backupServer.getServer());
       sendMessages(session, producer, n_msgs);
 
       // Deliver messages with Backup up-to-date
       syncDelay.deliverUpToDateMsg();
-      waitForBackup(sessionFactory, BACKUP_WAIT_TIME, true, backupServer.getServer());
+      waitForRemoteBackup(sessionFactory, BACKUP_WAIT_TIME, true, backupServer.getServer());
       // SEND more messages, now with the backup replicating
       sendMessages(session, producer, n_msgs);
 
@@ -114,14 +114,14 @@
    {
       syncDelay.deliverUpToDateMsg();
       backupServer.start();
-      waitForBackup(sessionFactory, BACKUP_WAIT_TIME, true, backupServer.getServer());
+      waitForRemoteBackup(sessionFactory, BACKUP_WAIT_TIME, true, backupServer.getServer());
    }
 
    public void testReplicationDuringSync() throws Exception
    {
       createProducerSendSomeMessages();
       backupServer.start();
-      waitForBackup(sessionFactory, BACKUP_WAIT_TIME, false, backupServer.getServer());
+      waitForRemoteBackup(sessionFactory, BACKUP_WAIT_TIME, false, backupServer.getServer());
 
       sendMessages(session, producer, n_msgs);
       session.commit();
@@ -136,7 +136,7 @@
    private void finishSyncAndFailover() throws Exception
    {
       syncDelay.deliverUpToDateMsg();
-      waitForBackup(sessionFactory, BACKUP_WAIT_TIME, true, backupServer.getServer());
+      waitForRemoteBackup(sessionFactory, BACKUP_WAIT_TIME, true, backupServer.getServer());
       assertFalse("should not be initialized", backupServer.getServer().isInitialised());
       crash(session);
       waitForServerInitialization(backupServer, 5);

Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java	2011-11-10 11:07:46 UTC (rev 11684)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java	2011-11-10 11:08:03 UTC (rev 11685)
@@ -282,8 +282,7 @@
    }
 
    /**
-    * This method will Waits for backup to be in the "started" state and to finish synchronization
-    * with the live.
+    * Waits for backup to be in the "started" state and to finish synchronization with its live.
     * @param sessionFactory
     * @param seconds
     * @throws Exception
@@ -291,7 +290,14 @@
    protected void waitForBackup(ClientSessionFactoryInternal sessionFactory, int seconds) throws Exception
    {
       final HornetQServerImpl actualServer = (HornetQServerImpl)backupServer.getServer();
-      waitForBackup(sessionFactory, seconds, true, actualServer);
+      if (actualServer.getConfiguration().isSharedStore())
+      {
+         waitForServer(actualServer);
+      }
+      else
+      {
+         waitForRemoteBackup(sessionFactory, seconds, true, actualServer);
+      }
    }
 
    /**
@@ -300,7 +306,7 @@
     * @param waitForSync
     * @param actualServer
     */
-   public static void waitForBackup(ClientSessionFactoryInternal sessionFactory,
+   public static void waitForRemoteBackup(ClientSessionFactoryInternal sessionFactory,
                                     int seconds,
                                     boolean waitForSync,
                                     final HornetQServer backup)

Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/PagingFailoverTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/PagingFailoverTest.java	2011-11-10 11:07:46 UTC (rev 11684)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/PagingFailoverTest.java	2011-11-10 11:08:03 UTC (rev 11685)
@@ -48,9 +48,12 @@
 
    private static final SimpleString ADDRESS = new SimpleString("SimpleAddress");
 
-   // Attributes ----------------------------------------------------
    private ServerLocator locator;
 
+   private ClientSession session;
+
+   private ClientSessionFactoryInternal sf;
+
    // Static --------------------------------------------------------
 
    // Constructors --------------------------------------------------
@@ -67,8 +70,18 @@
    @Override
    protected void tearDown() throws Exception
    {
-      locator.close();
-      super.tearDown();
+      try
+      {
+         if (session != null)
+            session.close();
+         if (sf != null)
+            sf.close();
+      }
+      finally
+      {
+      closeServerLocator(locator);
+         super.tearDown();
+      }
    }
 
    public void testPageFailBeforeConsume() throws Exception
@@ -98,12 +111,9 @@
       locator.setBlockOnDurableSend(true);
       locator.setReconnectAttempts(-1);
 
-      ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2);
-      ClientSession session = sf.createSession(!transacted, !transacted, 0);
+      sf = createSessionFactoryAndWaitForTopology(locator, 2);
+      session = sf.createSession(!transacted, !transacted, 0);
 
-      try
-      {
-
          session.createQueue(PagingFailoverTest.ADDRESS, PagingFailoverTest.ADDRESS, true);
 
          ClientProducer prod = session.createProducer(PagingFailoverTest.ADDRESS);
@@ -144,7 +154,6 @@
 
          for (int i = 0; i < MIDDLE; i++)
          {
-            System.out.println("msg " + i);
             ClientMessage msg = cons.receive(20000);
             Assert.assertNotNull(msg);
             msg.acknowledge();
@@ -184,17 +193,6 @@
             int result = (Integer)msg.getObjectProperty(new SimpleString("key"));
             Assert.assertEquals(i, result);
          }
-      }
-      finally
-      {
-         try
-         {
-            session.close();
-         }
-         catch (Exception ignored)
-         {
-         }
-      }
    }
 
    // Package protected ---------------------------------------------

Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/ReplicatedPagingFailoverTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/ReplicatedPagingFailoverTest.java	2011-11-10 11:07:46 UTC (rev 11684)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/ReplicatedPagingFailoverTest.java	2011-11-10 11:08:03 UTC (rev 11685)
@@ -24,29 +24,9 @@
 public class ReplicatedPagingFailoverTest extends PagingFailoverTest
 {
 
-   // Constants -----------------------------------------------------
-
-   // Attributes ----------------------------------------------------
-
-   // Static --------------------------------------------------------
-
-   // Constructors --------------------------------------------------
-
-   // Public --------------------------------------------------------
-
-   // Package protected ---------------------------------------------
-
-   // Protected -----------------------------------------------------
-
-
    @Override
    protected void createConfigs() throws Exception
    {
       createReplicatedConfigs();
    }
-
-   // Private -------------------------------------------------------
-
-   // Inner classes -------------------------------------------------
-
 }

Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/replication/ReplicationTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/replication/ReplicationTest.java	2011-11-10 11:07:46 UTC (rev 11684)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/replication/ReplicationTest.java	2011-11-10 11:08:03 UTC (rev 11685)
@@ -141,7 +141,7 @@
       backupServer.start();
       if (backup)
       {
-         FailoverTestBase.waitForBackup(null, 5, true, backupServer);
+         FailoverTestBase.waitForRemoteBackup(null, 5, true, backupServer);
       }
       int count = 0;
       waitForReplication(count);



More information about the hornetq-commits mailing list