Search in sources :

Example 1 with StorageNode

use of com.yahoo.vespa.model.content.StorageNode in project vespa by vespa-engine.

the class ModelProvisioningTest method testNodeCountForContentGroup.

@Test
public void testNodeCountForContentGroup() {
    String xmlWithNodes = "<?xml version='1.0' encoding='utf-8' ?>" + "<services>" + "\n" + "  <admin version='3.0'>" + "    <nodes count='3'/>" + "  </admin>" + "  <content version='1.0' id='bar'>" + "     <redundancy>2</redundancy>" + "     <documents>" + "       <document type='type1' mode='index'/>" + "     </documents>" + "     <nodes count='2'/>" + "   </content>" + "</services>";
    VespaModelTester tester = new VespaModelTester();
    int numberOfHosts = 2;
    tester.addHosts(numberOfHosts);
    int numberOfContentNodes = 2;
    VespaModel model = tester.createModel(xmlWithNodes, true);
    assertThat(model.getRoot().getHostSystem().getHosts().size(), is(numberOfHosts));
    final Map<String, ContentCluster> contentClusters = model.getContentClusters();
    ContentCluster cluster = contentClusters.get("bar");
    assertThat(cluster.getRootGroup().getNodes().size(), is(numberOfContentNodes));
    int i = 0;
    for (StorageNode node : cluster.getRootGroup().getNodes()) assertEquals(i++, node.getDistributionKey());
}
Also used : VespaModelTester(com.yahoo.vespa.model.test.VespaModelTester) VespaModel(com.yahoo.vespa.model.VespaModel) StorageNode(com.yahoo.vespa.model.content.StorageNode) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Aggregations

VespaModel (com.yahoo.vespa.model.VespaModel)1 StorageNode (com.yahoo.vespa.model.content.StorageNode)1 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)1 VespaModelTester (com.yahoo.vespa.model.test.VespaModelTester)1 Test (org.junit.Test)1