use of eu.bcvsolutions.idm.core.scheduler.api.dto.filter.IdmLongRunningTaskFilter in project CzechIdMng by bcvsolutions.
the class DefaultIdmLongRunningTaskServiceIntegrationTest method operationStateFilterTest.
@Test
public void operationStateFilterTest() {
IdmLongRunningTaskFilter filter = new IdmLongRunningTaskFilter();
String expectedResult = getHelper().createName();
// set tasks
LongRunningTaskExecutor<String> taskExecutor = new TestSimpleLongRunningTaskExecutor(expectedResult);
assertNull(taskExecutor.getLongRunningTaskId());
manager.executeSync(taskExecutor);
IdmLongRunningTaskDto task1 = service.get(taskExecutor.getLongRunningTaskId());
// set filter
filter.setOperationState(task1.getResultState());
Page<IdmLongRunningTaskDto> result = service.find(filter, null);
assertEquals("Wrong operationState id", true, result.getContent().contains(task1));
}
use of eu.bcvsolutions.idm.core.scheduler.api.dto.filter.IdmLongRunningTaskFilter in project CzechIdMng by bcvsolutions.
the class DefaultIdmLongRunningTaskServiceIntegrationTest method textFilterTest.
@Test
public void textFilterTest() {
IdmLongRunningTaskFilter filter = new IdmLongRunningTaskFilter();
String expectedResult = getHelper().createName();
String type1 = getHelper().createName();
String type2 = getHelper().createName();
// set tasks
LongRunningTaskExecutor<String> taskExecutor = new TestSimpleLongRunningTaskExecutor(expectedResult);
assertNull(taskExecutor.getLongRunningTaskId());
manager.executeSync(taskExecutor);
IdmLongRunningTaskDto task1 = service.get(taskExecutor.getLongRunningTaskId());
task1.setTaskType(type1);
service.save(task1);
LongRunningTaskExecutor<String> taskExecutor2 = new TestSimpleLongRunningTaskExecutor(expectedResult);
assertNull(taskExecutor2.getLongRunningTaskId());
manager.executeSync(taskExecutor2);
IdmLongRunningTaskDto task2 = service.get(taskExecutor2.getLongRunningTaskId());
task2.setTaskType(type1);
service.save(task2);
LongRunningTaskExecutor<String> taskExecutor3 = new TestSimpleLongRunningTaskExecutor(expectedResult);
assertNull(taskExecutor3.getLongRunningTaskId());
manager.executeSync(taskExecutor3);
IdmLongRunningTaskDto task3 = service.get(taskExecutor3.getLongRunningTaskId());
task3.setTaskType(type2);
service.save(task3);
LongRunningTaskExecutor<String> taskExecutor4 = new TestSimpleLongRunningTaskExecutor(expectedResult);
assertNull(taskExecutor4.getLongRunningTaskId());
manager.executeSync(taskExecutor4);
IdmLongRunningTaskDto task4 = service.get(taskExecutor4.getLongRunningTaskId());
task4.setTaskDescription(type1);
service.save(task4);
// set filter
filter.setText(type1);
Page<IdmLongRunningTaskDto> result = service.find(filter, null);
assertEquals("Wrong Text Type", 3, result.getTotalElements());
assertEquals("Wrong Text Type", true, result.getContent().contains(task4));
assertEquals("Wrong Text Description", true, result.getContent().contains(task1));
}
use of eu.bcvsolutions.idm.core.scheduler.api.dto.filter.IdmLongRunningTaskFilter in project CzechIdMng by bcvsolutions.
the class DefaultLongRunningTaskManagerIntegrationTest method testRecoverableTask.
@Test
public void testRecoverableTask() {
getHelper().setConfigurationValue(SchedulerConfiguration.PROPERTY_TASK_ASYNCHRONOUS_ENABLED, false);
//
try {
TestTaskExecutor executorOne = new TestTaskExecutor();
executorOne.setDescription(getHelper().createName());
executorOne.setCount(1L);
// first process
manager.execute(executorOne);
//
IdmLongRunningTaskFilter filter = new IdmLongRunningTaskFilter();
filter.setTaskType(TestTaskExecutor.class.getCanonicalName());
filter.setText(executorOne.getDescription());
filter.setOperationState(OperationState.EXECUTED);
List<IdmLongRunningTaskDto> ltrs = service.find(filter, null).getContent();
Assert.assertEquals(1, ltrs.size());
//
IdmLongRunningTaskDto task = ltrs.get(0);
manager.recover(task.getId());
//
ltrs = service.find(filter, null).getContent();
Assert.assertEquals(2, ltrs.size());
} finally {
getHelper().setConfigurationValue(SchedulerConfiguration.PROPERTY_TASK_ASYNCHRONOUS_ENABLED, true);
}
}
use of eu.bcvsolutions.idm.core.scheduler.api.dto.filter.IdmLongRunningTaskFilter in project CzechIdMng by bcvsolutions.
the class DefaultIdmLongRunningTaskServiceTest method typeFilterTest.
@Test
public void typeFilterTest() {
IdmLongRunningTaskFilter filter = new IdmLongRunningTaskFilter();
String expectedResult = "TEST_SUCCESS_03_M";
// set tasks
LongRunningTaskExecutor<String> taskExecutor = new TestSimpleLongRunningTaskExecutor(expectedResult);
assertNull(taskExecutor.getLongRunningTaskId());
manager.executeSync(taskExecutor);
IdmLongRunningTaskDto task1 = idmLongRunningTaskService.get(taskExecutor.getLongRunningTaskId());
task1.setTaskType("Type0001");
idmLongRunningTaskService.save(task1);
filter.setTaskType(task1.getTaskType());
Page<IdmLongRunningTaskDto> result = idmLongRunningTaskService.find(filter, null);
assertEquals("Wrong TaskType", task1.getId(), result.getContent().get(0).getId());
}
use of eu.bcvsolutions.idm.core.scheduler.api.dto.filter.IdmLongRunningTaskFilter in project CzechIdMng by bcvsolutions.
the class DefaultIdmLongRunningTaskServiceTest method runningFilterTest.
@Test
public void runningFilterTest() {
IdmLongRunningTaskFilter filter = new IdmLongRunningTaskFilter();
String expectedResult = "TEST_SUCCESS_02_M";
// set tasks
LongRunningTaskExecutor<String> taskExecutor = new TestSimpleLongRunningTaskExecutor(expectedResult);
assertNull(taskExecutor.getLongRunningTaskId());
manager.executeSync(taskExecutor);
IdmLongRunningTaskDto task1 = idmLongRunningTaskService.get(taskExecutor.getLongRunningTaskId());
task1.setRunning(true);
idmLongRunningTaskService.save(task1);
// set filter
filter.setTaskType(task1.getTaskType());
filter.setRunning(task1.isRunning());
Page<IdmLongRunningTaskDto> result = idmLongRunningTaskService.find(filter, null);
assertEquals("Wrong Running", task1.getId(), result.getContent().get(0).getId());
}
Aggregations