|
21 | 21 | import org.ngrinder.agent.service.AgentService;
|
22 | 22 | import org.ngrinder.common.constant.ControllerConstants;
|
23 | 23 | import org.ngrinder.common.constants.GrinderConstants;
|
24 |
| -import org.ngrinder.common.util.DateUtils; |
25 | 24 | import org.ngrinder.common.util.JsonUtils;
|
26 | 25 | import org.ngrinder.infra.config.Config;
|
27 | 26 | import org.ngrinder.infra.hazelcast.HazelcastService;
|
|
45 | 44 | import org.springframework.data.domain.PageRequest;
|
46 | 45 | import org.springframework.data.domain.Pageable;
|
47 | 46 | import org.springframework.data.domain.Sort;
|
48 |
| -import org.springframework.data.domain.Sort.Direction; |
49 | 47 | import org.springframework.data.web.PageableDefault;
|
50 | 48 | import org.springframework.web.bind.annotation.*;
|
51 | 49 |
|
|
65 | 63 | import static org.ngrinder.common.util.ExceptionUtils.processException;
|
66 | 64 | import static org.ngrinder.common.util.Preconditions.*;
|
67 | 65 | import static org.ngrinder.common.util.TypeConvertUtils.cast;
|
| 66 | +import static org.springframework.data.domain.Sort.Direction.*; |
| 67 | +import static org.springframework.data.domain.Sort.by; |
68 | 68 |
|
69 | 69 | /**
|
70 | 70 | * Performance Test api Controller.
|
@@ -408,11 +408,11 @@ private PerfTest getOneWithPermissionCheck(User user, Long id, boolean withTag)
|
408 | 408 |
|
409 | 409 | private Pair<Page<PerfTest>, Pageable> getPerfTests(User user, String query, String tag, String queryFilter, Pageable pageableParam) {
|
410 | 410 | Pageable pageable = PageRequest.of(pageableParam.getPageNumber(), pageableParam.getPageSize(),
|
411 |
| - pageableParam.getSort().isUnsorted() ? new Sort(Direction.DESC, "id") : pageableParam.getSort()); |
| 411 | + pageableParam.getSort().isUnsorted() ? by(DESC, "id") : pageableParam.getSort()); |
412 | 412 | Page<PerfTest> tests = perfTestService.getPagedAll(user, query, tag, queryFilter, pageable);
|
413 | 413 | if (tests.getNumberOfElements() == 0) {
|
414 | 414 | pageable = PageRequest.of(0, pageableParam.getPageSize(),
|
415 |
| - pageableParam.getSort().isUnsorted() ? new Sort(Direction.DESC, "id") : pageableParam.getSort()); |
| 415 | + pageableParam.getSort().isUnsorted() ? by(DESC, "id") : pageableParam.getSort()); |
416 | 416 | tests = perfTestService.getPagedAll(user, query, tag, queryFilter, pageableParam);
|
417 | 417 | }
|
418 | 418 | return Pair.of(tests, pageable);
|
@@ -682,7 +682,7 @@ private Map<String, Object> getReportPluginGraphData(long id, String plugin, Str
|
682 | 682 | @GetMapping({"/last", "", "/"})
|
683 | 683 | public List<PerfTest> getAll(User user, @RequestParam(defaultValue = "0") int page,
|
684 | 684 | @RequestParam(defaultValue = "1") int size) {
|
685 |
| - PageRequest pageRequest = PageRequest.of(page, size, new Sort(Direction.DESC, "id")); |
| 685 | + PageRequest pageRequest = PageRequest.of(page, size, by(DESC, "id")); |
686 | 686 | Page<PerfTest> testList = perfTestService.getPagedAll(user, null, null, null, pageRequest);
|
687 | 687 | return testList.getContent();
|
688 | 688 | }
|
|
0 commit comments