Search in sources :

Example 11 with TestDriver

use of com.yahoo.config.model.test.TestDriver in project vespa by vespa-engine.

the class MonitoringConfigSnoopTest method initRoot.

public void initRoot(int interval) throws Exception {
    TestDriver tester = new TestDriver();
    root = tester.buildModel(getAdminXml(interval) + getContent());
}
Also used : TestDriver(com.yahoo.config.model.test.TestDriver)

Example 12 with TestDriver

use of com.yahoo.config.model.test.TestDriver in project vespa by vespa-engine.

the class MonitoringConfigSnoopTest method correct_config_is_snooped_default_interval.

@Test
public void correct_config_is_snooped_default_interval() throws Exception {
    String getAdminXmlIntervalNotSpecified = "<admin version='2.0'>" + "  <adminserver hostalias='mockhost' />" + "</admin>";
    TestDriver tester = new TestDriver();
    root = tester.buildModel(getAdminXmlIntervalNotSpecified + getContent());
    assertThat(getConfig().snapshot().periods().size(), is(2));
    assertThat(getConfig().snapshot().periods(0), is(60));
    assertThat(getConfig().snapshot().periods(1), is(300));
}
Also used : TestDriver(com.yahoo.config.model.test.TestDriver) Test(org.junit.Test)

Example 13 with TestDriver

use of com.yahoo.config.model.test.TestDriver in project vespa by vespa-engine.

the class TldTest method requireThatServicesIsParsed.

@Test
public void requireThatServicesIsParsed() {
    ApplicationPackage app = new MockApplicationPackage.Builder().withHosts("<hosts><host name='localhost'><alias>mockhost</alias></host><host name='my.other.host'><alias>mockhost2</alias></host></hosts>").withServices("<services>" + "  <admin version='2.0'>" + "    <adminserver hostalias='mockhost' />" + "  </admin>" + "  <jdisc version='1.0' id='default'>" + "    <search />" + "    <nodes>" + "      <node hostalias='mockhost'/>" + "    </nodes>" + "  </jdisc>" + "  <content version='1.0' id='foo'>" + "    <redundancy>1</redundancy>" + "    <documents>" + "      <document type='music' mode='index'/>" + "    </documents>" + "    <group>" + "      <node hostalias='mockhost' distribution-key='0'/>" + "      <node hostalias='mockhost2' distribution-key='1'/>" + "    </group>" + "    <tuning>" + "      <dispatch>" + "        <max-hits-per-partition>69</max-hits-per-partition>" + "        <use-local-node>true</use-local-node>" + "      </dispatch>" + "    </tuning>" + "  </content>" + "</services>").withSearchDefinition(MockApplicationPackage.MUSIC_SEARCHDEFINITION).build();
    PartitionsConfig.Builder builder = new PartitionsConfig.Builder();
    new TestDriver(true).buildModel(app).getConfig(builder, "foo/search/cluster.foo/tlds/default.0.tld.0");
    PartitionsConfig config = new PartitionsConfig(builder);
    assertEquals(1, config.dataset().size());
    assertEquals(69, config.dataset(0).maxhitspernode());
    assertEquals(1, config.dataset(0).engine().size());
}
Also used : PartitionsConfig(com.yahoo.vespa.config.search.core.PartitionsConfig) ApplicationPackage(com.yahoo.config.application.api.ApplicationPackage) MockApplicationPackage(com.yahoo.config.model.test.MockApplicationPackage) TestDriver(com.yahoo.config.model.test.TestDriver) Test(org.junit.Test)

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