activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject activemq-artemis git commit: ARTEMIS-1224 fixing test
Date Thu, 22 Jun 2017 00:01:04 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master b89ad66c6 -> e78a90288


ARTEMIS-1224 fixing test


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/e78a9028
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/e78a9028
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/e78a9028

Branch: refs/heads/master
Commit: e78a902881671367deadcc017f8d0204500b0f21
Parents: b89ad66
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Wed Jun 21 19:57:16 2017 -0400
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Wed Jun 21 20:00:13 2017 -0400

----------------------------------------------------------------------
 .../persistence/JournalFileSizeTest.java        | 27 +++++++++++++++-----
 1 file changed, 20 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/e78a9028/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/JournalFileSizeTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/JournalFileSizeTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/JournalFileSizeTest.java
index 6a72095..7803479 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/JournalFileSizeTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/JournalFileSizeTest.java
@@ -1,5 +1,4 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
+/** * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements. See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
@@ -17,7 +16,10 @@
 package org.apache.activemq.artemis.tests.integration.persistence;
 
 
+import java.io.File;
+
 import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl;
+import org.apache.activemq.artemis.core.io.aio.AIOSequentialFileFactory;
 import org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager;
 import org.apache.activemq.artemis.utils.OrderedExecutorFactory;
 import org.junit.Assert;
@@ -25,11 +27,22 @@ import org.junit.Test;
 
 public class JournalFileSizeTest {
 
+   private static int align;
+
+   static {
+      try {
+         AIOSequentialFileFactory factory = new AIOSequentialFileFactory(new File("./target/"),
100);
+         align = factory.getAlignment();
+      } catch (Exception e) {
+         align = 512;
+      }
+   }
+
    @Test
    public void testIncorrectFileSizeLower() {
       ConfigurationImpl config = new ConfigurationImpl();
       int origFileSize = config.getJournalFileSize();
-      config.setJournalFileSize(origFileSize + (512 / 2 - 1));
+      config.setJournalFileSize(origFileSize + (align / 2 - 1));
       JournalStorageManager manager = new JournalStorageManager(config,
             new OrderedExecutorFactory(null),
             new OrderedExecutorFactory(null));
@@ -41,23 +54,23 @@ public class JournalFileSizeTest {
    public void testIncorrectFileSizeHigher() {
       ConfigurationImpl config = new ConfigurationImpl();
       int origFileSize = config.getJournalFileSize();
-      config.setJournalFileSize(origFileSize + (512 / 2 + 1));
+      config.setJournalFileSize(origFileSize + (align / 2 + 1));
       JournalStorageManager manager = new JournalStorageManager(config,
             new OrderedExecutorFactory(null),
             new OrderedExecutorFactory(null));
       int fileSize = manager.getMessageJournal().getFileSize();
-      Assert.assertEquals(origFileSize + 512, fileSize);
+      Assert.assertEquals(origFileSize + align, fileSize);
    }
 
    @Test
    public void testIncorrectFileSizeHalf() {
       ConfigurationImpl config = new ConfigurationImpl();
       int origFileSize = config.getJournalFileSize();
-      config.setJournalFileSize(origFileSize + (512 / 2));
+      config.setJournalFileSize(origFileSize + (align / 2));
       JournalStorageManager manager = new JournalStorageManager(config,
             new OrderedExecutorFactory(null),
             new OrderedExecutorFactory(null));
       int fileSize = manager.getMessageJournal().getFileSize();
-      Assert.assertEquals(origFileSize + 512, fileSize);
+      Assert.assertEquals(origFileSize + align, fileSize);
    }
 }


Mime
View raw message