public virtual IList <HistoricJobLogDto> queryHistoricJobLogs(HistoricJobLogQueryDto queryDto, int?firstResult, int?maxResults) { queryDto.ObjectMapper = objectMapper; HistoricJobLogQuery query = queryDto.toQuery(processEngine); IList <HistoricJobLog> matchingHistoricJobLogs; if (firstResult != null || maxResults != null) { matchingHistoricJobLogs = executePaginatedQuery(query, firstResult, maxResults); } else { matchingHistoricJobLogs = query.list(); } IList <HistoricJobLogDto> results = new List <HistoricJobLogDto>(); foreach (HistoricJobLog historicJobLog in matchingHistoricJobLogs) { HistoricJobLogDto result = HistoricJobLogDto.fromHistoricJobLog(historicJobLog); results.Add(result); } return(results); }
private void createHistoricJobLogMock() { HistoricJobLogQuery mockHistoricJobLogQuery = mock(typeof(HistoricJobLogQuery)); IList <HistoricJobLog> historicJobLogs = MockProvider.createMockHistoricJobLogs(); when(mockHistoricJobLogQuery.list()).thenReturn(historicJobLogs); when(mockHistoryService.createHistoricJobLogQuery()).thenReturn(mockHistoricJobLogQuery); }
protected internal virtual HistoricJobLogQuery setUpMockHistoricJobLogQuery(IList <HistoricJobLog> mockedHistoricJogLogs) { HistoricJobLogQuery mockedhistoricJobLogQuery = mock(typeof(HistoricJobLogQuery)); when(mockedhistoricJobLogQuery.list()).thenReturn(mockedHistoricJogLogs); when(mockedhistoricJobLogQuery.count()).thenReturn((long)mockedHistoricJogLogs.Count); when(processEngine.HistoryService.createHistoricJobLogQuery()).thenReturn(mockedhistoricJobLogQuery); return(mockedhistoricJobLogQuery); }
protected internal virtual void verifyQueryResults(HistoricJobLogQuery query, int countExpected) { assertEquals(countExpected, query.list().size()); assertEquals(countExpected, query.count()); if (countExpected == 1) { assertNotNull(query.singleResult()); } else if (countExpected > 1) { verifySingleResultFails(query); } else if (countExpected == 0) { assertNull(query.singleResult()); } }
protected internal virtual void verifyQueryWithOrdering(HistoricJobLogQuery query, int countExpected, TestOrderingUtil.NullTolerantComparator <HistoricJobLog> expectedOrdering) { verifyQueryResults(query, countExpected); TestOrderingUtil.verifySorting(query.list(), expectedOrdering); }