use of com.twitter.distributedlog.metadata.LogMetadataStore in project distributedlog by twitter.
the class TestFederatedZKLogMetadataStore method testCreateLog.
@Test(timeout = 60000)
public void testCreateLog() throws Exception {
DistributedLogConfiguration conf = new DistributedLogConfiguration();
conf.addConfiguration(baseConf);
ZooKeeperClient anotherZkc = TestZooKeeperClientBuilder.newBuilder().uri(uri).sessionTimeoutMs(zkSessionTimeoutMs).build();
FederatedZKLogMetadataStore anotherMetadataStore = new FederatedZKLogMetadataStore(conf, uri, anotherZkc, scheduler);
for (int i = 0; i < 2 * maxLogsPerSubnamespace; i++) {
LogMetadataStore createStore, checkStore;
if (i % 2 == 0) {
createStore = metadataStore;
checkStore = anotherMetadataStore;
} else {
createStore = anotherMetadataStore;
checkStore = metadataStore;
}
String logName = "test-create-log-" + i;
URI logUri = FutureUtils.result(createStore.createLog(logName));
Optional<URI> logLocation = FutureUtils.result(checkStore.getLogLocation(logName));
assertTrue("Log " + logName + " doesn't exist", logLocation.isPresent());
assertEquals("Different log location " + logLocation.get() + " is found", logUri, logLocation.get());
}
assertEquals(2, metadataStore.getSubnamespaces().size());
assertEquals(2, anotherMetadataStore.getSubnamespaces().size());
}
Aggregations