Skip to content

Instantly share code, notes, and snippets.

@atris
Last active February 8, 2020 16:32
Show Gist options
  • Save atris/773e1074edd1d50786ff35e300495984 to your computer and use it in GitHub Desktop.
Save atris/773e1074edd1d50786ff35e300495984 to your computer and use it in GitHub Desktop.
public void testMaxValueRead() throws Exception {
File journalDir = createTempDir("bookie", "journal");
Bookie.checkDirectoryStructure(Bookie.getCurrentDirectory(journalDir));
File ledgerDir = createTempDir("bookie", "ledger");
Bookie.checkDirectoryStructure(Bookie.getCurrentDirectory(ledgerDir));
JournalChannel jc = writeV4Journal(Bookie.getCurrentDirectory(journalDir), 100, "testPasswd".getBytes());
long initialSize = jc.fc.size();
jc.fc.truncate(jc.fc.size() / 2);
ServerConfiguration conf = TestBKConfiguration.newServerConfiguration();
conf.setJournalDirName(journalDir.getPath())
.setLedgerDirNames(new String[] { ledgerDir.getPath() })
.setMetadataServiceUri(null);
Journal.JournalScanner journalScanner = new DummyJournalScan();
Bookie b = new Bookie(conf);
//b.start();
for (Journal journal : b.journals) {
List<Long> journalIds = journal.listJournalIds(journal.getJournalDirectory(), null);
assert journalIds.size() == 1;
journal.scanJournal(journalIds.get(0), initialSize, journalScanner);
}
b.shutdown();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment