Search in sources :

Example 11 with EventInformation

use of com.hortonworks.streamline.streams.common.event.EventInformation in project streamline by hortonworks.

the class TopologyTestRunResource method getEventSubTreeOfTestRunTopologyHistory.

@GET
@Path("/topologies/{topologyId}/testhistories/{historyId}/events/tree/{rootEventId}/subtree/{subRootEventId}")
public Response getEventSubTreeOfTestRunTopologyHistory(@Context UriInfo urlInfo, @PathParam("topologyId") Long topologyId, @PathParam("historyId") Long historyId, @PathParam("rootEventId") String rootEventId, @PathParam("subRootEventId") String subRootEventId, @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);
    EventInformationTreeNode subRootEventNode = new EventInformationTreeBuilder(events).constructEventTree(rootEventId, subRootEventId);
    if (subRootEventNode == null) {
        throw BadRequestException.message("Can't find provided root event " + rootEventId + " from events.");
    }
    return WSUtils.respondEntity(subRootEventNode, OK);
}
Also used : EventInformationTreeBuilder(com.hortonworks.streamline.streams.common.event.tree.EventInformationTreeBuilder) EventInformation(com.hortonworks.streamline.streams.common.event.EventInformation) EventInformationTreeNode(com.hortonworks.streamline.streams.common.event.tree.EventInformationTreeNode) File(java.io.File) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Aggregations

EventInformation (com.hortonworks.streamline.streams.common.event.EventInformation)11 File (java.io.File)5 GET (javax.ws.rs.GET)5 Path (javax.ws.rs.Path)5 Test (org.junit.Test)4 CorrelatedEventsGrouper (com.hortonworks.streamline.streams.common.event.correlation.CorrelatedEventsGrouper)3 EventInformationTreeBuilder (com.hortonworks.streamline.streams.common.event.tree.EventInformationTreeBuilder)3 EventInformationTreeNode (com.hortonworks.streamline.streams.common.event.tree.EventInformationTreeNode)3 GroupedCorrelationEvents (com.hortonworks.streamline.streams.common.event.correlation.GroupedCorrelationEvents)2 IOException (java.io.IOException)2 QueryParam (javax.ws.rs.QueryParam)2 Timed (com.codahale.metrics.annotation.Timed)1 JsonIgnoreProperties (com.fasterxml.jackson.annotation.JsonIgnoreProperties)1 TypeReference (com.fasterxml.jackson.core.type.TypeReference)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Schema (com.hortonworks.registries.common.Schema)1 SchemaValueConverter (com.hortonworks.streamline.common.SchemaValueConverter)1 SchemaValidationFailedException (com.hortonworks.streamline.common.exception.SchemaValidationFailedException)1 BadRequestException (com.hortonworks.streamline.common.exception.service.exception.request.BadRequestException)1 EntityNotFoundException (com.hortonworks.streamline.common.exception.service.exception.request.EntityNotFoundException)1