use of org.apache.distributedlog.metadata.DLMetadata in project bookkeeper by apache.
the class TestZkMetadataResolver method testFederatedNamespace.
@Test(timeout = 60000)
public void testFederatedNamespace() throws Exception {
DistributedLogConfiguration dlConf = new DistributedLogConfiguration();
URI uri = createURI("/messaging/distributedlog-testfederatednamespace/dl1");
DLMetadata meta1 = DLMetadata.create(new BKDLConfig("127.0.0.1:7000", "ledgers"));
meta1.create(uri);
BKDLConfig read1 = BKDLConfig.resolveDLConfig(zkc, uri);
BKDLConfig.propagateConfiguration(read1, dlConf);
assertTrue(dlConf.getCreateStreamIfNotExists());
BKDLConfig.clearCachedDLConfigs();
DLMetadata meta2 = DLMetadata.create(new BKDLConfig("127.0.0.1:7000", "ledgers").setFederatedNamespace(true));
meta2.update(uri);
BKDLConfig read2 = BKDLConfig.resolveDLConfig(zkc, uri);
BKDLConfig.propagateConfiguration(read2, dlConf);
assertFalse(dlConf.getCreateStreamIfNotExists());
BKDLConfig.clearCachedDLConfigs();
DLMetadata meta3 = DLMetadata.create(new BKDLConfig("127.0.0.1:7000", "ledgers").setFederatedNamespace(false));
meta3.update(uri);
BKDLConfig read3 = BKDLConfig.resolveDLConfig(zkc, uri);
BKDLConfig.propagateConfiguration(read3, dlConf);
// if it is non-federated namespace, it won't change the create stream behavior.
assertFalse(dlConf.getCreateStreamIfNotExists());
BKDLConfig.clearCachedDLConfigs();
}
Aggregations