This is an automated email from the ASF dual-hosted git repository.

eolivelli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new 13c303f  ISSUE #230: Enable checkstyle on the bookie tests
13c303f is described below

commit 13c303f916b5b82702d73e2377b2caf75500243a
Author: Aaron Coburn <[email protected]>
AuthorDate: Tue Dec 12 13:21:42 2017 +0100

    ISSUE #230: Enable checkstyle on the bookie tests
    
    Descriptions of the changes in this PR:
    
    With this change, checkstyle verification is enabled for the
    entire bookkeeper-server package, and all packages use the same 
`suppressions.xml` file.
    
    Master Issue: #230
    
    Author: Aaron Coburn <[email protected]>
    
    Reviewers: Enrico Olivelli <[email protected]>, Jia Zhai <None>
    
    This closes #830 from acoburn/checkstyle_test_bookie, closes #230
---
 bookkeeper-server/pom.xml                          |  2 +-
 .../bookkeeper/bookie/AdvertisedAddressTest.java   |  5 +-
 .../apache/bookkeeper/bookie/BookieAccessor.java   |  4 +-
 .../bookie/BookieInitializationTest.java           | 85 +++++++++++-----------
 .../bookkeeper/bookie/BookieJournalNoSyncTest.java | 16 ++--
 .../bookkeeper/bookie/BookieJournalTest.java       | 43 ++++++-----
 .../bookkeeper/bookie/BookieShutdownTest.java      | 14 ++--
 .../bookie/BookieStorageThresholdTest.java         | 25 +++++--
 .../apache/bookkeeper/bookie/BookieThreadTest.java | 10 ++-
 .../bookkeeper/bookie/CompactionByBytesTest.java   |  3 +
 .../bookkeeper/bookie/CompactionByEntriesTest.java |  3 +
 .../apache/bookkeeper/bookie/CompactionTest.java   | 57 ++++++++-------
 .../org/apache/bookkeeper/bookie/CookieTest.java   | 39 +++++-----
 .../apache/bookkeeper/bookie/CreateNewLogTest.java | 42 ++++++-----
 .../bookie/EnableZkSecurityBasicTest.java          | 12 +--
 .../bookkeeper/bookie/IndexCorruptionTest.java     | 31 ++++----
 .../bookkeeper/bookie/IndexPersistenceMgrTest.java | 34 +++++----
 .../apache/bookkeeper/bookie/LedgerCacheTest.java  | 61 ++++++++--------
 .../bookkeeper/bookie/LedgerStorageTest.java       |  8 +-
 .../bookkeeper/bookie/TestEntryMemTable.java       | 15 ++--
 .../bookie/TestGcOverreplicatedLedger.java         |  9 ++-
 .../bookkeeper/bookie/TestLedgerDirsManager.java   |  8 +-
 .../bookkeeper/bookie/TestSkipListArena.java       | 42 ++++++-----
 .../apache/bookkeeper/bookie/TestSyncThread.java   | 30 +++++---
 .../bookkeeper/bookie/UpdateCookieCmdTest.java     | 14 ++--
 .../org/apache/bookkeeper/bookie/UpgradeTest.java  | 24 +++---
 .../resources/bookkeeper/server-suppressions.xml   | 30 --------
 27 files changed, 358 insertions(+), 308 deletions(-)

diff --git a/bookkeeper-server/pom.xml b/bookkeeper-server/pom.xml
index 28d90ba..b7b33eb 100644
--- a/bookkeeper-server/pom.xml
+++ b/bookkeeper-server/pom.xml
@@ -365,7 +365,7 @@
         </dependencies>
         <configuration>
           <configLocation>bookkeeper/checkstyle.xml</configLocation>
-          
<suppressionsLocation>bookkeeper/server-suppressions.xml</suppressionsLocation>
+          
<suppressionsLocation>bookkeeper/suppressions.xml</suppressionsLocation>
           <consoleOutput>true</consoleOutput>
           <failOnViolation>true</failOnViolation>
           <includeResources>false</includeResources>
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/AdvertisedAddressTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/AdvertisedAddressTest.java
index eb4b7fd..2f42ca4 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/AdvertisedAddressTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/AdvertisedAddressTest.java
@@ -36,6 +36,9 @@ import org.apache.bookkeeper.test.PortManager;
 import org.apache.bookkeeper.util.IOUtils;
 import org.junit.Test;
 
+/**
+ * Tests for when the setAdvertisedAddress is specified.
+ */
 public class AdvertisedAddressTest extends BookKeeperClusterTestCase {
     final int bookiePort = PortManager.nextFreePort();
 
@@ -82,7 +85,7 @@ public class AdvertisedAddressTest extends 
BookKeeperClusterTestCase {
     }
 
     /**
-     * When advertised address is specified, it should override the use
+     * When advertised address is specified, it should override the use.
      */
     @Test
     public void testBothUseHostnameAndAdvertisedAddress() throws Exception {
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieAccessor.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieAccessor.java
index f49f8ae..4c8ad46 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieAccessor.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieAccessor.java
@@ -25,11 +25,11 @@ import java.io.IOException;
 import org.apache.bookkeeper.bookie.CheckpointSource.Checkpoint;
 
 /**
- * Accessor class to avoid making Bookie internals public
+ * Accessor class to avoid making Bookie internals public.
  */
 public class BookieAccessor {
     /**
-     * Force a bookie to flush its ledger storage
+     * Force a bookie to flush its ledger storage.
      */
     public static void forceFlush(Bookie b) throws IOException {
         CheckpointSourceList source = new CheckpointSourceList(b.journals);
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieInitializationTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieInitializationTest.java
index 8da34ef..990c205 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieInitializationTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieInitializationTest.java
@@ -24,6 +24,7 @@ import static com.google.common.base.Charsets.UTF_8;
 import static 
org.apache.bookkeeper.util.BookKeeperConstants.BOOKIE_STATUS_FILENAME;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -61,7 +62,6 @@ import org.apache.bookkeeper.zookeeper.ZooKeeperClient;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.ZooKeeper;
 import org.apache.zookeeper.data.Stat;
-import org.junit.Assert;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TestName;
@@ -69,7 +69,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * Testing bookie initialization cases
+ * Testing bookie initialization cases.
  */
 public class BookieInitializationTest extends BookKeeperClusterTestCase {
     private static final Logger LOG = LoggerFactory
@@ -96,7 +96,7 @@ public class BookieInitializationTest extends 
BookKeeperClusterTestCase {
     @Override
     public void tearDown() throws Exception {
         super.tearDown();
-        if(rm != null) {
+        if (rm != null) {
             rm.close();
         }
     }
@@ -140,7 +140,7 @@ public class BookieInitializationTest extends 
BookKeeperClusterTestCase {
 
         bkServer.start();
         bkServer.join();
-        Assert.assertEquals("Failed to return ExitCode.ZK_REG_FAIL",
+        assertEquals("Failed to return ExitCode.ZK_REG_FAIL",
                 ExitCode.ZK_REG_FAIL, bkServer.getExitCode());
     }
 
@@ -163,12 +163,12 @@ public class BookieInitializationTest extends 
BookKeeperClusterTestCase {
 
         b.testRegisterBookie(conf);
         ZooKeeper zooKeeper = ((ZKRegistrationManager) rm).getZk();
-        Assert.assertNotNull("Bookie registration node doesn't exists!",
+        assertNotNull("Bookie registration node doesn't exists!",
             zooKeeper.exists(bkRegPath, false));
 
         // test register bookie again if the registeration node is created by 
itself.
         b.testRegisterBookie(conf);
-        Assert.assertNotNull("Bookie registration node doesn't exists!",
+        assertNotNull("Bookie registration node doesn't exists!",
             zooKeeper.exists(bkRegPath, false));
     }
 
@@ -197,7 +197,7 @@ public class BookieInitializationTest extends 
BookKeeperClusterTestCase {
         b.testRegisterBookie(conf);
 
         Stat bkRegNode1 = ((ZKRegistrationManager) 
rm).getZk().exists(bkRegPath, false);
-        Assert.assertNotNull("Bookie registration node doesn't exists!",
+        assertNotNull("Bookie registration node doesn't exists!",
                 bkRegNode1);
 
         // simulating bookie restart, on restart bookie will create new
@@ -225,7 +225,7 @@ public class BookieInitializationTest extends 
BookKeeperClusterTestCase {
                 Throwable t = e.getCause();
                 if (t instanceof KeeperException) {
                     KeeperException ke = (KeeperException) t;
-                    Assert.assertTrue("ErrorCode:" + ke.code()
+                    assertTrue("ErrorCode:" + ke.code()
                             + ", Registration node exists",
                         ke.code() != KeeperException.Code.NODEEXISTS);
                 }
@@ -234,8 +234,8 @@ public class BookieInitializationTest extends 
BookKeeperClusterTestCase {
 
             // verify ephemeral owner of the bkReg znode
             Stat bkRegNode2 = newZk.exists(bkRegPath, false);
-            Assert.assertNotNull("Bookie registration has been failed", 
bkRegNode2);
-            Assert.assertTrue("Bookie is referring to old registration znode:"
+            assertNotNull("Bookie registration has been failed", bkRegNode2);
+            assertTrue("Bookie is referring to old registration znode:"
                 + bkRegNode1 + ", New ZNode:" + bkRegNode2, bkRegNode1
                 .getEphemeralOwner() != bkRegNode2.getEphemeralOwner());
         } finally {
@@ -268,7 +268,7 @@ public class BookieInitializationTest extends 
BookKeeperClusterTestCase {
 
         b.testRegisterBookie(conf);
         Stat bkRegNode1 = zkc.exists(bkRegPath, false);
-        Assert.assertNotNull("Bookie registration node doesn't exists!",
+        assertNotNull("Bookie registration node doesn't exists!",
                 bkRegNode1);
 
         // simulating bookie restart, on restart bookie will create new
@@ -287,15 +287,15 @@ public class BookieInitializationTest extends 
BookKeeperClusterTestCase {
 
             if (t3 instanceof KeeperException) {
                 KeeperException ke = (KeeperException) t3;
-                Assert.assertTrue("ErrorCode:" + ke.code()
+                assertTrue("ErrorCode:" + ke.code()
                         + ", Registration node doesn't exists",
                         ke.code() == KeeperException.Code.NODEEXISTS);
 
                 // verify ephemeral owner of the bkReg znode
                 Stat bkRegNode2 = newzk.exists(bkRegPath, false);
-                Assert.assertNotNull("Bookie registration has been failed",
+                assertNotNull("Bookie registration has been failed",
                         bkRegNode2);
-                Assert.assertTrue(
+                assertTrue(
                         "Bookie wrongly registered. Old registration znode:"
                                 + bkRegNode1 + ", New znode:" + bkRegNode2,
                         bkRegNode1.getEphemeralOwner() == bkRegNode2
@@ -339,7 +339,7 @@ public class BookieInitializationTest extends 
BookKeeperClusterTestCase {
         } catch (BindException e) {
             // Ok
         } catch (IOException e) {
-            Assert.assertTrue("BKServer allowed duplicate Startups!",
+            assertTrue("BKServer allowed duplicate Startups!",
                     e.getMessage().contains("bind"));
         } finally {
             bs1.shutdown();
@@ -412,18 +412,18 @@ public class BookieInitializationTest extends 
BookKeeperClusterTestCase {
 
     /**
      * Verify that if I try to start a bookie without zk initialized, it won't
-     * prevent me from starting the bookie when zk is initialized
+     * prevent me from starting the bookie when zk is initialized.
      */
     @Test
     public void testStartBookieWithoutZKInitialized() throws Exception {
         File tmpDir = createTempDir("bookie", "test");
-        final String ZK_ROOT = "/ledgers2";
+        final String zkRoot = "/ledgers2";
 
         final ServerConfiguration conf = 
TestBKConfiguration.newServerConfiguration()
             .setZkServers(zkUtil.getZooKeeperConnectString())
             .setZkTimeout(5000).setJournalDirName(tmpDir.getPath())
             .setLedgerDirNames(new String[] { tmpDir.getPath() });
-        conf.setZkLedgersRootPath(ZK_ROOT);
+        conf.setZkLedgersRootPath(zkRoot);
         try {
             new Bookie(conf);
             fail("Should throw NoNodeException");
@@ -432,7 +432,7 @@ public class BookieInitializationTest extends 
BookKeeperClusterTestCase {
         }
         ClientConfiguration clientConf = new ClientConfiguration();
         clientConf.setZkServers(zkUtil.getZooKeeperConnectString());
-        clientConf.setZkLedgersRootPath(ZK_ROOT);
+        clientConf.setZkLedgersRootPath(zkRoot);
         BookKeeperAdmin.format(clientConf, false, false);
 
         Bookie b = new Bookie(conf);
@@ -454,38 +454,38 @@ public class BookieInitializationTest extends 
BookKeeperClusterTestCase {
                 .setDiskCheckInterval(1000)
                 .setDiskUsageThreshold((1.0f - ((float) usableSpace / (float) 
totalSpace)) * 0.999f)
                 .setDiskUsageWarnThreshold(0.0f);
-        
-        // if isForceGCAllowWhenNoSpace or readOnlyModeEnabled is not set and 
Bookie is 
+
+        // if isForceGCAllowWhenNoSpace or readOnlyModeEnabled is not set and 
Bookie is
         // started when Disk is full, then it will fail to start with 
NoWritableLedgerDirException
-        
+
         conf.setIsForceGCAllowWhenNoSpace(false)
             .setReadOnlyModeEnabled(false);
         try {
             new Bookie(conf);
             fail("NoWritableLedgerDirException expected");
-        } catch(NoWritableLedgerDirException e) {
+        } catch (NoWritableLedgerDirException e) {
             // expected
         }
-        
+
         conf.setIsForceGCAllowWhenNoSpace(true)
             .setReadOnlyModeEnabled(false);
         try {
             new Bookie(conf);
             fail("NoWritableLedgerDirException expected");
-        } catch(NoWritableLedgerDirException e) {
+        } catch (NoWritableLedgerDirException e) {
             // expected
         }
-        
+
         conf.setIsForceGCAllowWhenNoSpace(false)
             .setReadOnlyModeEnabled(true);
         try {
             new Bookie(conf);
             fail("NoWritableLedgerDirException expected");
-        } catch(NoWritableLedgerDirException e) {
+        } catch (NoWritableLedgerDirException e) {
             // expected
         }
     }
-    
+
     /**
      * Check disk full. Expected to start as read-only.
      */
@@ -501,7 +501,7 @@ public class BookieInitializationTest extends 
BookKeeperClusterTestCase {
                 .setDiskCheckInterval(1000)
                 .setDiskUsageThreshold((1.0f - ((float) usableSpace / (float) 
totalSpace)) * 0.999f)
                 .setDiskUsageWarnThreshold(0.0f);
-        
+
         // if isForceGCAllowWhenNoSpace and readOnlyModeEnabled are set, then 
Bookie should
         // start with readonlymode when Disk is full (assuming there is no 
need for creation of index file
         // while replaying the journal)
@@ -510,7 +510,7 @@ public class BookieInitializationTest extends 
BookKeeperClusterTestCase {
         final Bookie bk = new Bookie(conf);
         bk.start();
         Thread.sleep((conf.getDiskCheckInterval() * 2) + 100);
-        
+
         assertTrue(bk.isReadOnly());
         bk.shutdown();
     }
@@ -547,7 +547,7 @@ public class BookieInitializationTest extends 
BookKeeperClusterTestCase {
             return exitCode;
         }
     }
-    
+
     @Test
     public void testWithDiskFullAndAbilityToCreateNewIndexFile() throws 
Exception {
         File tmpDir = createTempDir("DiskCheck", "test");
@@ -568,7 +568,7 @@ public class BookieInitializationTest extends 
BookKeeperClusterTestCase {
         for (int i = 0; i < numOfEntries; i++) {
             entryId = lh.addEntry("data".getBytes());
         }
-        Assert.assertTrue("EntryId of the recently added entry should be 0", 
entryId == (numOfEntries - 1));
+        assertTrue("EntryId of the recently added entry should be 0", entryId 
== (numOfEntries - 1));
         // We want to simulate the scenario where Bookie is killed abruptly, so
         // SortedLedgerStorage's EntryMemTable and IndexInMemoryPageManager are
         // not flushed and hence when bookie is restarted it will replay the
@@ -599,7 +599,7 @@ public class BookieInitializationTest extends 
BookKeeperClusterTestCase {
         server = new BookieServer(conf);
         server.start();
         Thread.sleep((conf.getDiskCheckInterval() * 2) + 100);
-        Assert.assertTrue("Bookie should be up and running", 
server.getBookie().isRunning());
+        assertTrue("Bookie should be up and running", 
server.getBookie().isRunning());
         assertTrue(server.getBookie().isReadOnly());
         server.shutdown();
         bkClient.close();
@@ -621,7 +621,7 @@ public class BookieInitializationTest extends 
BookKeeperClusterTestCase {
             // Simulating disk errors by directly calling #init
             LedgerDirsManager ldm = new LedgerDirsManager(conf, 
conf.getLedgerDirs(),
                     new DiskChecker(conf.getDiskUsageThreshold(), 
conf.getDiskUsageWarnThreshold()));
-            LedgerDirsMonitor ledgerMonitor = new LedgerDirsMonitor(conf, 
+            LedgerDirsMonitor ledgerMonitor = new LedgerDirsMonitor(conf,
                     new DiskChecker(conf.getDiskUsageThreshold(), 
conf.getDiskUsageWarnThreshold()), ldm);
             ledgerMonitor.init();
             fail("should throw exception");
@@ -645,12 +645,12 @@ public class BookieInitializationTest extends 
BookKeeperClusterTestCase {
         
conf.setZkServers(zkUtil.getZooKeeperConnectString()).setZkTimeout(5000).setBookiePort(port)
         .setJournalDirName(tmpDir1.getPath())
         .setLedgerDirNames(new String[] { tmpDir1.getPath(), tmpDir2.getPath() 
})
-        .setIndexDirName(new String[] { tmpDir1.getPath()});;
+        .setIndexDirName(new String[] { tmpDir1.getPath() });
         conf.setAllowMultipleDirsUnderSameDiskPartition(false);
         BookieServer bs1 = null;
         try {
             bs1 = new BookieServer(conf);
-            Assert.fail("Bookkeeper should not have started since 
AllowMultipleDirsUnderSameDiskPartition is not enabled");
+            fail("Bookkeeper should not have started since 
AllowMultipleDirsUnderSameDiskPartition is not enabled");
         } catch (DiskPartitionDuplicationException dpde) {
             // Expected
         } finally {
@@ -671,7 +671,7 @@ public class BookieInitializationTest extends 
BookKeeperClusterTestCase {
         bs1 = null;
         try {
             bs1 = new BookieServer(conf);
-            Assert.fail("Bookkeeper should not have started since 
AllowMultipleDirsUnderSameDiskPartition is not enabled");
+            fail("Bookkeeper should not have started since 
AllowMultipleDirsUnderSameDiskPartition is not enabled");
         } catch (DiskPartitionDuplicationException dpde) {
             // Expected
         } finally {
@@ -692,8 +692,7 @@ public class BookieInitializationTest extends 
BookKeeperClusterTestCase {
         bs1 = null;
         try {
             bs1 = new BookieServer(conf);
-            Assert.fail(
-                    "Bookkeeper should not have started since 
AllowMultipleDirsUnderSameDiskPartition is not enabled");
+            fail("Bookkeeper should not have started since 
AllowMultipleDirsUnderSameDiskPartition is not enabled");
         } catch (DiskPartitionDuplicationException dpde) {
             // Expected
         } finally {
@@ -725,16 +724,16 @@ public class BookieInitializationTest extends 
BookKeeperClusterTestCase {
         conf.setAllowMultipleDirsUnderSameDiskPartition(true);
         BookieServer bs1 = null;
         try {
-            bs1 = new BookieServer(conf);          
+            bs1 = new BookieServer(conf);
         } catch (DiskPartitionDuplicationException dpde) {
-            Assert.fail("Bookkeeper should have started since 
AllowMultipleDirsUnderSameDiskPartition is enabled");
+            fail("Bookkeeper should have started since 
AllowMultipleDirsUnderSameDiskPartition is enabled");
         } finally {
             if (bs1 != null) {
                 bs1.shutdown();
             }
         }
     }
-    
+
     private ZooKeeperClient createNewZKClient() throws Exception {
         // create a zookeeper client
         LOG.debug("Instantiate ZK Client");
@@ -782,7 +781,7 @@ public class BookieInitializationTest extends 
BookKeeperClusterTestCase {
     }
 
     /**
-     * Check when we start a ReadOnlyBookie, we should ignore bookie status
+     * Check when we start a ReadOnlyBookie, we should ignore bookie status.
      */
     @Test(timeout = 10000)
     public void testReadOnlyBookieShouldIgnoreBookieStatus() throws Exception {
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieJournalNoSyncTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieJournalNoSyncTest.java
index baa2d7d..d345225 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieJournalNoSyncTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieJournalNoSyncTest.java
@@ -20,15 +20,19 @@
  */
 package org.apache.bookkeeper.bookie;
 
+import static org.junit.Assert.assertEquals;
+
 import java.util.Enumeration;
 
 import org.apache.bookkeeper.client.BookKeeper.DigestType;
 import org.apache.bookkeeper.client.LedgerEntry;
 import org.apache.bookkeeper.client.LedgerHandle;
 import org.apache.bookkeeper.test.BookKeeperClusterTestCase;
-import org.junit.Assert;
 import org.junit.Test;
 
+/**
+ * Test the bookie journal without sync.
+ */
 public class BookieJournalNoSyncTest extends BookKeeperClusterTestCase {
 
     public BookieJournalNoSyncTest() {
@@ -41,11 +45,11 @@ public class BookieJournalNoSyncTest extends 
BookKeeperClusterTestCase {
     public void testWriteToJournal() throws Exception {
         LedgerHandle lh = bkc.createLedger(1, 1, DigestType.CRC32, new 
byte[0]);
 
-        int N = 10;
+        int n = 10;
 
         long ledgerId = lh.getId();
 
-        for (int i = 0; i < N; i++) {
+        for (int i = 0; i < n; i++) {
             lh.addEntry(("entry-" + i).getBytes());
         }
 
@@ -53,10 +57,10 @@ public class BookieJournalNoSyncTest extends 
BookKeeperClusterTestCase {
 
         LedgerHandle readLh = bkc.openLedger(ledgerId, DigestType.CRC32, new 
byte[0]);
 
-        Enumeration<LedgerEntry> entries = readLh.readEntries(0, N - 1);
-        for (int i = 0; i < N; i++) {
+        Enumeration<LedgerEntry> entries = readLh.readEntries(0, n - 1);
+        for (int i = 0; i < n; i++) {
             LedgerEntry entry = entries.nextElement();
-            Assert.assertEquals("entry-" + i, new String(entry.getEntry()));
+            assertEquals("entry-" + i, new String(entry.getEntry()));
         }
     }
 
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieJournalTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieJournalTest.java
index 6f75bbe..328eddd 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieJournalTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieJournalTest.java
@@ -49,8 +49,11 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+/**
+ * Test the bookie journal.
+ */
 public class BookieJournalTest {
-    private final static Logger LOG = 
LoggerFactory.getLogger(BookieJournalTest.class);
+    private static final Logger LOG = 
LoggerFactory.getLogger(BookieJournalTest.class);
 
     final Random r = new Random(System.currentTimeMillis());
 
@@ -105,7 +108,7 @@ public class BookieJournalTest {
     }
 
     /**
-     * Generate fence entry
+     * Generate fence entry.
      */
     private ByteBuf generateFenceEntry(long ledgerId) {
         ByteBuf bb = Unpooled.buffer();
@@ -115,7 +118,7 @@ public class BookieJournalTest {
     }
 
     /**
-     * Generate meta entry with given master key
+     * Generate meta entry with given master key.
      */
     private ByteBuf generateMetaEntry(long ledgerId, byte[] masterKey) {
         ByteBuf bb = Unpooled.buffer();
@@ -133,7 +136,7 @@ public class BookieJournalTest {
         FileChannel fc = new RandomAccessFile(fn, "rw").getChannel();
 
         ByteBuffer zeros = ByteBuffer.allocate(512);
-        fc.write(zeros, 4*1024*1024);
+        fc.write(zeros, 4 * 1024 * 1024);
         fc.position(0);
 
         for (int i = 1; i <= 10; i++) {
@@ -148,13 +151,13 @@ public class BookieJournalTest {
         FileChannel fc = new RandomAccessFile(fn, "rw").getChannel();
 
         ByteBuffer zeros = ByteBuffer.allocate(512);
-        fc.write(zeros, 4*1024*1024);
+        fc.write(zeros, 4 * 1024 * 1024);
         fc.position(0);
 
         byte[] data = "JournalTestData".getBytes();
         long lastConfirmed = LedgerHandle.INVALID_ENTRY_ID;
         for (int i = 1; i <= numEntries; i++) {
-            ByteBuf packet = ClientUtil.generatePacket(1, i, lastConfirmed, 
i*data.length, data);
+            ByteBuf packet = ClientUtil.generatePacket(1, i, lastConfirmed, i 
* data.length, data);
             lastConfirmed = i;
             ByteBuffer lenBuff = ByteBuffer.allocate(4);
             lenBuff.putInt(packet.readableBytes());
@@ -195,10 +198,10 @@ public class BookieJournalTest {
         BufferedChannel bc = jc.getBufferedChannel();
 
         byte[] data = new byte[1024];
-        Arrays.fill(data, (byte)'X');
+        Arrays.fill(data, (byte) 'X');
         long lastConfirmed = LedgerHandle.INVALID_ENTRY_ID;
         for (int i = 1; i <= numEntries; i++) {
-            ByteBuf packet = ClientUtil.generatePacket(1, i, lastConfirmed, 
i*data.length, data);
+            ByteBuf packet = ClientUtil.generatePacket(1, i, lastConfirmed, i 
* data.length, data);
             lastConfirmed = i;
             ByteBuffer lenBuff = ByteBuffer.allocate(4);
             lenBuff.putInt(packet.readableBytes());
@@ -224,14 +227,14 @@ public class BookieJournalTest {
         BufferedChannel bc = jc.getBufferedChannel();
 
         byte[] data = new byte[1024];
-        Arrays.fill(data, (byte)'X');
+        Arrays.fill(data, (byte) 'X');
         long lastConfirmed = LedgerHandle.INVALID_ENTRY_ID;
         for (int i = 0; i <= numEntries; i++) {
             ByteBuf packet;
             if (i == 0) {
                 packet = generateMetaEntry(1, masterKey);
             } else {
-                packet = ClientUtil.generatePacket(1, i, lastConfirmed, 
i*data.length, data);
+                packet = ClientUtil.generatePacket(1, i, lastConfirmed, i * 
data.length, data);
             }
             lastConfirmed = i;
             ByteBuffer lenBuff = ByteBuffer.allocate(4);
@@ -258,7 +261,7 @@ public class BookieJournalTest {
         BufferedChannel bc = jc.getBufferedChannel();
 
         byte[] data = new byte[1024];
-        Arrays.fill(data, (byte)'X');
+        Arrays.fill(data, (byte) 'X');
         long lastConfirmed = LedgerHandle.INVALID_ENTRY_ID;
         for (int i = 0; i <= numEntries; i++) {
             ByteBuf packet;
@@ -295,7 +298,7 @@ public class BookieJournalTest {
         ByteBuf paddingBuff = Unpooled.buffer();
         paddingBuff.writeZero(2 * JournalChannel.SECTOR_SIZE);
         byte[] data = new byte[4 * 1024 * 1024];
-        Arrays.fill(data, (byte)'X');
+        Arrays.fill(data, (byte) 'X');
         long lastConfirmed = LedgerHandle.INVALID_ENTRY_ID;
         long length = 0;
         for (int i = 0; i <= numEntries; i++) {
@@ -398,7 +401,7 @@ public class BookieJournalTest {
 
         File ledgerDir = createTempDir("bookie", "ledger");
         Bookie.checkDirectoryStructure(Bookie.getCurrentDirectory(ledgerDir));
-        
+
         writeV5Journal(Bookie.getCurrentDirectory(journalDir), 2 * 
JournalChannel.SECTOR_SIZE,
                 "testV5Journal".getBytes());
 
@@ -538,7 +541,7 @@ public class BookieJournalTest {
      * Test that if the bookie crashes while writing the length
      * of an entry, that we can recover.
      *
-     * This is currently not the case, which is bad as recovery
+     * <p>This is currently not the case, which is bad as recovery
      * should be fine here. The bookie has crashed while writing
      * but so the client has not be notified of success.
      */
@@ -619,12 +622,12 @@ public class BookieJournalTest {
         assertEquals("Ledger Id is wrong", buf.readLong(), 1);
         assertEquals("Entry Id is wrong", buf.readLong(), 100);
         assertEquals("Last confirmed is wrong", buf.readLong(), 99);
-        assertEquals("Length is wrong", buf.readLong(), 100*1024);
+        assertEquals("Length is wrong", buf.readLong(), 100 * 1024);
         buf.readLong(); // skip checksum
         boolean allX = true;
         for (int i = 0; i < 1024; i++) {
             byte x = buf.readByte();
-            allX = allX && x == (byte)'X';
+            allX = allX && x == (byte) 'X';
         }
         assertFalse("Some of buffer should have been zeroed", allX);
 
@@ -637,7 +640,7 @@ public class BookieJournalTest {
     }
 
     /**
-     * Test partial index (truncate master key) with pre-v3 journals
+     * Test partial index (truncate master key) with pre-v3 journals.
      */
     @Test
     public void testPartialFileInfoPreV3Journal1() throws Exception {
@@ -645,7 +648,7 @@ public class BookieJournalTest {
     }
 
     /**
-     * Test partial index with pre-v3 journals
+     * Test partial index with pre-v3 journals.
      */
     @Test
     public void testPartialFileInfoPreV3Journal2() throws Exception {
@@ -693,7 +696,7 @@ public class BookieJournalTest {
     }
 
     /**
-     * Test partial index (truncate master key) with post-v3 journals
+     * Test partial index (truncate master key) with post-v3 journals.
      */
     @Test
     public void testPartialFileInfoPostV3Journal1() throws Exception {
@@ -701,7 +704,7 @@ public class BookieJournalTest {
     }
 
     /**
-     * Test partial index with post-v3 journals
+     * Test partial index with post-v3 journals.
      */
     @Test
     public void testPartialFileInfoPostV3Journal2() throws Exception {
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieShutdownTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieShutdownTest.java
index 4dd61f7..2ea6544 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieShutdownTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieShutdownTest.java
@@ -20,25 +20,29 @@
  */
 package org.apache.bookkeeper.bookie;
 
+import static org.junit.Assert.fail;
+
 import java.nio.ByteBuffer;
 import java.util.Random;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
-import org.apache.bookkeeper.client.BKException;
-import org.apache.bookkeeper.client.LedgerHandle;
+
 import org.apache.bookkeeper.client.AsyncCallback.AddCallback;
+import org.apache.bookkeeper.client.BKException;
 import org.apache.bookkeeper.client.BookKeeper.DigestType;
+import org.apache.bookkeeper.client.LedgerHandle;
 import org.apache.bookkeeper.conf.ServerConfiguration;
 import org.apache.bookkeeper.test.BookKeeperClusterTestCase;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static org.junit.Assert.*;
-
+/**
+ * Test bookie shutdown.
+ */
 public class BookieShutdownTest extends BookKeeperClusterTestCase {
 
-    private final static Logger LOG = 
LoggerFactory.getLogger(BookieShutdownTest.class);
+    private static final Logger LOG = 
LoggerFactory.getLogger(BookieShutdownTest.class);
 
     public BookieShutdownTest() {
         super(3);
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieStorageThresholdTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieStorageThresholdTest.java
index cea3b52..ad7ba1e 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieStorageThresholdTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieStorageThresholdTest.java
@@ -21,7 +21,9 @@
 
 package org.apache.bookkeeper.bookie;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.io.File;
 import java.util.concurrent.CountDownLatch;
@@ -40,11 +42,14 @@ import org.apache.bookkeeper.util.TestUtils;
 import org.junit.Before;
 import org.junit.Test;
 
+/**
+ * Test BookieStorage with a threshold.
+ */
 public class BookieStorageThresholdTest extends BookKeeperClusterTestCase {
 
-    static int NUM_BOOKIES = 1;
-    static int NUM_ENTRIES = 100;
-    static int ENTRY_SIZE = 1024;
+    private static final int NUM_BOOKIES = 1;
+    private static final int NUM_ENTRIES = 100;
+    private static final int ENTRY_SIZE = 1024;
 
     final String msg;
     DigestType digestType = DigestType.CRC32;
@@ -109,6 +114,9 @@ public class BookieStorageThresholdTest extends 
BookKeeperClusterTestCase {
         return lhs;
     }
 
+    /**
+     * A Threshold-based disk checker test.
+     */
     public class ThresholdTestDiskChecker extends DiskChecker {
 
         final AtomicBoolean injectDiskOutOfSpaceException;
@@ -137,8 +145,8 @@ public class BookieStorageThresholdTest extends 
BookKeeperClusterTestCase {
         stopAllBookies();
         ServerConfiguration conf = newServerConfiguration();
         File ledgerDir1 = createTempDir("ledger", "test1");
-        File ledgerDir2 = createTempDir("ledger","test2");
-        File journalDir = createTempDir("journal","test");
+        File ledgerDir2 = createTempDir("ledger", "test2");
+        File journalDir = createTempDir("journal", "test");
         String[] ledgerDirNames = new String[]{
             ledgerDir1.getPath(),
             ledgerDir2.getPath()
@@ -235,14 +243,15 @@ public class BookieStorageThresholdTest extends 
BookKeeperClusterTestCase {
         // force GC.
         // Because of getWritableLedgerDirsForNewLog, compaction would be able 
to create newlog and compact even though
         // there are no writableLedgerDirs
-        for(File ledgerDir : bookie.getLedgerDirsManager().getAllLedgerDirs()) 
{
+        for (File ledgerDir : 
bookie.getLedgerDirsManager().getAllLedgerDirs()) {
             assertFalse("Found entry log file ([0,1,2].log. They should have 
been compacted" + ledgerDir,
                 TestUtils.hasLogFiles(ledgerDir.getParentFile(), true, 0, 1, 
2));
         }
 
         try {
             ledgerDirsManager.getWritableLedgerDirs();
-            fail("It is expected that there wont be any Writable LedgerDirs 
and getWritableLedgerDirs is supposed to throw NoWritableLedgerDirException");
+            fail("It is expected that there wont be any Writable LedgerDirs 
and getWritableLedgerDirs "
+                    + "is supposed to throw NoWritableLedgerDirException");
         } catch (NoWritableLedgerDirException nowritableDirsException) {
         }
 
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieThreadTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieThreadTest.java
index 2420a06..adc187a 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieThreadTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieThreadTest.java
@@ -24,12 +24,15 @@ import org.junit.Assert;
 import org.junit.Test;
 
 /**
- * Testing bookie thread cases
+ * Testing bookie thread cases.
  */
 public class BookieThreadTest {
 
     private CountDownLatch runningLatch = new CountDownLatch(1);
 
+    /**
+     * A BookieThread implementation.
+     */
     public class MyThread extends BookieThread {
 
         public MyThread(String threadName) {
@@ -47,6 +50,9 @@ public class BookieThreadTest {
         }
     }
 
+    /**
+     * A critical thread implementation.
+     */
     public class MyCriticalThread extends BookieCriticalThread {
 
         public MyCriticalThread(String threadName) {
@@ -65,7 +71,7 @@ public class BookieThreadTest {
     }
 
     /**
-     * Test verifies uncaught exception handling of BookieThread
+     * Test verifies uncaught exception handling of BookieThread.
      */
     @Test
     public void testUncaughtException() throws Exception {
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/CompactionByBytesTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/CompactionByBytesTest.java
index 1893761..29303d7 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/CompactionByBytesTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/CompactionByBytesTest.java
@@ -20,6 +20,9 @@
  */
 package org.apache.bookkeeper.bookie;
 
+/**
+ * Test compaction by bytes.
+ */
 public class CompactionByBytesTest extends CompactionTest {
     public CompactionByBytesTest() {
         super(true);
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/CompactionByEntriesTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/CompactionByEntriesTest.java
index 3ffb210..df871a3 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/CompactionByEntriesTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/CompactionByEntriesTest.java
@@ -20,6 +20,9 @@
  */
 package org.apache.bookkeeper.bookie;
 
+/**
+ * Test compactions by entries.
+ */
 public class CompactionByEntriesTest extends CompactionTest {
     public CompactionByEntriesTest() {
         super(false);
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/CompactionTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/CompactionTest.java
index 08bb131..a678139 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/CompactionTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/CompactionTest.java
@@ -28,31 +28,33 @@ import static org.junit.Assert.fail;
 
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
+
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.List;
-import org.apache.bookkeeper.client.BookKeeper.DigestType;
+
 import 
org.apache.bookkeeper.bookie.LedgerDirsManager.NoWritableLedgerDirException;
+import org.apache.bookkeeper.client.BookKeeper.DigestType;
 import org.apache.bookkeeper.client.LedgerEntry;
 import org.apache.bookkeeper.client.LedgerHandle;
 import org.apache.bookkeeper.client.LedgerMetadata;
-import org.apache.bookkeeper.conf.TestBKConfiguration;
 import org.apache.bookkeeper.conf.ServerConfiguration;
+import org.apache.bookkeeper.conf.TestBKConfiguration;
 import org.apache.bookkeeper.meta.LedgerManager;
 import org.apache.bookkeeper.meta.LedgerManagerFactory;
-import org.apache.bookkeeper.stats.NullStatsLogger;
 import org.apache.bookkeeper.proto.BookieServer;
 import org.apache.bookkeeper.proto.BookkeeperInternalCallbacks.GenericCallback;
 import 
org.apache.bookkeeper.proto.BookkeeperInternalCallbacks.LedgerMetadataListener;
 import org.apache.bookkeeper.proto.BookkeeperInternalCallbacks.Processor;
+import org.apache.bookkeeper.stats.NullStatsLogger;
 import org.apache.bookkeeper.test.BookKeeperClusterTestCase;
 import org.apache.bookkeeper.util.DiskChecker;
 import org.apache.bookkeeper.util.HardLink;
@@ -70,10 +72,10 @@ import org.slf4j.LoggerFactory;
  */
 public abstract class CompactionTest extends BookKeeperClusterTestCase {
 
-    private final static Logger LOG = 
LoggerFactory.getLogger(CompactionTest.class);
+    private static final Logger LOG = 
LoggerFactory.getLogger(CompactionTest.class);
 
-    static int ENTRY_SIZE = 1024;
-    static int NUM_BOOKIES = 1;
+    private static final int ENTRY_SIZE = 1024;
+    private static final int NUM_BOOKIES = 1;
 
     private final boolean isThrottleByBytes;
     private final DigestType digestType;
@@ -138,13 +140,13 @@ public abstract class CompactionTest extends 
BookKeeperClusterTestCase {
         // first ledger write 2 entries, which is less than low water mark
         int num1 = 2;
         // third ledger write more than high water mark entries
-        int num3 = (int)(numEntries * 0.7f);
+        int num3 = (int) (numEntries * 0.7f);
         // second ledger write remaining entries, which is higher than low 
water mark
         // and less than high water mark
         int num2 = numEntries - num3 - num1;
 
         LedgerHandle[] lhs = new LedgerHandle[3];
-        for (int i=0; i<3; ++i) {
+        for (int i = 0; i < 3; ++i) {
             lhs[i] = bkc.createLedger(NUM_BOOKIES, NUM_BOOKIES, digestType, 
"".getBytes());
         }
 
@@ -257,8 +259,8 @@ public abstract class CompactionTest extends 
BookKeeperClusterTestCase {
         // Minor and Major compaction times should be larger than when we 
started
         // this test.
         assertTrue("Minor or major compaction did not trigger even on 
forcing.",
-                storage.gcThread.lastMajorCompactionTime > startTime &&
-                storage.gcThread.lastMinorCompactionTime > startTime);
+                storage.gcThread.lastMajorCompactionTime > startTime
+                && storage.gcThread.lastMinorCompactionTime > startTime);
         storage.shutdown();
     }
 
@@ -377,8 +379,8 @@ public abstract class CompactionTest extends 
BookKeeperClusterTestCase {
         // trigger relocateIndexFileAndFlushHeader. If we only have one ledger 
dir, compaction will always fail
         // when there's no writeable ledger dir.
         File ledgerDir1 = createTempDir("ledger", "test1");
-        File ledgerDir2 = createTempDir("ledger","test2");
-        File journalDir = createTempDir("journal","test");
+        File ledgerDir2 = createTempDir("ledger", "test2");
+        File journalDir = createTempDir("journal", "test");
         String[] ledgerDirNames = new String[]{
             ledgerDir1.getPath(),
             ledgerDir2.getPath()
@@ -450,7 +452,7 @@ public abstract class CompactionTest extends 
BookKeeperClusterTestCase {
             }
         }
     }
-    
+
     @Test
     public void testMajorCompaction() throws Exception {
 
@@ -534,7 +536,7 @@ public abstract class CompactionTest extends 
BookKeeperClusterTestCase {
 
         // create a ledger to write a few entries
         LedgerHandle alh = bkc.createLedger(NUM_BOOKIES, NUM_BOOKIES, 
digestType, "".getBytes());
-        for (int i=0; i<3; i++) {
+        for (int i = 0; i < 3; i++) {
            alh.addEntry(msg.getBytes());
         }
         alh.close();
@@ -591,7 +593,7 @@ public abstract class CompactionTest extends 
BookKeeperClusterTestCase {
         Bookie.checkDirectoryStructure(curDir);
         conf.setLedgerDirNames(new String[] {tmpDir.toString()});
 
-        conf.setEntryLogSizeLimit(EntryLogger.LOGFILE_HEADER_SIZE + 3 * 
(4+ENTRY_SIZE));
+        conf.setEntryLogSizeLimit(EntryLogger.LOGFILE_HEADER_SIZE + 3 * (4 + 
ENTRY_SIZE));
         conf.setGcWaitTime(100);
         conf.setMinorCompactionThreshold(0.7f);
         conf.setMajorCompactionThreshold(0.0f);
@@ -610,7 +612,7 @@ public abstract class CompactionTest extends 
BookKeeperClusterTestCase {
                         } else if (o == CheckpointSource.Checkpoint.MIN) {
                             return 1;
                         }
-                        return id - ((MyCheckpoint)o).id;
+                        return id - ((MyCheckpoint) o).id;
                     }
                 }
 
@@ -623,7 +625,7 @@ public abstract class CompactionTest extends 
BookKeeperClusterTestCase {
                         throws IOException {
                 }
             };
-        final byte[] KEY = "foobar".getBytes();
+        final byte[] key = "foobar".getBytes();
         File log0 = new File(curDir, "0.log");
         LedgerDirsManager dirs = new LedgerDirsManager(conf, 
conf.getLedgerDirs(),
                 new DiskChecker(conf.getDiskUsageThreshold(), 
conf.getDiskUsageWarnThreshold()));
@@ -640,9 +642,9 @@ public abstract class CompactionTest extends 
BookKeeperClusterTestCase {
         ledgers.add(1L);
         ledgers.add(2L);
         ledgers.add(3L);
-        storage.setMasterKey(1, KEY);
-        storage.setMasterKey(2, KEY);
-        storage.setMasterKey(3, KEY);
+        storage.setMasterKey(1, key);
+        storage.setMasterKey(2, key);
+        storage.setMasterKey(3, key);
         storage.addEntry(genEntry(1, 1, ENTRY_SIZE));
         storage.addEntry(genEntry(2, 1, ENTRY_SIZE));
         storage.addEntry(genEntry(2, 2, ENTRY_SIZE));
@@ -673,7 +675,7 @@ public abstract class CompactionTest extends 
BookKeeperClusterTestCase {
         assertFalse("Log shouldnt exist", log0.exists());
 
         ledgers.add(4L);
-        storage.setMasterKey(4, KEY);
+        storage.setMasterKey(4, key);
         storage.addEntry(genEntry(4, 1, ENTRY_SIZE)); // force ledger 1 page 
to flush
 
         storage = new InterleavedLedgerStorage();
@@ -800,7 +802,7 @@ public abstract class CompactionTest extends 
BookKeeperClusterTestCase {
         bb.writeLong(ledger);
         bb.writeLong(entry);
         while (bb.isWritable()) {
-            bb.writeByte((byte)0xFF);
+            bb.writeByte((byte) 0xFF);
         }
         return bb;
     }
@@ -1093,7 +1095,8 @@ public abstract class CompactionTest extends 
BookKeeperClusterTestCase {
                     File dir = compactedLogFile.getParentFile();
                     String compactedFilename = compactedLogFile.getName();
                     // create a hard link "x.log" for file "x.log.y.compacted"
-                    this.newEntryLogFile = new File(dir, 
compactedFilename.substring(0, compactedFilename.indexOf(".log") + 4));
+                    this.newEntryLogFile = new File(dir, 
compactedFilename.substring(0,
+                                compactedFilename.indexOf(".log") + 4));
                     File hardlinkFile = new File(dir, 
newEntryLogFile.getName());
                     if (!hardlinkFile.exists()) {
                         HardLink.createHardLink(compactedLogFile, 
hardlinkFile);
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/CookieTest.java 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/CookieTest.java
index a634e25..c39ed82 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/CookieTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/CookieTest.java
@@ -25,6 +25,7 @@ import static 
org.apache.bookkeeper.bookie.UpgradeTest.newV1JournalDirectory;
 import static org.apache.bookkeeper.bookie.UpgradeTest.newV1LedgerDirectory;
 import static org.apache.bookkeeper.bookie.UpgradeTest.newV2JournalDirectory;
 import static org.apache.bookkeeper.bookie.UpgradeTest.newV2LedgerDirectory;
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -50,9 +51,11 @@ import org.apache.bookkeeper.versioning.LongVersion;
 import org.apache.bookkeeper.versioning.Version;
 import org.apache.bookkeeper.versioning.Versioned;
 import org.apache.commons.io.FileUtils;
-import org.junit.Assert;
 import org.junit.Test;
 
+/**
+ * Test cookies.
+ */
 public class CookieTest extends BookKeeperClusterTestCase {
     final int bookiePort = PortManager.nextFreePort();
 
@@ -86,7 +89,7 @@ public class CookieTest extends BookKeeperClusterTestCase {
     @Override
     public void tearDown() throws Exception {
         super.tearDown();
-        if(rm != null) {
+        if (rm != null) {
             rm.close();
         }
     }
@@ -111,7 +114,7 @@ public class CookieTest extends BookKeeperClusterTestCase {
     /**
      * Test that if a zookeeper cookie
      * is different to a local cookie, the bookie
-     * will fail to start
+     * will fail to start.
      */
     @Test
     public void testBadJournalCookie() throws Exception {
@@ -146,7 +149,7 @@ public class CookieTest extends BookKeeperClusterTestCase {
     /**
      * Test that if a directory is removed from
      * the configuration, the bookie will fail to
-     * start
+     * start.
      */
     @Test
     public void testDirectoryMissing() throws Exception {
@@ -187,7 +190,7 @@ public class CookieTest extends BookKeeperClusterTestCase {
 
     /**
      * Test that if a cookie is missing from a journal directory
-     * the bookie will fail to start
+     * the bookie will fail to start.
      */
     @Test
     public void testCookieMissingOnJournalDir() throws Exception {
@@ -217,7 +220,7 @@ public class CookieTest extends BookKeeperClusterTestCase {
 
     /**
      * Test that if a cookie is missing from a journal directory
-     * the bookie will fail to start
+     * the bookie will fail to start.
      */
     @Test
     public void testCookieMissingOnLedgerDir() throws Exception {
@@ -248,7 +251,7 @@ public class CookieTest extends BookKeeperClusterTestCase {
     /**
      * Test that if a directory is added to a
      * preexisting bookie, the bookie will fail
-     * to start
+     * to start.
      */
     @Test
     public void testDirectoryAdded() throws Exception {
@@ -363,7 +366,7 @@ public class CookieTest extends BookKeeperClusterTestCase {
 
     /**
      * Test that adding of a non-empty directory is not allowed
-     * even when allowStorageExpansion option is true
+     * even when allowStorageExpansion option is true.
      */
     @Test
     public void testNonEmptyDirAddWithStorageExpansionOption() throws 
Exception {
@@ -418,7 +421,7 @@ public class CookieTest extends BookKeeperClusterTestCase {
 
     /**
      * Test that if a directory's contents
-     * are emptied, the bookie will fail to start
+     * are emptied, the bookie will fail to start.
      */
     @Test
     public void testDirectoryCleared() throws Exception {
@@ -445,7 +448,7 @@ public class CookieTest extends BookKeeperClusterTestCase {
 
     /**
      * Test that if a bookie's port is changed
-     * the bookie will fail to start
+     * the bookie will fail to start.
      */
     @Test
     public void testBookiePortChanged() throws Exception {
@@ -471,7 +474,7 @@ public class CookieTest extends BookKeeperClusterTestCase {
      * Test that if a bookie tries to start
      * with the address of a bookie which has already
      * existed in the system, then the bookie will fail
-     * to start
+     * to start.
      */
     @Test
     public void testNewBookieStartingWithAnotherBookiesPort() throws Exception 
{
@@ -497,7 +500,7 @@ public class CookieTest extends BookKeeperClusterTestCase {
         }
     }
 
-    /*
+    /**
      * Test Cookie verification with format.
      */
     @Test
@@ -536,7 +539,7 @@ public class CookieTest extends BookKeeperClusterTestCase {
 
     /**
      * Test that if a bookie is started with directories with
-     * version 2 data, that it will fail to start (it needs upgrade)
+     * version 2 data, that it will fail to start (it needs upgrade).
      */
     @Test
     public void testV2data() throws Exception {
@@ -561,7 +564,7 @@ public class CookieTest extends BookKeeperClusterTestCase {
 
     /**
      * Test that if a bookie is started with directories with
-     * version 1 data, that it will fail to start (it needs upgrade)
+     * version 1 data, that it will fail to start (it needs upgrade).
      */
     @Test
     public void testV1data() throws Exception {
@@ -665,7 +668,7 @@ public class CookieTest extends BookKeeperClusterTestCase {
 
     /**
      * Test old version bookie starts with the cookies generated by new version
-     * (with useHostNameAsBookieID=true)
+     * (with useHostNameAsBookieID=true).
      */
     @Test
     public void testV2dataWithHostNameAsBookieID() throws Exception {
@@ -705,7 +708,7 @@ public class CookieTest extends BookKeeperClusterTestCase {
         b.shutdown();
         Versioned<Cookie> zkCookie = Cookie.readFromRegistrationManager(rm, 
conf);
         Version version1 = zkCookie.getVersion();
-        Assert.assertTrue("Invalid type expected ZkVersion type",
+        assertTrue("Invalid type expected ZkVersion type",
             version1 instanceof LongVersion);
         LongVersion zkVersion1 = (LongVersion) version1;
         Cookie cookie = zkCookie.getValue();
@@ -713,10 +716,10 @@ public class CookieTest extends BookKeeperClusterTestCase 
{
 
         zkCookie = Cookie.readFromRegistrationManager(rm, conf);
         Version version2 = zkCookie.getVersion();
-        Assert.assertTrue("Invalid type expected ZkVersion type",
+        assertTrue("Invalid type expected ZkVersion type",
             version2 instanceof LongVersion);
         LongVersion zkVersion2 = (LongVersion) version2;
-        Assert.assertEquals("Version mismatches!",
+        assertEquals("Version mismatches!",
             zkVersion1.getLongVersion() + 1, zkVersion2.getLongVersion());
     }
 
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/CreateNewLogTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/CreateNewLogTest.java
index 8e562c2..182ae01 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/CreateNewLogTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/CreateNewLogTest.java
@@ -18,10 +18,11 @@
 
 package org.apache.bookkeeper.bookie;
 
+import static org.junit.Assert.assertTrue;
+
 import java.io.File;
 import java.util.List;
 
-import org.junit.Assert;
 import org.apache.bookkeeper.conf.ServerConfiguration;
 import org.apache.bookkeeper.conf.TestBKConfiguration;
 import org.apache.bookkeeper.util.DiskChecker;
@@ -31,74 +32,77 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+/**
+ * Test new log creation.
+ */
 public class CreateNewLogTest {
     private static final Logger LOG = LoggerFactory
     .getLogger(CreateNewLogTest.class);
-        
-    private String[] ledgerDirs; 
+
+    private String[] ledgerDirs;
     private int numDirs = 100;
-    
+
     @Before
     public void setUp() throws Exception{
         ledgerDirs = new String[numDirs];
-        for(int i = 0; i < numDirs; i++){
+        for (int i = 0; i < numDirs; i++){
             File temp = File.createTempFile("bookie", "test");
             temp.delete();
             temp.mkdir();
             File currentTemp = new File(temp.getAbsoluteFile() + "/current");
             currentTemp.mkdir();
             ledgerDirs[i] = temp.getPath();
-        }        
+        }
     }
-    
+
     @After
     public void tearDown() throws Exception{
-        for(int i = 0; i < numDirs; i++){
+        for (int i = 0; i < numDirs; i++){
             File f = new File(ledgerDirs[i]);
             deleteRecursive(f);
         }
     }
-    
+
     private void deleteRecursive(File f) {
         if (f.isDirectory()){
             for (File c : f.listFiles()){
                 deleteRecursive(c);
             }
         }
-        
+
         f.delete();
     }
-    
+
     /**
      * Checks if new log file id is verified against all directories.
-     * 
+     *
      * {@link https://issues.apache.org/jira/browse/BOOKKEEPER-465}
-     * 
+     *
      * @throws Exception
      */
     @Test
     public void testCreateNewLog() throws Exception {
         ServerConfiguration conf = 
TestBKConfiguration.newServerConfiguration();
-                     
-        // Creating a new configuration with a number of 
+
+        // Creating a new configuration with a number of
         // ledger directories.
         conf.setLedgerDirNames(ledgerDirs);
         LedgerDirsManager ledgerDirsManager = new LedgerDirsManager(conf, 
conf.getLedgerDirs(),
                 new DiskChecker(conf.getDiskUsageThreshold(), 
conf.getDiskUsageWarnThreshold()));
         EntryLogger el = new EntryLogger(conf, ledgerDirsManager);
-        
+
         // Extracted from createNewLog()
         String logFileName = Long.toHexString(1) + ".log";
         File dir = ledgerDirsManager.pickRandomWritableDir();
         LOG.info("Picked this directory: " + dir);
         File newLogFile = new File(dir, logFileName);
         newLogFile.createNewFile();
-        
+
         // Calls createNewLog, and with the number of directories we
         // are using, if it picks one at random it will fail.
         el.createNewLog();
         LOG.info("This is the current log id: " + el.getCurrentLogId());
-        Assert.assertTrue("Wrong log id", el.getCurrentLogId() > 1);
+        assertTrue("Wrong log id", el.getCurrentLogId() > 1);
     }
 
     @Test
@@ -129,7 +133,7 @@ public class CreateNewLogTest {
         // are using, if it picks one at random it will fail.
         el.createNewLog();
         LOG.info("This is the current log id: " + el.getCurrentLogId());
-        Assert.assertTrue("Wrong log id", el.getCurrentLogId() > 1);
+        assertTrue("Wrong log id", el.getCurrentLogId() > 1);
     }
 
 }
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/EnableZkSecurityBasicTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/EnableZkSecurityBasicTest.java
index 7d20395..6d49895 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/EnableZkSecurityBasicTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/EnableZkSecurityBasicTest.java
@@ -15,12 +15,15 @@
  */
 package org.apache.bookkeeper.bookie;
 
+import static org.junit.Assert.assertEquals;
+
 import java.io.File;
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.util.List;
 import javax.security.auth.login.Configuration;
+
 import org.apache.bookkeeper.client.BookKeeper;
 import org.apache.bookkeeper.client.LedgerHandle;
 import org.apache.bookkeeper.conf.ClientConfiguration;
@@ -32,12 +35,11 @@ import org.apache.zookeeper.ZooKeeper;
 import org.apache.zookeeper.data.ACL;
 import org.apache.zookeeper.data.Stat;
 import org.junit.AfterClass;
-import static org.junit.Assert.assertEquals;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
 /**
- * Test basic functions using secured ZooKeeper
+ * Test basic functions using secured ZooKeeper.
  */
 public class EnableZkSecurityBasicTest extends BookKeeperClusterTestCase {
 
@@ -52,8 +54,7 @@ public class EnableZkSecurityBasicTest extends 
BookKeeperClusterTestCase {
         System.setProperty("zookeeper.authProvider.1", 
"org.apache.zookeeper.server.auth.SASLAuthenticationProvider");
         File tmpJaasDir = new File("target").getAbsoluteFile();
         File tmpJaasFile = new File(tmpJaasDir, "jaas.conf");
-        String jassFileContent
-            = "Server {\n"
+        String jassFileContent = "Server {\n"
             + "       org.apache.zookeeper.server.auth.DigestLoginModule 
required\n"
             + "       user_foo=\"bar\";\n"
             + "};\n"
@@ -118,7 +119,8 @@ public class EnableZkSecurityBasicTest extends 
BookKeeperClusterTestCase {
                 assertEquals(31, acls.get(0).getPerms());
                 assertEquals(31, acls.get(0).getPerms());
                 assertEquals("unexpected ACLS on " + fullPath + ": " + 
acls.get(0), "foo", acls.get(0).getId().getId());
-                assertEquals("unexpected ACLS on " + fullPath + ": " + 
acls.get(0), "sasl", acls.get(0).getId().getScheme());
+                assertEquals("unexpected ACLS on " + fullPath + ": " + 
acls.get(0), "sasl",
+                        acls.get(0).getId().getScheme());
             }
         }
     }
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/IndexCorruptionTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/IndexCorruptionTest.java
index 614b982..b12dfe9 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/IndexCorruptionTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/IndexCorruptionTest.java
@@ -1,5 +1,3 @@
-package org.apache.bookkeeper.bookie;
-
 /*
  *
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -20,27 +18,28 @@ package org.apache.bookkeeper.bookie;
  * under the License.
  *
  */
+package org.apache.bookkeeper.bookie;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 import java.util.Enumeration;
 
+import org.apache.bookkeeper.client.BookKeeper.DigestType;
 import org.apache.bookkeeper.client.LedgerEntry;
 import org.apache.bookkeeper.client.LedgerHandle;
-import org.apache.bookkeeper.client.BookKeeper.DigestType;
 import org.apache.bookkeeper.test.BookKeeperClusterTestCase;
-
+import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.junit.Assert;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
 /**
- * This class tests that index corruption cases
+ * This class tests that index corruption cases.
  */
 public class IndexCorruptionTest extends BookKeeperClusterTestCase {
-    private final static Logger LOG = 
LoggerFactory.getLogger(IndexCorruptionTest.class);
+    private static final Logger LOG = 
LoggerFactory.getLogger(IndexCorruptionTest.class);
 
     DigestType digestType;
 
@@ -68,7 +67,7 @@ public class IndexCorruptionTest extends 
BookKeeperClusterTestCase {
         String dummyMsg = "NoSuchLedger";
         int numMsgs = 3;
         LedgerHandle wlh = bkc.createLedger(1, 1, digestType, "".getBytes());
-        for (int i=0; i<numMsgs; i++) {
+        for (int i = 0; i < numMsgs; i++) {
             wlh.addEntry(dummyMsg.getBytes());
         }
 
@@ -87,7 +86,7 @@ public class IndexCorruptionTest extends 
BookKeeperClusterTestCase {
             LedgerEntry e = seq.nextElement();
             assertEquals(entryId, e.getEntryId());
 
-            Assert.assertArrayEquals(dummyMsg.getBytes(), e.getEntry());
+            assertArrayEquals(dummyMsg.getBytes(), e.getEntry());
             ++entryId;
         }
         assertEquals(entryId, numMsgs);
@@ -110,7 +109,7 @@ public class IndexCorruptionTest extends 
BookKeeperClusterTestCase {
         // write two page entries to ledger 2
         int numMsgs = 2 * pageSize / 8;
         LedgerHandle lh2 = bkc.createLedger(1, 1, digestType, "".getBytes());
-        for (int i=0; i<numMsgs; i++) {
+        for (int i = 0; i < numMsgs; i++) {
             lh2.addEntry(dummyMsg.getBytes());
         }
 
@@ -125,7 +124,7 @@ public class IndexCorruptionTest extends 
BookKeeperClusterTestCase {
         LedgerHandle newLh1 = bkc.openLedger(lh1.getId(), digestType, 
"".getBytes());
 
         // write another 3 entries to ledger 2
-        for (int i=0; i<3; i++) {
+        for (int i = 0; i < 3; i++) {
             lh2.addEntry(dummyMsg.getBytes());
         }
 
@@ -145,7 +144,7 @@ public class IndexCorruptionTest extends 
BookKeeperClusterTestCase {
             LedgerEntry e = seq.nextElement();
             assertEquals(entryId, e.getEntryId());
 
-            Assert.assertArrayEquals(dummyMsg.getBytes(), e.getEntry());
+            assertArrayEquals(dummyMsg.getBytes(), e.getEntry());
             ++entryId;
         }
         assertEquals(entryId, numMsgs);
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/IndexPersistenceMgrTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/IndexPersistenceMgrTest.java
index 1c63d39..d729be4 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/IndexPersistenceMgrTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/IndexPersistenceMgrTest.java
@@ -20,6 +20,17 @@
  */
 package org.apache.bookkeeper.bookie;
 
+import static com.google.common.base.Charsets.UTF_8;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.util.Observable;
+import java.util.Observer;
+
 import org.apache.bookkeeper.conf.ServerConfiguration;
 import org.apache.bookkeeper.stats.NullStatsLogger;
 import org.apache.bookkeeper.util.DiskChecker;
@@ -31,19 +42,12 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.File;
-import java.util.Observable;
-import java.util.Observer;
-
-import static com.google.common.base.Charsets.UTF_8;
-import static org.junit.Assert.*;
-
 /**
- * Test cases for IndexPersistenceMgr
+ * Test cases for IndexPersistenceMgr.
  */
 public class IndexPersistenceMgrTest {
 
-    static final Logger logger = 
LoggerFactory.getLogger(IndexPersistenceMgr.class);
+    private static final Logger logger = 
LoggerFactory.getLogger(IndexPersistenceMgr.class);
 
     ServerConfiguration conf;
     File journalDir, ledgerDir;
@@ -69,7 +73,7 @@ public class IndexPersistenceMgrTest {
 
         ledgerDirsManager = new LedgerDirsManager(conf, conf.getLedgerDirs(),
                 new DiskChecker(conf.getDiskUsageThreshold(), 
conf.getDiskUsageWarnThreshold()));
-        ledgerMonitor = new LedgerDirsMonitor(conf, 
+        ledgerMonitor = new LedgerDirsMonitor(conf,
                 new DiskChecker(conf.getDiskUsageThreshold(), 
conf.getDiskUsageWarnThreshold()), ledgerDirsManager);
         ledgerMonitor.init();
     }
@@ -194,7 +198,7 @@ public class IndexPersistenceMgrTest {
         try {
             indexPersistenceMgr = createIndexPersistenceManager(1);
             for (int i = 0; i < 3; i++) {
-                FileInfo fileInfo = indexPersistenceMgr.getFileInfo(lid+i, 
masterKey);
+                FileInfo fileInfo = indexPersistenceMgr.getFileInfo(lid + i, 
masterKey);
                 // We need to make sure index file is created, otherwise the 
test case can be flaky
                 fileInfo.checkOpen(true);
             }
@@ -213,16 +217,16 @@ public class IndexPersistenceMgrTest {
             FileInfo fileInfo = 
indexPersistenceMgr.writeFileInfoCache.asMap().get(lid);
             assertNotNull(fileInfo);
             assertEquals(2, fileInfo.getUseCount());
-            fileInfo = 
indexPersistenceMgr.writeFileInfoCache.asMap().get(lid+1);
+            fileInfo = indexPersistenceMgr.writeFileInfoCache.asMap().get(lid 
+ 1);
             assertNull(fileInfo);
-            fileInfo = 
indexPersistenceMgr.writeFileInfoCache.asMap().get(lid+2);
+            fileInfo = indexPersistenceMgr.writeFileInfoCache.asMap().get(lid 
+ 2);
             assertNull(fileInfo);
             fileInfo = indexPersistenceMgr.readFileInfoCache.asMap().get(lid);
             assertNull(fileInfo);
-            fileInfo = 
indexPersistenceMgr.readFileInfoCache.asMap().get(lid+1);
+            fileInfo = indexPersistenceMgr.readFileInfoCache.asMap().get(lid + 
1);
             assertNotNull(fileInfo);
             assertEquals(2, fileInfo.getUseCount());
-            fileInfo = 
indexPersistenceMgr.readFileInfoCache.asMap().get(lid+2);
+            fileInfo = indexPersistenceMgr.readFileInfoCache.asMap().get(lid + 
2);
             assertNotNull(fileInfo);
             assertEquals(2, fileInfo.getUseCount());
         } finally {
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/LedgerCacheTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/LedgerCacheTest.java
index 144871c..61b2955 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/LedgerCacheTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/LedgerCacheTest.java
@@ -55,10 +55,10 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * LedgerCache related test cases
+ * LedgerCache related test cases.
  */
 public class LedgerCacheTest {
-    private final static Logger LOG = 
LoggerFactory.getLogger(LedgerCacheTest.class);
+    private static final Logger LOG = 
LoggerFactory.getLogger(LedgerCacheTest.class);
 
     SnapshotMap<Long, Boolean> activeLedgers;
     LedgerManagerFactory ledgerManagerFactory;
@@ -147,9 +147,9 @@ public class LedgerCacheTest {
          */
         try {
             byte[] masterKey = "blah".getBytes();
-            for( int i = 0; i < 100; i++) {
-                ledgerCache.setMasterKey((long)i, masterKey);
-                ledgerCache.putEntryOffset(i, 0, i*8);
+            for (int i = 0; i < 100; i++) {
+                ledgerCache.setMasterKey((long) i, masterKey);
+                ledgerCache.putEntryOffset(i, 0, i * 8);
             }
         } catch (IOException e) {
             LOG.error("Got IOException.", e);
@@ -168,9 +168,9 @@ public class LedgerCacheTest {
         try {
             int numLedgers = 3;
             byte[] masterKey = "blah".getBytes();
-            for (int i=1; i<=numLedgers; i++) {
-                ledgerCache.setMasterKey((long)i, masterKey);
-                for (int j=0; j<numEntries; j++) {
+            for (int i = 1; i <= numLedgers; i++) {
+                ledgerCache.setMasterKey((long) i, masterKey);
+                for (int j = 0; j < numEntries; j++) {
                     ledgerCache.putEntryOffset(i, j, i * numEntries + j);
                 }
             }
@@ -191,22 +191,22 @@ public class LedgerCacheTest {
         try {
             int numLedgers = 2;
             byte[] masterKey = "blah".getBytes();
-            for (int i=1; i<=numLedgers; i++) {
-                ledgerCache.setMasterKey((long)i, masterKey);
-                for (int j=0; j<numEntries; j++) {
-                    ledgerCache.putEntryOffset(i, j, i*numEntries + j);
+            for (int i = 1; i <= numLedgers; i++) {
+                ledgerCache.setMasterKey((long) i, masterKey);
+                for (int j = 0; j < numEntries; j++) {
+                    ledgerCache.putEntryOffset(i, j, i * numEntries + j);
                 }
             }
             // ledger cache is exhausted
             // delete ledgers
-            for (int i=1; i<=numLedgers; i++) {
-                ledgerCache.deleteLedger((long)i);
+            for (int i = 1; i <= numLedgers; i++) {
+                ledgerCache.deleteLedger((long) i);
             }
             // create num ledgers to add entries
-            for (int i=numLedgers+1; i<=2*numLedgers; i++) {
-                ledgerCache.setMasterKey((long)i, masterKey);
-                for (int j=0; j<numEntries; j++) {
-                    ledgerCache.putEntryOffset(i, j, i*numEntries + j);
+            for (int i = numLedgers + 1; i <= 2 * numLedgers; i++) {
+                ledgerCache.setMasterKey((long) i, masterKey);
+                for (int j = 0; j < numEntries; j++) {
+                    ledgerCache.putEntryOffset(i, j, i * numEntries + j);
                 }
             }
         } catch (Exception e) {
@@ -225,10 +225,10 @@ public class LedgerCacheTest {
         newLedgerCache();
         try {
             // create serveral ledgers
-            for (int i=1; i<=numLedgers; i++) {
-                ledgerCache.setMasterKey((long)i, masterKey);
-                ledgerCache.putEntryOffset(i, 0, i*8);
-                ledgerCache.putEntryOffset(i, 1, i*8);
+            for (int i = 1; i <= numLedgers; i++) {
+                ledgerCache.setMasterKey((long) i, masterKey);
+                ledgerCache.putEntryOffset(i, 0, i * 8);
+                ledgerCache.putEntryOffset(i, 1, i * 8);
             }
 
             // flush all first to clean previous dirty ledgers
@@ -237,7 +237,7 @@ public class LedgerCacheTest {
             ledgerCache.flushLedger(true);
 
             // delete serveral ledgers
-            for (int i=1; i<=numLedgers/2; i++) {
+            for (int i = 1; i <= numLedgers / 2; i++) {
                 ledgerCache.deleteLedger(i);
             }
 
@@ -245,11 +245,11 @@ public class LedgerCacheTest {
             newLedgerCache();
 
             // simulate replaying journals to add entries again
-            for (int i=1; i<=numLedgers; i++) {
+            for (int i = 1; i <= numLedgers; i++) {
                 try {
-                    ledgerCache.putEntryOffset(i, 1, i*8);
+                    ledgerCache.putEntryOffset(i, 1, i * 8);
                 } catch (NoLedgerException nsle) {
-                    if (i<=numLedgers/2) {
+                    if (i <= numLedgers / 2) {
                         // it is ok
                     } else {
                         LOG.error("Error put entry offset : ", nsle);
@@ -264,7 +264,7 @@ public class LedgerCacheTest {
     }
 
     /**
-     * Test Ledger Cache flush failure
+     * Test Ledger Cache flush failure.
      */
     @Test
     public void testLedgerCacheFlushFailureOnDiskFull() throws Exception {
@@ -398,7 +398,7 @@ public class LedgerCacheTest {
                     try {
                         for (int i = 0; i < 1000 && rc.get() == 0; i++) {
                             ledgerCache.setMasterKey(i, masterKey);
-                            ledgerQ.put((long)i);
+                            ledgerQ.put((long) i);
                         }
                     } catch (Exception e) {
                         rc.set(-1);
@@ -418,7 +418,7 @@ public class LedgerCacheTest {
                             }
                             LOG.info("Put entry for {}", id);
                             try {
-                                ledgerCache.putEntryOffset((long)id, 1, 0);
+                                ledgerCache.putEntryOffset((long) id, 1, 0);
                             } catch (Bookie.NoLedgerException nle) {
                                 //ignore
                             }
@@ -524,7 +524,8 @@ public class LedgerCacheTest {
         EntryMemTable memTable = flushTestSortedLedgerStorage.memTable;
 
         // this bookie.addEntry call is required. FileInfo for Ledger 1 would 
be created with this call.
-        // without the fileinfo, 'flushTestSortedLedgerStorage.addEntry' calls 
will fail because of BOOKKEEPER-965 change.
+        // without the fileinfo, 'flushTestSortedLedgerStorage.addEntry' calls 
will fail
+        // because of BOOKKEEPER-965 change.
         bookie.addEntry(generateEntry(1, 1), new Bookie.NopWriteCallback(), 
null, "passwd".getBytes());
 
         flushTestSortedLedgerStorage.addEntry(generateEntry(1, 2));
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/LedgerStorageTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/LedgerStorageTest.java
index 49fd563..67ec985 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/LedgerStorageTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/LedgerStorageTest.java
@@ -20,12 +20,16 @@
  */
 package org.apache.bookkeeper.bookie;
 
+import static org.junit.Assert.assertEquals;
+
 import java.util.concurrent.CountDownLatch;
 
 import org.apache.bookkeeper.test.BookKeeperClusterTestCase;
-import org.junit.Assert;
 import org.junit.Test;
 
+/**
+ * Test ledger storage.
+ */
 public class LedgerStorageTest extends BookKeeperClusterTestCase {
     public LedgerStorageTest() {
         super(1);
@@ -41,7 +45,7 @@ public class LedgerStorageTest extends 
BookKeeperClusterTestCase {
         CountDownLatch counter = new CountDownLatch(1);
 
         ledgerStorage.registerLedgerDeletionListener(ledgerId -> {
-            Assert.assertEquals(deletedLedgerId, ledgerId);
+            assertEquals(deletedLedgerId, ledgerId);
 
             counter.countDown();
         });
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/TestEntryMemTable.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/TestEntryMemTable.java
index 7606c91..50844f3 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/TestEntryMemTable.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/TestEntryMemTable.java
@@ -37,6 +37,9 @@ import org.apache.bookkeeper.stats.NullStatsLogger;
 import org.junit.Before;
 import org.junit.Test;
 
+/**
+ * Test the EntryMemTable class.
+ */
 public class TestEntryMemTable implements CacheCallback, SkipListFlusher, 
CheckpointSource {
 
     private EntryMemTable memTable;
@@ -76,7 +79,7 @@ public class TestEntryMemTable implements CacheCallback, 
SkipListFlusher, Checkp
     }
 
     /**
-     * Basic put/get
+     * Basic put/get.
      * @throws IOException
      * */
     @Test
@@ -106,7 +109,7 @@ public class TestEntryMemTable implements CacheCallback, 
SkipListFlusher, Checkp
     }
 
     /**
-     * Test read/write across snapshot
+     * Test read/write across snapshot.
      * @throws IOException
      */
     @Test
@@ -152,7 +155,7 @@ public class TestEntryMemTable implements CacheCallback, 
SkipListFlusher, Checkp
     }
 
     /**
-     * Test flush w/ logMark parameter
+     * Test flush w/ logMark parameter.
      * @throws IOException
      */
     @Test
@@ -186,7 +189,7 @@ public class TestEntryMemTable implements CacheCallback, 
SkipListFlusher, Checkp
     }
 
     /**
-     * Test snapshot/flush interaction
+     * Test snapshot/flush interaction.
      * @throws IOException
      */
     @Test
@@ -220,7 +223,7 @@ public class TestEntryMemTable implements CacheCallback, 
SkipListFlusher, Checkp
     }
 
     /**
-     * Test NoLedger exception/flush interaction
+     * Test NoLedger exception/flush interaction.
      * @throws IOException
      */
     @Test
@@ -259,7 +262,7 @@ public class TestEntryMemTable implements CacheCallback, 
SkipListFlusher, Checkp
             if (Checkpoint.MAX == o) {
                 return -1;
             }
-            return mark.compare(((TestCheckPoint)o).mark);
+            return mark.compare(((TestCheckPoint) o).mark);
         }
 
     }
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/TestGcOverreplicatedLedger.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/TestGcOverreplicatedLedger.java
index d0fd0ad..116fab8 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/TestGcOverreplicatedLedger.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/TestGcOverreplicatedLedger.java
@@ -21,6 +21,8 @@
 
 package org.apache.bookkeeper.bookie;
 
+import com.google.common.collect.Lists;
+
 import java.io.IOException;
 import java.net.UnknownHostException;
 import java.util.ArrayList;
@@ -46,6 +48,7 @@ import org.apache.bookkeeper.net.BookieSocketAddress;
 import org.apache.bookkeeper.proto.BookieServer;
 import org.apache.bookkeeper.proto.BookkeeperInternalCallbacks.GenericCallback;
 import org.apache.bookkeeper.util.SnapshotMap;
+import org.apache.zookeeper.ZooDefs;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -53,9 +56,9 @@ import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
 
-import com.google.common.collect.Lists;
-import org.apache.zookeeper.ZooDefs;
-
+/**
+ * Test GC-overreplicated ledger.
+ */
 @RunWith(Parameterized.class)
 public class TestGcOverreplicatedLedger extends LedgerManagerTestCase {
 
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/TestLedgerDirsManager.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/TestLedgerDirsManager.java
index d47ecbb..e53ddce 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/TestLedgerDirsManager.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/TestLedgerDirsManager.java
@@ -36,7 +36,6 @@ import 
org.apache.bookkeeper.bookie.LedgerDirsManager.LedgerDirsListener;
 import 
org.apache.bookkeeper.bookie.LedgerDirsManager.NoWritableLedgerDirException;
 import org.apache.bookkeeper.conf.ServerConfiguration;
 import org.apache.bookkeeper.conf.TestBKConfiguration;
-import org.apache.bookkeeper.stats.NullStatsLogger;
 import org.apache.bookkeeper.util.DiskChecker;
 import org.apache.bookkeeper.util.IOUtils;
 import org.apache.commons.io.FileUtils;
@@ -46,8 +45,11 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+/**
+ * Test LedgerDirsManager.
+ */
 public class TestLedgerDirsManager {
-    private final static Logger LOG = 
LoggerFactory.getLogger(TestLedgerDirsManager.class);
+    private static final Logger LOG = 
LoggerFactory.getLogger(TestLedgerDirsManager.class);
 
     ServerConfiguration conf;
     File curDir;
@@ -81,7 +83,7 @@ public class TestLedgerDirsManager {
         mockDiskChecker = new MockDiskChecker(threshold, warnThreshold);
         dirsManager = new LedgerDirsManager(conf, conf.getLedgerDirs(),
                 new DiskChecker(conf.getDiskUsageThreshold(), 
conf.getDiskUsageWarnThreshold()));
-        ledgerMonitor = new LedgerDirsMonitor(conf, 
+        ledgerMonitor = new LedgerDirsMonitor(conf,
                 mockDiskChecker, dirsManager);
         ledgerMonitor.init();
     }
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/TestSkipListArena.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/TestSkipListArena.java
index e42eacc..f5d819c 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/TestSkipListArena.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/TestSkipListArena.java
@@ -18,23 +18,29 @@
  */
 package org.apache.bookkeeper.bookie;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
+import com.google.common.primitives.Ints;
+
+import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
 import java.util.Random;
+import java.util.Set;
+import java.util.TreeMap;
 import java.util.concurrent.ConcurrentLinkedQueue;
 import java.util.concurrent.CountDownLatch;
 
-import org.apache.bookkeeper.conf.ServerConfiguration;
 import org.apache.bookkeeper.bookie.SkipListArena.MemorySlice;
+import org.apache.bookkeeper.conf.ServerConfiguration;
 import org.junit.Test;
 
-import java.util.Set;
-import java.util.HashSet;
-import java.util.HashMap;
-import java.util.TreeMap;
-import com.google.common.primitives.Ints;
-
+/**
+ * Test the SkipListArena class.
+ */
 public class TestSkipListArena {
 
     class CustomConfiguration extends ServerConfiguration {
@@ -56,7 +62,7 @@ public class TestSkipListArena {
     final CustomConfiguration cfg = new CustomConfiguration();
 
     /**
-    * Test random allocations
+    * Test random allocations.
     */
     @Test
     public void testRandomAllocation() {
@@ -104,7 +110,7 @@ public class TestSkipListArena {
         @Override
         public boolean equals(Object object) {
             if (object instanceof ByteArray) {
-                ByteArray other = (ByteArray)object;
+                ByteArray other = (ByteArray) object;
                 return this.bytes.equals(other.bytes);
             }
             return false;
@@ -150,7 +156,7 @@ public class TestSkipListArena {
     }
 
     /**
-    * Test concurrent allocation, check the results don't overlap
+    * Test concurrent allocation, check the results don't overlap.
     */
     @Test
     public void testConcurrency() throws Exception {
@@ -177,12 +183,12 @@ public class TestSkipListArena {
         for (AllocBuffer buf : buffers) {
             if (buf.size != 0) {
                 ByteArray ptr = new ByteArray(buf.alloc.getData());
-                Map<Integer, AllocBuffer> tree_map = mapsByArray.get(ptr);
-                if (tree_map == null) {
-                    tree_map = new TreeMap<Integer, AllocBuffer>();
-                    mapsByArray.put(ptr, tree_map);
+                Map<Integer, AllocBuffer> treeMap = mapsByArray.get(ptr);
+                if (treeMap == null) {
+                    treeMap = new TreeMap<Integer, AllocBuffer>();
+                    mapsByArray.put(ptr, treeMap);
                 }
-                AllocBuffer other = tree_map.put(new 
Integer(buf.alloc.getOffset()), buf);
+                AllocBuffer other = treeMap.put(new 
Integer(buf.alloc.getOffset()), buf);
                 if (other != null) {
                     fail("Buffer " + other.toString() + " overlapped with " + 
buf.toString());
                 }
@@ -190,9 +196,9 @@ public class TestSkipListArena {
         }
 
         // Now check each byte array to make sure allocations don't overlap
-        for (Map<Integer, AllocBuffer> tree_map : mapsByArray.values()) {
+        for (Map<Integer, AllocBuffer> treeMap : mapsByArray.values()) {
             int expectedOff = 0;
-            for (AllocBuffer buf : tree_map.values()) {
+            for (AllocBuffer buf : treeMap.values()) {
                 assertEquals(expectedOff, buf.alloc.getOffset());
                 expectedOff += buf.size;
             }
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/TestSyncThread.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/TestSyncThread.java
index 5f30557..b2bc916 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/TestSyncThread.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/TestSyncThread.java
@@ -20,34 +20,41 @@
  */
 package org.apache.bookkeeper.bookie;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import io.netty.buffer.ByteBuf;
+
 import java.io.File;
 import java.io.IOException;
 import java.util.Observable;
 import java.util.Observer;
+import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
-import java.util.concurrent.Callable;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
-import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.bookkeeper.conf.TestBKConfiguration;
-import org.apache.bookkeeper.conf.ServerConfiguration;
-import org.apache.bookkeeper.stats.StatsLogger;
+
 import org.apache.bookkeeper.bookie.CheckpointSource.Checkpoint;
 import org.apache.bookkeeper.bookie.LedgerDirsManager.LedgerDirsListener;
 import 
org.apache.bookkeeper.bookie.LedgerDirsManager.NoWritableLedgerDirException;
+import org.apache.bookkeeper.conf.ServerConfiguration;
+import org.apache.bookkeeper.conf.TestBKConfiguration;
 import org.apache.bookkeeper.meta.LedgerManager;
+import org.apache.bookkeeper.stats.StatsLogger;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.junit.Test;
-import org.junit.Before;
-import org.junit.After;
-
-import static org.junit.Assert.*;
 
+/**
+ * Test a synchronization thread.
+ */
 public class TestSyncThread {
     private static final Logger LOG = 
LoggerFactory.getLogger(TestSyncThread.class);
 
@@ -341,7 +348,8 @@ public class TestSyncThread {
         }
 
         @Override
-        public Observable waitForLastAddConfirmedUpdate(long ledgerId, long 
previoisLAC, Observer observer) throws IOException {
+        public Observable waitForLastAddConfirmedUpdate(long ledgerId, long 
previoisLAC, Observer observer)
+                throws IOException {
             return null;
         }
 
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/UpdateCookieCmdTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/UpdateCookieCmdTest.java
index 72efcf2..faa357f 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/UpdateCookieCmdTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/UpdateCookieCmdTest.java
@@ -40,11 +40,11 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * This tests 'updatecookie' shell command
+ * This tests 'updatecookie' shell command.
  */
 public class UpdateCookieCmdTest extends BookKeeperClusterTestCase {
 
-    private final static Logger LOG = 
LoggerFactory.getLogger(UpdateCookieCmdTest.class);
+    private static final Logger LOG = 
LoggerFactory.getLogger(UpdateCookieCmdTest.class);
 
     RegistrationManager rm;
 
@@ -64,13 +64,13 @@ public class UpdateCookieCmdTest extends 
BookKeeperClusterTestCase {
     @Override
     public void tearDown() throws Exception {
         super.tearDown();
-        if(rm != null) {
+        if (rm != null) {
             rm.close();
         }
     }
 
     /**
-     * updatecookie to hostname
+     * updatecookie to hostname.
      */
     @Test
     public void testUpdateCookieIpAddressToHostname() throws Exception {
@@ -78,7 +78,7 @@ public class UpdateCookieCmdTest extends 
BookKeeperClusterTestCase {
     }
 
     /**
-     * updatecookie to ipaddress
+     * updatecookie to ipaddress.
      */
     @Test
     public void testUpdateCookieHostnameToIpAddress() throws Exception {
@@ -93,7 +93,7 @@ public class UpdateCookieCmdTest extends 
BookKeeperClusterTestCase {
     }
 
     /**
-     * updatecookie to invalid bookie id
+     * updatecookie to invalid bookie id.
      */
     @Test
     public void testUpdateCookieWithInvalidOption() throws Exception {
@@ -153,7 +153,7 @@ public class UpdateCookieCmdTest extends 
BookKeeperClusterTestCase {
     }
 
     /**
-     * updatecookie to hostname
+     * updatecookie to hostname.
      */
     @Test
     public void testDuplicateUpdateCookieIpAddress() throws Exception {
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/UpgradeTest.java 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/UpgradeTest.java
index 00e3d15..a67235a 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/UpgradeTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/UpgradeTest.java
@@ -23,6 +23,7 @@ package org.apache.bookkeeper.bookie;
 
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
+
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 
@@ -40,17 +41,20 @@ import org.apache.bookkeeper.client.ClientUtil;
 import org.apache.bookkeeper.client.LedgerHandle;
 import org.apache.bookkeeper.conf.ServerConfiguration;
 import org.apache.bookkeeper.conf.TestBKConfiguration;
-import org.apache.bookkeeper.test.PortManager;
 import org.apache.bookkeeper.test.BookKeeperClusterTestCase;
+import org.apache.bookkeeper.test.PortManager;
 import org.apache.bookkeeper.util.IOUtils;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+/**
+ * Test the protocol upgrade procedure.
+ */
 public class UpgradeTest extends BookKeeperClusterTestCase {
-    private final static Logger LOG = LoggerFactory.getLogger(FileInfo.class);
+    private static final Logger LOG = LoggerFactory.getLogger(FileInfo.class);
 
-    final static int bookiePort = PortManager.nextFreePort();
+    private static final int bookiePort = PortManager.nextFreePort();
 
     public UpgradeTest() {
         super(0);
@@ -69,11 +73,11 @@ public class UpgradeTest extends BookKeeperClusterTestCase {
         fi.close(true);
 
         long logId = 0;
-        ByteBuffer LOGFILE_HEADER = ByteBuffer.allocate(1024);
-        LOGFILE_HEADER.put("BKLO".getBytes());
+        ByteBuffer logfileHeader = ByteBuffer.allocate(1024);
+        logfileHeader.put("BKLO".getBytes());
         FileChannel logfile = new RandomAccessFile(
-                new File(dir, Long.toHexString(logId)+".log"), 
"rw").getChannel();
-        logfile.write((ByteBuffer) LOGFILE_HEADER.clear());
+                new File(dir, Long.toHexString(logId) + ".log"), 
"rw").getChannel();
+        logfile.write((ByteBuffer) logfileHeader.clear());
         logfile.close();
     }
 
@@ -86,12 +90,12 @@ public class UpgradeTest extends BookKeeperClusterTestCase {
 
         long ledgerId = 1;
         byte[] data = new byte[1024];
-        Arrays.fill(data, (byte)'X');
+        Arrays.fill(data, (byte) 'X');
         long lastConfirmed = LedgerHandle.INVALID_ENTRY_ID;
 
         for (int i = 1; i <= numEntries; i++) {
             ByteBuf packet = ClientUtil.generatePacket(ledgerId, i, 
lastConfirmed,
-                                                          i*data.length, data);
+                                                          i * data.length, 
data);
             lastConfirmed = i;
             ByteBuffer lenBuff = ByteBuffer.allocate(4);
             lenBuff.putInt(packet.readableBytes());
@@ -111,7 +115,7 @@ public class UpgradeTest extends BookKeeperClusterTestCase {
         writeJournal(d, 100, "foobar".getBytes()).close();
         return d;
     }
-              
+
     static File newV1LedgerDirectory() throws Exception {
         File d = IOUtils.createTempDir("bookie", "tmpdir");
         writeLedgerDir(d, "foobar".getBytes());
diff --git a/buildtools/src/main/resources/bookkeeper/server-suppressions.xml 
b/buildtools/src/main/resources/bookkeeper/server-suppressions.xml
deleted file mode 100644
index 94f8cab..0000000
--- a/buildtools/src/main/resources/bookkeeper/server-suppressions.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0"?>
-<!--
-  Licensed under the Apache License, Version 2.0 (the "License");
-  you may not use this file except in compliance with the License.
-  You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License. See accompanying LICENSE file.
--->
-<!DOCTYPE suppressions PUBLIC
-        "-//Puppy Crawl//DTD Suppressions 1.1//EN"
-        "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd";>
-
-<suppressions>
-    <suppress checks="JavadocPackage" files=".*[\\/]src[\\/]test[\\/].*"/>
-    <suppress checks="JavadocPackage" files=".*[\\/]maven-archetypes[\\/].*"/>
-    <suppress checks="JavadocPackage" files=".*[\\/]examples[\\/].*"/>
-    <!-- suppress packages by packages -->
-    <suppress checks=".*" files=".*[\\/]test[\\/].*[\\/]bookie[\\/]"/>
-
-    <!-- suppress all checks in the generated directories -->
-    <suppress checks=".*" files=".+[\\/]generated[\\/].+\.java" />
-    <suppress checks=".*" files=".+[\\/]generated-sources[\\/].+\.java" />
-    <suppress checks=".*" files=".+[\\/]generated-test-sources[\\/].+\.java" />
-</suppressions>

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to