Search in sources :

Example 11 with JobDefinitionQuery

use of org.camunda.bpm.engine.management.JobDefinitionQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyJobDefinitionSuspensionStateTest method suspendJobDefinitionNoAuthenticatedTenants.

@Test
public void suspendJobDefinitionNoAuthenticatedTenants() {
    // 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, null);
    engineRule.getManagementService().updateJobDefinitionSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).suspend();
    engineRule.getIdentityService().clearAuthentication();
    assertThat(query.active().count(), is(2L));
    assertThat(query.suspended().count(), is(1L));
    assertThat(query.suspended().withoutTenantId().count(), is(1L));
}
Also used : JobDefinitionQuery(org.camunda.bpm.engine.management.JobDefinitionQuery) Test(org.junit.Test)

Example 12 with JobDefinitionQuery

use of org.camunda.bpm.engine.management.JobDefinitionQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyProcessDefinitionSuspensionStateTest method activateProcessDefinitionIncludingJobDefinitionsForTenant.

@Test
public void activateProcessDefinitionIncludingJobDefinitionsForTenant() {
    // given suspended jobs
    engineRule.getRepositoryService().updateProcessDefinitionSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).suspend();
    JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery();
    assertThat(query.active().count(), is(0L));
    assertThat(query.suspended().count(), is(3L));
    engineRule.getRepositoryService().updateProcessDefinitionSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).processDefinitionTenantId(TENANT_ONE).activate();
    assertThat(query.suspended().count(), is(2L));
    assertThat(query.active().count(), is(1L));
    assertThat(query.active().tenantIdIn(TENANT_ONE).count(), is(1L));
}
Also used : JobDefinitionQuery(org.camunda.bpm.engine.management.JobDefinitionQuery) Test(org.junit.Test)

Example 13 with JobDefinitionQuery

use of org.camunda.bpm.engine.management.JobDefinitionQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyProcessDefinitionSuspensionStateTest method activateProcessDefinitionIncludingJobDefinitionsForAllTenants.

@Test
public void activateProcessDefinitionIncludingJobDefinitionsForAllTenants() {
    // given suspended jobs
    engineRule.getRepositoryService().updateProcessDefinitionSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).suspend();
    JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery();
    assertThat(query.active().count(), is(0L));
    assertThat(query.suspended().count(), is(3L));
    engineRule.getRepositoryService().updateProcessDefinitionSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).activate();
    assertThat(query.suspended().count(), is(0L));
    assertThat(query.active().count(), is(3L));
}
Also used : JobDefinitionQuery(org.camunda.bpm.engine.management.JobDefinitionQuery) Test(org.junit.Test)

Example 14 with JobDefinitionQuery

use of org.camunda.bpm.engine.management.JobDefinitionQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyProcessDefinitionSuspensionStateTest method suspendProcessDefinitionIncludingJobDefinitionsForAllTenants.

@Test
public void suspendProcessDefinitionIncludingJobDefinitionsForAllTenants() {
    // given activated jobs
    JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery();
    assertThat(query.active().count(), is(3L));
    assertThat(query.suspended().count(), is(0L));
    engineRule.getRepositoryService().updateProcessDefinitionSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).suspend();
    assertThat(query.active().count(), is(0L));
    assertThat(query.suspended().count(), is(3L));
}
Also used : JobDefinitionQuery(org.camunda.bpm.engine.management.JobDefinitionQuery) Test(org.junit.Test)

Example 15 with JobDefinitionQuery

use of org.camunda.bpm.engine.management.JobDefinitionQuery in project camunda-bpm-platform by camunda.

the class JobDefinitionAuthorizationTest method testQueryWithReadPermissionOnAnyProcessDefinition.

public void testQueryWithReadPermissionOnAnyProcessDefinition() {
    // given
    createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ);
    // when
    JobDefinitionQuery query = managementService.createJobDefinitionQuery();
    // then
    verifyQueryResults(query, 2);
}
Also used : JobDefinitionQuery(org.camunda.bpm.engine.management.JobDefinitionQuery)

Aggregations

JobDefinitionQuery (org.camunda.bpm.engine.management.JobDefinitionQuery)163 Deployment (org.camunda.bpm.engine.test.Deployment)89 JobQuery (org.camunda.bpm.engine.runtime.JobQuery)88 HashMap (java.util.HashMap)86 JobDefinition (org.camunda.bpm.engine.management.JobDefinition)86 Job (org.camunda.bpm.engine.runtime.Job)78 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)54 Test (org.junit.Test)31 Date (java.util.Date)12 InputStream (java.io.InputStream)10 Deployment (org.camunda.bpm.engine.repository.Deployment)10 DeploymentBuilder (org.camunda.bpm.engine.repository.DeploymentBuilder)10 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)6 ArrayList (java.util.ArrayList)2 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 JobDefinitionDto (org.camunda.bpm.engine.rest.dto.management.JobDefinitionDto)1 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)1 Matchers.anyString (org.mockito.Matchers.anyString)1