Much more substantial testing for the fancy new inheritable properties.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@946 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
<pathelement location="../${deploy.dir}/classes"/>
|
||||
<pathelement location="${deploy.dir}/classes"/>
|
||||
<fileset dir="../lib" includes="**/*.jar"/>
|
||||
<fileset dir="lib" includes="**/*.jar"/>
|
||||
<fileset dir="${java.libraries}" includes="**/*.jar"/>
|
||||
</path>
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#
|
||||
# $Id: grandparent.properties,v 1.1 2002/11/25 22:23:21 mdb Exp $
|
||||
#
|
||||
# A test properties file
|
||||
|
||||
sub.sub1 = 5
|
||||
sub.sub2 = whee!
|
||||
@@ -0,0 +1,12 @@
|
||||
#
|
||||
# $Id: parent.properties,v 1.1 2002/11/25 22:23:21 mdb Exp $
|
||||
#
|
||||
# A test properties file
|
||||
|
||||
_extends = rsrc/util/grandparent.properties
|
||||
|
||||
prop1 = 13
|
||||
prop2 = nine
|
||||
prop3 = 9, 8, 7, 6
|
||||
prop4 = one, two, three,, and a half, four
|
||||
# prop5 = not defined
|
||||
@@ -1,13 +1,9 @@
|
||||
#
|
||||
# $Id: test.properties,v 1.2 2002/03/28 22:21:06 mdb Exp $
|
||||
# $Id: test.properties,v 1.3 2002/11/25 22:23:21 mdb Exp $
|
||||
#
|
||||
# A test properties file
|
||||
|
||||
_extends = rsrc/util/parent.properties
|
||||
|
||||
prop1 = 25
|
||||
prop2 = twenty five
|
||||
prop3 = 9, 8, 7, 6
|
||||
prop4 = one, two, three,, and a half, four
|
||||
# prop5 = not defined
|
||||
|
||||
sub.sub1 = 5
|
||||
sub.sub2 = whee!
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ConfigUtilTest.java,v 1.3 2002/04/11 04:07:42 mdb Exp $
|
||||
// $Id: ConfigUtilTest.java,v 1.4 2002/11/25 22:23:21 mdb Exp $
|
||||
//
|
||||
// samskivert library - useful routines for java programs
|
||||
// Copyright (C) 2001 Michael Bayne
|
||||
@@ -27,6 +27,45 @@ import junit.framework.TestCase;
|
||||
|
||||
import com.samskivert.Log;
|
||||
|
||||
/**
|
||||
* Our test properties files:
|
||||
*
|
||||
* <pre>
|
||||
* lib/test-c.jar:
|
||||
* _package = testC
|
||||
* _overrides = testAL, testBR
|
||||
*
|
||||
* three = testC - three
|
||||
*
|
||||
* lib/test-br.jar:
|
||||
* _package = testBR
|
||||
* _overrides = testAR
|
||||
*
|
||||
* two = testBR - two
|
||||
* four = testBR - four
|
||||
*
|
||||
* lib/test-ar.jar:
|
||||
* _package = testAR
|
||||
* _overrides = test
|
||||
*
|
||||
* one = testAR - one
|
||||
* two = testAR - two
|
||||
* four = testAR - four
|
||||
*
|
||||
* lib/test-al.jar:
|
||||
* _package = testAL
|
||||
* _overrides = test
|
||||
*
|
||||
* one = testAL - one
|
||||
*
|
||||
* lib/test.jar:
|
||||
* _package = test
|
||||
*
|
||||
* one = test - one
|
||||
* two = test - two
|
||||
* three = test - three
|
||||
* </pre>
|
||||
*/
|
||||
public class ConfigUtilTest extends TestCase
|
||||
{
|
||||
public ConfigUtilTest ()
|
||||
@@ -41,6 +80,10 @@ public class ConfigUtilTest extends TestCase
|
||||
Properties props = ConfigUtil.loadInheritedProperties(path);
|
||||
assertTrue("props valid", props.toString().equals(DUMP));
|
||||
|
||||
path = "test/test.properties";
|
||||
props = ConfigUtil.loadInheritedProperties(path);
|
||||
assertTrue("props valid", props.toString().equals(IDUMP));
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace(System.err);
|
||||
}
|
||||
@@ -51,8 +94,17 @@ public class ConfigUtilTest extends TestCase
|
||||
return new ConfigUtilTest();
|
||||
}
|
||||
|
||||
public static void main (String[] args)
|
||||
{
|
||||
ConfigUtilTest test = new ConfigUtilTest();
|
||||
test.runTest();
|
||||
}
|
||||
|
||||
protected static final String DUMP =
|
||||
"{prop4=one, two, three,, and a half, four, " +
|
||||
"prop3=9, 8, 7, 6, prop2=twenty five, prop1=25, " +
|
||||
"sub.sub2=whee!, sub.sub1=5}";
|
||||
|
||||
protected static final String IDUMP = "{two=testBR - two, " +
|
||||
"one=testAR - one, three=testC - three, four=testBR - four}";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user