Search in sources :

Example 26 with ProcessDefinitionStatistics

use of org.camunda.bpm.engine.management.ProcessDefinitionStatistics in project camunda-bpm-platform by camunda.

the class ProcessDefinitionStatisticsQueryTest method testQueryByIncidentsWithFailedTimerStartEvent.

@Deployment(resources = "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testFailedTimerStartEvent.bpmn20.xml")
public void testQueryByIncidentsWithFailedTimerStartEvent() {
    executeAvailableJobs();
    List<ProcessDefinitionStatistics> statistics = managementService.createProcessDefinitionStatisticsQuery().includeIncidents().list();
    assertEquals(1, statistics.size());
    ProcessDefinitionStatistics result = statistics.get(0);
    // there is no running instance
    assertEquals(0, result.getInstances());
    List<IncidentStatistics> incidentStatistics = result.getIncidentStatistics();
    // but there is one incident for the failed timer job
    assertEquals(1, incidentStatistics.size());
    IncidentStatistics incidentStatistic = incidentStatistics.get(0);
    assertEquals(1, incidentStatistic.getIncidentCount());
    assertEquals(Incident.FAILED_JOB_HANDLER_TYPE, incidentStatistic.getIncidentType());
}
Also used : ProcessDefinitionStatistics(org.camunda.bpm.engine.management.ProcessDefinitionStatistics) IncidentStatistics(org.camunda.bpm.engine.management.IncidentStatistics) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 27 with ProcessDefinitionStatistics

use of org.camunda.bpm.engine.management.ProcessDefinitionStatistics in project camunda-bpm-platform by camunda.

the class MultiTenancySharedProcessDefinitionStatisticsQueryTest method instancesFailedJobsAndIncidentsCountWithAuthenticatedTenant.

@Test
public void instancesFailedJobsAndIncidentsCountWithAuthenticatedTenant() {
    testRule.deploy(failingProcess);
    startProcessInstances(FAILED_JOBS_PROCESS_DEFINITION_KEY);
    testRule.executeAvailableJobs();
    identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
    List<ProcessDefinitionStatistics> processDefinitionsStatistics = managementService.createProcessDefinitionStatisticsQuery().includeFailedJobs().includeIncidents().list();
    // then
    assertEquals(1, processDefinitionsStatistics.size());
    ProcessDefinitionStatistics processDefinitionStatistics = processDefinitionsStatistics.get(0);
    assertEquals(2, processDefinitionStatistics.getInstances());
    assertEquals(2, processDefinitionStatistics.getFailedJobs());
    List<IncidentStatistics> incidentStatistics = processDefinitionStatistics.getIncidentStatistics();
    assertEquals(1, incidentStatistics.size());
    assertEquals(2, incidentStatistics.get(0).getIncidentCount());
}
Also used : ProcessDefinitionStatistics(org.camunda.bpm.engine.management.ProcessDefinitionStatistics) IncidentStatistics(org.camunda.bpm.engine.management.IncidentStatistics) Test(org.junit.Test)

Example 28 with ProcessDefinitionStatistics

use of org.camunda.bpm.engine.management.ProcessDefinitionStatistics in project camunda-bpm-platform by camunda.

the class ProcessDefinitionStatisticsAuthorizationTest method testQueryWithReadPermissionOnAnyProcessDefinition.

public void testQueryWithReadPermissionOnAnyProcessDefinition() {
    // given
    createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ);
    // when
    ProcessDefinitionStatisticsQuery query = managementService.createProcessDefinitionStatisticsQuery();
    // then
    verifyQueryResults(query, 2);
    List<ProcessDefinitionStatistics> statistics = query.list();
    for (ProcessDefinitionStatistics result : statistics) {
        verifyStatisticsResult(result, 0, 0, 0);
    }
}
Also used : ProcessDefinitionStatistics(org.camunda.bpm.engine.management.ProcessDefinitionStatistics) ProcessDefinitionStatisticsQuery(org.camunda.bpm.engine.management.ProcessDefinitionStatisticsQuery)

Example 29 with ProcessDefinitionStatistics

use of org.camunda.bpm.engine.management.ProcessDefinitionStatistics in project camunda-bpm-platform by camunda.

the class ProcessDefinitionStatisticsAuthorizationTest method testQueryIncludingIncidentsWithoutProcessInstanceAuthorizations.

// including incidents //////////////////////////////////////////////////////////////////////////
public void testQueryIncludingIncidentsWithoutProcessInstanceAuthorizations() {
    // given
    startProcessInstanceByKey(ONE_TASK_PROCESS_KEY);
    startProcessInstanceByKey(ONE_TASK_PROCESS_KEY);
    startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
    startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
    startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
    createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ);
    // when
    List<ProcessDefinitionStatistics> statistics = managementService.createProcessDefinitionStatisticsQuery().includeIncidents().list();
    // then
    assertEquals(2, statistics.size());
    ProcessDefinitionStatistics oneTaskProcessStatistics = getStatisticsByKey(statistics, ONE_TASK_PROCESS_KEY);
    verifyStatisticsResult(oneTaskProcessStatistics, 2, 0, 0);
    ProcessDefinitionStatistics oneIncidentProcessStatistics = getStatisticsByKey(statistics, ONE_INCIDENT_PROCESS_KEY);
    verifyStatisticsResult(oneIncidentProcessStatistics, 3, 0, 3);
}
Also used : ProcessDefinitionStatistics(org.camunda.bpm.engine.management.ProcessDefinitionStatistics)

Aggregations

ProcessDefinitionStatistics (org.camunda.bpm.engine.management.ProcessDefinitionStatistics)29 Deployment (org.camunda.bpm.engine.test.Deployment)19 Test (org.junit.Test)16 IncidentStatistics (org.camunda.bpm.engine.management.IncidentStatistics)10 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)7 HashMap (java.util.HashMap)6 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)4 ProcessDefinitionStatisticsQuery (org.camunda.bpm.engine.management.ProcessDefinitionStatisticsQuery)3 ArrayList (java.util.ArrayList)2 ManagementService (org.camunda.bpm.engine.ManagementService)1 StatisticsResultDto (org.camunda.bpm.engine.rest.dto.StatisticsResultDto)1 ProcessDefinitionStatisticsResultDto (org.camunda.bpm.engine.rest.dto.repository.ProcessDefinitionStatisticsResultDto)1 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)1