1 package org.xmlBlaster.test.classtest;
 2 
 3 import java.util.Map;
 4 
 5 import org.custommonkey.xmlunit.XMLTestCase;
 6 import org.xmlBlaster.util.Global;
 7 import org.xmlBlaster.util.context.ContextNode;
 8 
 9 /**
10  * Test ClientProperty. 
11  * <p />
12  * All methods starting with 'test' and without arguments are invoked automatically
13  * <p />
14  * TODO: http://xmlunit.sourceforge.net/
15  * <p />
16  * Invoke: java -Djava.compiler= junit.textui.TestRunner -noloading org.xmlBlaster.test.classtest.PropertyTest
17  * @see org.xmlBlaster.util.qos.ClientProperty
18  * @see <a href="http://www.xmlblaster.org/xmlBlaster/doc/requirements/engine.qos.clientProperty.html">The client.qos.clientProperty requirement</a>
19  */
20 public class PropertyTest extends XMLTestCase {
21    protected Global glob;
22    int counter = 0;
23 
24    public PropertyTest(String name) {
25       super(name);
26    }
27 
28    protected void setUp() {
29       this.glob = Global.instance();
30 
31    }
32 
33    public void testPropertyStartingWith() throws Exception {
34       
35       String[] args = new String[] { 
36            "-logging", "FINE",
37            "-/node/heron/logging", "FINE",
38            "-logging/org.xmlBlaster.engine.level", "FINE",
39            "-/node/heron/logging/org.xmlBlaster.engine.level", "FINE"
40       };
41       
42       Global glob = new Global(args);
43 
44       ContextNode ctx = ContextNode.valueOf("/node/heron");
45       Map props = glob.getProperty().getPropertiesForContextNode(ctx, "logging", "__default");
46       
47       assertEquals("Number of entries found", 2, props.size());
48    }
49 
50 
51    /**
52     * <pre>
53     *  java org.xmlBlaster.test.classtest.PropertyTest
54     * </pre>
55     */
56    public static void main(String args[])
57    {
58       try {
59          PropertyTest testSub = new PropertyTest("PropertyTest");
60          testSub.setUp();
61          testSub.testPropertyStartingWith();
62          testSub.tearDown();
63       }
64       catch(Throwable e) {
65          e.printStackTrace();
66          fail(e.toString());
67       }
68    }
69 }


syntax highlighted by Code2HTML, v. 0.9.1