{
TestHelper.setupCluster(_clusterName, ZK_ADDR, 12918, "localhost", "TestDB", 1, 10, 5, 3,
"MasterSlave", true);
ConfigAccessor appConfig = new ConfigAccessor(_gZkClient);
ConfigScope clusterScope = new ConfigScopeBuilder().forCluster(_clusterName).build();
// cluster scope config
String clusterConfigValue = appConfig.get(clusterScope, "clusterConfigKey");
Assert.assertNull(clusterConfigValue);
appConfig.set(clusterScope, "clusterConfigKey", "clusterConfigValue");
clusterConfigValue = appConfig.get(clusterScope, "clusterConfigKey");
Assert.assertEquals(clusterConfigValue, "clusterConfigValue");
// resource scope config
ConfigScope resourceScope = new ConfigScopeBuilder().forCluster(_clusterName)
.forResource("testResource").build();
appConfig.set(resourceScope, "resourceConfigKey", "resourceConfigValue");
String resourceConfigValue = appConfig.get(resourceScope, "resourceConfigKey");
Assert.assertEquals(resourceConfigValue, "resourceConfigValue");
// partition scope config
ConfigScope partitionScope = new ConfigScopeBuilder().forCluster(_clusterName)
.forResource("testResource").forPartition("testPartition").build();
appConfig.set(partitionScope, "partitionConfigKey", "partitionConfigValue");
String partitionConfigValue = appConfig.get(partitionScope, "partitionConfigKey");
Assert.assertEquals(partitionConfigValue, "partitionConfigValue");
// participant scope config
ConfigScope participantScope = new ConfigScopeBuilder().forCluster(_clusterName)
.forParticipant("localhost_12918").build();
appConfig.set(participantScope, "participantConfigKey", "participantConfigValue");
String participantConfigValue = appConfig.get(participantScope, "participantConfigKey");
Assert.assertEquals(participantConfigValue, "participantConfigValue");