use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class TenantRequestHandlerTest method testListConfigs.
@Test
public void testListConfigs() throws IOException, SAXException {
assertdefaultAppNotFound();
/*assertTrue(server.allConfigIds(ApplicationId.defaultId()).isEmpty());
assertTrue(server.allConfigsProduced(ApplicationId.defaultId()).isEmpty());
assertTrue(server.listConfigs(ApplicationId.defaultId(), false).isEmpty());
assertTrue(server.listConfigs(ApplicationId.defaultId(), true).isEmpty());*/
VespaModel model = new VespaModel(FilesApplicationPackage.fromFile(new File("src/test/apps/app")));
server.reloadConfig(ApplicationSet.fromSingle(new Application(model, new ServerCache(), 1, vespaVersion, MetricUpdater.createTestUpdater(), ApplicationId.defaultId())));
Set<ConfigKey<?>> configNames = server.listConfigs(ApplicationId.defaultId(), Optional.of(vespaVersion), false);
assertTrue(configNames.contains(new ConfigKey<>("sentinel", "hosts", "cloud.config")));
// for (ConfigKey<?> ck : configNames) {
// assertTrue(!"".equals(ck.getConfigId()));
// }
configNames = server.listConfigs(ApplicationId.defaultId(), Optional.of(vespaVersion), true);
System.out.println(configNames);
assertTrue(configNames.contains(new ConfigKey<>("feeder", "jdisc", "vespaclient.config")));
assertTrue(configNames.contains(new ConfigKey<>("documentmanager", "jdisc", "document.config")));
assertTrue(configNames.contains(new ConfigKey<>("documentmanager", "", "document.config")));
assertTrue(configNames.contains(new ConfigKey<>("documenttypes", "", "document")));
assertTrue(configNames.contains(new ConfigKey<>("documentmanager", "jdisc", "document.config")));
assertTrue(configNames.contains(new ConfigKey<>("health-monitor", "jdisc", "container.jdisc.config")));
assertTrue(configNames.contains(new ConfigKey<>("specific", "jdisc", "project")));
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class TenantsTestCase method testListenersAdded.
@Test
public void testListenersAdded() throws IOException, SAXException {
tenants.getTenant(tenant1).getReloadHandler().reloadConfig(ApplicationSet.fromSingle(new Application(new VespaModel(MockApplicationPackage.createEmpty()), new ServerCache(), 4l, Version.fromIntValues(1, 2, 3), MetricUpdater.createTestUpdater(), ApplicationId.defaultId())));
assertThat(listener.reloaded.get(), is(1));
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class StaticProvisionerTest method sameHostsAreProvisioned.
@Test
public void sameHostsAreProvisioned() throws IOException, SAXException {
ApplicationPackage app = FilesApplicationPackage.fromFile(new File("src/test/apps/hosted"));
InMemoryProvisioner inMemoryHostProvisioner = new InMemoryProvisioner(false, "host1.yahoo.com", "host2.yahoo.com", "host3.yahoo.com", "host4.yahoo.com");
VespaModel firstModel = createModel(app, inMemoryHostProvisioner);
StaticProvisioner staticProvisioner = new StaticProvisioner(firstModel.allocatedHosts());
VespaModel secondModel = createModel(app, staticProvisioner);
assertModelConfig(firstModel, secondModel);
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class DeploymentFileValidator method validate.
@Override
public void validate(VespaModel model, DeployState deployState) {
Optional<Reader> deployment = deployState.getApplicationPackage().getDeployment();
if (deployment.isPresent()) {
Reader deploymentReader = deployment.get();
DeploymentSpec deploymentSpec = DeploymentSpec.fromXml(deploymentReader);
final Optional<String> globalServiceId = deploymentSpec.globalServiceId();
if (globalServiceId.isPresent()) {
Set<ContainerCluster> containerClusters = model.getRoot().configModelRepo().getModels(ContainerModel.class).stream().map(ContainerModel::getCluster).filter(cc -> cc.getName().equals(globalServiceId.get())).collect(Collectors.toSet());
if (containerClusters.size() != 1) {
throw new IllegalArgumentException("global-service-id '" + globalServiceId.get() + "' specified in deployment.xml does not match any container cluster id");
}
}
}
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class ModelProvisioningTest method testMultitenantButNotHostedSharedContentNode.
@Test
public void testMultitenantButNotHostedSharedContentNode() {
String services = "<?xml version='1.0' encoding='UTF-8' ?>" + "<services version='1.0'>" + " <admin version='2.0'>" + " <adminserver hostalias='node1'/>" + " </admin>" + " <jdisc id='default' version='1.0'>" + " <search/>" + " <nodes>" + " <node hostalias='node1'/>" + " </nodes>" + " </jdisc>" + " <content id='storage' version='1.0'>" + " <redundancy>2</redundancy>" + " <group>" + " <node distribution-key='0' hostalias='node1'/>" + " <node distribution-key='1' hostalias='node1'/>" + " </group>" + " <tuning>" + " <cluster-controller>" + " <transition-time>0</transition-time>" + " </cluster-controller>" + " </tuning>" + " <documents>" + " <document mode='store-only' type='type1'/>" + " </documents>" + " <engine>" + " <proton/>" + " </engine>" + " </content>" + " <content id='search' version='1.0'>" + " <redundancy>2</redundancy>" + " <group>" + " <node distribution-key='0' hostalias='node1'/>" + " </group>" + " <documents>" + " <document type='type1'/>" + " </documents>" + " </content>" + " </services>";
VespaModel model = createNonProvisionedMultitenantModel(services);
assertThat(model.getRoot().getHostSystem().getHosts().size(), is(1));
ContentCluster content = model.getContentClusters().get("storage");
assertEquals(2, content.getRootGroup().getNodes().size());
ContainerCluster controller = content.getClusterControllers();
assertEquals(1, controller.getContainers().size());
}
Aggregations