avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/component/src/test/org/apache/avalon/excalibur/component/test PoolableComponentHandlerTestCase.java
Date Tue, 12 Nov 2002 21:57:45 GMT
donaldp     2002/11/12 13:57:45

  Modified:    component/src/test/org/apache/avalon/excalibur/component/test
                        PoolableComponentHandlerTestCase.java
  Log:
  Update test case to new testcase API and remove access to all protected variables.
  
  Revision  Changes    Path
  1.2       +28 -38    jakarta-avalon-excalibur/component/src/test/org/apache/avalon/excalibur/component/test/PoolableComponentHandlerTestCase.java
  
  Index: PoolableComponentHandlerTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/component/src/test/org/apache/avalon/excalibur/component/test/PoolableComponentHandlerTestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PoolableComponentHandlerTestCase.java	4 Apr 2002 05:09:02 -0000	1.1
  +++ PoolableComponentHandlerTestCase.java	12 Nov 2002 21:57:45 -0000	1.2
  @@ -10,7 +10,6 @@
   import org.apache.avalon.excalibur.component.PoolableComponentHandler;
   import org.apache.avalon.excalibur.testcase.BufferedLogger;
   import org.apache.avalon.excalibur.testcase.ExcaliburTestCase;
  -import org.apache.avalon.framework.component.ComponentManager;
   
   /**
    * Test the PoolableComponentHandler.
  @@ -33,15 +32,6 @@
       /*---------------------------------------------------------------
        * Methods
        *-------------------------------------------------------------*/
  -    /**
  -     * Inner access method to manager to work around a bug in the Javac compiler
  -     *  when manager is referenced from the method of an inner class.  Jikes seems to
  -     *  handle it Ok. :-/
  -     */
  -    private ComponentManager getInnerManager()
  -    {
  -        return manager;
  -    }
   
       /*---------------------------------------------------------------
        * TestCase Methods
  @@ -79,13 +69,13 @@
           for( int i = 0; i < size; i++ )
           {
               poolables[ i ] =
  -                (PoolableTestObject)manager.lookup( PoolableTestObject.ROLE + "_" + name
);
  +                (PoolableTestObject)lookup( PoolableTestObject.ROLE + "_" + name );
           }
   
           // Release the components.
           for( int i = 0; i < size; i++ )
           {
  -            manager.release( poolables[ i ] );
  +            release( poolables[ i ] );
               poolables[ i ] = null;
           }
   
  @@ -93,13 +83,13 @@
           for( int i = 0; i < size; i++ )
           {
               poolables[ i ] =
  -                (PoolableTestObject)manager.lookup( PoolableTestObject.ROLE + "_" + name
);
  +                (PoolableTestObject)lookup( PoolableTestObject.ROLE + "_" + name );
           }
   
           // Release the components.
           for( int i = 0; i < size; i++ )
           {
  -            manager.release( poolables[ i ] );
  +            release( poolables[ i ] );
               poolables[ i ] = null;
           }
   
  @@ -168,13 +158,13 @@
           for( int i = 0; i < size; i++ )
           {
               poolables[ i ] =
  -                (PoolableTestObject)manager.lookup( PoolableTestObject.ROLE + "_" + name
);
  +                (PoolableTestObject)lookup( PoolableTestObject.ROLE + "_" + name );
           }
   
           // Release the components.
           for( int i = 0; i < size; i++ )
           {
  -            manager.release( poolables[ i ] );
  +            release( poolables[ i ] );
               poolables[ i ] = null;
           }
   
  @@ -182,13 +172,13 @@
           for( int i = 0; i < size; i++ )
           {
               poolables[ i ] =
  -                (PoolableTestObject)manager.lookup( PoolableTestObject.ROLE + "_" + name
);
  +                (PoolableTestObject)lookup( PoolableTestObject.ROLE + "_" + name );
           }
   
           // Release the components.
           for( int i = 0; i < size; i++ )
           {
  -            manager.release( poolables[ i ] );
  +            release( poolables[ i ] );
               poolables[ i ] = null;
           }
   
  @@ -238,13 +228,13 @@
           for( int i = 0; i < size; i++ )
           {
               poolables[ i ] =
  -                (PoolableTestObject)manager.lookup( PoolableTestObject.ROLE + "_" + name
);
  +                (PoolableTestObject)lookup( PoolableTestObject.ROLE + "_" + name );
           }
   
           // Try to get one more.  Should fail.
           try
           {
  -            manager.lookup( PoolableTestObject.ROLE + "_" + name );
  +            lookup( PoolableTestObject.ROLE + "_" + name );
               fail( "Attempt to get more Pollables than are in the pool should have failed."
);
           }
           catch( Exception e )
  @@ -255,7 +245,7 @@
           // Release the components.
           for( int i = 0; i < size; i++ )
           {
  -            manager.release( poolables[ i ] );
  +            release( poolables[ i ] );
               poolables[ i ] = null;
           }
   
  @@ -298,7 +288,7 @@
           for( int i = 0; i < size; i++ )
           {
               poolables[ i ] =
  -                (PoolableTestObject)manager.lookup( PoolableTestObject.ROLE + "_" + name
);
  +                (PoolableTestObject)lookup( PoolableTestObject.ROLE + "_" + name );
           }
   
           // In another thread, get and release another poolable to cause this one to wait.
  @@ -310,7 +300,7 @@
                   {
                       logger.debug( "Lookup in second thread." );
                       PoolableTestObject poolable =
  -                        (PoolableTestObject)getInnerManager().lookup( PoolableTestObject.ROLE
+ "_" + name );
  +                        (PoolableTestObject)lookup( PoolableTestObject.ROLE + "_" + name
);
   
                       // Give the main thread a chance to block
                       try
  @@ -322,7 +312,7 @@
                       }
   
                       logger.debug( "Release in second thread." );
  -                    getInnerManager().release( poolable );
  +                    release( poolable );
                   }
                   catch( Exception e )
                   {
  @@ -343,15 +333,15 @@
           // Try to get one more.  Should block until the other thread has put it back.
           logger.debug( "Lookup in main thread." );
           PoolableTestObject poolable =
  -            (PoolableTestObject)manager.lookup( PoolableTestObject.ROLE + "_" + name );
  +            (PoolableTestObject)lookup( PoolableTestObject.ROLE + "_" + name );
   
           logger.debug( "Release in main thread." );
  -        manager.release( poolable );
  +        release( poolable );
   
           // Release the components.
           for( int i = 0; i < size; i++ )
           {
  -            manager.release( poolables[ i ] );
  +            release( poolables[ i ] );
               poolables[ i ] = null;
           }
   
  @@ -399,14 +389,14 @@
           for( int i = 0; i < size; i++ )
           {
               poolables[ i ] =
  -                (PoolableTestObject)manager.lookup( PoolableTestObject.ROLE + "_" + name
);
  +                (PoolableTestObject)lookup( PoolableTestObject.ROLE + "_" + name );
           }
   
           // Try to get one more.  Should fail after 500 milliseconds.
           long start = System.currentTimeMillis();
           try
           {
  -            manager.lookup( PoolableTestObject.ROLE + "_" + name );
  +            lookup( PoolableTestObject.ROLE + "_" + name );
               fail( "Attempt to get more Pollables than are in the pool should have failed."
);
           }
           catch( Exception e )
  @@ -420,7 +410,7 @@
           // Release the components.
           for( int i = 0; i < size; i++ )
           {
  -            manager.release( poolables[ i ] );
  +            release( poolables[ i ] );
               poolables[ i ] = null;
           }
   
  @@ -458,21 +448,21 @@
           for( int i = 0; i < 4; i++ )
           {
               poolables[ i ] =
  -                (PoolableTestObject)manager.lookup( PoolableTestObject.ROLE + "_" + name
);
  +                (PoolableTestObject)lookup( PoolableTestObject.ROLE + "_" + name );
           }
           for( int i = 0; i < 4; i++ )
           {
  -            manager.release( poolables[ i ] );
  +            release( poolables[ i ] );
               poolables[ i ] = null;
           }
           for( int i = 0; i < 4; i++ )
           {
               poolables[ i ] =
  -                (PoolableTestObject)manager.lookup( PoolableTestObject.ROLE + "_" + name
);
  +                (PoolableTestObject)lookup( PoolableTestObject.ROLE + "_" + name );
           }
           for( int i = 0; i < 4; i++ )
           {
  -            manager.release( poolables[ i ] );
  +            release( poolables[ i ] );
               poolables[ i ] = null;
           }
   
  @@ -489,11 +479,11 @@
           for( int i = 0; i < 2; i++ )
           {
               poolables[ i ] =
  -                (PoolableTestObject)manager.lookup( PoolableTestObject.ROLE + "_" + name
);
  +                (PoolableTestObject)lookup( PoolableTestObject.ROLE + "_" + name );
           }
           for( int i = 0; i < 2; i++ )
           {
  -            manager.release( poolables[ i ] );
  +            release( poolables[ i ] );
               poolables[ i ] = null;
           }
   
  @@ -512,11 +502,11 @@
           for( int i = 0; i < 4; i++ )
           {
               poolables[ i ] =
  -                (PoolableTestObject)manager.lookup( PoolableTestObject.ROLE + "_" + name
);
  +                (PoolableTestObject)lookup( PoolableTestObject.ROLE + "_" + name );
           }
           for( int i = 0; i < 4; i++ )
           {
  -            manager.release( poolables[ i ] );
  +            release( poolables[ i ] );
               poolables[ i ] = null;
           }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message