Search in sources :

Example 86 with TestingServer

use of org.apache.curator.test.TestingServer in project heron by twitter.

the class ZkCoordinatorTest method setUp.

@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    server = new TestingServer();
    String connectionString = server.getConnectString();
    ZkHosts hosts = new ZkHosts(connectionString);
    hosts.refreshFreqSecs = 1;
    spoutConfig = new SpoutConfig(hosts, "topic", "/test", "id");
    Map<String, Object> conf = buildZookeeperConfig(server);
    state = new ZkState(conf);
    simpleConsumer = new SimpleConsumer("localhost", broker.getPort(), 60000, 1024, "testClient");
    when(dynamicPartitionConnections.register(any(Broker.class), any(String.class), anyInt())).thenReturn(simpleConsumer);
}
Also used : TestingServer(org.apache.curator.test.TestingServer) SimpleConsumer(kafka.javaapi.consumer.SimpleConsumer) Before(org.junit.Before)

Example 87 with TestingServer

use of org.apache.curator.test.TestingServer in project curator by Netflix.

the class ContentWatcherTest method setUp.

@Before
public void setUp() throws Exception {
    LOG.info("------------ BEFORE -------------");
    _zkServer = new TestingServer(4711);
    _zkClient = ZkTestSystem.createZkClient(_zkServer.getConnectString());
}
Also used : TestingServer(org.apache.curator.test.TestingServer) Before(org.junit.Before)

Example 88 with TestingServer

use of org.apache.curator.test.TestingServer in project curator by Netflix.

the class DistributedQueueTest method setUp.

@Before
public void setUp() throws Exception {
    _zkServer = new TestingServer(4711);
    _zkClient = ZkTestSystem.createZkClient(_zkServer.getConnectString());
}
Also used : TestingServer(org.apache.curator.test.TestingServer) Before(org.junit.Before)

Example 89 with TestingServer

use of org.apache.curator.test.TestingServer in project curator by Netflix.

the class ServerZkClientTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    _zkServer = new TestingServer(4711);
    _client = ZkTestSystem.createZkClient("localhost:4711");
}
Also used : TestingServer(org.apache.curator.test.TestingServer) Before(org.junit.Before)

Example 90 with TestingServer

use of org.apache.curator.test.TestingServer in project archaius by Netflix.

the class ZooKeeperConfigurationSourceTest method setUp.

@BeforeClass
public static void setUp() throws Exception {
    System.setProperty(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES, "true");
    server = new TestingServer();
    logger.info("Initialized local ZK with connect string [{}]", server.getConnectString());
    client = CuratorFrameworkFactory.newClient(server.getConnectString(), new ExponentialBackoffRetry(1000, 3));
    client.start();
    zkConfigSource = new ZooKeeperConfigurationSource(client, CONFIG_ROOT_PATH);
    zkConfigSource.start();
    // setup system properties
    System.setProperty("test.key4", "test.value4-system");
    System.setProperty("test.key5", "test.value5-system");
    final ConcurrentMapConfiguration systemConfig = new ConcurrentMapConfiguration();
    systemConfig.loadProperties(System.getProperties());
    final DynamicWatchedConfiguration zkDynamicOverrideConfig = new DynamicWatchedConfiguration(zkConfigSource);
    mapConfig = new ConcurrentMapConfiguration();
    mapConfig.addProperty("test.key1", "test.value1-map");
    mapConfig.addProperty("test.key2", "test.value2-map");
    mapConfig.addProperty("test.key3", "test.value3-map");
    mapConfig.addProperty("test.key4", "test.value4-map");
    final ConcurrentCompositeConfiguration compositeConfig = new ConcurrentCompositeConfiguration();
    compositeConfig.addConfiguration(zkDynamicOverrideConfig, "zk dynamic override configuration");
    compositeConfig.addConfiguration(mapConfig, "map configuration");
    compositeConfig.addConfiguration(systemConfig, "system configuration");
    // setup ZK properties
    setZkProperty("test.key1", "test.value1-zk");
    setZkProperty("test.key2", "test.value2-zk");
    setZkProperty("test.key4", "test.value4-zk");
    ConfigurationManager.install(compositeConfig);
}
Also used : TestingServer(org.apache.curator.test.TestingServer) ExponentialBackoffRetry(org.apache.curator.retry.ExponentialBackoffRetry) ConcurrentMapConfiguration(com.netflix.config.ConcurrentMapConfiguration) DynamicWatchedConfiguration(com.netflix.config.DynamicWatchedConfiguration) ConcurrentCompositeConfiguration(com.netflix.config.ConcurrentCompositeConfiguration) BeforeClass(org.junit.BeforeClass)

Aggregations

TestingServer (org.apache.curator.test.TestingServer)150 Before (org.junit.Before)38 Test (org.junit.Test)30 CuratorFramework (org.apache.curator.framework.CuratorFramework)28 File (java.io.File)27 Properties (java.util.Properties)18 KafkaConfig (kafka.server.KafkaConfig)15 RetryOneTime (org.apache.curator.retry.RetryOneTime)15 Test (org.testng.annotations.Test)15 ExponentialBackoffRetry (org.apache.curator.retry.ExponentialBackoffRetry)14 IOException (java.io.IOException)13 Timing (org.apache.curator.test.Timing)13 HashMap (java.util.HashMap)12 ZkClient (org.I0Itec.zkclient.ZkClient)12 ServerSocket (java.net.ServerSocket)11 KafkaServerStartable (kafka.server.KafkaServerStartable)11 ZkUtils (kafka.utils.ZkUtils)11 ZkConnection (org.I0Itec.zkclient.ZkConnection)11 BeforeClass (org.junit.BeforeClass)11 TestingServerStarter (io.pravega.test.common.TestingServerStarter)9