diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/ZkLedgerUnderreplicationManager.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/ZkLedgerUnderreplicationManager.java index 4ccbc113ba8..3eaf63a2450 100644 --- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/ZkLedgerUnderreplicationManager.java +++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/ZkLedgerUnderreplicationManager.java @@ -20,6 +20,7 @@ import static java.nio.charset.StandardCharsets.UTF_8; +import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Joiner; import com.google.common.util.concurrent.RateLimiter; import com.google.protobuf.InvalidProtocolBufferException; diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/ZkLedgerUnderreplicationManagerTest.java b/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/ZkLedgerUnderreplicationManagerTest.java index 55bc0eeeb77..11f5ed8c54f 100644 --- a/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/ZkLedgerUnderreplicationManagerTest.java +++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/ZkLedgerUnderreplicationManagerTest.java @@ -110,7 +110,7 @@ public void testMarkLedgerUnderreplicatedBasic() throws Exception { // mark when it hasn't been marked before FutureUtils.result(urMgr.markLedgerUnderreplicatedAsync(ledgerId, missingBookies)); - UnderreplicatedLedgerFormat urLedgerFormat = urMgr.getLedgerUnreplicationInfo(ledgerId); + UnderreplicatedLedger urLedgerFormat = urMgr.getLedgerUnreplicationInfo(ledgerId); assertEquals(missingBookies, urLedgerFormat.getReplicaList()); assertTrue(urLedgerFormat.getCtime() > prevCtime); prevCtime = urLedgerFormat.getCtime(); @@ -168,7 +168,7 @@ public void testMarkLedgerUnderreplicatedConcurrently() throws Exception { } FutureUtils.result(FutureUtils.collect(futures)); - UnderreplicatedLedgerFormat urLedgerFormat = urMgr.getLedgerUnreplicationInfo(ledgerId); + UnderreplicatedLedger urLedgerFormat = urMgr.getLedgerUnreplicationInfo(ledgerId); Set actualBookies = Sets.newHashSet(); actualBookies.addAll(urLedgerFormat.getReplicaList()); @@ -198,7 +198,7 @@ public void testMarkLedgerUnderreplicatedConcurrentlyWithDifferentClients() thro FutureUtils.result(FutureUtils.collect(futures)); - UnderreplicatedLedgerFormat urLedgerFormat = urMgr.getLedgerUnreplicationInfo(ledgerId); + UnderreplicatedLedger urLedgerFormat = urMgr.getLedgerUnreplicationInfo(ledgerId); Set actualBookies = Sets.newHashSet(); actualBookies.addAll(urLedgerFormat.getReplicaList()); @@ -232,10 +232,10 @@ public void testMarkLedgerUnderreplicatedWhenSessionExpired() throws Exception { // expected } try { - UnderreplicatedLedgerFormat urLedgerFormat = + UnderreplicatedLedger urLedgerFormat = ZkLedgerUnderreplicationManagerTest.this.urMgr.getLedgerUnreplicationInfo(ledgerId); fail("The ledger shouldn't been marked as underreplicated"); - } catch (NoNodeException nee) { + } catch (ReplicationException.UnavailableException ue) { // expected } } diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/suites/BookKeeperClusterTestSuite.java b/bookkeeper-server/src/test/java/org/apache/bookkeeper/suites/BookKeeperClusterTestSuite.java index df156dff053..98d360d0166 100644 --- a/bookkeeper-server/src/test/java/org/apache/bookkeeper/suites/BookKeeperClusterTestSuite.java +++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/suites/BookKeeperClusterTestSuite.java @@ -20,16 +20,20 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; +import io.netty.buffer.PooledByteBufAllocator; import lombok.extern.slf4j.Slf4j; +import org.apache.bookkeeper.bookie.MockUncleanShutdownDetection; +import org.apache.bookkeeper.bookie.TestBookieImpl; import org.apache.bookkeeper.client.BookKeeperAdmin; import org.apache.bookkeeper.common.net.ServiceURI; import org.apache.bookkeeper.conf.ClientConfiguration; import org.apache.bookkeeper.conf.ServerConfiguration; import org.apache.bookkeeper.conf.TestBKConfiguration; import org.apache.bookkeeper.proto.BookieServer; -import org.apache.bookkeeper.test.PortManager; +import org.apache.bookkeeper.stats.NullStatsLogger; import org.apache.bookkeeper.test.TestStatsProvider; import org.apache.bookkeeper.util.IOUtils; +import org.apache.bookkeeper.util.PortManager; import org.apache.commons.io.FileUtils; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -112,8 +116,9 @@ private static void startNumBookies(int numBookies) throws Exception { private static BookieServer startBookie(ServerConfiguration conf) throws Exception { conf.setAutoRecoveryDaemonEnabled(true); - TestStatsProvider provider = new TestStatsProvider(); - BookieServer server = new BookieServer(conf, provider.getStatsLogger("")); + BookieServer server = new BookieServer( conf, new TestBookieImpl(conf), + NullStatsLogger.INSTANCE, PooledByteBufAllocator.DEFAULT, + new MockUncleanShutdownDetection()); server.start(); return server; } diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/suites/ZKMetadataStore.java b/bookkeeper-server/src/test/java/org/apache/bookkeeper/suites/ZKMetadataStore.java index 2c42b230ce6..5e34f2dbe97 100644 --- a/bookkeeper-server/src/test/java/org/apache/bookkeeper/suites/ZKMetadataStore.java +++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/suites/ZKMetadataStore.java @@ -30,12 +30,12 @@ class ZKMetadataStore implements MetadataStore { @Override public void start() throws Exception { - this.zkUtil.startServer(); + this.zkUtil.startCluster(); } @Override public void close() throws Exception { - this.zkUtil.killServer(); + this.zkUtil.killCluster(); } @Override