use of com.epam.ta.reportportal.entity.item.history.TestItemHistory in project commons-dao by reportportal.
the class TestItemRepositoryTest method testItemHistoryPageWithLaunchFilterAndLaunchName.
@Test
void testItemHistoryPageWithLaunchFilterAndLaunchName() {
Filter itemFilter = Filter.builder().withTarget(TestItem.class).withCondition(new FilterCondition(Condition.EQUALS, false, "FAILED", CRITERIA_STATUS)).build();
Filter launchFilter = Filter.builder().withTarget(Launch.class).withCondition(new FilterCondition(Condition.EQUALS, false, "FAILED", CRITERIA_STATUS)).build();
Sort sort = Sort.by(Lists.newArrayList(new Sort.Order(Sort.Direction.ASC, CRITERIA_START_TIME)));
Page<TestItemHistory> testItemHistories = testItemRepository.loadItemsHistoryPage(false, launchFilter, itemFilter, PageRequest.of(0, 5), PageRequest.of(0, 2, sort), 1L, "launch name 1", 5, true);
assertTrue(testItemHistories.isEmpty());
testItemHistories = testItemRepository.loadItemsHistoryPage(false, launchFilter, itemFilter, PageRequest.of(0, 5), PageRequest.of(0, 2, sort), 1L, "launch name 1", 5, false);
assertTrue(testItemHistories.isEmpty());
}
use of com.epam.ta.reportportal.entity.item.history.TestItemHistory in project commons-dao by reportportal.
the class TestItemRepositoryCustomImpl method loadItemsHistoryPage.
@Override
public Page<TestItemHistory> loadItemsHistoryPage(boolean isLatest, Queryable launchFilter, Queryable testItemFilter, Pageable launchPageable, Pageable testItemPageable, Long projectId, int historyDepth, boolean usingHash) {
SelectQuery<? extends Record> filteringQuery = buildCompositeFilterHistoryQuery(isLatest, launchFilter, testItemFilter, launchPageable, testItemPageable);
Field<?> historyGroupingField = usingHash ? TEST_ITEM.TEST_CASE_HASH : TEST_ITEM.UNIQUE_ID;
Page<String> historyBaseline = loadHistoryBaseline(filteringQuery, historyGroupingField, LAUNCH.PROJECT_ID.eq(projectId), testItemPageable);
List<TestItemHistory> itemHistories = historyBaseline.getContent().stream().map(value -> {
List<Long> itemIds = loadHistoryItem(getHistoryFilter(testItemFilter, usingHash, value), testItemPageable.getSort(), LAUNCH.PROJECT_ID.eq(projectId)).map(testItem -> getHistoryIds(testItem, usingHash, projectId, historyDepth - 1)).orElseGet(Collections::emptyList);
return new TestItemHistory(value, itemIds);
}).collect(Collectors.toList());
return new PageImpl<>(itemHistories, testItemPageable, historyBaseline.getTotalElements());
}
use of com.epam.ta.reportportal.entity.item.history.TestItemHistory in project commons-dao by reportportal.
the class TestItemRepositoryCustomImpl method loadItemsHistoryPage.
@Override
public Page<TestItemHistory> loadItemsHistoryPage(boolean isLatest, Queryable launchFilter, Queryable testItemFilter, Pageable launchPageable, Pageable testItemPageable, Long projectId, String launchName, int historyDepth, boolean usingHash) {
SelectQuery<? extends Record> filteringQuery = buildCompositeFilterHistoryQuery(isLatest, launchFilter, testItemFilter, launchPageable, testItemPageable);
Field<?> historyGroupingField = usingHash ? TEST_ITEM.TEST_CASE_HASH : TEST_ITEM.UNIQUE_ID;
Page<String> historyBaseline = loadHistoryBaseline(filteringQuery, historyGroupingField, LAUNCH.PROJECT_ID.eq(projectId).and(LAUNCH.NAME.eq(launchName)), testItemPageable);
List<TestItemHistory> itemHistories = historyBaseline.getContent().stream().map(value -> {
List<Long> itemIds = loadHistoryItem(getHistoryFilter(testItemFilter, usingHash, value), testItemPageable.getSort(), LAUNCH.PROJECT_ID.eq(projectId).and(LAUNCH.NAME.eq(launchName))).map(testItem -> getHistoryIds(testItem, usingHash, projectId, historyDepth - 1)).orElseGet(Collections::emptyList);
return new TestItemHistory(value, itemIds);
}).collect(Collectors.toList());
return new PageImpl<>(itemHistories, testItemPageable, historyBaseline.getTotalElements());
}
Aggregations