Exemplo n.º 1
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());
     }
   }
 }
Exemplo n.º 2
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);
 }
Exemplo n.º 3
0
 private Bucket makeBucket(int globalIndex) {
   List<Block> blocks = new ArrayList<Block>();
   for (int blockInBucket = 0; blockInBucket < server.getBucketSize(); blockInBucket++) {
     blocks.add(Block.create(globalIndex, new BitMatrix(blockSize), true));
   }
   Bucket bucket = new Bucket(server.getBucketSize(), blocks);
   return bucket;
 }