assertNotNull(kiji.getSchemaTable());
assertNotNull(kiji.getMetaTable());
kiji.createTable(KijiTableLayouts.getLayout(KijiTableLayouts.SIMPLE_FORMATTED_EID));
final KijiTable table = kiji.openTable("table");
try {
final KijiTableWriter writer = table.openTableWriter();
try {
writer.put(table.getEntityId("row1"), "family", "column", 0L, "Value at timestamp 0.");
writer.put(table.getEntityId("row1"), "family", "column", 1L, "Value at timestamp 1.");
} finally {
writer.close();
}
final KijiTableReader reader = table.openTableReader();
try {
final KijiDataRequest dataRequest = KijiDataRequest.builder()
.addColumns(ColumnsDef.create().withMaxVersions(100).add("family", "column"))
.build();
// Try this as a get.
final KijiRowData rowData = reader.get(table.getEntityId("row1"), dataRequest);
String s = rowData.getValue("family", "column", 0L).toString();
assertEquals(s, "Value at timestamp 0.");
// Try this as a scan.
int rowCounter = 0;
final KijiRowScanner rowScanner = reader.getScanner(dataRequest);
try {
// Should be just one row, with two versions.
for (KijiRowData kijiRowData : rowScanner) {
LOG.info("Read from scanner! " + kijiRowData.toString());
// Should see two versions for qualifier "column".
assertEquals(
"Value at timestamp 0.", kijiRowData.getValue("family", "column", 0L).toString());
assertEquals(
"Value at timestamp 1.", kijiRowData.getValue("family", "column", 1L).toString());
rowCounter++;
}
} finally {
rowScanner.close();
}
assertEquals(1, rowCounter);
} finally {
reader.close();
}
} finally {
table.release();
}
}