You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by eb...@apache.org on 2004/10/18 14:50:42 UTC
cvs commit: jakarta-commons/configuration/conf testDigesterConfiguration3.xml
ebourg 2004/10/18 05:50:42
Modified: configuration/xdocs changes.xml index.xml
configuration/src/java/org/apache/commons/configuration
ConfigurationConverter.java
ConfigurationFactory.java ConfigurationMap.java
configuration/src/test/org/apache/commons/configuration
TestConfigurationFactory.java
configuration/conf testDigesterConfiguration3.xml
Added: configuration/src/java/org/apache/commons/configuration
MapConfiguration.java SystemConfiguration.java
configuration/src/test/org/apache/commons/configuration
TestMapConfiguration.java
TestSystemConfiguration.java
Log:
Added MapConfiguration and SystemConfiguration
Revision Changes Path
1.60 +13 -0 jakarta-commons/configuration/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/xdocs/changes.xml,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- changes.xml 18 Oct 2004 11:12:09 -0000 1.59
+++ changes.xml 18 Oct 2004 12:50:41 -0000 1.60
@@ -8,6 +8,19 @@
<body>
<release version="1.1-dev" date="in CVS">
+ <action dev="ebourg" type="add" issue="26066">
+ Added a SystemConfiguration wrapping the system properties.
+ ConfigurationFactory recognizes the corresponding <system/>
+ element.
+ </action>
+ <action dev="ebourg" type="add">
+ Added a MapConfiguration to turn any Map into a Configuration. The
+ getConfiguration() methods in ConfigurationConverter now use
+ MapConfiguration, as a result the Configuration returned is always
+ synchronized with the underlying Properties or ExtendedProperties,
+ changes made to the Configuration are available in the Properties,
+ and reciprocally.
+ </action>
<action dev="ebourg" type="add" issue="31532">
The "autoSave" feature of XMLConfiguration has been generalized
to all file based configurations.
1.7 +3 -0 jakarta-commons/configuration/xdocs/index.xml
Index: index.xml
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/xdocs/index.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- index.xml 24 Sep 2004 20:52:57 -0000 1.6
+++ index.xml 18 Oct 2004 12:50:41 -0000 1.7
@@ -32,6 +32,9 @@
<li>XML documents</li>
<li>JNDI</li>
<li>JDBC Datasource</li>
+ <li>System properties</li>
+ <li>Applet parameters</li>
+ <li>Servlet parameters</li>
</ul>
Different configuration sources can be mixed using a
1.8 +5 -25 jakarta-commons/configuration/src/java/org/apache/commons/configuration/ConfigurationConverter.java
Index: ConfigurationConverter.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/ConfigurationConverter.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ConfigurationConverter.java 12 Aug 2004 16:06:01 -0000 1.7
+++ ConfigurationConverter.java 18 Oct 2004 12:50:41 -0000 1.8
@@ -16,7 +16,6 @@
package org.apache.commons.configuration;
-import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -47,17 +46,7 @@
*/
public static Configuration getConfiguration(ExtendedProperties eprops)
{
- Configuration config = new BaseConfiguration();
-
- Iterator keys = eprops.getKeys();
-
- while (keys.hasNext())
- {
- String key = (String) keys.next();
- config.setProperty(key, eprops.getProperty(key));
- }
-
- return config;
+ return new MapConfiguration(eprops);
}
/**
@@ -68,17 +57,7 @@
*/
public static Configuration getConfiguration(Properties props)
{
- Configuration config = new BaseConfiguration();
-
- Enumeration keys = props.keys();
-
- while (keys.hasMoreElements())
- {
- String key = (String) keys.nextElement();
- config.setProperty(key, props.getProperty(key));
- }
-
- return config;
+ return new MapConfiguration(props);
}
/**
@@ -152,7 +131,8 @@
* @param config Configuration object to convert
* @return Map created from the Configuration
*/
- public static Map getMap(Configuration config) {
+ public static Map getMap(Configuration config)
+ {
return new ConfigurationMap(config);
}
1.17 +21 -5 jakarta-commons/configuration/src/java/org/apache/commons/configuration/ConfigurationFactory.java
Index: ConfigurationFactory.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/ConfigurationFactory.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- ConfigurationFactory.java 22 Sep 2004 17:17:30 -0000 1.16
+++ ConfigurationFactory.java 18 Oct 2004 12:50:41 -0000 1.17
@@ -298,6 +298,13 @@
new JNDIConfigurationFactory(),
null,
additional);
+
+ setupDigesterInstance(
+ digester,
+ matchString + "system",
+ new SystemConfigurationFactory(),
+ null,
+ additional);
}
/**
@@ -487,16 +494,25 @@
/**
* A tiny inner class that allows the Configuration Factory to
- * let the digester construct JNDIPathConfiguration objects.
+ * let the digester construct JNDIConfiguration objects.
*/
private class JNDIConfigurationFactory extends DigesterConfigurationFactory
{
- /**
- * C'tor
- */
public JNDIConfigurationFactory()
{
super(JNDIConfiguration.class);
+ }
+ }
+
+ /**
+ * A tiny inner class that allows the Configuration Factory to
+ * let the digester construct SystemConfiguration objects.
+ */
+ private class SystemConfigurationFactory extends DigesterConfigurationFactory
+ {
+ public SystemConfigurationFactory()
+ {
+ super(SystemConfiguration.class);
}
}
1.7 +7 -12 jakarta-commons/configuration/src/java/org/apache/commons/configuration/ConfigurationMap.java
Index: ConfigurationMap.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/ConfigurationMap.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ConfigurationMap.java 20 Sep 2004 18:59:15 -0000 1.6
+++ ConfigurationMap.java 18 Oct 2004 12:50:41 -0000 1.7
@@ -1,5 +1,5 @@
/*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
@@ -22,7 +22,6 @@
import java.util.Map;
import java.util.Set;
-
/**
* <p>The <code>ConfigurationMap</code> wraps a
* configuration-collection
@@ -32,12 +31,11 @@
* @todo This implementation is incomplete.
*
* @author <a href="mailto:ricardo.gladwell@btinternet.com">Ricardo Gladwell</a>
+ * @version $Revision$, $Date$
+ * @since 1.0
*/
-
-public class ConfigurationMap
- extends AbstractMap
+public class ConfigurationMap extends AbstractMap
{
-
/**
* The <code>Configuration</code> wrapped by this class.
*/
@@ -82,13 +80,11 @@
return configuration.getProperty(String.valueOf(key));
}
- static class ConfigurationSet
- extends AbstractSet
+ static class ConfigurationSet extends AbstractSet
{
private Configuration configuration = null;
- private class Entry
- implements Map.Entry
+ private class Entry implements Map.Entry
{
private Object key = null;
@@ -116,8 +112,7 @@
}
- private class ConfigurationSetIterator
- implements Iterator
+ private class ConfigurationSetIterator implements Iterator
{
private Iterator keys;
1.1 jakarta-commons/configuration/src/java/org/apache/commons/configuration/MapConfiguration.java
Index: MapConfiguration.java
===================================================================
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed 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.
*/
package org.apache.commons.configuration;
import java.util.Iterator;
import java.util.Map;
import java.util.List;
/**
* A Map based Configuration.
*
* @author Emmanuel Bourg
* @version $Revision: 1.1 $, $Date: 2004/10/18 12:50:41 $
* @since 1.1
*/
public class MapConfiguration extends AbstractConfiguration
{
/** The Map decorated by this configuration. */
protected Map map;
/**
* Create a Configuration decorator around the specified Map. The map is
* used to store the configuration properties, any change will also affect
* the Map.
*
* @param map
*/
public MapConfiguration(Map map)
{
this.map = map;
}
/**
* Return the Map decorated by this configuration.
*/
public Map getMap()
{
return map;
}
protected Object getPropertyDirect(String key)
{
Object value = map.get(key);
if (value instanceof String)
{
List list = split((String) value);
return list.size() > 1 ? list : value;
}
else
{
return value;
}
}
protected void addPropertyDirect(String key, Object obj)
{
map.put(key, obj);
}
public boolean isEmpty()
{
return map.isEmpty();
}
public boolean containsKey(String key)
{
return map.containsKey(key);
}
public void clearProperty(String key)
{
map.remove(key);
}
public Iterator getKeys()
{
return map.keySet().iterator();
}
}
1.1 jakarta-commons/configuration/src/java/org/apache/commons/configuration/SystemConfiguration.java
Index: SystemConfiguration.java
===================================================================
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed 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.
*/
package org.apache.commons.configuration;
/**
* A configuration based on the system properties.
*
* @author Emmanuel Bourg
* @version $Revision: 1.1 $, $Date: 2004/10/18 12:50:41 $
* @since 1.1
*/
public class SystemConfiguration extends MapConfiguration
{
/**
* Create a Configuration based on the system properties.
*
* @see System#getProperties
*/
public SystemConfiguration()
{
super(System.getProperties());
}
}
1.16 +92 -88 jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestConfigurationFactory.java
Index: TestConfigurationFactory.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestConfigurationFactory.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- TestConfigurationFactory.java 21 Sep 2004 17:18:27 -0000 1.15
+++ TestConfigurationFactory.java 18 Oct 2004 12:50:41 -0000 1.16
@@ -33,17 +33,17 @@
/** The Files that we test with */
private File digesterRules = new File("conf/digesterRules.xml");
private File testDigesterFile =
- new File("conf/testDigesterConfiguration.xml");
+ new File("conf/testDigesterConfiguration.xml");
private File testDigesterFileReverseOrder =
- new File("conf/testDigesterConfigurationReverseOrder.xml");
+ new File("conf/testDigesterConfigurationReverseOrder.xml");
private File testDigesterFileNamespaceAware =
- new File("conf/testDigesterConfigurationNamespaceAware.xml");
+ new File("conf/testDigesterConfigurationNamespaceAware.xml");
private File testDigesterFileBasePath =
- new File("conf/testDigesterConfigurationBasePath.xml");
+ new File("conf/testDigesterConfigurationBasePath.xml");
private File testDigesterFileEnhanced =
- new File("conf/testDigesterConfiguration2.xml");
+ new File("conf/testDigesterConfiguration2.xml");
private File testDigesterFileComplete =
- new File("conf/testDigesterConfiguration3.xml");
+ new File("conf/testDigesterConfiguration3.xml");
private File testDigesterBadXML = new File("conf/testDigesterBadXML.xml");
@@ -55,7 +55,7 @@
public void setUp() throws Exception
{
- System.setProperty("java.naming.factory.initial","org.apache.commons.configuration.MockStaticMemoryInitialContextFactory");
+ System.setProperty("java.naming.factory.initial", "org.apache.commons.configuration.MockStaticMemoryInitialContextFactory");
factory = new ConfigurationFactory();
}
@@ -64,50 +64,50 @@
JNDIConfiguration jndiConfiguration = new JNDIConfiguration();
Object o = jndiConfiguration.getProperty("test.boolean");
assertNotNull(o);
- assertEquals("true",o.toString());
+ assertEquals("true", o.toString());
}
public void testLoadingConfiguration() throws Exception
{
factory.setConfigurationFileName(
- testDigesterFile.toString());
+ testDigesterFile.toString());
compositeConfiguration =
- (CompositeConfiguration) factory.getConfiguration();
+ (CompositeConfiguration) factory.getConfiguration();
assertEquals(
- "Verify how many configs",
- 3,
- compositeConfiguration.getNumberOfConfigurations());
+ "Verify how many configs",
+ 3,
+ compositeConfiguration.getNumberOfConfigurations());
assertEquals(
- PropertiesConfiguration.class,
- compositeConfiguration.getConfiguration(0).getClass());
+ PropertiesConfiguration.class,
+ compositeConfiguration.getConfiguration(0).getClass());
PropertiesConfiguration pc =
- (PropertiesConfiguration) compositeConfiguration.getConfiguration(
- 0);
+ (PropertiesConfiguration) compositeConfiguration.getConfiguration(
+ 0);
assertNotNull(
- "Make sure we have a fileName:" + pc.getFileName(),
- pc.getFileName());
+ "Make sure we have a fileName:" + pc.getFileName(),
+ pc.getFileName());
assertTrue(
- "Make sure we have loades our key",
- compositeConfiguration.getBoolean("test.boolean"));
+ "Make sure we have loades our key",
+ compositeConfiguration.getBoolean("test.boolean"));
assertEquals(
- "I'm complex!",
- compositeConfiguration.getProperty(
- "element2.subelement.subsubelement"));
+ "I'm complex!",
+ compositeConfiguration.getProperty(
+ "element2.subelement.subsubelement"));
configuration = compositeConfiguration;
assertEquals(
- "I'm complex!",
- configuration.getProperty("element2.subelement.subsubelement"));
+ "I'm complex!",
+ configuration.getProperty("element2.subelement.subsubelement"));
}
public void testLoadingConfigurationReverseOrder() throws Exception
{
factory.setConfigurationFileName(
- testDigesterFileReverseOrder.toString());
+ testDigesterFileReverseOrder.toString());
configuration = factory.getConfiguration();
@@ -127,37 +127,37 @@
compositeConfiguration = (CompositeConfiguration) factory.getConfiguration();
assertEquals(
- "Verify how many configs",
- 3,
- compositeConfiguration.getNumberOfConfigurations());
+ "Verify how many configs",
+ 3,
+ compositeConfiguration.getNumberOfConfigurations());
assertEquals(
- PropertiesConfiguration.class,
- compositeConfiguration.getConfiguration(0).getClass());
+ PropertiesConfiguration.class,
+ compositeConfiguration.getConfiguration(0).getClass());
PropertiesConfiguration pc =
- (PropertiesConfiguration) compositeConfiguration.getConfiguration(
- 0);
+ (PropertiesConfiguration) compositeConfiguration.getConfiguration(
+ 0);
assertNotNull(
- "Make sure we have a fileName:" + pc.getFileName(),
- pc.getFileName());
+ "Make sure we have a fileName:" + pc.getFileName(),
+ pc.getFileName());
assertTrue(
- "Make sure we have loaded our key",
- pc.getBoolean("test.boolean"));
+ "Make sure we have loaded our key",
+ pc.getBoolean("test.boolean"));
assertTrue(
- "Make sure we have loaded our key",
- compositeConfiguration.getBoolean("test.boolean"));
+ "Make sure we have loaded our key",
+ compositeConfiguration.getBoolean("test.boolean"));
assertEquals(
- "I'm complex!",
- compositeConfiguration.getProperty(
- "element2.subelement.subsubelement"));
+ "I'm complex!",
+ compositeConfiguration.getProperty(
+ "element2.subelement.subsubelement"));
configuration = compositeConfiguration;
assertEquals(
- "I'm complex!",
- configuration.getProperty("element2.subelement.subsubelement"));
+ "I'm complex!",
+ configuration.getProperty("element2.subelement.subsubelement"));
}
public void testLoadingConfigurationNamespaceAware() throws Exception
@@ -211,13 +211,12 @@
// Tests if properties from all sources can be loaded
public void testAllConfiguration() throws Exception
{
-
factory.setConfigurationURL(testDigesterFileComplete.toURL());
Configuration config = factory.getConfiguration();
assertFalse(config.isEmpty());
assertTrue(config instanceof CompositeConfiguration);
- CompositeConfiguration cc = (CompositeConfiguration)config;
- assertTrue(cc.getNumberOfConfigurations()>1);
+ CompositeConfiguration cc = (CompositeConfiguration) config;
+ assertTrue(cc.getNumberOfConfigurations() > 1);
// Currently fails, should be 4? Only 2?
//assertEquals(4, cc.getNumberOfConfigurations());
@@ -226,62 +225,67 @@
assertEquals("value", config.getProperty("element3"));
assertEquals("foo", config.getProperty("element3[@name]"));
assertNotNull(config.getProperty("mail.account.user"));
-
+
+ // test JNDIConfiguration
assertNotNull(config.getProperty("test.onlyinjndi"));
assertTrue(config.getBoolean("test.onlyinjndi"));
-
+
Configuration subset = config.subset("test");
assertNotNull(subset.getProperty("onlyinjndi"));
assertTrue(subset.getBoolean("onlyinjndi"));
+
+ // test SystemConfiguration
+ assertNotNull(config.getProperty("java.version"));
+ assertEquals(System.getProperty("java.version"), config.getString("java.version"));
}
private void checkUnionConfig() throws Exception
{
compositeConfiguration = (CompositeConfiguration) factory.getConfiguration();
assertEquals(
- "Verify how many configs",
- 3,
- compositeConfiguration.getNumberOfConfigurations());
+ "Verify how many configs",
+ 3,
+ compositeConfiguration.getNumberOfConfigurations());
// Test if union was constructed correctly
Object prop = compositeConfiguration.getProperty("tables.table.name");
assertTrue(prop instanceof Collection);
assertEquals(3, ((Collection) prop).size());
assertEquals(
- "users",
- compositeConfiguration.getProperty("tables.table(0).name"));
+ "users",
+ compositeConfiguration.getProperty("tables.table(0).name"));
assertEquals(
- "documents",
- compositeConfiguration.getProperty("tables.table(1).name"));
+ "documents",
+ compositeConfiguration.getProperty("tables.table(1).name"));
assertEquals(
- "tasks",
- compositeConfiguration.getProperty("tables.table(2).name"));
+ "tasks",
+ compositeConfiguration.getProperty("tables.table(2).name"));
prop =
- compositeConfiguration.getProperty(
- "tables.table.fields.field.name");
+ compositeConfiguration.getProperty(
+ "tables.table.fields.field.name");
assertTrue(prop instanceof Collection);
assertEquals(17, ((Collection) prop).size());
assertEquals(
- "smtp.mydomain.org",
- compositeConfiguration.getString("mail.host.smtp"));
+ "smtp.mydomain.org",
+ compositeConfiguration.getString("mail.host.smtp"));
assertEquals(
- "pop3.mydomain.org",
- compositeConfiguration.getString("mail.host.pop"));
+ "pop3.mydomain.org",
+ compositeConfiguration.getString("mail.host.pop"));
// This was overriden
assertEquals(
- "masterOfPost",
- compositeConfiguration.getString("mail.account.user"));
+ "masterOfPost",
+ compositeConfiguration.getString("mail.account.user"));
assertEquals(
- "topsecret",
- compositeConfiguration.getString("mail.account.psswd"));
+ "topsecret",
+ compositeConfiguration.getString("mail.account.psswd"));
// This was overriden, too, but not in additional section
assertEquals(
- "enhanced factory",
- compositeConfiguration.getString("test.configuration"));
+ "enhanced factory",
+ compositeConfiguration.getString("test.configuration"));
}
private void checkCompositeConfiguration() throws Exception
@@ -289,31 +293,31 @@
compositeConfiguration = (CompositeConfiguration) factory.getConfiguration();
assertEquals(
- "Verify how many configs",
- 2,
- compositeConfiguration.getNumberOfConfigurations());
+ "Verify how many configs",
+ 2,
+ compositeConfiguration.getNumberOfConfigurations());
assertEquals(
- PropertiesConfiguration.class,
- compositeConfiguration.getConfiguration(0).getClass());
+ PropertiesConfiguration.class,
+ compositeConfiguration.getConfiguration(0).getClass());
PropertiesConfiguration pc =
- (PropertiesConfiguration) compositeConfiguration.getConfiguration(
- 0);
+ (PropertiesConfiguration) compositeConfiguration.getConfiguration(
+ 0);
assertNotNull(
- "Make sure we have a fileName:" + pc.getFileName(),
- pc.getFileName());
+ "Make sure we have a fileName:" + pc.getFileName(),
+ pc.getFileName());
assertTrue(
- "Make sure we have loaded our key",
- pc.getBoolean("test.boolean"));
+ "Make sure we have loaded our key",
+ pc.getBoolean("test.boolean"));
assertTrue(
- "Make sure we have loaded our key",
- compositeConfiguration.getBoolean("test.boolean"));
+ "Make sure we have loaded our key",
+ compositeConfiguration.getBoolean("test.boolean"));
+
-
Object property = compositeConfiguration.getProperty(
- "element2.subelement.subsubelement");
- assertNull("Should have returned a null",property);
+ "element2.subelement.subsubelement");
+ assertNull("Should have returned a null", property);
}
}
1.1 jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestMapConfiguration.java
Index: TestMapConfiguration.java
===================================================================
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed 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.
*/
package org.apache.commons.configuration;
import java.util.HashMap;
import java.util.Map;
/**
* Tests for MapConfiguration.
*
* @author Emmanuel Bourg
* @version $Revision: 1.1 $, $Date: 2004/10/18 12:50:41 $
*/
public class TestMapConfiguration extends TestAbstractConfiguration
{
protected AbstractConfiguration getConfiguration()
{
Map map = new HashMap();
map.put("key1", "value1");
map.put("key2", "value2");
return new MapConfiguration(map);
}
protected AbstractConfiguration getEmptyConfiguration()
{
return new MapConfiguration(new HashMap());
}
public void testGetMap()
{
Map map = new HashMap();
MapConfiguration conf = new MapConfiguration(map);
assertEquals(map, conf.getMap());
}
}
1.1 jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestSystemConfiguration.java
Index: TestSystemConfiguration.java
===================================================================
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed 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.
*/
package org.apache.commons.configuration;
import java.util.Properties;
import junit.framework.TestCase;
/**
* Tests for MapConfiguration.
*
* @author Emmanuel Bourg
* @version $Revision: 1.1 $, $Date: 2004/10/18 12:50:41 $
*/
public class TestSystemConfiguration extends TestCase
{
public void testSystemConfiguration()
{
Properties props = System.getProperties();
props.put("test.number", "123");
Configuration conf = new SystemConfiguration();
assertEquals("number", 123, conf.getInt("test.number"));
}
}
1.7 +1 -0 jakarta-commons/configuration/conf/testDigesterConfiguration3.xml
Index: testDigesterConfiguration3.xml
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/conf/testDigesterConfiguration3.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- testDigesterConfiguration3.xml 20 Aug 2004 15:49:27 -0000 1.6
+++ testDigesterConfiguration3.xml 18 Oct 2004 12:50:42 -0000 1.7
@@ -3,6 +3,7 @@
<configuration>
<additional>
+ <system/>
<xml fileName="test.xml"/>
<hierarchicalXml fileName="testDigesterConfigurationInclude1.xml" at="tables"/>
<properties fileName="testDigesterConfigurationInclude2.properties" at="mail"/>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org