use of com.yahoo.yolean.trace.TraceNode in project vespa by vespa-engine.
the class JsonRendererTestCase method testTracingOfNestedNodesWithDataAndSubnodes.
@Test
public final void testTracingOfNestedNodesWithDataAndSubnodes() throws IOException, InterruptedException, ExecutionException {
String expected = "{\n" + " \"root\": {\n" + " \"fields\": {\n" + " \"totalCount\": 0\n" + " },\n" + " \"id\": \"toplevel\",\n" + " \"relevance\": 1.0\n" + " },\n" + " \"trace\": {\n" + " \"children\": [\n" + " {\n" + " \"message\": \"No query profile is used\"\n" + " },\n" + " {\n" + " \"children\": [\n" + " {\n" + " \"message\": \"string payload\",\n" + " \"children\": [\n" + " {\n" + " \"children\": [\n" + " {\n" + " \"message\": \"in OO languages, nesting is for birds\"\n" + " }\n" + " ]\n" + " }\n" + " ]\n" + " }\n" + " ]\n" + " }\n" + " ]\n" + " }\n" + "}\n";
Query q = new Query("/?query=a&tracelevel=1");
Execution execution = new Execution(Execution.Context.createContextStub());
Result r = new Result(q);
execution.search(q);
final TraceNode child = new TraceNode("string payload", 0L);
final TraceNode childOfChild = new TraceNode(null, 0L);
child.add(childOfChild);
childOfChild.add(new TraceNode("in OO languages, nesting is for birds", 0L));
execution.trace().traceNode().add(child);
String summary = render(execution, r);
assertEqualJson(expected, summary);
}
use of com.yahoo.yolean.trace.TraceNode in project vespa by vespa-engine.
the class SlimeTraceSerializerTest method test_string.
@Test
public void test_string() throws IOException {
TraceNode root = new TraceNode("bar", 5);
assertThat(toJson(root), is("{\"timestamp\":5,\"payload\":\"bar\"}"));
assertSerialize(root);
}
use of com.yahoo.yolean.trace.TraceNode in project vespa by vespa-engine.
the class SlimeTraceSerializerTest method test_serializer.
@Test
public void test_serializer() throws IOException {
TraceNode root = new TraceNode(null, 1);
root.add(new TraceNode("foo", 4));
root.add(new TraceNode("bar", 5).add(new TraceNode("baz", 2).add(new TraceNode("quux", 10))));
assertThat(toJson(root), is("{\"timestamp\":1,\"children\":[{\"timestamp\":5,\"payload\":\"bar\",\"children\":[{\"timestamp\":2,\"payload\":\"baz\",\"children\":[{\"timestamp\":10,\"payload\":\"quux\"}]}]},{\"timestamp\":4,\"payload\":\"foo\"}]}"));
assertSerialize(root);
}
use of com.yahoo.yolean.trace.TraceNode in project vespa by vespa-engine.
the class SlimeTraceSerializerTest method test_bool.
@Test
public void test_bool() throws IOException {
TraceNode root = new TraceNode(true, 5);
assertThat(toJson(root), is("{\"timestamp\":5,\"payload\":true}"));
assertSerialize(root);
}
use of com.yahoo.yolean.trace.TraceNode in project vespa by vespa-engine.
the class SlimeTraceSerializerTest method test_bytearray.
@Test
public void test_bytearray() throws IOException {
TraceNode root = new TraceNode(new byte[] { 3, 5 }, 5);
assertThat(toJson(root), is("{\"timestamp\":5,\"payload\":\"0x0305\"}"));
assertSerialize(root);
}
Aggregations