public void getConfig(StorDistributionConfig.Group.Builder builder) {
        builder.index(index == null ? "invalid" : index);
        builder.name(name == null ? "invalid" : name);
        partitions.ifPresent(builder::partitions);
        for (StorageNode node : nodes) {
            StorDistributionConfig.Group.Nodes.Builder nb = new StorDistributionConfig.Group.Nodes.Builder();
            nb.index(node.getDistributionKey());
            nb.retired(node.isRetired());
            builder.nodes.add(nb);
        }
        builder.capacity(getCapacity());
    }
@Test
    void testSingleGroup() {
        ContentCluster cluster = parse(
                "<content id=\"storage\">\n" +
                        "  <redundancy>3</redundancy>" +
                        "  <documents/>" +
                        "  <group>\n" +
                        "    <node hostalias=\"mockhost\" distribution-key=\"0\"/>\n" +
                        "    <node hostalias=\"mockhost\" distribution-key=\"1\"/>\n" +
                        "  </group>\n" +
                        "</content>"
        );

        assertEquals("content", cluster.getStorageCluster().getChildren().get("0").getServicePropertyString("clustertype"));
        assertEquals("storage", cluster.getStorageCluster().getChildren().get("0").getServicePropertyString("clustername"));
        assertEquals("0", cluster.getStorageCluster().getChildren().get("0").getServicePropertyString("index"));

        assertEquals("content", cluster.getDistributorNodes().getChildren().get("0").getServicePropertyString("clustertype"));
        assertEquals("storage", cluster.getDistributorNodes().getChildren().get("0").getServicePropertyString("clustername"));
        assertEquals("0", cluster.getDistributorNodes().getChildren().get("0").getServicePropertyString("index"));

        StorDistributionConfig.Builder builder = new StorDistributionConfig.Builder();
        cluster.getConfig(builder);
        StorDistributionConfig config = new StorDistributionConfig(builder);

        assertEquals(1, config.group().size());
        assertEquals("invalid", config.group(0).index());
        assertEquals("invalid", config.group(0).name());
        assertEquals(2, config.group(0).nodes().size());
        assertEquals(0, config.group(0).nodes(0).index());
        assertEquals(1, config.group(0).nodes(1).index());
        //assertNotNull(cluster.getRootGroup().getNodes().get(0).getHost());

        DistributionConfig.Builder distributionBuilder = new DistributionConfig.Builder();
        cluster.getConfig(distributionBuilder);
        DistributionConfig.Cluster clusterConfig = distributionBuilder.build().cluster("storage");

        assertEquals(1, clusterConfig.group().size());
        assertEquals("invalid", clusterConfig.group(0).index());
        assertEquals("invalid", clusterConfig.group(0).name());
        assertEquals(2, clusterConfig.group(0).nodes().size());
        assertEquals(0, clusterConfig.group(0).nodes(0).index());
        assertEquals(1, clusterConfig.group(0).nodes(1).index());
    }