Search in sources :

Example 6 with ServerCache

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

the class TenantsTestCase method testListenersAdded.

@Test
public void testListenersAdded() throws IOException, SAXException {
    tenants.getTenant(tenant1).getReloadHandler().reloadConfig(ApplicationSet.fromSingle(new Application(new VespaModel(MockApplicationPackage.createEmpty()), new ServerCache(), 4l, Version.fromIntValues(1, 2, 3), MetricUpdater.createTestUpdater(), ApplicationId.defaultId())));
    assertThat(listener.reloaded.get(), is(1));
}
Also used : ServerCache(com.yahoo.vespa.config.server.ServerCache) VespaModel(com.yahoo.vespa.model.VespaModel) Application(com.yahoo.vespa.config.server.application.Application) Test(org.junit.Test)

Example 7 with ServerCache

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

the class RpcServerTest method testEnabled.

private void testEnabled() throws IOException, SAXException {
    generationCounter.increment();
    Application app = new Application(new VespaModel(MockApplicationPackage.createEmpty()), new ServerCache(), 2l, Version.fromIntValues(1, 2, 3), MetricUpdater.createTestUpdater(), ApplicationId.defaultId());
    ApplicationSet appSet = ApplicationSet.fromSingle(app);
    rpcServer.configActivated(TenantName.defaultName(), appSet);
    ConfigKey<?> key = new ConfigKey<>(LbServicesConfig.class, "*");
    JRTClientConfigRequest clientReq = JRTClientConfigRequestV3.createFromRaw(new RawConfig(key, LbServicesConfig.CONFIG_DEF_MD5), 120_000, Trace.createDummy(), CompressionType.UNCOMPRESSED, Optional.empty());
    assertTrue(clientReq.validateParameters());
    performRequest(clientReq.getRequest());
    assertFalse(clientReq.validateResponse());
    assertThat(clientReq.errorCode(), is(ErrorCode.APPLICATION_NOT_LOADED));
    rpcServer.onTenantsLoaded();
    clientReq = JRTClientConfigRequestV3.createFromRaw(new RawConfig(key, LbServicesConfig.CONFIG_DEF_MD5), 120_000, Trace.createDummy(), CompressionType.UNCOMPRESSED, Optional.empty());
    assertTrue(clientReq.validateParameters());
    performRequest(clientReq.getRequest());
    boolean validResponse = clientReq.validateResponse();
    assertTrue(clientReq.errorMessage(), validResponse);
    assertThat(clientReq.errorCode(), is(0));
}
Also used : ServerCache(com.yahoo.vespa.config.server.ServerCache) VespaModel(com.yahoo.vespa.model.VespaModel) ApplicationSet(com.yahoo.vespa.config.server.application.ApplicationSet) Application(com.yahoo.vespa.config.server.application.Application)

Example 8 with ServerCache

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

the class ApplicationConvergenceCheckerTest method setup.

@Before
public void setup() throws IOException, SAXException, InterruptedException {
    Model mockModel = MockModel.createContainer("localhost", 1337);
    application = new Application(mockModel, new ServerCache(), 3, Version.fromIntValues(0, 0, 0), MetricUpdater.createTestUpdater(), appId);
}
Also used : ServerCache(com.yahoo.vespa.config.server.ServerCache) Model(com.yahoo.config.model.api.Model) Before(org.junit.Before)

Example 9 with ServerCache

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

the class ApplicationTest method createCacheAndAddContent.

private static ServerCache createCacheAndAddContent() {
    ServerCache cache = new ServerCache();
    final ConfigDefinitionKey key = new ConfigDefinitionKey(SimpletypesConfig.CONFIG_DEF_NAME, SimpletypesConfig.CONFIG_DEF_NAMESPACE);
    com.yahoo.vespa.config.buildergen.ConfigDefinition def = getDef(key, SimpletypesConfig.CONFIG_DEF_SCHEMA);
    // TODO Why do we have to use empty def md5 here?
    cache.addDef(key, def);
    final ConfigDefinitionKey key2 = new ConfigDefinitionKey(SlobroksConfig.CONFIG_DEF_NAME, SlobroksConfig.CONFIG_DEF_NAMESPACE);
    com.yahoo.vespa.config.buildergen.ConfigDefinition def2 = getDef(key2, SlobroksConfig.CONFIG_DEF_SCHEMA);
    cache.addDef(key2, def2);
    final ConfigDefinitionKey key3 = new ConfigDefinitionKey(LogdConfig.CONFIG_DEF_NAME, LogdConfig.CONFIG_DEF_NAMESPACE);
    com.yahoo.vespa.config.buildergen.ConfigDefinition def3 = getDef(key3, LogdConfig.CONFIG_DEF_SCHEMA);
    cache.addDef(key3, def3);
    return cache;
}
Also used : ServerCache(com.yahoo.vespa.config.server.ServerCache) ConfigDefinitionKey(com.yahoo.vespa.config.ConfigDefinitionKey)

Aggregations

ServerCache (com.yahoo.vespa.config.server.ServerCache)9 Application (com.yahoo.vespa.config.server.application.Application)4 VespaModel (com.yahoo.vespa.model.VespaModel)4 Test (org.junit.Test)3 ApplicationId (com.yahoo.config.provision.ApplicationId)2 MetricUpdater (com.yahoo.vespa.config.server.monitoring.MetricUpdater)2 File (java.io.File)2 Before (org.junit.Before)2 Model (com.yahoo.config.model.api.Model)1 ModelContext (com.yahoo.config.model.api.ModelContext)1 MockFileRegistry (com.yahoo.config.model.application.provider.MockFileRegistry)1 Version (com.yahoo.config.provision.Version)1 ConfigDefinitionKey (com.yahoo.vespa.config.ConfigDefinitionKey)1 ConfigKey (com.yahoo.vespa.config.ConfigKey)1 ModelStub (com.yahoo.vespa.config.server.ModelStub)1 ApplicationSet (com.yahoo.vespa.config.server.application.ApplicationSet)1 ModelContextImpl (com.yahoo.vespa.config.server.deploy.ModelContextImpl)1