/** * Put, get, and remove from a range. This should occur at a range that is * not touched by other tests. * <p> * @param map * @param start * @param end * @throws Exception */ public void runConcurrentRangeTests( LRUMap<String, String> map, int start, int end ) throws Exception { for ( int i = start; i < end; i++ ) { map.put( i + ":key", "data" + i ); } for ( int i = end - 1; i >= start; i-- ) { String res = map.get( i + ":key" ); assertNotNull( "[" + i + ":key] should not be null", res ); } // test removal map.remove( start + ":key" ); assertNull( map.get( start + ":key" ) ); } }
/** * Just make sure that we can put and get concurrently * * @param map * @param items * @throws Exception */ public void runConcurrentPutGetTests( LRUMap<String, String> map, int items ) throws Exception { for ( int i = 0; i < items; i++ ) { map.put( i + ":key", "data" + i ); } for ( int i = items - 1; i >= 0; i-- ) { String res = map.get( i + ":key" ); assertNotNull( "[" + i + ":key] should not be null", res ); } }
/** * Just make sure that we can put and get concurrently * * @param map * @param items * @throws Exception */ public void runConcurrentPutGetTests( LRUMap<String, String> map, int items ) throws Exception { for ( int i = 0; i < items; i++ ) { map.put( i + ":key", "data" + i ); } for ( int i = items - 1; i >= 0; i-- ) { String res = map.get( i + ":key" ); assertNotNull( "[" + i + ":key] should not be null", res ); } }
/** * Put, get, and remove from a range. This should occur at a range that is * not touched by other tests. * <p> * @param map * @param start * @param end * @throws Exception */ public void runConcurrentRangeTests( LRUMap<String, String> map, int start, int end ) throws Exception { for ( int i = start; i < end; i++ ) { map.put( i + ":key", "data" + i ); } for ( int i = end - 1; i >= start; i-- ) { String res = map.get( i + ":key" ); assertNotNull( "[" + i + ":key] should not be null", res ); } // test removal map.remove( start + ":key" ); assertNull( map.get( start + ":key" ) ); } }
while ( it.hasNext() ) assertNotNull( it.next() ); assertNotNull( "[" + i + ":key] should not be null", res ); assertNull( map.get( ( total - 1 ) + ":key" ) );
while ( it.hasNext() ) assertNotNull( it.next() ); assertNotNull( "[" + i + ":key] should not be null", res ); assertNull( map.get( ( total - 1 ) + ":key" ) );
/** * Just test that we can put, get and remove as expected. * <p> * @throws Exception * Description of the Exception */ public void testSimpleLoad() throws Exception { LRUMap<String, String> map = new LRUMap<String, String>( items ); for ( int i = 0; i < items; i++ ) { map.put( i + ":key", "data" + i ); } for ( int i = items - 1; i >= 0; i-- ) { String res = map.get( i + ":key" ); assertNotNull( "[" + i + ":key] should not be null", res ); } // test removal map.remove( "300:key" ); assertNull( map.get( "300:key" ) ); }
/** * Just test that we can put, get and remove as expected. * <p> * @throws Exception * Description of the Exception */ public void testSimpleLoad() throws Exception { LRUMap<String, String> map = new LRUMap<String, String>( items ); for ( int i = 0; i < items; i++ ) { map.put( i + ":key", "data" + i ); } for ( int i = items - 1; i >= 0; i-- ) { String res = map.get( i + ":key" ); assertNotNull( "[" + i + ":key] should not be null", res ); } // test removal map.remove( "300:key" ); assertNull( map.get( "300:key" ) ); }
assertNull( map.get( i + ":key" ) ); assertNotNull( "[" + i + ":key] should not be null", res );
assertNull( map.get( i + ":key" ) ); assertNotNull( "[" + i + ":key] should not be null", res );