1 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 21 public class LogKitManagementTestCase 22 extends ExcaliburTestCase 23 { 24 25 public static void main( final String [] args ) throws Exception 26 { 27 final String [] testCaseName = { LogKitManagementTestCase.class.getName() }; 28 TestRunner.main( testCaseName ); 29 } 30 31 public LogKitManagementTestCase( final String name ) 32 { 33 super( name ); 34 } 35 36 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 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 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 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 |