use of org.camunda.bpm.engine.repository.DeploymentWithDefinitions in project camunda-bpm-platform by camunda.
the class ModificationExecutionSyncTest method testStartBeforeAndCancelAll.
@Test
public void testStartBeforeAndCancelAll() {
DeploymentWithDefinitions deployment = testRule.deploy(instance);
ProcessDefinition definition = deployment.getDeployedProcessDefinitions().get(0);
List<String> processInstanceIds = helper.startInstances("process1", 2);
runtimeService.createModification(definition.getId()).cancelAllForActivity("user1").startBeforeActivity("user2").processInstanceIds(processInstanceIds).execute();
for (String processInstanceId : processInstanceIds) {
ActivityInstance updatedTree = runtimeService.getActivityInstance(processInstanceId);
assertNotNull(updatedTree);
assertEquals(processInstanceId, updatedTree.getProcessInstanceId());
assertThat(updatedTree).hasStructure(describeActivityInstanceTree(definition.getId()).activity("user2").done());
}
}
use of org.camunda.bpm.engine.repository.DeploymentWithDefinitions in project camunda-bpm-platform by camunda.
the class ModificationExecutionAsyncTest method executeModificationJobsForStartTransitionAndCancelAll.
@Test
public void executeModificationJobsForStartTransitionAndCancelAll() {
DeploymentWithDefinitions deployment = testRule.deploy(instance);
ProcessDefinition processDefinition = deployment.getDeployedProcessDefinitions().get(0);
List<String> instances = helper.startInstances("process1", 10);
Batch batch = runtimeService.createModification(processDefinition.getId()).startTransition("seq").cancelAllForActivity("user1").processInstanceIds(instances).executeAsync();
helper.executeSeedJob(batch);
List<Job> modificationJobs = helper.getExecutionJobs(batch);
// when
for (Job modificationJob : modificationJobs) {
helper.executeJob(modificationJob);
}
// then all process instances where modified
for (String processInstanceId : helper.currentProcessInstances) {
ActivityInstance updatedTree = runtimeService.getActivityInstance(processInstanceId);
assertNotNull(updatedTree);
assertThat(updatedTree).hasStructure(describeActivityInstanceTree(processDefinition.getId()).activity("user2").done());
}
// and the no modification jobs exist
assertEquals(0, helper.getExecutionJobs(batch).size());
// but a monitor job exists
assertNotNull(helper.getMonitorJob(batch));
}
use of org.camunda.bpm.engine.repository.DeploymentWithDefinitions in project camunda-bpm-platform by camunda.
the class ModificationExecutionAsyncTest method executeModificationJobsForStartTransition.
@Test
public void executeModificationJobsForStartTransition() {
DeploymentWithDefinitions deployment = testRule.deploy(instance);
ProcessDefinition processDefinition = deployment.getDeployedProcessDefinitions().get(0);
Batch batch = helper.startTransitionAsync("process1", 10, "seq", processDefinition.getId());
helper.executeSeedJob(batch);
List<Job> modificationJobs = helper.getExecutionJobs(batch);
// when
for (Job modificationJob : modificationJobs) {
helper.executeJob(modificationJob);
}
// then all process instances where modified
for (String processInstanceId : helper.currentProcessInstances) {
ActivityInstance updatedTree = runtimeService.getActivityInstance(processInstanceId);
assertNotNull(updatedTree);
assertEquals(processInstanceId, updatedTree.getProcessInstanceId());
assertThat(updatedTree).hasStructure(describeActivityInstanceTree(processDefinition.getId()).activity("user1").activity("user2").done());
}
// and the no modification jobs exist
assertEquals(0, helper.getExecutionJobs(batch).size());
// but a monitor job exists
assertNotNull(helper.getMonitorJob(batch));
}
use of org.camunda.bpm.engine.repository.DeploymentWithDefinitions in project camunda-bpm-platform by camunda.
the class ModificationExecutionAsyncTest method testBatchCreationWithOverlappingProcessInstanceIdsAndQuery.
@Test
public void testBatchCreationWithOverlappingProcessInstanceIdsAndQuery() {
int processInstanceCount = 15;
DeploymentWithDefinitions deployment = testRule.deploy(instance);
ProcessDefinition processDefinition = deployment.getDeployedProcessDefinitions().get(0);
List<String> processInstanceIds = helper.startInstances("process1", 15);
ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery().processDefinitionId(processDefinition.getId());
assertEquals(processInstanceCount, processInstanceQuery.count());
// when
Batch batch = runtimeService.createModification(processDefinition.getId()).startTransition("seq").processInstanceIds(processInstanceIds).processInstanceQuery(processInstanceQuery).executeAsync();
// then a batch is created
assertBatchCreated(batch, processInstanceCount);
}
use of org.camunda.bpm.engine.repository.DeploymentWithDefinitions in project camunda-bpm-platform by camunda.
the class ModificationExecutionAsyncTest method executeModificationJobsForStartBefore.
@Test
public void executeModificationJobsForStartBefore() {
DeploymentWithDefinitions deployment = testRule.deploy(instance);
ProcessDefinition processDefinition = deployment.getDeployedProcessDefinitions().get(0);
Batch batch = helper.startBeforeAsync("process1", 10, "user2", processDefinition.getId());
helper.executeSeedJob(batch);
List<Job> modificationJobs = helper.getExecutionJobs(batch);
// when
for (Job modificationJob : modificationJobs) {
helper.executeJob(modificationJob);
}
// then all process instances where modified
for (String processInstanceId : helper.currentProcessInstances) {
ActivityInstance updatedTree = runtimeService.getActivityInstance(processInstanceId);
assertNotNull(updatedTree);
assertEquals(processInstanceId, updatedTree.getProcessInstanceId());
assertThat(updatedTree).hasStructure(describeActivityInstanceTree(processDefinition.getId()).activity("user1").activity("user2").done());
}
// and the no modification jobs exist
assertEquals(0, helper.getExecutionJobs(batch).size());
// but a monitor job exists
assertNotNull(helper.getMonitorJob(batch));
}
Aggregations