Search in sources :

Example 6 with ConfigResponse

use of com.yahoo.vespa.config.protocol.ConfigResponse in project vespa by vespa-engine.

the class SuperModelRequestHandler method resolveConfig.

@Override
public ConfigResponse resolveConfig(ApplicationId appId, GetConfigRequest req, Optional<Version> vespaVersion) {
    log.log(LogLevel.DEBUG, () -> "SuperModelRequestHandler resolving " + req + " for app id '" + appId + "'");
    if (handler != null) {
        ConfigResponse configResponse = handler.resolveConfig(req);
        log.log(LogLevel.DEBUG, () -> "SuperModelRequestHandler returning response for config " + req + " with generation " + configResponse.getGeneration());
        return configResponse;
    }
    return null;
}
Also used : ConfigResponse(com.yahoo.vespa.config.protocol.ConfigResponse)

Example 7 with ConfigResponse

use of com.yahoo.vespa.config.protocol.ConfigResponse in project vespa by vespa-engine.

the class HttpConfigResponseTest method require_that_response_is_created_from_config.

@Test
public void require_that_response_is_created_from_config() throws IOException {
    final long generation = 1L;
    ConfigPayload payload = ConfigPayload.fromInstance(new SimpletypesConfig(new SimpletypesConfig.Builder()));
    // TODO: Hope to be able to remove this mess soon.
    DefParser dParser = new DefParser(SimpletypesConfig.getDefName(), new StringReader(StringUtilities.implode(SimpletypesConfig.CONFIG_DEF_SCHEMA, "\n")));
    InnerCNode targetDef = dParser.getTree();
    ConfigResponse configResponse = SlimeConfigResponse.fromConfigPayload(payload, targetDef, generation, "mymd5");
    HttpConfigResponse response = HttpConfigResponse.createFromConfig(configResponse);
    assertThat(SessionHandlerTest.getRenderedString(response), is("{\"boolval\":false,\"doubleval\":0.0,\"enumval\":\"VAL1\",\"intval\":0,\"longval\":0,\"stringval\":\"s\"}"));
}
Also used : SimpletypesConfig(com.yahoo.config.SimpletypesConfig) InnerCNode(com.yahoo.config.codegen.InnerCNode) ConfigPayload(com.yahoo.vespa.config.ConfigPayload) StringReader(java.io.StringReader) SlimeConfigResponse(com.yahoo.vespa.config.protocol.SlimeConfigResponse) ConfigResponse(com.yahoo.vespa.config.protocol.ConfigResponse) DefParser(com.yahoo.config.codegen.DefParser) Test(org.junit.Test)

Example 8 with ConfigResponse

use of com.yahoo.vespa.config.protocol.ConfigResponse in project vespa by vespa-engine.

the class ConfigResponseFactoryTest method testUncompressedFacory.

@Test
public void testUncompressedFacory() {
    UncompressedConfigResponseFactory responseFactory = new UncompressedConfigResponseFactory();
    ConfigResponse response = responseFactory.createResponse(ConfigPayload.empty(), def, 3);
    assertThat(response.getCompressionInfo().getCompressionType(), is(CompressionType.UNCOMPRESSED));
    assertThat(response.getGeneration(), is(3l));
    assertThat(response.getPayload().getByteLength(), is(2));
}
Also used : ConfigResponse(com.yahoo.vespa.config.protocol.ConfigResponse) Test(org.junit.Test)

Example 9 with ConfigResponse

use of com.yahoo.vespa.config.protocol.ConfigResponse in project vespa by vespa-engine.

the class ServerCacheTest method testThatCacheWorksWithSameKeyDifferentMd5.

@Test
public void testThatCacheWorksWithSameKeyDifferentMd5() {
    assertThat(cache.getDef(fooBarDefKey), is(payload));
    ConfigResponse raw = cache.get(fooBarCacheKey);
    assertThat(raw.getConfigMd5(), is(configMd5));
    raw = cache.get(fooBarCacheKeyDifferentMd5);
    assertThat(raw.getConfigMd5(), is(configMd5_2));
}
Also used : SlimeConfigResponse(com.yahoo.vespa.config.protocol.SlimeConfigResponse) ConfigResponse(com.yahoo.vespa.config.protocol.ConfigResponse) Test(org.junit.Test)

Example 10 with ConfigResponse

use of com.yahoo.vespa.config.protocol.ConfigResponse in project vespa by vespa-engine.

the class ApplicationTest method require_that_configs_are_cached.

@Test
public void require_that_configs_are_cached() {
    ConfigResponse response = handler.resolveConfig(createRequest(ModelConfig.CONFIG_DEF_NAME, ModelConfig.CONFIG_DEF_NAMESPACE, ModelConfig.CONFIG_DEF_MD5, ModelConfig.CONFIG_DEF_SCHEMA));
    assertNotNull(response);
    ConfigResponse cached_response = handler.resolveConfig(createRequest(ModelConfig.CONFIG_DEF_NAME, ModelConfig.CONFIG_DEF_NAMESPACE, ModelConfig.CONFIG_DEF_MD5, ModelConfig.CONFIG_DEF_SCHEMA));
    assertNotNull(cached_response);
    assertTrue(response == cached_response);
}
Also used : ConfigResponse(com.yahoo.vespa.config.protocol.ConfigResponse) Test(org.junit.Test)

Aggregations

ConfigResponse (com.yahoo.vespa.config.protocol.ConfigResponse)10 Test (org.junit.Test)6 SlimeConfigResponse (com.yahoo.vespa.config.protocol.SlimeConfigResponse)3 ConfigPayload (com.yahoo.vespa.config.ConfigPayload)2 ConfigurationRuntimeException (com.yahoo.config.ConfigurationRuntimeException)1 SimpletypesConfig (com.yahoo.config.SimpletypesConfig)1 DefParser (com.yahoo.config.codegen.DefParser)1 InnerCNode (com.yahoo.config.codegen.InnerCNode)1 ConfigCacheKey (com.yahoo.vespa.config.ConfigCacheKey)1 ConfigDefinition (com.yahoo.vespa.config.buildergen.ConfigDefinition)1 UnknownConfigDefinitionException (com.yahoo.vespa.config.server.UnknownConfigDefinitionException)1 HttpConfigResponse (com.yahoo.vespa.config.server.http.HttpConfigResponse)1 StringReader (java.io.StringReader)1