本文整理汇总了Java中org.apache.helix.HelixAdmin.getConfig方法的典型用法代码示例。如果您正苦于以下问题:Java HelixAdmin.getConfig方法的具体用法?Java HelixAdmin.getConfig怎么用?Java HelixAdmin.getConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.helix.HelixAdmin
的用法示例。
在下文中一共展示了HelixAdmin.getConfig方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testAdministrator
import org.apache.helix.HelixAdmin; //导入方法依赖的package包/类
@Test()
public void testAdministrator() throws Exception {
System.out.println("START " + className + ".testAdministrator() at "
+ new Date(System.currentTimeMillis()));
final String clusterName = CLUSTER_PREFIX + "_" + className + "_admin";
// basic test
if (_gZkClient.exists("/" + clusterName)) {
_gZkClient.deleteRecursive("/" + clusterName);
}
ZKHelixManager admin =
new ZKHelixManager(clusterName, null, InstanceType.ADMINISTRATOR, ZK_ADDR);
TestHelper.setupEmptyCluster(_gZkClient, clusterName);
admin.connect();
AssertJUnit.assertTrue(admin.isConnected());
HelixAdmin adminTool = admin.getClusterManagmentTool();
HelixConfigScope scope =
new HelixConfigScopeBuilder(ConfigScopeProperty.PARTITION).forCluster(clusterName)
.forResource("testResource").forPartition("testPartition").build();
Map<String, String> properties = new HashMap<String, String>();
properties.put("pKey1", "pValue1");
properties.put("pKey2", "pValue2");
adminTool.setConfig(scope, properties);
properties = adminTool.getConfig(scope, Arrays.asList("pKey1", "pKey2"));
Assert.assertEquals(properties.size(), 2);
Assert.assertEquals(properties.get("pKey1"), "pValue1");
Assert.assertEquals(properties.get("pKey2"), "pValue2");
admin.disconnect();
AssertJUnit.assertFalse(admin.isConnected());
System.out.println("END " + className + ".testAdministrator() at "
+ new Date(System.currentTimeMillis()));
}
示例2: getInstanceConfigsMapFor
import org.apache.helix.HelixAdmin; //导入方法依赖的package包/类
public static Map<String, String> getInstanceConfigsMapFor(String instanceName, String clusterName, HelixAdmin admin) {
final HelixConfigScope scope = getInstanceScopefor(clusterName, instanceName);
final List<String> keys = admin.getConfigKeys(scope);
return admin.getConfig(scope, keys);
}
示例3: getResourceConfigsFor
import org.apache.helix.HelixAdmin; //导入方法依赖的package包/类
public static Map<String, String> getResourceConfigsFor(String clusterName, String resourceName, HelixAdmin admin) {
final HelixConfigScope scope = getResourceScopeFor(clusterName, resourceName);
final List<String> keys = admin.getConfigKeys(scope);
return admin.getConfig(scope, keys);
}