Search in sources :

Example 6 with Group

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"));
}
Also used : Group(com.yahoo.vdslib.distribution.Group) Test(org.junit.Test)

Example 7 with Group

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"));
}
Also used : Group(com.yahoo.vdslib.distribution.Group) Test(org.junit.Test)

Example 8 with Group

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() : ""));
    }
}
Also used : Group(com.yahoo.vdslib.distribution.Group)

Aggregations

Group (com.yahoo.vdslib.distribution.Group)8 Test (org.junit.Test)4 ConfiguredNode (com.yahoo.vdslib.distribution.ConfiguredNode)2 Distribution (com.yahoo.vdslib.distribution.Distribution)2 NodeState (com.yahoo.vdslib.state.NodeState)1 VdsClusterHtmlRendrer (com.yahoo.vespa.clustercontroller.core.status.statuspage.VdsClusterHtmlRendrer)1 HashSet (java.util.HashSet)1 StringContains.containsString (org.hamcrest.core.StringContains.containsString)1