EventFacadeEjb implements EventFacade { @Override @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void archiveAllArchivableEvents(int daysAfterEventGetsArchived) { archiveAllArchivableEvents(daysAfterEventGetsArchived, LocalDate.now()); }  @Override List<String> getAllActiveUuids(); @Override List<EventDto> getAllActiveEventsAfter(Date date); @Override List<EventDto> getByUuids(List<String> uuids); @Override List<String> getDeletedUuidsSince(Date since); @Override List<DashboardEventDto> getNewEventsForDashboard(EventCriteria eventCriteria); Map<Disease, Long> getEventCountByDisease(EventCriteria eventCriteria); Map<EventStatus, Long> getEventCountByStatus(EventCriteria eventCriteria); @Override EventDto getEventByUuid(String uuid); @Override EventReferenceDto getReferenceByUuid(String uuid); @Override EventDto saveEvent(EventDto dto); @Override void deleteEvent(String eventUuid); @Override long count(EventCriteria eventCriteria); @Override List<EventIndexDto> getIndexList(EventCriteria eventCriteria, Integer first, Integer max, List<SortProperty> sortProperties); @Override List<EventExportDto> getExportList(EventCriteria eventCriteria, Integer first, Integer max); @Override boolean isArchived(String eventUuid); @Override boolean isDeleted(String eventUuid); @Override void archiveOrDearchiveEvent(String eventUuid, boolean archive); @Override List<String> getArchivedUuidsSince(Date since); Event fromDto(@NotNull EventDto source); EventDto convertToDto(Event source, Pseudonymizer pseudonymizer); static EventReferenceDto toReferenceDto(Event entity); static EventDto toDto(Event source); @Override @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) void archiveAllArchivableEvents(int daysAfterEventGetsArchived); @Override boolean exists(String uuid); @Override String getUuidByCaseUuidOrPersonUuid(String searchTerm); Boolean isEventEditAllowed(String eventUuid);  }
@Test public void testArchiveAllArchivableEvents() { RDCFEntities rdcfEntities = creator.createRDCFEntities(); RDCF rdcf = creator.createRDCF(); UserReferenceDto user = creator.createUser(rdcfEntities).toReference(); EventDto event1 = creator.createEvent( EventStatus.EVENT, "", "", "", "", "", TypeOfPlace.MEANS_OF_TRANSPORT, new Date(), new Date(), user, user, Disease.ANTHRAX, rdcf.district); EventFacadeEjbLocal cut = getBean(EventFacadeEjbLocal.class); cut.archiveOrDearchiveEvent(event1.getUuid(), true); EventDto event2 = creator.createEvent( EventStatus.SIGNAL, "", "", "", "", "", TypeOfPlace.HOSPITAL, new Date(), new Date(), user, user, Disease.DENGUE, rdcf.district); assertTrue(cut.isArchived(event1.getUuid())); assertFalse(cut.isArchived(event2.getUuid())); cut.archiveAllArchivableEvents(70, LocalDate.now().plusDays(69)); assertTrue(cut.isArchived(event1.getUuid())); assertFalse(cut.isArchived(event2.getUuid())); cut.archiveAllArchivableEvents(70, LocalDate.now().plusDays(71)); assertTrue(cut.isArchived(event1.getUuid())); assertTrue(cut.isArchived(event2.getUuid())); }