From 73bdbad8b44b1da772e870168138f42256970379 Mon Sep 17 00:00:00 2001 From: Justin Bertram Date: Wed, 24 Apr 2019 14:17:50 -0500 Subject: [PATCH] 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. --- .../activemq/artemis/utils/XMLUtil.java | 54 ++++++++++----- .../activemq/artemis/util/XMLUtilTest.java | 2 +- .../jms/server/impl/JMSServerManagerImpl.java | 11 +-- .../artemis/rest/MessageServiceManager.java | 2 +- .../core/config/FileDeploymentManager.java | 29 +++----- .../config/impl/LegacyJMSConfiguration.java | 7 +- .../impl/FileConfigurationParser.java | 18 ++--- .../impl/journal/DescribeJournal.java | 69 +++++++------------ .../config/impl/FileConfigurationTest.java | 20 ++++++ .../ConfigurationTest-full-config.xml | 14 ++-- ...gurationTest-xinclude-config-acceptors.xml | 20 ++++++ ...gurationTest-xinclude-config-addresses.xml | 10 +-- ...Test-xinclude-config-security-settings.xml | 2 +- .../ConfigurationTest-xinclude-config.xml | 7 +- .../impl/ConfigurationValidationTest.java | 7 ++ 15 files changed, 148 insertions(+), 124 deletions(-) create mode 100644 artemis-server/src/test/resources/ConfigurationTest-xinclude-config-acceptors.xml diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/XMLUtil.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/XMLUtil.java index 49d290cc58..c45b62dec2 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/XMLUtil.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/XMLUtil.java @@ -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(); diff --git a/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/XMLUtilTest.java b/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/XMLUtilTest.java index c7dcdaf137..6a19622c2e 100644 --- a/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/XMLUtilTest.java +++ b/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/XMLUtilTest.java @@ -214,7 +214,7 @@ public class XMLUtilTest extends SilentTestCase { String after = "\n" + " content1\n" + " content2\n" + " content3\n" + " content4\n" + " content5\n" + " content6\n" + ""; System.setProperty("sysprop1", "test1"); System.setProperty("sysprop2", "content4"); - String replaced = XMLUtil.replaceSystemProps(before); + String replaced = XMLUtil.replaceSystemPropsInString(before); Assert.assertEquals(after, replaced); } diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java index 2beb9feef1..a05ed27de1 100644 --- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java +++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java @@ -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"); diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/MessageServiceManager.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/MessageServiceManager.java index 4fd8c9c27a..f6e6a09f37 100644 --- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/MessageServiceManager.java +++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/MessageServiceManager.java @@ -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)); } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/FileDeploymentManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/FileDeploymentManager.java index 3607e75c0a..861047d54f 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/FileDeploymentManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/FileDeploymentManager.java @@ -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); } } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/LegacyJMSConfiguration.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/LegacyJMSConfiguration.java index dc50917bd6..0a9b6e5b76 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/LegacyJMSConfiguration.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/LegacyJMSConfiguration.java @@ -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 NodeList children = e.getElementsByTagName(CONFIGURATION_SCHEMA_ROOT_ELEMENT); if (children.getLength() > 0) { 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 30a3ab0a89..637e3ac7de 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 @@ -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(); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/DescribeJournal.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/DescribeJournal.java index d21d38a944..0723d70cc8 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/DescribeJournal.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/DescribeJournal.java @@ -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. *

@@ -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(); 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 79ea2d4ef9..3ca145d50a 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 @@ -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"; } diff --git a/artemis-server/src/test/resources/ConfigurationTest-full-config.xml b/artemis-server/src/test/resources/ConfigurationTest-full-config.xml index 930e70baab..d27e7f4288 100644 --- a/artemis-server/src/test/resources/ConfigurationTest-full-config.xml +++ b/artemis-server/src/test/resources/ConfigurationTest-full-config.xml @@ -84,7 +84,7 @@ tcp://0.0.0.0:61616? tcpNoDelay=456; connectionTtl=44; - connectionsAllowed=92 + connectionsAllowed=${ninetyTwoProp} vm://0?e1=z1;e2=567;connectionsAllowed=87 @@ -364,7 +364,7 @@ - + @@ -438,11 +438,11 @@

- false + ${falseProp} - - true + + ${trueProp} @@ -452,8 +452,8 @@ - - true + + ${trueProp}
diff --git a/artemis-server/src/test/resources/ConfigurationTest-xinclude-config-acceptors.xml b/artemis-server/src/test/resources/ConfigurationTest-xinclude-config-acceptors.xml new file mode 100644 index 0000000000..9ebad5712f --- /dev/null +++ b/artemis-server/src/test/resources/ConfigurationTest-xinclude-config-acceptors.xml @@ -0,0 +1,20 @@ + + + tcp://0.0.0.0:61616?tcpNoDelay=456;connectionTtl=44;connectionsAllowed=${ninetyTwoProp} + vm://0?e1=z1;e2=567;connectionsAllowed=87 + \ No newline at end of file diff --git a/artemis-server/src/test/resources/ConfigurationTest-xinclude-config-addresses.xml b/artemis-server/src/test/resources/ConfigurationTest-xinclude-config-addresses.xml index 377b048431..530695ec81 100644 --- a/artemis-server/src/test/resources/ConfigurationTest-xinclude-config-addresses.xml +++ b/artemis-server/src/test/resources/ConfigurationTest-xinclude-config-addresses.xml @@ -18,11 +18,11 @@
- false + ${falseProp} - - true + + ${trueProp} @@ -32,8 +32,8 @@ - - true + + ${trueProp}
diff --git a/artemis-server/src/test/resources/ConfigurationTest-xinclude-config-security-settings.xml b/artemis-server/src/test/resources/ConfigurationTest-xinclude-config-security-settings.xml index e22784c986..38076ab345 100644 --- a/artemis-server/src/test/resources/ConfigurationTest-xinclude-config-security-settings.xml +++ b/artemis-server/src/test/resources/ConfigurationTest-xinclude-config-security-settings.xml @@ -18,7 +18,7 @@ - + \ No newline at end of file diff --git a/artemis-server/src/test/resources/ConfigurationTest-xinclude-config.xml b/artemis-server/src/test/resources/ConfigurationTest-xinclude-config.xml index c99b4ebe28..bd647d61d1 100644 --- a/artemis-server/src/test/resources/ConfigurationTest-xinclude-config.xml +++ b/artemis-server/src/test/resources/ConfigurationTest-xinclude-config.xml @@ -76,10 +76,9 @@ tcp://localhost1:5678?localAddress=mylocal;localPort=99 vm://5 - - tcp://0.0.0.0:61616?tcpNoDelay=456;connectionTtl=44;connectionsAllowed=92 - vm://0?e1=z1;e2=567;connectionsAllowed=87 - + + + 10999 diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/config/impl/ConfigurationValidationTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/config/impl/ConfigurationValidationTest.java index c6b7c1603e..e7420baf89 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/config/impl/ConfigurationValidationTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/config/impl/ConfigurationValidationTest.java @@ -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 ----------------------------------------------------