activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From michaelpea...@apache.org
Subject [activemq-artemis] branch master updated: ARTEMIS-2450 page-size-bytes should not be greater than Integer.MAX_VALUE
Date Mon, 19 Aug 2019 16:18:51 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new a644c49  ARTEMIS-2450 page-size-bytes should not be greater than Integer.MAX_VALUE
     new b9dda34  This closes #2791
a644c49 is described below

commit a644c498da088cf9a5a9d1d4c13aa0acbdcbd2dd
Author: Wei Yang <wy96fyw@gmail.com>
AuthorDate: Mon Aug 5 09:28:39 2019 +0800

    ARTEMIS-2450 page-size-bytes should not be greater than Integer.MAX_VALUE
---
 .../artemis/core/config/impl/Validators.java       | 24 ++++++++++++++++++
 .../deployers/impl/FileConfigurationParser.java    | 20 ++++++++-------
 .../activemq/artemis/core/paging/PagingStore.java  |  2 +-
 .../artemis/core/paging/impl/PagingStoreImpl.java  |  4 +--
 .../artemis/core/server/ActiveMQMessageBundle.java |  6 +++++
 .../artemis/core/server/impl/QueueImpl.java        |  2 +-
 .../core/settings/impl/AddressSettings.java        | 15 +++++------
 .../config/impl/FileConfigurationParserTest.java   | 29 ++++++++++++++++++++++
 .../core/config/impl/FileConfigurationTest.java    |  4 +--
 .../artemis/core/config/impl/ValidatorsTest.java   | 23 +++++++++++++++++
 .../artemis/tests/util/ActiveMQTestBase.java       |  6 ++---
 .../resources/ConfigurationTest-full-config.xml    |  4 +--
 ...rationTest-xinclude-config-address-settings.xml |  4 +--
 .../test/resources/InvalidConfigurationTest0.xml   |  4 +--
 .../test/resources/InvalidConfigurationTest1.xml   |  4 +--
 .../test/resources/InvalidConfigurationTest2.xml   |  4 +--
 .../test/resources/InvalidConfigurationTest3.xml   |  4 +--
 .../test/resources/InvalidConfigurationTest4.xml   |  4 +--
 .../test/resources/InvalidConfigurationTest5.xml   |  4 +--
 .../amqp/AmqpBridgeClusterRedistributionTest.java  |  2 +-
 .../ExclusiveDivertWithClusterTest.java            |  2 +-
 .../tests/integration/paging/GlobalPagingTest.java |  2 +-
 .../integration/plugin/OpenwirePluginTest.java     |  2 +-
 .../storage/PersistMultiThreadTest.java            |  2 +-
 24 files changed, 131 insertions(+), 46 deletions(-)

diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/Validators.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/Validators.java
index 7883013..a5d41ee 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/Validators.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/Validators.java
@@ -122,6 +122,30 @@ public final class Validators {
       }
    };
 
+   public static final Validator POSITIVE_INT = new Validator() {
+      @Override
+      public void validate(final String name, final Object value) {
+         Number val = (Number) value;
+         if (val.longValue() > 0 && val.longValue() <= Integer.MAX_VALUE) {
+            // OK
+         } else {
+            throw ActiveMQMessageBundle.BUNDLE.inRangeOfPositiveInt(name, val);
+         }
+      }
+   };
+
+   public static final Validator MINUS_ONE_OR_POSITIVE_INT = new Validator() {
+      @Override
+      public void validate(final String name, final Object value) {
+         Number val = (Number) value;
+         if (val.longValue() == -1 || (val.longValue() > 0 && val.longValue()
<= Integer.MAX_VALUE)) {
+            // OK
+         } else {
+            throw ActiveMQMessageBundle.BUNDLE.inRangeOfPositiveIntThanMinusOne(name, val);
+         }
+      }
+   };
+
    public static final Validator THREAD_PRIORITY_RANGE = new Validator() {
       @Override
       public void validate(final String name, final Object value) {
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java
index e733465..8d016ef 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java
@@ -599,11 +599,11 @@ public final class FileConfigurationParser extends XMLConfigurationUtil
{
 
       config.setJournalSyncNonTransactional(getBoolean(e, "journal-sync-non-transactional",
config.isJournalSyncNonTransactional()));
 
-      config.setJournalFileSize(getTextBytesAsIntBytes(e, "journal-file-size", config.getJournalFileSize(),
Validators.GT_ZERO));
+      config.setJournalFileSize(getTextBytesAsIntBytes(e, "journal-file-size", config.getJournalFileSize(),
Validators.POSITIVE_INT));
 
       int journalBufferTimeout = getInteger(e, "journal-buffer-timeout", config.getJournalType()
== JournalType.ASYNCIO ? ArtemisConstants.DEFAULT_JOURNAL_BUFFER_TIMEOUT_AIO : ArtemisConstants.DEFAULT_JOURNAL_BUFFER_TIMEOUT_NIO,
Validators.GE_ZERO);
 
-      int journalBufferSize = getTextBytesAsIntBytes(e, "journal-buffer-size", config.getJournalType()
== JournalType.ASYNCIO ? ArtemisConstants.DEFAULT_JOURNAL_BUFFER_SIZE_AIO : ArtemisConstants.DEFAULT_JOURNAL_BUFFER_SIZE_NIO,
Validators.GT_ZERO);
+      int journalBufferSize = getTextBytesAsIntBytes(e, "journal-buffer-size", config.getJournalType()
== JournalType.ASYNCIO ? ArtemisConstants.DEFAULT_JOURNAL_BUFFER_SIZE_AIO : ArtemisConstants.DEFAULT_JOURNAL_BUFFER_SIZE_NIO,
Validators.POSITIVE_INT);
 
       int journalMaxIO = getInteger(e, "journal-max-io", config.getJournalType() == JournalType.ASYNCIO
? ActiveMQDefaultConfiguration.getDefaultJournalMaxIoAio() : ActiveMQDefaultConfiguration.getDefaultJournalMaxIoNio(),
Validators.GT_ZERO);
 
@@ -1049,7 +1049,9 @@ public final class FileConfigurationParser extends XMLConfigurationUtil
{
          } else if (MAX_SIZE_BYTES_NODE_NAME.equalsIgnoreCase(name)) {
             addressSettings.setMaxSizeBytes(ByteUtil.convertTextBytes(getTrimmedTextContent(child)));
          } else if (PAGE_SIZE_BYTES_NODE_NAME.equalsIgnoreCase(name)) {
-            addressSettings.setPageSizeBytes(ByteUtil.convertTextBytes(getTrimmedTextContent(child)));
+            long pageSizeLong = ByteUtil.convertTextBytes(getTrimmedTextContent(child));
+            Validators.POSITIVE_INT.validate(PAGE_SIZE_BYTES_NODE_NAME, pageSizeLong);
+            addressSettings.setPageSizeBytes((int) pageSizeLong);
          } else if (PAGE_MAX_CACHE_SIZE_NODE_NAME.equalsIgnoreCase(name)) {
             addressSettings.setPageCacheMaxSize(XMLUtil.parseInt(child));
          } else if (MESSAGE_COUNTER_HISTORY_DAY_LIMIT_NODE_NAME.equalsIgnoreCase(name)) {
@@ -1758,7 +1760,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil
{
 
       double retryIntervalMultiplier = getDouble(e, "retry-interval-multiplier", ActiveMQDefaultConfiguration.getDefaultClusterRetryIntervalMultiplier(),
Validators.GT_ZERO);
 
-      int minLargeMessageSize = getTextBytesAsIntBytes(e, "min-large-message-size", ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
Validators.GT_ZERO);
+      int minLargeMessageSize = getTextBytesAsIntBytes(e, "min-large-message-size", ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
Validators.POSITIVE_INT);
 
       long maxRetryInterval = getLong(e, "max-retry-interval", ActiveMQDefaultConfiguration.getDefaultClusterMaxRetryInterval(),
Validators.GT_ZERO);
 
@@ -1766,9 +1768,9 @@ public final class FileConfigurationParser extends XMLConfigurationUtil
{
 
       int reconnectAttempts = getInteger(e, "reconnect-attempts", ActiveMQDefaultConfiguration.getDefaultClusterReconnectAttempts(),
Validators.MINUS_ONE_OR_GE_ZERO);
 
-      int confirmationWindowSize = getTextBytesAsIntBytes(e, "confirmation-window-size",
ActiveMQDefaultConfiguration.getDefaultClusterConfirmationWindowSize(), Validators.GT_ZERO);
+      int confirmationWindowSize = getTextBytesAsIntBytes(e, "confirmation-window-size",
ActiveMQDefaultConfiguration.getDefaultClusterConfirmationWindowSize(), Validators.POSITIVE_INT);
 
-      int producerWindowSize = getTextBytesAsIntBytes(e, "producer-window-size", ActiveMQDefaultConfiguration.getDefaultBridgeProducerWindowSize(),
Validators.MINUS_ONE_OR_GT_ZERO);
+      int producerWindowSize = getTextBytesAsIntBytes(e, "producer-window-size", ActiveMQDefaultConfiguration.getDefaultBridgeProducerWindowSize(),
Validators.MINUS_ONE_OR_POSITIVE_INT);
 
       long clusterNotificationInterval = getLong(e, "notification-interval", ActiveMQDefaultConfiguration.getDefaultClusterNotificationInterval(),
Validators.GT_ZERO);
 
@@ -1841,9 +1843,9 @@ public final class FileConfigurationParser extends XMLConfigurationUtil
{
       String transformerClassName = getString(brNode, "transformer-class-name", null, Validators.NO_CHECK);
 
       // Default bridge conf
-      int confirmationWindowSize = getTextBytesAsIntBytes(brNode, "confirmation-window-size",
ActiveMQDefaultConfiguration.getDefaultBridgeConfirmationWindowSize(), Validators.GT_ZERO);
+      int confirmationWindowSize = getTextBytesAsIntBytes(brNode, "confirmation-window-size",
ActiveMQDefaultConfiguration.getDefaultBridgeConfirmationWindowSize(), Validators.POSITIVE_INT);
 
-      int producerWindowSize = getTextBytesAsIntBytes(brNode, "producer-window-size", ActiveMQDefaultConfiguration.getDefaultBridgeConfirmationWindowSize(),
Validators.GT_ZERO);
+      int producerWindowSize = getTextBytesAsIntBytes(brNode, "producer-window-size", ActiveMQDefaultConfiguration.getDefaultBridgeConfirmationWindowSize(),
Validators.POSITIVE_INT);
 
       long retryInterval = getLong(brNode, "retry-interval", ActiveMQClient.DEFAULT_RETRY_INTERVAL,
Validators.GT_ZERO);
 
@@ -1851,7 +1853,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil
{
 
       long connectionTTL = getLong(brNode, "connection-ttl", ActiveMQClient.DEFAULT_CONNECTION_TTL,
Validators.GT_ZERO);
 
-      int minLargeMessageSize = getTextBytesAsIntBytes(brNode, "min-large-message-size",
ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE, Validators.GT_ZERO);
+      int minLargeMessageSize = getTextBytesAsIntBytes(brNode, "min-large-message-size",
ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE, Validators.POSITIVE_INT);
 
       long maxRetryInterval = getLong(brNode, "max-retry-interval", ActiveMQClient.DEFAULT_MAX_RETRY_INTERVAL,
Validators.GT_ZERO);
 
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/PagingStore.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/PagingStore.java
index a49e58d..275805e 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/PagingStore.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/PagingStore.java
@@ -61,7 +61,7 @@ public interface PagingStore extends ActiveMQComponent, RefCountMessageListener
 
    long getFirstPage();
 
-   long getPageSizeBytes();
+   int getPageSizeBytes();
 
    long getAddressSize();
 
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java
index 908e807..452be16 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java
@@ -91,7 +91,7 @@ public class PagingStoreImpl implements PagingStore {
 
    private long maxSize;
 
-   private long pageSize;
+   private int pageSize;
 
    private volatile AddressFullMessagePolicy addressFullMessagePolicy;
 
@@ -273,7 +273,7 @@ public class PagingStoreImpl implements PagingStore {
    }
 
    @Override
-   public long getPageSizeBytes() {
+   public int getPageSizeBytes() {
       return pageSize;
    }
 
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java
index 930c236..c8eca81 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java
@@ -473,4 +473,10 @@ public interface ActiveMQMessageBundle {
 
    @Message(id = 229225, value = "Validated User is not set", format = Message.Format.MESSAGE_FORMAT)
    ActiveMQIllegalStateException rejectEmptyValidatedUser();
+
+   @Message(id = 229226, value = "{0}  must be greater than 0 and less than or equal to Integer.MAX_VALUE
(actual value: {1})", format = Message.Format.MESSAGE_FORMAT)
+   IllegalArgumentException inRangeOfPositiveInt(String name, Number val);
+
+   @Message(id = 229227, value = "{0}  must be equals to -1 or greater than 0 and less than
or equal to Integer.MAX_VALUE (actual value: {1})", format = Message.Format.MESSAGE_FORMAT)
+   IllegalArgumentException inRangeOfPositiveIntThanMinusOne(String name, Number val);
 }
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
index d56e4db..1c133ef 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
@@ -2765,7 +2765,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue
{
          }
       }
 
-      long maxSize = pageSubscription.getPagingStore().getPageSizeBytes();
+      int maxSize = pageSubscription.getPagingStore().getPageSizeBytes();
 
       long timeout = System.currentTimeMillis() + DELIVERY_TIMEOUT;
 
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/AddressSettings.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/AddressSettings.java
index 600839e..b864c6f 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/AddressSettings.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/AddressSettings.java
@@ -42,7 +42,7 @@ public class AddressSettings implements Mergeable<AddressSettings>,
Serializable
 
    public static final AddressFullMessagePolicy DEFAULT_ADDRESS_FULL_MESSAGE_POLICY = AddressFullMessagePolicy.PAGE;
 
-   public static final long DEFAULT_PAGE_SIZE = 10 * 1024 * 1024;
+   public static final int DEFAULT_PAGE_SIZE = 10 * 1024 * 1024;
 
    public static final int DEFAULT_MAX_DELIVERY_ATTEMPTS = 10;
 
@@ -111,7 +111,7 @@ public class AddressSettings implements Mergeable<AddressSettings>,
Serializable
 
    private Long maxSizeBytes = null;
 
-   private Long pageSizeBytes = null;
+   private Integer pageSizeBytes = null;
 
    private Integer pageMaxCache = null;
 
@@ -500,11 +500,11 @@ public class AddressSettings implements Mergeable<AddressSettings>,
Serializable
       return this;
    }
 
-   public long getPageSizeBytes() {
+   public int getPageSizeBytes() {
       return pageSizeBytes != null ? pageSizeBytes : AddressSettings.DEFAULT_PAGE_SIZE;
    }
 
-   public AddressSettings setPageSizeBytes(final long pageSize) {
+   public AddressSettings setPageSizeBytes(final int pageSize) {
       pageSizeBytes = pageSize;
       return this;
    }
@@ -909,7 +909,8 @@ public class AddressSettings implements Mergeable<AddressSettings>,
Serializable
 
       maxSizeBytes = BufferHelper.readNullableLong(buffer);
 
-      pageSizeBytes = BufferHelper.readNullableLong(buffer);
+      Long pageSizeLong = BufferHelper.readNullableLong(buffer);
+      pageSizeBytes = pageSizeLong == null ? null : pageSizeLong.intValue();
 
       pageMaxCache = BufferHelper.readNullableInteger(buffer);
 
@@ -1046,7 +1047,7 @@ public class AddressSettings implements Mergeable<AddressSettings>,
Serializable
 
       return BufferHelper.sizeOfNullableSimpleString(addressFullMessagePolicy != null ? addressFullMessagePolicy.toString()
: null) +
          BufferHelper.sizeOfNullableLong(maxSizeBytes) +
-         BufferHelper.sizeOfNullableLong(pageSizeBytes) +
+         BufferHelper.sizeOfNullableLong(Long.valueOf(pageSizeBytes)) +
          BufferHelper.sizeOfNullableInteger(pageMaxCache) +
          BufferHelper.sizeOfNullableBoolean(dropMessagesWhenFull) +
          BufferHelper.sizeOfNullableInteger(maxDeliveryAttempts) +
@@ -1097,7 +1098,7 @@ public class AddressSettings implements Mergeable<AddressSettings>,
Serializable
 
       BufferHelper.writeNullableLong(buffer, maxSizeBytes);
 
-      BufferHelper.writeNullableLong(buffer, pageSizeBytes);
+      BufferHelper.writeNullableLong(buffer, Long.valueOf(pageSizeBytes));
 
       BufferHelper.writeNullableInteger(buffer, pageMaxCache);
 
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationParserTest.java
b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationParserTest.java
index d9fc446..df1ee08 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationParserTest.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationParserTest.java
@@ -257,6 +257,35 @@ public class FileConfigurationParserTest extends ActiveMQTestBase {
       assertEquals("helloworld", bconfig.getPassword());
    }
 
+   @Test
+   public void testParsingOverflowPageSize() throws Exception {
+      testParsingOverFlow("<address-settings>" + "\n" + "<address-setting match=\"#\">"
+ "\n" + "<page-size-bytes>2147483648</page-size-bytes>\n" + "</address-setting>"
+ "\n" + "</address-settings>" + "\n");
+      testParsingOverFlow("<journal-file-size>2147483648</journal-file-size>");
+      testParsingOverFlow("<journal-buffer-size>2147483648</journal-buffer-size>");
+
+      testParsingOverFlow("<cluster-connections> \n" + "  <cluster-connection name=\"my-cluster\">
\n" + "    <connector-ref>netty</connector-ref>  \n" + "    <min-large-message-size>2147483648</min-large-message-size>\n"
+ "    <discovery-group-ref discovery-group-name=\"my-discovery-group\"/> \n" + "  </cluster-connection>
\n" + "</cluster-connections>");
+      testParsingOverFlow("<cluster-connections> \n" + "  <cluster-connection name=\"my-cluster\">
\n" + "    <connector-ref>netty</connector-ref>  \n" + "    <confirmation-window-size>2147483648</confirmation-window-size>\n"
+ "    <discovery-group-ref discovery-group-name=\"my-discovery-group\"/> \n" + "  </cluster-connection>
\n" + "</cluster-connections>");
+      testParsingOverFlow("<cluster-connections> \n" + "  <cluster-connection name=\"my-cluster\">
\n" + "    <connector-ref>netty</connector-ref>  \n" + "    <producer-window-size>2147483648</producer-window-size>\n"
+ "    <discovery-group-ref discovery-group-name=\"my-discovery-group\"/> \n" + "  </cluster-connection>
\n" + "</cluster-connections>");
+
+      testParsingOverFlow("<bridges> \n" + "  <bridge name=\"price-forward-bridge\">
\n" + "    <queue-name>priceForwarding</queue-name>  \n" + "    <forwarding-address>newYorkPriceUpdates</forwarding-address>\n"
+ "    <min-large-message-size>2147483648</min-large-message-size>\n" + "    <static-connectors>
\n" + "      <connector-ref>netty</connector-ref> \n" + "    </static-connectors>
\n" + "  </bridge> \n" + "</bridges>");
+      testParsingOverFlow("<bridges> \n" + "  <bridge name=\"price-forward-bridge\">
\n" + "    <queue-name>priceForwarding</queue-name>  \n" + "    <forwarding-address>newYorkPriceUpdates</forwarding-address>\n"
+ "    <confirmation-window-size>2147483648</confirmation-window-size>\n" + "
   <static-connectors> \n" + "      <connector-ref>netty</connector-ref>
\n" + "    </static-connectors> \n" + "  </bridge> \n" + "</bridges>\n");
+      testParsingOverFlow("<bridges> \n" + "  <bridge name=\"price-forward-bridge\">
\n" + "    <queue-name>priceForwarding</queue-name>  \n" + "    <forwarding-address>newYorkPriceUpdates</forwarding-address>\n"
+ "    <producer-window-size>2147483648</producer-window-size>\n" + "    <static-connectors>
\n" + "      <connector-ref>netty</connector-ref> \n" + "    </static-connectors>
\n" + "  </bridge> \n" + "</bridges>\n");
+   }
+
+   private void testParsingOverFlow(String config) throws Exception {
+      FileConfigurationParser parser = new FileConfigurationParser();
+      String firstPartWithoutAddressSettings = firstPart.substring(0, firstPart.indexOf("<address-settings"));
+
+      String configStr = firstPartWithoutAddressSettings + config + lastPart;
+      ByteArrayInputStream input = new ByteArrayInputStream(configStr.getBytes(StandardCharsets.UTF_8));
+
+      try {
+         Configuration configuration = parser.parseMainConfig(input);
+         fail("parsing should have failed bcs of overflow page size");
+      } catch (java.lang.IllegalArgumentException e) {
+      }
+   }
+
    private static String bridgePart = "<bridges>\n" +
            "            <bridge name=\"my-bridge\">\n" +
            "               <queue-name>sausage-factory</queue-name>\n" +
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java
b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java
index 98711f7..18469c5 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java
@@ -344,7 +344,7 @@ public class FileConfigurationTest extends ConfigurationImplTest {
       assertEquals("a1.2", conf.getAddressesSettings().get("a1").getExpiryAddress().toString());
       assertEquals(1, conf.getAddressesSettings().get("a1").getRedeliveryDelay());
       assertEquals(856686592L, conf.getAddressesSettings().get("a1").getMaxSizeBytes());
-      assertEquals(81738173872337L, conf.getAddressesSettings().get("a1").getPageSizeBytes());
+      assertEquals(817381738L, conf.getAddressesSettings().get("a1").getPageSizeBytes());
       assertEquals(10, conf.getAddressesSettings().get("a1").getPageCacheMaxSize());
       assertEquals(4, conf.getAddressesSettings().get("a1").getMessageCounterHistoryDayLimit());
       assertEquals(10, conf.getAddressesSettings().get("a1").getSlowConsumerThreshold());
@@ -365,7 +365,7 @@ public class FileConfigurationTest extends ConfigurationImplTest {
       assertEquals("a2.2", conf.getAddressesSettings().get("a2").getExpiryAddress().toString());
       assertEquals(5, conf.getAddressesSettings().get("a2").getRedeliveryDelay());
       assertEquals(932489234928324L, conf.getAddressesSettings().get("a2").getMaxSizeBytes());
-      assertEquals(7126716262626L, conf.getAddressesSettings().get("a2").getPageSizeBytes());
+      assertEquals(712671626L, conf.getAddressesSettings().get("a2").getPageSizeBytes());
       assertEquals(20, conf.getAddressesSettings().get("a2").getPageCacheMaxSize());
       assertEquals(8, conf.getAddressesSettings().get("a2").getMessageCounterHistoryDayLimit());
       assertEquals(20, conf.getAddressesSettings().get("a2").getSlowConsumerThreshold());
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ValidatorsTest.java
b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ValidatorsTest.java
index 354827a..1d575e4 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ValidatorsTest.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ValidatorsTest.java
@@ -120,6 +120,29 @@ public class ValidatorsTest extends Assert {
       ValidatorsTest.failure(Validators.PERCENTAGE_OR_MINUS_ONE, null);
    }
 
+   @Test
+   public void testPOSITIVE_INT() {
+      ValidatorsTest.failure(Validators.POSITIVE_INT, -1);
+      ValidatorsTest.failure(Validators.POSITIVE_INT, 0);
+      ValidatorsTest.failure(Validators.POSITIVE_INT, 0.1);
+      ValidatorsTest.success(Validators.POSITIVE_INT, 1);
+
+      ValidatorsTest.success(Validators.POSITIVE_INT, Integer.MAX_VALUE);
+      ValidatorsTest.failure(Validators.POSITIVE_INT, Integer.MAX_VALUE + 1);
+   }
+
+   @Test
+   public void testMINUS_ONE_OR_POSITIVE_INT() {
+      ValidatorsTest.failure(Validators.MINUS_ONE_OR_POSITIVE_INT, -2);
+      ValidatorsTest.success(Validators.MINUS_ONE_OR_POSITIVE_INT, -1);
+      ValidatorsTest.failure(Validators.MINUS_ONE_OR_POSITIVE_INT, 0);
+      ValidatorsTest.failure(Validators.MINUS_ONE_OR_POSITIVE_INT, 0.1);
+      ValidatorsTest.success(Validators.MINUS_ONE_OR_POSITIVE_INT, 1);
+
+      ValidatorsTest.success(Validators.MINUS_ONE_OR_POSITIVE_INT, Integer.MAX_VALUE);
+      ValidatorsTest.failure(Validators.MINUS_ONE_OR_POSITIVE_INT, Integer.MAX_VALUE + 1);
+   }
+
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java
b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java
index a318e98..458da17 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java
@@ -1399,14 +1399,14 @@ public abstract class ActiveMQTestBase extends Assert {
 
    protected final ActiveMQServer createServer(final boolean realFiles,
                                                final Configuration configuration,
-                                               final long pageSize,
+                                               final int pageSize,
                                                final long maxAddressSize) {
       return createServer(realFiles, configuration, pageSize, maxAddressSize, (Map<String,
AddressSettings>) null);
    }
 
    protected ActiveMQServer createServer(final boolean realFiles,
                                          final Configuration configuration,
-                                         final long pageSize,
+                                         final int pageSize,
                                          final long maxAddressSize,
                                          final Map<String, AddressSettings> settings)
{
       ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(configuration,
realFiles));
@@ -1426,7 +1426,7 @@ public abstract class ActiveMQTestBase extends Assert {
 
    protected final ActiveMQServer createServer(final boolean realFiles,
                                                final Configuration configuration,
-                                               final long pageSize,
+                                               final int pageSize,
                                                final long maxAddressSize,
                                                final Map<String, AddressSettings> settings,
                                                StoreConfiguration.StoreType storeType) {
diff --git a/artemis-server/src/test/resources/ConfigurationTest-full-config.xml b/artemis-server/src/test/resources/ConfigurationTest-full-config.xml
index c97bcbf..8b96e91 100644
--- a/artemis-server/src/test/resources/ConfigurationTest-full-config.xml
+++ b/artemis-server/src/test/resources/ConfigurationTest-full-config.xml
@@ -384,7 +384,7 @@
             <expiry-address>a1.2</expiry-address>
             <redelivery-delay>1</redelivery-delay>
             <max-size-bytes>817M</max-size-bytes>
-            <page-size-bytes>81738173872337</page-size-bytes>
+            <page-size-bytes>817381738</page-size-bytes>
             <page-max-cache-size>10</page-max-cache-size>
             <message-counter-history-day-limit>4</message-counter-history-day-limit>
             <slow-consumer-threshold>10</slow-consumer-threshold>
@@ -408,7 +408,7 @@
             <expiry-address>a2.2</expiry-address>
             <redelivery-delay>5</redelivery-delay>
             <max-size-bytes>932489234928324</max-size-bytes>
-            <page-size-bytes>7126716262626</page-size-bytes>
+            <page-size-bytes>712671626</page-size-bytes>
             <page-max-cache-size>20</page-max-cache-size>
             <message-counter-history-day-limit>8</message-counter-history-day-limit>
             <slow-consumer-threshold>20</slow-consumer-threshold>
diff --git a/artemis-server/src/test/resources/ConfigurationTest-xinclude-config-address-settings.xml
b/artemis-server/src/test/resources/ConfigurationTest-xinclude-config-address-settings.xml
index 0d5784d..b060302 100644
--- a/artemis-server/src/test/resources/ConfigurationTest-xinclude-config-address-settings.xml
+++ b/artemis-server/src/test/resources/ConfigurationTest-xinclude-config-address-settings.xml
@@ -20,7 +20,7 @@
       <expiry-address>a1.2</expiry-address>
       <redelivery-delay>1</redelivery-delay>
       <max-size-bytes>817M</max-size-bytes>
-      <page-size-bytes>81738173872337</page-size-bytes>
+      <page-size-bytes>817381738</page-size-bytes>
       <page-max-cache-size>10</page-max-cache-size>
       <message-counter-history-day-limit>4</message-counter-history-day-limit>
       <slow-consumer-threshold>10</slow-consumer-threshold>
@@ -44,7 +44,7 @@
       <expiry-address>a2.2</expiry-address>
       <redelivery-delay>5</redelivery-delay>
       <max-size-bytes>932489234928324</max-size-bytes>
-      <page-size-bytes>7126716262626</page-size-bytes>
+      <page-size-bytes>712671626</page-size-bytes>
       <page-max-cache-size>20</page-max-cache-size>
       <message-counter-history-day-limit>8</message-counter-history-day-limit>
       <slow-consumer-threshold>20</slow-consumer-threshold>
diff --git a/artemis-server/src/test/resources/InvalidConfigurationTest0.xml b/artemis-server/src/test/resources/InvalidConfigurationTest0.xml
index 9eabc9e..ca08c84 100644
--- a/artemis-server/src/test/resources/InvalidConfigurationTest0.xml
+++ b/artemis-server/src/test/resources/InvalidConfigurationTest0.xml
@@ -213,7 +213,7 @@
             <expiry-address>a1.2</expiry-address>
             <redelivery-delay>1</redelivery-delay>
             <max-size-bytes>81781728121878</max-size-bytes>
-            <page-size-bytes>81738173872337</page-size-bytes>
+            <page-size-bytes>817381738</page-size-bytes>
             <page-max-cache-size>10</page-max-cache-size>
             <message-counter-history-day-limit>4</message-counter-history-day-limit>
          </address-setting>
@@ -222,7 +222,7 @@
             <expiry-address>a2.2</expiry-address>
             <redelivery-delay>5</redelivery-delay>
             <max-size-bytes>932489234928324</max-size-bytes>
-            <page-size-bytes>7126716262626</page-size-bytes>
+            <page-size-bytes>712671626</page-size-bytes>
             <page-max-cache-size>20</page-max-cache-size>
             <message-counter-history-day-limit>AA</message-counter-history-day-limit>
          </address-setting>
diff --git a/artemis-server/src/test/resources/InvalidConfigurationTest1.xml b/artemis-server/src/test/resources/InvalidConfigurationTest1.xml
index 7080f37..93e6e9b 100644
--- a/artemis-server/src/test/resources/InvalidConfigurationTest1.xml
+++ b/artemis-server/src/test/resources/InvalidConfigurationTest1.xml
@@ -213,7 +213,7 @@
             <expiry-address>a1.2</expiry-address>
             <redelivery-delay>1</redelivery-delay>
             <max-size-bytes>81781728121878</max-size-bytes>
-            <page-size-bytes>81738173872337</page-size-bytes>
+            <page-size-bytes>817381738</page-size-bytes>
             <page-max-cache-size>10</page-max-cache-size>
             <message-counter-history-day-limit>4</message-counter-history-day-limit>
          </address-setting>
@@ -222,7 +222,7 @@
             <expiry-address>a2.2</expiry-address>
             <redelivery-delay>5</redelivery-delay>
             <max-size-bytes>932489234928324</max-size-bytes>
-            <page-size-bytes>7126716262626</page-size-bytes>
+            <page-size-bytes>712671626</page-size-bytes>
             <page-max-cache-size>20</page-max-cache-size>
             <message-counter-history-day-limit>8</message-counter-history-day-limit>
          </address-setting>
diff --git a/artemis-server/src/test/resources/InvalidConfigurationTest2.xml b/artemis-server/src/test/resources/InvalidConfigurationTest2.xml
index 3d3ae98..bdd50e9 100644
--- a/artemis-server/src/test/resources/InvalidConfigurationTest2.xml
+++ b/artemis-server/src/test/resources/InvalidConfigurationTest2.xml
@@ -213,7 +213,7 @@
             <expiry-address>a1.2</expiry-address>
             <redelivery-delay>1</redelivery-delay>
             <max-size-bytes>81781728121878</max-size-bytes>
-            <page-size-bytes>81738173872337</page-size-bytes>
+            <page-size-bytes>817381738</page-size-bytes>
             <page-max-cache-size>10</page-max-cache-size>
             <message-counter-history-day-limit>4</message-counter-history-day-limit>
          </address-setting>
@@ -222,7 +222,7 @@
             <expiry-address>a2.2</expiry-address>
             <redelivery-delay>5</redelivery-delay>
             <max-size-bytes>932489234928324</max-size-bytes>
-            <page-size-bytes>7126716262626</page-size-bytes>
+            <page-size-bytes>712671626</page-size-bytes>
             <page-max-cache-size>20</page-max-cache-size>
             <message-counter-history-day-limit>8</message-counter-history-day-limit>
          </address-setting>
diff --git a/artemis-server/src/test/resources/InvalidConfigurationTest3.xml b/artemis-server/src/test/resources/InvalidConfigurationTest3.xml
index 7b3eb9b..b52d2e5 100644
--- a/artemis-server/src/test/resources/InvalidConfigurationTest3.xml
+++ b/artemis-server/src/test/resources/InvalidConfigurationTest3.xml
@@ -214,7 +214,7 @@
             <expiry-address>a1.2</expiry-address>
             <redelivery-delay>1</redelivery-delay>
             <max-size-bytes>81781728121878</max-size-bytes>
-            <page-size-bytes>81738173872337</page-size-bytes>
+            <page-size-bytes>817381738</page-size-bytes>
             <page-max-cache-size>10</page-max-cache-size>
             <message-counter-history-day-limit>4</message-counter-history-day-limit>
          </address-setting>
@@ -223,7 +223,7 @@
             <expiry-address>a2.2</expiry-address>
             <redelivery-delay>5</redelivery-delay>
             <max-size-bytes>932489234928324</max-size-bytes>
-            <page-size-bytes>7126716262626</page-size-bytes>
+            <page-size-bytes>712671626</page-size-bytes>
             <page-max-cache-size>20</page-max-cache-size>
             <message-counter-history-day-limit>8</message-counter-history-day-limit>
          </address-setting>
diff --git a/artemis-server/src/test/resources/InvalidConfigurationTest4.xml b/artemis-server/src/test/resources/InvalidConfigurationTest4.xml
index e6feced..ae98081 100644
--- a/artemis-server/src/test/resources/InvalidConfigurationTest4.xml
+++ b/artemis-server/src/test/resources/InvalidConfigurationTest4.xml
@@ -212,7 +212,7 @@
             <expiry-address>a1.2</expiry-address>
             <redelivery-delay>1</redelivery-delay>
             <max-size-bytes>81781728121878</max-size-bytes>
-            <page-size-bytes>81738173872337</page-size-bytes>
+            <page-size-bytes>817381738</page-size-bytes>
             <page-max-cache-size>10</page-max-cache-size>
             <message-counter-history-day-limit>4</message-counter-history-day-limit>
          </address-setting>
@@ -221,7 +221,7 @@
             <expiry-address>a2.2</expiry-address>
             <redelivery-delay>5</redelivery-delay>
             <max-size-bytes>932489234928324</max-size-bytes>
-            <page-size-bytes>7126716262626</page-size-bytes>
+            <page-size-bytes>712671626</page-size-bytes>
             <page-max-cache-size>20</page-max-cache-size>
             <message-counter-history-day-limit>8</message-counter-history-day-limit>
          </address-setting>
diff --git a/artemis-server/src/test/resources/InvalidConfigurationTest5.xml b/artemis-server/src/test/resources/InvalidConfigurationTest5.xml
index 1b4dc9c..80e40f3 100644
--- a/artemis-server/src/test/resources/InvalidConfigurationTest5.xml
+++ b/artemis-server/src/test/resources/InvalidConfigurationTest5.xml
@@ -215,7 +215,7 @@
             <expiry-address>a1.2</expiry-address>
             <redelivery-delay>1</redelivery-delay>
             <max-size-bytes>81781728121878</max-size-bytes>
-            <page-size-bytes>81738173872337</page-size-bytes>
+            <page-size-bytes>817381738</page-size-bytes>
             <page-max-cache-size>10</page-max-cache-size>
             <message-counter-history-day-limit>4</message-counter-history-day-limit>
          </address-setting>
@@ -224,7 +224,7 @@
             <expiry-address>a2.2</expiry-address>
             <redelivery-delay>5</redelivery-delay>
             <max-size-bytes>932489234928324</max-size-bytes>
-            <page-size-bytes>7126716262626</page-size-bytes>
+            <page-size-bytes>712671626</page-size-bytes>
             <page-max-cache-size>20</page-max-cache-size>
             <message-counter-history-day-limit>8</message-counter-history-day-limit>
          </address-setting>
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpBridgeClusterRedistributionTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpBridgeClusterRedistributionTest.java
index 3365723..56b9c37 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpBridgeClusterRedistributionTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpBridgeClusterRedistributionTest.java
@@ -83,7 +83,7 @@ public class AmqpBridgeClusterRedistributionTest extends AmqpClientTestSupport
{
    @Override
    protected ActiveMQServer createServer(final boolean realFiles,
                                          final Configuration configuration,
-                                         final long pageSize,
+                                         final int pageSize,
                                          final long maxAddressSize,
                                          final Map<String, AddressSettings> settings)
{
       ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(configuration,
realFiles));
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ExclusiveDivertWithClusterTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ExclusiveDivertWithClusterTest.java
index f033128..095b017 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ExclusiveDivertWithClusterTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ExclusiveDivertWithClusterTest.java
@@ -45,7 +45,7 @@ public class ExclusiveDivertWithClusterTest extends ClusterTestBase {
    @Override
    protected ActiveMQServer createServer(final boolean realFiles,
                                          final Configuration configuration,
-                                         final long pageSize,
+                                         final int pageSize,
                                          final long maxAddressSize,
                                          final Map<String, AddressSettings> settings)
{
       DivertConfiguration divertConf = new DivertConfiguration().setName("notifications-divert").setAddress("*.Provider.*.Agent.*.Status").setForwardingAddress("Notifications").setExclusive(true);
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/GlobalPagingTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/GlobalPagingTest.java
index 870bb14..698d392 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/GlobalPagingTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/GlobalPagingTest.java
@@ -70,7 +70,7 @@ public class GlobalPagingTest extends PagingTest {
    @Override
    protected ActiveMQServer createServer(final boolean realFiles,
                                          final Configuration configuration,
-                                         final long pageSize,
+                                         final int pageSize,
                                          final long maxAddressSize,
                                          final Map<String, AddressSettings> settings)
{
       ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(configuration,
realFiles));
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/OpenwirePluginTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/OpenwirePluginTest.java
index d0206a7..425bac8 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/OpenwirePluginTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/OpenwirePluginTest.java
@@ -75,7 +75,7 @@ public class OpenwirePluginTest extends BasicOpenWireTest {
    private final MethodCalledVerifier verifier = new MethodCalledVerifier(methodCalls);
 
    @Override
-   protected ActiveMQServer createServer(boolean realFiles, Configuration configuration,
long pageSize,
+   protected ActiveMQServer createServer(boolean realFiles, Configuration configuration,
int pageSize,
                                          long maxAddressSize, Map<String, AddressSettings>
settings) {
       ActiveMQServer server = super.createServer(realFiles, configuration, pageSize, maxAddressSize,
settings);
       server.registerBrokerPlugin(verifier);
diff --git a/tests/performance-tests/src/test/java/org/apache/activemq/artemis/tests/performance/storage/PersistMultiThreadTest.java
b/tests/performance-tests/src/test/java/org/apache/activemq/artemis/tests/performance/storage/PersistMultiThreadTest.java
index 420c278..30aa4c3 100644
--- a/tests/performance-tests/src/test/java/org/apache/activemq/artemis/tests/performance/storage/PersistMultiThreadTest.java
+++ b/tests/performance-tests/src/test/java/org/apache/activemq/artemis/tests/performance/storage/PersistMultiThreadTest.java
@@ -303,7 +303,7 @@ public class PersistMultiThreadTest extends ActiveMQTestBase {
       }
 
       @Override
-      public long getPageSizeBytes() {
+      public int getPageSizeBytes() {
          return 0;
       }
 


Mime
View raw message