Search in sources :

Example 1 with UncompressedConfigResponseFactory

use of com.yahoo.vespa.config.server.rpc.UncompressedConfigResponseFactory 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 2 with UncompressedConfigResponseFactory

use of com.yahoo.vespa.config.server.rpc.UncompressedConfigResponseFactory 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)

Example 3 with UncompressedConfigResponseFactory

use of com.yahoo.vespa.config.server.rpc.UncompressedConfigResponseFactory in project vespa by vespa-engine.

the class TenantRequestHandlerTest method setUp.

@Before
public void setUp() throws IOException, SAXException {
    feedApp(app1, 1);
    Metrics sh = Metrics.createTestMetrics();
    List<ReloadListener> listeners = new ArrayList<>();
    listeners.add(listener);
    server = new TenantRequestHandler(sh, tenant, listeners, new UncompressedConfigResponseFactory(), new HostRegistries());
    componentRegistry = new TestComponentRegistry.Builder().curator(curator).modelFactoryRegistry(createRegistry()).build();
}
Also used : ReloadListener(com.yahoo.vespa.config.server.ReloadListener) Metrics(com.yahoo.vespa.config.server.monitoring.Metrics) HostRegistries(com.yahoo.vespa.config.server.host.HostRegistries) UncompressedConfigResponseFactory(com.yahoo.vespa.config.server.rpc.UncompressedConfigResponseFactory) Before(org.junit.Before)

Aggregations

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