Search in sources :

Example 16 with OpenLedgerCallback

use of org.apache.bookkeeper.mledger.AsyncCallbacks.OpenLedgerCallback in project incubator-pulsar by apache.

the class ServerCnxTest method testCreateProducerMultipleTimeouts.

@Test(timeOut = 30000, enabled = false)
public void testCreateProducerMultipleTimeouts() throws Exception {
    resetChannel();
    setChannelConnected();
    // Delay the topic creation in a deterministic way
    CountDownLatch topicCreationDelayLatch = new CountDownLatch(1);
    doAnswer(new Answer<Object>() {

        @Override
        public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
            topicCreationDelayLatch.await();
            ((OpenLedgerCallback) invocationOnMock.getArguments()[2]).openLedgerComplete(ledgerMock, null);
            return null;
        }
    }).when(mlFactoryMock).asyncOpen(matches(".*success.*"), any(ManagedLedgerConfig.class), any(OpenLedgerCallback.class), anyObject());
    // In a create producer timeout from client side we expect to see this sequence of commands :
    // 1. create producer
    // 2. close producer (when the timeout is triggered, which may be before the producer was created on the broker
    // 3. create producer (triggered by reconnection logic)
    // These operations need to be serialized, to allow the last create producer to finally succeed
    // (There can be more create/close pairs in the sequence, depending on the client timeout
    String producerName = "my-producer";
    ByteBuf createProducer1 = Commands.newProducer(successTopicName, 1, /* producer id */
    1, /* request id */
    producerName, Collections.emptyMap());
    channel.writeInbound(createProducer1);
    ByteBuf closeProducer1 = Commands.newCloseProducer(1, /* producer id */
    2);
    channel.writeInbound(closeProducer1);
    ByteBuf createProducer2 = Commands.newProducer(successTopicName, 1, /* producer id */
    3, /* request id */
    producerName, Collections.emptyMap());
    channel.writeInbound(createProducer2);
    ByteBuf createProducer3 = Commands.newProducer(successTopicName, 1, /* producer id */
    4, /* request id */
    producerName, Collections.emptyMap());
    channel.writeInbound(createProducer3);
    ByteBuf createProducer4 = Commands.newProducer(successTopicName, 1, /* producer id */
    5, /* request id */
    producerName, Collections.emptyMap());
    channel.writeInbound(createProducer4);
    // Close succeeds
    Object response = getResponse();
    assertEquals(response.getClass(), CommandSuccess.class);
    assertEquals(((CommandSuccess) response).getRequestId(), 2);
    // Now allow topic creation to complete
    topicCreationDelayLatch.countDown();
    // 1st producer it's not acked
    // 2nd producer fails
    response = getResponse();
    assertEquals(response.getClass(), CommandError.class);
    assertEquals(((CommandError) response).getRequestId(), 3);
    // 3rd producer fails
    response = getResponse();
    assertEquals(response.getClass(), CommandError.class);
    assertEquals(((CommandError) response).getRequestId(), 4);
    // 4nd producer fails
    response = getResponse();
    assertEquals(response.getClass(), CommandError.class);
    assertEquals(((CommandError) response).getRequestId(), 5);
    Thread.sleep(100);
    // We should not receive response for 1st producer, since it was cancelled by the close
    assertTrue(channel.outboundMessages().isEmpty());
    assertTrue(channel.isActive());
    channel.finish();
}
Also used : InvocationOnMock(org.mockito.invocation.InvocationOnMock) Matchers.anyObject(org.mockito.Matchers.anyObject) ManagedLedgerConfig(org.apache.bookkeeper.mledger.ManagedLedgerConfig) ByteString(com.google.protobuf.ByteString) CountDownLatch(java.util.concurrent.CountDownLatch) ByteBuf(io.netty.buffer.ByteBuf) OpenLedgerCallback(org.apache.bookkeeper.mledger.AsyncCallbacks.OpenLedgerCallback) Test(org.testng.annotations.Test)

Example 17 with OpenLedgerCallback

use of org.apache.bookkeeper.mledger.AsyncCallbacks.OpenLedgerCallback in project incubator-pulsar by apache.

the class ServerCnxTest method setupMLAsyncCallbackMocks.

private void setupMLAsyncCallbackMocks() {
    doReturn(new ArrayList<Object>()).when(ledgerMock).getCursors();
    // call openLedgerComplete with ledgerMock on ML factory asyncOpen
    doAnswer(new Answer<Object>() {

        @Override
        public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
            Thread.sleep(300);
            ((OpenLedgerCallback) invocationOnMock.getArguments()[2]).openLedgerComplete(ledgerMock, null);
            return null;
        }
    }).when(mlFactoryMock).asyncOpen(matches(".*success.*"), any(ManagedLedgerConfig.class), any(OpenLedgerCallback.class), anyObject());
    // call openLedgerFailed on ML factory asyncOpen
    doAnswer(new Answer<Object>() {

        @Override
        public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
            Thread.sleep(300);
            new Thread(() -> {
                ((OpenLedgerCallback) invocationOnMock.getArguments()[2]).openLedgerFailed(new ManagedLedgerException("Managed ledger failure"), null);
            }).start();
            return null;
        }
    }).when(mlFactoryMock).asyncOpen(matches(".*fail.*"), any(ManagedLedgerConfig.class), any(OpenLedgerCallback.class), anyObject());
    // call addComplete on ledger asyncAddEntry
    doAnswer(new Answer<Object>() {

        @Override
        public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
            ((AddEntryCallback) invocationOnMock.getArguments()[1]).addComplete(new PositionImpl(-1, -1), invocationOnMock.getArguments()[2]);
            return null;
        }
    }).when(ledgerMock).asyncAddEntry(any(ByteBuf.class), any(AddEntryCallback.class), anyObject());
    doAnswer(new Answer<Object>() {

        @Override
        public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
            Thread.sleep(300);
            ((OpenCursorCallback) invocationOnMock.getArguments()[2]).openCursorComplete(cursorMock, null);
            return null;
        }
    }).when(ledgerMock).asyncOpenCursor(matches(".*success.*"), any(InitialPosition.class), any(OpenCursorCallback.class), anyObject());
    doAnswer(new Answer<Object>() {

        @Override
        public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
            Thread.sleep(300);
            ((OpenCursorCallback) invocationOnMock.getArguments()[2]).openCursorFailed(new ManagedLedgerException("Managed ledger failure"), null);
            return null;
        }
    }).when(ledgerMock).asyncOpenCursor(matches(".*fail.*"), any(InitialPosition.class), any(OpenCursorCallback.class), anyObject());
    doAnswer(new Answer<Object>() {

        @Override
        public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
            ((DeleteCursorCallback) invocationOnMock.getArguments()[1]).deleteCursorComplete(null);
            return null;
        }
    }).when(ledgerMock).asyncDeleteCursor(matches(".*success.*"), any(DeleteCursorCallback.class), anyObject());
    doAnswer(new Answer<Object>() {

        @Override
        public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
            ((DeleteCursorCallback) invocationOnMock.getArguments()[1]).deleteCursorFailed(new ManagedLedgerException("Managed ledger failure"), null);
            return null;
        }
    }).when(ledgerMock).asyncDeleteCursor(matches(".*fail.*"), any(DeleteCursorCallback.class), anyObject());
    doAnswer(new Answer<Object>() {

        @Override
        public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
            ((CloseCallback) invocationOnMock.getArguments()[0]).closeComplete(null);
            return null;
        }
    }).when(cursorMock).asyncClose(any(CloseCallback.class), anyObject());
    doReturn(successSubName).when(cursorMock).getName();
}
Also used : PositionImpl(org.apache.bookkeeper.mledger.impl.PositionImpl) CloseCallback(org.apache.bookkeeper.mledger.AsyncCallbacks.CloseCallback) InitialPosition(org.apache.pulsar.common.api.proto.PulsarApi.CommandSubscribe.InitialPosition) ByteBuf(io.netty.buffer.ByteBuf) ManagedLedgerException(org.apache.bookkeeper.mledger.ManagedLedgerException) OpenCursorCallback(org.apache.bookkeeper.mledger.AsyncCallbacks.OpenCursorCallback) InvocationOnMock(org.mockito.invocation.InvocationOnMock) Matchers.anyObject(org.mockito.Matchers.anyObject) DeleteCursorCallback(org.apache.bookkeeper.mledger.AsyncCallbacks.DeleteCursorCallback) ManagedLedgerConfig(org.apache.bookkeeper.mledger.ManagedLedgerConfig) OpenLedgerCallback(org.apache.bookkeeper.mledger.AsyncCallbacks.OpenLedgerCallback) AddEntryCallback(org.apache.bookkeeper.mledger.AsyncCallbacks.AddEntryCallback)

Example 18 with OpenLedgerCallback

use of org.apache.bookkeeper.mledger.AsyncCallbacks.OpenLedgerCallback in project incubator-pulsar by apache.

the class ServerCnxTest method testCreateProducerTimeout.

@Test(timeOut = 30000)
public void testCreateProducerTimeout() throws Exception {
    resetChannel();
    setChannelConnected();
    // Delay the topic creation in a deterministic way
    CompletableFuture<Runnable> openTopicFuture = new CompletableFuture<>();
    doAnswer(invocationOnMock -> {
        openTopicFuture.complete(() -> {
            ((OpenLedgerCallback) invocationOnMock.getArguments()[2]).openLedgerComplete(ledgerMock, null);
        });
        return null;
    }).when(mlFactoryMock).asyncOpen(matches(".*success.*"), any(ManagedLedgerConfig.class), any(OpenLedgerCallback.class), anyObject());
    // In a create producer timeout from client side we expect to see this sequence of commands :
    // 1. create producer
    // 2. close producer (when the timeout is triggered, which may be before the producer was created on the broker
    // 3. create producer (triggered by reconnection logic)
    // These operations need to be serialized, to allow the last create producer to finally succeed
    // (There can be more create/close pairs in the sequence, depending on the client timeout
    String producerName = "my-producer";
    ByteBuf createProducer1 = Commands.newProducer(successTopicName, 1, /* producer id */
    1, /* request id */
    producerName, Collections.emptyMap());
    channel.writeInbound(createProducer1);
    ByteBuf closeProducer = Commands.newCloseProducer(1, /* producer id */
    2);
    channel.writeInbound(closeProducer);
    ByteBuf createProducer2 = Commands.newProducer(successTopicName, 1, /* producer id */
    3, /* request id */
    producerName, Collections.emptyMap());
    channel.writeInbound(createProducer2);
    // Complete the topic opening
    openTopicFuture.get().run();
    // Close succeeds
    Object response = getResponse();
    assertEquals(response.getClass(), CommandSuccess.class);
    assertEquals(((CommandSuccess) response).getRequestId(), 2);
    // 2nd producer fails to create
    response = getResponse();
    assertEquals(response.getClass(), CommandError.class);
    assertEquals(((CommandError) response).getRequestId(), 3);
    // We should not receive response for 1st producer, since it was cancelled by the close
    assertTrue(channel.outboundMessages().isEmpty());
    assertTrue(channel.isActive());
    channel.finish();
}
Also used : CompletableFuture(java.util.concurrent.CompletableFuture) Matchers.anyObject(org.mockito.Matchers.anyObject) ManagedLedgerConfig(org.apache.bookkeeper.mledger.ManagedLedgerConfig) ByteString(com.google.protobuf.ByteString) ByteBuf(io.netty.buffer.ByteBuf) OpenLedgerCallback(org.apache.bookkeeper.mledger.AsyncCallbacks.OpenLedgerCallback) Test(org.testng.annotations.Test)

Example 19 with OpenLedgerCallback

use of org.apache.bookkeeper.mledger.AsyncCallbacks.OpenLedgerCallback in project incubator-pulsar by apache.

the class ServerCnxTest method testSubscribeTimeout.

@Test(timeOut = 30000)
public void testSubscribeTimeout() throws Exception {
    resetChannel();
    setChannelConnected();
    // Delay the topic creation in a deterministic way
    CompletableFuture<Runnable> openTopicTask = new CompletableFuture<>();
    doAnswer(invocationOnMock -> {
        openTopicTask.complete(() -> {
            ((OpenLedgerCallback) invocationOnMock.getArguments()[2]).openLedgerComplete(ledgerMock, null);
        });
        return null;
    }).when(mlFactoryMock).asyncOpen(matches(".*success.*"), any(ManagedLedgerConfig.class), any(OpenLedgerCallback.class), anyObject());
    // In a subscribe timeout from client side we expect to see this sequence of commands :
    // 1. Subscribe
    // 2. close consumer (when the timeout is triggered, which may be before the consumer was created on the broker)
    // 3. Subscribe (triggered by reconnection logic)
    // These operations need to be serialized, to allow the last subscribe operation to finally succeed
    // (There can be more subscribe/close pairs in the sequence, depending on the client timeout
    ByteBuf subscribe1 = // 
    Commands.newSubscribe(// 
    successTopicName, successSubName, 1, /* consumer id */
    1, /* request id */
    SubType.Exclusive, 0, "test");
    channel.writeInbound(subscribe1);
    ByteBuf closeConsumer = Commands.newCloseConsumer(1, /* consumer id */
    2);
    channel.writeInbound(closeConsumer);
    ByteBuf subscribe2 = // 
    Commands.newSubscribe(// 
    successTopicName, successSubName, 1, /* consumer id */
    3, /* request id */
    SubType.Exclusive, 0, "test");
    channel.writeInbound(subscribe2);
    ByteBuf subscribe3 = // 
    Commands.newSubscribe(// 
    successTopicName, successSubName, 1, /* consumer id */
    4, /* request id */
    SubType.Exclusive, 0, "test");
    channel.writeInbound(subscribe3);
    ByteBuf subscribe4 = // 
    Commands.newSubscribe(// 
    successTopicName, successSubName, 1, /* consumer id */
    5, /* request id */
    SubType.Exclusive, 0, "test");
    channel.writeInbound(subscribe4);
    openTopicTask.get().run();
    Object response;
    synchronized (this) {
        // Close succeeds
        response = getResponse();
        assertEquals(response.getClass(), CommandSuccess.class);
        assertEquals(((CommandSuccess) response).getRequestId(), 2);
        // All other subscribe should fail
        response = getResponse();
        assertEquals(response.getClass(), CommandError.class);
        assertEquals(((CommandError) response).getRequestId(), 3);
        response = getResponse();
        assertEquals(response.getClass(), CommandError.class);
        assertEquals(((CommandError) response).getRequestId(), 4);
        response = getResponse();
        assertEquals(response.getClass(), CommandError.class);
        assertEquals(((CommandError) response).getRequestId(), 5);
        // We should not receive response for 1st producer, since it was cancelled by the close
        assertTrue(channel.outboundMessages().isEmpty());
        assertTrue(channel.isActive());
    }
    channel.finish();
}
Also used : CompletableFuture(java.util.concurrent.CompletableFuture) Matchers.anyObject(org.mockito.Matchers.anyObject) ManagedLedgerConfig(org.apache.bookkeeper.mledger.ManagedLedgerConfig) ByteBuf(io.netty.buffer.ByteBuf) OpenLedgerCallback(org.apache.bookkeeper.mledger.AsyncCallbacks.OpenLedgerCallback) Test(org.testng.annotations.Test)

Example 20 with OpenLedgerCallback

use of org.apache.bookkeeper.mledger.AsyncCallbacks.OpenLedgerCallback in project incubator-pulsar by apache.

the class PersistentTopicTest method testCreateTopic.

@Test
public void testCreateTopic() throws Exception {
    final ManagedLedger ledgerMock = mock(ManagedLedger.class);
    doReturn(new ArrayList<Object>()).when(ledgerMock).getCursors();
    final String topicName = "persistent://prop/use/ns-abc/topic1";
    doAnswer(new Answer<Object>() {

        @Override
        public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
            ((OpenLedgerCallback) invocationOnMock.getArguments()[2]).openLedgerComplete(ledgerMock, null);
            return null;
        }
    }).when(mlFactoryMock).asyncOpen(anyString(), any(ManagedLedgerConfig.class), any(OpenLedgerCallback.class), anyObject());
    CompletableFuture<Void> future = brokerService.getTopic(topicName).thenAccept(topic -> {
        assertTrue(topic.toString().contains(topicName));
    }).exceptionally((t) -> {
        fail("should not fail");
        return null;
    });
    // wait for completion
    try {
        future.get(1, TimeUnit.SECONDS);
    } catch (Exception e) {
        fail("Should not fail or time out");
    }
}
Also used : PulsarClientImpl(org.apache.pulsar.client.impl.PulsarClientImpl) URL(java.net.URL) AdminResource(org.apache.pulsar.broker.admin.AdminResource) SchemaVersion(org.apache.pulsar.common.schema.SchemaVersion) CloseCallback(org.apache.bookkeeper.mledger.AsyncCallbacks.CloseCallback) LoggerFactory(org.slf4j.LoggerFactory) TimeoutException(java.util.concurrent.TimeoutException) Test(org.testng.annotations.Test) AfterMethod(org.testng.annotations.AfterMethod) Unpooled(io.netty.buffer.Unpooled) AckType(org.apache.pulsar.common.api.proto.PulsarApi.CommandAck.AckType) Future(java.util.concurrent.Future) OpenCursorCallback(org.apache.bookkeeper.mledger.AsyncCallbacks.OpenCursorCallback) ManagedCursor(org.apache.bookkeeper.mledger.ManagedCursor) ManagedLedger(org.apache.bookkeeper.mledger.ManagedLedger) ManagedLedgerConfig(org.apache.bookkeeper.mledger.ManagedLedgerConfig) Mockito.doAnswer(org.mockito.Mockito.doAnswer) Map(java.util.Map) ZooKeeperDataCache(org.apache.pulsar.zookeeper.ZooKeeperDataCache) Mockito.atLeast(org.mockito.Mockito.atLeast) DeleteCursorCallback(org.apache.bookkeeper.mledger.AsyncCallbacks.DeleteCursorCallback) Mockito.doReturn(org.mockito.Mockito.doReturn) Assert.assertFalse(org.testng.Assert.assertFalse) Method(java.lang.reflect.Method) PositionImpl(org.apache.bookkeeper.mledger.impl.PositionImpl) ZooKeeper(org.apache.zookeeper.ZooKeeper) CyclicBarrier(java.util.concurrent.CyclicBarrier) ImmutableMap(com.google.common.collect.ImmutableMap) CommandSubscribe(org.apache.pulsar.common.api.proto.PulsarApi.CommandSubscribe) BeforeMethod(org.testng.annotations.BeforeMethod) Mockito.doNothing(org.mockito.Mockito.doNothing) InetSocketAddress(java.net.InetSocketAddress) Executors(java.util.concurrent.Executors) MockedPulsarServiceBaseTest.createMockBookKeeper(org.apache.pulsar.broker.auth.MockedPulsarServiceBaseTest.createMockBookKeeper) AddEntryCallback(org.apache.bookkeeper.mledger.AsyncCallbacks.AddEntryCallback) Matchers.any(org.mockito.Matchers.any) ManagedLedgerException(org.apache.bookkeeper.mledger.ManagedLedgerException) CountDownLatch(java.util.concurrent.CountDownLatch) ManagedCursorImpl(org.apache.bookkeeper.mledger.impl.ManagedCursorImpl) PersistentTopic(org.apache.pulsar.broker.service.persistent.PersistentTopic) ConcurrentOpenHashMap(org.apache.pulsar.common.util.collections.ConcurrentOpenHashMap) PersistentSubscription(org.apache.pulsar.broker.service.persistent.PersistentSubscription) Optional(java.util.Optional) Mockito.mock(org.mockito.Mockito.mock) DeleteLedgerCallback(org.apache.bookkeeper.mledger.AsyncCallbacks.DeleteLedgerCallback) TopicName(org.apache.pulsar.common.naming.TopicName) Assert.assertNull(org.testng.Assert.assertNull) ManagedLedgerFactory(org.apache.bookkeeper.mledger.ManagedLedgerFactory) Assert.assertEquals(org.testng.Assert.assertEquals) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) PersistentDispatcherSingleActiveConsumer(org.apache.pulsar.broker.service.persistent.PersistentDispatcherSingleActiveConsumer) CompletableFuture(java.util.concurrent.CompletableFuture) NamespaceService(org.apache.pulsar.broker.namespace.NamespaceService) Mockito.spy(org.mockito.Mockito.spy) Matchers.anyString(org.mockito.Matchers.anyString) ArrayList(java.util.ArrayList) Answer(org.mockito.stubbing.Answer) InvocationOnMock(org.mockito.invocation.InvocationOnMock) ArgumentCaptor(org.mockito.ArgumentCaptor) ByteBuf(io.netty.buffer.ByteBuf) Matchers.anyObject(org.mockito.Matchers.anyObject) PulsarClient(org.apache.pulsar.client.api.PulsarClient) MessageMetadata(org.apache.pulsar.common.api.proto.PulsarApi.MessageMetadata) NamespaceBundle(org.apache.pulsar.common.naming.NamespaceBundle) PersistentDispatcherMultipleConsumers(org.apache.pulsar.broker.service.persistent.PersistentDispatcherMultipleConsumers) ExecutorService(java.util.concurrent.ExecutorService) CompactorSubscription(org.apache.pulsar.broker.service.persistent.CompactorSubscription) PersistentReplicator(org.apache.pulsar.broker.service.persistent.PersistentReplicator) Logger(org.slf4j.Logger) SubType(org.apache.pulsar.common.api.proto.PulsarApi.CommandSubscribe.SubType) Matchers.matches(org.mockito.Matchers.matches) CompactedTopic(org.apache.pulsar.compaction.CompactedTopic) ServiceConfiguration(org.apache.pulsar.broker.ServiceConfiguration) Assert.fail(org.testng.Assert.fail) Mockito.when(org.mockito.Mockito.when) ConfigurationCacheService(org.apache.pulsar.broker.cache.ConfigurationCacheService) MockedPulsarServiceBaseTest.createMockZooKeeper(org.apache.pulsar.broker.auth.MockedPulsarServiceBaseTest.createMockZooKeeper) Field(java.lang.reflect.Field) PulsarService(org.apache.pulsar.broker.PulsarService) ProducerConfigurationData(org.apache.pulsar.client.impl.conf.ProducerConfigurationData) Mockito.verify(org.mockito.Mockito.verify) Schema(org.apache.pulsar.client.api.Schema) ExecutionException(java.util.concurrent.ExecutionException) TimeUnit(java.util.concurrent.TimeUnit) Policies(org.apache.pulsar.common.policies.data.Policies) Mockito(org.mockito.Mockito) OpenLedgerCallback(org.apache.bookkeeper.mledger.AsyncCallbacks.OpenLedgerCallback) Compactor(org.apache.pulsar.compaction.Compactor) POLICIES(org.apache.pulsar.broker.cache.ConfigurationCacheService.POLICIES) MarkDeleteCallback(org.apache.bookkeeper.mledger.AsyncCallbacks.MarkDeleteCallback) Assert.assertTrue(org.testng.Assert.assertTrue) NonPersistentReplicator(org.apache.pulsar.broker.service.nonpersistent.NonPersistentReplicator) InitialPosition(org.apache.pulsar.common.api.proto.PulsarApi.CommandSubscribe.InitialPosition) LocalZooKeeperCacheService(org.apache.pulsar.broker.cache.LocalZooKeeperCacheService) Collections(java.util.Collections) ManagedLedger(org.apache.bookkeeper.mledger.ManagedLedger) Matchers.anyString(org.mockito.Matchers.anyString) TimeoutException(java.util.concurrent.TimeoutException) ManagedLedgerException(org.apache.bookkeeper.mledger.ManagedLedgerException) ExecutionException(java.util.concurrent.ExecutionException) InvocationOnMock(org.mockito.invocation.InvocationOnMock) Matchers.anyObject(org.mockito.Matchers.anyObject) ManagedLedgerConfig(org.apache.bookkeeper.mledger.ManagedLedgerConfig) OpenLedgerCallback(org.apache.bookkeeper.mledger.AsyncCallbacks.OpenLedgerCallback) Test(org.testng.annotations.Test)

Aggregations

OpenLedgerCallback (org.apache.bookkeeper.mledger.AsyncCallbacks.OpenLedgerCallback)31 ManagedLedgerConfig (org.apache.bookkeeper.mledger.ManagedLedgerConfig)25 ManagedLedgerException (org.apache.bookkeeper.mledger.ManagedLedgerException)23 Test (org.testng.annotations.Test)20 ByteBuf (io.netty.buffer.ByteBuf)19 Matchers.anyObject (org.mockito.Matchers.anyObject)18 CompletableFuture (java.util.concurrent.CompletableFuture)17 ManagedLedger (org.apache.bookkeeper.mledger.ManagedLedger)17 CountDownLatch (java.util.concurrent.CountDownLatch)14 InvocationOnMock (org.mockito.invocation.InvocationOnMock)9 AddEntryCallback (org.apache.bookkeeper.mledger.AsyncCallbacks.AddEntryCallback)8 ManagedCursor (org.apache.bookkeeper.mledger.ManagedCursor)8 OpenCursorCallback (org.apache.bookkeeper.mledger.AsyncCallbacks.OpenCursorCallback)7 ManagedLedgerFactory (org.apache.bookkeeper.mledger.ManagedLedgerFactory)7 ArrayList (java.util.ArrayList)6 List (java.util.List)6 Executors (java.util.concurrent.Executors)6 TimeUnit (java.util.concurrent.TimeUnit)6 CloseCallback (org.apache.bookkeeper.mledger.AsyncCallbacks.CloseCallback)6 DeleteCursorCallback (org.apache.bookkeeper.mledger.AsyncCallbacks.DeleteCursorCallback)6