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));
}
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);
}
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());
}
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());
}
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));
}
Aggregations