use of com.github.ambry.router.GetBlobOptionsBuilder in project ambry by linkedin.
the class ServerTestUtil method checkBlobId.
private static void checkBlobId(Router router, BlobId blobId, byte[] data) throws Exception {
GetBlobResult result = router.getBlob(blobId.getID(), new GetBlobOptionsBuilder().build()).get(20, TimeUnit.SECONDS);
ReadableStreamChannel blob = result.getBlobDataChannel();
assertEquals("Size does not match that of data", data.length, result.getBlobInfo().getBlobProperties().getBlobSize());
RetainingAsyncWritableChannel channel = new RetainingAsyncWritableChannel();
blob.readInto(channel, null).get(1, TimeUnit.SECONDS);
try (InputStream is = channel.consumeContentAsInputStream()) {
assertArrayEquals(data, Utils.readBytesFromStream(is, (int) channel.getBytesWritten()));
}
}
Aggregations