Search in sources :

Example 11 with HistoricJobLogQuery

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

the class HistoricJobLogAuthorizationTest method testQueryWithHistoryReadPermissionOnAnyProcessDefinition.

public void testQueryWithHistoryReadPermissionOnAnyProcessDefinition() {
    // given
    startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
    startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
    startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
    disableAuthorization();
    String jobId = managementService.createJobQuery().processDefinitionKey(TIMER_START_PROCESS_KEY).singleResult().getId();
    managementService.executeJob(jobId);
    jobId = managementService.createJobQuery().processDefinitionKey(TIMER_START_PROCESS_KEY).singleResult().getId();
    managementService.executeJob(jobId);
    enableAuthorization();
    createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ_HISTORY);
    // when
    HistoricJobLogQuery query = historyService.createHistoricJobLogQuery();
    // then
    verifyQueryResults(query, 17);
}
Also used : HistoricJobLogQuery(org.camunda.bpm.engine.history.HistoricJobLogQuery)

Example 12 with HistoricJobLogQuery

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

the class HistoricJobLogAuthorizationTest method testStartTimerJobLogQueryWithoutAuthorization.

// historic job log query (start timer job) ////////////////////////////////
public void testStartTimerJobLogQueryWithoutAuthorization() {
    // given
    // when
    HistoricJobLogQuery query = historyService.createHistoricJobLogQuery();
    // then
    verifyQueryResults(query, 0);
}
Also used : HistoricJobLogQuery(org.camunda.bpm.engine.history.HistoricJobLogQuery)

Example 13 with HistoricJobLogQuery

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

the class HistoricJobLogAuthorizationTest method testQueryWithoutAuthorization.

// historic job log query (multiple process instance) ////////////////////////////////////////////////
public void testQueryWithoutAuthorization() {
    // given
    startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
    startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
    startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
    disableAuthorization();
    String jobId = managementService.createJobQuery().processDefinitionKey(TIMER_START_PROCESS_KEY).singleResult().getId();
    managementService.executeJob(jobId);
    jobId = managementService.createJobQuery().processDefinitionKey(TIMER_START_PROCESS_KEY).singleResult().getId();
    managementService.executeJob(jobId);
    enableAuthorization();
    // when
    HistoricJobLogQuery query = historyService.createHistoricJobLogQuery();
    // then
    verifyQueryResults(query, 0);
}
Also used : HistoricJobLogQuery(org.camunda.bpm.engine.history.HistoricJobLogQuery)

Example 14 with HistoricJobLogQuery

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

the class HistoricJobLogAuthorizationTest method testSimpleQueryWithHistoryReadPermissionOnProcessDefinition.

public void testSimpleQueryWithHistoryReadPermissionOnProcessDefinition() {
    // given
    startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
    createGrantAuthorization(PROCESS_DEFINITION, ONE_INCIDENT_PROCESS_KEY, userId, READ_HISTORY);
    // when
    HistoricJobLogQuery query = historyService.createHistoricJobLogQuery();
    // then
    verifyQueryResults(query, 4);
}
Also used : HistoricJobLogQuery(org.camunda.bpm.engine.history.HistoricJobLogQuery)

Example 15 with HistoricJobLogQuery

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

the class HistoricJobLogTest method testDeletedJob.

@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoricJobLogTest.testAsyncContinuation.bpmn20.xml" })
public void testDeletedJob() {
    // given
    runtimeService.startProcessInstanceByKey("process");
    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
    managementService.deleteJob(jobId);
    // 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)

Aggregations

HistoricJobLogQuery (org.camunda.bpm.engine.history.HistoricJobLogQuery)65 Deployment (org.camunda.bpm.engine.test.Deployment)28 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)17 HistoricJobLog (org.camunda.bpm.engine.history.HistoricJobLog)12 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)1 AbstractRestServiceTest (org.camunda.bpm.engine.rest.AbstractRestServiceTest)1 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 HistoricJobLogDto (org.camunda.bpm.engine.rest.dto.history.HistoricJobLogDto)1 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)1 Task (org.camunda.bpm.engine.task.Task)1 Test (org.junit.Test)1