Search in sources :

Example 46 with RuntimeService

use of org.camunda.bpm.engine.RuntimeService in project camunda-bpm-platform by camunda.

the class VariableInstanceQueryForOracleTest method testQueryWhen1001InstancesActive.

@Test
public void testQueryWhen1001InstancesActive() {
    // given
    Assume.assumeTrue(engineRule.getProcessEngineConfiguration().getDatabaseType().equals("oracle"));
    RuntimeService runtimeService = engineRule.getRuntimeService();
    testRule.deploy(ProcessModels.TWO_TASKS_PROCESS);
    String[] ids = new String[1001];
    // when
    for (int i = 0; i < 1001; i++) {
        ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("Process", Variables.createVariables().putValue("foo", "bar"));
        String activityInstanceId = runtimeService.getActivityInstance(processInstance.getId()).getId();
        ids[i] = activityInstanceId;
    }
    // then
    List<VariableInstance> variables = engineRule.getRuntimeService().createVariableInstanceQuery().activityInstanceIdIn(ids).list();
    assertEquals(1001, variables.size());
}
Also used : RuntimeService(org.camunda.bpm.engine.RuntimeService) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) VariableInstance(org.camunda.bpm.engine.runtime.VariableInstance) Test(org.junit.Test)

Example 47 with RuntimeService

use of org.camunda.bpm.engine.RuntimeService in project camunda-bpm-platform by camunda.

the class VariableInstanceQueryForOracleTest method testQueryWhen2001InstancesActive.

@Test
public void testQueryWhen2001InstancesActive() {
    // given
    Assume.assumeTrue(engineRule.getProcessEngineConfiguration().getDatabaseType().equals("oracle"));
    RuntimeService runtimeService = engineRule.getRuntimeService();
    testRule.deploy(ProcessModels.TWO_TASKS_PROCESS);
    String[] ids = new String[2001];
    // when
    for (int i = 0; i < 2001; i++) {
        ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("Process", Variables.createVariables().putValue("foo", "bar"));
        String activityInstanceId = runtimeService.getActivityInstance(processInstance.getId()).getId();
        ids[i] = activityInstanceId;
    }
    // then
    List<VariableInstance> variables = engineRule.getRuntimeService().createVariableInstanceQuery().activityInstanceIdIn(ids).list();
    assertEquals(2001, variables.size());
}
Also used : RuntimeService(org.camunda.bpm.engine.RuntimeService) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) VariableInstance(org.camunda.bpm.engine.runtime.VariableInstance) Test(org.junit.Test)

Example 48 with RuntimeService

use of org.camunda.bpm.engine.RuntimeService in project camunda-bpm-platform by camunda.

the class BatchModificationHelper method startAfterAsync.

public Batch startAfterAsync(String key, int numberOfProcessInstances, String activityId, String processDefinitionId) {
    RuntimeService runtimeService = engineRule.getRuntimeService();
    List<String> processInstanceIds = startInstances(key, numberOfProcessInstances);
    return runtimeService.createModification(processDefinitionId).startAfterActivity(activityId).processInstanceIds(processInstanceIds).executeAsync();
}
Also used : RuntimeService(org.camunda.bpm.engine.RuntimeService)

Example 49 with RuntimeService

use of org.camunda.bpm.engine.RuntimeService in project camunda-bpm-platform by camunda.

the class BatchModificationHelper method startBeforeAsync.

public Batch startBeforeAsync(String key, int numberOfProcessInstances, String activityId, String processDefinitionId) {
    RuntimeService runtimeService = engineRule.getRuntimeService();
    List<String> processInstanceIds = startInstances(key, numberOfProcessInstances);
    return runtimeService.createModification(processDefinitionId).startBeforeActivity(activityId).processInstanceIds(processInstanceIds).executeAsync();
}
Also used : RuntimeService(org.camunda.bpm.engine.RuntimeService)

Example 50 with RuntimeService

use of org.camunda.bpm.engine.RuntimeService in project camunda-bpm-platform by camunda.

the class ExecuteRuntimeServiceOperationTaskListener method notify.

public void notify(DelegateTask delegateTask) {
    ProcessEngineServices services = delegateTask.getProcessEngineServices();
    RuntimeService runtimeService = services.getRuntimeService();
    runtimeService.setVariable(delegateTask.getExecutionId(), "taskListenerCalled", true);
}
Also used : ProcessEngineServices(org.camunda.bpm.engine.ProcessEngineServices) RuntimeService(org.camunda.bpm.engine.RuntimeService)

Aggregations

RuntimeService (org.camunda.bpm.engine.RuntimeService)51 Test (org.junit.Test)12 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)10 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)9 IdentityService (org.camunda.bpm.engine.IdentityService)6 MigrationPlan (org.camunda.bpm.engine.migration.MigrationPlan)6 TaskService (org.camunda.bpm.engine.TaskService)5 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)5 Batch (org.camunda.bpm.engine.batch.Batch)4 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)4 VariableInstance (org.camunda.bpm.engine.runtime.VariableInstance)4 Task (org.camunda.bpm.engine.task.Task)4 ArrayList (java.util.ArrayList)3 AuthorizationException (org.camunda.bpm.engine.AuthorizationException)3 BadUserRequestException (org.camunda.bpm.engine.BadUserRequestException)3 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)3 ProcessEngineServices (org.camunda.bpm.engine.ProcessEngineServices)3 RepositoryService (org.camunda.bpm.engine.RepositoryService)3 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)3 ProcessInstanceQuery (org.camunda.bpm.engine.runtime.ProcessInstanceQuery)3