use of com.epam.ta.reportportal.entity.enums.StatusEnum in project commons-dao by reportportal.
the class TestItemRepositoryTest method selectItemsInStatusByLaunch.
@Test
void selectItemsInStatusByLaunch() {
final Long launchId = 1L;
final StatusEnum failedStatus = StatusEnum.FAILED;
final List<TestItem> items = testItemRepository.selectItemsInStatusByLaunch(launchId, failedStatus);
assertNotNull(items, "Items should not be null");
assertTrue(!items.isEmpty(), "Items should not be empty");
items.forEach(it -> {
assertEquals(launchId, it.getLaunchId(), "Incorrect launch id");
assertEquals(failedStatus, it.getItemResults().getStatus(), "Incorrect launch status");
});
}
use of com.epam.ta.reportportal.entity.enums.StatusEnum in project commons-dao by reportportal.
the class TestItemRepositoryTest method selectItemsInStatusByParent.
@Test
void selectItemsInStatusByParent() {
final Long parentId = 2L;
final StatusEnum failedStatus = StatusEnum.FAILED;
final List<TestItem> items = testItemRepository.selectItemsInStatusByParent(parentId, failedStatus);
assertNotNull(items, "Items should not be null");
assertFalse(items.isEmpty(), "Items should not be empty");
items.forEach(it -> {
assertEquals(parentId, it.getParentId(), "Incorrect parent id");
assertEquals(failedStatus, it.getItemResults().getStatus(), "Incorrect launch status");
});
}
use of com.epam.ta.reportportal.entity.enums.StatusEnum in project commons-dao by reportportal.
the class LogRepositoryCustomImpl method buildNestedStepQuery.
private SelectHavingStep<Record3<Long, Timestamp, String>> buildNestedStepQuery(Long parentId, boolean excludeEmptySteps, Queryable filter) {
SelectConditionStep<Record3<Long, Timestamp, String>> nestedStepSelect = dsl.select(TEST_ITEM.ITEM_ID.as(ID), TEST_ITEM.START_TIME.as(TIME), DSL.val(ITEM).as(TYPE)).from(TEST_ITEM).join(TEST_ITEM_RESULTS).on(TEST_ITEM.ITEM_ID.eq(TEST_ITEM_RESULTS.RESULT_ID)).where(TEST_ITEM.PARENT_ID.eq(parentId)).and(TEST_ITEM.HAS_STATS.isFalse());
filter.getFilterConditions().stream().flatMap(condition -> condition.getAllConditions().stream()).filter(c -> CRITERIA_STATUS.equals(c.getSearchCriteria())).findFirst().map(c -> Stream.of(c.getValue().split(",")).filter(StatusEnum::isPresent).map(JStatusEnum::valueOf).collect(toList())).map(TEST_ITEM_RESULTS.STATUS::in).ifPresent(nestedStepSelect::and);
if (excludeEmptySteps) {
JTestItem nested = TEST_ITEM.as(NESTED);
nestedStepSelect.and(field(DSL.exists(dsl.with(LOGS).as(QueryBuilder.newBuilder(filter, QueryUtils.collectJoinFields(filter)).addCondition(LOG.ITEM_ID.eq(parentId)).build()).select().from(LOG).join(LOGS).on(LOG.ID.eq(field(LOGS, ID).cast(Long.class))).where(LOG.ITEM_ID.eq(TEST_ITEM.ITEM_ID))).orExists(dsl.select().from(nested).where(nested.PARENT_ID.eq(TEST_ITEM.ITEM_ID)))));
}
return nestedStepSelect.groupBy(TEST_ITEM.ITEM_ID);
}
Aggregations