use of org.apache.cassandra.utils.WrappedRunnable in project eiger by wlloyd.
the class TableTest method testGetSliceFromBasic.
@Test
public void testGetSliceFromBasic() throws Throwable {
// tests slicing against data from one row in a memtable and then flushed to an sstable
final Table table = Table.open("Keyspace1");
final ColumnFamilyStore cfStore = table.getColumnFamilyStore("Standard1");
final DecoratedKey ROW = Util.dk("row1");
RowMutation rm = new RowMutation("Keyspace1", ROW.key);
ColumnFamily cf = ColumnFamily.create("Keyspace1", "Standard1");
cf.addColumn(column("col1", "val1", 1L));
cf.addColumn(column("col3", "val3", 1L));
cf.addColumn(column("col4", "val4", 1L));
cf.addColumn(column("col5", "val5", 1L));
cf.addColumn(column("col7", "val7", 1L));
cf.addColumn(column("col9", "val9", 1L));
rm.add(cf);
rm.apply();
rm = new RowMutation("Keyspace1", ROW.key);
rm.delete(new QueryPath("Standard1", null, ByteBufferUtil.bytes("col4")), 2L);
rm.apply();
Runnable verify = new WrappedRunnable() {
public void runMayThrow() throws Exception {
ColumnFamily cf;
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBufferUtil.bytes("col5"), ByteBufferUtil.EMPTY_BYTE_BUFFER, false, 2);
assertColumns(cf, "col5", "col7");
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBufferUtil.bytes("col4"), ByteBufferUtil.EMPTY_BYTE_BUFFER, false, 2);
assertColumns(cf, "col4", "col5", "col7");
assertColumns(ColumnFamilyStore.removeDeleted(cf, Integer.MAX_VALUE), "col5", "col7");
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBufferUtil.bytes("col5"), ByteBufferUtil.EMPTY_BYTE_BUFFER, true, 2);
assertColumns(cf, "col3", "col4", "col5");
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBufferUtil.bytes("col6"), ByteBufferUtil.EMPTY_BYTE_BUFFER, true, 2);
assertColumns(cf, "col3", "col4", "col5");
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBufferUtil.EMPTY_BYTE_BUFFER, ByteBufferUtil.EMPTY_BYTE_BUFFER, true, 2);
assertColumns(cf, "col7", "col9");
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBufferUtil.bytes("col95"), ByteBufferUtil.EMPTY_BYTE_BUFFER, false, 2);
assertColumns(cf);
cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBufferUtil.bytes("col0"), ByteBufferUtil.EMPTY_BYTE_BUFFER, true, 2);
assertColumns(cf);
}
};
reTest(table.getColumnFamilyStore("Standard1"), verify);
}
Aggregations