* @throws CacheException
*/
public void testPutGetThroughHub()
throws CacheException
{
JCS cache = JCS.getInstance( "testPutGetThroughHub" );
int max = cache.getCacheAttributes().getMaxObjects();
int items = max * 2;
for ( int i = 0; i < items; i++ )
{
cache.put( i + ":key", "myregion" + " data " + i );
}
// Test that first items are not in the cache
for ( int i = max; i >= 0; i-- )
{
String value = (String) cache.get( i + ":key" );
assertNull( "Should not have value for key [" + i + ":key" + "] in the cache.", value );
}
// Test that last items are in cache
// skip 2 for the buffer.
for ( int i = max + 2; i < items; i++ )
{
String value = (String) cache.get( i + ":key" );
assertEquals( "myregion" + " data " + i, value );
}
}