本文整理汇总了Java中org.apache.hadoop.registry.client.binding.RegistryUtils.statChildren方法的典型用法代码示例。如果您正苦于以下问题:Java RegistryUtils.statChildren方法的具体用法?Java RegistryUtils.statChildren怎么用?Java RegistryUtils.statChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.registry.client.binding.RegistryUtils
的用法示例。
在下文中一共展示了RegistryUtils.statChildren方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testLsParent
import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入方法依赖的package包/类
@Test
public void testLsParent() throws Throwable {
ServiceRecord written = putExampleServiceEntry(ENTRY_PATH, 0);
RegistryPathStatus stat = operations.stat(ENTRY_PATH);
List<String> children = operations.list(PARENT_PATH);
assertEquals(1, children.size());
assertEquals(NAME, children.get(0));
Map<String, RegistryPathStatus> childStats =
RegistryUtils.statChildren(operations, PARENT_PATH);
assertEquals(1, childStats.size());
assertEquals(stat, childStats.get(NAME));
Map<String, ServiceRecord> records =
RegistryUtils.extractServiceRecords(operations,
PARENT_PATH,
childStats.values());
assertEquals(1, records.size());
ServiceRecord record = records.get(ENTRY_PATH);
RegistryTypeUtils.validateServiceRecord(ENTRY_PATH, record);
assertMatches(written, record);
}
示例2: testListListFully
import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入方法依赖的package包/类
@Test
public void testListListFully() throws Throwable {
ServiceRecord r1 = new ServiceRecord();
ServiceRecord r2 = createRecord("i",
PersistencePolicies.PERMANENT, "r2");
String path = USERPATH + SC_HADOOP + "/listing" ;
operations.mknode(path, true);
String r1path = path + "/r1";
operations.bind(r1path, r1, 0);
String r2path = path + "/r2";
operations.bind(r2path, r2, 0);
RegistryPathStatus r1stat = operations.stat(r1path);
assertEquals("r1", r1stat.path);
RegistryPathStatus r2stat = operations.stat(r2path);
assertEquals("r2", r2stat.path);
assertNotEquals(r1stat, r2stat);
// listings now
List<String> list = operations.list(path);
assertEquals("Wrong no. of children", 2, list.size());
// there's no order here, so create one
Map<String, String> names = new HashMap<String, String>();
String entries = "";
for (String child : list) {
names.put(child, child);
entries += child + " ";
}
assertTrue("No 'r1' in " + entries,
names.containsKey("r1"));
assertTrue("No 'r2' in " + entries,
names.containsKey("r2"));
Map<String, RegistryPathStatus> stats =
RegistryUtils.statChildren(operations, path);
assertEquals("Wrong no. of children", 2, stats.size());
assertEquals(r1stat, stats.get("r1"));
assertEquals(r2stat, stats.get("r2"));
}