use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.
the class RuntimeServiceAsyncOperationsTest method testDeleteProcessInstancesAsyncWithQueryWithoutDeleteReason.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
@Test
public void testDeleteProcessInstancesAsyncWithQueryWithoutDeleteReason() throws Exception {
// given
List<String> processIds = startTestProcesses(2);
ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery().processInstanceIds(new HashSet<String>(processIds));
// when
Batch batch = runtimeService.deleteProcessInstancesAsync(null, processInstanceQuery, null);
executeSeedJob(batch);
executeBatchJobs(batch);
// then
assertHistoricTaskDeletionPresent(processIds, "deleted", testRule);
assertHistoricBatchExists(testRule);
assertProcessInstancesAreDeleted();
}
use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.
the class BatchCreationAuthorizationTest method cleanBatch.
@After
public void cleanBatch() {
Batch batch = engineRule.getManagementService().createBatchQuery().singleResult();
if (batch != null) {
engineRule.getManagementService().deleteBatch(batch.getId(), true);
}
HistoricBatch historicBatch = engineRule.getHistoryService().createHistoricBatchQuery().singleResult();
if (historicBatch != null) {
engineRule.getHistoryService().deleteHistoricBatch(historicBatch.getId());
}
}
use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.
the class SetExternalTasksRetriesBatchAuthorizationTest method testSetRetriesWithQueryAsync.
@Test
public void testSetRetriesWithQueryAsync() {
// given
ProcessDefinition processDefinition = testRule.deployAndGetDefinition(ExternalTaskModels.ONE_EXTERNAL_TASK_PROCESS);
ProcessInstance processInstance1 = engineRule.getRuntimeService().startProcessInstanceByKey("Process");
List<ExternalTask> externalTasks;
ExternalTaskQuery externalTaskQuery = engineRule.getExternalTaskService().createExternalTaskQuery();
// when
authRule.init(scenario).withUser("userId").bindResource("batchId", "*").bindResource("processInstance1", processInstance1.getId()).bindResource("processDefinition", processDefinition.getKey()).start();
Batch batch = engineRule.getExternalTaskService().setRetriesAsync(null, externalTaskQuery, 5);
if (batch != null) {
executeSeedAndBatchJobs(batch);
}
// then
if (authRule.assertScenario(scenario)) {
externalTasks = engineRule.getExternalTaskService().createExternalTaskQuery().list();
for (ExternalTask task : externalTasks) {
Assert.assertEquals(5, (int) task.getRetries());
}
}
}
use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.
the class BatchStatisticsQueryTest method testQueryCount.
@Test
public void testQueryCount() {
long count = managementService.createBatchStatisticsQuery().count();
assertEquals(0, count);
Batch batch1 = helper.createMigrationBatchWithSize(1);
count = managementService.createBatchStatisticsQuery().count();
assertEquals(1, count);
Batch batch2 = helper.createMigrationBatchWithSize(1);
Batch batch3 = helper.createMigrationBatchWithSize(1);
count = managementService.createBatchStatisticsQuery().count();
assertEquals(3, count);
helper.completeBatch(batch1);
helper.completeBatch(batch3);
count = managementService.createBatchStatisticsQuery().count();
assertEquals(1, count);
helper.completeBatch(batch2);
count = managementService.createBatchStatisticsQuery().count();
assertEquals(0, count);
}
use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.
the class BatchStatisticsQueryTest method testStatisticsOneFailedJob.
@Test
public void testStatisticsOneFailedJob() {
// given
Batch batch = helper.createMigrationBatchWithSize(3);
// when
helper.completeSeedJobs(batch);
helper.failExecutionJobs(batch, 1);
// then
BatchStatistics batchStatistics = managementService.createBatchStatisticsQuery().singleResult();
assertEquals(3, batchStatistics.getTotalJobs());
assertEquals(3, batchStatistics.getJobsCreated());
assertEquals(3, batchStatistics.getRemainingJobs());
assertEquals(0, batchStatistics.getCompletedJobs());
assertEquals(1, batchStatistics.getFailedJobs());
}
Aggregations