ARTEMIS-2310 support system prop sub in xincludes
Historically the broker has read the XML configuration file as a String, substituted system properties, and then parsed that String into an XML document. However, this method won't substitute system properties in the files which are imported via xinclude. In order to substitue system properties in xincluded files the substitution needs to be performed after the file is parsed into an XML document. This commit implements that change and refactors the XMLUtil class a bit to eliminate redundant code, obsolete comments, etc.
This commit is contained in:
parent
31348621cd
commit
73bdbad8b4
|
@ -23,6 +23,7 @@ import javax.xml.transform.dom.DOMSource;
|
|||
import javax.xml.validation.Schema;
|
||||
import javax.xml.validation.SchemaFactory;
|
||||
import javax.xml.validation.Validator;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
|
@ -51,12 +52,18 @@ public final class XMLUtil {
|
|||
// Utility class
|
||||
}
|
||||
|
||||
public static Element streamToElement(InputStream inputStream) throws Exception {
|
||||
try (Reader reader = new InputStreamReader(inputStream)) {
|
||||
return XMLUtil.readerToElement(reader);
|
||||
}
|
||||
}
|
||||
|
||||
public static Element stringToElement(final String s) throws Exception {
|
||||
return XMLUtil.readerToElement(new StringReader(s));
|
||||
}
|
||||
|
||||
public static Element urlToElement(final URL url) throws Exception {
|
||||
return XMLUtil.readerToElement(new InputStreamReader(url.openStream()));
|
||||
return XMLUtil.streamToElement(url.openStream());
|
||||
}
|
||||
|
||||
public static String readerToString(final Reader r) throws Exception {
|
||||
|
@ -70,24 +77,11 @@ public final class XMLUtil {
|
|||
}
|
||||
|
||||
public static Element readerToElement(final Reader r) throws Exception {
|
||||
// Read into string
|
||||
StringBuffer buff = new StringBuffer();
|
||||
int c;
|
||||
while ((c = r.read()) != -1) {
|
||||
buff.append((char) c);
|
||||
}
|
||||
|
||||
// Quick hardcoded replace, FIXME this is a kludge - use regexp to match properly
|
||||
String s = buff.toString();
|
||||
|
||||
StringReader sreader = new StringReader(s);
|
||||
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
// see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6529766
|
||||
factory.setNamespaceAware(true);
|
||||
factory.setXIncludeAware(true);
|
||||
DocumentBuilder parser = factory.newDocumentBuilder();
|
||||
Document doc = parser.parse(new InputSource(sreader));
|
||||
Document doc = replaceSystemPropsInXml(parser.parse(new InputSource(r)));
|
||||
return doc.getDocumentElement();
|
||||
}
|
||||
|
||||
|
@ -257,7 +251,8 @@ public final class XMLUtil {
|
|||
}
|
||||
return s;
|
||||
}
|
||||
public static String replaceSystemProps(String xml) {
|
||||
|
||||
public static String replaceSystemPropsInString(String xml) {
|
||||
while (xml.contains("${")) {
|
||||
int start = xml.indexOf("${");
|
||||
int end = xml.indexOf("}") + 1;
|
||||
|
@ -280,6 +275,33 @@ public final class XMLUtil {
|
|||
return xml;
|
||||
}
|
||||
|
||||
public static Document replaceSystemPropsInXml(Document doc) {
|
||||
NodeList nodeList = doc.getElementsByTagName("*");
|
||||
for (int i = 0, len = nodeList.getLength(); i < len; i++) {
|
||||
Node node = nodeList.item(i);
|
||||
if (node != null && node.getNodeType() == Node.ELEMENT_NODE) {
|
||||
if (node.hasAttributes()) {
|
||||
NamedNodeMap attributes = node.getAttributes();
|
||||
for (int j = 0; j < attributes.getLength(); j++) {
|
||||
Node attribute = attributes.item(j);
|
||||
attribute.setTextContent(XMLUtil.replaceSystemPropsInString(attribute.getTextContent()));
|
||||
}
|
||||
}
|
||||
if (node.hasChildNodes()) {
|
||||
NodeList children = node.getChildNodes();
|
||||
for (int j = 0; j < children.getLength(); j++) {
|
||||
String value = children.item(j).getNodeValue();
|
||||
if (value != null) {
|
||||
children.item(j).setNodeValue(XMLUtil.replaceSystemPropsInString(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return doc;
|
||||
}
|
||||
|
||||
public static long parseLong(final Node elem) {
|
||||
String value = elem.getTextContent().trim();
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@ public class XMLUtilTest extends SilentTestCase {
|
|||
String after = "<configuration>\n" + " <test name=\"test1\">content1</test>\n" + " <test name=\"test2\">content2</test>\n" + " <test name=\"test3\">content3</test>\n" + " <test name=\"test4\">content4</test>\n" + " <test name=\"test5\">content5</test>\n" + " <test name=\"test6\">content6</test>\n" + "</configuration>";
|
||||
System.setProperty("sysprop1", "test1");
|
||||
System.setProperty("sysprop2", "content4");
|
||||
String replaced = XMLUtil.replaceSystemProps(before);
|
||||
String replaced = XMLUtil.replaceSystemPropsInString(before);
|
||||
Assert.assertEquals(after, replaced);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,9 +17,6 @@
|
|||
package org.apache.activemq.artemis.jms.server.impl;
|
||||
|
||||
import javax.naming.NamingException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.net.InetAddress;
|
||||
import java.net.URL;
|
||||
import java.net.UnknownHostException;
|
||||
|
@ -1632,13 +1629,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
|
|||
public void reload(URL url) throws Exception {
|
||||
ActiveMQServerLogger.LOGGER.reloadingConfiguration("jms");
|
||||
|
||||
InputStream input = url.openStream();
|
||||
String xml;
|
||||
try (Reader reader = new InputStreamReader(input)) {
|
||||
xml = XMLUtil.readerToString(reader);
|
||||
}
|
||||
xml = XMLUtil.replaceSystemProps(xml);
|
||||
Element e = XMLUtil.stringToElement(xml);
|
||||
Element e = XMLUtil.urlToElement(url);
|
||||
|
||||
if (config instanceof FileJMSConfiguration) {
|
||||
NodeList children = e.getElementsByTagName("jms");
|
||||
|
|
|
@ -124,7 +124,7 @@ public class MessageServiceManager {
|
|||
JAXBContext jaxb = JAXBContext.newInstance(MessageServiceConfiguration.class);
|
||||
try (Reader reader = new InputStreamReader(url.openStream())) {
|
||||
String xml = XMLUtil.readerToString(reader);
|
||||
xml = XMLUtil.replaceSystemProps(xml);
|
||||
xml = XMLUtil.replaceSystemPropsInString(xml);
|
||||
configuration = (MessageServiceConfiguration) jaxb.createUnmarshaller().unmarshal(new StringReader(xml));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
package org.apache.activemq.artemis.core.config;
|
||||
|
||||
import javax.management.MBeanServer;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
|
@ -68,23 +66,18 @@ public class FileDeploymentManager {
|
|||
// The URL is outside of the classloader. Trying a pure url now
|
||||
url = new URL(configurationUrl);
|
||||
}
|
||||
// create a reader
|
||||
try (Reader reader = new InputStreamReader(url.openStream())) {
|
||||
String xml = XMLUtil.readerToString(reader);
|
||||
//replace any system props
|
||||
xml = XMLUtil.replaceSystemProps(xml);
|
||||
Element e = XMLUtil.stringToElement(xml);
|
||||
|
||||
//iterate around all the deployables
|
||||
for (Deployable deployable : deployables.values()) {
|
||||
String root = deployable.getRootElement();
|
||||
NodeList children = e.getElementsByTagName(root);
|
||||
//if the root element exists then parse it
|
||||
if (root != null && children.getLength() > 0) {
|
||||
Node item = children.item(0);
|
||||
XMLUtil.validate(item, deployable.getSchema());
|
||||
deployable.parse((Element) item, url);
|
||||
}
|
||||
Element e = XMLUtil.urlToElement(url);
|
||||
|
||||
//iterate around all the deployables
|
||||
for (Deployable deployable : deployables.values()) {
|
||||
String root = deployable.getRootElement();
|
||||
NodeList children = e.getElementsByTagName(root);
|
||||
//if the root element exists then parse it
|
||||
if (root != null && children.getLength() > 0) {
|
||||
Node item = children.item(0);
|
||||
XMLUtil.validate(item, deployable.getSchema());
|
||||
deployable.parse((Element) item, url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,8 +18,6 @@ package org.apache.activemq.artemis.core.config.impl;
|
|||
|
||||
import javax.management.MBeanServer;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.net.URL;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -102,10 +100,7 @@ public class LegacyJMSConfiguration implements Deployable {
|
|||
|
||||
|
||||
public void parseConfiguration(final InputStream input) throws Exception {
|
||||
Reader reader = new InputStreamReader(input);
|
||||
String xml = XMLUtil.readerToString(reader);
|
||||
xml = XMLUtil.replaceSystemProps(xml);
|
||||
Element e = XMLUtil.stringToElement(xml);
|
||||
Element e = XMLUtil.streamToElement(input);
|
||||
// only parse elements from <jms>
|
||||
NodeList children = e.getElementsByTagName(CONFIGURATION_SCHEMA_ROOT_ELEMENT);
|
||||
if (children.getLength() > 0) {
|
||||
|
|
|
@ -16,9 +16,12 @@
|
|||
*/
|
||||
package org.apache.activemq.artemis.core.deployers.impl;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.validation.Schema;
|
||||
import javax.xml.validation.SchemaFactory;
|
||||
import javax.xml.validation.Validator;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.ArrayList;
|
||||
|
@ -93,12 +96,6 @@ import org.w3c.dom.NamedNodeMap;
|
|||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.validation.Schema;
|
||||
import javax.xml.validation.SchemaFactory;
|
||||
import javax.xml.validation.Validator;
|
||||
|
||||
/**
|
||||
* Parses an XML document according to the {@literal artemis-configuration.xsd} schema.
|
||||
*/
|
||||
|
@ -286,10 +283,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
|
|||
}
|
||||
|
||||
public Configuration parseMainConfig(final InputStream input) throws Exception {
|
||||
Reader reader = new InputStreamReader(input);
|
||||
String xml = XMLUtil.readerToString(reader);
|
||||
xml = XMLUtil.replaceSystemProps(xml);
|
||||
Element e = XMLUtil.stringToElement(xml);
|
||||
Element e = XMLUtil.streamToElement(input);
|
||||
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
|
||||
Schema schema = schemaFactory.newSchema(XMLUtil.findResource("schema/artemis-server.xsd"));
|
||||
Validator validator = schema.newValidator();
|
||||
|
|
|
@ -16,42 +16,15 @@
|
|||
*/
|
||||
package org.apache.activemq.artemis.core.persistence.impl.journal;
|
||||
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.ACKNOWLEDGE_CURSOR;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.ACKNOWLEDGE_REF;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.ADDRESS_BINDING_RECORD;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.ADDRESS_SETTING_RECORD;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.ADD_LARGE_MESSAGE;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.ADD_LARGE_MESSAGE_PENDING;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.ADD_MESSAGE;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.ADD_MESSAGE_PROTOCOL;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.ADD_REF;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.DUPLICATE_ID;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.HEURISTIC_COMPLETION;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.ID_COUNTER_RECORD;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.PAGE_CURSOR_COMPLETE;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.PAGE_CURSOR_COUNTER_INC;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.PAGE_CURSOR_COUNTER_VALUE;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.PAGE_CURSOR_PENDING_COUNTER;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.PAGE_TRANSACTION;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.QUEUE_BINDING_RECORD;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.QUEUE_STATUS_RECORD;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.SECURITY_RECORD;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.SET_SCHEDULED_DELIVERY_TIME;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.UPDATE_DELIVERY_COUNT;
|
||||
|
||||
import javax.transaction.xa.Xid;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintStream;
|
||||
import java.io.Reader;
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.transaction.xa.Xid;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQBuffers;
|
||||
import org.apache.activemq.artemis.api.core.Message;
|
||||
|
@ -95,6 +68,29 @@ import org.w3c.dom.Element;
|
|||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.ACKNOWLEDGE_CURSOR;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.ACKNOWLEDGE_REF;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.ADDRESS_BINDING_RECORD;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.ADDRESS_SETTING_RECORD;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.ADD_LARGE_MESSAGE;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.ADD_LARGE_MESSAGE_PENDING;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.ADD_MESSAGE;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.ADD_MESSAGE_PROTOCOL;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.ADD_REF;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.DUPLICATE_ID;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.HEURISTIC_COMPLETION;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.ID_COUNTER_RECORD;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.PAGE_CURSOR_COMPLETE;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.PAGE_CURSOR_COUNTER_INC;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.PAGE_CURSOR_COUNTER_VALUE;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.PAGE_CURSOR_PENDING_COUNTER;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.PAGE_TRANSACTION;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.QUEUE_BINDING_RECORD;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.QUEUE_STATUS_RECORD;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.SECURITY_RECORD;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.SET_SCHEDULED_DELIVERY_TIME;
|
||||
import static org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds.UPDATE_DELIVERY_COUNT;
|
||||
|
||||
/**
|
||||
* Outputs a String description of the Journals contents.
|
||||
* <p>
|
||||
|
@ -113,15 +109,10 @@ public final class DescribeJournal {
|
|||
if (instanceFolder != null) {
|
||||
configuration = new FileConfiguration();
|
||||
File configFile = new File(instanceFolder + "/etc/broker.xml");
|
||||
URL url;
|
||||
Reader reader = null;
|
||||
|
||||
try {
|
||||
url = configFile.toURI().toURL();
|
||||
reader = new InputStreamReader(url.openStream());
|
||||
String xml = XMLUtil.readerToString(reader);
|
||||
xml = XMLUtil.replaceSystemProps(xml);
|
||||
Element e = XMLUtil.stringToElement(xml);
|
||||
URL url = configFile.toURI().toURL();
|
||||
Element e = XMLUtil.urlToElement(url);
|
||||
|
||||
String root = ((FileConfiguration) configuration).getRootElement();
|
||||
NodeList children = e.getElementsByTagName(root);
|
||||
|
@ -132,14 +123,6 @@ public final class DescribeJournal {
|
|||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("failed to load broker.xml", e);
|
||||
} finally {
|
||||
if (reader != null) {
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
configuration = new ConfigurationImpl();
|
||||
|
|
|
@ -59,11 +59,31 @@ import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancing
|
|||
import org.apache.activemq.artemis.core.server.impl.LegacyLDAPSecuritySettingPlugin;
|
||||
import org.apache.activemq.artemis.core.server.plugin.ActiveMQServerPlugin;
|
||||
import org.apache.activemq.artemis.core.settings.impl.SlowConsumerPolicy;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
public class FileConfigurationTest extends ConfigurationImplTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void setupProperties() {
|
||||
System.setProperty("a2Prop", "a2");
|
||||
System.setProperty("falseProp", "false");
|
||||
System.setProperty("trueProp", "true");
|
||||
System.setProperty("ninetyTwoProp", "92");
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void clearProperties() {
|
||||
System.clearProperty("a2Prop");
|
||||
System.clearProperty("falseProp");
|
||||
System.clearProperty("trueProp");
|
||||
System.clearProperty("ninetyTwoProp");
|
||||
}
|
||||
|
||||
|
||||
protected String getConfigurationName() {
|
||||
return "ConfigurationTest-full-config.xml";
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
tcp://0.0.0.0:61616?
|
||||
tcpNoDelay=456;
|
||||
connectionTtl=44;
|
||||
connectionsAllowed=92
|
||||
connectionsAllowed=${ninetyTwoProp}
|
||||
</acceptor>
|
||||
<acceptor>vm://0?e1=z1;e2=567;connectionsAllowed=87</acceptor>
|
||||
</acceptors>
|
||||
|
@ -364,7 +364,7 @@
|
|||
<security-setting match="a1">
|
||||
<permission type="createNonDurableQueue" roles="a1.1"/>
|
||||
</security-setting>
|
||||
<security-setting match="a2">
|
||||
<security-setting match="${a2Prop}">
|
||||
<permission type="deleteNonDurableQueue" roles="a2.1"/>
|
||||
</security-setting>
|
||||
</security-settings>
|
||||
|
@ -438,11 +438,11 @@
|
|||
<address name="addr1">
|
||||
<anycast>
|
||||
<queue name="q1">
|
||||
<durable>false</durable>
|
||||
<durable>${falseProp}</durable>
|
||||
<filter string="color='blue'"/>
|
||||
</queue>
|
||||
<queue name="q2" max-consumers="-1" purge-on-no-consumers="false">
|
||||
<durable>true</durable>
|
||||
<queue name="q2" max-consumers="-1" purge-on-no-consumers="${falseProp}">
|
||||
<durable>${trueProp}</durable>
|
||||
<filter string="color='green'"/>
|
||||
</queue>
|
||||
</anycast>
|
||||
|
@ -452,8 +452,8 @@
|
|||
<queue name="q3" max-consumers="10" >
|
||||
<filter string="color='red'"/>
|
||||
</queue>
|
||||
<queue name="q4" purge-on-no-consumers="true">
|
||||
<durable>true</durable>
|
||||
<queue name="q4" purge-on-no-consumers="${trueProp}">
|
||||
<durable>${trueProp}</durable>
|
||||
</queue>
|
||||
</multicast>
|
||||
</address>
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
<!--
|
||||
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
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<acceptors xmlns="urn:activemq:core">
|
||||
<acceptor>tcp://0.0.0.0:61616?tcpNoDelay=456;connectionTtl=44;connectionsAllowed=${ninetyTwoProp}</acceptor>
|
||||
<acceptor>vm://0?e1=z1;e2=567;connectionsAllowed=87</acceptor>
|
||||
</acceptors>
|
|
@ -18,11 +18,11 @@
|
|||
<address name="addr1">
|
||||
<anycast>
|
||||
<queue name="q1">
|
||||
<durable>false</durable>
|
||||
<durable>${falseProp}</durable>
|
||||
<filter string="color='blue'"/>
|
||||
</queue>
|
||||
<queue name="q2" max-consumers="-1" purge-on-no-consumers="false">
|
||||
<durable>true</durable>
|
||||
<queue name="q2" max-consumers="-1" purge-on-no-consumers="${falseProp}">
|
||||
<durable>${trueProp}</durable>
|
||||
<filter string="color='green'"/>
|
||||
</queue>
|
||||
</anycast>
|
||||
|
@ -32,8 +32,8 @@
|
|||
<queue name="q3" max-consumers="10" >
|
||||
<filter string="color='red'"/>
|
||||
</queue>
|
||||
<queue name="q4" purge-on-no-consumers="true">
|
||||
<durable>true</durable>
|
||||
<queue name="q4" purge-on-no-consumers="${trueProp}">
|
||||
<durable>${trueProp}</durable>
|
||||
</queue>
|
||||
</multicast>
|
||||
</address>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<security-setting match="a1">
|
||||
<permission type="createNonDurableQueue" roles="a1.1"/>
|
||||
</security-setting>
|
||||
<security-setting match="a2">
|
||||
<security-setting match="${a2Prop}">
|
||||
<permission type="deleteNonDurableQueue" roles="a2.1"/>
|
||||
</security-setting>
|
||||
</security-settings>
|
|
@ -76,10 +76,9 @@
|
|||
<connector name="connector1">tcp://localhost1:5678?localAddress=mylocal;localPort=99</connector>
|
||||
<connector name="connector2">vm://5</connector>
|
||||
</connectors>
|
||||
<acceptors>
|
||||
<acceptor>tcp://0.0.0.0:61616?tcpNoDelay=456;connectionTtl=44;connectionsAllowed=92</acceptor>
|
||||
<acceptor>vm://0?e1=z1;e2=567;connectionsAllowed=87</acceptor>
|
||||
</acceptors>
|
||||
|
||||
<xi:include href="./src/test/resources/ConfigurationTest-xinclude-config-acceptors.xml"/>
|
||||
|
||||
<broadcast-groups>
|
||||
<broadcast-group name="bg1">
|
||||
<local-bind-port>10999</local-bind-port>
|
||||
|
|
|
@ -26,6 +26,13 @@ import org.w3c.dom.Element;
|
|||
|
||||
public class ConfigurationValidationTest extends ActiveMQTestBase {
|
||||
|
||||
static {
|
||||
System.setProperty("a2Prop", "a2");
|
||||
System.setProperty("falseProp", "false");
|
||||
System.setProperty("trueProp", "true");
|
||||
System.setProperty("ninetyTwoProp", "92");
|
||||
}
|
||||
|
||||
// Constants -----------------------------------------------------
|
||||
|
||||
// Attributes ----------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue