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;
}
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\"}"));
}
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));
}
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));
}
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);
}
Aggregations