Search in sources :

Example 6 with DeploymentStatistics

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

the class DeploymentStatisticsAuthorizationTest method testQueryWithReadPermissionOnDeployment.

public void testQueryWithReadPermissionOnDeployment() {
    // given
    createGrantAuthorization(DEPLOYMENT, firstDeploymentId, userId, READ);
    // when
    DeploymentStatisticsQuery query = managementService.createDeploymentStatisticsQuery();
    // then
    verifyQueryResults(query, 1);
    DeploymentStatistics statistics = query.singleResult();
    verifyStatisticsResult(statistics, 0, 0, 0);
}
Also used : DeploymentStatisticsQuery(org.camunda.bpm.engine.management.DeploymentStatisticsQuery) DeploymentStatistics(org.camunda.bpm.engine.management.DeploymentStatistics)

Example 7 with DeploymentStatistics

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

the class DeploymentStatisticsAuthorizationTest method testQueryIncludingIncidentsWithReadInstancePermissionOnAnyProcessDefinition.

public void testQueryIncludingIncidentsWithReadInstancePermissionOnAnyProcessDefinition() {
    // given
    createGrantAuthorization(DEPLOYMENT, ANY, userId, READ);
    startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
    startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
    startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
    startProcessInstanceByKey(TIMER_START_PROCESS_KEY);
    startProcessInstanceByKey(TIMER_START_PROCESS_KEY);
    startProcessInstanceByKey(TIMER_START_PROCESS_KEY);
    startProcessInstanceByKey(TIMER_BOUNDARY_PROCESS_KEY);
    startProcessInstanceByKey(TIMER_BOUNDARY_PROCESS_KEY);
    startProcessInstanceByKey(TIMER_BOUNDARY_PROCESS_KEY);
    createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ_INSTANCE);
    // when
    DeploymentStatisticsQuery query = managementService.createDeploymentStatisticsQuery().includeIncidents();
    // then
    List<DeploymentStatistics> statistics = query.list();
    for (DeploymentStatistics deploymentStatistics : statistics) {
        String id = deploymentStatistics.getId();
        if (id.equals(firstDeploymentId)) {
            verifyStatisticsResult(deploymentStatistics, 3, 0, 3);
        } else if (id.equals(secondDeploymentId)) {
            verifyStatisticsResult(deploymentStatistics, 3, 0, 0);
        } else if (id.equals(thirdDeploymentId)) {
            verifyStatisticsResult(deploymentStatistics, 3, 0, 0);
        } else {
            fail("Unexpected deployment");
        }
    }
}
Also used : DeploymentStatisticsQuery(org.camunda.bpm.engine.management.DeploymentStatisticsQuery) DeploymentStatistics(org.camunda.bpm.engine.management.DeploymentStatistics)

Example 8 with DeploymentStatistics

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

the class MultiTenancySharedDeploymentStatisticsQueryTest method instancesFailedJobsAndIncidentsCountWithAuthenticatedTenant.

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

Example 9 with DeploymentStatistics

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

the class DeploymentStatisticsQueryTest method testQueryByFailedJobsWithFailedTimerStartEvent.

@Deployment(resources = "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testFailedTimerStartEvent.bpmn20.xml")
public void testQueryByFailedJobsWithFailedTimerStartEvent() {
    executeAvailableJobs();
    List<DeploymentStatistics> statistics = managementService.createDeploymentStatisticsQuery().includeFailedJobs().list();
    assertEquals(1, statistics.size());
    DeploymentStatistics result = statistics.get(0);
    // there is no running instance
    assertEquals(0, result.getInstances());
    // but there is one failed timer job
    assertEquals(1, result.getFailedJobs());
}
Also used : DeploymentStatistics(org.camunda.bpm.engine.management.DeploymentStatistics) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 10 with DeploymentStatistics

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

the class DeploymentStatisticsQueryTest method testDeploymentStatisticsQueryWithIncidentType.

@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testMultiInstanceStatisticsQuery.bpmn20.xml", "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testStatisticsQueryWithFailedJobs.bpmn20.xml" })
public void testDeploymentStatisticsQueryWithIncidentType() {
    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put("fail", true);
    runtimeService.startProcessInstanceByKey("MIExampleProcess");
    runtimeService.startProcessInstanceByKey("ExampleProcess", parameters);
    executeAvailableJobs();
    List<DeploymentStatistics> statistics = managementService.createDeploymentStatisticsQuery().includeIncidentsForType("failedJob").list();
    assertFalse(statistics.isEmpty());
    assertEquals(1, statistics.size());
    DeploymentStatistics result = statistics.get(0);
    List<IncidentStatistics> incidentStatistics = result.getIncidentStatistics();
    assertFalse(incidentStatistics.isEmpty());
    assertEquals(1, incidentStatistics.size());
    IncidentStatistics incident = incidentStatistics.get(0);
    assertEquals(Incident.FAILED_JOB_HANDLER_TYPE, incident.getIncidentType());
    assertEquals(1, incident.getIncidentCount());
}
Also used : IncidentStatistics(org.camunda.bpm.engine.management.IncidentStatistics) DeploymentStatistics(org.camunda.bpm.engine.management.DeploymentStatistics) HashMap(java.util.HashMap) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

DeploymentStatistics (org.camunda.bpm.engine.management.DeploymentStatistics)31 DeploymentStatisticsQuery (org.camunda.bpm.engine.management.DeploymentStatisticsQuery)18 Deployment (org.camunda.bpm.engine.test.Deployment)11 IncidentStatistics (org.camunda.bpm.engine.management.IncidentStatistics)9 Test (org.junit.Test)9 HashMap (java.util.HashMap)5 Calendar (java.util.Calendar)1