ARTEMIS-2505: Fix wiring of the max-size-bytes-reject-threshold address-setting
This commit is contained in:
parent
4925040e4d
commit
4e0b209128
|
@ -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);
|
||||
|
|
|
@ -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" +
|
||||
|
|
Loading…
Reference in New Issue