use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.
the class StorageClusterTest method requireThatNestedGroupsRequireDistribution.
@Test
public void requireThatNestedGroupsRequireDistribution() throws Exception {
String xml = "<cluster id=\"storage\">\n" + "<documents/>\n" + " <group>\n" + " <group distribution-key=\"0\" name=\"bar\">\n" + " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + " </group>\n" + " <group distribution-key=\"0\" name=\"baz\">\n" + " <node distribution-key=\"1\" hostalias=\"mockhost\"/>\n" + " </group>\n" + " </group>\n" + "</cluster>";
try {
ContentClusterUtils.createCluster(xml, new MockRoot());
fail("Did not get exception with missing distribution element");
} catch (RuntimeException e) {
assertEquals("'distribution' attribute is required with multiple subgroups", e.getMessage());
}
}
use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.
the class ContentClusterUtils method createCluster.
public static ContentCluster createCluster(String clusterXml, List<String> searchDefinitions) throws Exception {
MockRoot root = createMockRoot(searchDefinitions);
ContentCluster cluster = createCluster(clusterXml, root);
root.freezeModelTopology();
cluster.validate();
return cluster;
}
use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.
the class ContentClusterUtils method createMockRoot.
private static MockRoot createMockRoot(HostProvisioner provisioner, List<String> searchDefinitions, DeployState.Builder deployStateBuilder) {
ApplicationPackage applicationPackage = new MockApplicationPackage.Builder().withSearchDefinitions(searchDefinitions).build();
deployStateBuilder.applicationPackage(applicationPackage).modelHostProvisioner(provisioner).build(true);
return new MockRoot("", deployStateBuilder.build(true));
}
use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.
the class GenericServicesModelTest method test_generic_services_model.
@Test
public void test_generic_services_model() {
MockRoot root = new MockRoot();
GenericServicesModel model = new GenericServicesModel(ConfigModelContext.create(null, root, "foo"));
assertThat(model.serviceClusters().size(), is(0));
model.addCluster(new ServiceCluster(root, "mycluster", "/bin/foo"));
assertThat(model.serviceClusters().size(), is(1));
assertThat(model.serviceClusters().get(0).getName(), is("mycluster"));
}
use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.
the class MultilevelDispatchTest method createSearchNodes.
private List<SearchNode> createSearchNodes(int numNodes) {
List<SearchNode> searchNodes = new ArrayList<>();
MockRoot root = new MockRoot("");
for (int i = 0; i < numNodes; ++i) {
searchNodes.add(SearchNode.create(root, "mynode" + i, i, new NodeSpec(0, i), "mycluster", null, false, Optional.empty()));
}
return searchNodes;
}
Aggregations