String input = sb.toString();
ByteArrayInputStream in = new ByteArrayInputStream(input.getBytes());
ObjectMetadata meta = ChunkedStorage.newWriter(provider, "MyObject", in)
.withChunkSize(100)
.call();
meta = ChunkedStorage.newInfoReader(provider, "MyObject").call();
System.out.println("Obj size: " + meta.getObjectSize().intValue());
System.out.println("Chunk count: " + meta.getChunkCount());
ByteArrayOutputStream os = new ByteArrayOutputStream(meta.getObjectSize().intValue());
meta = ChunkedStorage.newReader(provider, "MyObject", os)
.withBatchSize(11) // Randomize fetching blocks within a batch.
.withConcurrencyLevel(3)
.call();
String output = os.toString();
Assert.assertEquals(input, output);
ChunkedStorage.newDeleter(provider, "MyObject").call();
for (int i=0; i<meta.getChunkCount(); i++) {
ColumnList<String> result = keyspace.prepareQuery(CF_CHUNK).getKey("MyObject$" + i).execute().getResult();
Assert.assertTrue(result.isEmpty());
}
}