Search in sources :

Example 31 with EventDto

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()));
}
Also used : UserDto(de.symeda.sormas.api.user.UserDto) EventDto(de.symeda.sormas.api.event.EventDto) DocumentDto(de.symeda.sormas.api.document.DocumentDto) TestDataCreator(de.symeda.sormas.backend.TestDataCreator) Test(org.junit.Test) AbstractBeanTest(de.symeda.sormas.backend.AbstractBeanTest)

Example 32 with EventDto

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()));
}
Also used : EventDto(de.symeda.sormas.api.event.EventDto) Test(org.junit.Test) AbstractBeanTest(de.symeda.sormas.backend.AbstractBeanTest)

Example 33 with EventDto

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));
}
Also used : EventDto(de.symeda.sormas.api.event.EventDto) Test(org.junit.Test) AbstractBeanTest(de.symeda.sormas.backend.AbstractBeanTest)

Example 34 with EventDto

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));
}
Also used : EventDto(de.symeda.sormas.api.event.EventDto) Test(org.junit.Test) AbstractBeanTest(de.symeda.sormas.backend.AbstractBeanTest)

Example 35 with EventDto

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()));
}
Also used : EventDto(de.symeda.sormas.api.event.EventDto) Test(org.junit.Test) AbstractBeanTest(de.symeda.sormas.backend.AbstractBeanTest)

Aggregations

EventDto (de.symeda.sormas.api.event.EventDto)151 Test (org.junit.Test)89 UserDto (de.symeda.sormas.api.user.UserDto)62 PersonDto (de.symeda.sormas.api.person.PersonDto)56 AbstractBeanTest (de.symeda.sormas.backend.AbstractBeanTest)55 EventParticipantDto (de.symeda.sormas.api.event.EventParticipantDto)53 Date (java.util.Date)49 CaseDataDto (de.symeda.sormas.api.caze.CaseDataDto)32 ContactDto (de.symeda.sormas.api.contact.ContactDto)27 UserReferenceDto (de.symeda.sormas.api.user.UserReferenceDto)26 EventReferenceDto (de.symeda.sormas.api.event.EventReferenceDto)24 SampleDto (de.symeda.sormas.api.sample.SampleDto)24 TestDataCreator (de.symeda.sormas.backend.TestDataCreator)23 List (java.util.List)20 RDCF (de.symeda.sormas.backend.TestDataCreator.RDCF)19 AbstractBeanTest (de.symeda.sormas.ui.AbstractBeanTest)19 SormasToSormasEventDto (de.symeda.sormas.api.sormastosormas.event.SormasToSormasEventDto)17 Disease (de.symeda.sormas.api.Disease)16 CommitDiscardWrapperComponent (de.symeda.sormas.ui.utils.CommitDiscardWrapperComponent)16 EventIndexDto (de.symeda.sormas.api.event.EventIndexDto)15