Beispiel #1
0
  @Test
  public void WAL_replay_mixed() {
    e = openEngine();
    e.structuralLock.lock();

    for (int i = 0; i < 3; i++) {
      long v = e.composeIndexVal(100 + i, e.round16Up(10000) + i * 16, true, true, true);
      e.walPutLong(0xF0000 + i * 8, v);
      byte[] d = new byte[9];
      Arrays.fill(d, (byte) i);
      e.putDataSingleWithoutLink(-1, e.round16Up(100000) + 64 + i * 16, d, 0, d.length);
    }
    e.commit();
    e.structuralLock.lock();
    e.commitLock.lock();
    e.replayWAL();

    for (int i = 0; i < 3; i++) {
      long v = e.composeIndexVal(100 + i, e.round16Up(10000) + i * 16, true, true, true);
      assertEquals(v, e.vol.getLong(0xF0000 + i * 8));

      byte[] d = new byte[9];
      Arrays.fill(d, (byte) i);
      byte[] d2 = new byte[9];

      e.vol.getData(e.round16Up(100000) + 64 + i * 16, d2, 0, d2.length);
      assertTrue(Serializer.BYTE_ARRAY.equals(d, d2));
    }
  }
Beispiel #2
0
 @Test
 public void testHexaConversion() {
   byte[] b = new byte[] {11, 112, 11, 0, 39, 90};
   assertTrue(Serializer.BYTE_ARRAY.equals(b, DataIO.fromHexa(DataIO.toHexa(b))));
 }