epugh 2003/03/21 21:18:16
Modified: configuration/src/test/org/apache/commons/configuration
BaseNonStringProperties.java
TestCompositeConfiguration.java
TestConfigurationFactory.java
TestDOM4JConfiguration.java
TestPropertiesConfiguration.java
Log:
Finally got the configuration stuff working all working with Turbine using the
ocnfigurationFactory. Ready for review!
Revision Changes Path
1.3 +7 -1
jakarta-commons-sandbox/configuration/src/test/org/apache/commons/configuration/BaseNonStringProperties.java
Index: BaseNonStringProperties.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/configuration/src/test/org/apache/commons/configuration/BaseNonStringProperties.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BaseNonStringProperties.java 11 Mar 2003 18:04:20 -0000 1.2
+++ BaseNonStringProperties.java 22 Mar 2003 05:18:16 -0000 1.3
@@ -220,4 +220,10 @@
assertEquals(2, shortValue);
assertEquals(2, conf.getVector("test.short.array").size());
}
+
+ public void testVectorMissing() throws Exception
+ {
+
+ assertEquals(0, conf.getVector("missing.vector").size());
+ }
}
1.7 +19 -63
jakarta-commons-sandbox/configuration/src/test/org/apache/commons/configuration/TestCompositeConfiguration.java
Index: TestCompositeConfiguration.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/configuration/src/test/org/apache/commons/configuration/TestCompositeConfiguration.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TestCompositeConfiguration.java 20 Mar 2003 08:32:52 -0000 1.6
+++ TestCompositeConfiguration.java 22 Mar 2003 05:18:16 -0000 1.7
@@ -73,12 +73,9 @@
protected DOM4JConfiguration dom4jConf;
protected CompositeConfiguration cc;
/** The File that we test with */
- private String testProperties =
- new File("conf/test.properties").getAbsolutePath();
- private String testProperties2 =
- new File("conf/test2.properties").getAbsolutePath();
- private String testPropertiesXML =
- new File("conf/test.xml").getAbsolutePath();
+ private String testProperties = new
File("conf/test.properties").getAbsolutePath();
+ private String testProperties2 = new
File("conf/test2.properties").getAbsolutePath();
+ private String testPropertiesXML = new File("conf/test.xml").getAbsolutePath();
public TestCompositeConfiguration(String s)
{
@@ -112,38 +109,23 @@
{
cc.addConfiguration(conf1);
cc.addConfiguration(conf2);
- assertEquals(
- "Make sure we get the property from conf1 first",
- "packagea",
- cc.getString("packages"));
+ assertEquals("Make sure we get the property from conf1 first", "packagea",
cc.getString("packages"));
cc.clear();
cc.addConfiguration(conf2);
cc.addConfiguration(conf1);
- assertEquals(
- "Make sure we get the property from conf1 first",
- "override.packages",
- cc.getString("packages"));
+ assertEquals("Make sure we get the property from conf1 first",
"override.packages", cc.getString("packages"));
}
public void testGetPropertyMissing() throws Exception
{
cc.addConfiguration(conf1);
cc.addConfiguration(conf2);
- try
- {
- cc.getString("bogus.property");
- fail("Should have thrown a java.util.NoSuchElementException");
- }
- catch (java.util.NoSuchElementException nsee)
- {}
-
- assertTrue(
- "Should be false",
- !cc.getBoolean("test.missing.boolean", false));
- assertTrue(
- "Should be true",
- cc.getBoolean("test.missing.boolean.true", true));
+
+ assertNull(cc.getString("bogus.property"));
+
+ assertTrue("Should be false", !cc.getBoolean("test.missing.boolean",
false));
+ assertTrue("Should be true", cc.getBoolean("test.missing.boolean.true",
true));
}
@@ -154,18 +136,12 @@
{
cc.addConfiguration(conf1);
cc.addConfiguration(dom4jConf);
- assertEquals(
- "Make sure we get the property from conf1 first",
- 1,
- cc.getInt("test.short"));
+ assertEquals("Make sure we get the property from conf1 first", 1,
cc.getInt("test.short"));
cc.clear();
cc.addConfiguration(dom4jConf);
cc.addConfiguration(conf1);
- assertEquals(
- "Make sure we get the property from dom4j",
- 8,
- cc.getInt("test.short"));
+ assertEquals("Make sure we get the property from dom4j", 8,
cc.getInt("test.short"));
}
/**
@@ -197,12 +173,8 @@
{
cc.addConfiguration(conf1);
cc.addConfiguration(dom4jConf);
- assertEquals(
- PropertiesConfiguration.class,
- cc.getConfiguration(1).getClass());
- assertEquals(
- DOM4JConfiguration.class,
- cc.getConfiguration(2).getClass());
+ assertEquals(PropertiesConfiguration.class,
cc.getConfiguration(1).getClass());
+ assertEquals(DOM4JConfiguration.class, cc.getConfiguration(2).getClass());
}
/**
@@ -214,9 +186,7 @@
cc.addConfiguration(conf1);
cc.addConfiguration(dom4jConf);
cc.clearProperty("test.short");
- assertTrue(
- "Make sure test.short is gone!",
- !cc.containsKey("test.short"));
+ assertTrue("Make sure test.short is gone!", !cc.containsKey("test.short"));
}
/**
@@ -229,10 +199,7 @@
cc.addConfiguration(dom4jConf);
cc.addProperty("test.short", "88");
- assertEquals(
- "Make sure test.short is overridden!",
- "88",
- cc.getString("test.short"));
+ assertEquals("Make sure test.short is overridden!", "88",
cc.getString("test.short"));
}
/**
@@ -259,19 +226,11 @@
subset = cc.subset("test.short");
assertNotNull(subset);
assertTrue("Shouldn't be empty", !subset.isEmpty());
- assertEquals(
- "Make sure the initial loaded configs subset overrides"
- + "any later add configs subset",
- "1",
- subset.getString("test.short"));
+ assertEquals("Make sure the initial loaded configs subset overrides" + "any
later add configs subset", "1", subset.getString("test.short"));
cc.setProperty("test.short", "43");
subset = cc.subset("test.short");
- assertEquals(
- "Make sure the initial loaded configs subset overrides"
- + "any later add configs subset",
- "43",
- subset.getString("test.short"));
+ assertEquals("Make sure the initial loaded configs subset overrides" + "any
later add configs subset", "43", subset.getString("test.short"));
}
@@ -296,7 +255,6 @@
assertEquals(2, packages.size());
}
-
/**
* Tests <code>String</code> array parsing.
*/
@@ -308,8 +266,6 @@
String[] packages = cc.getStringArray("packages");
// we should get 3 packages here
assertEquals(3, packages.length);
-
-
packages = cc.getStringArray("packages.which.dont.exist");
// we should get 0 packages here
1.3 +113 -68
jakarta-commons-sandbox/configuration/src/test/org/apache/commons/configuration/TestConfigurationFactory.java
Index: TestConfigurationFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/configuration/src/test/org/apache/commons/configuration/TestConfigurationFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestConfigurationFactory.java 19 Mar 2003 10:32:46 -0000 1.2
+++ TestConfigurationFactory.java 22 Mar 2003 05:18:16 -0000 1.3
@@ -67,112 +67,157 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Eric Pugh</a>
* @version $Id$
*/
-public class TestConfigurationFactory extends TestCase {
+public class TestConfigurationFactory extends TestCase
+{
- private static Log log = LogFactory.getLog(TestConfigurationFactory.class);
+ private static Log log = LogFactory.getLog(TestConfigurationFactory.class);
- /** The Files that we test with */
- private File digesterRules = new File("conf/digesterRules.xml");
- private File testDigesterFile = new File("conf/testDigesterConfiguration.xml");
- private File testDigesterFileReverseOrder = new
File("conf/testDigesterConfigurationReverseOrder.xml");
- private File testDigesterFileNamespaceAware = new
File("conf/testDigesterConfigurationNamespaceAware.xml");
+ /** The Files that we test with */
+ private File digesterRules = new File("conf/digesterRules.xml");
+ private File testDigesterFile = new File("conf/testDigesterConfiguration.xml");
+ private File testDigesterFileReverseOrder = new
File("conf/testDigesterConfigurationReverseOrder.xml");
+ private File testDigesterFileNamespaceAware = new
File("conf/testDigesterConfigurationNamespaceAware.xml");
+ private File testDigesterFileBasePath = new
File("conf/testDigesterConfigurationBasePath.xml");
- private Configuration configuration;
- private CompositeConfiguration compositeConfiguration;
- private ConfigurationFactory configurationFactory;
+ private String testBasePath = new File("conf").getAbsolutePath();
- public TestConfigurationFactory(String s) throws Exception {
- super(s);
+ private Configuration configuration;
+ private CompositeConfiguration compositeConfiguration;
+ private ConfigurationFactory configurationFactory;
- }
+ public TestConfigurationFactory(String s) throws Exception
+ {
+ super(s);
- public void setUp() throws Exception {
- configurationFactory = new ConfigurationFactory();
- }
+ }
- public void testLoadingConfiguration() throws Exception {
+ public void setUp() throws Exception
+ {
+ configurationFactory = new ConfigurationFactory();
+ }
-
configurationFactory.setConfigurationFileName(testDigesterFile.toString());
+ public void testLoadingConfiguration() throws Exception
+ {
- compositeConfiguration = (CompositeConfiguration)
configurationFactory.getConfiguration();
+ configurationFactory.setConfigurationFileName(testDigesterFile.toString());
- assertEquals("Verify how many configs", 3,
compositeConfiguration.getNumberOfConfigurations());
- assertEquals(PropertiesConfiguration.class,
compositeConfiguration.getConfiguration(1).getClass());
- PropertiesConfiguration pc = (PropertiesConfiguration)
compositeConfiguration.getConfiguration(1);
+ compositeConfiguration = (CompositeConfiguration)
configurationFactory.getConfiguration();
- assertNotNull("Make sure we have a fileName:" + pc.getFileName(),
pc.getFileName());
+ assertEquals("Verify how many configs", 3,
compositeConfiguration.getNumberOfConfigurations());
+ assertEquals(PropertiesConfiguration.class,
compositeConfiguration.getConfiguration(1).getClass());
+ PropertiesConfiguration pc = (PropertiesConfiguration)
compositeConfiguration.getConfiguration(1);
- assertTrue("Make sure we have loades our key",
compositeConfiguration.getBoolean("test.boolean"));
- assertEquals("I'm complex!",
compositeConfiguration.getProperty("element2.subelement.subsubelement"));
+ assertNotNull("Make sure we have a fileName:" + pc.getFileName(),
pc.getFileName());
- configuration = (Configuration) compositeConfiguration;
- assertEquals("I'm complex!",
configuration.getProperty("element2.subelement.subsubelement"));
+ assertTrue("Make sure we have loades our key",
compositeConfiguration.getBoolean("test.boolean"));
+ assertEquals("I'm complex!",
compositeConfiguration.getProperty("element2.subelement.subsubelement"));
- }
+ configuration = (Configuration) compositeConfiguration;
+ assertEquals("I'm complex!",
configuration.getProperty("element2.subelement.subsubelement"));
- public void testLoadingConfigurationReverseOrder() throws Exception {
+ }
-
configurationFactory.setConfigurationFileName(testDigesterFileReverseOrder.toString());
+ public void testLoadingConfigurationReverseOrder() throws Exception
+ {
- configuration = configurationFactory.getConfiguration();
+
configurationFactory.setConfigurationFileName(testDigesterFileReverseOrder.toString());
- assertEquals("8", configuration.getProperty("test.short"));
+ configuration = configurationFactory.getConfiguration();
-
configurationFactory.setConfigurationFileName(testDigesterFile.toString());
+ assertEquals("8", configuration.getProperty("test.short"));
- configuration = configurationFactory.getConfiguration();
- assertEquals("1", configuration.getProperty("test.short"));
+ configurationFactory.setConfigurationFileName(testDigesterFile.toString());
- }
+ configuration = configurationFactory.getConfiguration();
+ assertEquals("1", configuration.getProperty("test.short"));
- public void testLoadingConfigurationWithRulesXML() throws Exception {
+ }
-
configurationFactory.setConfigurationFileName(testDigesterFile.toString());
- configurationFactory.setDigesterRules(digesterRules.toURL());
+ public void testLoadingConfigurationWithRulesXML() throws Exception
+ {
- compositeConfiguration = (CompositeConfiguration)
configurationFactory.getConfiguration();
+ configurationFactory.setConfigurationFileName(testDigesterFile.toString());
+ configurationFactory.setDigesterRules(digesterRules.toURL());
- assertEquals("Verify how many configs", 3,
compositeConfiguration.getNumberOfConfigurations());
+ compositeConfiguration = (CompositeConfiguration)
configurationFactory.getConfiguration();
- assertEquals(PropertiesConfiguration.class,
compositeConfiguration.getConfiguration(1).getClass());
+ assertEquals("Verify how many configs", 3,
compositeConfiguration.getNumberOfConfigurations());
- PropertiesConfiguration pc = (PropertiesConfiguration)
compositeConfiguration.getConfiguration(1);
- assertNotNull("Make sure we have a fileName:" + pc.getFileName(),
pc.getFileName());
- assertTrue("Make sure we have loaded our key",
pc.getBoolean("test.boolean"));
+ assertEquals(PropertiesConfiguration.class,
compositeConfiguration.getConfiguration(1).getClass());
- assertTrue("Make sure we have loaded our key",
compositeConfiguration.getBoolean("test.boolean"));
+ PropertiesConfiguration pc = (PropertiesConfiguration)
compositeConfiguration.getConfiguration(1);
+ assertNotNull("Make sure we have a fileName:" + pc.getFileName(),
pc.getFileName());
+ assertTrue("Make sure we have loaded our key",
pc.getBoolean("test.boolean"));
- assertEquals("I'm complex!",
compositeConfiguration.getProperty("element2.subelement.subsubelement"));
+ assertTrue("Make sure we have loaded our key",
compositeConfiguration.getBoolean("test.boolean"));
- configuration = (Configuration) compositeConfiguration;
- assertEquals("I'm complex!",
configuration.getProperty("element2.subelement.subsubelement"));
+ assertEquals("I'm complex!",
compositeConfiguration.getProperty("element2.subelement.subsubelement"));
- }
+ configuration = (Configuration) compositeConfiguration;
+ assertEquals("I'm complex!",
configuration.getProperty("element2.subelement.subsubelement"));
- public void testLoadingConfigurationNamespaceAware() throws Exception {
+ }
-
configurationFactory.setConfigurationFileName(testDigesterFileNamespaceAware.toString());
- //configurationFactory.setDigesterRules(digesterRules.toURL());
- configurationFactory.setDigesterRuleNamespaceURI("namespace-one");
+ public void testLoadingConfigurationNamespaceAware() throws Exception
+ {
- compositeConfiguration = (CompositeConfiguration)
configurationFactory.getConfiguration();
+
configurationFactory.setConfigurationFileName(testDigesterFileNamespaceAware.toString());
+ //configurationFactory.setDigesterRules(digesterRules.toURL());
+ configurationFactory.setDigesterRuleNamespaceURI("namespace-one");
- assertEquals("Verify how many configs", 2,
compositeConfiguration.getNumberOfConfigurations());
+ compositeConfiguration = (CompositeConfiguration)
configurationFactory.getConfiguration();
- assertEquals(PropertiesConfiguration.class,
compositeConfiguration.getConfiguration(1).getClass());
+ assertEquals("Verify how many configs", 2,
compositeConfiguration.getNumberOfConfigurations());
- PropertiesConfiguration pc = (PropertiesConfiguration)
compositeConfiguration.getConfiguration(1);
- assertNotNull("Make sure we have a fileName:" + pc.getFileName(),
pc.getFileName());
- assertTrue("Make sure we have loaded our key",
pc.getBoolean("test.boolean"));
+ assertEquals(PropertiesConfiguration.class,
compositeConfiguration.getConfiguration(1).getClass());
- assertTrue("Make sure we have loaded our key",
compositeConfiguration.getBoolean("test.boolean"));
+ PropertiesConfiguration pc = (PropertiesConfiguration)
compositeConfiguration.getConfiguration(1);
+ assertNotNull("Make sure we have a fileName:" + pc.getFileName(),
pc.getFileName());
+ assertTrue("Make sure we have loaded our key",
pc.getBoolean("test.boolean"));
- try {
+ assertTrue("Make sure we have loaded our key",
compositeConfiguration.getBoolean("test.boolean"));
-
compositeConfiguration.getProperty("element2.subelement.subsubelement");
- fail("Should have thrown an exception");
- }
- catch (java.util.NoSuchElementException nsee) {}
+ try
+ {
- }
+ compositeConfiguration.getProperty("element2.subelement.subsubelement");
+ fail("Should have thrown an exception");
+ }
+ catch (java.util.NoSuchElementException nsee)
+ {}
+
+ }
+
+ public void testLoadingConfigurationBasePath() throws Exception
+ {
+
+
configurationFactory.setConfigurationFileName(testDigesterFileBasePath.toString());
+
+ configurationFactory.setBasePath(testBasePath);
+
+ //configurationFactory.setDigesterRules(digesterRules.toURL());
+ //configurationFactory.setDigesterRuleNamespaceURI("namespace-one");
+
+ compositeConfiguration = (CompositeConfiguration)
configurationFactory.getConfiguration();
+
+ assertEquals("Verify how many configs", 2,
compositeConfiguration.getNumberOfConfigurations());
+
+ assertEquals(PropertiesConfiguration.class,
compositeConfiguration.getConfiguration(1).getClass());
+
+ PropertiesConfiguration pc = (PropertiesConfiguration)
compositeConfiguration.getConfiguration(1);
+ assertNotNull("Make sure we have a fileName:" + pc.getFileName(),
pc.getFileName());
+ assertTrue("Make sure we have loaded our key",
pc.getBoolean("test.boolean"));
+
+ assertTrue("Make sure we have loaded our key",
compositeConfiguration.getBoolean("test.boolean"));
+
+ try
+ {
+
+ compositeConfiguration.getProperty("element2.subelement.subsubelement");
+ fail("Should have thrown an exception");
+ }
+ catch (java.util.NoSuchElementException nsee)
+ {}
+
+ }
}
1.4 +70 -31
jakarta-commons-sandbox/configuration/src/test/org/apache/commons/configuration/TestDOM4JConfiguration.java
Index: TestDOM4JConfiguration.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/configuration/src/test/org/apache/commons/configuration/TestDOM4JConfiguration.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TestDOM4JConfiguration.java 19 Mar 2003 10:32:46 -0000 1.3
+++ TestDOM4JConfiguration.java 22 Mar 2003 05:18:16 -0000 1.4
@@ -64,35 +64,74 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Eric Pugh</a>
* @version $Id$
*/
-public class TestDOM4JConfiguration extends TestCase {
- /** The File that we test with */
- private String testProperties = new File("conf/test.xml").getAbsolutePath();
- private DOM4JConfiguration conf;
+public class TestDOM4JConfiguration extends TestCase
+{
+ /** The File that we test with */
+ private String testProperties = new File("conf/test.xml").getAbsolutePath();
+ private String testBasePath = new File("conf").getAbsolutePath();
+ private DOM4JConfiguration conf;
+
+ public TestDOM4JConfiguration(String s)
+ {
+ super(s);
+ }
+
+ protected void setUp() throws Exception
+ {
+ conf = new DOM4JConfiguration(new File(testProperties));
+ }
+
+ public void testGetProperty() throws Exception
+ {
+
+ assertEquals("value", conf.getProperty("element"));
+
+ }
+
+ public void testGetComplexProperty() throws Exception
+ {
+
+ assertEquals("I'm complex!",
conf.getProperty("element2.subelement.subsubelement"));
+
+ }
+
+ public void testSettingFileNames() throws Exception
+ {
+ conf = new DOM4JConfiguration();
+ conf.setFileName(testProperties);
+ assertEquals(testProperties.toString(), conf.getFileName());
+
+ conf.setBasePath(testBasePath);
+ conf.setFileName("hello.xml");
+ assertEquals("hello.xml", conf.getFileName());
+ assertEquals(testBasePath.toString(), conf.getBasePath());
+ assertEquals(new File(testBasePath, "hello.xml"), conf.getFile());
+
+ conf.setBasePath(testBasePath);
+ conf.setFileName("/subdir/hello.xml");
+ assertEquals("/subdir/hello.xml", conf.getFileName());
+ assertEquals(testBasePath.toString(), conf.getBasePath());
+ assertEquals(new File(testBasePath, "/subdir/hello.xml"), conf.getFile());
+
+ }
+
+ public void testLoad() throws Exception
+ {
+ conf = new DOM4JConfiguration();
+ conf.setFileName(testProperties);
+ conf.load();
+
+ assertEquals("I'm complex!",
conf.getProperty("element2.subelement.subsubelement"));
+ }
+
+ public void testLoadWithBasePath() throws Exception
+ {
+ conf = new DOM4JConfiguration();
+
+ conf.setFileName("test.xml");
+ conf.setBasePath(testBasePath);
+ conf.load();
- public TestDOM4JConfiguration(String s) {
- super(s);
- }
-
- protected void setUp() throws Exception {
- conf = new DOM4JConfiguration(new File(testProperties));
- }
-
- public void testGetProperty() throws Exception {
-
- assertEquals("value", conf.getProperty("element"));
-
- }
-
- public void testGetComplexProperty() throws Exception {
-
- assertEquals("I'm complex!",
conf.getProperty("element2.subelement.subsubelement"));
-
- }
- public void testLoad() throws Exception {
- conf = new DOM4JConfiguration();
- conf.setFileName(testProperties);
- conf.load();
-
- assertEquals("I'm complex!",
conf.getProperty("element2.subelement.subsubelement"));
- }
+ assertEquals("I'm complex!",
conf.getProperty("element2.subelement.subsubelement"));
+ }
}
1.9 +46 -20
jakarta-commons-sandbox/configuration/src/test/org/apache/commons/configuration/TestPropertiesConfiguration.java
Index: TestPropertiesConfiguration.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/configuration/src/test/org/apache/commons/configuration/TestPropertiesConfiguration.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- TestPropertiesConfiguration.java 19 Mar 2003 10:32:46 -0000 1.8
+++ TestPropertiesConfiguration.java 22 Mar 2003 05:18:16 -0000 1.9
@@ -65,26 +65,25 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel Rall</a>
* @version $Id$
*/
-public class TestPropertiesConfiguration
- extends TestBasePropertiesConfiguration
+public class TestPropertiesConfiguration extends TestBasePropertiesConfiguration
{
/** The File that we test with */
- private String testProperties =
- new File("conf/test.properties").getAbsolutePath();
+ private String testProperties = new
File("conf/test.properties").getAbsolutePath();
+
+ private String testBasePath = new File("conf").getAbsolutePath();
+ private String testBasePath2 = new
File("conf").getAbsoluteFile().getParentFile().getAbsolutePath();
public TestPropertiesConfiguration(String s)
{
super(s);
}
- protected void setUp()
- throws Exception
+ protected void setUp() throws Exception
{
conf = new PropertiesConfiguration(testProperties);
}
- public void testSave()
- throws Exception
+ public void atestSave() throws Exception
{
PropertiesConfiguration toSave = new PropertiesConfiguration();
toSave.addProperty("string", "value1");
@@ -98,15 +97,42 @@
toSave.save(filename);
}
-
- public void testLoadViaProperty()
- throws Exception
- {
- PropertiesConfiguration pc = new PropertiesConfiguration();
- pc.setFileName(testProperties);
- pc.load();
-
- assertTrue("Make sure we have multiple
keys",pc.getBoolean("test.boolean"));
- }
-}
+ public void atestLoadViaProperty() throws Exception
+ {
+ PropertiesConfiguration pc = new PropertiesConfiguration();
+ pc.setFileName(testProperties);
+ pc.load();
+
+ assertTrue("Make sure we have multiple keys",
pc.getBoolean("test.boolean"));
+ }
+
+ public void testLoadViaPropertyWithBasePath() throws Exception
+ {
+
+ PropertiesConfiguration pc = new PropertiesConfiguration();
+ pc.setBasePath(testBasePath);
+ pc.setFileName("test.properties");
+ pc.load();
+
+ assertTrue("Make sure we have multiple keys",
pc.getBoolean("test.boolean"));
+ }
+
+ public void testLoadViaPropertyWithBasePath2() throws Exception
+ {
+
+ PropertiesConfiguration pc = new PropertiesConfiguration();
+ pc.setBasePath(testBasePath2);
+ pc.setFileName("/conf/test.properties");
+ pc.load();
+
+ assertTrue("Make sure we have multiple keys",
pc.getBoolean("test.boolean"));
+
+ pc = new PropertiesConfiguration();
+ pc.setBasePath(testBasePath2);
+ pc.setFileName("conf/test.properties");
+ pc.load();
+
+ assertTrue("Make sure we have multiple keys",
pc.getBoolean("test.boolean"));
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]