Search in sources :

Example 1 with BatchStatistics

use of org.camunda.bpm.engine.batch.BatchStatistics 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 BatchStatistics

use of org.camunda.bpm.engine.batch.BatchStatistics in project camunda-bpm-platform by camunda.

the class MockBatchStatisticsBuilder method build.

public BatchStatistics build() {
    BatchStatistics batchStatistics = mock(BatchStatistics.class);
    when(batchStatistics.getId()).thenReturn(id);
    when(batchStatistics.getType()).thenReturn(type);
    when(batchStatistics.getTotalJobs()).thenReturn(size);
    when(batchStatistics.getJobsCreated()).thenReturn(jobsCreated);
    when(batchStatistics.getBatchJobsPerSeed()).thenReturn(batchJobsPerSeed);
    when(batchStatistics.getInvocationsPerBatchJob()).thenReturn(invocationsPerBatchJob);
    when(batchStatistics.getSeedJobDefinitionId()).thenReturn(seedJobDefinitionId);
    when(batchStatistics.getMonitorJobDefinitionId()).thenReturn(monitorJobDefinitionId);
    when(batchStatistics.getBatchJobDefinitionId()).thenReturn(batchJobDefinitionId);
    when(batchStatistics.getTenantId()).thenReturn(tenantId);
    when(batchStatistics.getRemainingJobs()).thenReturn(remainingJobs);
    when(batchStatistics.getCompletedJobs()).thenReturn(completedJobs);
    when(batchStatistics.getFailedJobs()).thenReturn(failedJobs);
    when(batchStatistics.isSuspended()).thenReturn(suspended);
    return batchStatistics;
}
Also used : BatchStatistics(org.camunda.bpm.engine.batch.BatchStatistics)

Example 3 with BatchStatistics

use of org.camunda.bpm.engine.batch.BatchStatistics in project camunda-bpm-platform by camunda.

the class MultiTenancyBatchQueryTest method testBatchStatisticsQueryFilterWithoutTenantId.

@Test
public void testBatchStatisticsQueryFilterWithoutTenantId() {
    // when
    BatchStatistics returnedBatch = managementService.createBatchStatisticsQuery().withoutTenantId().singleResult();
    // then
    Assert.assertNotNull(returnedBatch);
    Assert.assertEquals(sharedBatch.getId(), returnedBatch.getId());
}
Also used : BatchStatistics(org.camunda.bpm.engine.batch.BatchStatistics) Test(org.junit.Test)

Example 4 with BatchStatistics

use of org.camunda.bpm.engine.batch.BatchStatistics in project camunda-bpm-platform by camunda.

the class BatchStatisticsQueryTest method testStatisticsOneFailedJob.

@Test
public void testStatisticsOneFailedJob() {
    // given
    Batch batch = helper.createMigrationBatchWithSize(3);
    // when
    helper.completeSeedJobs(batch);
    helper.failExecutionJobs(batch, 1);
    // then
    BatchStatistics batchStatistics = managementService.createBatchStatisticsQuery().singleResult();
    assertEquals(3, batchStatistics.getTotalJobs());
    assertEquals(3, batchStatistics.getJobsCreated());
    assertEquals(3, batchStatistics.getRemainingJobs());
    assertEquals(0, batchStatistics.getCompletedJobs());
    assertEquals(1, batchStatistics.getFailedJobs());
}
Also used : Batch(org.camunda.bpm.engine.batch.Batch) BatchStatistics(org.camunda.bpm.engine.batch.BatchStatistics) Test(org.junit.Test)

Example 5 with BatchStatistics

use of org.camunda.bpm.engine.batch.BatchStatistics in project camunda-bpm-platform by camunda.

the class BatchStatisticsQueryTest method testStatisticsAllExecutionJobsGenerated.

@Test
public void testStatisticsAllExecutionJobsGenerated() {
    // given
    Batch batch = helper.createMigrationBatchWithSize(3);
    // when
    helper.completeSeedJobs(batch);
    // then
    BatchStatistics batchStatistics = managementService.createBatchStatisticsQuery().singleResult();
    assertEquals(3, batchStatistics.getTotalJobs());
    assertEquals(3, batchStatistics.getJobsCreated());
    assertEquals(3, batchStatistics.getRemainingJobs());
    assertEquals(0, batchStatistics.getCompletedJobs());
    assertEquals(0, batchStatistics.getFailedJobs());
}
Also used : Batch(org.camunda.bpm.engine.batch.Batch) BatchStatistics(org.camunda.bpm.engine.batch.BatchStatistics) Test(org.junit.Test)

Aggregations

BatchStatistics (org.camunda.bpm.engine.batch.BatchStatistics)18 Test (org.junit.Test)16 Batch (org.camunda.bpm.engine.batch.Batch)13 ArrayList (java.util.ArrayList)1 BatchStatisticsQuery (org.camunda.bpm.engine.batch.BatchStatisticsQuery)1 BatchStatisticsDto (org.camunda.bpm.engine.rest.dto.batch.BatchStatisticsDto)1 BatchStatisticsQueryDto (org.camunda.bpm.engine.rest.dto.batch.BatchStatisticsQueryDto)1