startNewBookieWithMultipleLedgerDirs(2);
File[] ledgerDirs = bsConfs.get(1).getLedgerDirs();
assertEquals("Only one ledger dir should be present", 2,
ledgerDirs.length);
Bookie bookie = bs.get(1).getBookie();
LedgerHandle ledger = bkc.createLedger(2, 2, DigestType.MAC,
"".getBytes());
LedgerDirsManager ledgerDirsManager = bookie.getLedgerDirsManager();
for (int i = 0; i < 10; i++) {
ledger.addEntry("data".getBytes());
}
// Now add the current ledger dir to filled dirs list
ledgerDirsManager.addToFilledDirs(new File(ledgerDirs[0], "current"));
for (int i = 0; i < 10; i++) {
ledger.addEntry("data".getBytes());
}
assertEquals("writable dirs should have one dir", 1, ledgerDirsManager
.getWritableLedgerDirs().size());
assertTrue("Bookie should shutdown if readOnlyMode not enabled",
bookie.isAlive());
}