use of de.symeda.sormas.api.user.UserDto in project SORMAS-Project by hzi-braunschweig.
the class CaseFacadeEjbTest method testGetIndexListByFreeText.
@Test
public void testGetIndexListByFreeText() {
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("FirstName1", "LastName1", p -> {
p.getAddress().setPostalCode("10115");
p.getAddress().setCity("Berlin");
p.setPhone("+4930-90-1820");
});
creator.createCase(user.toReference(), person1.toReference(), Disease.EVD, CaseClassification.PROBABLE, InvestigationStatus.PENDING, new Date(), rdcf);
PersonDto person2 = creator.createPerson("FirstName2", "LastName2", p -> {
p.getAddress().setPostalCode("20095");
p.getAddress().setCity("Hamburg");
p.setPhone("+49-30-901822");
});
creator.createCase(user.toReference(), person2.toReference(), Disease.EVD, CaseClassification.PROBABLE, InvestigationStatus.PENDING, new Date(), rdcf);
PersonDto person3 = creator.createPerson("FirstName3", "Last Name3", p -> {
p.getAddress().setPostalCode("80331");
p.getAddress().setCity("Munich");
p.setPhone("+49 31 9018 20");
});
creator.createCase(user.toReference(), person3.toReference(), Disease.EVD, CaseClassification.PROBABLE, InvestigationStatus.PENDING, new Date(), rdcf);
Assert.assertEquals(3, getCaseFacade().getIndexList(null, 0, 100, null).size());
Assert.assertEquals(1, getCaseFacade().getIndexList(new CaseCriteria().personLike("Munich"), 0, 100, null).size());
Assert.assertEquals(1, getCaseFacade().getIndexList(new CaseCriteria().personLike("Last Name3"), 0, 100, null).size());
Assert.assertEquals(1, getCaseFacade().getIndexList(new CaseCriteria().personLike("20095"), 0, 100, null).size());
Assert.assertEquals(2, getCaseFacade().getIndexList(new CaseCriteria().personLike("+49-31-901-820"), 0, 100, null).size());
Assert.assertEquals(1, getCaseFacade().getIndexList(new CaseCriteria().personLike("4930901822"), 0, 100, null).size());
}
use of de.symeda.sormas.api.user.UserDto in project SORMAS-Project by hzi-braunschweig.
the class CaseFacadeEjbTest method testGetIndexList.
@Test
public void testGetIndexList() {
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);
String lastName = "Person";
PersonDto cazePerson = creator.createPerson("Case", lastName);
creator.createCase(user.toReference(), cazePerson.toReference(), Disease.EVD, CaseClassification.PROBABLE, InvestigationStatus.PENDING, new Date(), rdcf);
creator.createCase(user.toReference(), cazePerson.toReference(), Disease.EVD, CaseClassification.PROBABLE, InvestigationStatus.PENDING, new Date(), rdcf, c -> c.setHealthFacilityDetails("abc"));
creator.createCase(user.toReference(), cazePerson.toReference(), Disease.EVD, CaseClassification.PROBABLE, InvestigationStatus.PENDING, new Date(), rdcf, c -> c.setHealthFacilityDetails("xyz"));
List<CaseIndexDto> results = getCaseFacade().getIndexList(null, 0, 100, Arrays.asList(new SortProperty(CaseIndexDto.DISEASE), new SortProperty(CaseIndexDto.PERSON_FIRST_NAME), new SortProperty(CaseIndexDto.RESPONSIBLE_DISTRICT_NAME), new SortProperty(CaseIndexDto.HEALTH_FACILITY_NAME, false), new SortProperty(CaseIndexDto.SURVEILLANCE_OFFICER_UUID)));
// List should have one entry
assertEquals(3, results.size());
assertEquals(districtName, results.get(0).getResponsibleDistrictName());
assertEquals(lastName, results.get(0).getPersonLastName());
assertEquals("Facility - xyz", results.get(0).getHealthFacilityName());
assertEquals("Facility - abc", results.get(1).getHealthFacilityName());
assertEquals("Facility", results.get(2).getHealthFacilityName());
}
use of de.symeda.sormas.api.user.UserDto in project SORMAS-Project by hzi-braunschweig.
the class CaseFacadeEjbTest method testGetDuplicateCasesOfDifferentSexAndSameBirthDateIsEmpty.
@Test
public void testGetDuplicateCasesOfDifferentSexAndSameBirthDateIsEmpty() {
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.FEMALE, 1980, 1, 1);
creator.createCase(user.toReference(), cazePerson2.toReference(), Disease.EVD, CaseClassification.PROBABLE, InvestigationStatus.PENDING, DateUtils.addMinutes(today, -3), rdcf);
Assert.assertEquals(0, getCaseFacade().getCasesForDuplicateMerging(new CaseCriteria().creationDateFrom(today).creationDateTo(today), true).size());
}
use of de.symeda.sormas.api.user.UserDto 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);
CaseDataDto case2 = creator.createCase(user.toReference(), person2.toReference(), Disease.EVD, CaseClassification.PROBABLE, InvestigationStatus.PENDING, new Date(), rdcf);
event1Participant1.setResultingCase(case1.toReference());
getEventParticipantFacade().saveEventParticipant(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.user.UserDto in project SORMAS-Project by hzi-braunschweig.
the class ContactFacadeEjbTest method testGetIndexListWithLabUser.
@Test
public void testGetIndexListWithLabUser() {
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");
CaseDataDto caze = creator.createCase(user.toReference(), cazePerson.toReference(), Disease.EVD, CaseClassification.PROBABLE, InvestigationStatus.PENDING, new Date(), rdcf);
PersonDto contactPerson = creator.createPerson("Contact", "Person");
ContactDto contact = creator.createContact(user.toReference(), user.toReference(), contactPerson.toReference(), caze, new Date(), new Date(), null);
UserDto labUser = creator.createUser(null, null, null, "Lab", "Off", UserRole.LAB_USER);
FacilityReferenceDto laboratory = new FacilityReferenceDto(rdcf.facility.getUuid(), rdcf.facility.toString(), rdcf.facility.getExternalID());
labUser.setLaboratory(laboratory);
getUserFacade().saveUser(labUser);
loginWith(labUser);
assertEquals(0, getContactFacade().getIndexList(null, 0, 100, null).size());
loginWith(user);
creator.createSample(contact.toReference(), user.toReference(), laboratory, s -> {
s.setSampleDateTime(new Date());
s.setComment("Test contact sample");
});
loginWith(labUser);
assertEquals(1, getContactFacade().getIndexList(null, 0, 100, null).size());
}
Aggregations