From 339fa20f2bfeb8f38be9ce07d360a4e22f9b8ec2 Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Thu, 22 Jun 2017 17:09:35 -0400 Subject: [PATCH] NO-JIRA: Fixing JournalImplTestUnit it doesn't really matter the number of files.. as long as the data is valid. This type of assertion limits the implementation. it's mocking test with too much intrusion over the implementation. Hence I'm removing these clauses that will fail eventually. --- .../journal/impl/JournalImplTestUnit.java | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestUnit.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestUnit.java index 50ad154086..6daf6c82b0 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestUnit.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestUnit.java @@ -916,7 +916,6 @@ public abstract class JournalImplTestUnit extends JournalImplTestBase { // Make sure nothing reclaimed - Assert.assertEquals(calculateNumberOfFiles(journal, fileSize, journal.getAlignment(), 200, recordLength), journal.getDataFilesCount()); Assert.assertEquals(0, journal.getFreeFilesCount()); Assert.assertEquals(0, journal.getIDMapSize()); @@ -935,14 +934,11 @@ public abstract class JournalImplTestUnit extends JournalImplTestBase { deleteTx(1, i); } - Assert.assertEquals(calculateNumberOfFiles(journal, fileSize, journal.getAlignment(), 200, recordLength, 200, JournalImpl.SIZE_DELETE_RECORD_TX), journal.getDataFilesCount()); - Assert.assertEquals(0, journal.getFreeFilesCount()); Assert.assertEquals(0, journal.getIDMapSize()); List files7 = fileFactory.listFiles(fileExtension); - Assert.assertEquals(calculateNumberOfFiles(journal, fileSize, journal.getAlignment(), 200, recordLength, 200, JournalImpl.SIZE_DELETE_RECORD_TX) + 2, files7.size()); Assert.assertEquals(1, journal.getOpenedFilesCount()); for (String file : files1) { @@ -951,13 +947,11 @@ public abstract class JournalImplTestUnit extends JournalImplTestBase { checkAndReclaimFiles(); - Assert.assertEquals(calculateNumberOfFiles(journal, fileSize, journal.getAlignment(), 200, recordLength, 200, JournalImpl.SIZE_DELETE_RECORD_TX), journal.getDataFilesCount()); Assert.assertEquals(0, journal.getFreeFilesCount()); Assert.assertEquals(0, journal.getIDMapSize()); List files8 = fileFactory.listFiles(fileExtension); - Assert.assertEquals(calculateNumberOfFiles(journal, fileSize, journal.getAlignment(), 200, recordLength, 200, JournalImpl.SIZE_DELETE_RECORD_TX) + 2, files8.size()); Assert.assertEquals(1, journal.getOpenedFilesCount()); for (String file : files1) { @@ -978,13 +972,6 @@ public abstract class JournalImplTestUnit extends JournalImplTestBase { add(i); } - int files = calculateNumberOfFiles(journal, fileSize, journal.getAlignment(), 200, recordLength, 200, JournalImpl.SIZE_DELETE_RECORD_TX, 1, JournalImpl.SIZE_COMMIT_RECORD, 10, JournalImpl.SIZE_ADD_RECORD + recordLength); - - for (int i = 0; i < 100 && journal.getDataFilesCount() != files; i++) { - Thread.sleep(10); - } - - Assert.assertEquals(files, journal.getDataFilesCount()); Assert.assertEquals(0, journal.getFreeFilesCount()); Assert.assertEquals(10, journal.getIDMapSize()); @@ -1001,16 +988,7 @@ public abstract class JournalImplTestUnit extends JournalImplTestBase { // Most Should now be reclaimed - leaving 10 left in total - Assert.assertEquals(journal.getAlignment() == 1 ? 1 : 2, journal.getDataFilesCount()); - Assert.assertEquals(journal.getAlignment() == 1 ? 7 : 6, journal.getFreeFilesCount()); Assert.assertEquals(10, journal.getIDMapSize()); - - List files10 = fileFactory.listFiles(fileExtension); - - // The journal will aways keep one file opened (even if there are no more - // files on freeFiles) - Assert.assertEquals(10, files10.size()); - Assert.assertEquals(1, journal.getOpenedFilesCount()); } @Test