Search in sources :

Example 1 with LocalZooKeeperCacheService

use of com.yahoo.pulsar.broker.cache.LocalZooKeeperCacheService in project pulsar by yahoo.

the class OwnershipCacheTest method setup.

@BeforeMethod
public void setup() throws Exception {
    final int port = 8080;
    selfBrokerUrl = "tcp://localhost:" + port;
    pulsar = mock(PulsarService.class);
    config = mock(ServiceConfiguration.class);
    executor = new OrderedSafeExecutor(1, "test");
    zkCache = new LocalZooKeeperCache(MockZooKeeper.newInstance(), executor);
    localCache = new LocalZooKeeperCacheService(zkCache, null);
    bundleFactory = new NamespaceBundleFactory(pulsar, Hashing.crc32());
    nsService = mock(NamespaceService.class);
    brokerService = mock(BrokerService.class);
    doReturn(CompletableFuture.completedFuture(1)).when(brokerService).unloadServiceUnit(anyObject());
    doReturn(zkCache).when(pulsar).getLocalZkCache();
    doReturn(localCache).when(pulsar).getLocalZkCacheService();
    doReturn(config).when(pulsar).getConfiguration();
    doReturn(nsService).when(pulsar).getNamespaceService();
    doReturn(port).when(config).getBrokerServicePort();
    doReturn(brokerService).when(pulsar).getBrokerService();
    doReturn(webAddress(config)).when(pulsar).getWebServiceAddress();
    doReturn(selfBrokerUrl).when(pulsar).getBrokerServiceUrl();
}
Also used : PulsarService(com.yahoo.pulsar.broker.PulsarService) ServiceConfiguration(com.yahoo.pulsar.broker.ServiceConfiguration) LocalZooKeeperCache(com.yahoo.pulsar.zookeeper.LocalZooKeeperCache) OrderedSafeExecutor(org.apache.bookkeeper.util.OrderedSafeExecutor) NamespaceBundleFactory(com.yahoo.pulsar.common.naming.NamespaceBundleFactory) BrokerService(com.yahoo.pulsar.broker.service.BrokerService) LocalZooKeeperCacheService(com.yahoo.pulsar.broker.cache.LocalZooKeeperCacheService) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 2 with LocalZooKeeperCacheService

use of com.yahoo.pulsar.broker.cache.LocalZooKeeperCacheService in project pulsar by yahoo.

the class PulsarService method startZkCacheService.

private void startZkCacheService() throws PulsarServerException {
    LOG.info("starting configuration cache service");
    this.localZkCache = new LocalZooKeeperCache(getZkClient(), getOrderedExecutor());
    this.globalZkCache = new GlobalZooKeeperCache(getZooKeeperClientFactory(), (int) config.getZooKeeperSessionTimeoutMillis(), config.getGlobalZookeeperServers(), getOrderedExecutor(), this.executor);
    try {
        this.globalZkCache.start();
    } catch (IOException e) {
        throw new PulsarServerException(e);
    }
    this.configurationCacheService = new ConfigurationCacheService(getGlobalZkCache());
    this.localZkCacheService = new LocalZooKeeperCacheService(getLocalZkCache(), this.configurationCacheService);
}
Also used : GlobalZooKeeperCache(com.yahoo.pulsar.zookeeper.GlobalZooKeeperCache) LocalZooKeeperCache(com.yahoo.pulsar.zookeeper.LocalZooKeeperCache) ConfigurationCacheService(com.yahoo.pulsar.broker.cache.ConfigurationCacheService) IOException(java.io.IOException) LocalZooKeeperCacheService(com.yahoo.pulsar.broker.cache.LocalZooKeeperCacheService)

Example 3 with LocalZooKeeperCacheService

use of com.yahoo.pulsar.broker.cache.LocalZooKeeperCacheService in project pulsar by yahoo.

the class ResourceQuotaCacheTest method setup.

@BeforeMethod
public void setup() throws Exception {
    pulsar = mock(PulsarService.class);
    OrderedSafeExecutor executor = new OrderedSafeExecutor(1, "test");
    zkCache = new LocalZooKeeperCache(MockZooKeeper.newInstance(), executor);
    localCache = new LocalZooKeeperCacheService(zkCache, null);
    bundleFactory = new NamespaceBundleFactory(pulsar, Hashing.crc32());
    doReturn(zkCache).when(pulsar).getLocalZkCache();
    doReturn(localCache).when(pulsar).getLocalZkCacheService();
}
Also used : PulsarService(com.yahoo.pulsar.broker.PulsarService) LocalZooKeeperCache(com.yahoo.pulsar.zookeeper.LocalZooKeeperCache) OrderedSafeExecutor(org.apache.bookkeeper.util.OrderedSafeExecutor) NamespaceBundleFactory(com.yahoo.pulsar.common.naming.NamespaceBundleFactory) LocalZooKeeperCacheService(com.yahoo.pulsar.broker.cache.LocalZooKeeperCacheService) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

LocalZooKeeperCacheService (com.yahoo.pulsar.broker.cache.LocalZooKeeperCacheService)3 LocalZooKeeperCache (com.yahoo.pulsar.zookeeper.LocalZooKeeperCache)3 PulsarService (com.yahoo.pulsar.broker.PulsarService)2 NamespaceBundleFactory (com.yahoo.pulsar.common.naming.NamespaceBundleFactory)2 OrderedSafeExecutor (org.apache.bookkeeper.util.OrderedSafeExecutor)2 BeforeMethod (org.testng.annotations.BeforeMethod)2 ServiceConfiguration (com.yahoo.pulsar.broker.ServiceConfiguration)1 ConfigurationCacheService (com.yahoo.pulsar.broker.cache.ConfigurationCacheService)1 BrokerService (com.yahoo.pulsar.broker.service.BrokerService)1 GlobalZooKeeperCache (com.yahoo.pulsar.zookeeper.GlobalZooKeeperCache)1 IOException (java.io.IOException)1