use of org.apache.hadoop.hdfs.protocol.proto.HdfsServerProtos.BlocksWithLocationsProto in project hadoop by apache.
the class TestPBHelper method testConvertBlocksWithLocations.
@Test
public void testConvertBlocksWithLocations() {
boolean[] testSuite = new boolean[] { false, true };
for (int i = 0; i < testSuite.length; i++) {
BlockWithLocations[] list = new BlockWithLocations[] { getBlockWithLocations(1, testSuite[i]), getBlockWithLocations(2, testSuite[i]) };
BlocksWithLocations locs = new BlocksWithLocations(list);
BlocksWithLocationsProto locsProto = PBHelper.convert(locs);
BlocksWithLocations locs2 = PBHelper.convert(locsProto);
BlockWithLocations[] blocks = locs.getBlocks();
BlockWithLocations[] blocks2 = locs2.getBlocks();
assertEquals(blocks.length, blocks2.length);
for (int j = 0; j < blocks.length; j++) {
compare(blocks[j], blocks2[j]);
}
}
}
Aggregations