01: package org.jgroups.tests;
02:
03: import junit.framework.TestCase;
04: import org.apache.commons.logging.Log;
05: import org.apache.commons.logging.LogFactory;
06: import org.jgroups.conf.XmlConfigurator;
07: import org.jgroups.util.Util;
08:
09: import java.io.InputStream;
10:
11: public class XmlConfigurationTest extends TestCase {
12:
13: protected Log log = LogFactory.getLog(getClass());
14:
15: public XmlConfigurationTest(String Name_) {
16: super (Name_);
17: }
18:
19: public void testBasic() {
20: try {
21: InputStream default_config = Util.getResourceAsStream(
22: "udp.xml", this .getClass());
23: XmlConfigurator conf = XmlConfigurator
24: .getInstance(default_config);
25: if (log.isDebugEnabled())
26: log.debug(conf.getProtocolStackString());
27: assertTrue(
28: "Successfully parsed a valid XML configuration file.",
29: true);
30: } catch (Exception x) {
31: fail(x.getMessage());
32: }
33: }
34:
35: public static void main(String[] args) {
36: String[] testCaseName = { XmlConfigurationTest.class.getName() };
37: junit.swingui.TestRunner.main(testCaseName);
38: }
39:
40: }
|