Search in sources :

Example 1 with ClientChannelHelper

use of com.yahoo.pulsar.broker.service.utils.ClientChannelHelper in project pulsar by yahoo.

the class ServerCnxTest method setup.

@BeforeMethod
public void setup() throws Exception {
    svcConfig = spy(new ServiceConfiguration());
    pulsar = spy(new PulsarService(svcConfig));
    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 = mock(ZooKeeper.class);
    doReturn(mockZk).when(pulsar).getZkClient();
    configCacheService = mock(ConfigurationCacheService.class);
    @SuppressWarnings("unchecked") ZooKeeperDataCache<Policies> zkDataCache = mock(ZooKeeperDataCache.class);
    doReturn(Optional.empty()).when(zkDataCache).get(anyObject());
    doReturn(zkDataCache).when(configCacheService).policiesCache();
    doReturn(configCacheService).when(pulsar).getConfigurationCache();
    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(DestinationName.class));
    setupMLAsyncCallbackMocks();
    clientChannelHelper = new ClientChannelHelper();
}
Also used : NamespaceBundle(com.yahoo.pulsar.common.naming.NamespaceBundle) Policies(com.yahoo.pulsar.common.policies.data.Policies) ClientChannelHelper(com.yahoo.pulsar.broker.service.utils.ClientChannelHelper) ZooKeeper(org.apache.zookeeper.ZooKeeper) ServiceConfiguration(com.yahoo.pulsar.broker.ServiceConfiguration) PulsarService(com.yahoo.pulsar.broker.PulsarService) NamespaceService(com.yahoo.pulsar.broker.namespace.NamespaceService) ManagedLedgerFactory(org.apache.bookkeeper.mledger.ManagedLedgerFactory) ConfigurationCacheService(com.yahoo.pulsar.broker.cache.ConfigurationCacheService) DestinationName(com.yahoo.pulsar.common.naming.DestinationName) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

PulsarService (com.yahoo.pulsar.broker.PulsarService)1 ServiceConfiguration (com.yahoo.pulsar.broker.ServiceConfiguration)1 ConfigurationCacheService (com.yahoo.pulsar.broker.cache.ConfigurationCacheService)1 NamespaceService (com.yahoo.pulsar.broker.namespace.NamespaceService)1 ClientChannelHelper (com.yahoo.pulsar.broker.service.utils.ClientChannelHelper)1 DestinationName (com.yahoo.pulsar.common.naming.DestinationName)1 NamespaceBundle (com.yahoo.pulsar.common.naming.NamespaceBundle)1 Policies (com.yahoo.pulsar.common.policies.data.Policies)1 ManagedLedgerFactory (org.apache.bookkeeper.mledger.ManagedLedgerFactory)1 ZooKeeper (org.apache.zookeeper.ZooKeeper)1 BeforeMethod (org.testng.annotations.BeforeMethod)1