use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.
the class ModificationExecutionAsyncTest method testIoMappingInvocation.
@Test
public void testIoMappingInvocation() {
// given
ProcessDefinition processDefinition = testRule.deployAndGetDefinition(modify(instance).activityBuilder("user1").camundaInputParameter("foo", "bar").done());
ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinition.getId());
Batch batch = runtimeService.createModification(processDefinition.getId()).startAfterActivity("user2").processInstanceIds(Arrays.asList(processInstance.getId())).executeAsync();
helper.executeSeedJob(batch);
// when
helper.executeJobs(batch);
// then
VariableInstance inputVariable = runtimeService.createVariableInstanceQuery().singleResult();
Assert.assertNotNull(inputVariable);
assertEquals("foo", inputVariable.getName());
assertEquals("bar", inputVariable.getValue());
ActivityInstance activityInstance = runtimeService.getActivityInstance(processInstance.getId());
assertEquals(activityInstance.getActivityInstances("user1")[0].getId(), inputVariable.getActivityInstanceId());
}
use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.
the class ModificationExecutionAsyncTest method createBatchModification.
@Test
public void createBatchModification() {
ProcessDefinition processDefinition = testRule.deployAndGetDefinition(instance);
List<String> processInstanceIds = helper.startInstances("process1", 2);
Batch batch = runtimeService.createModification(processDefinition.getId()).startAfterActivity("user2").processInstanceIds(processInstanceIds).executeAsync();
assertBatchCreated(batch, 2);
}
use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.
the class ModificationExecutionAsyncTest method testBatchDeletionWithCascade.
@Test
public void testBatchDeletionWithCascade() {
ProcessDefinition processDefinition = testRule.deployAndGetDefinition(instance);
Batch batch = helper.startTransitionAsync("process1", 10, "seq", processDefinition.getId());
helper.executeSeedJob(batch);
// when
rule.getManagementService().deleteBatch(batch.getId(), true);
// then the batch was deleted
assertEquals(0, rule.getManagementService().createBatchQuery().count());
// and the seed and modification job definition were deleted
assertEquals(0, rule.getManagementService().createJobDefinitionQuery().count());
// and the seed job and modification jobs were deleted
assertEquals(0, rule.getManagementService().createJobQuery().count());
}
use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.
the class ModificationExecutionAsyncTest method testBatchWithFailedMonitorJobDeletionWithCascade.
@Test
public void testBatchWithFailedMonitorJobDeletionWithCascade() {
ProcessDefinition processDefinition = testRule.deployAndGetDefinition(instance);
Batch batch = helper.startBeforeAsync("process1", 2, "user2", processDefinition.getId());
helper.executeSeedJob(batch);
// create incident
Job monitorJob = helper.getMonitorJob(batch);
rule.getManagementService().setJobRetries(monitorJob.getId(), 0);
// when
rule.getManagementService().deleteBatch(batch.getId(), true);
// then the no historic incidents exists
long historicIncidents = rule.getHistoryService().createHistoricIncidentQuery().count();
assertEquals(0, historicIncidents);
}
use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.
the class ModificationExecutionAsyncTest method testCancelWithoutFlag.
@Test
public void testCancelWithoutFlag() {
// given
this.instance = Bpmn.createExecutableProcess("process1").startEvent("start").serviceTask("ser").camundaExpression("${true}").userTask("user").endEvent("end").done();
ProcessDefinition processDefinition = testRule.deployAndGetDefinition(instance);
List<String> processInstanceIds = helper.startInstances("process1", 1);
// when
Batch batch = runtimeService.createModification(processDefinition.getId()).startBeforeActivity("ser").cancelAllForActivity("user").processInstanceIds(processInstanceIds).executeAsync();
helper.executeSeedJob(batch);
helper.executeJobs(batch);
// then
assertEquals(0, runtimeService.createExecutionQuery().list().size());
}
Aggregations