Search in sources :

Example 6 with IdmProcessedTaskItemFilter

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

the class DefaultIdmProcessedTaskItemDtoServiceTest method getLongRunningTaskIdFilter.

@Test
public void getLongRunningTaskIdFilter() {
    IdmScheduledTaskDto d = helper.createSchedulableTask();
    IdmLongRunningTaskDto lrt = this.createLongRunningTask(d);
    IdmLongRunningTaskDto lrt2 = this.createLongRunningTask(d);
    // 
    IdmProcessedTaskItemDto item = service.saveInternal(helper.prepareProcessedItem(lrt));
    IdmProcessedTaskItemDto item2 = service.saveInternal(helper.prepareProcessedItem(lrt));
    IdmProcessedTaskItemDto item3 = service.saveInternal(helper.prepareProcessedItem(lrt2));
    // 
    IdmProcessedTaskItemFilter filter = new IdmProcessedTaskItemFilter();
    filter.setLongRunningTaskId(lrt.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));
    assertFalse(result.getContent().contains(item3));
}
Also used : IdmLongRunningTaskDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmLongRunningTaskDto) 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 7 with IdmProcessedTaskItemFilter

use of eu.bcvsolutions.idm.core.scheduler.api.dto.filter.IdmProcessedTaskItemFilter 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 8 with IdmProcessedTaskItemFilter

use of eu.bcvsolutions.idm.core.scheduler.api.dto.filter.IdmProcessedTaskItemFilter 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 9 with IdmProcessedTaskItemFilter

use of eu.bcvsolutions.idm.core.scheduler.api.dto.filter.IdmProcessedTaskItemFilter 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

IdmProcessedTaskItemFilter (eu.bcvsolutions.idm.core.scheduler.api.dto.filter.IdmProcessedTaskItemFilter)9 IdmProcessedTaskItemDto (eu.bcvsolutions.idm.core.scheduler.api.dto.IdmProcessedTaskItemDto)7 IdmScheduledTaskDto (eu.bcvsolutions.idm.core.scheduler.api.dto.IdmScheduledTaskDto)6 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)6 Test (org.junit.Test)6 Transactional (org.springframework.transaction.annotation.Transactional)2 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)1 IdmLongRunningTaskDto (eu.bcvsolutions.idm.core.scheduler.api.dto.IdmLongRunningTaskDto)1 PageImpl (org.springframework.data.domain.PageImpl)1 PageRequest (org.springframework.data.domain.PageRequest)1