Search in sources :

Example 16 with HistoricJobLog

use of org.camunda.bpm.engine.history.HistoricJobLog in project camunda-bpm-platform by camunda.

the class HistoricJobLogTest method testSuccessfulHistoricJobLogEntryStoredForLongActivityId.

@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoricJobLogTest.testAsyncContinuationWithLongId.bpmn20.xml" })
public void testSuccessfulHistoricJobLogEntryStoredForLongActivityId() {
    runtimeService.startProcessInstanceByKey("process", Variables.createVariables().putValue("fail", false));
    Job job = managementService.createJobQuery().singleResult();
    managementService.executeJob(job.getId());
    HistoricJobLog historicJob = historyService.createHistoricJobLogQuery().successLog().singleResult();
    assertNotNull(historicJob);
    assertEquals("serviceTaskIdIsReallyLongAndItShouldBeMoreThan64CharsSoItWill" + "BlowAnyActivityIdColumnWhereSizeIs64OrLessSoWeAlignItTo255LikeEverywhereElse", historicJob.getActivityId());
}
Also used : HistoricJobLog(org.camunda.bpm.engine.history.HistoricJobLog) Job(org.camunda.bpm.engine.runtime.Job) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 17 with HistoricJobLog

use of org.camunda.bpm.engine.history.HistoricJobLog in project camunda-bpm-platform by camunda.

the class HistoricJobLogTest method testDeletedProcessInstance.

@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoricJobLogTest.testAsyncContinuation.bpmn20.xml" })
public void testDeletedProcessInstance() {
    // given
    String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId();
    String jobId = managementService.createJobQuery().singleResult().getId();
    HistoricJobLogQuery query = historyService.createHistoricJobLogQuery().jobId(jobId);
    HistoricJobLogQuery createdQuery = historyService.createHistoricJobLogQuery().jobId(jobId).creationLog();
    HistoricJobLogQuery deletedQuery = historyService.createHistoricJobLogQuery().jobId(jobId).deletionLog();
    // there exists one historic job log entry
    assertEquals(1, query.count());
    assertEquals(1, createdQuery.count());
    assertEquals(0, deletedQuery.count());
    // when
    runtimeService.deleteProcessInstance(processInstanceId, null);
    // then
    assertEquals(2, query.count());
    assertEquals(1, createdQuery.count());
    assertEquals(1, deletedQuery.count());
    HistoricJobLog createdJobLogEntry = createdQuery.singleResult();
    assertEquals(3, createdJobLogEntry.getJobRetries());
    HistoricJobLog deletedJobLogEntry = deletedQuery.singleResult();
    assertEquals(3, deletedJobLogEntry.getJobRetries());
}
Also used : HistoricJobLogQuery(org.camunda.bpm.engine.history.HistoricJobLogQuery) HistoricJobLog(org.camunda.bpm.engine.history.HistoricJobLog) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 18 with HistoricJobLog

use of org.camunda.bpm.engine.history.HistoricJobLog in project camunda-bpm-platform by camunda.

the class HistoricJobLogTest method testAsyncAfterJobHandlerType.

@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoricJobLogTest.testAsyncContinuation.bpmn20.xml" })
public void testAsyncAfterJobHandlerType() {
    runtimeService.startProcessInstanceByKey("process", Variables.createVariables().putValue("fail", false));
    Job job = managementService.createJobQuery().singleResult();
    managementService.executeJob(job.getId());
    Job anotherJob = managementService.createJobQuery().singleResult();
    assertFalse(job.getId().equals(anotherJob.getId()));
    HistoricJobLog historicJob = historyService.createHistoricJobLogQuery().jobId(anotherJob.getId()).singleResult();
    assertNotNull(historicJob);
    assertNull(historicJob.getJobDueDate());
    assertEquals(anotherJob.getJobDefinitionId(), historicJob.getJobDefinitionId());
    assertEquals("serviceTask", historicJob.getActivityId());
    assertEquals(AsyncContinuationJobHandler.TYPE, historicJob.getJobDefinitionType());
    assertEquals(MessageJobDeclaration.ASYNC_AFTER, historicJob.getJobDefinitionConfiguration());
}
Also used : HistoricJobLog(org.camunda.bpm.engine.history.HistoricJobLog) Job(org.camunda.bpm.engine.runtime.Job) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 19 with HistoricJobLog

use of org.camunda.bpm.engine.history.HistoricJobLog in project camunda-bpm-platform by camunda.

the class HistoricJobLogTest method testStartTimerEventInsideEventSubProcessJobHandlerType.

@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoricJobLogTest.testStartTimerEventInsideEventSubProcess.bpmn20.xml" })
public void testStartTimerEventInsideEventSubProcessJobHandlerType() {
    runtimeService.startProcessInstanceByKey("process");
    Job job = managementService.createJobQuery().singleResult();
    HistoricJobLog historicJob = historyService.createHistoricJobLogQuery().jobId(job.getId()).singleResult();
    assertNotNull(historicJob);
    assertEquals(job.getId(), historicJob.getJobId());
    assertEquals(job.getJobDefinitionId(), historicJob.getJobDefinitionId());
    assertEquals("subprocessStartEvent", historicJob.getActivityId());
    assertEquals(TimerStartEventSubprocessJobHandler.TYPE, historicJob.getJobDefinitionType());
    assertEquals("DURATION: PT1M", historicJob.getJobDefinitionConfiguration());
    assertEquals(job.getDuedate(), historicJob.getJobDueDate());
}
Also used : HistoricJobLog(org.camunda.bpm.engine.history.HistoricJobLog) Job(org.camunda.bpm.engine.runtime.Job) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 20 with HistoricJobLog

use of org.camunda.bpm.engine.history.HistoricJobLog in project camunda-bpm-platform by camunda.

the class HistoricJobLogTest method testAsyncBeforeJobHandlerType.

@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoricJobLogTest.testAsyncContinuation.bpmn20.xml" })
public void testAsyncBeforeJobHandlerType() {
    runtimeService.startProcessInstanceByKey("process");
    Job job = managementService.createJobQuery().singleResult();
    HistoricJobLog historicJob = historyService.createHistoricJobLogQuery().jobId(job.getId()).singleResult();
    assertNotNull(historicJob);
    assertNull(historicJob.getJobDueDate());
    assertEquals(job.getJobDefinitionId(), historicJob.getJobDefinitionId());
    assertEquals("serviceTask", historicJob.getActivityId());
    assertEquals(AsyncContinuationJobHandler.TYPE, historicJob.getJobDefinitionType());
    assertEquals(MessageJobDeclaration.ASYNC_BEFORE, historicJob.getJobDefinitionConfiguration());
}
Also used : HistoricJobLog(org.camunda.bpm.engine.history.HistoricJobLog) Job(org.camunda.bpm.engine.runtime.Job) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

HistoricJobLog (org.camunda.bpm.engine.history.HistoricJobLog)47 Deployment (org.camunda.bpm.engine.test.Deployment)26 Job (org.camunda.bpm.engine.runtime.Job)15 Date (java.util.Date)14 HistoricJobLogQuery (org.camunda.bpm.engine.history.HistoricJobLogQuery)13 Batch (org.camunda.bpm.engine.batch.Batch)12 HistoricBatch (org.camunda.bpm.engine.batch.history.HistoricBatch)12 Test (org.junit.Test)12 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)8 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)6 ArrayList (java.util.ArrayList)5 HistoryService (org.camunda.bpm.engine.HistoryService)2 HistoricJobLogEventEntity (org.camunda.bpm.engine.impl.persistence.entity.HistoricJobLogEventEntity)2 HashSet (java.util.HashSet)1 List (java.util.List)1 CommandContext (org.camunda.bpm.engine.impl.interceptor.CommandContext)1 CommandExecutor (org.camunda.bpm.engine.impl.interceptor.CommandExecutor)1 JobManager (org.camunda.bpm.engine.impl.persistence.entity.JobManager)1 HistoricJobLogDto (org.camunda.bpm.engine.rest.dto.history.HistoricJobLogDto)1 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)1