ARTEMIS-2516 support sys props in xinclude href

This commit is contained in:
Justin Bertram 2019-10-10 09:04:05 -05:00 committed by Clebert Suconic
parent faed83432c
commit 9e9c0778b1
3 changed files with 26 additions and 5 deletions

View File

@ -81,7 +81,7 @@ public final class XMLUtil {
factory.setNamespaceAware(true);
factory.setXIncludeAware(true);
DocumentBuilder parser = factory.newDocumentBuilder();
Document doc = replaceSystemPropsInXml(parser.parse(new InputSource(r)));
Document doc = replaceSystemPropsInXml(parser.parse(new InputSource(new StringReader(replaceSystemPropsInString(readerToString(r))))));
return doc.getDocumentElement();
}

View File

@ -16,8 +16,29 @@
*/
package org.apache.activemq.artemis.core.config.impl;
import org.junit.AfterClass;
import org.junit.BeforeClass;
public class FileXIncludeConfigurationTest extends FileConfigurationTest {
@BeforeClass
public static void setupProperties() {
System.setProperty("xincludePath", "./src/test/resources");
System.setProperty("a2Prop", "a2");
System.setProperty("falseProp", "false");
System.setProperty("trueProp", "true");
System.setProperty("ninetyTwoProp", "92");
}
@AfterClass
public static void clearProperties() {
System.clearProperty("xincludePath");
System.clearProperty("a2Prop");
System.clearProperty("falseProp");
System.clearProperty("trueProp");
System.clearProperty("ninetyTwoProp");
}
@Override
protected String getConfigurationName() {
return "ConfigurationTest-xinclude-config.xml";

View File

@ -78,7 +78,7 @@
<connector name="connector2">vm://5</connector>
</connectors>
<xi:include href="./src/test/resources/ConfigurationTest-xinclude-config-acceptors.xml"/>
<xi:include href="${xincludePath}/ConfigurationTest-xinclude-config-acceptors.xml"/>
<broadcast-groups>
<broadcast-group name="bg1">
@ -284,9 +284,9 @@
<network-check-ping-command>ping-four</network-check-ping-command>
<network-check-ping6-command>ping-six</network-check-ping6-command>
<xi:include href="./src/test/resources/ConfigurationTest-xinclude-config-security-settings.xml"/>
<xi:include href="${xincludePath}/ConfigurationTest-xinclude-config-security-settings.xml"/>
<xi:include href="./src/test/resources/ConfigurationTest-xinclude-config-address-settings.xml"/>
<xi:include href="${xincludePath}/ConfigurationTest-xinclude-config-address-settings.xml"/>
<resource-limit-settings>
<resource-limit-setting match="myUser">
@ -300,6 +300,6 @@
</connector-service>
</connector-services>
<xi:include href="./src/test/resources/ConfigurationTest-xinclude-config-addresses.xml"/>
<xi:include href="${xincludePath}/ConfigurationTest-xinclude-config-addresses.xml"/>
</core>
</configuration>