@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testCompositeRangeQuery() throws InterruptedException {
try{
AstyanaxClient client = new AstyanaxClient();
Map<String, Object> clientConfig = new HashMap<String, Object>();
clientConfig.put(StormCassandraConstants.CASSANDRA_HOST, "localhost:9160");
clientConfig.put(StormCassandraConstants.CASSANDRA_KEYSPACE, Arrays.asList(new String [] {KEYSPACE}));
client.start(clientConfig);
Fields fields = new Fields("rowkey", "a", "b", "value");
Values values = new Values("my_row", "a", "a", "aa");
TridentTuple tuple = newTridentTuple(fields, values);
CompositeColumnTridentTupleMapper tupleMapper = new CompositeColumnTridentTupleMapper(KEYSPACE);
client.writeTuple(tuple, tupleMapper);
tuple = newTridentTuple(fields, new Values("my_row", "b", "b", "bb"));
client.writeTuple(tuple, tupleMapper);
tuple = newTridentTuple(fields, new Values("my_row", "a", "b", "ab"));
client.writeTuple(tuple, tupleMapper);
tuple = newTridentTuple(fields, new Values("my_row", "a", "c", "ac"));
client.writeTuple(tuple, tupleMapper);
tuple = newTridentTuple(fields, new Values("my_row", "a", "d", "ad"));
client.writeTuple(tuple, tupleMapper);
tuple = newTridentTuple(fields, new Values("my_row", "c", "c", "cc"));
client.writeTuple(tuple, tupleMapper);
tuple = newTridentTuple(fields, new Values("my_row", "d", "d", "dd"));
client.writeTuple(tuple, tupleMapper);
Map<SimpleComposite, String> map = client.lookup(tupleMapper, tuple, new SimpleComposite("a", "a"), new SimpleComposite("a", "c"), Equality.GREATER_THAN_EQUAL);
dumpMap(map);
assertNotNull(map.get(new SimpleComposite("a", "a")));
assertNotNull(map.get(new SimpleComposite("a", "b")));
assertNotNull(map.get(new SimpleComposite("a", "c")));
assertNull(map.get(new SimpleComposite("a", "d")));
assertNull(map.get(new SimpleComposite("c", "c")));
assertNull(map.get(new SimpleComposite("d", "d")));
client.stop();
} catch (Exception e){
e.printStackTrace();
fail();
}
}