use of com.yahoo.config.model.api.ApplicationInfo in project vespa by vespa-engine.
the class SuperModelManager method configActivated.
public synchronized void configActivated(TenantName tenant, ApplicationSet applicationSet) {
// TODO: Should supermodel care about multiple versions?
ApplicationInfo applicationInfo = applicationSet.getForVersionOrLatest(Optional.empty(), Instant.now()).toApplicationInfo();
SuperModel newSuperModel = this.superModelConfigProvider.getSuperModel().cloneAndSetApplication(applicationInfo);
makeNewSuperModelConfigProvider(newSuperModel);
listeners.stream().forEach(listener -> listener.applicationActivated(newSuperModel, applicationInfo));
}
use of com.yahoo.config.model.api.ApplicationInfo in project vespa by vespa-engine.
the class SuperModelConfigProvider method getConfig.
public <CONFIGTYPE extends ConfigInstance> CONFIGTYPE getConfig(Class<CONFIGTYPE> configClass, ApplicationId applicationId, String configId) {
TenantName tenant = applicationId.tenant();
if (!superModel.getAllModels().containsKey(tenant)) {
throw new IllegalArgumentException("Tenant " + tenant + " not found");
}
Map<ApplicationId, ApplicationInfo> applications = superModel.getAllModels().get(tenant);
if (!applications.containsKey(applicationId)) {
throw new IllegalArgumentException("Application id " + applicationId + " not found");
}
ApplicationInfo application = applications.get(applicationId);
ConfigKey<CONFIGTYPE> key = new ConfigKey<>(configClass, configId);
ConfigPayload payload = application.getModel().getConfig(key, null);
return payload.toInstance(configClass, configId);
}
use of com.yahoo.config.model.api.ApplicationInfo 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.model.api.ApplicationInfo 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;
}
use of com.yahoo.config.model.api.ApplicationInfo in project vespa by vespa-engine.
the class ExampleModelTest method testEmptyApplication.
@Test
public void testEmptyApplication() {
ApplicationInfo application = ExampleModel.createApplication("tenant", "app").build();
assertEquals("tenant.app", application.getApplicationId().toString());
assertEquals(1, application.getGeneration());
assertEquals(0, application.getModel().getHosts().size());
}
Aggregations