Search in sources :

Example 26 with ApplicationId

use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.

the class ApplicationTest method testThatApplicationIsInitialized.

@Test
public void testThatApplicationIsInitialized() throws IOException, SAXException {
    ApplicationId appId = ApplicationId.from(TenantName.defaultName(), ApplicationName.from("foobar"), InstanceName.defaultName());
    ServerCache cache = new ServerCache();
    Version vespaVersion = Version.fromIntValues(1, 2, 3);
    Application app = new Application(new ModelStub(), cache, 1337, vespaVersion, MetricUpdater.createTestUpdater(), appId);
    assertThat(app.getApplicationGeneration(), is(1337l));
    assertNotNull(app.getModel());
    assertThat(app.getCache(), is(cache));
    assertThat(app.getId().application().value(), is("foobar"));
    assertThat(app.getVespaVersion(), is(vespaVersion));
    assertThat(app.toString(), is("application 'foobar', generation 1337, vespa version 1.2.3"));
}
Also used : ServerCache(com.yahoo.vespa.config.server.ServerCache) Version(com.yahoo.config.provision.Version) ApplicationId(com.yahoo.config.provision.ApplicationId) ModelStub(com.yahoo.vespa.config.server.ModelStub) Test(org.junit.Test)

Example 27 with ApplicationId

use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.

the class ApplicationTest method setupHandler.

@Before
public void setupHandler() throws IOException, SAXException {
    File testApp = new File("src/test/apps/app");
    ServerCache cache = createCacheAndAddContent();
    VespaModel model = new VespaModel(FilesApplicationPackage.fromFile(testApp));
    final ApplicationId applicationId = new ApplicationId.Builder().tenant("foo").applicationName("foo").build();
    handler = new Application(model, cache, 1, Version.fromIntValues(1, 2, 3), new MetricUpdater(Metrics.createTestMetrics(), Metrics.createDimensions(applicationId)), applicationId);
}
Also used : ServerCache(com.yahoo.vespa.config.server.ServerCache) MetricUpdater(com.yahoo.vespa.config.server.monitoring.MetricUpdater) VespaModel(com.yahoo.vespa.model.VespaModel) ApplicationId(com.yahoo.config.provision.ApplicationId) File(java.io.File) Before(org.junit.Before)

Example 28 with ApplicationId

use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.

the class TenantApplicationsTest method require_that_reload_handler_is_called_when_apps_are_removed.

@Test
public void require_that_reload_handler_is_called_when_apps_are_removed() throws Exception {
    ApplicationId foo = createApplicationId("foo");
    writeApplicationData(foo, 3L);
    writeApplicationData(createApplicationId("bar"), 4L);
    MockReloadHandler reloadHandler = new MockReloadHandler();
    TenantApplications repo = createZKAppRepo(reloadHandler);
    assertNull(reloadHandler.lastRemoved);
    repo.deleteApplication(foo).commit();
    long endTime = System.currentTimeMillis() + 60_000;
    while (System.currentTimeMillis() < endTime && reloadHandler.lastRemoved == null) {
        Thread.sleep(100);
    }
    assertNotNull(reloadHandler.lastRemoved);
    assertThat(reloadHandler.lastRemoved.serializedForm(), is(foo.serializedForm()));
}
Also used : MockReloadHandler(com.yahoo.vespa.config.server.MockReloadHandler) ApplicationId(com.yahoo.config.provision.ApplicationId) Test(org.junit.Test)

Example 29 with ApplicationId

use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.

the class SessionCreateHandlerTest method require_that_application_urls_can_be_given_as_from_parameter.

@Test
public void require_that_application_urls_can_be_given_as_from_parameter() throws Exception {
    localSessionRepo.addSession(new SessionHandlerTest.MockSession(2l, FilesApplicationPackage.fromFile(testApp)));
    ApplicationId fooId = new ApplicationId.Builder().tenant(tenant).applicationName("foo").instanceName("quux").build();
    applicationRepo.createPutApplicationTransaction(fooId, 2).commit();
    assertFromParameter("3", "http://myhost:40555/application/v2/tenant/" + tenant + "/application/foo/environment/test/region/baz/instance/quux");
    localSessionRepo.addSession(new SessionHandlerTest.MockSession(5l, FilesApplicationPackage.fromFile(testApp)));
    ApplicationId bioId = new ApplicationId.Builder().tenant(tenant).applicationName("foobio").instanceName("quux").build();
    applicationRepo.createPutApplicationTransaction(bioId, 5).commit();
    assertFromParameter("6", "http://myhost:40555/application/v2/tenant/" + tenant + "/application/foobio/environment/staging/region/baz/instance/quux");
}
Also used : SessionHandlerTest(com.yahoo.vespa.config.server.http.SessionHandlerTest) ApplicationId(com.yahoo.config.provision.ApplicationId) HandlerTest(com.yahoo.vespa.config.server.http.HandlerTest) Test(org.junit.Test) SessionHandlerTest(com.yahoo.vespa.config.server.http.SessionHandlerTest) CompressedApplicationInputStreamTest(com.yahoo.vespa.config.server.http.CompressedApplicationInputStreamTest)

Example 30 with ApplicationId

use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.

the class SessionZooKeeperClientTest method require_that_application_id_is_written_to_zk.

@Test
public void require_that_application_id_is_written_to_zk() {
    ApplicationId id = new ApplicationId.Builder().tenant("tenant").applicationName("foo").instanceName("bim").build();
    SessionZooKeeperClient zkc = createSessionZKClient("3");
    zkc.writeApplicationId(id);
    String path = "/3/" + SessionZooKeeperClient.APPLICATION_ID_PATH;
    assertTrue(configCurator.exists(path));
    assertThat(configCurator.getData(path), is("tenant:foo:bim"));
}
Also used : ApplicationId(com.yahoo.config.provision.ApplicationId) Test(org.junit.Test)

Aggregations

ApplicationId (com.yahoo.config.provision.ApplicationId)173 Test (org.junit.Test)102 Zone (com.yahoo.config.provision.Zone)52 Node (com.yahoo.vespa.hosted.provision.Node)30 ClusterSpec (com.yahoo.config.provision.ClusterSpec)22 TenantName (com.yahoo.config.provision.TenantName)20 Flavor (com.yahoo.config.provision.Flavor)19 List (java.util.List)16 HashSet (java.util.HashSet)15 HostSpec (com.yahoo.config.provision.HostSpec)12 Duration (java.time.Duration)12 HashMap (java.util.HashMap)12 Map (java.util.Map)12 Set (java.util.Set)12 Collectors (java.util.stream.Collectors)12 Version (com.yahoo.component.Version)11 OutOfCapacityException (com.yahoo.config.provision.OutOfCapacityException)11 Slime (com.yahoo.slime.Slime)11 ArrayList (java.util.ArrayList)11 Optional (java.util.Optional)11