Search in sources :

Example 1 with HistoricBatchDto

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

the class HistoricBatchRestServiceQueryTest method verifyHistoricBatchListJson.

protected void verifyHistoricBatchListJson(String historicBatchListJson) {
    List<Object> batches = from(historicBatchListJson).get();
    assertEquals("There should be one historic batch returned.", 1, batches.size());
    HistoricBatchDto historicBatch = from(historicBatchListJson).getObject("[0]", HistoricBatchDto.class);
    assertNotNull("The returned historic batch should not be null.", historicBatch);
    assertEquals(MockProvider.EXAMPLE_BATCH_ID, historicBatch.getId());
    assertEquals(MockProvider.EXAMPLE_BATCH_TYPE, historicBatch.getType());
    assertEquals(MockProvider.EXAMPLE_BATCH_TOTAL_JOBS, historicBatch.getTotalJobs());
    assertEquals(MockProvider.EXAMPLE_BATCH_JOBS_PER_SEED, historicBatch.getBatchJobsPerSeed());
    assertEquals(MockProvider.EXAMPLE_INVOCATIONS_PER_BATCH_JOB, historicBatch.getInvocationsPerBatchJob());
    assertEquals(MockProvider.EXAMPLE_SEED_JOB_DEFINITION_ID, historicBatch.getSeedJobDefinitionId());
    assertEquals(MockProvider.EXAMPLE_MONITOR_JOB_DEFINITION_ID, historicBatch.getMonitorJobDefinitionId());
    assertEquals(MockProvider.EXAMPLE_BATCH_JOB_DEFINITION_ID, historicBatch.getBatchJobDefinitionId());
    assertEquals(MockProvider.EXAMPLE_TENANT_ID, historicBatch.getTenantId());
    assertEquals(DateTimeUtil.parseDate(MockProvider.EXAMPLE_HISTORIC_BATCH_START_TIME), historicBatch.getStartTime());
    assertEquals(DateTimeUtil.parseDate(MockProvider.EXAMPLE_HISTORIC_BATCH_END_TIME), historicBatch.getEndTime());
}
Also used : HistoricBatchDto(org.camunda.bpm.engine.rest.dto.history.batch.HistoricBatchDto)

Example 2 with HistoricBatchDto

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

the class HistoricBatchRestServiceInteractionTest method verifyHistoricBatchJson.

protected void verifyHistoricBatchJson(String historicBatchJson) {
    HistoricBatchDto historicBatch = from(historicBatchJson).getObject("", HistoricBatchDto.class);
    assertNotNull("The returned historic batch should not be null.", historicBatch);
    assertEquals(MockProvider.EXAMPLE_BATCH_ID, historicBatch.getId());
    assertEquals(MockProvider.EXAMPLE_BATCH_TYPE, historicBatch.getType());
    assertEquals(MockProvider.EXAMPLE_BATCH_TOTAL_JOBS, historicBatch.getTotalJobs());
    assertEquals(MockProvider.EXAMPLE_BATCH_JOBS_PER_SEED, historicBatch.getBatchJobsPerSeed());
    assertEquals(MockProvider.EXAMPLE_INVOCATIONS_PER_BATCH_JOB, historicBatch.getInvocationsPerBatchJob());
    assertEquals(MockProvider.EXAMPLE_SEED_JOB_DEFINITION_ID, historicBatch.getSeedJobDefinitionId());
    assertEquals(MockProvider.EXAMPLE_MONITOR_JOB_DEFINITION_ID, historicBatch.getMonitorJobDefinitionId());
    assertEquals(MockProvider.EXAMPLE_BATCH_JOB_DEFINITION_ID, historicBatch.getBatchJobDefinitionId());
    assertEquals(MockProvider.EXAMPLE_TENANT_ID, historicBatch.getTenantId());
    assertEquals(DateTimeUtil.parseDate(MockProvider.EXAMPLE_HISTORIC_BATCH_START_TIME), historicBatch.getStartTime());
    assertEquals(DateTimeUtil.parseDate(MockProvider.EXAMPLE_HISTORIC_BATCH_END_TIME), historicBatch.getEndTime());
}
Also used : HistoricBatchDto(org.camunda.bpm.engine.rest.dto.history.batch.HistoricBatchDto)

Example 3 with HistoricBatchDto

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

the class HistoricBatchRestServiceImpl method getHistoricBatches.

@SuppressWarnings("unchecked")
@Override
public List<HistoricBatchDto> getHistoricBatches(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
    HistoricBatchQueryDto queryDto = new HistoricBatchQueryDto(objectMapper, uriInfo.getQueryParameters());
    HistoricBatchQuery query = queryDto.toQuery(processEngine);
    List<HistoricBatch> matchingBatches;
    if (firstResult != null || maxResults != null) {
        matchingBatches = (List<HistoricBatch>) executePaginatedQuery(query, firstResult, maxResults);
    } else {
        matchingBatches = query.list();
    }
    List<HistoricBatchDto> batchResults = new ArrayList<HistoricBatchDto>();
    for (HistoricBatch matchingBatch : matchingBatches) {
        batchResults.add(HistoricBatchDto.fromBatch(matchingBatch));
    }
    return batchResults;
}
Also used : HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) HistoricBatchQueryDto(org.camunda.bpm.engine.rest.dto.history.batch.HistoricBatchQueryDto) HistoricBatchQuery(org.camunda.bpm.engine.batch.history.HistoricBatchQuery) ArrayList(java.util.ArrayList) HistoricBatchDto(org.camunda.bpm.engine.rest.dto.history.batch.HistoricBatchDto)

Aggregations

HistoricBatchDto (org.camunda.bpm.engine.rest.dto.history.batch.HistoricBatchDto)3 ArrayList (java.util.ArrayList)1 HistoricBatch (org.camunda.bpm.engine.batch.history.HistoricBatch)1 HistoricBatchQuery (org.camunda.bpm.engine.batch.history.HistoricBatchQuery)1 HistoricBatchQueryDto (org.camunda.bpm.engine.rest.dto.history.batch.HistoricBatchQueryDto)1