Search in sources :

Example 41 with ExecutionQuery

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

the class MultiTenancyExecutionQueryTest method testQueryByExecutionsWithoutTenantId.

public void testQueryByExecutionsWithoutTenantId() {
    ExecutionQuery query = runtimeService.createExecutionQuery().withoutTenantId();
    assertThat(query.count(), is(1L));
}
Also used : ExecutionQuery(org.camunda.bpm.engine.runtime.ExecutionQuery)

Example 42 with ExecutionQuery

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

the class MultiTenancyExecutionQueryTest method testQueryAuthenticatedTenant.

public void testQueryAuthenticatedTenant() {
    identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
    ExecutionQuery query = runtimeService.createExecutionQuery();
    assertThat(query.count(), is(2L));
    assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
    assertThat(query.tenantIdIn(TENANT_TWO).count(), is(0L));
    assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count(), is(1L));
}
Also used : ExecutionQuery(org.camunda.bpm.engine.runtime.ExecutionQuery)

Example 43 with ExecutionQuery

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

the class MultiTenancyExecutionQueryTest method testQueryNoTenantIdSet.

public void testQueryNoTenantIdSet() {
    ExecutionQuery query = runtimeService.createExecutionQuery();
    assertThat(query.count(), is(3L));
}
Also used : ExecutionQuery(org.camunda.bpm.engine.runtime.ExecutionQuery)

Example 44 with ExecutionQuery

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

the class SignalEventTest method testSignalStartEventInEventSubProcess.

@Deployment
@Test
public void testSignalStartEventInEventSubProcess() {
    // start process instance
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("signalStartEventInEventSubProcess");
    // check if execution exists
    ExecutionQuery executionQuery = runtimeService.createExecutionQuery().processInstanceId(processInstance.getId());
    assertEquals(1, executionQuery.count());
    // check if user task exists
    TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(processInstance.getId());
    assertEquals(1, taskQuery.count());
    // send interrupting signal to event sub process
    runtimeService.signalEventReceived("alert");
    assertEquals(true, DummyServiceTask.wasExecuted);
    // check if user task doesn't exist because signal start event is interrupting
    taskQuery = taskService.createTaskQuery().processInstanceId(processInstance.getId());
    assertEquals(0, taskQuery.count());
    // check if execution doesn't exist because signal start event is interrupting
    executionQuery = runtimeService.createExecutionQuery().processInstanceId(processInstance.getId());
    assertEquals(0, executionQuery.count());
}
Also used : TaskQuery(org.camunda.bpm.engine.task.TaskQuery) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) ExecutionQuery(org.camunda.bpm.engine.runtime.ExecutionQuery) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 45 with ExecutionQuery

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

the class StartTimerEventTest method testNonInterruptingStartTimerEventInEventSubProcess.

@Deployment
public void testNonInterruptingStartTimerEventInEventSubProcess() {
    DummyServiceTask.wasExecuted = false;
    // start process instance
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("nonInterruptingStartTimerEventInEventSubProcess");
    // check if execution exists
    ExecutionQuery executionQuery = runtimeService.createExecutionQuery().processInstanceId(processInstance.getId());
    assertEquals(1, executionQuery.count());
    // check if user task exists
    TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(processInstance.getId());
    assertEquals(1, taskQuery.count());
    JobQuery jobQuery = managementService.createJobQuery();
    assertEquals(1, jobQuery.count());
    // execute existing job timer
    managementService.executeJob(managementService.createJobQuery().list().get(0).getId());
    assertEquals(0, jobQuery.count());
    assertEquals(true, DummyServiceTask.wasExecuted);
    // check if user task still exists because timer start event is non
    // interrupting
    assertEquals(1, taskQuery.count());
    // check if execution still exists because timer start event is non
    // interrupting
    assertEquals(1, executionQuery.count());
    ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId());
    assertEquals(1, processInstanceQuery.count());
}
Also used : ProcessInstanceQuery(org.camunda.bpm.engine.runtime.ProcessInstanceQuery) TaskQuery(org.camunda.bpm.engine.task.TaskQuery) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) JobQuery(org.camunda.bpm.engine.runtime.JobQuery) ExecutionQuery(org.camunda.bpm.engine.runtime.ExecutionQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

ExecutionQuery (org.camunda.bpm.engine.runtime.ExecutionQuery)59 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)27 Deployment (org.camunda.bpm.engine.test.Deployment)26 Execution (org.camunda.bpm.engine.runtime.Execution)17 TaskQuery (org.camunda.bpm.engine.task.TaskQuery)17 JobQuery (org.camunda.bpm.engine.runtime.JobQuery)14 ProcessInstanceQuery (org.camunda.bpm.engine.runtime.ProcessInstanceQuery)12 HashMap (java.util.HashMap)10 ArrayList (java.util.ArrayList)7 Job (org.camunda.bpm.engine.runtime.Job)6 Test (org.junit.Test)4 Date (java.util.Date)2 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)2 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)2 SimpleDateFormat (java.text.SimpleDateFormat)1 Calendar (java.util.Calendar)1 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 ExecutionDto (org.camunda.bpm.engine.rest.dto.runtime.ExecutionDto)1 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)1 CaseExecution (org.camunda.bpm.engine.runtime.CaseExecution)1