Search in sources :

Example 1 with CaseFacadeEjbLocal

use of de.symeda.sormas.backend.caze.CaseFacadeEjb.CaseFacadeEjbLocal in project SORMAS-Project by hzi-braunschweig.

the class CaseFacadeEjbTest method testArchiveAllArchivableCases.

@Test
public void testArchiveAllArchivableCases() {
    RDCFEntities rdcf = creator.createRDCFEntities();
    UserReferenceDto user = creator.createUser(rdcf).toReference();
    PersonReferenceDto person = creator.createPerson("Walter", "Schuster").toReference();
    // One archived case
    CaseDataDto case1 = creator.createCase(user, person, rdcf);
    CaseFacadeEjbLocal cut = getBean(CaseFacadeEjbLocal.class);
    cut.archive(case1.getUuid(), null);
    // One other case
    CaseDataDto case2 = creator.createCase(user, person, rdcf);
    assertTrue(cut.isArchived(case1.getUuid()));
    assertFalse(cut.isArchived(case2.getUuid()));
    // Case of "today" shouldn't be archived
    cut.archiveAllArchivableCases(70, LocalDate.now().plusDays(69));
    assertTrue(cut.isArchived(case1.getUuid()));
    assertFalse(cut.isArchived(case2.getUuid()));
    // Case of "yesterday" should be archived
    cut.archiveAllArchivableCases(70, LocalDate.now().plusDays(71));
    assertTrue(cut.isArchived(case1.getUuid()));
    assertTrue(cut.isArchived(case2.getUuid()));
}
Also used : UserReferenceDto(de.symeda.sormas.api.user.UserReferenceDto) RDCFEntities(de.symeda.sormas.backend.TestDataCreator.RDCFEntities) CaseFacadeEjbLocal(de.symeda.sormas.backend.caze.CaseFacadeEjb.CaseFacadeEjbLocal) CaseDataDto(de.symeda.sormas.api.caze.CaseDataDto) PersonReferenceDto(de.symeda.sormas.api.person.PersonReferenceDto) AbstractBeanTest(de.symeda.sormas.backend.AbstractBeanTest) Test(org.junit.Test)

Aggregations

CaseDataDto (de.symeda.sormas.api.caze.CaseDataDto)1 PersonReferenceDto (de.symeda.sormas.api.person.PersonReferenceDto)1 UserReferenceDto (de.symeda.sormas.api.user.UserReferenceDto)1 AbstractBeanTest (de.symeda.sormas.backend.AbstractBeanTest)1 RDCFEntities (de.symeda.sormas.backend.TestDataCreator.RDCFEntities)1 CaseFacadeEjbLocal (de.symeda.sormas.backend.caze.CaseFacadeEjb.CaseFacadeEjbLocal)1 Test (org.junit.Test)1