Schema schema = new Schema(ais());
StoreAdapter adapter = newStoreAdapter(schema);
QueryContext queryContext = queryContext(adapter);
QueryBindings queryBindings = queryContext.createBindings();
DirectObjectCursor cursor = plan.cursor(queryContext, queryBindings);
queryBindings.setValue(0, new Value(MString.varcharFor("stat"), "stat"));
queryBindings.setValue(1, new Value(MString.varcharFor("count=3"), "count=3"));
queryBindings.setValue(2, new Value(MString.varcharFor("delay=2"), "delay=2"));
queryBindings.setValue(3, new Value(MString.varcharFor("-a"), "-a"));
int populatedResults = 0;
int emptyResults = 0;
cursor.open();
while(true) {
List<? extends Object> columns = cursor.next();
if (columns == null) {
break;
}
if (columns.isEmpty()) {
emptyResults++;
} else {
assertEquals(1, columns.size());
assertTrue(columns.get(0) instanceof String);
populatedResults++;
}
}
cursor.close();
assertEquals(3, populatedResults);
assertTrue(emptyResults > 0 && emptyResults < 60);
}