use of org.camunda.bpm.engine.management.JobDefinition in project camunda-bpm-platform by camunda.
the class JobDefinitionAuthorizationTest method testActivateByProcessDefinitionKeyWithUpdatePermissionOnAnyProcessDefinition.
public void testActivateByProcessDefinitionKeyWithUpdatePermissionOnAnyProcessDefinition() {
// given
suspendJobDefinitionByProcessDefinitionKey(TIMER_BOUNDARY_PROCESS_KEY);
createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, UPDATE);
// when
managementService.activateJobDefinitionByProcessDefinitionKey(TIMER_BOUNDARY_PROCESS_KEY);
// then
JobDefinition jobDefinition = selectJobDefinitionByProcessDefinitionKey(TIMER_BOUNDARY_PROCESS_KEY);
assertNotNull(jobDefinition);
assertFalse(jobDefinition.isSuspended());
}
use of org.camunda.bpm.engine.management.JobDefinition in project camunda-bpm-platform by camunda.
the class JobDefinitionAuthorizationTest method testSuspendIncludingJobsByIdWithUpdatePermissionOnAnyProcessInstance.
public void testSuspendIncludingJobsByIdWithUpdatePermissionOnAnyProcessInstance() {
// given
String jobDefinitionId = selectJobDefinitionByProcessDefinitionKey(TIMER_BOUNDARY_PROCESS_KEY).getId();
String processInstanceId = startProcessInstanceByKey(TIMER_BOUNDARY_PROCESS_KEY).getId();
createGrantAuthorization(PROCESS_DEFINITION, TIMER_BOUNDARY_PROCESS_KEY, userId, UPDATE);
createGrantAuthorization(PROCESS_INSTANCE, ANY, userId, UPDATE);
// when
managementService.suspendJobDefinitionById(jobDefinitionId, true);
// then
JobDefinition jobDefinition = selectJobDefinitionByProcessDefinitionKey(TIMER_BOUNDARY_PROCESS_KEY);
assertNotNull(jobDefinition);
assertTrue(jobDefinition.isSuspended());
Job job = selectJobByProcessInstanceId(processInstanceId);
assertNotNull(job);
assertTrue(job.isSuspended());
}
use of org.camunda.bpm.engine.management.JobDefinition in project camunda-bpm-platform by camunda.
the class JobDefinitionAuthorizationTest method testSuspendIncludingJobsByProcessDefinitionKeyWithUpdateInstancePermissionOnProcessDefinition.
public void testSuspendIncludingJobsByProcessDefinitionKeyWithUpdateInstancePermissionOnProcessDefinition() {
// given
String processInstanceId = startProcessInstanceByKey(TIMER_BOUNDARY_PROCESS_KEY).getId();
createGrantAuthorization(PROCESS_DEFINITION, TIMER_BOUNDARY_PROCESS_KEY, userId, UPDATE, UPDATE_INSTANCE);
// when
managementService.suspendJobDefinitionByProcessDefinitionKey(TIMER_BOUNDARY_PROCESS_KEY, true);
// then
JobDefinition jobDefinition = selectJobDefinitionByProcessDefinitionKey(TIMER_BOUNDARY_PROCESS_KEY);
assertNotNull(jobDefinition);
assertTrue(jobDefinition.isSuspended());
Job job = selectJobByProcessInstanceId(processInstanceId);
assertNotNull(job);
assertTrue(job.isSuspended());
}
use of org.camunda.bpm.engine.management.JobDefinition in project camunda-bpm-platform by camunda.
the class JobDefinitionAuthorizationTest method testActivateIncludingJobsByProcessDefinitionKeyWithUpdateInstancePermissionOnAnyProcessDefinition.
public void testActivateIncludingJobsByProcessDefinitionKeyWithUpdateInstancePermissionOnAnyProcessDefinition() {
// given
String processInstanceId = startProcessInstanceByKey(TIMER_BOUNDARY_PROCESS_KEY).getId();
suspendJobDefinitionIncludingJobsByProcessDefinitionKey(TIMER_BOUNDARY_PROCESS_KEY);
createGrantAuthorization(PROCESS_DEFINITION, TIMER_BOUNDARY_PROCESS_KEY, userId, UPDATE);
createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, UPDATE_INSTANCE);
// when
managementService.activateJobDefinitionByProcessDefinitionKey(TIMER_BOUNDARY_PROCESS_KEY, true);
// then
JobDefinition jobDefinition = selectJobDefinitionByProcessDefinitionKey(TIMER_BOUNDARY_PROCESS_KEY);
assertNotNull(jobDefinition);
assertFalse(jobDefinition.isSuspended());
Job job = selectJobByProcessInstanceId(processInstanceId);
assertNotNull(job);
assertFalse(job.isSuspended());
}
use of org.camunda.bpm.engine.management.JobDefinition in project camunda-bpm-platform by camunda.
the class JobDefinitionAuthorizationTest method testSuspendIncludingJobsByIdWithUpdateInstancePermissionOnAnyProcessDefinition.
public void testSuspendIncludingJobsByIdWithUpdateInstancePermissionOnAnyProcessDefinition() {
// given
String jobDefinitionId = selectJobDefinitionByProcessDefinitionKey(TIMER_BOUNDARY_PROCESS_KEY).getId();
String processInstanceId = startProcessInstanceByKey(TIMER_BOUNDARY_PROCESS_KEY).getId();
createGrantAuthorization(PROCESS_DEFINITION, TIMER_BOUNDARY_PROCESS_KEY, userId, UPDATE);
createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, UPDATE_INSTANCE);
// when
managementService.suspendJobDefinitionById(jobDefinitionId, true);
// then
JobDefinition jobDefinition = selectJobDefinitionByProcessDefinitionKey(TIMER_BOUNDARY_PROCESS_KEY);
assertNotNull(jobDefinition);
assertTrue(jobDefinition.isSuspended());
Job job = selectJobByProcessInstanceId(processInstanceId);
assertNotNull(job);
assertTrue(job.isSuspended());
}
Aggregations