use of org.camunda.bpm.engine.runtime.Execution in project camunda-bpm-platform by camunda.
the class ExecutionQueryTest method testQueryExecutionId.
public void testQueryExecutionId() {
Execution execution = runtimeService.createExecutionQuery().processDefinitionKey(SEQUENTIAL_PROCESS_KEY).singleResult();
assertNotNull(runtimeService.createExecutionQuery().executionId(execution.getId()));
}
use of org.camunda.bpm.engine.runtime.Execution in project camunda-bpm-platform by camunda.
the class MultiTenancyMessageEventReceivedCmdTenantCheckTest method correlateReceivedMessageToIntermediateCatchEventWithAuthenticatedTenant.
@Test
public void correlateReceivedMessageToIntermediateCatchEventWithAuthenticatedTenant() {
testRule.deployForTenant(TENANT_ONE, MESSAGE_CATCH_PROCESS);
engineRule.getRuntimeService().createProcessInstanceByKey("messageCatch").execute();
Execution execution = engineRule.getRuntimeService().createExecutionQuery().processDefinitionKey("messageCatch").messageEventSubscriptionName("message").singleResult();
engineRule.getIdentityService().setAuthentication("user", null, Arrays.asList(TENANT_ONE));
engineRule.getRuntimeService().messageEventReceived("message", execution.getId());
engineRule.getIdentityService().clearAuthentication();
TaskQuery query = engineRule.getTaskService().createTaskQuery();
assertThat(query.count(), is(1L));
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
}
use of org.camunda.bpm.engine.runtime.Execution in project camunda-bpm-platform by camunda.
the class MultiTenancySignalReceiveCmdTenantCheckTest method failToSignalIntermediateCatchEventNoAuthenticatedTenants.
@Test
public void failToSignalIntermediateCatchEventNoAuthenticatedTenants() {
testRule.deployForTenant(TENANT_ONE, SIGNAL_CATCH_PROCESS);
engineRule.getRuntimeService().createProcessInstanceByKey("signalCatch").execute();
Execution execution = engineRule.getRuntimeService().createExecutionQuery().processDefinitionKey("signalCatch").signalEventSubscriptionName("signal").singleResult();
// declared expected exception
thrown.expect(ProcessEngineException.class);
thrown.expectMessage("Cannot update the process instance");
engineRule.getIdentityService().setAuthentication("user", null, null);
engineRule.getRuntimeService().signal(execution.getId(), "signal", null, null);
}
use of org.camunda.bpm.engine.runtime.Execution in project camunda-bpm-platform by camunda.
the class MultiTenancySignalReceiveCmdTenantCheckTest method signalIntermediateCatchEventDisabledTenantCheck.
@Test
public void signalIntermediateCatchEventDisabledTenantCheck() {
testRule.deployForTenant(TENANT_ONE, SIGNAL_CATCH_PROCESS);
testRule.deployForTenant(TENANT_TWO, SIGNAL_CATCH_PROCESS);
engineRule.getRuntimeService().createProcessInstanceByKey("signalCatch").processDefinitionTenantId(TENANT_ONE).execute();
engineRule.getRuntimeService().createProcessInstanceByKey("signalCatch").processDefinitionTenantId(TENANT_TWO).execute();
Execution execution = engineRule.getRuntimeService().createExecutionQuery().processDefinitionKey("signalCatch").signalEventSubscriptionName("signal").tenantIdIn(TENANT_ONE).singleResult();
engineRule.getProcessEngineConfiguration().setTenantCheckEnabled(false);
engineRule.getIdentityService().setAuthentication("user", null, null);
engineRule.getRuntimeService().signal(execution.getId(), "signal", null, null);
TaskQuery query = engineRule.getTaskService().createTaskQuery();
assertThat(query.count(), is(1L));
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
assertThat(query.tenantIdIn(TENANT_TWO).count(), is(0L));
}
use of org.camunda.bpm.engine.runtime.Execution in project camunda-bpm-platform by camunda.
the class ExecutionVariablesTest method testTreeCompactionWithLocalVariableOnConcurrentExecution.
@Deployment
public void testTreeCompactionWithLocalVariableOnConcurrentExecution() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process");
Execution innerTaskExecution = runtimeService.createExecutionQuery().activityId("innerTask").singleResult();
Execution subProcessConcurrentExecution = runtimeService.createExecutionQuery().executionId(((ExecutionEntity) innerTaskExecution).getParentId()).singleResult();
Task task = taskService.createTaskQuery().taskDefinitionKey("task").singleResult();
// when
runtimeService.setVariableLocal(subProcessConcurrentExecution.getId(), "foo", "bar");
// and completing the concurrent task, thereby pruning the sub process concurrent execution
taskService.complete(task.getId());
// then the variable still exists
VariableInstance variable = runtimeService.createVariableInstanceQuery().singleResult();
assertNotNull(variable);
assertEquals("foo", variable.getName());
assertEquals(processInstance.getId(), variable.getExecutionId());
}
Aggregations