1 17 18 package org.apache.avalon.fortress.impl.role.test; 19 20 import junit.framework.TestCase; 21 import org.apache.avalon.fortress.MetaInfoEntry; 22 import org.apache.avalon.fortress.MetaInfoManager; 23 24 30 public abstract class AbstractMetaInfoManagerTestCase extends TestCase 31 { 32 private boolean m_informixClassExists = false; 33 protected MetaInfoManager m_manager; 34 35 public AbstractMetaInfoManagerTestCase( String name ) 36 { 37 super( name ); 38 39 try 40 { 41 Class.forName( "org.apache.avalon.excalibur.datasource.InformixDataSource" ); 42 m_informixClassExists = true; 43 } 44 catch ( Exception e ) 45 { 46 m_informixClassExists = false; 47 } 48 } 49 50 protected boolean isInformixClassExists() 51 { 52 return m_informixClassExists; 53 } 54 55 protected void checkRole( final String shortname, 56 final String [] roles, 57 final String className, 58 final String handlerClassname ) 59 throws ClassNotFoundException 60 { 61 final MetaInfoEntry metaEntry = m_manager.getMetaInfoForShortName( shortname ); 62 assertNotNull( "MetaInfoEntry", metaEntry ); 63 64 assertEquals( "componentClass:", 65 metaEntry.getComponentClass(), Class.forName( className ) ); 66 67 for ( int i = 0; i < roles.length; i++ ) 68 { 69 assertTrue( "Role:", metaEntry.containsRole( roles[i] ) ); 70 } 71 assertEquals( "Handler:", 72 metaEntry.getHandlerClass(), Class.forName( handlerClassname ) ); 73 } 74 } 75 | Popular Tags |