use of org.apache.bookkeeper.bookie.BookieImpl in project incubator-pulsar by apache.
the class BrokerBookieIsolationTest method testBookieIsolation.
/**
* Validate that broker can support tenant based bookie isolation.
*
* <pre>
* 1. create two bookie-info group : default-group and isolated-group
* 2. namespace ns1 : uses default-group
* validate: bookie-ensemble for ns1-topics's ledger will be from default-group
* 3. namespace ns2,ns3,ns4: uses isolated-group
* validate: bookie-ensemble for above namespace-topics's ledger will be from isolated-group
* </pre>
*
* @throws Exception
*/
@Test
public void testBookieIsolation() throws Exception {
final String tenant1 = "tenant1";
final String cluster = "use";
final String ns1 = String.format("%s/%s/%s", tenant1, cluster, "ns1");
final String ns2 = String.format("%s/%s/%s", tenant1, cluster, "ns2");
final String ns3 = String.format("%s/%s/%s", tenant1, cluster, "ns3");
final String ns4 = String.format("%s/%s/%s", tenant1, cluster, "ns4");
final int totalPublish = 100;
final String brokerBookkeeperClientIsolationGroups = "default-group";
final String tenantNamespaceIsolationGroups = "tenant1-isolation";
BookieServer[] bookies = bkEnsemble.getBookies();
ZooKeeper zkClient = bkEnsemble.getZkClient();
Set<BookieId> defaultBookies = Sets.newHashSet(bookies[0].getBookieId(), bookies[1].getBookieId());
Set<BookieId> isolatedBookies = Sets.newHashSet(bookies[2].getBookieId(), bookies[3].getBookieId());
setDefaultIsolationGroup(brokerBookkeeperClientIsolationGroups, zkClient, defaultBookies);
setDefaultIsolationGroup(tenantNamespaceIsolationGroups, zkClient, isolatedBookies);
ServiceConfiguration config = new ServiceConfiguration();
config.setLoadManagerClassName(ModularLoadManagerImpl.class.getName());
config.setClusterName(cluster);
config.setWebServicePort(Optional.of(0));
config.setMetadataStoreUrl("zk:127.0.0.1" + ":" + bkEnsemble.getZookeeperPort());
config.setBrokerShutdownTimeoutMs(0L);
config.setLoadBalancerOverrideBrokerNicSpeedGbps(Optional.of(1.0d));
config.setBrokerServicePort(Optional.of(0));
config.setAdvertisedAddress("localhost");
config.setBookkeeperClientIsolationGroups(brokerBookkeeperClientIsolationGroups);
config.setManagedLedgerDefaultEnsembleSize(2);
config.setManagedLedgerDefaultWriteQuorum(2);
config.setManagedLedgerDefaultAckQuorum(2);
config.setAllowAutoTopicCreationType("non-partitioned");
int totalEntriesPerLedger = 20;
int totalLedgers = totalPublish / totalEntriesPerLedger;
config.setManagedLedgerMaxEntriesPerLedger(totalEntriesPerLedger);
config.setManagedLedgerMinLedgerRolloverTimeMinutes(0);
pulsarService = new PulsarService(config);
pulsarService.start();
PulsarAdmin admin = PulsarAdmin.builder().serviceHttpUrl(pulsarService.getWebServiceAddress()).build();
ClusterData clusterData = ClusterData.builder().serviceUrl(pulsarService.getWebServiceAddress()).build();
admin.clusters().createCluster(cluster, clusterData);
TenantInfoImpl tenantInfo = new TenantInfoImpl(null, Sets.newHashSet(cluster));
admin.tenants().createTenant(tenant1, tenantInfo);
admin.namespaces().createNamespace(ns1);
admin.namespaces().createNamespace(ns2);
admin.namespaces().createNamespace(ns3);
admin.namespaces().createNamespace(ns4);
admin.namespaces().setBookieAffinityGroup(ns2, BookieAffinityGroupData.builder().bookkeeperAffinityGroupPrimary(tenantNamespaceIsolationGroups).build());
admin.namespaces().setBookieAffinityGroup(ns3, BookieAffinityGroupData.builder().bookkeeperAffinityGroupPrimary(tenantNamespaceIsolationGroups).build());
admin.namespaces().setBookieAffinityGroup(ns4, BookieAffinityGroupData.builder().bookkeeperAffinityGroupPrimary(tenantNamespaceIsolationGroups).build());
assertEquals(admin.namespaces().getBookieAffinityGroup(ns2), BookieAffinityGroupData.builder().bookkeeperAffinityGroupPrimary(tenantNamespaceIsolationGroups).build());
assertEquals(admin.namespaces().getBookieAffinityGroup(ns3), BookieAffinityGroupData.builder().bookkeeperAffinityGroupPrimary(tenantNamespaceIsolationGroups).build());
assertEquals(admin.namespaces().getBookieAffinityGroup(ns4), BookieAffinityGroupData.builder().bookkeeperAffinityGroupPrimary(tenantNamespaceIsolationGroups).build());
try {
admin.namespaces().getBookieAffinityGroup(ns1);
fail("ns1 should have no bookie affinity group set");
} catch (PulsarAdminException.NotFoundException e) {
// Ok
}
@Cleanup PulsarClient pulsarClient = PulsarClient.builder().serviceUrl(pulsarService.getBrokerServiceUrl()).statsInterval(-1, TimeUnit.SECONDS).build();
PersistentTopic topic1 = (PersistentTopic) createTopicAndPublish(pulsarClient, ns1, "topic1", totalPublish);
PersistentTopic topic2 = (PersistentTopic) createTopicAndPublish(pulsarClient, ns2, "topic1", totalPublish);
PersistentTopic topic3 = (PersistentTopic) createTopicAndPublish(pulsarClient, ns3, "topic1", totalPublish);
PersistentTopic topic4 = (PersistentTopic) createTopicAndPublish(pulsarClient, ns4, "topic1", totalPublish);
BookieImpl bookie1 = (BookieImpl) bookies[0].getBookie();
LedgerManager ledgerManager = getLedgerManager(bookie1);
// namespace: ns1
ManagedLedgerImpl ml = (ManagedLedgerImpl) topic1.getManagedLedger();
assertEquals(ml.getLedgersInfoAsList().size(), totalLedgers);
// validate ledgers' ensemble with affinity bookies
assertAffinityBookies(ledgerManager, ml.getLedgersInfoAsList(), defaultBookies);
// namespace: ns2
ml = (ManagedLedgerImpl) topic2.getManagedLedger();
assertEquals(ml.getLedgersInfoAsList().size(), totalLedgers);
// validate ledgers' ensemble with affinity bookies
assertAffinityBookies(ledgerManager, ml.getLedgersInfoAsList(), isolatedBookies);
// namespace: ns3
ml = (ManagedLedgerImpl) topic3.getManagedLedger();
assertEquals(ml.getLedgersInfoAsList().size(), totalLedgers);
// validate ledgers' ensemble with affinity bookies
assertAffinityBookies(ledgerManager, ml.getLedgersInfoAsList(), isolatedBookies);
// namespace: ns4
ml = (ManagedLedgerImpl) topic4.getManagedLedger();
assertEquals(ml.getLedgersInfoAsList().size(), totalLedgers);
// validate ledgers' ensemble with affinity bookies
assertAffinityBookies(ledgerManager, ml.getLedgersInfoAsList(), isolatedBookies);
ManagedLedgerClientFactory mlFactory = (ManagedLedgerClientFactory) pulsarService.getManagedLedgerClientFactory();
Map<EnsemblePlacementPolicyConfig, BookKeeper> bkPlacementPolicyToBkClientMap = mlFactory.getBkEnsemblePolicyToBookKeeperMap();
// broker should create only 1 bk-client and factory per isolation-group
assertEquals(bkPlacementPolicyToBkClientMap.size(), 1);
// make sure bk-isolation group also configure REPP_DNS_RESOLVER_CLASS as ZkBookieRackAffinityMapping to
// configure rack-aware policy with in isolated group
Map<EnsemblePlacementPolicyConfig, BookKeeper> bkMap = mlFactory.getBkEnsemblePolicyToBookKeeperMap();
BookKeeper bk = bkMap.values().iterator().next();
Method getConf = BookKeeper.class.getDeclaredMethod("getConf");
getConf.setAccessible(true);
ClientConfiguration clientConf = (ClientConfiguration) getConf.invoke(bk);
assertEquals(clientConf.getProperty(REPP_DNS_RESOLVER_CLASS), BookieRackAffinityMapping.class.getName());
}
use of org.apache.bookkeeper.bookie.BookieImpl in project pulsar by yahoo.
the class BrokerBookieIsolationTest method testBookieIsolation.
/**
* Validate that broker can support tenant based bookie isolation.
*
* <pre>
* 1. create two bookie-info group : default-group and isolated-group
* 2. namespace ns1 : uses default-group
* validate: bookie-ensemble for ns1-topics's ledger will be from default-group
* 3. namespace ns2,ns3,ns4: uses isolated-group
* validate: bookie-ensemble for above namespace-topics's ledger will be from isolated-group
* </pre>
*
* @throws Exception
*/
@Test
public void testBookieIsolation() throws Exception {
final String tenant1 = "tenant1";
final String cluster = "use";
final String ns1 = String.format("%s/%s/%s", tenant1, cluster, "ns1");
final String ns2 = String.format("%s/%s/%s", tenant1, cluster, "ns2");
final String ns3 = String.format("%s/%s/%s", tenant1, cluster, "ns3");
final String ns4 = String.format("%s/%s/%s", tenant1, cluster, "ns4");
final int totalPublish = 100;
final String brokerBookkeeperClientIsolationGroups = "default-group";
final String tenantNamespaceIsolationGroups = "tenant1-isolation";
BookieServer[] bookies = bkEnsemble.getBookies();
ZooKeeper zkClient = bkEnsemble.getZkClient();
Set<BookieId> defaultBookies = Sets.newHashSet(bookies[0].getBookieId(), bookies[1].getBookieId());
Set<BookieId> isolatedBookies = Sets.newHashSet(bookies[2].getBookieId(), bookies[3].getBookieId());
setDefaultIsolationGroup(brokerBookkeeperClientIsolationGroups, zkClient, defaultBookies);
setDefaultIsolationGroup(tenantNamespaceIsolationGroups, zkClient, isolatedBookies);
ServiceConfiguration config = new ServiceConfiguration();
config.setLoadManagerClassName(ModularLoadManagerImpl.class.getName());
config.setClusterName(cluster);
config.setWebServicePort(Optional.of(0));
config.setMetadataStoreUrl("zk:127.0.0.1" + ":" + bkEnsemble.getZookeeperPort());
config.setBrokerShutdownTimeoutMs(0L);
config.setLoadBalancerOverrideBrokerNicSpeedGbps(Optional.of(1.0d));
config.setBrokerServicePort(Optional.of(0));
config.setAdvertisedAddress("localhost");
config.setBookkeeperClientIsolationGroups(brokerBookkeeperClientIsolationGroups);
config.setManagedLedgerDefaultEnsembleSize(2);
config.setManagedLedgerDefaultWriteQuorum(2);
config.setManagedLedgerDefaultAckQuorum(2);
config.setAllowAutoTopicCreationType("non-partitioned");
int totalEntriesPerLedger = 20;
int totalLedgers = totalPublish / totalEntriesPerLedger;
config.setManagedLedgerMaxEntriesPerLedger(totalEntriesPerLedger);
config.setManagedLedgerMinLedgerRolloverTimeMinutes(0);
pulsarService = new PulsarService(config);
pulsarService.start();
PulsarAdmin admin = PulsarAdmin.builder().serviceHttpUrl(pulsarService.getWebServiceAddress()).build();
ClusterData clusterData = ClusterData.builder().serviceUrl(pulsarService.getWebServiceAddress()).build();
admin.clusters().createCluster(cluster, clusterData);
TenantInfoImpl tenantInfo = new TenantInfoImpl(null, Sets.newHashSet(cluster));
admin.tenants().createTenant(tenant1, tenantInfo);
admin.namespaces().createNamespace(ns1);
admin.namespaces().createNamespace(ns2);
admin.namespaces().createNamespace(ns3);
admin.namespaces().createNamespace(ns4);
admin.namespaces().setBookieAffinityGroup(ns2, BookieAffinityGroupData.builder().bookkeeperAffinityGroupPrimary(tenantNamespaceIsolationGroups).build());
admin.namespaces().setBookieAffinityGroup(ns3, BookieAffinityGroupData.builder().bookkeeperAffinityGroupPrimary(tenantNamespaceIsolationGroups).build());
admin.namespaces().setBookieAffinityGroup(ns4, BookieAffinityGroupData.builder().bookkeeperAffinityGroupPrimary(tenantNamespaceIsolationGroups).build());
assertEquals(admin.namespaces().getBookieAffinityGroup(ns2), BookieAffinityGroupData.builder().bookkeeperAffinityGroupPrimary(tenantNamespaceIsolationGroups).build());
assertEquals(admin.namespaces().getBookieAffinityGroup(ns3), BookieAffinityGroupData.builder().bookkeeperAffinityGroupPrimary(tenantNamespaceIsolationGroups).build());
assertEquals(admin.namespaces().getBookieAffinityGroup(ns4), BookieAffinityGroupData.builder().bookkeeperAffinityGroupPrimary(tenantNamespaceIsolationGroups).build());
try {
admin.namespaces().getBookieAffinityGroup(ns1);
fail("ns1 should have no bookie affinity group set");
} catch (PulsarAdminException.NotFoundException e) {
// Ok
}
@Cleanup PulsarClient pulsarClient = PulsarClient.builder().serviceUrl(pulsarService.getBrokerServiceUrl()).statsInterval(-1, TimeUnit.SECONDS).build();
PersistentTopic topic1 = (PersistentTopic) createTopicAndPublish(pulsarClient, ns1, "topic1", totalPublish);
PersistentTopic topic2 = (PersistentTopic) createTopicAndPublish(pulsarClient, ns2, "topic1", totalPublish);
PersistentTopic topic3 = (PersistentTopic) createTopicAndPublish(pulsarClient, ns3, "topic1", totalPublish);
PersistentTopic topic4 = (PersistentTopic) createTopicAndPublish(pulsarClient, ns4, "topic1", totalPublish);
BookieImpl bookie1 = (BookieImpl) bookies[0].getBookie();
LedgerManager ledgerManager = getLedgerManager(bookie1);
// namespace: ns1
ManagedLedgerImpl ml = (ManagedLedgerImpl) topic1.getManagedLedger();
assertEquals(ml.getLedgersInfoAsList().size(), totalLedgers);
// validate ledgers' ensemble with affinity bookies
assertAffinityBookies(ledgerManager, ml.getLedgersInfoAsList(), defaultBookies);
// namespace: ns2
ml = (ManagedLedgerImpl) topic2.getManagedLedger();
assertEquals(ml.getLedgersInfoAsList().size(), totalLedgers);
// validate ledgers' ensemble with affinity bookies
assertAffinityBookies(ledgerManager, ml.getLedgersInfoAsList(), isolatedBookies);
// namespace: ns3
ml = (ManagedLedgerImpl) topic3.getManagedLedger();
assertEquals(ml.getLedgersInfoAsList().size(), totalLedgers);
// validate ledgers' ensemble with affinity bookies
assertAffinityBookies(ledgerManager, ml.getLedgersInfoAsList(), isolatedBookies);
// namespace: ns4
ml = (ManagedLedgerImpl) topic4.getManagedLedger();
assertEquals(ml.getLedgersInfoAsList().size(), totalLedgers);
// validate ledgers' ensemble with affinity bookies
assertAffinityBookies(ledgerManager, ml.getLedgersInfoAsList(), isolatedBookies);
ManagedLedgerClientFactory mlFactory = (ManagedLedgerClientFactory) pulsarService.getManagedLedgerClientFactory();
Map<EnsemblePlacementPolicyConfig, BookKeeper> bkPlacementPolicyToBkClientMap = mlFactory.getBkEnsemblePolicyToBookKeeperMap();
// broker should create only 1 bk-client and factory per isolation-group
assertEquals(bkPlacementPolicyToBkClientMap.size(), 1);
// make sure bk-isolation group also configure REPP_DNS_RESOLVER_CLASS as ZkBookieRackAffinityMapping to
// configure rack-aware policy with in isolated group
Map<EnsemblePlacementPolicyConfig, BookKeeper> bkMap = mlFactory.getBkEnsemblePolicyToBookKeeperMap();
BookKeeper bk = bkMap.values().iterator().next();
Method getConf = BookKeeper.class.getDeclaredMethod("getConf");
getConf.setAccessible(true);
ClientConfiguration clientConf = (ClientConfiguration) getConf.invoke(bk);
assertEquals(clientConf.getProperty(REPP_DNS_RESOLVER_CLASS), BookieRackAffinityMapping.class.getName());
}
use of org.apache.bookkeeper.bookie.BookieImpl in project pulsar by yahoo.
the class BrokerBookieIsolationTest method testStrictBookieIsolation.
/**
* Validate that broker can support tenant based strict bookie isolation.
*
* <pre>
* 1. create one bookie-info group : isolated-group
* 2. namespace ns1 : has none group
* validate: bookie-ensemble for ns1-topics's ledger will be from bookies don't belongs to any group
* if bookies don't belongs to any group are not enough, then, throw #BKNotEnoughBookiesException
* 3. namespace ns2,ns3,ns4: uses isolated-group
* validate: bookie-ensemble for above namespace-topics's ledger will try to select from isolated-group firstly
* if bookies belongs to isolated-group are not enough
* then, bookies from secondary isolation group will be selected (if secondary isolation group set)
* if bookies still are not enough, then, bookies don't belongs to any group will be selected.
* </pre>
*
* @throws Exception
*/
@Test
public void testStrictBookieIsolation() throws Exception {
final String tenant1 = "tenant1";
final String cluster = "use";
final String ns1 = String.format("%s/%s/%s", tenant1, cluster, "ns1");
final String ns2 = String.format("%s/%s/%s", tenant1, cluster, "ns2");
final String ns3 = String.format("%s/%s/%s", tenant1, cluster, "ns3");
final String ns4 = String.format("%s/%s/%s", tenant1, cluster, "ns4");
final int totalPublish = 100;
final String brokerBookkeeperClientIsolationGroups = "default-group";
final String tenantNamespaceIsolationGroups = "tenant1-isolation";
BookieServer[] bookies = bkEnsemble.getBookies();
ZooKeeper zkClient = bkEnsemble.getZkClient();
Set<BookieId> defaultBookies = Sets.newHashSet(bookies[0].getBookieId(), bookies[1].getBookieId());
Set<BookieId> isolatedBookies = Sets.newHashSet(bookies[2].getBookieId(), bookies[3].getBookieId());
setDefaultIsolationGroup(tenantNamespaceIsolationGroups, zkClient, isolatedBookies);
ServiceConfiguration config = new ServiceConfiguration();
config.setLoadManagerClassName(ModularLoadManagerImpl.class.getName());
config.setClusterName(cluster);
config.setWebServicePort(Optional.of(0));
config.setZookeeperServers("127.0.0.1" + ":" + bkEnsemble.getZookeeperPort());
config.setBrokerShutdownTimeoutMs(0L);
config.setLoadBalancerOverrideBrokerNicSpeedGbps(Optional.of(1.0d));
config.setBrokerServicePort(Optional.of(0));
config.setAdvertisedAddress("localhost");
config.setStrictBookieAffinityEnabled(true);
config.setTopicLevelPoliciesEnabled(false);
config.setSystemTopicEnabled(false);
config.setBookkeeperClientIsolationGroups(brokerBookkeeperClientIsolationGroups);
config.setManagedLedgerDefaultEnsembleSize(2);
config.setManagedLedgerDefaultWriteQuorum(2);
config.setManagedLedgerDefaultAckQuorum(2);
config.setAllowAutoTopicCreationType("non-partitioned");
int totalEntriesPerLedger = 20;
int totalLedgers = totalPublish / totalEntriesPerLedger;
config.setManagedLedgerMaxEntriesPerLedger(totalEntriesPerLedger);
config.setManagedLedgerMinLedgerRolloverTimeMinutes(0);
pulsarService = new PulsarService(config);
pulsarService.start();
PulsarAdmin admin = PulsarAdmin.builder().serviceHttpUrl(pulsarService.getWebServiceAddress()).build();
ClusterData clusterData = ClusterData.builder().serviceUrl(pulsarService.getWebServiceAddress()).build();
admin.clusters().createCluster(cluster, clusterData);
TenantInfoImpl tenantInfo = new TenantInfoImpl(null, Sets.newHashSet(cluster));
admin.tenants().createTenant(tenant1, tenantInfo);
admin.namespaces().createNamespace(ns1);
admin.namespaces().createNamespace(ns2);
admin.namespaces().createNamespace(ns3);
admin.namespaces().createNamespace(ns4);
admin.namespaces().setBookieAffinityGroup(ns2, BookieAffinityGroupData.builder().bookkeeperAffinityGroupPrimary(tenantNamespaceIsolationGroups).build());
admin.namespaces().setBookieAffinityGroup(ns3, BookieAffinityGroupData.builder().bookkeeperAffinityGroupPrimary(tenantNamespaceIsolationGroups).build());
admin.namespaces().setBookieAffinityGroup(ns4, BookieAffinityGroupData.builder().bookkeeperAffinityGroupPrimary(tenantNamespaceIsolationGroups).build());
assertEquals(admin.namespaces().getBookieAffinityGroup(ns2), BookieAffinityGroupData.builder().bookkeeperAffinityGroupPrimary(tenantNamespaceIsolationGroups).build());
assertEquals(admin.namespaces().getBookieAffinityGroup(ns3), BookieAffinityGroupData.builder().bookkeeperAffinityGroupPrimary(tenantNamespaceIsolationGroups).build());
assertEquals(admin.namespaces().getBookieAffinityGroup(ns4), BookieAffinityGroupData.builder().bookkeeperAffinityGroupPrimary(tenantNamespaceIsolationGroups).build());
try {
admin.namespaces().getBookieAffinityGroup(ns1);
fail("ns1 should have no bookie affinity group set");
} catch (PulsarAdminException.NotFoundException e) {
// Ok
}
@Cleanup PulsarClient pulsarClient = PulsarClient.builder().serviceUrl(pulsarService.getBrokerServiceUrl()).statsInterval(-1, TimeUnit.SECONDS).build();
PersistentTopic topic1 = (PersistentTopic) createTopicAndPublish(pulsarClient, ns1, "topic1", totalPublish);
PersistentTopic topic2 = (PersistentTopic) createTopicAndPublish(pulsarClient, ns2, "topic1", totalPublish);
PersistentTopic topic3 = (PersistentTopic) createTopicAndPublish(pulsarClient, ns3, "topic1", totalPublish);
PersistentTopic topic4 = (PersistentTopic) createTopicAndPublish(pulsarClient, ns4, "topic1", totalPublish);
BookieImpl bookie1 = (BookieImpl) bookies[0].getBookie();
LedgerManager ledgerManager = getLedgerManager(bookie1);
// namespace: ns1
ManagedLedgerImpl ml = (ManagedLedgerImpl) topic1.getManagedLedger();
assertEquals(ml.getLedgersInfoAsList().size(), totalLedgers);
// validate ledgers' ensemble with affinity bookies
assertAffinityBookies(ledgerManager, ml.getLedgersInfoAsList(), defaultBookies);
// namespace: ns2
ml = (ManagedLedgerImpl) topic2.getManagedLedger();
assertEquals(ml.getLedgersInfoAsList().size(), totalLedgers);
// validate ledgers' ensemble with affinity bookies
assertAffinityBookies(ledgerManager, ml.getLedgersInfoAsList(), isolatedBookies);
// namespace: ns3
ml = (ManagedLedgerImpl) topic3.getManagedLedger();
assertEquals(ml.getLedgersInfoAsList().size(), totalLedgers);
// validate ledgers' ensemble with affinity bookies
assertAffinityBookies(ledgerManager, ml.getLedgersInfoAsList(), isolatedBookies);
// namespace: ns4
ml = (ManagedLedgerImpl) topic4.getManagedLedger();
assertEquals(ml.getLedgersInfoAsList().size(), totalLedgers);
// validate ledgers' ensemble with affinity bookies
assertAffinityBookies(ledgerManager, ml.getLedgersInfoAsList(), isolatedBookies);
ManagedLedgerClientFactory mlFactory = (ManagedLedgerClientFactory) pulsarService.getManagedLedgerClientFactory();
Map<EnsemblePlacementPolicyConfig, BookKeeper> bkPlacementPolicyToBkClientMap = mlFactory.getBkEnsemblePolicyToBookKeeperMap();
// broker should create only 1 bk-client and factory per isolation-group
assertEquals(bkPlacementPolicyToBkClientMap.size(), 2);
// make sure bk-isolation group also configure REPP_DNS_RESOLVER_CLASS as ZkBookieRackAffinityMapping to
// configure rack-aware policy with in isolated group
Map<EnsemblePlacementPolicyConfig, BookKeeper> bkMap = mlFactory.getBkEnsemblePolicyToBookKeeperMap();
BookKeeper bk = bkMap.values().iterator().next();
Method getConf = BookKeeper.class.getDeclaredMethod("getConf");
getConf.setAccessible(true);
ClientConfiguration clientConf = (ClientConfiguration) getConf.invoke(bk);
assertEquals(clientConf.getProperty(REPP_DNS_RESOLVER_CLASS), BookieRackAffinityMapping.class.getName());
}
Aggregations