colus 02/03/30 08:34:15
Modified: cache/src/test/org/apache/avalon/excalibur/cache/store/test
AbstractCacheStoreTestCase.java
FlipSpacesStoreTestCase.java
MemoryStoreTestCase.java
cache/src/test/org/apache/avalon/excalibur/cache/test
AbstractCacheTestCase.java LRUCacheTestCase.java
TimeMapLRUCacheTestCase.java
Log:
Added some testcases.
Revision Changes Path
1.4 +13 -0
jakarta-avalon-excalibur/cache/src/test/org/apache/avalon/excalibur/cache/store/test/AbstractCacheStoreTestCase.java
Index: AbstractCacheStoreTestCase.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/cache/src/test/org/apache/avalon/excalibur/cache/store/test/AbstractCacheStoreTestCase.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AbstractCacheStoreTestCase.java 30 Mar 2002 07:24:19 -0000 1.3
+++ AbstractCacheStoreTestCase.java 30 Mar 2002 16:34:15 -0000 1.4
@@ -18,10 +18,23 @@
public class AbstractCacheStoreTestCase
extends TestCase
{
+ protected static final int STORE_SIZE = 10;
+
protected CacheStore m_store;
public AbstractCacheStoreTestCase( final String name )
{
super( name );
+ }
+
+ public void testIsFull()
+ {
+ for ( int i = 0; i < STORE_SIZE - 1; i++ )
+ {
+ m_store.put( "KEY" + i , "VALUE" + i );
+ assertTrue( ! m_store.isFull() );
+ }
+ m_store.put( "KEY" + STORE_SIZE, "VALUE" + STORE_SIZE );
+ assertTrue( m_store.isFull() );
}
}
1.3 +1 -1
jakarta-avalon-excalibur/cache/src/test/org/apache/avalon/excalibur/cache/store/test/FlipSpacesStoreTestCase.java
Index: FlipSpacesStoreTestCase.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/cache/src/test/org/apache/avalon/excalibur/cache/store/test/FlipSpacesStoreTestCase.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FlipSpacesStoreTestCase.java 16 Mar 2002 00:05:44 -0000 1.2
+++ FlipSpacesStoreTestCase.java 30 Mar 2002 16:34:15 -0000 1.3
@@ -24,6 +24,6 @@
protected void setUp()
{
- m_store = new FlipSpacesStore( 10 );
+ m_store = new FlipSpacesStore( STORE_SIZE );
}
}
1.3 +1 -1
jakarta-avalon-excalibur/cache/src/test/org/apache/avalon/excalibur/cache/store/test/MemoryStoreTestCase.java
Index: MemoryStoreTestCase.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/cache/src/test/org/apache/avalon/excalibur/cache/store/test/MemoryStoreTestCase.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MemoryStoreTestCase.java 16 Mar 2002 00:05:44 -0000 1.2
+++ MemoryStoreTestCase.java 30 Mar 2002 16:34:15 -0000 1.3
@@ -24,6 +24,6 @@
protected void setUp()
{
- m_store = new MemoryStore( 10 );
+ m_store = new MemoryStore( STORE_SIZE );
}
}
1.4 +30 -0
jakarta-avalon-excalibur/cache/src/test/org/apache/avalon/excalibur/cache/test/AbstractCacheTestCase.java
Index: AbstractCacheTestCase.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/cache/src/test/org/apache/avalon/excalibur/cache/test/AbstractCacheTestCase.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AbstractCacheTestCase.java 30 Mar 2002 07:24:19 -0000 1.3
+++ AbstractCacheTestCase.java 30 Mar 2002 16:34:15 -0000 1.4
@@ -18,10 +18,40 @@
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.7 +1 -2
jakarta-avalon-excalibur/cache/src/test/org/apache/avalon/excalibur/cache/test/LRUCacheTestCase.java
Index: LRUCacheTestCase.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/cache/src/test/org/apache/avalon/excalibur/cache/test/LRUCacheTestCase.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- LRUCacheTestCase.java 30 Mar 2002 07:24:19 -0000 1.6
+++ LRUCacheTestCase.java 30 Mar 2002 16:34:15 -0000 1.7
@@ -7,7 +7,6 @@
*/
package org.apache.avalon.excalibur.cache.test;
-import org.apache.avalon.excalibur.cache.Cache;
import org.apache.avalon.excalibur.cache.LRUCache;
/**
@@ -25,6 +24,6 @@
protected void setUp()
{
- m_cache = new LRUCache( 10 );
+ m_cache = new LRUCache( STORE_SIZE );
}
}
1.3 +1 -1
jakarta-avalon-excalibur/cache/src/test/org/apache/avalon/excalibur/cache/test/TimeMapLRUCacheTestCase.java
Index: TimeMapLRUCacheTestCase.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/cache/src/test/org/apache/avalon/excalibur/cache/test/TimeMapLRUCacheTestCase.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TimeMapLRUCacheTestCase.java 30 Mar 2002 07:24:19 -0000 1.2
+++ TimeMapLRUCacheTestCase.java 30 Mar 2002 16:34:15 -0000 1.3
@@ -25,6 +25,6 @@
protected void setUp()
{
- m_cache = new TimeMapLRUCache( 10 );
+ m_cache = new TimeMapLRUCache( STORE_SIZE );
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>