use of org.camunda.bpm.engine.history.HistoricProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyHistoricProcessInstanceQueryTest method testQueryWithoutTenantId.
public void testQueryWithoutTenantId() {
HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery();
assertThat(query.count(), is(2L));
}
use of org.camunda.bpm.engine.history.HistoricProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyHistoricProcessInstanceQueryTest method testQueryNoAuthenticatedTenants.
public void testQueryNoAuthenticatedTenants() {
identityService.setAuthentication("user", null, null);
HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery();
assertThat(query.count(), is(0L));
}
use of org.camunda.bpm.engine.history.HistoricProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyHistoricProcessInstanceQueryTest method testQueryByNonExistingTenantId.
public void testQueryByNonExistingTenantId() {
HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery().tenantIdIn("nonExisting");
assertThat(query.count(), is(0L));
}
use of org.camunda.bpm.engine.history.HistoricProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyProcessInstantiationTest method testRestartProcessInstanceAsyncWithTenantIdByHistoricProcessInstanceQuery.
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL)
public void testRestartProcessInstanceAsyncWithTenantIdByHistoricProcessInstanceQuery() {
// given
ProcessInstance processInstance = startAndDeleteProcessInstance(TENANT_ONE, PROCESS);
HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery().processDefinitionId(processInstance.getProcessDefinitionId());
identityService.setAuthentication("user", null, Collections.singletonList(TENANT_ONE));
// when
Batch batch = runtimeService.restartProcessInstances(processInstance.getProcessDefinitionId()).startBeforeActivity("userTask").historicProcessInstanceQuery(query).executeAsync();
batchHelper.completeBatch(batch);
// then
ProcessInstance restartedInstance = runtimeService.createProcessInstanceQuery().active().processDefinitionId(processInstance.getProcessDefinitionId()).singleResult();
assertNotNull(restartedInstance);
assertEquals(restartedInstance.getTenantId(), TENANT_ONE);
}
use of org.camunda.bpm.engine.history.HistoricProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyProcessInstantiationTest method testFailToRestartProcessInstanceAsyncWithOtherTenantIdByHistoricProcessInstanceQuery.
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL)
public void testFailToRestartProcessInstanceAsyncWithOtherTenantIdByHistoricProcessInstanceQuery() {
// given
ProcessInstance processInstance = startAndDeleteProcessInstance(TENANT_ONE, PROCESS);
HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery().processDefinitionId(processInstance.getProcessDefinitionId());
identityService.setAuthentication("user", null, Collections.singletonList(TENANT_TWO));
try {
// when
runtimeService.restartProcessInstances(processInstance.getProcessDefinitionId()).startBeforeActivity("userTask").historicProcessInstanceQuery(query).executeAsync();
} catch (ProcessEngineException e) {
assertThat(e.getMessage(), containsString("processInstanceIds is empty"));
}
}
Aggregations