Skip to content

Commit

Permalink
fix methods changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gaoran10 committed Aug 9, 2024
1 parent 067f274 commit 449f052
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.MoreExecutors;
import io.netty.channel.EventLoopGroup;
import io.opentelemetry.api.OpenTelemetry;
import io.streamnative.pulsar.handlers.amqp.AmqpServiceConfiguration;
import java.lang.reflect.Field;
import java.nio.charset.StandardCharsets;
Expand Down Expand Up @@ -153,8 +154,10 @@ protected void setupBrokerMocks(PulsarService pulsar) throws Exception {
doReturn(mockBookKeeperClientFactory).when(pulsar).newBookKeeperClientFactory();

MockZooKeeperSession mockZooKeeperSession = MockZooKeeperSession.newInstance(mockZooKeeper);
doReturn(new ZKMetadataStore(mockZooKeeperSession)).when(pulsar).createLocalMetadataStore(any());
doReturn(new ZKMetadataStore(mockZooKeeperSession)).when(pulsar).createConfigurationMetadataStore(any());
doReturn(new ZKMetadataStore(mockZooKeeperSession)).when(pulsar).createLocalMetadataStore(
any(), OpenTelemetry.noop());
doReturn(new ZKMetadataStore(mockZooKeeperSession)).when(pulsar).createConfigurationMetadataStore(
any(), OpenTelemetry.noop());

Supplier<NamespaceService> namespaceServiceSupplier = () -> spy(new NamespaceService(pulsar));
doReturn(namespaceServiceSupplier).when(pulsar).getNamespaceServiceProvider();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.MoreExecutors;
import io.netty.channel.EventLoopGroup;
import io.opentelemetry.api.OpenTelemetry;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.bookkeeper.client.BookKeeper;
Expand Down Expand Up @@ -280,8 +281,10 @@ protected void setupBrokerMocks(PulsarService pulsar) throws Exception {
doReturn(mockBookKeeperClientFactory).when(pulsar).newBookKeeperClientFactory();

MockZooKeeperSession mockZooKeeperSession = MockZooKeeperSession.newInstance(mockZooKeeper);
doReturn(new ZKMetadataStore(mockZooKeeperSession)).when(pulsar).createLocalMetadataStore(any());
doReturn(new ZKMetadataStore(mockZooKeeperSession)).when(pulsar).createConfigurationMetadataStore(any());
doReturn(new ZKMetadataStore(mockZooKeeperSession)).when(pulsar)
.createLocalMetadataStore(any(), OpenTelemetry.noop());
doReturn(new ZKMetadataStore(mockZooKeeperSession)).when(pulsar)
.createConfigurationMetadataStore(any(), OpenTelemetry.noop());

Supplier<NamespaceService> namespaceServiceSupplier = () -> spy(new NamespaceService(pulsar));
doReturn(namespaceServiceSupplier).when(pulsar).getNamespaceServiceProvider();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
import java.util.function.Supplier;

import io.opentelemetry.api.OpenTelemetry;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.bookkeeper.client.BookKeeper;
Expand Down Expand Up @@ -307,8 +309,10 @@ protected void setupBrokerMocks(PulsarService pulsar) throws Exception {
doReturn(mockBookKeeperClientFactory).when(pulsar).newBookKeeperClientFactory();

MockZooKeeperSession mockZooKeeperSession = MockZooKeeperSession.newInstance(mockZooKeeper);
doReturn(new ZKMetadataStore(mockZooKeeperSession)).when(pulsar).createLocalMetadataStore(any());
doReturn(new ZKMetadataStore(mockZooKeeperSession)).when(pulsar).createConfigurationMetadataStore(any());
doReturn(new ZKMetadataStore(mockZooKeeperSession)).when(pulsar)
.createLocalMetadataStore(any(), OpenTelemetry.noop());
doReturn(new ZKMetadataStore(mockZooKeeperSession)).when(pulsar)
.createConfigurationMetadataStore(any(), OpenTelemetry.noop());

Supplier<NamespaceService> namespaceServiceSupplier = () -> spy(new NamespaceService(pulsar));
doReturn(namespaceServiceSupplier).when(pulsar).getNamespaceServiceProvider();
Expand Down

0 comments on commit 449f052

Please sign in to comment.