コード例 #1
0
  public final void testGetDeleteableBlocks() {
    // HeaderBlock hBlock =
    TransactionBlock latestTransBlock = tracker.getLatestTransactionBlock(DATANAME1);
    assertEquals(tBlock1.getBlockId(), latestTransBlock.getBlockId());

    tracker.addTransaction(tBlock2);
    latestTransBlock = tracker.getLatestTransactionBlock(DATANAME1);
    assertEquals(tBlock2.getBlockId(), latestTransBlock.getBlockId());

    Vector<Long> blocksToDelete = tracker.getBlocksOnlyReferencedBy(tBlock1);
    assertEquals(2, blocksToDelete.size());
    assertEquals(hBlock1.getBlockId(), blocksToDelete.get(0).longValue());
    assertEquals(dBlock1.getBlockId(), blocksToDelete.get(1).longValue());
  }
コード例 #2
0
  public final void testGetLatestBlock() {
    assertSame(tBlock1, tracker.getLatestTransactionBlock(DATANAME1));
    assertSame(hBlock1, tracker.getLatestHeaderBlockForFile(FILENAME));

    tracker.addHeaderBlock(hBlock2);
    tracker.addTransaction(tBlock2);
    assertSame(tBlock2, tracker.getLatestTransactionBlock(DATANAME1));
    assertSame(hBlock2, tracker.getLatestHeaderBlockForFile(FILENAME));

    Vector<Long> blocksOfT1 = tracker.getBlocksOnlyReferencedBy(tBlock1);
    assertEquals(2, blocksOfT1.size());
    assertEquals(hBlock1.getBlockId(), blocksOfT1.get(0).longValue());
    assertEquals(dBlock1.getBlockId(), blocksOfT1.get(1).longValue());
  }