diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2016-01-14 15:22:42 +0100 |
---|---|---|
committer | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2016-01-14 18:53:45 +0100 |
commit | 0d4c4cc245e1595e4fb9279905ecdca4ead442c1 (patch) | |
tree | 91a68744e20a26b180ee8585701db2100821ced5 | |
parent | c660710f23ebfee872380e70d0dc4d24b6616c40 (diff) | |
download | sonarqube-0d4c4cc245e1595e4fb9279905ecdca4ead442c1.tar.gz sonarqube-0d4c4cc245e1595e4fb9279905ecdca4ead442c1.zip |
SONAR-7135 WS api/measures/component_tree sorting does not depend on metric direction
-rw-r--r-- | server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeSort.java | 2 | ||||
-rw-r--r-- | server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentTreeSortTest.java | 11 |
2 files changed, 1 insertions, 12 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeSort.java b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeSort.java index 2cd5f81b1f9..f2ccb842042 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeSort.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeSort.java @@ -130,7 +130,7 @@ class ComponentTreeSort { return null; } - return metric.getDirection() >= 0 ? measure.getValue() : -measure.getValue(); + return measure.getValue(); } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentTreeSortTest.java b/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentTreeSortTest.java index 1efa56e50c8..5341852e50b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentTreeSortTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentTreeSortTest.java @@ -112,17 +112,6 @@ public class ComponentTreeSortTest { } @Test - public void sort_by_metric_key_with_negative_metric_direction() { - metrics.get(0).setDirection(-1); - ComponentTreeWsRequest wsRequest = newRequest(singletonList(METRIC_SORT), true, METRIC_KEY); - - List<ComponentDtoWithSnapshotId> result = sortComponents(wsRequest); - - assertThat(result).extracting("path") - .containsExactly("path-9", "path-8", "path-7", "path-6", "path-5", "path-4", "path-3", "path-2", "path-1"); - } - - @Test public void sort_on_multiple_fields() { components = newArrayList( newComponentWithoutSnapshotId("name-1", "qualifier-1", "path-2"), |