use of de.symeda.sormas.api.caze.CaseCriteria in project SORMAS-Project by hzi-braunschweig.
the class CaseFacadeEjbTest method testGetDuplicateCasesOfSexUnknownAndSameBirthDateMatches.
@Test
public void testGetDuplicateCasesOfSexUnknownAndSameBirthDateMatches() {
final Date today = new Date();
RDCFEntities rdcf = creator.createRDCFEntities("Region", "District", "Community", "Facility");
UserDto user = creator.createUser(rdcf.region.getUuid(), rdcf.district.getUuid(), rdcf.facility.getUuid(), "Surv", "Sup", UserRole.SURVEILLANCE_SUPERVISOR);
PersonDto cazePerson = creator.createPerson("Case", "Person", Sex.MALE, 1980, 1, 1);
creator.createCase(user.toReference(), cazePerson.toReference(), Disease.EVD, CaseClassification.PROBABLE, InvestigationStatus.PENDING, today, rdcf);
PersonDto cazePerson2 = creator.createPerson("Case", "Person", Sex.UNKNOWN, 1980, 1, 1);
creator.createCase(user.toReference(), cazePerson2.toReference(), Disease.EVD, CaseClassification.PROBABLE, InvestigationStatus.PENDING, DateUtils.addMinutes(today, -3), rdcf);
Assert.assertEquals(1, getCaseFacade().getCasesForDuplicateMerging(new CaseCriteria().creationDateFrom(today).creationDateTo(today), true).size());
}
use of de.symeda.sormas.api.caze.CaseCriteria in project SORMAS-Project by hzi-braunschweig.
the class CaseFacadeEjbTest method testGetIndexListByEventFreeText.
@Test
public void testGetIndexListByEventFreeText() {
String districtName = "District";
RDCF rdcf = creator.createRDCF("Region", districtName, "Community", "Facility");
useSurveillanceOfficerLogin(rdcf);
UserDto user = creator.createUser(rdcf.region.getUuid(), rdcf.district.getUuid(), rdcf.facility.getUuid(), "Surv", "Sup", UserRole.SURVEILLANCE_SUPERVISOR);
PersonDto person1 = creator.createPerson();
PersonDto person2 = creator.createPerson();
EventDto event1 = creator.createEvent(EventStatus.SIGNAL, EventInvestigationStatus.PENDING, "Signal foo", "A long description for this event", user.toReference(), eventDto -> {
});
EventParticipantDto event1Participant1 = creator.createEventParticipant(event1.toReference(), person1, user.toReference());
EventParticipantDto event1Participant2 = creator.createEventParticipant(event1.toReference(), person2, user.toReference());
CaseDataDto case1 = creator.createCase(user.toReference(), person1.toReference(), Disease.EVD, CaseClassification.PROBABLE, InvestigationStatus.PENDING, new Date(), rdcf);
creator.createCase(user.toReference(), person2.toReference(), Disease.EVD, CaseClassification.PROBABLE, InvestigationStatus.PENDING, new Date(), rdcf);
event1Participant1.setResultingCase(case1.toReference());
getEventParticipantFacade().save(event1Participant1);
Assert.assertEquals(2, getCaseFacade().getIndexList(null, 0, 100, null).size());
Assert.assertEquals(1, getCaseFacade().getIndexList(new CaseCriteria().eventLike("signal"), 0, 100, null).size());
Assert.assertEquals(1, getCaseFacade().getIndexList(new CaseCriteria().eventLike(event1.getUuid()), 0, 100, null).size());
Assert.assertEquals(1, getCaseFacade().getIndexList(new CaseCriteria().eventLike("signal description"), 0, 100, null).size());
}
use of de.symeda.sormas.api.caze.CaseCriteria in project SORMAS-Project by hzi-braunschweig.
the class CaseFacadeEjbUserFilterTest method testGetCasesOnNationalLevel.
@Test
public void testGetCasesOnNationalLevel() {
loginWith(nationalUser);
createCase(rdcf2, districtUser2);
createCase(rdcf1, districtUser1);
List<CaseIndexDto> indexList = getCaseFacade().getIndexList(new CaseCriteria(), 0, 100, null);
assertThat(indexList, hasSize(2));
}
use of de.symeda.sormas.api.caze.CaseCriteria in project SORMAS-Project by hzi-braunschweig.
the class CaseFacadeEjbUserFilterTest method testGetCasesOnCommunityLevel.
@Test
public void testGetCasesOnCommunityLevel() {
loginWith(communityUser);
CaseDataDto visibleCase = createCase(rdcf2, districtUser2);
createCase(rdcf1, districtUser1);
List<CaseIndexDto> indexList = getCaseFacade().getIndexList(new CaseCriteria(), 0, 100, null);
assertThat(indexList, hasSize(1));
assertThat(indexList.get(0).getUuid(), is(visibleCase.getUuid()));
}
use of de.symeda.sormas.api.caze.CaseCriteria in project SORMAS-Project by hzi-braunschweig.
the class CaseFacadeEjbUserFilterTest method testGetCasesOnRegionLevel.
@Test
public void testGetCasesOnRegionLevel() {
loginWith(regionUser);
CaseDataDto visibleCase = createCase(rdcf2, districtUser2);
createCase(rdcf1, districtUser1);
List<CaseIndexDto> indexList = getCaseFacade().getIndexList(new CaseCriteria(), 0, 100, null);
assertThat(indexList, hasSize(1));
assertThat(indexList.get(0).getUuid(), is(visibleCase.getUuid()));
}
Aggregations