Search in sources :

Example 6 with Job

use of org.camunda.bpm.engine.runtime.Job in project camunda-bpm-platform by camunda.

the class SpringTransactionIntegrationTest method testTransactionRollbackInServiceTaskWithCustomRetryCycle.

@Deployment
public void testTransactionRollbackInServiceTaskWithCustomRetryCycle() throws Exception {
    runtimeService.startProcessInstanceByKey("txRollbackServiceTaskWithCustomRetryCycle");
    waitForJobExecutorToProcessAllJobs(WAIT_TIME_MILLIS);
    Job job = managementService.createJobQuery().singleResult();
    assertNotNull(job);
    assertEquals(0, job.getRetries());
    assertEquals("Transaction rolled back because it has been marked as rollback-only", job.getExceptionMessage());
    String stacktrace = managementService.getJobExceptionStacktrace(job.getId());
    assertNotNull(stacktrace);
    assertTrue("unexpected stacktrace, was <" + stacktrace + ">", stacktrace.contains("Transaction rolled back because it has been marked as rollback-only"));
}
Also used : Job(org.camunda.bpm.engine.runtime.Job) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 7 with Job

use of org.camunda.bpm.engine.runtime.Job in project camunda-bpm-platform by camunda.

the class JobAuthorizationTest method testSetJobRetriesByJobDefinitionIdWithUpdateInstancePermissionOnAnyProcessDefinition.

public void testSetJobRetriesByJobDefinitionIdWithUpdateInstancePermissionOnAnyProcessDefinition() {
    // given
    String processInstanceId = startProcessInstanceByKey(TIMER_BOUNDARY_PROCESS_KEY).getId();
    createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, UPDATE_INSTANCE);
    String jobId = selectJobByProcessInstanceId(processInstanceId).getId();
    // when
    managementService.setJobRetries(jobId, 1);
    // then
    Job job = selectJobById(jobId);
    assertNotNull(job);
    assertEquals(1, job.getRetries());
}
Also used : Job(org.camunda.bpm.engine.runtime.Job)

Example 8 with Job

use of org.camunda.bpm.engine.runtime.Job in project camunda-bpm-platform by camunda.

the class JobAuthorizationTest method testSuspendJobByProcessInstanceIdWihtUpdatePermissionOnProcessDefinition.

public void testSuspendJobByProcessInstanceIdWihtUpdatePermissionOnProcessDefinition() {
    // given
    String processInstanceId = startProcessInstanceByKey(TIMER_BOUNDARY_PROCESS_KEY).getId();
    createGrantAuthorization(PROCESS_DEFINITION, TIMER_BOUNDARY_PROCESS_KEY, userId, UPDATE_INSTANCE);
    // when
    managementService.suspendJobByProcessInstanceId(processInstanceId);
    // then
    Job job = selectJobByProcessInstanceId(processInstanceId);
    assertNotNull(job);
    assertTrue(job.isSuspended());
}
Also used : Job(org.camunda.bpm.engine.runtime.Job)

Example 9 with Job

use of org.camunda.bpm.engine.runtime.Job in project camunda-bpm-platform by camunda.

the class JobAuthorizationTest method testSetJobDueDateWithUpdatePermissionOnAnyProcessInstance.

public void testSetJobDueDateWithUpdatePermissionOnAnyProcessInstance() {
    // given
    String processInstanceId = startProcessInstanceByKey(TIMER_BOUNDARY_PROCESS_KEY).getId();
    createGrantAuthorization(PROCESS_INSTANCE, ANY, userId, UPDATE);
    String jobId = selectJobByProcessInstanceId(processInstanceId).getId();
    // when
    managementService.setJobDuedate(jobId, null);
    // then
    Job job = selectJobById(jobId);
    assertNull(job.getDuedate());
}
Also used : Job(org.camunda.bpm.engine.runtime.Job)

Example 10 with Job

use of org.camunda.bpm.engine.runtime.Job in project camunda-bpm-platform by camunda.

the class JobAuthorizationTest method testQueryWithReadInstancePermissionOnTimerBoundaryProcessDefinition.

public void testQueryWithReadInstancePermissionOnTimerBoundaryProcessDefinition() {
    // given
    String processInstanceId = startProcessInstanceByKey(TIMER_BOUNDARY_PROCESS_KEY).getId();
    createGrantAuthorization(PROCESS_DEFINITION, TIMER_BOUNDARY_PROCESS_KEY, userId, READ_INSTANCE);
    // when
    JobQuery query = managementService.createJobQuery();
    // then
    verifyQueryResults(query, 1);
    Job job = query.singleResult();
    assertEquals(processInstanceId, job.getProcessInstanceId());
    assertEquals(TIMER_BOUNDARY_PROCESS_KEY, job.getProcessDefinitionKey());
}
Also used : JobQuery(org.camunda.bpm.engine.runtime.JobQuery) Job(org.camunda.bpm.engine.runtime.Job)

Aggregations

Job (org.camunda.bpm.engine.runtime.Job)696 Deployment (org.camunda.bpm.engine.test.Deployment)310 Test (org.junit.Test)232 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)189 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)148 JobDefinition (org.camunda.bpm.engine.management.JobDefinition)135 JobQuery (org.camunda.bpm.engine.runtime.JobQuery)116 HashMap (java.util.HashMap)98 Batch (org.camunda.bpm.engine.batch.Batch)78 JobDefinitionQuery (org.camunda.bpm.engine.management.JobDefinitionQuery)78 Task (org.camunda.bpm.engine.task.Task)71 Date (java.util.Date)67 MigrationPlan (org.camunda.bpm.engine.migration.MigrationPlan)48 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)24 AbstractFoxPlatformIntegrationTest (org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest)23 ActivityInstance (org.camunda.bpm.engine.runtime.ActivityInstance)21 TaskQuery (org.camunda.bpm.engine.task.TaskQuery)20 Incident (org.camunda.bpm.engine.runtime.Incident)17 HistoricJobLog (org.camunda.bpm.engine.history.HistoricJobLog)15 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)15