[exo-jcr-commits] exo-jcr SVN: r3237 - in kernel/branches/2.2.x/exo.kernel.container/src: test/java/org/exoplatform/container/configuration and 1 other directory.
do-not-reply at jboss.org
do-not-reply at jboss.org
Mon Oct 4 10:39:54 EDT 2010
Author: sergiykarpenko
Date: 2010-10-04 10:39:54 -0400 (Mon, 04 Oct 2010)
New Revision: 3237
Modified:
kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/StandaloneContainer.java
kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestConfigurationManagerImpl.java
Log:
JCR-1466: StandaloneContainer.initConfigurationURL fixed
Modified: kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/StandaloneContainer.java
===================================================================
--- kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/StandaloneContainer.java 2010-10-04 14:01:54 UTC (rev 3236)
+++ kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/StandaloneContainer.java 2010-10-04 14:39:54 UTC (rev 3237)
@@ -332,12 +332,13 @@
J2EEServerInfo env = new J2EEServerInfo();
// (2) exo-configuration.xml in AS (standalone) home directory
- configurationURL = new URL("file:" + env.getServerHome() + "/exo-configuration.xml");
+ configurationURL = (new File(env.getServerHome() + "/exo-configuration.xml")).toURI().toURL();
// (3) AS_HOME/conf/exo-conf (JBossAS usecase)
if (!fileExists(configurationURL))
{
- configurationURL = new URL("file:" + env.getExoConfigurationDirectory() + "/exo-configuration.xml");
+ configurationURL =
+ (new File(env.getExoConfigurationDirectory() + "/exo-configuration.xml")).toURI().toURL();
}
// (4) conf/exo-configuration.xml in war/ear(?)
Modified: kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestConfigurationManagerImpl.java
===================================================================
--- kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestConfigurationManagerImpl.java 2010-10-04 14:01:54 UTC (rev 3236)
+++ kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestConfigurationManagerImpl.java 2010-10-04 14:39:54 UTC (rev 3237)
@@ -198,7 +198,33 @@
url = cm3.getURL("configuration\\empty-config-fake.xml");
checkURL(url, true);
}
+
+ public void testGetFileURL() throws Exception
+ {
+ // Empty CM
+ ConfigurationManager cm = new ConfigurationManagerImpl();
+ URL url = cm.getURL(null);
+ assertNull(url);
+ url = cm.getURL("file:F:\\somepath\\path\\configuration.xml");
+ assertEquals("file:/F:/somepath/path/configuration.xml", url.toString());
+ //make context configuration starting fith "file:D:..."
+ try
+ {
+ cm.addConfiguration("file:D:\\somepath\\config.xml");
+ }
+ catch (Exception e)
+ {
+ // thats is ok, because such config does not exists,
+ // but ConfigurationManagerInmp.contextPath going to be initialized
+ // thats all we need to reproduce bug.
+ }
+
+ // now lets check relative url
+ url = cm.getURL("configuration.xml");
+ assertEquals("file:/D:/somepath/configuration.xml", url.toString());
+ }
+
private void checkURL(URL url) throws Exception
{
checkURL(url, false);
More information about the exo-jcr-commits
mailing list