use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.
the class TenantRequestHandlerTest method testReloadConfig.
@Test
public void testReloadConfig() throws IOException, SAXException {
Clock clock = Clock.systemUTC();
ApplicationId applicationId = new ApplicationId.Builder().applicationName(ApplicationName.defaultName()).tenant(tenant).build();
server.reloadConfig(reloadConfig(1, clock));
assertThat(listener.reloaded.get(), is(1));
// Using only payload list for this simple test
SimpletypesConfig config = resolve(SimpletypesConfig.class, server, "");
assertThat(config.intval(), is(1337));
assertThat(server.getApplicationGeneration(applicationId, Optional.of(vespaVersion)), is(1l));
server.reloadConfig(reloadConfig(1l, clock));
config = resolve(SimpletypesConfig.class, server, "");
assertThat(config.intval(), is(1337));
assertThat(listener.reloaded.get(), is(2));
assertThat(server.getApplicationGeneration(applicationId, Optional.of(vespaVersion)), is(1l));
assertThat(listener.tenantHosts.size(), is(1));
assertThat(server.resolveApplicationId("mytesthost"), is(applicationId));
listener.reloaded.set(0);
feedApp(app2, 2);
server.reloadConfig(reloadConfig(2l, clock));
config = resolve(SimpletypesConfig.class, server, "");
assertThat(config.intval(), is(1330));
assertThat(listener.reloaded.get(), is(1));
assertThat(server.getApplicationGeneration(applicationId, Optional.of(vespaVersion)), is(2l));
}
use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.
the class TenantRequestHandlerTest method testResolveMultipleVersions.
@Test
public void testResolveMultipleVersions() throws IOException {
ApplicationId appId = new ApplicationId.Builder().tenant(tenant).applicationName("myapp1").instanceName("myinst1").build();
feedAndReloadApp(app1, 1, appId);
SimpletypesConfig config = resolve(SimpletypesConfig.class, server, appId, vespaVersion, "");
assertThat(config.intval(), is(1337));
config = resolve(SimpletypesConfig.class, server, appId, Version.fromIntValues(3, 2, 1), "");
assertThat(config.intval(), is(1337));
}
use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.
the class SessionPreparerTest method require_no_warning_for_overlapping_host_for_same_appid.
@Test
public void require_no_warning_for_overlapping_host_for_same_appid() throws IOException {
SessionContext ctx = getContext(getApplicationPackage(testApp));
((HostRegistry<ApplicationId>) ctx.getHostValidator()).update(applicationId("default"), Collections.singletonList("mytesthost"));
final StringBuilder logged = new StringBuilder();
DeployLogger logger = (level, message) -> {
System.out.println(level + ": " + message);
if (level.equals(LogLevel.WARNING) && message.contains("The host mytesthost is already in use"))
logged.append("ok");
};
preparer.prepare(ctx, logger, new PrepareParams.Builder().build(), Optional.empty(), tenantPath, Instant.now());
assertEquals(logged.toString(), "");
}
use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.
the class LbServicesProducerTest method randomizeApplications.
private Map<ApplicationId, ApplicationInfo> randomizeApplications(Map<ApplicationId, ApplicationInfo> applicationIdApplicationMap, int seed) {
Map<ApplicationId, ApplicationInfo> randomizedApplications = new LinkedHashMap<>();
List<ApplicationId> keys = new ArrayList<>(applicationIdApplicationMap.keySet());
Collections.shuffle(keys, new Random(seed));
for (ApplicationId key : keys) {
randomizedApplications.put(key, applicationIdApplicationMap.get(key));
}
return randomizedApplications;
}
use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.
the class LbServicesProducerTest method createTestApplications.
private Map<ApplicationId, ApplicationInfo> createTestApplications(TenantName tenant, DeployState.Builder deploystateBuilder) throws IOException, SAXException {
Map<ApplicationId, ApplicationInfo> aMap = new LinkedHashMap<>();
ApplicationId fooApp = new ApplicationId.Builder().tenant(tenant).applicationName("foo").build();
ApplicationId barApp = new ApplicationId.Builder().tenant(tenant).applicationName("bar").build();
ApplicationId bazApp = new ApplicationId.Builder().tenant(tenant).applicationName("baz").build();
aMap.put(fooApp, createApplication(fooApp, deploystateBuilder));
aMap.put(barApp, createApplication(barApp, deploystateBuilder));
aMap.put(bazApp, createApplication(bazApp, deploystateBuilder));
return aMap;
}
Aggregations