stephan     2003/12/12 01:41:02

  Modified:    component/src/java/org/apache/avalon/excalibur/testcase
                        ExcaliburTestCase.java
  Log:
  Fixing bug 16446 by myself.
  ExcaliburTestCase.class.getMethods() delivers not the test methods.
  
  Revision  Changes    Path
  1.2       +10 -11    
avalon-excalibur/component/src/java/org/apache/avalon/excalibur/testcase/ExcaliburTestCase.java
  
  Index: ExcaliburTestCase.java
  ===================================================================
  RCS file: 
/home/cvs/avalon-excalibur/component/src/java/org/apache/avalon/excalibur/testcase/ExcaliburTestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ExcaliburTestCase.java    9 Nov 2003 12:45:27 -0000       1.1
  +++ ExcaliburTestCase.java    12 Dec 2003 09:41:02 -0000      1.2
  @@ -281,12 +281,11 @@
       {
           super( name );
   
  -        ArrayList methodList = (ArrayList)ExcaliburTestCase.m_tests.get( 
ExcaliburTestCase.class );
  -
  -        Method[] methods = ExcaliburTestCase.class.getMethods();
  +        ArrayList methodList = (ArrayList)ExcaliburTestCase.m_tests.get( getClass() 
);
   
           if( null == methodList )
           {
  +            Method[] methods = getClass().getMethods();
               methodList = new ArrayList( methods.length );
   
               for( int i = 0; i < methods.length; i++ )
  @@ -301,7 +300,7 @@
                   }
               }
   
  -            ExcaliburTestCase.m_tests.put( ExcaliburTestCase.class, methodList );
  +            ExcaliburTestCase.m_tests.put( getClass(), methodList );
           }
       }
   
  @@ -326,8 +325,8 @@
       protected void prepare()
           throws Exception
       {
  -        final String resourceName = ExcaliburTestCase.class.getName().replace( '.', 
'/' ) + ".xtest";
  -        URL resource = ExcaliburTestCase.class.getClassLoader().getResource( 
resourceName );
  +        final String resourceName = getClass().getName().replace( '.', '/' ) + 
".xtest";
  +        URL resource = getClass().getClassLoader().getResource( resourceName );
   
           if( resource != null )
           {
  @@ -409,7 +408,7 @@
        */
       final public void run( TestResult result )
       {
  -        ArrayList methodList = (ArrayList)ExcaliburTestCase.m_tests.get( 
ExcaliburTestCase.class );
  +        ArrayList methodList = (ArrayList)ExcaliburTestCase.m_tests.get( getClass() 
);
   
           if( null == methodList || methodList.isEmpty() )
           {
  @@ -417,7 +416,7 @@
           }
   
           // Set the logger for the initialization phase.
  -        setCurrentLogger( getBaseClassName( ExcaliburTestCase.class ) );
  +        setCurrentLogger( getBaseClassName( getClass() ) );
   
           try
           {
  @@ -480,7 +479,7 @@
           }
   
           methodList.clear();
  -        ExcaliburTestCase.m_tests.put( ExcaliburTestCase.class, methodList );
  +        ExcaliburTestCase.m_tests.put( getClass(), methodList );
       }
   
       /**
  @@ -541,7 +540,7 @@
               if( value == null )
               {
                   String clazz = confs[ i ].getAttribute( "class" );
  -                Object obj = ExcaliburTestCase.class.getClassLoader().loadClass( 
clazz ).newInstance();
  +                Object obj = getClass().getClassLoader().loadClass( clazz 
).newInstance();
                   context.put( key, obj );
                   if( getLogger().isInfoEnabled() )
                       getLogger().info( "ExcaliburTestCase: added an instance of 
class " + clazz + " to context entry " + key );
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to