Exemplo n.º 1
0
 @Test
 public void testOldBlocksAreEvicted() throws Exception {
   assertTrue(isZero(storage.bytes()));
   cache.obtainBlock(storage, new BlockId(0)).put(0, (byte) 1);
   cache.obtainBlock(storage, new BlockId(1)).put(0, (byte) 1);
   assertTrue(isZero(storage.bytes()));
   cache.obtainBlock(storage, new BlockId(2)).put(0, (byte) 1);
   assertFalse(isZero(storage.bytes()));
 }
Exemplo n.º 2
0
 @Test
 public void testBasicOperation() throws Exception {
   final Block block = cache.obtainBlock(storage, new BlockId(0));
   assertTrue(isZero(storage.bytes()));
   block.put(0, (byte) 1);
   assertTrue(isZero(storage.bytes()));
   cache.flush();
   assertFalse(isZero(storage.bytes()));
 }