use of org.apache.pulsar.broker.service.utils.ClientChannelHelper in project incubator-pulsar by apache.
the class ServerCnxTest method setup.
@BeforeMethod
public void setup() throws Exception {
svcConfig = spy(new ServiceConfiguration());
pulsar = spy(new PulsarService(svcConfig));
doReturn(new DefaultSchemaRegistryService()).when(pulsar).getSchemaRegistryService();
svcConfig.setKeepAliveIntervalSeconds(inSec(1, TimeUnit.SECONDS));
svcConfig.setBacklogQuotaCheckEnabled(false);
doReturn(svcConfig).when(pulsar).getConfiguration();
doReturn("use").when(svcConfig).getClusterName();
mlFactoryMock = mock(ManagedLedgerFactory.class);
doReturn(mlFactoryMock).when(pulsar).getManagedLedgerFactory();
ZooKeeper mockZk = createMockZooKeeper();
doReturn(mockZk).when(pulsar).getZkClient();
doReturn(createMockBookKeeper(mockZk)).when(pulsar).getBookKeeperClient();
configCacheService = mock(ConfigurationCacheService.class);
ZooKeeperDataCache<Policies> zkDataCache = mock(ZooKeeperDataCache.class);
doReturn(Optional.empty()).when(zkDataCache).get(anyObject());
doReturn(zkDataCache).when(configCacheService).policiesCache();
doReturn(configCacheService).when(pulsar).getConfigurationCache();
LocalZooKeeperCacheService zkCache = mock(LocalZooKeeperCacheService.class);
doReturn(CompletableFuture.completedFuture(Optional.empty())).when(zkDataCache).getAsync(any());
doReturn(zkDataCache).when(zkCache).policiesCache();
doReturn(configCacheService).when(pulsar).getConfigurationCache();
doReturn(zkCache).when(pulsar).getLocalZkCacheService();
brokerService = spy(new BrokerService(pulsar));
doReturn(brokerService).when(pulsar).getBrokerService();
namespaceService = mock(NamespaceService.class);
doReturn(namespaceService).when(pulsar).getNamespaceService();
doReturn(true).when(namespaceService).isServiceUnitOwned(any(NamespaceBundle.class));
doReturn(true).when(namespaceService).isServiceUnitActive(any(TopicName.class));
setupMLAsyncCallbackMocks();
clientChannelHelper = new ClientChannelHelper();
}
Aggregations