Search in sources :

Example 16 with IdmProcessedTaskItemDto

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

the class DefaultTestHelper method prepareProcessedItem.

@Override
public IdmProcessedTaskItemDto prepareProcessedItem(IdmScheduledTaskDto d) {
    IdmProcessedTaskItemDto item = new IdmProcessedTaskItemDto();
    item.setReferencedDtoType(IdmIdentityDto.class.getCanonicalName());
    item.setReferencedEntityId(UUID.randomUUID());
    item.setScheduledTaskQueueOwner(d.getId());
    item.setOperationResult(new OperationResult.Builder(OperationState.EXECUTED).build());
    return item;
}
Also used : IdmProcessedTaskItemDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmProcessedTaskItemDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)

Example 17 with IdmProcessedTaskItemDto

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

the class SchedulerTestUtils method checkLogItems.

public static <E extends AbstractDto> void checkLogItems(IdmLongRunningTaskDto longRunningTask, Class<E> dtoClazz, Page<IdmProcessedTaskItemDto> logItems) {
    // 
    for (IdmProcessedTaskItemDto qi : logItems) {
        assertEquals(longRunningTask.getId(), qi.getLongRunningTask());
        assertEquals(dtoClazz.getCanonicalName(), qi.getReferencedDtoType());
        assertEquals(OperationState.EXECUTED, qi.getOperationResult().getState());
    }
}
Also used : IdmProcessedTaskItemDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmProcessedTaskItemDto)

Example 18 with IdmProcessedTaskItemDto

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

the class SchedulerTestUtils method checkQueueItems.

public static <E extends AbstractDto> void checkQueueItems(IdmScheduledTaskDto scheduledTask, Class<E> dtoClazz, Page<IdmProcessedTaskItemDto> queueItems) {
    // 
    for (IdmProcessedTaskItemDto qi : queueItems) {
        assertEquals(scheduledTask.getId(), qi.getScheduledTaskQueueOwner());
        assertEquals(dtoClazz.getCanonicalName(), qi.getReferencedDtoType());
        assertEquals(OperationState.EXECUTED, qi.getOperationResult().getState());
    }
}
Also used : IdmProcessedTaskItemDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmProcessedTaskItemDto)

Example 19 with IdmProcessedTaskItemDto

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

the class DefaultTestHelper method prepareProcessedItem.

@Override
public IdmProcessedTaskItemDto prepareProcessedItem(IdmScheduledTaskDto d, OperationState state) {
    IdmProcessedTaskItemDto item = new IdmProcessedTaskItemDto();
    item.setReferencedDtoType(IdmIdentityDto.class.getCanonicalName());
    item.setReferencedEntityId(UUID.randomUUID());
    item.setScheduledTaskQueueOwner(d.getId());
    item.setOperationResult(new OperationResult.Builder(state).build());
    return item;
}
Also used : IdmProcessedTaskItemDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmProcessedTaskItemDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)

Example 20 with IdmProcessedTaskItemDto

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

the class IdmLongRunningTaskItemController method addToQueue.

@ResponseBody
@RequestMapping(value = "/{backendId}/queue-item", method = RequestMethod.POST)
@PreAuthorize("hasAuthority('" + CoreGroupPermission.SCHEDULER_CREATE + "')")
@ApiOperation(value = "Create record", nickname = "createRecord", tags = { IdmLongRunningTaskItemController.TAG }, authorizations = { @Authorization(value = SwaggerConfig.AUTHENTICATION_BASIC, scopes = { @AuthorizationScope(scope = CoreGroupPermission.SCHEDULER_CREATE, description = "") }), @Authorization(value = SwaggerConfig.AUTHENTICATION_CIDMST, scopes = { @AuthorizationScope(scope = CoreGroupPermission.SCHEDULER_CREATE, description = "") }) })
public ResponseEntity<?> addToQueue(@ApiParam(value = "Records's uuid identifier", required = true) @PathVariable @NotNull String backendId, @Valid @RequestBody UUID scheduledTask) {
    IdmScheduledTaskDto task = scheduledTaskService.get(scheduledTask);
    IdmProcessedTaskItemDto itemDto = itemService.get(backendId);
    itemService.createQueueItem(itemDto, new OperationResult(OperationState.EXECUTED), task);
    // 
    return new ResponseEntity<>(HttpStatus.CREATED);
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) IdmScheduledTaskDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmScheduledTaskDto) OperationResult(eu.bcvsolutions.idm.core.api.entity.OperationResult) IdmProcessedTaskItemDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmProcessedTaskItemDto) ApiOperation(io.swagger.annotations.ApiOperation) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

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