use of org.apache.jena.dboe.base.record.Record in project jena by apache.
the class AbstractTestRangeIndex method tree_iter_0_01.
// Root
@Test
public void tree_iter_0_01() {
int[] keys = { 1, 2, 3, 4, 5 };
RangeIndex rIndex = makeRangeIndex(5);
add(rIndex, keys);
Iterator<Record> iter = rIndex.iterator(r(2), r(4));
while (iter.hasNext()) iter.next();
List<Integer> x = toIntList(rIndex.iterator(r(2), r(4)));
List<Integer> expected = toIntList(2, 3);
assertEquals(expected, x);
}
use of org.apache.jena.dboe.base.record.Record in project jena by apache.
the class IndexTestLib method testIndexContents.
public static void testIndexContents(Index index, int... records) {
List<Integer> x = toIntList(index.iterator());
// Make a unique list of expected records. Remove duplicates
List<Integer> y = unique(asList(records));
assertEquals("Expected records size and tree size different", y.size(), index.size());
assertEquals("Expected records size and iteration over all keys are of different sizes", y.size(), x.size());
if (index instanceof RangeIndex) {
// Check sorted order
for (int i = 0; i < x.size() - 2; i++) {
if (x.get(i) > x.get(i + 1)) {
fail("check failed: " + strings(records));
return;
}
}
}
// Check each expected record is in the tree
for (int k : y) {
Record rec = intToRecord(k);
Record r2 = index.find(rec);
assertNotNull(r2);
}
}
use of org.apache.jena.dboe.base.record.Record in project jena by apache.
the class IndexLogger method find.
@Override
public Record find(Record record) {
log.info("Find: {}", record);
Record r2 = super.find(record);
log.info("Find: " + record + " ==> " + r2);
return r2;
}
use of org.apache.jena.dboe.base.record.Record in project jena by apache.
the class AbstractTestIndex method index_find_2.
@Test
public void index_find_2() {
int[] keys = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
Index index = test(keys);
Record r = intToRecord(20, RecordLib.TestRecordLength);
r = index.find(r);
assertNull(r);
}
use of org.apache.jena.dboe.base.record.Record in project jena by apache.
the class AbstractTestIndex method index_find_1.
@Test
public void index_find_1() {
int[] keys = { 1 };
Index index = test(keys);
Record r = intToRecord(1, RecordLib.TestRecordLength);
r = index.find(r);
assertNotNull(r);
}
Aggregations