use of com.yahoo.config.model.test.TestDriver in project vespa by vespa-engine.
the class ClusterTest method parse.
ContentCluster parse(String xml) {
xml = HOSTS + xml;
TestRoot root = new TestDriver().buildModel(xml);
return root.getConfigModels(Content.class).get(0).getCluster();
}
use of com.yahoo.config.model.test.TestDriver in project vespa by vespa-engine.
the class RankProfileRegistryTest method testRankProfileInheritance.
@Test
public void testRankProfileInheritance() {
TestRoot root = new TestDriver().buildModel(FilesApplicationPackage.fromFile(new File(TESTDIR)));
RankProfilesConfig left = root.getConfig(RankProfilesConfig.class, "inherit/search/cluster.inherit/left");
RankProfilesConfig right = root.getConfig(RankProfilesConfig.class, "inherit/search/cluster.inherit/right");
assertThat(left.rankprofile().size(), is(3));
assertThat(right.rankprofile().size(), is(2));
}
use of com.yahoo.config.model.test.TestDriver in project vespa by vespa-engine.
the class ClusterControllerTestCase method testStandaloneZooKeeper.
@Test
public void testStandaloneZooKeeper() throws Exception {
String xml = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" + "<services>\n" + "\n" + " <admin version=\"2.0\">\n" + " <adminserver hostalias=\"node1\" />\n" + " <cluster-controllers standalone-zookeeper=\"true\">\n" + " <cluster-controller hostalias=\"node2\"/>" + " <cluster-controller hostalias=\"node3\"/>" + " <cluster-controller hostalias=\"node4\"/>" + " </cluster-controllers>\n" + " </admin>\n" + " <content version='1.0' id='bar'>" + " <redundancy>1</redundancy>\n" + " <documents>" + " </documents>\n" + " <group>" + " <node hostalias='node1' distribution-key='0' />" + " </group>" + " </content>" + "\n" + "</services>";
String hosts = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" + "<hosts>\n" + " <host name=\"localhost\">\n" + " <alias>node1</alias>\n" + " </host>\n" + " <host name=\"my.host1.com\">\n" + " <alias>node2</alias>\n" + " </host>\n" + " <host name=\"my.host2.com\">\n" + " <alias>node3</alias>\n" + " </host>\n" + " <host name=\"my.host3.com\">\n" + " <alias>node4</alias>\n" + " </host>\n" + "</hosts>";
TestDriver driver = new TestDriver();
TestRoot root = driver.buildModel(xml, hosts);
assertZookeepersConfig(root);
assertZookeeperServerConfig(root, 0);
assertZookeeperServerConfig(root, 1);
assertZookeeperServerConfig(root, 2);
}
use of com.yahoo.config.model.test.TestDriver in project vespa by vespa-engine.
the class ClusterControllerTestCase method testSeparateHostsFromConfigServerRequired.
@Test(expected = IllegalArgumentException.class)
public void testSeparateHostsFromConfigServerRequired() throws Exception {
String xml = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" + "<services>\n" + "\n" + " <admin version=\"2.0\">\n" + " <adminserver hostalias=\"mockhost\" />\n" + " <configservers>\n" + " <configserver hostalias=\"mockhost\" />" + " </configservers>" + " <cluster-controllers standalone-zookeeper=\"true\">\n" + " <cluster-controller hostalias=\"mockhost\"/>" + " </cluster-controllers>\n" + " </admin>\n" + " <content version='1.0' id='bar'>" + " <redundancy>1</redundancy>\n" + " <documents>" + " </documents>\n" + " <group>" + " <node hostalias='mockhost' distribution-key='0' />" + " </group>" + " </content>" + "\n" + "</services>";
TestDriver driver = new TestDriver();
driver.buildModel(xml);
}
use of com.yahoo.config.model.test.TestDriver in project vespa by vespa-engine.
the class ClusterTest method newContentCluster.
private static ContentCluster newContentCluster(String contentSearchXml, boolean globalDocType) throws ParseException {
ApplicationPackage app = new MockApplicationPackage.Builder().withHosts(joinLines("<hosts>", " <host name='localhost'><alias>my_host</alias></host>", "</hosts>")).withServices(joinLines("<services version='1.0'>", " <admin version='2.0'>", " <adminserver hostalias='my_host' />", " </admin>", " <content version='1.0'>", " <documents>", " " + getDocumentXml(globalDocType), " </documents>", " <engine><proton /></engine>", " <group>", " <node hostalias='my_host' distribution-key='0' />", " </group>", contentSearchXml, " </content>", "</services>")).withSearchDefinitions(ApplicationPackageUtils.generateSearchDefinition("my_document")).build();
List<Content> contents = new TestDriver().buildModel(app).getConfigModels(Content.class);
assertEquals(1, contents.size());
return contents.get(0).getCluster();
}
Aggregations