This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/main by this push:
     new 42d99dd8f0 ARTEMIS-4505 Small improvements on test
42d99dd8f0 is described below

commit 42d99dd8f080657513aa5e31fdca410588489d60
Author: Clebert Suconic <[email protected]>
AuthorDate: Thu Nov 16 12:46:10 2023 -0500

    ARTEMIS-4505 Small improvements on test
---
 .../integration/paging/PageTransactionCleanupTest.java | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageTransactionCleanupTest.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageTransactionCleanupTest.java
index 5cf6c8b591..11de275080 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageTransactionCleanupTest.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageTransactionCleanupTest.java
@@ -29,9 +29,9 @@ import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.activemq.artemis.api.core.QueueConfiguration;
 import org.apache.activemq.artemis.api.core.RoutingType;
-import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.core.config.Configuration;
 import org.apache.activemq.artemis.core.paging.impl.PagingStoreImpl;
+import 
org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.Queue;
 import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
@@ -53,14 +53,11 @@ public class PageTransactionCleanupTest extends 
ActiveMQTestBase {
 
    private static final Logger logger = 
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
-   private static final int PAGE_MAX = 100 * 1024;
-
-   private static final int PAGE_SIZE = 10 * 1024;
-
-   static final SimpleString ADDRESS = new SimpleString("TestQueue");
 
    @Test
    public void testPageTXCleanup() throws Throwable {
+      final int PAGE_MAX = 100 * 1024;
+      final int PAGE_SIZE = 10 * 1024;
 
       Configuration config = 
createDefaultConfig(true).setJournalSyncNonTransactional(false);
 
@@ -100,15 +97,20 @@ public class PageTransactionCleanupTest extends 
ActiveMQTestBase {
          logger.debug("removing file {}", fileToRemove);
       }
 
+
+      HashMap<Integer, AtomicInteger> journalCount = 
countJournal(server.getConfiguration());
+      Assert.assertEquals(NUMBER_OF_MESSAGES * 2, 
journalCount.get((int)JournalRecordIds.PAGE_TRANSACTION).get());
+
       try (AssertionLoggerHandler handler = new AssertionLoggerHandler()) {
          server.start();
          Wait.assertTrue(() -> handler.findText("AMQ224132"));
       }
 
+      // compacting to clean up older records before counting them
       
server.getStorageManager().getMessageJournal().scheduleCompactAndBlock(60_000);
 
-      HashMap<Integer, AtomicInteger> countedJournal = 
countJournal(server.getConfiguration());
-      Assert.assertEquals(NUMBER_OF_MESSAGES, countedJournal.get(35).get());
+      journalCount = countJournal(server.getConfiguration());
+      Assert.assertEquals(NUMBER_OF_MESSAGES, 
journalCount.get((int)JournalRecordIds.PAGE_TRANSACTION).get());
 
       server.stop();
       server.start();

Reply via email to