You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by co...@apache.org on 2002/04/03 12:36:02 UTC

cvs commit: jakarta-avalon-excalibur/cache/src/test/org/apache/avalon/excalibur/cache/validator/test TimeoutValidatorTestCase.java

colus       02/04/03 02:36:02

  Modified:    cache/src/java/org/apache/avalon/excalibur/cache
                        LRUCache.java TimeMapLRUCache.java
               cache/src/test/org/apache/avalon/excalibur/cache/validator/test
                        TimeoutValidatorTestCase.java
  Added:       cache/src/java/org/apache/avalon/excalibur/cache/impl
                        LRUCache.java TimeMapLRUCache.java
               cache/src/test/org/apache/avalon/excalibur/cache/impl/test
                        AbstractCacheTestCase.java LRUCacheTestCase.java
                        TimeMapLRUCacheTestCase.java
  Removed:     cache/src/test/org/apache/avalon/excalibur/cache/test
                        AbstractCacheTestCase.java LRUCacheTestCase.java
                        TimeMapLRUCacheTestCase.java
  Log:
  Solve circular package dependency.
  
  Revision  Changes    Path
  1.7       +5 -7      jakarta-avalon-excalibur/cache/src/java/org/apache/avalon/excalibur/cache/LRUCache.java
  
  Index: LRUCache.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/cache/src/java/org/apache/avalon/excalibur/cache/LRUCache.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- LRUCache.java	27 Jan 2002 05:01:01 -0000	1.6
  +++ LRUCache.java	3 Apr 2002 10:36:02 -0000	1.7
  @@ -7,25 +7,23 @@
    */
   package org.apache.avalon.excalibur.cache;
   
  -import org.apache.avalon.excalibur.cache.policy.LRUPolicy;
  -import org.apache.avalon.excalibur.cache.store.MemoryStore;
  -
   /**
    * LRUCache.
    *
    * @author <a href="mailto:colus@apache.org">Eung-ju Park</a>
  - * @version $Revision: 1.6 $ $Date: 2002/01/27 05:01:01 $
  + * @version $Revision: 1.7 $ $Date: 2002/04/03 10:36:02 $
  + * @deprecated Use org.apache.avalon.excalibur.cache.impl.LRUCache
    */
   public class LRUCache
  -    extends DefaultCache
  +    extends org.apache.avalon.excalibur.cache.impl.LRUCache
   {
       public LRUCache( final int capacity )
       {
  -        this( new MemoryStore( capacity ) );
  +        super( capacity );
       }
   
       public LRUCache( final CacheStore store )
       {
  -        super( new LRUPolicy(), store );
  +        super( store );
       }
   }
  
  
  
  1.2       +4 -6      jakarta-avalon-excalibur/cache/src/java/org/apache/avalon/excalibur/cache/TimeMapLRUCache.java
  
  Index: TimeMapLRUCache.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/cache/src/java/org/apache/avalon/excalibur/cache/TimeMapLRUCache.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TimeMapLRUCache.java	28 Jan 2002 07:28:17 -0000	1.1
  +++ TimeMapLRUCache.java	3 Apr 2002 10:36:02 -0000	1.2
  @@ -7,24 +7,22 @@
    */
   package org.apache.avalon.excalibur.cache;
   
  -import org.apache.avalon.excalibur.cache.policy.TimeMapLRUPolicy;
  -import org.apache.avalon.excalibur.cache.store.MemoryStore;
  -
   /**
    * TimeMapLRUCache.
    *
    * @author <a href="alag@users.sourceforge.net">Alexis Agahi</a>
  + * @deprecated Use org.apache.avalon.excalibur.cache.impl.TimeMapLRUCache
    */
   public class TimeMapLRUCache
  -    extends DefaultCache
  +    extends org.apache.avalon.excalibur.cache.impl.TimeMapLRUCache
   {
       public TimeMapLRUCache( final int capacity )
       {
  -        this( new MemoryStore( capacity ) );
  +        super( capacity );
       }
   
       public TimeMapLRUCache( final CacheStore store )
       {
  -        super( new TimeMapLRUPolicy(), store );
  +        super( store );
       }
   }
  
  
  
  1.1                  jakarta-avalon-excalibur/cache/src/java/org/apache/avalon/excalibur/cache/impl/LRUCache.java
  
  Index: LRUCache.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included  with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.avalon.excalibur.cache.impl;
  
  import org.apache.avalon.excalibur.cache.CacheStore;
  import org.apache.avalon.excalibur.cache.DefaultCache;
  import org.apache.avalon.excalibur.cache.policy.LRUPolicy;
  import org.apache.avalon.excalibur.cache.store.MemoryStore;
  
  /**
   * LRUCache.
   *
   * @author <a href="mailto:colus@apache.org">Eung-ju Park</a>
   * @version $Revision: 1.1 $ $Date: 2002/04/03 10:36:02 $
   */
  public class LRUCache
      extends DefaultCache
  {
      public LRUCache( final int capacity )
      {
          this( new MemoryStore( capacity ) );
      }
  
      public LRUCache( final CacheStore store )
      {
          super( new LRUPolicy(), store );
      }
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/cache/src/java/org/apache/avalon/excalibur/cache/impl/TimeMapLRUCache.java
  
  Index: TimeMapLRUCache.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included  with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.avalon.excalibur.cache.impl;
  
  import org.apache.avalon.excalibur.cache.CacheStore;
  import org.apache.avalon.excalibur.cache.DefaultCache;
  import org.apache.avalon.excalibur.cache.policy.TimeMapLRUPolicy;
  import org.apache.avalon.excalibur.cache.store.MemoryStore;
  
  /**
   * TimeMapLRUCache.
   *
   * @author <a href="alag@users.sourceforge.net">Alexis Agahi</a>
   * @version $Revision: 1.1 $ $Date: 2002/04/03 10:36:02 $
   */
  public class TimeMapLRUCache
      extends DefaultCache
  {
      public TimeMapLRUCache( final int capacity )
      {
          this( new MemoryStore( capacity ) );
      }
  
      public TimeMapLRUCache( final CacheStore store )
      {
          super( new TimeMapLRUPolicy(), store );
      }
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/cache/src/test/org/apache/avalon/excalibur/cache/impl/test/AbstractCacheTestCase.java
  
  Index: AbstractCacheTestCase.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included  with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.avalon.excalibur.cache.impl.test;
  
  import junit.framework.TestCase;
  import org.apache.avalon.excalibur.cache.Cache;
  
  /**
   * TestCase for Cache.
   *
   * @author <a href="mailto:colus@apache.org">Eung-ju Park</a>
   */
  public class AbstractCacheTestCase
      extends TestCase
  {
      protected static final int STORE_SIZE = 10;
  
      protected Cache m_cache;
  
      public AbstractCacheTestCase( final String name )
      {
          super( name );
      }
  
      public void testPut()
      {
          for ( int i = 0; i < STORE_SIZE * 2; i++ )
          {
              m_cache.put( "KEY" + i, "VALUE" + i );
              if ( i < STORE_SIZE )
              {
                  assertEquals( i + 1, m_cache.size() );
              }
              else
              {
                  assertEquals( STORE_SIZE, m_cache.size() );
              }
          }
      }
  
      public void testPutNull()
      {
          m_cache.put( null, "VALUE" );
          assertEquals( 0, m_cache.size() );
  
          m_cache.put( "KEY", null );
          assertEquals( 0, m_cache.size() );
  
          m_cache.put( null, null );
          assertEquals( 0, m_cache.size() );
      }
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/cache/src/test/org/apache/avalon/excalibur/cache/impl/test/LRUCacheTestCase.java
  
  Index: LRUCacheTestCase.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included  with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.avalon.excalibur.cache.impl.test;
  
  import org.apache.avalon.excalibur.cache.LRUCache;
  
  /**
   * TestCase for LRUCache.
   *
   * @author <a href="mailto:colus@apache.org">Eung-ju Park</a>
   */
  public class LRUCacheTestCase
      extends AbstractCacheTestCase
  {
      public LRUCacheTestCase( final String name )
      {
          super( name );
      }
  
      protected void setUp()
      {
          m_cache = new LRUCache( STORE_SIZE );
      }
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/cache/src/test/org/apache/avalon/excalibur/cache/impl/test/TimeMapLRUCacheTestCase.java
  
  Index: TimeMapLRUCacheTestCase.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included  with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.avalon.excalibur.cache.impl.test;
  
  import org.apache.avalon.excalibur.cache.Cache;
  import org.apache.avalon.excalibur.cache.TimeMapLRUCache;
  
  /**
   * TestCase for TimeMapLRUCache
  
   * @author <a href="alag@users.sourceforge.net">Alexis Agahi</a>
   */
  public class TimeMapLRUCacheTestCase
      extends AbstractCacheTestCase
  {
      public TimeMapLRUCacheTestCase( final String name )
      {
          super( name );
      }
  
      protected void setUp()
      {
          m_cache = new TimeMapLRUCache( STORE_SIZE );
      }
  }
  
  
  
  1.7       +1 -1      jakarta-avalon-excalibur/cache/src/test/org/apache/avalon/excalibur/cache/validator/test/TimeoutValidatorTestCase.java
  
  Index: TimeoutValidatorTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/cache/src/test/org/apache/avalon/excalibur/cache/validator/test/TimeoutValidatorTestCase.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TimeoutValidatorTestCase.java	30 Mar 2002 16:33:31 -0000	1.6
  +++ TimeoutValidatorTestCase.java	3 Apr 2002 10:36:02 -0000	1.7
  @@ -9,8 +9,8 @@
   
   import junit.framework.TestCase;
   import org.apache.avalon.excalibur.cache.Cache;
  -import org.apache.avalon.excalibur.cache.LRUCache;
   import org.apache.avalon.excalibur.cache.ValidatingCache;
  +import org.apache.avalon.excalibur.cache.impl.LRUCache;
   import org.apache.avalon.excalibur.cache.validator.TimeoutValidator;
   
   /**
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>