use of org.camunda.bpm.engine.history.CleanableHistoricDecisionInstanceReport in project camunda-bpm-platform by camunda.
the class CleanableHistoricDecisionInstanceReportServiceTest method setupHistoryReportMock.
private void setupHistoryReportMock() {
CleanableHistoricDecisionInstanceReport report = mock(CleanableHistoricDecisionInstanceReport.class);
when(report.decisionDefinitionIdIn(anyString())).thenReturn(report);
when(report.decisionDefinitionKeyIn(anyString())).thenReturn(report);
CleanableHistoricDecisionInstanceReportResult reportResult = mock(CleanableHistoricDecisionInstanceReportResult.class);
when(reportResult.getDecisionDefinitionId()).thenReturn(EXAMPLE_DD_ID);
when(reportResult.getDecisionDefinitionKey()).thenReturn(EXAMPLE_DD_KEY);
when(reportResult.getDecisionDefinitionName()).thenReturn(EXAMPLE_DD_NAME);
when(reportResult.getDecisionDefinitionVersion()).thenReturn(EXAMPLE_DD_VERSION);
when(reportResult.getHistoryTimeToLive()).thenReturn(EXAMPLE_TTL);
when(reportResult.getFinishedDecisionInstanceCount()).thenReturn(EXAMPLE_FINISHED_DI_COUNT);
when(reportResult.getCleanableDecisionInstanceCount()).thenReturn(EXAMPLE_CLEANABLE_DI_COUNT);
when(reportResult.getTenantId()).thenReturn(EXAMPLE_TENANT_ID);
CleanableHistoricDecisionInstanceReportResult anotherReportResult = mock(CleanableHistoricDecisionInstanceReportResult.class);
when(anotherReportResult.getDecisionDefinitionId()).thenReturn(ANOTHER_EXAMPLE_DD_ID);
when(anotherReportResult.getDecisionDefinitionKey()).thenReturn(ANOTHER_EXAMPLE_DD_KEY);
when(anotherReportResult.getDecisionDefinitionName()).thenReturn("dpName");
when(anotherReportResult.getDecisionDefinitionVersion()).thenReturn(33);
when(anotherReportResult.getHistoryTimeToLive()).thenReturn(5);
when(anotherReportResult.getFinishedDecisionInstanceCount()).thenReturn(10l);
when(anotherReportResult.getCleanableDecisionInstanceCount()).thenReturn(0l);
when(anotherReportResult.getTenantId()).thenReturn(ANOTHER_EXAMPLE_TENANT_ID);
List<CleanableHistoricDecisionInstanceReportResult> mocks = new ArrayList<CleanableHistoricDecisionInstanceReportResult>();
mocks.add(reportResult);
mocks.add(anotherReportResult);
when(report.list()).thenReturn(mocks);
when(report.count()).thenReturn((long) mocks.size());
historicDecisionInstanceReport = report;
when(processEngine.getHistoryService().createCleanableHistoricDecisionInstanceReport()).thenReturn(historicDecisionInstanceReport);
}
use of org.camunda.bpm.engine.history.CleanableHistoricDecisionInstanceReport in project camunda-bpm-platform by camunda.
the class HistoricDecisionDefinitionRestServiceImpl method getCleanableHistoricDecisionInstanceReportCount.
@Override
public CountResultDto getCleanableHistoricDecisionInstanceReportCount(UriInfo uriInfo) {
CleanableHistoricDecisionInstanceReportDto queryDto = new CleanableHistoricDecisionInstanceReportDto(objectMapper, uriInfo.getQueryParameters());
queryDto.setObjectMapper(objectMapper);
CleanableHistoricDecisionInstanceReport query = queryDto.toQuery(processEngine);
long count = query.count();
CountResultDto result = new CountResultDto();
result.setCount(count);
return result;
}
use of org.camunda.bpm.engine.history.CleanableHistoricDecisionInstanceReport in project camunda-bpm-platform by camunda.
the class HistoricDecisionDefinitionRestServiceImpl method getCleanableHistoricDecisionInstanceReport.
@Override
public List<CleanableHistoricDecisionInstanceReportResultDto> getCleanableHistoricDecisionInstanceReport(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
CleanableHistoricDecisionInstanceReportDto queryDto = new CleanableHistoricDecisionInstanceReportDto(objectMapper, uriInfo.getQueryParameters());
CleanableHistoricDecisionInstanceReport query = queryDto.toQuery(processEngine);
List<CleanableHistoricDecisionInstanceReportResult> reportResult;
if (firstResult != null || maxResults != null) {
reportResult = executePaginatedQuery(query, firstResult, maxResults);
} else {
reportResult = query.list();
}
return CleanableHistoricDecisionInstanceReportResultDto.convert(reportResult);
}
use of org.camunda.bpm.engine.history.CleanableHistoricDecisionInstanceReport in project camunda-bpm-platform by camunda.
the class CleanableHistoricDecisionInstanceReportTest method testReportByInvalidDecisionDefinitionId.
@Test
public void testReportByInvalidDecisionDefinitionId() {
CleanableHistoricDecisionInstanceReport report = historyService.createCleanableHistoricDecisionInstanceReport();
try {
report.decisionDefinitionIdIn(null);
fail("Expected NotValidException");
} catch (NotValidException e) {
// expected
}
try {
report.decisionDefinitionIdIn("abc", null, "def");
fail("Expected NotValidException");
} catch (NotValidException e) {
// expected
}
}
use of org.camunda.bpm.engine.history.CleanableHistoricDecisionInstanceReport in project camunda-bpm-platform by camunda.
the class CleanableHistoricDecisionInstanceReportTest method testReportByInvalidDecisionDefinitionKey.
@Test
public void testReportByInvalidDecisionDefinitionKey() {
CleanableHistoricDecisionInstanceReport report = historyService.createCleanableHistoricDecisionInstanceReport();
try {
report.decisionDefinitionKeyIn(null);
fail("Expected NotValidException");
} catch (NotValidException e) {
// expected
}
try {
report.decisionDefinitionKeyIn("abc", null, "def");
fail("Expected NotValidException");
} catch (NotValidException e) {
// expected
}
}
Aggregations