Пример #1
0
 protected final LocatedBlocks ensureFileReplicasOnStorageType(Path path, StorageType storageType)
     throws IOException {
   // Ensure that returned block locations returned are correct!
   LOG.info("Ensure path: " + path + " is on StorageType: " + storageType);
   assertThat(fs.exists(path), is(true));
   long fileLength = client.getFileInfo(path.toString()).getLen();
   LocatedBlocks locatedBlocks = client.getLocatedBlocks(path.toString(), 0, fileLength);
   for (LocatedBlock locatedBlock : locatedBlocks.getLocatedBlocks()) {
     assertThat(locatedBlock.getStorageTypes()[0], is(storageType));
   }
   return locatedBlocks;
 }
 private LocatedBlock getLocatedBlock() throws IOException {
   LocatedBlocks locatedBlocks = client.getLocatedBlocks(PATH.toString(), 0, BLOCK_SIZE);
   assertThat(locatedBlocks.getLocatedBlocks().size(), is(1));
   return Iterables.getOnlyElement(locatedBlocks.getLocatedBlocks());
 }