use of org.camunda.bpm.engine.runtime.Job in project camunda-bpm-platform by camunda.
the class JobAuthorizationTest method testDeleteStandaloneJob.
// delete standalone job ////////////////////////////////
public void testDeleteStandaloneJob() {
// given
createGrantAuthorization(PROCESS_DEFINITION, TIMER_START_PROCESS_KEY, userId, UPDATE);
Date startTime = new Date();
ClockUtil.setCurrentTime(startTime);
long oneWeekFromStartTime = startTime.getTime() + (7 * 24 * 60 * 60 * 1000);
disableAuthorization();
// creates a new "standalone" job
managementService.suspendJobDefinitionByProcessDefinitionKey(TIMER_START_PROCESS_KEY, false, new Date(oneWeekFromStartTime));
enableAuthorization();
String jobId = managementService.createJobQuery().singleResult().getId();
// when
managementService.deleteJob(jobId);
// then
Job job = selectJobById(jobId);
assertNull(job);
}
use of org.camunda.bpm.engine.runtime.Job in project camunda-bpm-platform by camunda.
the class JobAuthorizationTest method testSuspendJobByIdWihtUpdatePermissionOnAnyProcessInstance.
public void testSuspendJobByIdWihtUpdatePermissionOnAnyProcessInstance() {
// given
String processInstanceId = startProcessInstanceByKey(TIMER_BOUNDARY_PROCESS_KEY).getId();
String jobId = selectJobByProcessInstanceId(processInstanceId).getId();
createGrantAuthorization(PROCESS_INSTANCE, ANY, userId, UPDATE);
// when
managementService.suspendJobById(jobId);
// then
Job job = selectJobByProcessInstanceId(processInstanceId);
assertNotNull(job);
assertTrue(job.isSuspended());
}
use of org.camunda.bpm.engine.runtime.Job in project camunda-bpm-platform by camunda.
the class JobAuthorizationTest method testActivateJobByJobDefinitionIdWihtUpdatePermissionOnAnyProcessDefinition.
public void testActivateJobByJobDefinitionIdWihtUpdatePermissionOnAnyProcessDefinition() {
// given
String processInstanceId = startProcessInstanceByKey(TIMER_BOUNDARY_PROCESS_KEY).getId();
String jobDefinitionId = selectJobDefinitionByProcessDefinitionKey(TIMER_BOUNDARY_PROCESS_KEY).getId();
suspendJobByJobDefinitionId(jobDefinitionId);
createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, UPDATE_INSTANCE);
// when
managementService.activateJobByJobDefinitionId(jobDefinitionId);
// then
Job job = selectJobByProcessInstanceId(processInstanceId);
assertNotNull(job);
assertFalse(job.isSuspended());
}
use of org.camunda.bpm.engine.runtime.Job in project camunda-bpm-platform by camunda.
the class JobAuthorizationTest method testSuspendJobByProcessInstanceIdWihtUpdatePermissionOnAnyProcessDefinition.
public void testSuspendJobByProcessInstanceIdWihtUpdatePermissionOnAnyProcessDefinition() {
// given
String processInstanceId = startProcessInstanceByKey(TIMER_BOUNDARY_PROCESS_KEY).getId();
createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, UPDATE_INSTANCE);
// when
managementService.suspendJobByProcessInstanceId(processInstanceId);
// then
Job job = selectJobByProcessInstanceId(processInstanceId);
assertNotNull(job);
assertTrue(job.isSuspended());
}
use of org.camunda.bpm.engine.runtime.Job in project camunda-bpm-platform by camunda.
the class JobAuthorizationTest method testSuspendJobByProcessDefinitionIdWihtUpdatePermissionOnProcessDefinition.
public void testSuspendJobByProcessDefinitionIdWihtUpdatePermissionOnProcessDefinition() {
// given
String processInstanceId = startProcessInstanceByKey(TIMER_BOUNDARY_PROCESS_KEY).getId();
String processDefinitionId = selectProcessDefinitionByKey(TIMER_BOUNDARY_PROCESS_KEY).getId();
createGrantAuthorization(PROCESS_DEFINITION, TIMER_BOUNDARY_PROCESS_KEY, userId, UPDATE_INSTANCE);
// when
managementService.suspendJobByProcessDefinitionId(processDefinitionId);
// then
Job job = selectJobByProcessInstanceId(processInstanceId);
assertNotNull(job);
assertTrue(job.isSuspended());
}
Aggregations