use of de.symeda.sormas.api.sample.SampleDto in project SORMAS-Project by hzi-braunschweig.
the class PathogenTestFacadeEjbPseudonymizationTest method testPathogenTestOnSampleOutsideJurisdiction.
@Test
public void testPathogenTestOnSampleOutsideJurisdiction() {
Facility lab = getFacilityService().getByUuid(creator.createFacility("Lab", rdcf1.region, rdcf1.district, rdcf1.community).getUuid());
loginWith(user2);
CaseDataDto caze = creator.createCase(user1.toReference(), creator.createPerson("First", "Last").toReference(), rdcf1);
SampleDto sample = creator.createSample(caze.toReference(), user1.toReference(), lab);
PathogenTestDto pathogenTest = createPathogenTest(lab, sample, user1);
assertPseudonymized(getPathogenTestFacade().getByUuid(pathogenTest.getUuid()));
}
use of de.symeda.sormas.api.sample.SampleDto in project SORMAS-Project by hzi-braunschweig.
the class PathogenTestFacadeEjbPseudonymizationTest method updatePathogenTestInJurisdictionWithPseudonymizedDto.
@Test
public void updatePathogenTestInJurisdictionWithPseudonymizedDto() {
Facility lab = getFacilityService().getByUuid(creator.createFacility("Lab", rdcf2.region, rdcf2.district, rdcf2.community).getUuid());
loginWith(user2);
CaseDataDto caze = creator.createCase(user2.toReference(), creator.createPerson("First", "Last").toReference(), rdcf2);
SampleDto sample = creator.createSample(caze.toReference(), user2.toReference(), lab);
PathogenTestDto pathogenTest = createPathogenTest(lab, sample, user2);
pathogenTest.setPseudonymized(true);
pathogenTest.setLab(null);
pathogenTest.setLabUser(null);
getPathogenTestFacade().savePathogenTest(pathogenTest);
PathogenTest updatedTest = getPathogenTestService().getByUuid(pathogenTest.getUuid());
assertThat(updatedTest.getLab(), is(nullValue()));
assertThat(updatedTest.getLabUser().getUuid(), is(user2.getUuid()));
}
use of de.symeda.sormas.api.sample.SampleDto in project SORMAS-Project by hzi-braunschweig.
the class PathogenTestFacadeEjbPseudonymizationTest method testPseudonymizeGetAllActive.
@Test
public void testPseudonymizeGetAllActive() {
Facility lab1 = getFacilityService().getByUuid(creator.createFacility("Lab", rdcf2.region, rdcf2.district, rdcf2.community).getUuid());
Facility lab2 = getFacilityService().getByUuid(creator.createFacility("Lab", rdcf1.region, rdcf1.district, rdcf1.community).getUuid());
loginWith(user2);
CaseDataDto caze1 = creator.createCase(user2.toReference(), creator.createPerson("First", "Last").toReference(), rdcf2);
SampleDto sample1 = creator.createSample(caze1.toReference(), user2.toReference(), lab1);
PathogenTestDto pathogenTest1 = createPathogenTest(lab1, sample1, user2);
CaseDataDto caze2 = creator.createCase(user1.toReference(), creator.createPerson("First", "Last").toReference(), rdcf1);
creator.createContact(user2.toReference(), creator.createPerson("First", "Last").toReference(), caze2);
SampleDto sample2 = creator.createSample(caze2.toReference(), user1.toReference(), lab2);
PathogenTestDto pathogenTest2 = createPathogenTest(lab2, sample2, user1);
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, 2019);
List<PathogenTestDto> activeTests = getPathogenTestFacade().getAllActivePathogenTestsAfter(calendar.getTime());
assertNotPseudonymized(activeTests.stream().filter(t -> t.getUuid().equals(pathogenTest1.getUuid())).findFirst().get());
assertPseudonymized(activeTests.stream().filter(t -> t.getUuid().equals(pathogenTest2.getUuid())).findFirst().get());
}
use of de.symeda.sormas.api.sample.SampleDto in project SORMAS-Project by hzi-braunschweig.
the class PathogenTestFacadeEjbPseudonymizationTest method testPseudonymizeGetAllByUuds.
@Test
public void testPseudonymizeGetAllByUuds() {
Facility lab1 = getFacilityService().getByUuid(creator.createFacility("Lab", rdcf2.region, rdcf2.district, rdcf2.community).getUuid());
Facility lab2 = getFacilityService().getByUuid(creator.createFacility("Lab", rdcf1.region, rdcf1.district, rdcf1.community).getUuid());
loginWith(user2);
CaseDataDto caze1 = creator.createCase(user2.toReference(), creator.createPerson("First", "Last").toReference(), rdcf2);
SampleDto sample1 = creator.createSample(caze1.toReference(), user2.toReference(), lab1);
PathogenTestDto pathogenTest1 = createPathogenTest(lab1, sample1, user2);
CaseDataDto caze2 = creator.createCase(user1.toReference(), creator.createPerson("First", "Last").toReference(), rdcf1);
creator.createContact(user2.toReference(), creator.createPerson("First", "Last").toReference(), caze2);
SampleDto sample2 = creator.createSample(caze2.toReference(), user1.toReference(), lab2);
PathogenTestDto pathogenTest2 = createPathogenTest(lab2, sample2, user1);
List<PathogenTestDto> activeTests = getPathogenTestFacade().getByUuids(Arrays.asList(pathogenTest1.getUuid(), pathogenTest2.getUuid()));
assertNotPseudonymized(activeTests.stream().filter(t -> t.getUuid().equals(pathogenTest1.getUuid())).findFirst().get());
assertPseudonymized(activeTests.stream().filter(t -> t.getUuid().equals(pathogenTest2.getUuid())).findFirst().get());
}
use of de.symeda.sormas.api.sample.SampleDto in project SORMAS-Project by hzi-braunschweig.
the class PathogenTestFacadeEjbTest method testSaveAndUpdatePathogenTestAssociatedToContact.
@Test
public void testSaveAndUpdatePathogenTestAssociatedToContact() {
final RDCFEntities rdcf = creator.createRDCFEntities("Region", "District", "Community", "Facility");
final UserDto user = creator.createUser(rdcf, UserRole.SURVEILLANCE_SUPERVISOR);
final PersonDto person = creator.createPerson();
final CaseDataDto caze = creator.createCase(user.toReference(), person.toReference(), rdcf);
final ContactDto contact = creator.createContact(user.toReference(), person.toReference(), caze);
final SampleDto sample = creator.createSample(contact.toReference(), new Date(), new Date(), user.toReference(), SampleMaterial.BLOOD, rdcf.facility);
final PathogenTestDto newPathogenTest = creator.buildPathogenTestDto(rdcf, user, sample, contact.getDisease(), testDateTime);
testSaveAndUpdatePathogenTest(newPathogenTest);
}
Aggregations