Search in sources :

Example 21 with NullConfigModelRegistry

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

the class AccessControlValidatorTest method cluster_with_mbus_handler_passes_validation_without_write_protection.

@Test
public void cluster_with_mbus_handler_passes_validation_without_write_protection() throws IOException, SAXException {
    String servicesXml = joinLines("<services version='1.0'>", "  <container id='default' version='1.0'>", "    <handler id='foo'>", "      <binding>mbus://*/foo</binding>", "    </handler>", "  </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 22 with NullConfigModelRegistry

use of com.yahoo.config.model.NullConfigModelRegistry 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());
}
Also used : AllocatedHosts(com.yahoo.config.provision.AllocatedHosts) NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) DeployState(com.yahoo.config.model.deploy.DeployState) InMemoryProvisioner(com.yahoo.config.model.provision.InMemoryProvisioner) DeployProperties(com.yahoo.config.model.deploy.DeployProperties) VespaModel(com.yahoo.vespa.model.VespaModel) FilesApplicationPackage(com.yahoo.config.model.application.provider.FilesApplicationPackage) ApplicationPackage(com.yahoo.config.application.api.ApplicationPackage) MockApplicationPackage(com.yahoo.config.model.test.MockApplicationPackage) Test(org.junit.Test)

Example 23 with NullConfigModelRegistry

use of com.yahoo.config.model.NullConfigModelRegistry 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));
}
Also used : NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) DeployState(com.yahoo.config.model.deploy.DeployState) VespaModel(com.yahoo.vespa.model.VespaModel) FilesApplicationPackage(com.yahoo.config.model.application.provider.FilesApplicationPackage) ApplicationPackage(com.yahoo.config.application.api.ApplicationPackage) MockApplicationPackage(com.yahoo.config.model.test.MockApplicationPackage) File(java.io.File) Test(org.junit.Test)

Example 24 with NullConfigModelRegistry

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

the class SessionActiveHandlerTest method setup.

@Before
public void setup() throws Exception {
    remoteSessionRepo = new RemoteSessionRepo(tenant);
    applicationRepo = new MemoryTenantApplications();
    curator = new MockCurator();
    configCurator = ConfigCurator.create(curator);
    localRepo = new LocalSessionRepo(Clock.systemUTC());
    pathPrefix = "/application/v2/tenant/" + tenant + "/session/";
    hostProvisioner = new MockProvisioner();
    modelFactory = new VespaModelFactory(new NullConfigModelRegistry());
    componentRegistry = new TestComponentRegistry.Builder().curator(curator).configCurator(configCurator).modelFactoryRegistry(new ModelFactoryRegistry(Collections.singletonList(modelFactory))).build();
}
Also used : VespaModelFactory(com.yahoo.vespa.model.VespaModelFactory) RemoteSessionRepo(com.yahoo.vespa.config.server.session.RemoteSessionRepo) NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) MemoryTenantApplications(com.yahoo.vespa.config.server.application.MemoryTenantApplications) LocalSessionRepo(com.yahoo.vespa.config.server.session.LocalSessionRepo) TestComponentRegistry(com.yahoo.vespa.config.server.TestComponentRegistry) ModelFactoryRegistry(com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry) MockCurator(com.yahoo.vespa.curator.mock.MockCurator) Before(org.junit.Before)

Example 25 with NullConfigModelRegistry

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

the class RemoteSessionTest method require_that_applications_are_loaded.

@Test
public void require_that_applications_are_loaded() throws IOException, SAXException {
    RemoteSession session = createSession(3, Arrays.asList(new MockModelFactory(), new VespaModelFactory(new NullConfigModelRegistry())), Clock.systemUTC());
    session.loadPrepared();
    ApplicationSet applicationSet = session.ensureApplicationLoaded();
    assertNotNull(applicationSet);
    assertThat(applicationSet.getApplicationGeneration(), is(3l));
    assertThat(applicationSet.getForVersionOrLatest(Optional.empty(), Instant.now()).getId().application().value(), is("foo"));
    assertNotNull(applicationSet.getForVersionOrLatest(Optional.empty(), Instant.now()).getModel());
    session.deactivate();
    applicationSet = session.ensureApplicationLoaded();
    assertNotNull(applicationSet);
    assertThat(applicationSet.getApplicationGeneration(), is(3l));
    assertThat(applicationSet.getForVersionOrLatest(Optional.empty(), Instant.now()).getId().application().value(), is("foo"));
    assertNotNull(applicationSet.getForVersionOrLatest(Optional.empty(), Instant.now()).getModel());
}
Also used : VespaModelFactory(com.yahoo.vespa.model.VespaModelFactory) NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) ApplicationSet(com.yahoo.vespa.config.server.application.ApplicationSet) 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