Search in sources :

Example 26 with VespaModel

use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.

the class AccessControlValidatorTest method cluster_with_no_handlers_passes_validation_without_write_protection.

@Test
public void cluster_with_no_handlers_passes_validation_without_write_protection() throws IOException, SAXException {
    DeployState deployState = deployState(servicesXml(false, false));
    VespaModel model = new VespaModel(new NullConfigModelRegistry(), deployState);
    new AccessControlValidator().validate(model, deployState);
}
Also used : NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) DeployState(com.yahoo.config.model.deploy.DeployState) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 27 with VespaModel

use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.

the class AccessControlValidatorTest method cluster_with_write_protection_passes_validation.

@Test
public void cluster_with_write_protection_passes_validation() throws IOException, SAXException {
    DeployState deployState = deployState(servicesXml(true, true));
    VespaModel model = new VespaModel(new NullConfigModelRegistry(), deployState);
    new AccessControlValidator().validate(model, deployState);
}
Also used : NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) DeployState(com.yahoo.config.model.deploy.DeployState) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 28 with VespaModel

use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.

the class AccessControlValidatorTest method cluster_without_custom_components_passes_validation_without_write_protection.

@Test
public void cluster_without_custom_components_passes_validation_without_write_protection() throws IOException, SAXException {
    String servicesXml = joinLines("<services version='1.0'>", "  <container id='default' version='1.0' />", "</services>");
    DeployState deployState = deployState(servicesXml);
    VespaModel model = new VespaModel(new NullConfigModelRegistry(), deployState);
    new AccessControlValidator().validate(model, deployState);
}
Also used : NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) DeployState(com.yahoo.config.model.deploy.DeployState) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 29 with VespaModel

use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.

the class AccessControlValidatorTest method write_protection_is_not_required_for_non_default_application_type.

@Test
public void write_protection_is_not_required_for_non_default_application_type() throws IOException, SAXException {
    String servicesXml = joinLines("<services version='1.0' application-type='hosted-infrastructure'>", "  <container id='default' version='1.0'>", httpHandlerXml, "  </container>", "</services>");
    DeployState deployState = deployState(servicesXml);
    VespaModel model = new VespaModel(new NullConfigModelRegistry(), deployState);
    new AccessControlValidator().validate(model, deployState);
}
Also used : NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) DeployState(com.yahoo.config.model.deploy.DeployState) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 30 with VespaModel

use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.

the class AdminTestCase method testContainerMetricsSnapshotInterval.

@Test
public void testContainerMetricsSnapshotInterval() throws Exception {
    VespaModel vespaModel = getVespaModel(TESTDIR + "metricconfig");
    ContainerCluster docprocCluster = vespaModel.getContainerClusters().get("cluster.music.indexing");
    HealthMonitorConfig.Builder builder = new HealthMonitorConfig.Builder();
    docprocCluster.getConfig(builder);
    HealthMonitorConfig docprocConfig = new HealthMonitorConfig(builder);
    assertEquals(60, (int) docprocConfig.snapshot_interval());
    ContainerCluster qrCluster = vespaModel.getContainerClusters().get("container");
    builder = new HealthMonitorConfig.Builder();
    qrCluster.getConfig(builder);
    HealthMonitorConfig qrClusterConfig = new HealthMonitorConfig(builder);
    assertEquals(60, (int) qrClusterConfig.snapshot_interval());
    StatisticsComponent stat = null;
    for (Component component : qrCluster.getAllComponents()) {
        if (component.getClassId().getName().contains("com.yahoo.statistics.StatisticsImpl")) {
            stat = (StatisticsComponent) component;
            break;
        }
    }
    assertNotNull(stat);
    StatisticsConfig.Builder sb = new StatisticsConfig.Builder();
    stat.getConfig(sb);
    StatisticsConfig sc = new StatisticsConfig(sb);
    assertEquals(60, (int) sc.collectionintervalsec());
    assertEquals(60, (int) sc.loggingintervalsec());
}
Also used : StatisticsComponent(com.yahoo.vespa.model.container.component.StatisticsComponent) StatisticsConfig(com.yahoo.container.StatisticsConfig) VespaModel(com.yahoo.vespa.model.VespaModel) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) HealthMonitorConfig(com.yahoo.container.jdisc.config.HealthMonitorConfig) StatisticsComponent(com.yahoo.vespa.model.container.component.StatisticsComponent) Component(com.yahoo.vespa.model.container.component.Component) 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