You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2019/09/27 19:29:57 UTC

[activemq-artemis] branch master updated: ARTEMIS-2505: Fix wiring of the max-size-bytes-reject-threshold address-setting

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

clebertsuconic 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 4e0b209  ARTEMIS-2505: Fix wiring of the max-size-bytes-reject-threshold address-setting
     new 4526695  This closes #2852
4e0b209 is described below

commit 4e0b209128f1fa1f1a555266cd4256a14808d447
Author: Keith Wall <kw...@apache.org>
AuthorDate: Wed Sep 25 14:41:48 2019 +0100

    ARTEMIS-2505: Fix wiring of the max-size-bytes-reject-threshold address-setting
---
 .../core/deployers/impl/FileConfigurationParser.java  |  4 ++++
 .../core/config/impl/FileConfigurationParserTest.java | 19 +++++++++++++++++++
 2 files changed, 23 insertions(+)

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 2b4b481..a2e42d2 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
@@ -174,6 +174,8 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
 
    private static final String MAX_SIZE_BYTES_NODE_NAME = "max-size-bytes";
 
+   private static final String MAX_SIZE_BYTES_REJECT_THRESHOLD_NODE_NAME = "max-size-bytes-reject-threshold";
+
    private static final String ADDRESS_FULL_MESSAGE_POLICY_NODE_NAME = "address-full-policy";
 
    private static final String PAGE_SIZE_BYTES_NODE_NAME = "page-size-bytes";
@@ -1058,6 +1060,8 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
             addressSettings.setMaxRedeliveryDelay(XMLUtil.parseLong(child));
          } else if (MAX_SIZE_BYTES_NODE_NAME.equalsIgnoreCase(name)) {
             addressSettings.setMaxSizeBytes(ByteUtil.convertTextBytes(getTrimmedTextContent(child)));
+         } else if (MAX_SIZE_BYTES_REJECT_THRESHOLD_NODE_NAME.equalsIgnoreCase(name)) {
+            addressSettings.setMaxSizeBytesRejectThreshold(ByteUtil.convertTextBytes(getTrimmedTextContent(child)));
          } else if (PAGE_SIZE_BYTES_NODE_NAME.equalsIgnoreCase(name)) {
             long pageSizeLong = ByteUtil.convertTextBytes(getTrimmedTextContent(child));
             Validators.POSITIVE_INT.validate(PAGE_SIZE_BYTES_NODE_NAME, pageSizeLong);
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 6e41d1c..2b943d4 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
@@ -34,6 +34,7 @@ import org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration;
 import org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration;
 import org.apache.activemq.artemis.core.deployers.impl.FileConfigurationParser;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
+import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.apache.activemq.artemis.utils.DefaultSensitiveStringCodec;
 import org.apache.activemq.artemis.utils.PasswordMaskingUtil;
@@ -332,6 +333,24 @@ public class FileConfigurationParserTest extends ActiveMQTestBase {
            "            </bridge>\n" +
            "</bridges>\n";
 
+   @Test
+   public void testParsingAddressSettings() throws Exception {
+      long expected = 2147483648L;
+      String firstPartWithoutAS = firstPart.substring(0, firstPart.indexOf("<address-settings"));
+      String configStr = firstPartWithoutAS + ("<address-settings>\n"
+                                               + "<address-setting match=\"#\">\n"
+                                               + String.format("<max-size-bytes-reject-threshold>%d</max-size-bytes-reject-threshold>\n",
+                                                               expected)
+                                               + "</address-setting>\n"
+                                               + "</address-settings>"
+                                               + "\n") + lastPart;
+      ByteArrayInputStream input = new ByteArrayInputStream(configStr.getBytes(StandardCharsets.UTF_8));
+      Configuration configuration = new FileConfigurationParser().parseMainConfig(input);
+      assertEquals(1, configuration.getAddressesSettings().size());
+      AddressSettings addressSettings = configuration.getAddressesSettings().get("#");
+      assertEquals(expected, addressSettings.getMaxSizeBytesRejectThreshold());
+   }
+
    private static String firstPart = "<core xmlns=\"urn:activemq:core\">" + "\n" +
       "<name>ActiveMQ.main.config</name>" + "\n" +
       "<log-delegate-factory-class-name>org.apache.activemq.artemis.integration.logging.Log4jLogDelegateFactory</log-delegate-factory-class-name>" + "\n" +