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));
}
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));
}
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());
}
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());
}
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));
}
Aggregations