Search in sources :

Example 41 with ConfigPayload

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

Aggregations

ConfigPayload (com.yahoo.vespa.config.ConfigPayload)41 Test (org.junit.Test)29 InnerCNode (com.yahoo.config.codegen.InnerCNode)10 SimpletypesConfig (com.yahoo.config.SimpletypesConfig)6 Slime (com.yahoo.slime.Slime)6 Element (org.w3c.dom.Element)6 HttpResponse (com.yahoo.container.jdisc.HttpResponse)5 FunctionTestConfig (com.yahoo.foo.FunctionTestConfig)4 SimpletypesConfig (com.yahoo.foo.SimpletypesConfig)4 DefParser (com.yahoo.config.codegen.DefParser)3 HandlerTest (com.yahoo.vespa.config.server.http.HandlerTest)3 SessionHandlerTest (com.yahoo.vespa.config.server.http.SessionHandlerTest)3 StringReader (java.io.StringReader)3 ConfigurationRuntimeException (com.yahoo.config.ConfigurationRuntimeException)2 ApplicationId (com.yahoo.config.provision.ApplicationId)2 CfgConfigPayloadBuilder (com.yahoo.config.subscription.CfgConfigPayloadBuilder)2 ConfigInterruptedException (com.yahoo.config.subscription.ConfigInterruptedException)2 HttpRequest (com.yahoo.container.jdisc.HttpRequest)2 Utf8Array (com.yahoo.text.Utf8Array)2 ConfigCacheKey (com.yahoo.vespa.config.ConfigCacheKey)2