Search in sources :

Example 1 with SuperModelConfigProvider

use of com.yahoo.vespa.config.server.model.SuperModelConfigProvider in project vespa by vespa-engine.

the class SuperModelManager method makeNewSuperModelConfigProvider.

private void makeNewSuperModelConfigProvider(SuperModel newSuperModel) {
    generation = masterGeneration + generationCounter.get();
    superModelConfigProvider = new SuperModelConfigProvider(newSuperModel, zone);
}
Also used : SuperModelConfigProvider(com.yahoo.vespa.config.server.model.SuperModelConfigProvider)

Example 2 with SuperModelConfigProvider

use of com.yahoo.vespa.config.server.model.SuperModelConfigProvider in project vespa by vespa-engine.

the class SuperModelControllerTest method test_lb_config_multiple_apps.

@Test
public void test_lb_config_multiple_apps() throws IOException, SAXException {
    Map<TenantName, Map<ApplicationId, ApplicationInfo>> models = new LinkedHashMap<>();
    models.put(TenantName.from("t1"), new LinkedHashMap<>());
    models.put(TenantName.from("t2"), new LinkedHashMap<>());
    File testApp1 = new File("src/test/resources/deploy/app");
    File testApp2 = new File("src/test/resources/deploy/advancedapp");
    File testApp3 = new File("src/test/resources/deploy/advancedapp");
    // TODO must fix equals, hashCode on Tenant
    Version vespaVersion = Version.fromIntValues(1, 2, 3);
    models.get(TenantName.from("t1")).put(applicationId("mysimpleapp"), new ApplicationInfo(applicationId("mysimpleapp"), 4l, new VespaModel(FilesApplicationPackage.fromFile(testApp1))));
    models.get(TenantName.from("t1")).put(applicationId("myadvancedapp"), new ApplicationInfo(applicationId("myadvancedapp"), 4l, new VespaModel(FilesApplicationPackage.fromFile(testApp2))));
    models.get(TenantName.from("t2")).put(applicationId("minetooadvancedapp"), new ApplicationInfo(applicationId("minetooadvancedapp"), 4l, new VespaModel(FilesApplicationPackage.fromFile(testApp3))));
    SuperModel superModel = new SuperModel(models);
    SuperModelController han = new SuperModelController(new SuperModelConfigProvider(superModel, Zone.defaultZone()), new TestConfigDefinitionRepo(), 2, new UncompressedConfigResponseFactory());
    LbServicesConfig.Builder lb = new LbServicesConfig.Builder();
    han.getSuperModel().getConfig(lb);
    LbServicesConfig lbc = new LbServicesConfig(lb);
    assertThat(lbc.tenants().size(), is(2));
    assertThat(lbc.tenants("t1").applications().size(), is(2));
    assertThat(lbc.tenants("t2").applications().size(), is(1));
    assertThat(lbc.tenants("t2").applications("minetooadvancedapp:prod:default:default").hosts().size(), is(1));
    assertQrServer(lbc.tenants("t2").applications("minetooadvancedapp:prod:default:default"));
}
Also used : TenantName(com.yahoo.config.provision.TenantName) SuperModel(com.yahoo.config.model.api.SuperModel) SuperModelConfigProvider(com.yahoo.vespa.config.server.model.SuperModelConfigProvider) ApplicationInfo(com.yahoo.config.model.api.ApplicationInfo) LinkedHashMap(java.util.LinkedHashMap) Version(com.yahoo.config.provision.Version) VespaModel(com.yahoo.vespa.model.VespaModel) UncompressedConfigResponseFactory(com.yahoo.vespa.config.server.rpc.UncompressedConfigResponseFactory) LbServicesConfig(com.yahoo.cloud.config.LbServicesConfig) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) File(java.io.File) Test(org.junit.Test)

Example 3 with SuperModelConfigProvider

use of com.yahoo.vespa.config.server.model.SuperModelConfigProvider in project vespa by vespa-engine.

the class SuperModelControllerTest method setupHandler.

@Before
public void setupHandler() throws IOException, SAXException {
    Map<TenantName, Map<ApplicationId, ApplicationInfo>> models = new LinkedHashMap<>();
    models.put(TenantName.from("a"), new LinkedHashMap<>());
    File testApp = new File("src/test/resources/deploy/app");
    ApplicationId app = ApplicationId.from(TenantName.from("a"), ApplicationName.from("foo"), InstanceName.defaultName());
    models.get(app.tenant()).put(app, new ApplicationInfo(app, 4l, new VespaModel(FilesApplicationPackage.fromFile(testApp))));
    SuperModel superModel = new SuperModel(models);
    handler = new SuperModelController(new SuperModelConfigProvider(superModel, Zone.defaultZone()), new TestConfigDefinitionRepo(), 2, new UncompressedConfigResponseFactory());
}
Also used : TenantName(com.yahoo.config.provision.TenantName) SuperModel(com.yahoo.config.model.api.SuperModel) SuperModelConfigProvider(com.yahoo.vespa.config.server.model.SuperModelConfigProvider) ApplicationInfo(com.yahoo.config.model.api.ApplicationInfo) LinkedHashMap(java.util.LinkedHashMap) VespaModel(com.yahoo.vespa.model.VespaModel) UncompressedConfigResponseFactory(com.yahoo.vespa.config.server.rpc.UncompressedConfigResponseFactory) ApplicationId(com.yahoo.config.provision.ApplicationId) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) File(java.io.File) Before(org.junit.Before)

Aggregations

SuperModelConfigProvider (com.yahoo.vespa.config.server.model.SuperModelConfigProvider)3 ApplicationInfo (com.yahoo.config.model.api.ApplicationInfo)2 SuperModel (com.yahoo.config.model.api.SuperModel)2 TenantName (com.yahoo.config.provision.TenantName)2 UncompressedConfigResponseFactory (com.yahoo.vespa.config.server.rpc.UncompressedConfigResponseFactory)2 VespaModel (com.yahoo.vespa.model.VespaModel)2 File (java.io.File)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2 LbServicesConfig (com.yahoo.cloud.config.LbServicesConfig)1 ApplicationId (com.yahoo.config.provision.ApplicationId)1 Version (com.yahoo.config.provision.Version)1 Before (org.junit.Before)1 Test (org.junit.Test)1