Search in sources :

Example 1 with ActivityResource

use of com.epam.ta.reportportal.ws.model.ActivityResource in project commons-dao by reportportal.

the class WidgetContentRepositoryTest method activityStatistics.

@Test
void activityStatistics() {
    Filter filter = buildDefaultActivityFilter(1L);
    Sort sort = Sort.by(Lists.newArrayList(new Sort.Order(Sort.Direction.DESC, CRITERIA_CREATION_DATE)));
    List<String> contentFields = buildActivityContentFields();
    filter.withCondition(new FilterCondition(Condition.EQUALS, false, "superadmin", CRITERIA_USER)).withCondition(new FilterCondition(Condition.IN, false, String.join(",", contentFields), CRITERIA_ACTION));
    List<ActivityResource> activityContentList = widgetContentRepository.activityStatistics(filter, sort, 4);
    assertNotNull(activityContentList);
    assertEquals(4, activityContentList.size());
}
Also used : Filter(com.epam.ta.reportportal.commons.querygen.Filter) FilterCondition(com.epam.ta.reportportal.commons.querygen.FilterCondition) ActivityResource(com.epam.ta.reportportal.ws.model.ActivityResource) Sort(org.springframework.data.domain.Sort) BaseTest(com.epam.ta.reportportal.BaseTest) Test(org.junit.jupiter.api.Test)

Example 2 with ActivityResource

use of com.epam.ta.reportportal.ws.model.ActivityResource in project commons-dao by reportportal.

the class WidgetContentRepositoryTest method activityStatisticsSorting.

@Test
void activityStatisticsSorting() {
    Filter filter = buildDefaultActivityFilter(1L);
    List<Sort.Order> orders = filter.getTarget().getCriteriaHolders().stream().map(ch -> new Sort.Order(Sort.Direction.ASC, ch.getFilterCriteria())).collect(Collectors.toList());
    Sort sort = Sort.by(orders);
    List<String> contentFields = buildActivityContentFields();
    filter.withCondition(new FilterCondition(Condition.EQUALS, false, "superadmin", CRITERIA_USER)).withCondition(new FilterCondition(Condition.IN, false, String.join(",", contentFields), CRITERIA_ACTION));
    List<ActivityResource> activityContentList = widgetContentRepository.activityStatistics(filter, sort, 4);
    assertNotNull(activityContentList);
    assertEquals(4, activityContentList.size());
}
Also used : com.epam.ta.reportportal.entity.widget.content.healthcheck(com.epam.ta.reportportal.entity.widget.content.healthcheck) StatusEnum(com.epam.ta.reportportal.entity.enums.StatusEnum) CRITERIA_STATUS(com.epam.ta.reportportal.commons.querygen.constant.TestItemCriteriaConstant.CRITERIA_STATUS) DSL(org.jooq.impl.DSL) TestItem(com.epam.ta.reportportal.entity.item.TestItem) Activity(com.epam.ta.reportportal.entity.activity.Activity) Autowired(org.springframework.beans.factory.annotation.Autowired) com.epam.ta.reportportal.entity.widget.content(com.epam.ta.reportportal.entity.widget.content) CRITERIA_COMPOSITE_ATTRIBUTE(com.epam.ta.reportportal.commons.querygen.constant.ItemAttributeConstant.CRITERIA_COMPOSITE_ATTRIBUTE) CRITERIA_ACTION(com.epam.ta.reportportal.commons.querygen.constant.ActivityCriteriaConstant.CRITERIA_ACTION) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) BigDecimal(java.math.BigDecimal) Condition(com.epam.ta.reportportal.commons.querygen.Condition) Map(java.util.Map) DSLContext(org.jooq.DSLContext) Sort(org.springframework.data.domain.Sort) CRITERIA_LAUNCH_MODE(com.epam.ta.reportportal.commons.querygen.constant.LaunchCriteriaConstant.CRITERIA_LAUNCH_MODE) RoundingMode(java.math.RoundingMode) Record(org.jooq.Record) BaseTest(com.epam.ta.reportportal.BaseTest) Launch(com.epam.ta.reportportal.entity.launch.Launch) ImmutableMap(com.google.common.collect.ImmutableMap) JTestItemTypeEnum(com.epam.ta.reportportal.jooq.enums.JTestItemTypeEnum) Filter(com.epam.ta.reportportal.commons.querygen.Filter) Timestamp(java.sql.Timestamp) WidgetContentRepositoryConstants(com.epam.ta.reportportal.dao.constant.WidgetContentRepositoryConstants) GeneralCriteriaConstant(com.epam.ta.reportportal.commons.querygen.constant.GeneralCriteriaConstant) ConvertibleCondition(com.epam.ta.reportportal.commons.querygen.ConvertibleCondition) FilterCondition(com.epam.ta.reportportal.commons.querygen.FilterCondition) Result(org.jooq.Result) Maps(com.google.common.collect.Maps) Sql(org.springframework.test.context.jdbc.Sql) Collectors(java.util.stream.Collectors) CRITERIA_CREATION_DATE(com.epam.ta.reportportal.commons.querygen.constant.ActivityCriteriaConstant.CRITERIA_CREATION_DATE) Test(org.junit.jupiter.api.Test) List(java.util.List) CRITERIA_USER(com.epam.ta.reportportal.commons.querygen.constant.UserCriteriaConstant.CRITERIA_USER) Lists(org.assertj.core.util.Lists) Assertions(org.junit.jupiter.api.Assertions) JStatusEnum(com.epam.ta.reportportal.jooq.enums.JStatusEnum) CRITERIA_ITEM_ATTRIBUTE_KEY(com.epam.ta.reportportal.commons.querygen.constant.ItemAttributeConstant.CRITERIA_ITEM_ATTRIBUTE_KEY) Mode(com.epam.ta.reportportal.ws.model.launch.Mode) ActivityResource(com.epam.ta.reportportal.ws.model.ActivityResource) Filter(com.epam.ta.reportportal.commons.querygen.Filter) FilterCondition(com.epam.ta.reportportal.commons.querygen.FilterCondition) ActivityResource(com.epam.ta.reportportal.ws.model.ActivityResource) Sort(org.springframework.data.domain.Sort) BaseTest(com.epam.ta.reportportal.BaseTest) Test(org.junit.jupiter.api.Test)

Aggregations

BaseTest (com.epam.ta.reportportal.BaseTest)2 Filter (com.epam.ta.reportportal.commons.querygen.Filter)2 FilterCondition (com.epam.ta.reportportal.commons.querygen.FilterCondition)2 ActivityResource (com.epam.ta.reportportal.ws.model.ActivityResource)2 Test (org.junit.jupiter.api.Test)2 Sort (org.springframework.data.domain.Sort)2 Condition (com.epam.ta.reportportal.commons.querygen.Condition)1 ConvertibleCondition (com.epam.ta.reportportal.commons.querygen.ConvertibleCondition)1 CRITERIA_ACTION (com.epam.ta.reportportal.commons.querygen.constant.ActivityCriteriaConstant.CRITERIA_ACTION)1 CRITERIA_CREATION_DATE (com.epam.ta.reportportal.commons.querygen.constant.ActivityCriteriaConstant.CRITERIA_CREATION_DATE)1 GeneralCriteriaConstant (com.epam.ta.reportportal.commons.querygen.constant.GeneralCriteriaConstant)1 CRITERIA_COMPOSITE_ATTRIBUTE (com.epam.ta.reportportal.commons.querygen.constant.ItemAttributeConstant.CRITERIA_COMPOSITE_ATTRIBUTE)1 CRITERIA_ITEM_ATTRIBUTE_KEY (com.epam.ta.reportportal.commons.querygen.constant.ItemAttributeConstant.CRITERIA_ITEM_ATTRIBUTE_KEY)1 CRITERIA_LAUNCH_MODE (com.epam.ta.reportportal.commons.querygen.constant.LaunchCriteriaConstant.CRITERIA_LAUNCH_MODE)1 CRITERIA_STATUS (com.epam.ta.reportportal.commons.querygen.constant.TestItemCriteriaConstant.CRITERIA_STATUS)1 CRITERIA_USER (com.epam.ta.reportportal.commons.querygen.constant.UserCriteriaConstant.CRITERIA_USER)1 WidgetContentRepositoryConstants (com.epam.ta.reportportal.dao.constant.WidgetContentRepositoryConstants)1 Activity (com.epam.ta.reportportal.entity.activity.Activity)1 StatusEnum (com.epam.ta.reportportal.entity.enums.StatusEnum)1 TestItem (com.epam.ta.reportportal.entity.item.TestItem)1