Example #1
0
 /** Fail test bad block size */
 @Test(expected = IllegalArgumentException.class)
 public void testAssertBadBlockSizeFail() {
   Bucket b = new Bucket(bucketSize, new ArrayList<Block>());
   for (int i = 0; i < b.getBlocks().size(); ++i) {
     b.getBlocks().set(i, Block.create(0, new BitMatrix(blockSize), true));
   }
   server.writeBucket(0, 0, b);
 }
Example #2
0
 /** Writes and reads from different levels */
 @Test
 public void testWriteReadLevels() {
   for (int i = 0; i < server.getTreeHeight(); i++) {
     server.writeBucket(i, i, makeBucket(i));
   }
   for (int i = 0; i < server.getTreeHeight(); i++) {
     Bucket bucket = server.readBucket(i, i);
     for (Block block : bucket.getBlocks()) {
       assertEquals(i, block.getId());
     }
   }
 }
Example #3
0
 /** Test the read bucket function */
 @Test
 public void testReadBucket() {
   Bucket b = server.readBucket(50, 2);
   assertEquals(bucketSize, b.getBlocks().size());
 }