use of org.camunda.bpm.engine.repository.ProcessDefinition in project camunda-bpm-platform by camunda.
the class MultiTenancyProcessInstantiationTest method testFailToStartProcessInstanceByIdWithoutTenantId.
public void testFailToStartProcessInstanceByIdWithoutTenantId() {
deploymentForTenant(TENANT_ONE, PROCESS);
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
try {
runtimeService.createProcessInstanceById(processDefinition.getId()).processDefinitionWithoutTenantId().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 testFailToStartProcessInstanceByIdNoAuthenticatedTenants.
public void testFailToStartProcessInstanceByIdNoAuthenticatedTenants() {
deploymentForTenant(TENANT_ONE, PROCESS);
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
identityService.setAuthentication("user", null, null);
try {
runtimeService.createProcessInstanceById(processDefinition.getId()).execute();
fail("expected exception");
} catch (ProcessEngineException e) {
assertThat(e.getMessage(), containsString("Cannot create an instance of the process definition"));
}
}
use of org.camunda.bpm.engine.repository.ProcessDefinition in project camunda-bpm-platform by camunda.
the class MultiTenancyMigrationTest method cannotCreateMigrationPlanBetweenDifferentTenants.
@Test
public void cannotCreateMigrationPlanBetweenDifferentTenants() {
// given
ProcessDefinition tenant1Definition = testHelper.deployForTenantAndGetDefinition(TENANT_ONE, ProcessModels.ONE_TASK_PROCESS);
ProcessDefinition tenant2Definition = testHelper.deployForTenantAndGetDefinition(TENANT_TWO, ProcessModels.ONE_TASK_PROCESS);
// when
try {
engineRule.getRuntimeService().createMigrationPlan(tenant1Definition.getId(), tenant2Definition.getId()).mapEqualActivities().build();
Assert.fail("exception expected");
} catch (ProcessEngineException e) {
// then
Assert.assertThat(e.getMessage(), CoreMatchers.containsString("Cannot migrate process instances between processes of different tenants ('tenant1' != 'tenant2')"));
}
}
use of org.camunda.bpm.engine.repository.ProcessDefinition in project camunda-bpm-platform by camunda.
the class MultiTenancyMigrationTest method canMigrateInstanceWithTenantIdToDefinitionWithoutTenantId.
@Test
public void canMigrateInstanceWithTenantIdToDefinitionWithoutTenantId() {
// given
ProcessDefinition sourceDefinition = testHelper.deployForTenantAndGetDefinition(TENANT_ONE, ProcessModels.ONE_TASK_PROCESS);
ProcessDefinition targetDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
ProcessInstance processInstance = engineRule.getRuntimeService().startProcessInstanceById(sourceDefinition.getId());
MigrationPlan migrationPlan = engineRule.getRuntimeService().createMigrationPlan(sourceDefinition.getId(), targetDefinition.getId()).mapEqualActivities().build();
// when
engineRule.getRuntimeService().newMigration(migrationPlan).processInstanceIds(Arrays.asList(processInstance.getId())).execute();
// then
assertMigratedTo(processInstance, targetDefinition);
}
use of org.camunda.bpm.engine.repository.ProcessDefinition in project camunda-bpm-platform by camunda.
the class MultiTenancyMigrationTest method canCreateMigrationPlanFromTenantToNoTenant.
@Test
public void canCreateMigrationPlanFromTenantToNoTenant() {
// given
ProcessDefinition sharedDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
ProcessDefinition tenantDefinition = testHelper.deployForTenantAndGetDefinition(TENANT_ONE, ProcessModels.ONE_TASK_PROCESS);
// when
MigrationPlan migrationPlan = engineRule.getRuntimeService().createMigrationPlan(tenantDefinition.getId(), sharedDefinition.getId()).mapEqualActivities().build();
// then
Assert.assertNotNull(migrationPlan);
}
Aggregations