use of com.yahoo.config.model.test.TestRoot 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.TestRoot 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.TestRoot 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.TestRoot in project vespa by vespa-engine.
the class MultilevelDispatchTest method requireThatSearchCoverageIsSetInSingleLevelSetup.
@Test
public void requireThatSearchCoverageIsSetInSingleLevelSetup() throws Exception {
TestRoot root = new TestDriver(true).buildModel(new MockApplicationPackage.Builder().withServices("<services version='1.0'>" + "<content id='stateful' version='1.0'>" + " <redundancy>1</redundancy>" + " <documents><document mode='index' type='music' /></documents>" + " <nodes>" + " <node distribution-key='1' hostalias='mockroot' />" + " </nodes>" + " <search><coverage><minimum>0.95</minimum></coverage></search>" + "</content>" + "<jdisc id='foo' version='1.0'>" + " <search />" + " <nodes><node hostalias='mockroot' /></nodes>" + "</jdisc>" + "</services>").withSearchDefinition(MockApplicationPackage.MUSIC_SEARCHDEFINITION).build());
PartitionsConfig config = root.getConfig(PartitionsConfig.class, "stateful/search/cluster.stateful/tlds/foo.0.tld.0");
assertThat(config.dataset().size(), is(1));
assertEquals(95.0, config.dataset(0).minimal_searchcoverage(), 0.1);
}
use of com.yahoo.config.model.test.TestRoot in project vespa by vespa-engine.
the class AdminTestCase method testDisableFileDistributorForAllApps.
@Test
public void testDisableFileDistributorForAllApps() {
DeployState state = new DeployState.Builder().zone(new Zone(Environment.dev, RegionName.from("baz"))).properties(new DeployProperties.Builder().applicationId(new ApplicationId.Builder().tenant("quux").applicationName("foo").instanceName("bim").build()).build()).build(true);
TestRoot root = new TestDriver().buildModel(state);
String localhost = HostName.getLocalhost();
SentinelConfig sentinelConfig = root.getConfig(SentinelConfig.class, "hosts/" + localhost);
assertThat(sentinelConfig.service().size(), is(3));
assertThat(sentinelConfig.service(0).name(), is("logserver"));
assertThat(sentinelConfig.service(1).name(), is("slobrok"));
assertThat(sentinelConfig.service(2).name(), is("logd"));
}
Aggregations