01: package org.codehaus.spice.netserve.connection.impl;
02:
03: import junit.framework.TestCase;
04: import org.apache.avalon.framework.configuration.DefaultConfiguration;
05: import org.apache.avalon.framework.logger.ConsoleLogger;
06:
07: public class AvalonAcceptorManagerTestCase extends TestCase {
08: public void testAvalonAcceptorManager() throws Exception {
09: final AvalonAcceptorManager manager = new AvalonAcceptorManager();
10: final DefaultConfiguration root = new DefaultConfiguration(
11: "root", "");
12: final DefaultConfiguration configuration = new DefaultConfiguration(
13: "shutdownTimeout", "");
14: configuration.setValue("22");
15: root.addChild(configuration);
16:
17: final ConsoleLogger logger = new ConsoleLogger(
18: ConsoleLogger.LEVEL_DISABLED);
19: manager.enableLogging(logger);
20: final AcceptorMonitor monitor = manager.getMonitor();
21: assertTrue("getMonitor() instanceof AvalonAcceptorMonitor",
22: monitor instanceof AvalonAcceptorMonitor);
23: final AvalonAcceptorMonitor dnaMonitor = (AvalonAcceptorMonitor) monitor;
24: assertEquals("logger", logger, dnaMonitor.getLogger());
25: manager.configure(root);
26: assertEquals("getShutdownTimeout()", 22, manager
27: .getShutdownTimeout());
28: manager.initialize();
29: manager.dispose();
30: }
31: }
|