Search in sources :

Example 11 with FilterCondition

use of com.epam.ta.reportportal.commons.querygen.FilterCondition in project commons-dao by reportportal.

the class UserRepositoryTest method usersWithProjectSort.

@Test
void usersWithProjectSort() {
    Filter filter = Filter.builder().withTarget(User.class).withCondition(new FilterCondition(Condition.CONTAINS, false, "chuba", CRITERIA_USER)).build();
    PageRequest pageRequest = PageRequest.of(0, 5, Sort.Direction.ASC, CRITERIA_PROJECT);
    Page<User> result = userRepository.findByFilter(filter, pageRequest);
    assertEquals(2, result.getTotalElements());
}
Also used : PageRequest(org.springframework.data.domain.PageRequest) ProjectUser(com.epam.ta.reportportal.entity.user.ProjectUser) ReportPortalUser(com.epam.ta.reportportal.commons.ReportPortalUser) User(com.epam.ta.reportportal.entity.user.User) Filter(com.epam.ta.reportportal.commons.querygen.Filter) CompositeFilterCondition(com.epam.ta.reportportal.commons.querygen.CompositeFilterCondition) FilterCondition(com.epam.ta.reportportal.commons.querygen.FilterCondition) BaseTest(com.epam.ta.reportportal.BaseTest) Test(org.junit.jupiter.api.Test)

Example 12 with FilterCondition

use of com.epam.ta.reportportal.commons.querygen.FilterCondition in project commons-dao by reportportal.

the class LogRepositoryTest method getPageNumberTest.

@Test
void getPageNumberTest() {
    Filter filter = Filter.builder().withTarget(Log.class).withCondition(new FilterCondition(Condition.EQUALS, false, "3", CRITERIA_TEST_ITEM_ID)).build();
    Integer number = logRepository.getPageNumber(1L, filter, PageRequest.of(0, 10, Sort.by(Sort.Direction.ASC, CRITERIA_LOG_TIME)));
    assertEquals(1L, (long) number, "Unexpected log page number");
}
Also used : Filter(com.epam.ta.reportportal.commons.querygen.Filter) CompositeFilterCondition(com.epam.ta.reportportal.commons.querygen.CompositeFilterCondition) FilterCondition(com.epam.ta.reportportal.commons.querygen.FilterCondition) BaseTest(com.epam.ta.reportportal.BaseTest) Test(org.junit.jupiter.api.Test)

Example 13 with FilterCondition

use of com.epam.ta.reportportal.commons.querygen.FilterCondition in project commons-dao by reportportal.

the class LogRepositoryTest method findNestedItemsTest.

@Test
void findNestedItemsTest() {
    Filter filter = Filter.builder().withTarget(Log.class).withCondition(new FilterCondition(Condition.EQUALS, false, "2", CRITERIA_TEST_ITEM_ID)).withCondition(new FilterCondition(Condition.IN, false, "FAILED, PASSED", CRITERIA_STATUS)).build();
    logRepository.findNestedItems(2L, false, false, filter, PageRequest.of(2, 1));
}
Also used : Filter(com.epam.ta.reportportal.commons.querygen.Filter) Log(com.epam.ta.reportportal.entity.log.Log) IndexLog(com.epam.ta.reportportal.ws.model.analyzer.IndexLog) CompositeFilterCondition(com.epam.ta.reportportal.commons.querygen.CompositeFilterCondition) FilterCondition(com.epam.ta.reportportal.commons.querygen.FilterCondition) BaseTest(com.epam.ta.reportportal.BaseTest) Test(org.junit.jupiter.api.Test)

Aggregations

BaseTest (com.epam.ta.reportportal.BaseTest)13 Filter (com.epam.ta.reportportal.commons.querygen.Filter)13 FilterCondition (com.epam.ta.reportportal.commons.querygen.FilterCondition)13 Test (org.junit.jupiter.api.Test)13 CompositeFilterCondition (com.epam.ta.reportportal.commons.querygen.CompositeFilterCondition)8 ReportPortalUser (com.epam.ta.reportportal.commons.ReportPortalUser)6 ProjectUser (com.epam.ta.reportportal.entity.user.ProjectUser)6 User (com.epam.ta.reportportal.entity.user.User)6 Launch (com.epam.ta.reportportal.entity.launch.Launch)4 ActivityResource (com.epam.ta.reportportal.ws.model.ActivityResource)4 Sort (org.springframework.data.domain.Sort)4 Condition (com.epam.ta.reportportal.commons.querygen.Condition)3 ConvertibleCondition (com.epam.ta.reportportal.commons.querygen.ConvertibleCondition)3 CRITERIA_ACTION (com.epam.ta.reportportal.commons.querygen.constant.ActivityCriteriaConstant.CRITERIA_ACTION)3 CRITERIA_CREATION_DATE (com.epam.ta.reportportal.commons.querygen.constant.ActivityCriteriaConstant.CRITERIA_CREATION_DATE)3 GeneralCriteriaConstant (com.epam.ta.reportportal.commons.querygen.constant.GeneralCriteriaConstant)3 CRITERIA_COMPOSITE_ATTRIBUTE (com.epam.ta.reportportal.commons.querygen.constant.ItemAttributeConstant.CRITERIA_COMPOSITE_ATTRIBUTE)3 CRITERIA_ITEM_ATTRIBUTE_KEY (com.epam.ta.reportportal.commons.querygen.constant.ItemAttributeConstant.CRITERIA_ITEM_ATTRIBUTE_KEY)3 CRITERIA_LAUNCH_MODE (com.epam.ta.reportportal.commons.querygen.constant.LaunchCriteriaConstant.CRITERIA_LAUNCH_MODE)3 CRITERIA_STATUS (com.epam.ta.reportportal.commons.querygen.constant.TestItemCriteriaConstant.CRITERIA_STATUS)3