use of de.symeda.sormas.api.event.EventDto in project SORMAS-Project by hzi-braunschweig.
the class DocumentFacadeEjbTest method testDocumentDeletion.
@Test
public void testDocumentDeletion() throws IOException {
TestDataCreator.RDCF rdcf = creator.createRDCF("Region", "District", "Community", "Facility");
UserDto user = creator.createUser(rdcf);
EventDto event = creator.createEvent(user.toReference());
DocumentDto document = creator.createDocument(user.toReference(), "Name.pdf", "application/pdf", 42L, event.toReference(), "content".getBytes(StandardCharsets.UTF_8));
assumeNotNull(getDocumentFacade().getDocumentByUuid(document.getUuid()));
assumeThat(getDocumentFacade().getDocumentsRelatedToEntity(DocumentRelatedEntityType.EVENT, event.getUuid()), hasSize(1));
assumeThat(getDocumentFacade().isExistingDocument(DocumentRelatedEntityType.EVENT, event.getUuid(), document.getName()), equalTo(document.getUuid()));
getDocumentFacade().deleteDocument(document.getUuid());
Document deleted = getDocumentService().getByUuid(document.getUuid());
assertNotNull(deleted);
assertTrue(deleted.isDeleted());
assertThat(getDocumentFacade().getDocumentsRelatedToEntity(DocumentRelatedEntityType.EVENT, event.getUuid()), empty());
assertNull(getDocumentFacade().isExistingDocument(DocumentRelatedEntityType.EVENT, event.getUuid(), document.getName()));
}
use of de.symeda.sormas.api.event.EventDto in project SORMAS-Project by hzi-braunschweig.
the class EventFacadeEjbPseudonymizationTest method testUpdateWithPseudonymizedDto.
@Test
public void testUpdateWithPseudonymizedDto() {
EventDto event = createEvent(user2, rdcf2);
event.setPseudonymized(true);
event.setResponsibleUser(null);
getEventFacade().save(event);
Event savedEvent = getEventService().getByUuid(event.getUuid());
assertThat(savedEvent.getResponsibleUser().getUuid(), is(user2.getUuid()));
}
use of de.symeda.sormas.api.event.EventDto in project SORMAS-Project by hzi-braunschweig.
the class EventFacadeEjbPseudonymizationTest method testEventInJurisdiction.
@Test
public void testEventInJurisdiction() {
EventDto event = createEvent(user2, rdcf2);
assertNotPseudonymized(getEventFacade().getEventByUuid(event.getUuid(), false));
}
use of de.symeda.sormas.api.event.EventDto in project SORMAS-Project by hzi-braunschweig.
the class EventFacadeEjbPseudonymizationTest method testEventOutsideJurisdiction.
@Test
public void testEventOutsideJurisdiction() {
EventDto event = createEvent(user1, rdcf1);
assertPseudonymized(getEventFacade().getEventByUuid(event.getUuid(), false));
}
use of de.symeda.sormas.api.event.EventDto in project SORMAS-Project by hzi-braunschweig.
the class EventFacadeEjbPseudonymizationTest method testUpdatePseudonymizedEvent.
@Test
public void testUpdatePseudonymizedEvent() {
EventDto event = createEvent(user2, rdcf2);
loginWith(observerUser);
event.setConnectionNumber("updated");
event.setResponsibleUser(null);
getEventFacade().save(event);
Event savedEvent = getEventService().getByUuid(event.getUuid());
assertThat(savedEvent.getConnectionNumber(), is("Connect No."));
assertThat(savedEvent.getResponsibleUser().getUuid(), is(user2.getUuid()));
}
Aggregations