use of org.apache.cassandra.db.rows.RowIterator in project cassandra by apache.
the class KeyspaceTest method assertRowsInResult.
private static void assertRowsInResult(ColumnFamilyStore cfs, SinglePartitionReadCommand command, int... columnValues) {
try (ReadExecutionController executionController = command.executionController();
PartitionIterator iterator = command.executeInternal(executionController)) {
if (columnValues.length == 0) {
if (iterator.hasNext())
fail("Didn't expect any results, but got rows starting with: " + iterator.next().next().toString(cfs.metadata()));
return;
}
try (RowIterator rowIterator = iterator.next()) {
for (int expected : columnValues) {
Row row = rowIterator.next();
Cell cell = row.getCell(cfs.metadata().getColumn(new ColumnIdentifier("c", false)));
assertEquals(String.format("Expected %s, but got %s", ByteBufferUtil.bytesToHex(ByteBufferUtil.bytes(expected)), ByteBufferUtil.bytesToHex(cell.value())), ByteBufferUtil.bytes(expected), cell.value());
}
assertFalse(rowIterator.hasNext());
}
}
}
Aggregations