Search in sources :

Example 16 with ApplicationPackage

use of com.yahoo.config.application.api.ApplicationPackage in project vespa by vespa-engine.

the class SessionActiveHandlerTest method addLocalSession.

private LocalSessionRepo addLocalSession(long sessionId, DeployData deployData, SessionZooKeeperClient zkc) {
    writeApplicationId(zkc, deployData.getApplicationName());
    TenantFileSystemDirs tenantFileSystemDirs = TenantFileSystemDirs.createTestDirs(tenant);
    ApplicationPackage app = FilesApplicationPackage.fromFileWithDeployData(testApp, deployData);
    localRepo.addSession(new LocalSession(tenant, sessionId, new SessionTest.MockSessionPreparer(), new SessionContext(app, zkc, new File(tenantFileSystemDirs.sessionsPath(), String.valueOf(sessionId)), applicationRepo, new HostRegistry<>(), new SuperModelGenerationCounter(curator))));
    return localRepo;
}
Also used : TenantFileSystemDirs(com.yahoo.vespa.config.server.deploy.TenantFileSystemDirs) LocalSession(com.yahoo.vespa.config.server.session.LocalSession) SessionContext(com.yahoo.vespa.config.server.session.SessionContext) SuperModelGenerationCounter(com.yahoo.vespa.config.server.SuperModelGenerationCounter) FilesApplicationPackage(com.yahoo.config.model.application.provider.FilesApplicationPackage) ApplicationPackage(com.yahoo.config.application.api.ApplicationPackage) File(java.io.File)

Example 17 with ApplicationPackage

use of com.yahoo.config.application.api.ApplicationPackage 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 18 with ApplicationPackage

use of com.yahoo.config.application.api.ApplicationPackage in project vespa by vespa-engine.

the class ModelProvisioningTest method createNonProvisionedMultitenantModel.

private VespaModel createNonProvisionedMultitenantModel(String services) {
    VespaModelCreatorWithMockPkg modelCreatorWithMockPkg = new VespaModelCreatorWithMockPkg(null, services, ApplicationPackageUtils.generateSearchDefinition("type1"));
    ApplicationPackage appPkg = modelCreatorWithMockPkg.appPkg;
    DeployState deployState = new DeployState.Builder().applicationPackage(appPkg).properties((new DeployProperties.Builder()).multitenant(true).build()).build(true);
    return modelCreatorWithMockPkg.create(false, deployState);
}
Also used : VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) DeployState(com.yahoo.config.model.deploy.DeployState) DeployProperties(com.yahoo.config.model.deploy.DeployProperties) ApplicationPackage(com.yahoo.config.application.api.ApplicationPackage)

Example 19 with ApplicationPackage

use of com.yahoo.config.application.api.ApplicationPackage in project vespa by vespa-engine.

the class ContainerModelBuilderTest method fail_if_http_port_is_not_4080_in_hosted_vespa.

@Test
public void fail_if_http_port_is_not_4080_in_hosted_vespa() throws Exception {
    String servicesXml = "<services>" + "<admin version='3.0'>" + "    <nodes count='1'/>" + "</admin>" + "<jdisc version='1.0'>" + "  <http>" + "    <server port='9000' id='foo' />" + "  </http>" + nodesXml + "</jdisc>" + "</services>";
    ApplicationPackage applicationPackage = new MockApplicationPackage.Builder().withServices(servicesXml).build();
    // Need to create VespaModel to make deploy properties have effect
    final MyLogger logger = new MyLogger();
    new VespaModel(new NullConfigModelRegistry(), new DeployState.Builder().applicationPackage(applicationPackage).deployLogger(logger).properties(new DeployProperties.Builder().hostedVespa(true).build()).build(true));
    assertFalse(logger.msgs.isEmpty());
    assertThat(logger.msgs.get(0).getSecond(), containsString(String.format("You cannot set port to anything else than %d", Container.BASEPORT)));
}
Also used : NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) DeployState(com.yahoo.config.model.deploy.DeployState) VespaModel(com.yahoo.vespa.model.VespaModel) DeployProperties(com.yahoo.config.model.deploy.DeployProperties) 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)

Example 20 with ApplicationPackage

use of com.yahoo.config.application.api.ApplicationPackage in project vespa by vespa-engine.

the class ContainerModelBuilderTest method vip_status_handler_uses_file_for_hosted_vespa.

@Test
public void vip_status_handler_uses_file_for_hosted_vespa() throws Exception {
    String servicesXml = "<services>" + "<jdisc version='1.0'>" + nodesXml + "</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().hostedVespa(true).build()).build(true));
    AbstractConfigProducerRoot modelRoot = model.getRoot();
    VipStatusConfig vipStatusConfig = modelRoot.getConfig(VipStatusConfig.class, "jdisc/component/status.html-status-handler");
    assertTrue(vipStatusConfig.accessdisk());
    assertEquals(ContainerModelBuilder.HOSTED_VESPA_STATUS_FILE, vipStatusConfig.statusfile());
}
Also used : NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) AbstractConfigProducerRoot(com.yahoo.config.model.producer.AbstractConfigProducerRoot) VespaModel(com.yahoo.vespa.model.VespaModel) DeployProperties(com.yahoo.config.model.deploy.DeployProperties) Matchers.containsString(org.hamcrest.Matchers.containsString) VipStatusConfig(com.yahoo.container.core.VipStatusConfig) 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

ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)39 MockApplicationPackage (com.yahoo.config.model.test.MockApplicationPackage)25 Test (org.junit.Test)21 VespaModel (com.yahoo.vespa.model.VespaModel)14 FilesApplicationPackage (com.yahoo.config.model.application.provider.FilesApplicationPackage)13 DeployState (com.yahoo.config.model.deploy.DeployState)12 File (java.io.File)11 NullConfigModelRegistry (com.yahoo.config.model.NullConfigModelRegistry)10 DeployProperties (com.yahoo.config.model.deploy.DeployProperties)8 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)7 InMemoryProvisioner (com.yahoo.config.model.provision.InMemoryProvisioner)6 Matchers.containsString (org.hamcrest.Matchers.containsString)5 VespaModelCreatorWithMockPkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg)4 TestDriver (com.yahoo.config.model.test.TestDriver)3 Path (com.yahoo.path.Path)3 DeployLogger (com.yahoo.config.application.api.DeployLogger)2 MockRoot (com.yahoo.config.model.test.MockRoot)2 Zone (com.yahoo.config.provision.Zone)2 ConfigDefinition (com.yahoo.vespa.config.ConfigDefinition)2 ConfigDefinitionKey (com.yahoo.vespa.config.ConfigDefinitionKey)2