public void testScanners() throws Exception {
LilyClient client = lilyProxy.getLilyServerProxy().getClient();
// Obtain a repository
Repository repository = client.getRepository();
IdGenerator idGenerator = repository.getIdGenerator();
String NS = "org.lilyproject.client.test";
// Create a field type and record type
TypeManager typeManager = repository.getTypeManager();
FieldType fieldType = typeManager.newFieldType("STRING", new QName(NS, "scanfield"), Scope.VERSIONED);
fieldType = typeManager.createFieldType(fieldType);
RecordType recordType = typeManager.newRecordType(new QName(NS, "scanrt"));
recordType.addFieldTypeEntry(fieldType.getId(), true);
recordType = typeManager.createRecordType(recordType);
// Create some records
for (int i = 0; i < 10; i++) {
Record record = repository.newRecord();
record.setId(repository.getIdGenerator().newRecordId("A" + i));
record.setRecordType(new QName(NS, "scanrt"));
record.setField(new QName(NS, "scanfield"), "value " + i);
repository.create(record);
}
// Do a scan
RecordScan scan = new RecordScan();
scan.setStartRecordId(idGenerator.newRecordId("A"));
scan.setStopRecordId(idGenerator.newRecordId("B"));
RecordScanner scanner = repository.getScanner(scan);
int i = 0;
while (scanner.next() != null) {
i++;