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"));
}
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);
}
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()));
}
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");
}
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"));
}
Aggregations