1 /*
2 * File: CompositePropertiesTest.java
3 * Date: Aug 22, 2003
4 */
5 package com.rhi.architecture.lang;
6
7 import java.util.Properties;
8
9 import junit.framework.TestCase;
10
11 /***
12 * CompositePropertiesTest
13 *
14 * @author <a href="mailto:pete_mckinstry@yahoo.com">Pete McKinstry</a>
15 * @copyright 2003 Pete McKinstry All Rights Reserved.
16 */
17 public class CompositePropertiesTest extends TestCase {
18
19 /***
20 * constructor
21 * @param name
22 */
23 public CompositePropertiesTest(String name) {
24 super(name);
25 }
26
27 /***
28 * test creation of composite properties object using nested files.
29 * @throws Exception
30 */
31 public void testCreation() throws Exception {
32 Properties orig = PropertyUtils.loadProperties( "parent.properties" );
33 CompositeProperties pc = new CompositeProperties( orig );
34 pc.list( System.out );
35 assertTrue("parent keys not loaded",
36 pc.get("some-key").equals("some-value"));
37 {
38 // check child properties.
39 assertTrue("child keys not loaded",
40 pc.get("datasource1.driver").equals("COM.ibm.db2.app.Driver"));
41 assertTrue("child keys not loaded",
42 pc.get("datasource1.db_url").equals("jdbc:db2:dev"));
43 assertTrue("child keys not loaded",
44 pc.get("datasource1.username").equals("scott"));
45 assertTrue("child keys not loaded",
46 pc.get("datasource1.password").equals("tiger"));
47 }
48 }
49 /***
50 * main()
51 * @param args
52 */
53 public static void main(String[] args) {
54 junit.textui.TestRunner.run(CompositePropertiesTest.class);
55 }
56
57 }
This page was automatically generated by Maven