Esempio n. 1
0
  @Test
  public void root_leaf_insert() {
    if (valsOutside) return;

    m.put(11, 12);
    final long rootRecid = engine.get(m.rootRecidRef, Serializer.RECID);
    BTreeMap.LeafNode n = (BTreeMap.LeafNode) engine.get(rootRecid, m.nodeSerializer);
    assertTrue(Arrays.equals(new Object[] {null, 11, null}, nodeKeysToArray(n)));
    assertTrue(Arrays.equals(new Object[] {12}, (Object[]) n.vals));
    assertEquals(0, n.next);
  }
Esempio n. 2
0
  @Test
  public void simple_root_get() {

    if (valsOutside) return;

    BTreeMap.LeafNode l =
        new BTreeMap.LeafNode(
            new Object[] {10, 20, 30}, true, true, false, new Object[] {10, 20, 30}, 0);
    long rootRecid = engine.put(l, m.nodeSerializer);
    engine.update(m.rootRecidRef, rootRecid, Serializer.RECID);

    assertEquals(null, m.get(1));
    assertEquals(null, m.get(9));
    assertEquals(10, m.get(10));
    assertEquals(null, m.get(11));
    assertEquals(null, m.get(19));
    assertEquals(20, m.get(20));
    assertEquals(null, m.get(21));
    assertEquals(null, m.get(29));
    assertEquals(30, m.get(30));
    assertEquals(null, m.get(31));
  }
Esempio n. 3
0
 @Before
 public void init() {
   engine = new StoreDirect(null);
   engine.init();
   m =
       new BTreeMap(
           engine,
           false,
           BTreeMap.createRootRef(engine, BTreeKeySerializer.BASIC, Serializer.BASIC, 0),
           6,
           valsOutside,
           0,
           BTreeKeySerializer.BASIC,
           Serializer.BASIC,
           0);
 }
Esempio n. 4
0
 @After
 public void close() {
   engine.close();
 }