Search in sources :

Example 36 with Record

use of org.apache.jena.tdb.base.record.Record in project jena by apache.

the class ExtHashTestBase method check.

public static void check(ExtHash extHash, int... recs) {
    extHash.check();
    for (int i : recs) {
        Record r = intToRecordKey(i);
        assertNotNull(extHash.find(r));
    }
    List<Integer> y = unique(asList(recs));
    int x = (int) extHash.size();
    assertEquals(y.size(), x);
}
Also used : Record(org.apache.jena.tdb.base.record.Record)

Example 37 with Record

use of org.apache.jena.tdb.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);
}
Also used : Index(org.apache.jena.tdb.index.Index) Record(org.apache.jena.tdb.base.record.Record) RecordLib.intToRecord(org.apache.jena.tdb.base.record.RecordLib.intToRecord) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 38 with Record

use of org.apache.jena.tdb.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);
}
Also used : Index(org.apache.jena.tdb.index.Index) Record(org.apache.jena.tdb.base.record.Record) RecordLib.intToRecord(org.apache.jena.tdb.base.record.RecordLib.intToRecord) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 39 with Record

use of org.apache.jena.tdb.base.record.Record in project jena by apache.

the class IndexTestLib method testDelete.

public static void testDelete(Index index, int[] vals) {
    long size1 = index.size();
    int count = 0;
    count = delete(index, vals);
    List<Record> x = intToRecord(vals, RecordLib.TestRecordLength);
    for (Record r : x) {
        boolean b = index.delete(r);
        if (b)
            count++;
    }
    for (Record r : x) BaseTest.assertFalse(index.contains(r));
    long size2 = index.size();
    assertEquals(size1 - count, size2);
}
Also used : Record(org.apache.jena.tdb.base.record.Record) RecordLib.intToRecord(org.apache.jena.tdb.base.record.RecordLib.intToRecord)

Example 40 with Record

use of org.apache.jena.tdb.base.record.Record in project jena by apache.

the class TestBPTreeRecords method bpt_shift_1.

@Test
public void bpt_shift_1() {
    BPTreeRecords bpr1 = make();
    BPTreeRecords bpr2 = make();
    insert(bpr1, 10);
    Record r = bpr1.shiftRight(bpr2, null);
    assertNull(r);
    //assertTrue(Record.keyEQ(r, RecordTestLib.intToRecord(10))) ;
    contains(bpr1);
    contains(bpr2, 10);
    bpr1.release();
    bpr2.release();
}
Also used : BPTreeRecords(org.apache.jena.tdb.index.bplustree.BPTreeRecords) Record(org.apache.jena.tdb.base.record.Record) Test(org.junit.Test) BaseTest(org.apache.jena.atlas.junit.BaseTest)

Aggregations

Record (org.apache.jena.tdb.base.record.Record)96 BaseTest (org.apache.jena.atlas.junit.BaseTest)25 Test (org.junit.Test)25 RecordLib.intToRecord (org.apache.jena.tdb.base.record.RecordLib.intToRecord)20 RecordBuffer (org.apache.jena.tdb.base.buffer.RecordBuffer)15 RangeIndex (org.apache.jena.tdb.index.RangeIndex)8 BPTreeRecords (org.apache.jena.tdb.index.bplustree.BPTreeRecords)5 NodeId (org.apache.jena.tdb.store.NodeId)5 NoSuchElementException (java.util.NoSuchElementException)4 Pair (org.apache.jena.atlas.lib.Pair)4 BlockMgr (org.apache.jena.tdb.base.block.BlockMgr)4 RecordFactory (org.apache.jena.tdb.base.record.RecordFactory)4 Tuple (org.apache.jena.atlas.lib.tuple.Tuple)3 StorageException (org.apache.jena.tdb.base.StorageException)3 FileSet (org.apache.jena.tdb.base.file.FileSet)3 Location (org.apache.jena.tdb.base.file.Location)3 RecordBufferPage (org.apache.jena.tdb.base.recordbuffer.RecordBufferPage)3 Index (org.apache.jena.tdb.index.Index)3 BPlusTree (org.apache.jena.tdb.index.bplustree.BPlusTree)3 TupleIndexRecord (org.apache.jena.tdb.store.tupletable.TupleIndexRecord)3