Role role = SessionTestHelper.createNewRoleForSubject(em, subject, "fake role");
ResourceGroup resourceGroup = SessionTestHelper.createNewCompatibleGroupForRole(em, role, "fake group");
Resource resource = SessionTestHelper.createNewResourceForGroup(em, resourceGroup, "fake resource");
EventDefinition eventDefinition = createEventDefinition(resource);
em.persist(eventDefinition);
EventSource eventSource = createEventSource(eventDefinition, resource);
em.persist(eventSource);
int fatalEventCount = 7;
for (int i = 0; i < fatalEventCount; i++) {
Event event = createEvent(eventSource, EventSeverity.FATAL);
em.persist(event);