Skip to content
Snippets Groups Projects
Commit dd922cc8 authored by Clemens Klein-Robbenhaar's avatar Clemens Klein-Robbenhaar
Browse files

Revert "XWIKI-15163: xwiki.properties do not split list valued properties if read from /etc/xwiki"

This reverts commit de4385dc.
because new system property needs more discussion
parent 6530d1b0
No related branches found
No related tags found
No related merge requests found
......@@ -53,8 +53,6 @@ public class XWikiPropertiesConfigurationSource extends CommonsConfigurationSour
private static final String XWIKI_PROPERTIES_WARPATH = "/WEB-INF/" + XWIKI_PROPERTIES_FILE;
private static final String XWIKI_PROPERTIES_DEFAULT_DIR_SYSTEM_PROPERTY = "xwiki.properties.default.dir";
/**
* the Environment from where to get the XWiki properties file.
*/
......@@ -75,9 +73,8 @@ public void initialize() throws InitializationException
private Configuration loadConfiguration()
{
String defaultDir = System.getProperty(XWIKI_PROPERTIES_DEFAULT_DIR_SYSTEM_PROPERTY, "/etc/xwiki");
// Looking for /etc/xwiki/xwiki.properties first
File file = new File(defaultDir, XWIKI_PROPERTIES_FILE);
File file = new File("/etc/xwiki/" + XWIKI_PROPERTIES_FILE);
if (file.exists()) {
try {
this.logger.info("loading {} from default location {}", XWIKI_PROPERTIES_FILE, file.getCanonicalPath());
......
......@@ -19,11 +19,9 @@
*/
package org.xwiki.configuration.internal;
import java.io.File;
import java.util.Arrays;
import java.util.Properties;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
......@@ -59,8 +57,6 @@ public void before() throws ComponentLookupException
@Test
public void testInitializeWhenNoPropertiesFile() throws Exception
{
System.setProperty("xwiki.properties.default.dir", "/does/not/exist");
// Verifies that we can get a property from the source (i.e. that it's correctly initialized)
this.mocker.getComponentUnderTest().getProperty("key");
......@@ -80,33 +76,4 @@ public void testListParsing() throws ComponentLookupException
Properties properties = this.mocker.getComponentUnderTest().getProperty("propertiesProperty", Properties.class);
assertEquals("value1", properties.get("prop1"));
}
private Properties systemPropertiesBackup;
@Before
public void saveSystemProperties()
{
systemPropertiesBackup = new Properties(System.getProperties());
}
@After
public void restoreSystemProperties()
{
System.setProperties(systemPropertiesBackup);
}
@Test
public void testListParsingDefaultProperties() throws ComponentLookupException
{
String propertyFile = getClass().getResource("/xwiki.properties").getFile();
String propertyDir = new File(propertyFile).getParent();
System.setProperty("xwiki.properties.default.dir", propertyDir);
assertEquals(Arrays.asList("value1", "value2"),
this.mocker.getComponentUnderTest().getProperty("listProperty"));
Properties properties = this.mocker.getComponentUnderTest().getProperty("propertiesProperty", Properties.class);
assertEquals("value1", properties.get("prop1"));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment