Search in sources :

Example 1 with NullConfigModelRegistry

use of com.yahoo.config.model.NullConfigModelRegistry 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 2 with NullConfigModelRegistry

use of com.yahoo.config.model.NullConfigModelRegistry 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 3 with NullConfigModelRegistry

use of com.yahoo.config.model.NullConfigModelRegistry 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 4 with NullConfigModelRegistry

use of com.yahoo.config.model.NullConfigModelRegistry 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 5 with NullConfigModelRegistry

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

the class ContainerModelBuilderTest method qrconfig_is_produced.

@Test
public void qrconfig_is_produced() throws IOException, SAXException {
    String servicesXml = "<services>" + "<admin version='3.0'>" + "    <nodes count='1'/>" + "</admin>" + "<jdisc id ='default' version='1.0'>" + "  <nodes>" + "    <node hostalias='node1' />" + "  </nodes>" + "</jdisc>" + "</services>";
    ApplicationPackage applicationPackage = new MockApplicationPackage.Builder().withServices(servicesXml).build();
    VespaModel model = new VespaModel(new NullConfigModelRegistry(), new DeployState.Builder().applicationPackage(applicationPackage).properties(new DeployProperties.Builder().build()).build(true));
    // Using the same way of getting hostname as filedistribution model
    String hostname = HostName.getLocalhost();
    QrConfig config = model.getConfig(QrConfig.class, "default/container.0");
    assertEquals("default.container.0", config.discriminator());
    assertEquals(19102, config.rpc().port());
    assertEquals("vespa/service/default/container.0", config.rpc().slobrokId());
    assertEquals(true, config.rpc().enabled());
    assertEquals("", config.rpc().host());
    assertEquals(false, config.restartOnDeploy());
    assertEquals(false, config.coveragereports());
    assertEquals("filedistribution/" + hostname, config.filedistributor().configid());
}
Also used : NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) VespaModel(com.yahoo.vespa.model.VespaModel) QrConfig(com.yahoo.container.QrConfig) Matchers.containsString(org.hamcrest.Matchers.containsString) ApplicationPackage(com.yahoo.config.application.api.ApplicationPackage) MockApplicationPackage(com.yahoo.config.model.test.MockApplicationPackage) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest) Test(org.junit.Test)

Aggregations

NullConfigModelRegistry (com.yahoo.config.model.NullConfigModelRegistry)25 Test (org.junit.Test)21 VespaModel (com.yahoo.vespa.model.VespaModel)15 DeployState (com.yahoo.config.model.deploy.DeployState)13 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)11 MockApplicationPackage (com.yahoo.config.model.test.MockApplicationPackage)9 FilesApplicationPackage (com.yahoo.config.model.application.provider.FilesApplicationPackage)5 VespaModelFactory (com.yahoo.vespa.model.VespaModelFactory)5 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)4 Matchers.containsString (org.hamcrest.Matchers.containsString)4 MockModelContext (com.yahoo.config.model.MockModelContext)3 DeployProperties (com.yahoo.config.model.deploy.DeployProperties)3 TestComponentRegistry (com.yahoo.vespa.config.server.TestComponentRegistry)3 ModelFactoryRegistry (com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry)3 Model (com.yahoo.config.model.api.Model)2 ModelCreateResult (com.yahoo.config.model.api.ModelCreateResult)2 InMemoryProvisioner (com.yahoo.config.model.provision.InMemoryProvisioner)2 TenantName (com.yahoo.config.provision.TenantName)2 SessionHandlerTest (com.yahoo.vespa.config.server.http.SessionHandlerTest)2 RemoteSession (com.yahoo.vespa.config.server.session.RemoteSession)2