Search in sources :

Example 76 with VespaModel

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")));
}
Also used : ServerCache(com.yahoo.vespa.config.server.ServerCache) ConfigKey(com.yahoo.vespa.config.ConfigKey) VespaModel(com.yahoo.vespa.model.VespaModel) File(java.io.File) Application(com.yahoo.vespa.config.server.application.Application) Test(org.junit.Test)

Example 77 with VespaModel

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));
}
Also used : ServerCache(com.yahoo.vespa.config.server.ServerCache) VespaModel(com.yahoo.vespa.model.VespaModel) Application(com.yahoo.vespa.config.server.application.Application) Test(org.junit.Test)

Example 78 with VespaModel

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);
}
Also used : InMemoryProvisioner(com.yahoo.config.model.provision.InMemoryProvisioner) 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) Test(org.junit.Test)

Example 79 with VespaModel

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");
            }
        }
    }
}
Also used : DeployState(com.yahoo.config.model.deploy.DeployState) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) DeploymentSpec(com.yahoo.config.application.api.DeploymentSpec) VespaModel(com.yahoo.vespa.model.VespaModel) ContainerModel(com.yahoo.vespa.model.container.ContainerModel) Optional(java.util.Optional) Set(java.util.Set) Reader(java.io.Reader) Collectors(java.util.stream.Collectors) DeploymentSpec(com.yahoo.config.application.api.DeploymentSpec) Reader(java.io.Reader) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) ContainerModel(com.yahoo.vespa.model.container.ContainerModel)

Example 80 with VespaModel

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());
}
Also used : VespaModel(com.yahoo.vespa.model.VespaModel) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Aggregations

VespaModel (com.yahoo.vespa.model.VespaModel)153 Test (org.junit.Test)135 VespaModelTester (com.yahoo.vespa.model.test.VespaModelTester)35 VespaModelCreatorWithMockPkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg)26 ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)22 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)21 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)18 DeployState (com.yahoo.config.model.deploy.DeployState)18 NullConfigModelRegistry (com.yahoo.config.model.NullConfigModelRegistry)15 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)14 MockApplicationPackage (com.yahoo.config.model.test.MockApplicationPackage)13 Matchers.containsString (org.hamcrest.Matchers.containsString)12 File (java.io.File)8 ProtonConfig (com.yahoo.vespa.config.search.core.ProtonConfig)6 ValidationTester (com.yahoo.vespa.model.application.validation.ValidationTester)6 ContentSearchCluster (com.yahoo.vespa.model.content.ContentSearchCluster)6 LogdConfig (com.yahoo.cloud.config.log.LogdConfig)5 FilesApplicationPackage (com.yahoo.config.model.application.provider.FilesApplicationPackage)5 InMemoryProvisioner (com.yahoo.config.model.provision.InMemoryProvisioner)5 HostResource (com.yahoo.vespa.model.HostResource)5