Last active
February 8, 2020 16:32
-
-
Save atris/773e1074edd1d50786ff35e300495984 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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