TraceService extends SearchableService { public JsonNode getTrace(String traceId) { DocumentPage docs = this.docMgr.read( new ServerTransform("mlTraceUISearchResults"), "/" + traceId, "/" + traceId + ".json", "/" + traceId + ".xml"); if (docs.size() < 1) { throw new DataHubException("Could not find traceId " + traceId, null); } ObjectMapper mapper = new ObjectMapper(); StringHandle traceStr = docs.nextContent(new StringHandle()); JsonNode result = null; try { result = mapper.readTree(traceStr.toString()); } catch (IOException e) { e.printStackTrace(); } return result; } TraceService(DatabaseClient client); StringHandle getTraces(TraceQuery traceQuery); JsonNode getTrace(String traceId);  }
@Test @Disabled public void getTrace() throws IOException { TraceService tm = new TraceService(traceClient); TraceQuery traceQuery = new TraceQuery(); traceQuery.start = 1L; traceQuery.count = 1L; StringHandle traces = tm.getTraces(traceQuery); String resultStr = traces.toString(); ObjectMapper mapper = new ObjectMapper(); JsonNode node = mapper.readTree(resultStr); JsonNode results = node.findValue("results"); String traceId = results.get(0).findValue("content").findValue("traceId").asText(); JsonNode trace = tm.getTrace(traceId); assertNotNull(trace); assertEquals(traceId, trace.findValue("traceId").asText()); }