use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class MigrationProcessInstanceTest method testEmptyProcessInstanceQuery.
@Test
public void testEmptyProcessInstanceQuery() {
ProcessDefinition testProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
MigrationPlan migrationPlan = runtimeService.createMigrationPlan(testProcessDefinition.getId(), testProcessDefinition.getId()).mapEqualActivities().build();
ProcessInstanceQuery emptyProcessInstanceQuery = runtimeService.createProcessInstanceQuery();
assertEquals(0, emptyProcessInstanceQuery.count());
try {
runtimeService.newMigration(migrationPlan).processInstanceQuery(emptyProcessInstanceQuery).execute();
fail("Should not be able to migrate");
} catch (ProcessEngineException e) {
assertThat(e.getMessage(), CoreMatchers.containsString("process instance ids is empty"));
}
}
use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class ProcessInstanceAuthorizationTest method testStartProcessInstanceByKey.
public void testStartProcessInstanceByKey() {
// given
createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, CREATE_INSTANCE);
createGrantAuthorization(PROCESS_INSTANCE, ANY, userId, CREATE);
// when
runtimeService.startProcessInstanceByKey(PROCESS_KEY);
// then
disableAuthorization();
ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery();
verifyQueryResults(query, 1);
enableAuthorization();
}
use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class ProcessInstanceAuthorizationTest method testSimpleQueryWithMultiple.
public void testSimpleQueryWithMultiple() {
// given
String processInstanceId = startProcessInstanceByKey(PROCESS_KEY).getId();
createGrantAuthorization(PROCESS_INSTANCE, processInstanceId, userId, READ);
createGrantAuthorization(PROCESS_INSTANCE, ANY, userId, READ);
// when
ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery();
// then
verifyQueryResults(query, 1);
}
use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class ProcessInstanceAuthorizationTest method testQueryWithReadInstancesPermissionOnOneTaskProcess.
public void testQueryWithReadInstancesPermissionOnOneTaskProcess() {
// given
startProcessInstanceByKey(PROCESS_KEY);
startProcessInstanceByKey(PROCESS_KEY);
startProcessInstanceByKey(PROCESS_KEY);
startProcessInstanceByKey(MESSAGE_START_PROCESS_KEY);
startProcessInstanceByKey(MESSAGE_START_PROCESS_KEY);
startProcessInstanceByKey(MESSAGE_START_PROCESS_KEY);
startProcessInstanceByKey(MESSAGE_START_PROCESS_KEY);
createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, READ_INSTANCE);
// when
ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery();
// then
verifyQueryResults(query, 3);
}
use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class ProcessInstanceAuthorizationTest method testStartProcessInstanceByMessage.
public void testStartProcessInstanceByMessage() {
// given
createGrantAuthorization(PROCESS_DEFINITION, MESSAGE_START_PROCESS_KEY, userId, CREATE_INSTANCE);
createGrantAuthorization(PROCESS_INSTANCE, ANY, userId, CREATE);
// when
runtimeService.startProcessInstanceByMessage("startInvoiceMessage");
// then
disableAuthorization();
ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery();
verifyQueryResults(query, 1);
enableAuthorization();
}
Aggregations