use of de.symeda.sormas.backend.TestDataCreator.RDCF in project SORMAS-Project by hzi-braunschweig.
the class FeatureConfigurationServiceTest method createConfigurations.
// TODO Re-enable these tests after #7218 has been implemented
// @Test
// public void testCreateMissingFeatureConfigurations() {
//
// createConfigurations();
// FeatureConfigurationService featureConfigurationService = getBean(FeatureConfigurationService.class);
// featureConfigurationService.createMissingFeatureConfigurations();
// assertTrue(
// featureConfigurationService.getAll()
// .stream()
// .map(e -> e.getFeatureType())
// .collect(Collectors.toList())
// .containsAll(FeatureType.getAllServerFeatures()));
// }
// @Test
// public void testUpdateFeatureConfigurations() {
//
// createConfigurations();
// FeatureConfigurationService featureConfigurationService = getBean(FeatureConfigurationService.class);
//
// /*
// * update relies on that all serverFeature configurations are already present,
// * that's why the createMissing needs to be run before.
// */
// featureConfigurationService.createMissingFeatureConfigurations();
// featureConfigurationService.updateFeatureConfigurations();
// }
private void createConfigurations() {
// Some serverFeatures
build(FeatureType.EVENT_SURVEILLANCE);
build(FeatureType.TASK_MANAGEMENT);
// Some features configured on district level
RDCF rdcf = creator.createRDCF();
Region region = getRegionService().getByUuid(rdcf.region.getUuid());
build(FeatureType.LINE_LISTING, null, region, getDistrictService().getByUuid(rdcf.district.getUuid()));
build(FeatureType.LINE_LISTING, null, region, creator.createDistrict("d2", region));
}
use of de.symeda.sormas.backend.TestDataCreator.RDCF in project SORMAS-Project by hzi-braunschweig.
the class FacilityFacadeEjbTest method testGetAllActiveLaboratories.
@Test
public void testGetAllActiveLaboratories() {
RDCF rdcf = creator.createRDCF("r", "d", "c", "f");
FacilityDto f1 = getFacilityFacade().getByUuid(rdcf.facility.getUuid());
getFacilityFacade().archive(f1.getUuid());
f1 = getFacilityFacade().getByUuid(f1.getUuid());
f1.setType(FacilityType.LABORATORY);
getFacilityFacade().save(f1);
FacilityDto f2 = creator.createFacility("f2", rdcf.region, rdcf.district, rdcf.community);
f2 = getFacilityFacade().getByUuid(f2.getUuid());
f2.setType(FacilityType.LABORATORY);
getFacilityFacade().save(f2);
assertEquals(1, getFacilityFacade().getAllActiveLaboratories(false).size());
}
use of de.symeda.sormas.backend.TestDataCreator.RDCF in project SORMAS-Project by hzi-braunschweig.
the class ContactFacadeEjbTest method testCreateWithoutUuid.
@Test
public void testCreateWithoutUuid() {
RDCF rdcf = creator.createRDCF();
ContactDto contact = new ContactDto();
contact.setReportDateTime(new Date());
contact.setReportingUser(creator.createUser(rdcf, UserRole.SURVEILLANCE_OFFICER).toReference());
contact.setDisease(Disease.CORONAVIRUS);
contact.setPerson(creator.createPerson().toReference());
contact.setRegion(rdcf.region);
contact.setDistrict(rdcf.district);
contact.setHealthConditions(new HealthConditionsDto());
ContactDto savedContact = getContactFacade().save(contact);
assertThat(savedContact.getUuid(), not(isEmptyOrNullString()));
assertThat(savedContact.getHealthConditions().getUuid(), not(isEmptyOrNullString()));
}
use of de.symeda.sormas.backend.TestDataCreator.RDCF in project SORMAS-Project by hzi-braunschweig.
the class ContactFacadeEjbTest method testContactDeletion.
@Test
public void testContactDeletion() {
Date since = new Date();
RDCF rdcf = creator.createRDCF("Region", "District", "Community", "Facility");
UserDto user = creator.createUser(rdcf.region.getUuid(), rdcf.district.getUuid(), rdcf.facility.getUuid(), "Surv", "Sup", UserRole.SURVEILLANCE_SUPERVISOR);
UserDto admin = creator.createUser(rdcf.region.getUuid(), rdcf.district.getUuid(), rdcf.facility.getUuid(), "Another", "Admin", UserRole.ADMIN);
String adminUuid = admin.getUuid();
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);
VisitDto visit = creator.createVisit(caze.getDisease(), contactPerson.toReference(), DateUtils.addDays(new Date(), 21), VisitStatus.UNAVAILABLE, VisitOrigin.USER);
TaskDto task = creator.createTask(TaskContext.CONTACT, TaskType.CONTACT_INVESTIGATION, TaskStatus.PENDING, null, contact.toReference(), null, new Date(), user.toReference());
SampleDto sample = creator.createSample(contact.toReference(), new Date(), new Date(), user.toReference(), SampleMaterial.BLOOD, rdcf.facility);
SampleDto sample2 = creator.createSample(contact.toReference(), new Date(), new Date(), user.toReference(), SampleMaterial.BLOOD, rdcf.facility);
sample2.setAssociatedCase(new CaseReferenceDto(caze.getUuid()));
getSampleFacade().saveSample(sample2);
// Database should contain the created contact, visit and task
assertNotNull(getContactFacade().getByUuid(contact.getUuid()));
assertNotNull(getTaskFacade().getByUuid(task.getUuid()));
assertNotNull(getVisitFacade().getVisitByUuid(visit.getUuid()));
assertNotNull(getSampleFacade().getSampleByUuid(sample.getUuid()));
getContactFacade().deleteContact(contact.getUuid());
// Deleted flag should be set for contact; Task should be deleted
assertTrue(getContactFacade().getDeletedUuidsSince(since).contains(contact.getUuid()));
// Can't delete visit because it might be associated with other contacts as well
// assertNull(getVisitFacade().getVisitByUuid(visit.getUuid()));
assertNull(getTaskFacade().getByUuid(task.getUuid()));
assertTrue(getSampleFacade().getDeletedUuidsSince(since).contains(sample.getUuid()));
assertFalse(getSampleFacade().getDeletedUuidsSince(since).contains(sample2.getUuid()));
}
use of de.symeda.sormas.backend.TestDataCreator.RDCF in project SORMAS-Project by hzi-braunschweig.
the class ContactFacadeEjbTest method testSearchContactsWithReducedQuarantine.
@Test
public void testSearchContactsWithReducedQuarantine() {
RDCF rdcf = creator.createRDCF();
ContactDto contact = creator.createContact(creator.createUser(rdcf, UserRole.SURVEILLANCE_OFFICER).toReference(), creator.createPerson().toReference());
contact.setQuarantineReduced(true);
getContactFacade().save(contact);
List<ContactIndexDto> indexList = getContactFacade().getIndexList(new ContactCriteria(), 0, 100, Collections.emptyList());
assertThat(indexList.get(0).getUuid(), is(contact.getUuid()));
ContactCriteria contactCriteria = new ContactCriteria();
contactCriteria.setWithReducedQuarantine(true);
List<ContactIndexDto> indexListFiltered = getContactFacade().getIndexList(contactCriteria, 0, 100, Collections.emptyList());
assertThat(indexListFiltered.get(0).getUuid(), is(contact.getUuid()));
}
Aggregations