KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > avalon > excalibur > logger > test > LogKitManagementTestCase


1 /*
2  * Copyright (C) The Apache Software Foundation. All rights reserved.
3  *
4  * This software is published under the terms of the Apache Software License
5  * version 1.1, a copy of which has been included with this distribution in
6  * the LICENSE.txt file.
7  */

8 package org.apache.avalon.excalibur.logger.test;
9
10 import org.apache.avalon.excalibur.testcase.ExcaliburTestCase;
11 import org.apache.avalon.excalibur.testcase.CascadingAssertionFailedError;
12
13 import junit.swingui.TestRunner;
14
15 /**
16  * LogKitManagementTest.
17  *
18  * @author <a HREF="mailto:giacomo@apache,org">Giacomo Pati</a>
19  * @version CVS $Revision: 1.7 $ $Date: 2001/12/11 09:53:39 $
20  */

21 public class LogKitManagementTestCase
22     extends ExcaliburTestCase
23 {
24
25     public static void main( final String JavaDoc [] args ) throws Exception JavaDoc
26     {
27         final String JavaDoc[] testCaseName = { LogKitManagementTestCase.class.getName() };
28         TestRunner.main( testCaseName );
29     }
30
31     public LogKitManagementTestCase( final String JavaDoc name )
32     {
33         super( name );
34     }
35
36     /*
37     public void setUp()
38         throws Exception
39     {
40         m_logPriority = Priority.DEBUG;
41         super.setUp();
42     }
43     */

44
45     public void testComponent()
46         throws CascadingAssertionFailedError
47     {
48         TestComponent tc = null;
49
50         try
51         {
52             tc = (TestComponent) manager.lookup( TestComponent.ROLE + "/A" );
53             tc.test( getLogEnabledLogger(), "Test log entry A" );
54         }
55         catch ( Exception JavaDoc e)
56         {
57             throw new CascadingAssertionFailedError( "There was an error in the LogKitManagement test", e );
58         }
59         finally
60         {
61             assertTrue( "The test component could not be retrieved.", null != tc );
62             manager.release( tc );
63         }
64
65         try
66         {
67             tc = (TestComponent) manager.lookup( TestComponent.ROLE + "/B" );
68             tc.test( getLogEnabledLogger(), "Test log entry B" );
69         }
70         catch ( Exception JavaDoc e)
71         {
72             throw new CascadingAssertionFailedError( "There was an error in the LogKitManagement test", e );
73         }
74         finally
75         {
76             assertTrue( "The test component could not be retrieved.", null != tc );
77             manager.release( tc );
78         }
79
80         try
81         {
82             tc = (TestComponent) manager.lookup( TestComponent.ROLE + "/C" );
83             tc.test( getLogEnabledLogger(), "Test log entry C" );
84         }
85         catch ( Exception JavaDoc e)
86         {
87             throw new CascadingAssertionFailedError( "There was an error in the LogKitManagement test", e );
88         }
89         finally
90         {
91             assertTrue( "The test component could not be retrieved.", null != tc );
92             manager.release( tc );
93         }
94     }
95 }
96
Popular Tags