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());
}
Aggregations