avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/pool/test SingleThreadedPoolComparisonProfile.java
Date Sat, 02 Feb 2002 15:16:05 GMT
leif        02/02/02 07:16:05

  Modified:    src/scratchpad/org/apache/avalon/excalibur/pool/test
                        SingleThreadedPoolComparisonProfile.java
  Log:
  Added profile test cases for VariableSizePool and FixedSizePool
  
  Revision  Changes    Path
  1.2       +183 -0    jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/pool/test/SingleThreadedPoolComparisonProfile.java
  
  Index: SingleThreadedPoolComparisonProfile.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/pool/test/SingleThreadedPoolComparisonProfile.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SingleThreadedPoolComparisonProfile.java	2 Feb 2002 15:04:57 -0000	1.1
  +++ SingleThreadedPoolComparisonProfile.java	2 Feb 2002 15:16:05 -0000	1.2
  @@ -9,6 +9,7 @@
   
   import junit.framework.TestCase;
   
  +import org.apache.avalon.excalibur.pool.FixedSizePool;
   import org.apache.avalon.excalibur.pool.HardResourceLimitingPool;
   import org.apache.avalon.excalibur.pool.ObjectFactory;
   import org.apache.avalon.excalibur.pool.Pool;
  @@ -16,6 +17,7 @@
   import org.apache.avalon.excalibur.pool.ResourceLimitingPool;
   import org.apache.avalon.excalibur.pool.SingleThreadedPool;
   import org.apache.avalon.excalibur.pool.SoftResourceLimitingPool;
  +import org.apache.avalon.excalibur.pool.VariableSizePool;
   
   import org.apache.avalon.framework.activity.Disposable;
   import org.apache.avalon.framework.logger.Logger;
  @@ -26,6 +28,7 @@
    *  given a single access thread.
    *
    * @author <a href="mailto:leif@silveregg.co.jp">Leif Mortenson</a>
  + * @version $Id: SingleThreadedPoolComparisonProfile.java,v 1.2 2002/02/02 15:16:05 leif
Exp $
    */
   public class SingleThreadedPoolComparisonProfile
       extends TestCase
  @@ -533,6 +536,186 @@
           generalTest( name, poolA, poolB, 10, poolableClass );
       }
   
  +    /*---------------------------------------------------------------
  +     * FixedSizePool vs ResourceLimitingPool TestCases
  +     *-------------------------------------------------------------*/
  +    /**
  +     * Compare the FixedSizePool and ResourceLimitingPool when the
  +     *  ResourceLimitingPool is configured to act like a FixedSizePool.
  +     * <p>
  +     * Test will use pools with a max size of 10, while getting up to 10 at a time,
  +     *  Poolables are small objects.
  +     */
  +    public void testCompare_FixedSizePool_And_ResourceLimitingPool_Max10_Gets10_SmallPoolables()
  +        throws Exception
  +    {
  +        String name = "FixedSizePool_And_ResourceLimitingPool_Max10_Gets10_SmallPoolables";
  +        
  +        Class         poolableClass = SmallPoolable.class;
  +        ObjectFactory factory = new ClassInstanceObjectFactory( poolableClass, m_poolLogger
);
  +        int           min          = 0;
  +        int           max          = 10;
  +        boolean       maxStrict    = true;
  +        boolean       blocking     = false;
  +        long          blockTimeout = 0;
  +        long          trimInterval = 0;
  +        
  +        FixedSizePool poolA = new FixedSizePool( factory, max );
  +        
  +        ResourceLimitingPool poolB = new ResourceLimitingPool( factory, max, maxStrict,
blocking, blockTimeout, trimInterval );
  +        poolB.enableLogging( m_poolLogger );
  +        
  +        generalTest( name, poolA, poolB, 10, poolableClass );
  +    }
  +    
  +    /**
  +     * Compare the FixedSizePool and ResourceLimitingPool when the
  +     *  ResourceLimitingPool is configured to act like a FixedSizePool.
  +     * <p>
  +     * Test will use pools with a max size of 10, while getting up to 10 at a time,
  +     *  Poolables are medium objects.
  +     */
  +    public void testCompare_FixedSizePool_And_ResourceLimitingPool_Max10_Gets10_MediumPoolables()
  +        throws Exception
  +    {
  +        String name = "FixedSizePool_And_ResourceLimitingPool_Max10_Gets10_MediumPoolables";
  +        
  +        Class         poolableClass = MediumPoolable.class;
  +        ObjectFactory factory = new ClassInstanceObjectFactory( poolableClass, m_poolLogger
);
  +        int           min          = 0;
  +        int           max          = 10;
  +        boolean       maxStrict    = true;
  +        boolean       blocking     = false;
  +        long          blockTimeout = 0;
  +        long          trimInterval = 0;
  +        
  +        FixedSizePool poolA = new FixedSizePool( factory, max );
  +        
  +        ResourceLimitingPool poolB = new ResourceLimitingPool( factory, max, maxStrict,
blocking, blockTimeout, trimInterval );
  +        poolB.enableLogging( m_poolLogger );
  +        
  +        generalTest( name, poolA, poolB, 10, poolableClass );
  +    }
  +    
  +    /**
  +     * Compare the FixedSizePool and ResourceLimitingPool when the
  +     *  ResourceLimitingPool is configured to act like a FixedSizePool.
  +     * <p>
  +     * Test will use pools with a max size of 10, while getting up to 10 at a time,
  +     *  Poolables are large objects.
  +     */
  +    public void testCompare_FixedSizePool_And_ResourceLimitingPool_Max10_Gets10_LargePoolables()
  +        throws Exception
  +    {
  +        String name = "FixedSizePool_And_ResourceLimitingPool_Max10_Gets10_LargePoolables";
  +        
  +        Class         poolableClass = LargePoolable.class;
  +        ObjectFactory factory = new ClassInstanceObjectFactory( poolableClass, m_poolLogger
);
  +        int           min          = 0;
  +        int           max          = 10;
  +        boolean       maxStrict    = true;
  +        boolean       blocking     = false;
  +        long          blockTimeout = 0;
  +        long          trimInterval = 0;
  +        
  +        FixedSizePool poolA = new FixedSizePool( factory, max );
  +        
  +        ResourceLimitingPool poolB = new ResourceLimitingPool( factory, max, maxStrict,
blocking, blockTimeout, trimInterval );
  +        poolB.enableLogging( m_poolLogger );
  +        
  +        generalTest( name, poolA, poolB, 10, poolableClass );
  +    }
  +    
  +    /*---------------------------------------------------------------
  +     * VariableSizePool vs ResourceLimitingPool TestCases
  +     *-------------------------------------------------------------*/
  +    /**
  +     * Compare the VariableSizePool and ResourceLimitingPool when the
  +     *  ResourceLimitingPool is configured to act like a VariableSizePool.
  +     * <p>
  +     * Test will use pools with a max size of 10, while getting up to 10 at a time,
  +     *  Poolables are small objects.
  +     */
  +    public void testCompare_VariableSizePool_And_ResourceLimitingPool_Max10_Gets10_SmallPoolables()
  +        throws Exception
  +    {
  +        String name = "VariableSizePool_And_ResourceLimitingPool_Max10_Gets10_SmallPoolables";
  +        
  +        Class         poolableClass = SmallPoolable.class;
  +        ObjectFactory factory = new ClassInstanceObjectFactory( poolableClass, m_poolLogger
);
  +        int           min          = 0;
  +        int           max          = 10;
  +        boolean       maxStrict    = true;
  +        boolean       blocking     = false;
  +        long          blockTimeout = 0;
  +        long          trimInterval = 0;
  +        
  +        VariableSizePool poolA = new VariableSizePool( factory, max );
  +        
  +        ResourceLimitingPool poolB = new ResourceLimitingPool( factory, max, maxStrict,
blocking, blockTimeout, trimInterval );
  +        poolB.enableLogging( m_poolLogger );
  +        
  +        generalTest( name, poolA, poolB, 10, poolableClass );
  +    }
  +    
  +    /**
  +     * Compare the VariableSizePool and ResourceLimitingPool when the
  +     *  ResourceLimitingPool is configured to act like a VariableSizePool.
  +     * <p>
  +     * Test will use pools with a max size of 10, while getting up to 10 at a time,
  +     *  Poolables are medium objects.
  +     */
  +    public void testCompare_VariableSizePool_And_ResourceLimitingPool_Max10_Gets10_MediumPoolables()
  +        throws Exception
  +    {
  +        String name = "VariableSizePool_And_ResourceLimitingPool_Max10_Gets10_MediumPoolables";
  +        
  +        Class         poolableClass = MediumPoolable.class;
  +        ObjectFactory factory = new ClassInstanceObjectFactory( poolableClass, m_poolLogger
);
  +        int           min          = 0;
  +        int           max          = 10;
  +        boolean       maxStrict    = true;
  +        boolean       blocking     = false;
  +        long          blockTimeout = 0;
  +        long          trimInterval = 0;
  +        
  +        VariableSizePool poolA = new VariableSizePool( factory, max );
  +        
  +        ResourceLimitingPool poolB = new ResourceLimitingPool( factory, max, maxStrict,
blocking, blockTimeout, trimInterval );
  +        poolB.enableLogging( m_poolLogger );
  +        
  +        generalTest( name, poolA, poolB, 10, poolableClass );
  +    }
  +    
  +    /**
  +     * Compare the VariableSizePool and ResourceLimitingPool when the
  +     *  ResourceLimitingPool is configured to act like a VariableSizePool.
  +     * <p>
  +     * Test will use pools with a max size of 10, while getting up to 10 at a time,
  +     *  Poolables are large objects.
  +     */
  +    public void testCompare_VariableSizePool_And_ResourceLimitingPool_Max10_Gets10_LargePoolables()
  +        throws Exception
  +    {
  +        String name = "VariableSizePool_And_ResourceLimitingPool_Max10_Gets10_LargePoolables";
  +        
  +        Class         poolableClass = LargePoolable.class;
  +        ObjectFactory factory = new ClassInstanceObjectFactory( poolableClass, m_poolLogger
);
  +        int           min          = 0;
  +        int           max          = 10;
  +        boolean       maxStrict    = true;
  +        boolean       blocking     = false;
  +        long          blockTimeout = 0;
  +        long          trimInterval = 0;
  +        
  +        VariableSizePool poolA = new VariableSizePool( factory, max );
  +        
  +        ResourceLimitingPool poolB = new ResourceLimitingPool( factory, max, maxStrict,
blocking, blockTimeout, trimInterval );
  +        poolB.enableLogging( m_poolLogger );
  +        
  +        generalTest( name, poolA, poolB, 10, poolableClass );
  +    }
  +    
       /*---------------------------------------------------------------
        * Test Classes
        *-------------------------------------------------------------*/
  
  
  

--
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