use of org.camunda.bpm.engine.repository.ProcessDefinition in project camunda-bpm-platform by camunda.
the class MultiTenancyProcessDefinitionQueryTest method testQueryByLatestNoTenantIdSet.
public void testQueryByLatestNoTenantIdSet() {
// deploy a second version for tenant one
deploymentForTenant(TENANT_ONE, emptyProcess);
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery().processDefinitionKey(PROCESS_DEFINITION_KEY).latestVersion();
// one definition for each tenant
assertThat(query.count(), is(3L));
Map<String, ProcessDefinition> processDefinitionsForTenant = getProcessDefinitionsForTenant(query.list());
assertThat(processDefinitionsForTenant.get(TENANT_ONE).getVersion(), is(2));
assertThat(processDefinitionsForTenant.get(TENANT_TWO).getVersion(), is(1));
assertThat(processDefinitionsForTenant.get(null).getVersion(), is(1));
}
use of org.camunda.bpm.engine.repository.ProcessDefinition in project camunda-bpm-platform by camunda.
the class MultiTenancyHistoricIdentityLinkLogQueryTest method addAndRemoveHistoricIdentityLinksForProcessDefinitionWithTenantId.
@Test
public void addAndRemoveHistoricIdentityLinksForProcessDefinitionWithTenantId() throws Exception {
String resourceName = "org/camunda/bpm/engine/test/api/runtime/oneTaskProcess.bpmn20.xml";
testRule.deployForTenant(TENANT_1, resourceName);
testRule.deployForTenant(TENANT_2, resourceName);
ProcessDefinition processDefinition1 = repositoryService.createProcessDefinitionQuery().processDefinitionKey(PROCESS_DEFINITION_KEY).list().get(0);
ProcessDefinition processDefinition2 = repositoryService.createProcessDefinitionQuery().processDefinitionKey(PROCESS_DEFINITION_KEY).list().get(1);
assertNotNull(processDefinition1);
assertNotNull(processDefinition2);
testTenantsByProcessDefinition(processDefinition1.getId());
testTenantsByProcessDefinition(processDefinition2.getId());
List<HistoricIdentityLinkLog> historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
assertEquals(historicIdentityLinks.size(), 8);
// Query test
HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.tenantIdIn(TENANT_1).count(), 4);
query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.tenantIdIn(TENANT_2).count(), 4);
}
use of org.camunda.bpm.engine.repository.ProcessDefinition in project camunda-bpm-platform by camunda.
the class MultiTenancyProcessInstantiationTest method testFailToStartProcessInstanceAtActivityByIdWithoutTenantId.
public void testFailToStartProcessInstanceAtActivityByIdWithoutTenantId() {
deployment(PROCESS);
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
try {
runtimeService.createProcessInstanceById(processDefinition.getId()).processDefinitionWithoutTenantId().startBeforeActivity("userTask").execute();
fail("expected exception");
} catch (BadUserRequestException e) {
assertThat(e.getMessage(), containsString("Cannot specify a tenant-id"));
}
}
use of org.camunda.bpm.engine.repository.ProcessDefinition in project camunda-bpm-platform by camunda.
the class MultiTenancyProcessInstantiationTest method testStartProcessInstanceByIdAuthenticatedTenant.
public void testStartProcessInstanceByIdAuthenticatedTenant() {
deploymentForTenant(TENANT_ONE, PROCESS);
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
runtimeService.createProcessInstanceById(processDefinition.getId()).execute();
ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery();
assertThat(query.count(), is(1L));
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
}
use of org.camunda.bpm.engine.repository.ProcessDefinition in project camunda-bpm-platform by camunda.
the class MultiTenancyProcessInstantiationTest method testFailToStartProcessInstanceAtActivityByIdAndTenantId.
public void testFailToStartProcessInstanceAtActivityByIdAndTenantId() {
deploymentForTenant(TENANT_ONE, PROCESS);
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
try {
runtimeService.createProcessInstanceById(processDefinition.getId()).processDefinitionTenantId(TENANT_ONE).startBeforeActivity("userTask").execute();
fail("expected exception");
} catch (BadUserRequestException e) {
assertThat(e.getMessage(), containsString("Cannot specify a tenant-id"));
}
}
Aggregations