use of com.yahoo.vdslib.distribution.Group in project vespa by vespa-engine.
the class LeafGroupsTest method singleLeafIsEnumerated.
@Test
public void singleLeafIsEnumerated() throws Exception {
Group g = new Group(0, "donkeykong", dummyDistribution());
Group child = new Group(1, "mario");
g.addSubGroup(child);
List<Group> leaves = LeafGroups.enumerateFrom(g);
assertThat(leaves.size(), is(1));
assertThat(leaves.get(0).getName(), is("mario"));
}
use of com.yahoo.vdslib.distribution.Group in project vespa by vespa-engine.
the class LeafGroupsTest method singleLeafIsEnumeratedInNestedCase.
@Test
public void singleLeafIsEnumeratedInNestedCase() throws Exception {
Group g = new Group(0, "donkeykong", dummyDistribution());
Group child = new Group(1, "mario", dummyDistribution());
child.addSubGroup(new Group(2, "toad"));
g.addSubGroup(child);
List<Group> leaves = LeafGroups.enumerateFrom(g);
assertThat(leaves.size(), is(1));
assertThat(leaves.get(0).getName(), is("toad"));
}
use of com.yahoo.vdslib.distribution.Group in project vespa by vespa-engine.
the class ContentCluster method getLeaves.
private void getLeaves(Group node, List<Group> leaves, List<String> names, String name) {
if (node.isLeafGroup()) {
leaves.add(node);
names.add(name + "/" + node.getName());
return;
}
for (Group g : node.getSubgroups().values()) {
getLeaves(g, leaves, names, name + (node.getName() != null ? "/" + node.getName() : ""));
}
}
Aggregations