Search in sources :

Example 31 with IdmProcessedTaskItemDto

use of eu.bcvsolutions.idm.core.scheduler.api.dto.IdmProcessedTaskItemDto in project CzechIdMng by bcvsolutions.

the class DefaultIdmProcessedTaskItemDtoServiceTest method scheduledTaskIdFilter.

@Test
public void scheduledTaskIdFilter() {
    IdmScheduledTaskDto d = helper.createSchedulableTask();
    IdmProcessedTaskItemDto item = service.saveInternal(helper.prepareProcessedItem(d));
    IdmProcessedTaskItemDto item2 = service.saveInternal(helper.prepareProcessedItem(d));
    // 
    IdmProcessedTaskItemFilter filter = new IdmProcessedTaskItemFilter();
    filter.setScheduledTaskId(d.getId());
    Page<IdmProcessedTaskItemDto> result = service.find(filter, null);
    assertEquals("Wrong number of items!", 2, result.getTotalElements());
    assertTrue(result.getContent().contains(item));
    assertTrue(result.getContent().contains(item2));
}
Also used : IdmScheduledTaskDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmScheduledTaskDto) IdmProcessedTaskItemFilter(eu.bcvsolutions.idm.core.scheduler.api.dto.filter.IdmProcessedTaskItemFilter) IdmProcessedTaskItemDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmProcessedTaskItemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 32 with IdmProcessedTaskItemDto

use of eu.bcvsolutions.idm.core.scheduler.api.dto.IdmProcessedTaskItemDto in project CzechIdMng by bcvsolutions.

the class DefaultIdmProcessedTaskItemDtoServiceTest method getOperationState.

@Test
public void getOperationState() {
    IdmScheduledTaskDto d = helper.createSchedulableTask();
    // 
    IdmProcessedTaskItemDto item = service.saveInternal(helper.prepareProcessedItem(d));
    IdmProcessedTaskItemDto item2 = service.saveInternal(helper.prepareProcessedItem(d));
    IdmProcessedTaskItemDto item3 = service.saveInternal(helper.prepareProcessedItem(d, OperationState.CANCELED));
    // 
    IdmProcessedTaskItemFilter filter = new IdmProcessedTaskItemFilter();
    filter.setOperationState(item.getOperationResult().getState());
    Page<IdmProcessedTaskItemDto> result = service.find(filter, null);
    assertTrue(result.getContent().contains(item));
    assertTrue(result.getContent().contains(item2));
    assertFalse(result.getContent().contains(item3));
}
Also used : IdmScheduledTaskDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmScheduledTaskDto) IdmProcessedTaskItemFilter(eu.bcvsolutions.idm.core.scheduler.api.dto.filter.IdmProcessedTaskItemFilter) IdmProcessedTaskItemDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmProcessedTaskItemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 33 with IdmProcessedTaskItemDto

use of eu.bcvsolutions.idm.core.scheduler.api.dto.IdmProcessedTaskItemDto in project CzechIdMng by bcvsolutions.

the class DefaultIdmProcessedTaskItemDtoServiceTest method testCreateItem.

@Test
public void testCreateItem() {
    IdmScheduledTaskDto d = helper.createSchedulableTask();
    IdmLongRunningTaskDto lrt = this.createLongRunningTask(d);
    IdmProcessedTaskItemDto item = helper.prepareProcessedItem(lrt);
    // 
    IdmProcessedTaskItemDto retrieved = service.get(service.saveInternal(item).getId());
    // 
    assertNotNull(retrieved);
    assertEquals(item.getReferencedDtoType(), retrieved.getReferencedDtoType());
    assertEquals(item.getReferencedEntityId(), retrieved.getReferencedEntityId());
    assertEquals(item.getLongRunningTask(), retrieved.getLongRunningTask());
}
Also used : IdmLongRunningTaskDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmLongRunningTaskDto) IdmScheduledTaskDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmScheduledTaskDto) IdmProcessedTaskItemDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmProcessedTaskItemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 34 with IdmProcessedTaskItemDto

use of eu.bcvsolutions.idm.core.scheduler.api.dto.IdmProcessedTaskItemDto in project CzechIdMng by bcvsolutions.

the class DefaultIdmProcessedTaskItemDtoServiceTest method testImmutable.

@Test
public void testImmutable() {
    IdmScheduledTaskDto d = helper.createSchedulableTask();
    IdmLongRunningTaskDto lrt = this.createLongRunningTask(d);
    IdmProcessedTaskItemDto item = helper.prepareProcessedItem(lrt);
    IdmProcessedTaskItemDto saved = service.get(service.saveInternal(item).getId());
    // set fields to new value
    saved.setReferencedDtoType(IdmIdentityContractDto.class.getCanonicalName());
    saved.setReferencedEntityId(UUID.randomUUID());
    saved.setLongRunningTask(this.createLongRunningTask(d).getId());
    // 
    IdmProcessedTaskItemDto retrieved = service.get(service.saveInternal(saved).getId());
    // fields must not update
    assertEquals(item.getLongRunningTask(), retrieved.getLongRunningTask());
    assertEquals(item.getReferencedDtoType(), retrieved.getReferencedDtoType());
    assertEquals(item.getReferencedEntityId(), retrieved.getReferencedEntityId());
    // 
    assertNotEquals(item.getLongRunningTask(), saved.getLongRunningTask());
    assertNotEquals(item.getReferencedDtoType(), saved.getReferencedDtoType());
    assertNotEquals(item.getReferencedEntityId(), saved.getReferencedEntityId());
}
Also used : IdmLongRunningTaskDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmLongRunningTaskDto) IdmScheduledTaskDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmScheduledTaskDto) IdmProcessedTaskItemDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmProcessedTaskItemDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 35 with IdmProcessedTaskItemDto

use of eu.bcvsolutions.idm.core.scheduler.api.dto.IdmProcessedTaskItemDto in project CzechIdMng by bcvsolutions.

the class DefaultIdmProcessedTaskItemDtoServiceTest method referencedEntityIdFilter.

@Test
public void referencedEntityIdFilter() {
    IdmScheduledTaskDto d = helper.createSchedulableTask();
    IdmProcessedTaskItemDto item = service.saveInternal(helper.prepareProcessedItem(d));
    IdmProcessedTaskItemDto item2 = service.saveInternal(helper.prepareProcessedItem(d));
    // 
    IdmProcessedTaskItemFilter filter = new IdmProcessedTaskItemFilter();
    filter.setReferencedEntityId(item.getReferencedEntityId());
    Page<IdmProcessedTaskItemDto> result = service.find(filter, null);
    assertEquals("Wrong number of items!", 1, result.getTotalElements());
    assertTrue(result.getContent().contains(item));
    assertFalse(result.getContent().contains(item2));
    // 
    filter.setReferencedEntityId(item2.getReferencedEntityId());
    result = service.find(filter, null);
    assertEquals("Wrong number of items!", 1, result.getTotalElements());
    assertTrue(result.getContent().contains(item2));
    assertFalse(result.getContent().contains(item));
}
Also used : IdmScheduledTaskDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmScheduledTaskDto) IdmProcessedTaskItemFilter(eu.bcvsolutions.idm.core.scheduler.api.dto.filter.IdmProcessedTaskItemFilter) IdmProcessedTaskItemDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmProcessedTaskItemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Aggregations

IdmProcessedTaskItemDto (eu.bcvsolutions.idm.core.scheduler.api.dto.IdmProcessedTaskItemDto)42 Test (org.junit.Test)32 IdmScheduledTaskDto (eu.bcvsolutions.idm.core.scheduler.api.dto.IdmScheduledTaskDto)22 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)16 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)13 IdmLongRunningTaskDto (eu.bcvsolutions.idm.core.scheduler.api.dto.IdmLongRunningTaskDto)12 IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)11 IdmProcessedTaskItemFilter (eu.bcvsolutions.idm.core.scheduler.api.dto.filter.IdmProcessedTaskItemFilter)9 IdmPasswordDto (eu.bcvsolutions.idm.core.api.dto.IdmPasswordDto)4 OperationResult (eu.bcvsolutions.idm.core.api.entity.OperationResult)4 AbstractVerifiableUnitTest (eu.bcvsolutions.idm.test.api.AbstractVerifiableUnitTest)4 UUID (java.util.UUID)4 LocalDate (org.joda.time.LocalDate)4 AbstractDto (eu.bcvsolutions.idm.core.api.dto.AbstractDto)3 AbstractRestTest (eu.bcvsolutions.idm.test.api.AbstractRestTest)2 PageImpl (org.springframework.data.domain.PageImpl)2 PageRequest (org.springframework.data.domain.PageRequest)2 Pageable (org.springframework.data.domain.Pageable)2 Transactional (org.springframework.transaction.annotation.Transactional)2 CoreException (eu.bcvsolutions.idm.core.api.exception.CoreException)1