use of org.camunda.bpm.engine.management.JobDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyJobDefinitionQueryTest method testQueryAuthenticatedTenant.
public void testQueryAuthenticatedTenant() {
identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
JobDefinitionQuery query = managementService.createJobDefinitionQuery();
assertThat(query.count(), is(2L));
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
assertThat(query.tenantIdIn(TENANT_TWO).count(), is(0L));
assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).includeJobDefinitionsWithoutTenantId().count(), is(2L));
}
use of org.camunda.bpm.engine.management.JobDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyJobDefinitionQueryTest method testQueryAuthenticatedTenants.
public void testQueryAuthenticatedTenants() {
identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE, TENANT_TWO));
JobDefinitionQuery query = managementService.createJobDefinitionQuery();
assertThat(query.count(), is(3L));
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
assertThat(query.tenantIdIn(TENANT_TWO).count(), is(1L));
assertThat(query.withoutTenantId().count(), is(1L));
}
use of org.camunda.bpm.engine.management.JobDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyJobDefinitionSuspensionStateTest method suspendJobDefinitionWithAuthenticatedTenant.
@Test
public void suspendJobDefinitionWithAuthenticatedTenant() {
// given activated job definitions
JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery();
assertThat(query.active().count(), is(3L));
assertThat(query.suspended().count(), is(0L));
engineRule.getIdentityService().setAuthentication("user", null, Arrays.asList(TENANT_ONE));
engineRule.getManagementService().updateJobDefinitionSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).suspend();
engineRule.getIdentityService().clearAuthentication();
assertThat(query.active().count(), is(1L));
assertThat(query.suspended().count(), is(2L));
assertThat(query.active().tenantIdIn(TENANT_TWO).count(), is(1L));
assertThat(query.suspended().withoutTenantId().count(), is(1L));
assertThat(query.suspended().tenantIdIn(TENANT_ONE).count(), is(1L));
}
use of org.camunda.bpm.engine.management.JobDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyJobDefinitionSuspensionStateTest method suspendJobDefinitionForNonTenant.
@Test
public void suspendJobDefinitionForNonTenant() {
// given activated job definitions
JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery();
assertThat(query.active().count(), is(3L));
assertThat(query.suspended().count(), is(0L));
engineRule.getManagementService().updateJobDefinitionSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).processDefinitionWithoutTenantId().suspend();
assertThat(query.active().count(), is(2L));
assertThat(query.suspended().count(), is(1L));
assertThat(query.suspended().withoutTenantId().count(), is(1L));
}
use of org.camunda.bpm.engine.management.JobDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyJobDefinitionSuspensionStateTest method suspendAndActivateJobDefinitionsForAllTenants.
@Test
public void suspendAndActivateJobDefinitionsForAllTenants() {
// given activated job definitions
JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery();
assertThat(query.active().count(), is(3L));
assertThat(query.suspended().count(), is(0L));
// first suspend
engineRule.getManagementService().updateJobDefinitionSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).suspend();
assertThat(query.active().count(), is(0L));
assertThat(query.suspended().count(), is(3L));
// then activate
engineRule.getManagementService().updateJobDefinitionSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).activate();
assertThat(query.active().count(), is(3L));
assertThat(query.suspended().count(), is(0L));
}
Aggregations