use of org.apache.twill.internal.zookeeper.DefaultZKClientService in project cdap by caskdata.
the class KafkaClientModuleTest method beforeTest.
@Before
public void beforeTest() throws Exception {
zkServer = InMemoryZKServer.builder().setDataDir(TEMP_FOLDER.newFolder()).build();
zkServer.startAndWait();
CConfiguration cConf = CConfiguration.create();
String kafkaZKNamespace = cConf.get(KafkaConstants.ConfigKeys.ZOOKEEPER_NAMESPACE_CONFIG);
kafkaZKConnect = zkServer.getConnectionStr();
if (kafkaZKNamespace != null) {
ZKClientService zkClient = new DefaultZKClientService(zkServer.getConnectionStr(), 2000, null, ImmutableMultimap.<String, byte[]>of());
zkClient.startAndWait();
zkClient.create("/" + kafkaZKNamespace, null, CreateMode.PERSISTENT);
zkClient.stopAndWait();
kafkaZKConnect += "/" + kafkaZKNamespace;
}
kafkaServer = createKafkaServer(kafkaZKConnect, TEMP_FOLDER.newFolder());
kafkaServer.startAndWait();
}
Aggregations