[hornetq-commits] JBoss hornetq SVN: r11770 - trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Nov 25 10:01:47 EST 2011


Author: borges
Date: 2011-11-25 10:01:47 -0500 (Fri, 25 Nov 2011)
New Revision: 11770

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/BackupSyncLargeMessageTest.java
Log:
Verify that previous test did clean up.

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-25 15:01:32 UTC (rev 11769)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupSyncJournalTest.java	2011-11-25 15:01:47 UTC (rev 11770)
@@ -86,8 +86,7 @@
       finishSyncAndFailover();
 
       JournalImpl backupMsgJournal = getMessageJournalFromServer(backupServer);
-      System.out.println("backup journal " + backupMsgJournal);
-      System.out.println("live journal " + messageJournal);
+
       assertEquals("file sizes must be the same", size, backupMsgJournal.getFileSize());
       Set<Long> backupIds = getFileIds(backupMsgJournal);
       assertEquals("File IDs must match!", liveIds, backupIds);

Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupSyncLargeMessageTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupSyncLargeMessageTest.java	2011-11-25 15:01:32 UTC (rev 11769)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupSyncLargeMessageTest.java	2011-11-25 15:01:47 UTC (rev 11770)
@@ -35,9 +35,13 @@
 
    public void testDeleteLargeMessages() throws Exception
    {
+      File dir = new File(backupServer.getServer().getConfiguration().getLargeMessagesDirectory());
+      assertEquals("Should not have any large messages... previous test failed to clean up?", 0,
+                   getAllMessageFileIds(dir).size());
       createProducerSendSomeMessages();
       startBackupFinishSyncing();
-      File dir = new File(backupServer.getServer().getConfiguration().getLargeMessagesDirectory());
+      // File dir = new
+      // File(backupServer.getServer().getConfiguration().getLargeMessagesDirectory());
       receiveMsgsInRange(0, n_msgs / 2);
       assertEquals("we really ought to delete these after delivery", n_msgs / 2, getAllMessageFileIds(dir).size());
    }
@@ -45,11 +49,15 @@
    private Set<Long> getAllMessageFileIds(File dir)
    {
       Set<Long> idsOnBkp = new HashSet<Long>();
-      for (String filename : dir.list())
+      String[] fileList = dir.list();
+      if (fileList != null)
       {
-         if (filename.endsWith(".msg"))
+         for (String filename : fileList)
          {
-            idsOnBkp.add(Long.valueOf(filename.split("\\.")[0]));
+            if (filename.endsWith(".msg"))
+            {
+               idsOnBkp.add(Long.valueOf(filename.split("\\.")[0]));
+            }
          }
       }
       return idsOnBkp;



More information about the hornetq-commits mailing list