Search in sources :

Example 31 with ApplicationPackage

use of com.yahoo.config.application.api.ApplicationPackage 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));
}
Also used : MockRoot(com.yahoo.config.model.test.MockRoot) ApplicationPackage(com.yahoo.config.application.api.ApplicationPackage) MockApplicationPackage(com.yahoo.config.model.test.MockApplicationPackage)

Example 32 with ApplicationPackage

use of com.yahoo.config.application.api.ApplicationPackage in project vespa by vespa-engine.

the class GenericServicesTest method getModel.

@BeforeClass
public static void getModel() throws IOException, SAXException {
    String appDir = "src/test/cfg/application/app_genericservices";
    ApplicationPackage app = FilesApplicationPackage.fromFile(new File(appDir));
    model = new VespaModel(app);
}
Also used : VespaModel(com.yahoo.vespa.model.VespaModel) ApplicationPackage(com.yahoo.config.application.api.ApplicationPackage) FilesApplicationPackage(com.yahoo.config.model.application.provider.FilesApplicationPackage) File(java.io.File) BeforeClass(org.junit.BeforeClass)

Example 33 with ApplicationPackage

use of com.yahoo.config.application.api.ApplicationPackage 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)

Example 34 with ApplicationPackage

use of com.yahoo.config.application.api.ApplicationPackage in project vespa by vespa-engine.

the class VespaModelTestCase method testNoMultitenantHostExported.

@Test
public void testNoMultitenantHostExported() throws IOException, SAXException {
    ApplicationPackage applicationPackage = new MockApplicationPackage.Builder().withServices("<services version='1.0'><admin version='3.0'><nodes count='1' /></admin></services>").build();
    DeployState deployState = new DeployState.Builder().applicationPackage(applicationPackage).modelHostProvisioner(new InMemoryProvisioner(true, "host1.yahoo.com")).properties(new DeployProperties.Builder().configServerSpecs(Arrays.asList(new Configserver.Spec("cfghost", 1234, 1235, 1236))).multitenant(true).build()).build(true);
    VespaModel model = new VespaModel(new NullConfigModelRegistry(), deployState);
    AllocatedHosts info = model.allocatedHosts();
    assertEquals("Admin version 3 is ignored, and there are no other hosts to borrow for admin services", 0, info.getHosts().size());
}
Also used : AllocatedHosts(com.yahoo.config.provision.AllocatedHosts) NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) DeployState(com.yahoo.config.model.deploy.DeployState) InMemoryProvisioner(com.yahoo.config.model.provision.InMemoryProvisioner) DeployProperties(com.yahoo.config.model.deploy.DeployProperties) VespaModel(com.yahoo.vespa.model.VespaModel) FilesApplicationPackage(com.yahoo.config.model.application.provider.FilesApplicationPackage) ApplicationPackage(com.yahoo.config.application.api.ApplicationPackage) MockApplicationPackage(com.yahoo.config.model.test.MockApplicationPackage) Test(org.junit.Test)

Example 35 with ApplicationPackage

use of com.yahoo.config.application.api.ApplicationPackage in project vespa by vespa-engine.

the class VespaModelTestCase method testPermanentServices.

@Test
public void testPermanentServices() throws IOException, SAXException {
    ApplicationPackage app = MockApplicationPackage.createEmpty();
    DeployState.Builder builder = new DeployState.Builder().applicationPackage(app);
    VespaModel model = new VespaModel(new NullConfigModelRegistry(), builder.build(true));
    assertThat(model.getContainerClusters().size(), is(0));
    model = new VespaModel(new NullConfigModelRegistry(), builder.permanentApplicationPackage(Optional.of(FilesApplicationPackage.fromFile(new File(TESTDIR, "app_permanent")))).build(true));
    assertThat(model.getContainerClusters().size(), is(1));
}
Also used : NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) DeployState(com.yahoo.config.model.deploy.DeployState) VespaModel(com.yahoo.vespa.model.VespaModel) FilesApplicationPackage(com.yahoo.config.model.application.provider.FilesApplicationPackage) ApplicationPackage(com.yahoo.config.application.api.ApplicationPackage) MockApplicationPackage(com.yahoo.config.model.test.MockApplicationPackage) File(java.io.File) Test(org.junit.Test)

Aggregations

ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)39 MockApplicationPackage (com.yahoo.config.model.test.MockApplicationPackage)25 Test (org.junit.Test)21 VespaModel (com.yahoo.vespa.model.VespaModel)14 FilesApplicationPackage (com.yahoo.config.model.application.provider.FilesApplicationPackage)13 DeployState (com.yahoo.config.model.deploy.DeployState)12 File (java.io.File)11 NullConfigModelRegistry (com.yahoo.config.model.NullConfigModelRegistry)10 DeployProperties (com.yahoo.config.model.deploy.DeployProperties)8 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)7 InMemoryProvisioner (com.yahoo.config.model.provision.InMemoryProvisioner)6 Matchers.containsString (org.hamcrest.Matchers.containsString)5 VespaModelCreatorWithMockPkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg)4 TestDriver (com.yahoo.config.model.test.TestDriver)3 Path (com.yahoo.path.Path)3 DeployLogger (com.yahoo.config.application.api.DeployLogger)2 MockRoot (com.yahoo.config.model.test.MockRoot)2 Zone (com.yahoo.config.provision.Zone)2 ConfigDefinition (com.yahoo.vespa.config.ConfigDefinition)2 ConfigDefinitionKey (com.yahoo.vespa.config.ConfigDefinitionKey)2