use of com.epam.ta.reportportal.entity.item.history.TestItemHistory in project commons-dao by reportportal.
the class TestItemRepositoryTest method testItemHistoryPageWithLaunchFilter.
@Test
void testItemHistoryPageWithLaunchFilter() {
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, 5, true);
assertTrue(testItemHistories.isEmpty());
testItemHistories = testItemRepository.loadItemsHistoryPage(false, launchFilter, itemFilter, PageRequest.of(0, 5), PageRequest.of(0, 2, sort), 1L, 5, false);
assertTrue(testItemHistories.isEmpty());
}
use of com.epam.ta.reportportal.entity.item.history.TestItemHistory in project commons-dao by reportportal.
the class TestItemRepositoryTest method testItemHistoryPage.
@Test
void testItemHistoryPage() {
Filter itemFilter = Filter.builder().withTarget(TestItem.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(itemFilter, PageRequest.of(0, 2, sort), 1L, 5, true);
assertFalse(testItemHistories.isEmpty());
testItemHistories = testItemRepository.loadItemsHistoryPage(itemFilter, PageRequest.of(0, 2, sort), 1L, 5, false);
assertFalse(testItemHistories.isEmpty());
}
use of com.epam.ta.reportportal.entity.item.history.TestItemHistory in project commons-dao by reportportal.
the class TestItemRepositoryTest method testItemHistoryPageWithLaunchName.
@Test
void testItemHistoryPageWithLaunchName() {
Filter itemFilter = Filter.builder().withTarget(TestItem.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(itemFilter, PageRequest.of(0, 2, sort), 1L, "launch name 1", 5, true);
assertTrue(testItemHistories.isEmpty());
testItemHistories = testItemRepository.loadItemsHistoryPage(itemFilter, 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 TestItemRepositoryTest method stepHistoryWithTestCaseHashTest.
@Test
void stepHistoryWithTestCaseHashTest() {
List<ConvertibleCondition> commonConditions = Lists.newArrayList(FilterCondition.builder().eq(CRITERIA_HAS_STATS, "true").build(), FilterCondition.builder().eq(CRITERIA_HAS_CHILDREN, "false").build(), FilterCondition.builder().eq(CRITERIA_TYPE, "STEP").build(), FilterCondition.builder().eq(CRITERIA_LAUNCH_ID, "1").build());
Filter baseFilter = new Filter(FilterTarget.TEST_ITEM_TARGET.getClazz(), commonConditions);
PageRequest pageable = PageRequest.of(0, 20, Sort.by(CRITERIA_ID));
List<TestItemHistory> content = custom.loadItemsHistoryPage(baseFilter, pageable, 1L, 30, true).getContent();
assertFalse(content.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(Queryable filter, Pageable pageable, Long projectId, String launchName, int historyDepth, boolean usingHash) {
SelectQuery<? extends Record> filteringQuery = QueryBuilder.newBuilder(filter, QueryUtils.collectJoinFields(filter, pageable.getSort())).with(pageable.getSort()).build();
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)), pageable);
List<TestItemHistory> itemHistories = historyBaseline.getContent().stream().map(value -> {
List<Long> itemIds = loadHistoryItem(getHistoryFilter(filter, usingHash, value), pageable.getSort(), LAUNCH.PROJECT_ID.eq(projectId).and(LAUNCH.NAME.eq(launchName))).map(testItem -> getHistoryIds(testItem, usingHash, projectId, launchName, historyDepth - 1)).orElseGet(Collections::emptyList);
return new TestItemHistory(value, itemIds);
}).collect(Collectors.toList());
return new PageImpl<>(itemHistories, pageable, historyBaseline.getTotalElements());
}
Aggregations