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);
}
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());
}
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());
}
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");
}
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);
}
Aggregations