use of org.camunda.bpm.engine.history.CleanableHistoricProcessInstanceReport in project camunda-bpm-platform by camunda.
the class HistoricProcessDefinitionRestServiceImpl method getCleanableHistoricProcessInstanceReport.
@Override
public List<CleanableHistoricProcessInstanceReportResultDto> getCleanableHistoricProcessInstanceReport(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
CleanableHistoricProcessInstanceReportDto queryDto = new CleanableHistoricProcessInstanceReportDto(objectMapper, uriInfo.getQueryParameters());
CleanableHistoricProcessInstanceReport query = queryDto.toQuery(processEngine);
List<CleanableHistoricProcessInstanceReportResult> reportResult;
if (firstResult != null || maxResults != null) {
reportResult = executePaginatedQuery(query, firstResult, maxResults);
} else {
reportResult = query.list();
}
return CleanableHistoricProcessInstanceReportResultDto.convert(reportResult);
}
use of org.camunda.bpm.engine.history.CleanableHistoricProcessInstanceReport in project camunda-bpm-platform by camunda.
the class HistoricProcessDefinitionRestServiceImpl method getCleanableHistoricProcessInstanceReportCount.
@Override
public CountResultDto getCleanableHistoricProcessInstanceReportCount(UriInfo uriInfo) {
CleanableHistoricProcessInstanceReportDto queryDto = new CleanableHistoricProcessInstanceReportDto(objectMapper, uriInfo.getQueryParameters());
queryDto.setObjectMapper(objectMapper);
CleanableHistoricProcessInstanceReport query = queryDto.toQuery(processEngine);
long count = query.count();
CountResultDto result = new CountResultDto();
result.setCount(count);
return result;
}
use of org.camunda.bpm.engine.history.CleanableHistoricProcessInstanceReport in project camunda-bpm-platform by camunda.
the class CleanableHistoricProcessInstanceReportTest method testReportByInvalidProcessDefinitionId.
@Test
public void testReportByInvalidProcessDefinitionId() {
CleanableHistoricProcessInstanceReport report = historyService.createCleanableHistoricProcessInstanceReport();
try {
report.processDefinitionIdIn(null);
fail("Expected NotValidException");
} catch (NotValidException e) {
// expected
}
try {
report.processDefinitionIdIn("abc", null, "def");
fail("Expected NotValidException");
} catch (NotValidException e) {
// expected
}
}
use of org.camunda.bpm.engine.history.CleanableHistoricProcessInstanceReport in project camunda-bpm-platform by camunda.
the class CleanableHistoricProcessInstanceReportServiceTest method setupHistoryReportMock.
private void setupHistoryReportMock() {
CleanableHistoricProcessInstanceReport report = mock(CleanableHistoricProcessInstanceReport.class);
when(report.processDefinitionIdIn(anyString())).thenReturn(report);
when(report.processDefinitionKeyIn(anyString())).thenReturn(report);
CleanableHistoricProcessInstanceReportResult reportResult = mock(CleanableHistoricProcessInstanceReportResult.class);
when(reportResult.getProcessDefinitionId()).thenReturn(EXAMPLE_PROCESS_DEFINITION_ID);
when(reportResult.getProcessDefinitionKey()).thenReturn(EXAMPLE_PD_KEY);
when(reportResult.getProcessDefinitionName()).thenReturn(EXAMPLE_PD_NAME);
when(reportResult.getProcessDefinitionVersion()).thenReturn(EXAMPLE_PD_VERSION);
when(reportResult.getHistoryTimeToLive()).thenReturn(EXAMPLE_TTL);
when(reportResult.getFinishedProcessInstanceCount()).thenReturn(EXAMPLE_FINISHED_PI_COUNT);
when(reportResult.getCleanableProcessInstanceCount()).thenReturn(EXAMPLE_CLEANABLE_PI_COUNT);
when(reportResult.getTenantId()).thenReturn(EXAMPLE_TENANT_ID);
CleanableHistoricProcessInstanceReportResult anotherReportResult = mock(CleanableHistoricProcessInstanceReportResult.class);
when(anotherReportResult.getProcessDefinitionId()).thenReturn(ANOTHER_EXAMPLE_PROCESS_DEFINITION_ID);
when(anotherReportResult.getProcessDefinitionKey()).thenReturn(ANOTHER_EXAMPLE_PD_KEY);
when(anotherReportResult.getProcessDefinitionName()).thenReturn("pdName");
when(anotherReportResult.getProcessDefinitionVersion()).thenReturn(33);
when(anotherReportResult.getHistoryTimeToLive()).thenReturn(null);
when(anotherReportResult.getFinishedProcessInstanceCount()).thenReturn(13l);
when(anotherReportResult.getCleanableProcessInstanceCount()).thenReturn(0l);
when(anotherReportResult.getTenantId()).thenReturn(ANOTHER_EXAMPLE_TENANT_ID);
List<CleanableHistoricProcessInstanceReportResult> mocks = new ArrayList<CleanableHistoricProcessInstanceReportResult>();
mocks.add(reportResult);
mocks.add(anotherReportResult);
when(report.list()).thenReturn(mocks);
when(report.count()).thenReturn((long) mocks.size());
historicProcessInstanceReport = report;
when(processEngine.getHistoryService().createCleanableHistoricProcessInstanceReport()).thenReturn(historicProcessInstanceReport);
}
use of org.camunda.bpm.engine.history.CleanableHistoricProcessInstanceReport in project camunda-bpm-platform by camunda.
the class CleanableHistoricProcessInstanceReportTest method testReportByInvalidProcessDefinitionKey.
@Test
public void testReportByInvalidProcessDefinitionKey() {
CleanableHistoricProcessInstanceReport report = historyService.createCleanableHistoricProcessInstanceReport();
try {
report.processDefinitionKeyIn(null);
fail("Expected NotValidException");
} catch (NotValidException e) {
// expected
}
try {
report.processDefinitionKeyIn("abc", null, "def");
fail("Expected NotValidException");
} catch (NotValidException e) {
// expected
}
}
Aggregations