Search in sources :

Example 1 with TestDriver

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();
}
Also used : TestRoot(com.yahoo.config.model.test.TestRoot) TestDriver(com.yahoo.config.model.test.TestDriver)

Example 2 with TestDriver

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));
}
Also used : RankProfilesConfig(com.yahoo.vespa.config.search.RankProfilesConfig) TestRoot(com.yahoo.config.model.test.TestRoot) File(java.io.File) TestDriver(com.yahoo.config.model.test.TestDriver) Test(org.junit.Test)

Example 3 with TestDriver

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);
}
Also used : TestRoot(com.yahoo.config.model.test.TestRoot) TestDriver(com.yahoo.config.model.test.TestDriver) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 4 with TestDriver

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);
}
Also used : TestDriver(com.yahoo.config.model.test.TestDriver) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 5 with TestDriver

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();
}
Also used : Content(com.yahoo.vespa.model.content.Content) SearchBuilder(com.yahoo.searchdefinition.SearchBuilder) ApplicationPackage(com.yahoo.config.application.api.ApplicationPackage) MockApplicationPackage(com.yahoo.config.model.test.MockApplicationPackage) TestDriver(com.yahoo.config.model.test.TestDriver)

Aggregations

TestDriver (com.yahoo.config.model.test.TestDriver)13 Test (org.junit.Test)10 TestRoot (com.yahoo.config.model.test.TestRoot)6 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)3 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)3 MockApplicationPackage (com.yahoo.config.model.test.MockApplicationPackage)3 PartitionsConfig (com.yahoo.vespa.config.search.core.PartitionsConfig)3 SentinelConfig (com.yahoo.cloud.config.SentinelConfig)2 DeployState (com.yahoo.config.model.deploy.DeployState)2 Zone (com.yahoo.config.provision.Zone)2 SearchBuilder (com.yahoo.searchdefinition.SearchBuilder)1 RankProfilesConfig (com.yahoo.vespa.config.search.RankProfilesConfig)1 Content (com.yahoo.vespa.model.content.Content)1 File (java.io.File)1