|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| package org.jconfig; |
|
9 |
| |
|
10 |
| import junit.framework.Test; |
|
11 |
| import junit.framework.TestCase; |
|
12 |
| import junit.framework.TestSuite; |
|
13 |
| |
|
14 |
| import org.jconfig.event.CategoryChangedEvent; |
|
15 |
| import org.jconfig.event.ConfigurationChangedEvent; |
|
16 |
| import org.jconfig.event.PropertyChangedEvent; |
|
17 |
| import org.jconfig.parser.DefaultConfigParser; |
|
18 |
| |
|
19 |
| |
|
20 |
| |
|
21 |
| |
|
22 |
| public class DefaultConfigEventTest extends TestCase { |
|
23 |
| |
|
24 |
| private Configuration cfg; |
|
25 |
| |
|
26 |
0
| public DefaultConfigEventTest(java.lang.String testName) {
|
|
27 |
0
| super(testName);
|
|
28 |
| } |
|
29 |
| |
|
30 |
0
| protected void setUp() {
|
|
31 |
0
| System.setProperty("jconfig.parser", DefaultConfigParser.class.getName());
|
|
32 |
0
| cfg = new DefaultConfiguration("ConfigurationTest");
|
|
33 |
0
| assertNotNull(cfg);
|
|
34 |
| } |
|
35 |
| |
|
36 |
0
| public static Test suite() {
|
|
37 |
0
| TestSuite suite = new TestSuite(DefaultConfigEventTest.class);
|
|
38 |
0
| return suite;
|
|
39 |
| } |
|
40 |
| |
|
41 |
0
| public void testPropertyListener() {
|
|
42 |
0
| MockPropListener mpl = new MockPropListener();
|
|
43 |
0
| cfg.addPropertyListener(mpl,"test");
|
|
44 |
0
| cfg.setProperty("testName","testValue","test");
|
|
45 |
0
| PropertyChangedEvent e = mpl.getEvent();
|
|
46 |
0
| assertNotNull(e);
|
|
47 |
| } |
|
48 |
| |
|
49 |
0
| public void testCategoryListener() {
|
|
50 |
0
| MockCatListener listener = new MockCatListener();
|
|
51 |
0
| cfg.addCategoryListener(listener,"test");
|
|
52 |
0
| cfg.setProperty("testName","testValue","test");
|
|
53 |
0
| CategoryChangedEvent e = listener.getCategoryChangedEvent();
|
|
54 |
0
| assertNotNull(e);
|
|
55 |
| } |
|
56 |
| |
|
57 |
0
| public void testConfListener() {
|
|
58 |
0
| MockConfListener listener = new MockConfListener();
|
|
59 |
0
| cfg.addConfigurationListener(listener);
|
|
60 |
0
| cfg.setProperty("testName","testValue","test");
|
|
61 |
0
| ConfigurationChangedEvent e = listener.getConfigurationChangedEvent();
|
|
62 |
0
| assertNotNull(e);
|
|
63 |
| } |
|
64 |
| } |