ApplicationEntity extends HierarchicalTimelineEntity { public static TimelineEvent getApplicationEvent(TimelineEntity te, String eventId) { if (isApplicationEntity(te)) { for (TimelineEvent event : te.getEvents()) { if (event.getId().equals(eventId)) { return event; } } } return null; } ApplicationEntity();  ApplicationEntity(TimelineEntity entity); String getQueue(); void setQueue(String queue); static boolean isApplicationEntity(TimelineEntity te); static TimelineEvent getApplicationEvent(TimelineEntity te,
      String eventId); static final String QUEUE_INFO_KEY; }
@Test public void testGetApplicationEvent() { TimelineEntity te = null; TimelineEvent tEvent = ApplicationEntity.getApplicationEvent(te, "no event"); assertEquals(null, tEvent); te = new TimelineEntity(); te.setType(TimelineEntityType.YARN_APPLICATION.toString()); TimelineEvent event = new TimelineEvent(); event.setId("start_event"); event.setTimestamp(System.currentTimeMillis()); te.addEvent(event); tEvent = ApplicationEntity.getApplicationEvent(te, "start_event"); assertEquals(event, tEvent); te = new TimelineEntity(); te.setType(TimelineEntityType.YARN_CLUSTER.toString()); event = new TimelineEvent(); event.setId("start_event_cluster"); event.setTimestamp(System.currentTimeMillis()); te.addEvent(event); tEvent = ApplicationEntity.getApplicationEvent(te, "start_event_cluster"); assertEquals(null, tEvent); }