|
@@ -73,7 +73,7 @@ public class TestJournal {
|
|
conf = new Configuration();
|
|
conf = new Configuration();
|
|
journal = new Journal(conf, TEST_LOG_DIR, JID, StartupOption.REGULAR,
|
|
journal = new Journal(conf, TEST_LOG_DIR, JID, StartupOption.REGULAR,
|
|
mockErrorReporter);
|
|
mockErrorReporter);
|
|
- journal.format(FAKE_NSINFO);
|
|
|
|
|
|
+ journal.format(FAKE_NSINFO, false);
|
|
}
|
|
}
|
|
|
|
|
|
@After
|
|
@After
|
|
@@ -207,7 +207,7 @@ public class TestJournal {
|
|
// Clear the storage directory before reformatting it
|
|
// Clear the storage directory before reformatting it
|
|
journal.getStorage().getJournalManager()
|
|
journal.getStorage().getJournalManager()
|
|
.getStorageDirectory().clearDirectory();
|
|
.getStorageDirectory().clearDirectory();
|
|
- journal.format(FAKE_NSINFO_2);
|
|
|
|
|
|
+ journal.format(FAKE_NSINFO_2, false);
|
|
|
|
|
|
assertEquals(0, journal.getLastPromisedEpoch());
|
|
assertEquals(0, journal.getLastPromisedEpoch());
|
|
assertEquals(0, journal.getLastWriterEpoch());
|
|
assertEquals(0, journal.getLastWriterEpoch());
|
|
@@ -425,7 +425,7 @@ public class TestJournal {
|
|
try {
|
|
try {
|
|
// Format again here and to format the non-empty directories in
|
|
// Format again here and to format the non-empty directories in
|
|
// journal node.
|
|
// journal node.
|
|
- journal.format(FAKE_NSINFO);
|
|
|
|
|
|
+ journal.format(FAKE_NSINFO, false);
|
|
fail("Did not fail to format non-empty directories in journal node.");
|
|
fail("Did not fail to format non-empty directories in journal node.");
|
|
} catch (IOException ioe) {
|
|
} catch (IOException ioe) {
|
|
GenericTestUtils.assertExceptionContains(
|
|
GenericTestUtils.assertExceptionContains(
|
|
@@ -434,4 +434,15 @@ public class TestJournal {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Test
|
|
|
|
+ public void testFormatNonEmptyStorageDirectoriesWhenforceOptionIsTrue()
|
|
|
|
+ throws Exception {
|
|
|
|
+ try {
|
|
|
|
+ // Format again here and to format the non-empty directories in
|
|
|
|
+ // journal node.
|
|
|
|
+ journal.format(FAKE_NSINFO, true);
|
|
|
|
+ } catch (IOException ioe) {
|
|
|
|
+ fail("Format should be success with force option.");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|