@GET
@Path("/topologies/{topologyId}/testhistories/{historyId}/events/root")
public Response getRootEventsOfTestRunTopologyHistory(@Context UriInfo urlInfo,
@PathParam("topologyId") Long topologyId,
@PathParam("historyId") Long historyId,
@Context SecurityContext securityContext) throws Exception {
SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER,
Topology.NAMESPACE, topologyId, READ);
File eventLogFile = getEventLogFile(topologyId, historyId);
List<EventInformation> events = eventLogFileReader.loadEventLogFile(eventLogFile);
List<com.hortonworks.registries.common.QueryParam> qps = com.hortonworks.registries.common.QueryParam.params(
TopologySource.TOPOLOGYID, topologyId.toString(),
TopologySource.VERSIONID, catalogService.getCurrentVersionId(topologyId).toString());
Set<String> sourceNames = catalogService.listTopologySources(qps).stream()
.map(TopologyComponent::getName)
.collect(Collectors.toSet());
return WSUtils.respondEntities(new CorrelatedEventsGrouper(events).groupByRelatedSourceEvents(sourceNames), OK);
}