KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > inversoft > verge > config > test > TestConfigBuilder2


1 /*
2  * Copyright (c) 2003, Inversoft
3  *
4  * This software is distribuable under the GNU Lesser General Public License.
5  * For more information visit gnu.org.
6  */

7 package com.inversoft.verge.config.test;
8
9
10 import java.util.Map JavaDoc;
11
12 import junit.framework.Assert;
13
14 import org.jdom.Document;
15
16 import com.inversoft.config.ConfigBuilder;
17 import com.inversoft.config.ConfigRegistry;
18 import com.inversoft.config.ConfigurationException;
19
20
21 /**
22  * <p>
23  * This class is a test implementation of the config builder
24  * </p>
25  *
26  * @author Brian Pontarelli
27  * @since 2.0
28  * @version 2.0
29  */

30 public class TestConfigBuilder2 implements ConfigBuilder {
31
32     public static ConfigBuilder INSTANCE = new TestConfigBuilder2();
33
34     /**
35      */

36     public void build(Document document, ConfigRegistry registry)
37     throws ConfigurationException {
38         if (TestConfigFactory2.createRegistry) {
39             Assert.assertTrue("Should be new registry",
40                 registry != TestConfigRegistry2.INSTANCE);
41         } else if (TestConfigFactory2.nullRegistry) {
42             Assert.assertTrue("Should be null registry",
43                 registry == null);
44         } else {
45             Assert.assertTrue("Should be instance registry",
46                 registry == TestConfigRegistry2.INSTANCE);
47         }
48     }
49
50     /**
51      */

52     public void rebuild(Document document, ConfigRegistry registry)
53     throws ConfigurationException {
54         if (TestConfigFactory2.createRegistry) {
55             Assert.assertTrue("Should be new registry",
56                 registry != TestConfigRegistry2.INSTANCE);
57         } else if (TestConfigFactory2.nullRegistry) {
58             Assert.assertTrue("Should be null registry",
59                 registry == null);
60         } else {
61             Assert.assertTrue("Should be instance registry",
62                 registry == TestConfigRegistry2.INSTANCE);
63         }
64     }
65
66     /**
67      */

68     public void validate(ConfigRegistry registry, Map JavaDoc registries)
69     throws ConfigurationException {
70         if (TestConfigFactory2.createRegistry) {
71             Assert.assertTrue("Should be new registry",
72                 registry != TestConfigRegistry2.INSTANCE);
73         } else if (TestConfigFactory2.nullRegistry) {
74             Assert.assertTrue("Should be null registry", registry == null);
75         } else {
76             Assert.assertTrue("Should be instance registry",
77                 registry == TestConfigRegistry2.INSTANCE);
78         }
79     }
80
81     /**
82      */

83     public void commit(ConfigRegistry registry, Map JavaDoc otherRegistries) {
84     }
85 }
Popular Tags