use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class ProcessInstanceAuthorizationTest method testSimpleQueryWithReadInstancesPermissionOnOneTaskProcess.
public void testSimpleQueryWithReadInstancesPermissionOnOneTaskProcess() {
// given
String processInstanceId = startProcessInstanceByKey(PROCESS_KEY).getId();
createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, READ_INSTANCE);
// when
ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery();
// then
verifyQueryResults(query, 1);
ProcessInstance instance = query.singleResult();
assertNotNull(instance);
assertEquals(processInstanceId, instance.getId());
}
use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class ManagementServiceAsyncOperationsTest method testSetJobsRetryAsyncWithProcessQuery.
@Test
public void testSetJobsRetryAsyncWithProcessQuery() throws Exception {
// given
ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery();
// when
Batch batch = managementService.setJobRetriesAsync(null, query, RETRIES);
executeSeedJob(batch);
List<Exception> exceptions = executeBatchJobs(batch);
// then
assertThat(exceptions.size(), is(0));
assertRetries(ids, RETRIES);
assertHistoricBatchExists(testRule);
}
use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class ManagementServiceAsyncOperationsTest method testSetJobsRetryAsyncWithNonExistingIDAsProcessQuery.
@Test
public void testSetJobsRetryAsyncWithNonExistingIDAsProcessQuery() throws Exception {
// expect
thrown.expect(ProcessEngineException.class);
// given
ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery().processInstanceId("aFake");
// when
managementService.setJobRetriesAsync(null, query, RETRIES);
}
use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyCallActivityTest method testStartProcessInstanceWithLatestBindingDifferentVersion.
public void testStartProcessInstanceWithLatestBindingDifferentVersion() {
BpmnModelInstance callingProcess = Bpmn.createExecutableProcess("callingProcess").startEvent().callActivity().calledElement("subProcess").camundaCalledElementBinding("latest").endEvent().done();
deploymentForTenant(TENANT_ONE, callingProcess, SUB_PROCESS);
deploymentForTenant(TENANT_TWO, callingProcess, SUB_PROCESS);
deploymentForTenant(TENANT_TWO, SUB_PROCESS);
runtimeService.createProcessInstanceByKey("callingProcess").processDefinitionTenantId(TENANT_ONE).execute();
runtimeService.createProcessInstanceByKey("callingProcess").processDefinitionTenantId(TENANT_TWO).execute();
ProcessDefinition latestSubProcessTenantTwo = repositoryService.createProcessDefinitionQuery().tenantIdIn(TENANT_TWO).processDefinitionKey("subProcess").latestVersion().singleResult();
ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery().processDefinitionKey("subProcess");
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
assertThat(query.tenantIdIn(TENANT_TWO).processDefinitionId(latestSubProcessTenantTwo.getId()).count(), is(1L));
}
use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyCallActivityTest method testStartProcessInstanceWithDeploymentBinding.
public void testStartProcessInstanceWithDeploymentBinding() {
BpmnModelInstance callingProcess = Bpmn.createExecutableProcess("callingProcess").startEvent().callActivity().calledElement("subProcess").camundaCalledElementBinding("deployment").endEvent().done();
deploymentForTenant(TENANT_ONE, callingProcess, SUB_PROCESS);
deploymentForTenant(TENANT_TWO, callingProcess, SUB_PROCESS);
runtimeService.createProcessInstanceByKey("callingProcess").processDefinitionTenantId(TENANT_ONE).execute();
runtimeService.createProcessInstanceByKey("callingProcess").processDefinitionTenantId(TENANT_TWO).execute();
ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery().processDefinitionKey("subProcess");
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
assertThat(query.tenantIdIn(TENANT_TWO).count(), is(1L));
}
Aggregations