Search in sources :

Example 1 with BatchStatisticsDto

use of org.camunda.bpm.engine.rest.dto.batch.BatchStatisticsDto in project camunda-bpm-platform by camunda.

the class BatchRestServiceImpl method getStatistics.

public List<BatchStatisticsDto> getStatistics(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
    BatchStatisticsQueryDto queryDto = new BatchStatisticsQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
    BatchStatisticsQuery query = queryDto.toQuery(getProcessEngine());
    List<BatchStatistics> batchStatisticsList;
    if (firstResult != null || maxResults != null) {
        batchStatisticsList = executePaginatedStatisticsQuery(query, firstResult, maxResults);
    } else {
        batchStatisticsList = query.list();
    }
    List<BatchStatisticsDto> statisticsResults = new ArrayList<BatchStatisticsDto>();
    for (BatchStatistics batchStatistics : batchStatisticsList) {
        statisticsResults.add(BatchStatisticsDto.fromBatchStatistics(batchStatistics));
    }
    return statisticsResults;
}
Also used : BatchStatisticsQuery(org.camunda.bpm.engine.batch.BatchStatisticsQuery) BatchStatisticsQueryDto(org.camunda.bpm.engine.rest.dto.batch.BatchStatisticsQueryDto) ArrayList(java.util.ArrayList) BatchStatisticsDto(org.camunda.bpm.engine.rest.dto.batch.BatchStatisticsDto) BatchStatistics(org.camunda.bpm.engine.batch.BatchStatistics)

Example 2 with BatchStatisticsDto

use of org.camunda.bpm.engine.rest.dto.batch.BatchStatisticsDto in project camunda-bpm-platform by camunda.

the class BatchRestServiceStatisticsTest method verifyBatchStatisticsListJson.

protected void verifyBatchStatisticsListJson(String batchStatisticsListJson) {
    List<Object> batches = from(batchStatisticsListJson).get();
    assertEquals("There should be one batch statistics returned.", 1, batches.size());
    BatchStatisticsDto batchStatistics = from(batchStatisticsListJson).getObject("[0]", BatchStatisticsDto.class);
    assertNotNull("The returned batch statistics should not be null.", batchStatistics);
    assertEquals(MockProvider.EXAMPLE_BATCH_ID, batchStatistics.getId());
    assertEquals(MockProvider.EXAMPLE_BATCH_TYPE, batchStatistics.getType());
    assertEquals(MockProvider.EXAMPLE_BATCH_TOTAL_JOBS, batchStatistics.getTotalJobs());
    assertEquals(MockProvider.EXAMPLE_BATCH_JOBS_CREATED, batchStatistics.getJobsCreated());
    assertEquals(MockProvider.EXAMPLE_BATCH_JOBS_PER_SEED, batchStatistics.getBatchJobsPerSeed());
    assertEquals(MockProvider.EXAMPLE_INVOCATIONS_PER_BATCH_JOB, batchStatistics.getInvocationsPerBatchJob());
    assertEquals(MockProvider.EXAMPLE_SEED_JOB_DEFINITION_ID, batchStatistics.getSeedJobDefinitionId());
    assertEquals(MockProvider.EXAMPLE_MONITOR_JOB_DEFINITION_ID, batchStatistics.getMonitorJobDefinitionId());
    assertEquals(MockProvider.EXAMPLE_BATCH_JOB_DEFINITION_ID, batchStatistics.getBatchJobDefinitionId());
    assertEquals(MockProvider.EXAMPLE_TENANT_ID, batchStatistics.getTenantId());
    assertEquals(MockProvider.EXAMPLE_BATCH_REMAINING_JOBS, batchStatistics.getRemainingJobs());
    assertEquals(MockProvider.EXAMPLE_BATCH_COMPLETED_JOBS, batchStatistics.getCompletedJobs());
    assertEquals(MockProvider.EXAMPLE_BATCH_FAILED_JOBS, batchStatistics.getFailedJobs());
    assertTrue(batchStatistics.isSuspended());
}
Also used : BatchStatisticsDto(org.camunda.bpm.engine.rest.dto.batch.BatchStatisticsDto)

Aggregations

BatchStatisticsDto (org.camunda.bpm.engine.rest.dto.batch.BatchStatisticsDto)2 ArrayList (java.util.ArrayList)1 BatchStatistics (org.camunda.bpm.engine.batch.BatchStatistics)1 BatchStatisticsQuery (org.camunda.bpm.engine.batch.BatchStatisticsQuery)1 BatchStatisticsQueryDto (org.camunda.bpm.engine.rest.dto.batch.BatchStatisticsQueryDto)1