aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core/src/test/java
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2012-12-14 18:26:23 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2012-12-14 18:26:23 +0100
commit189a12a09eb4fd34b632fb2582eb479e15a08125 (patch)
treefbc870f1a63cd345e5ce9b7194430d982b21bbca /sonar-core/src/test/java
parent8317be2653b7f1aa950de11b859048efe2e829f0 (diff)
downloadsonarqube-189a12a09eb4fd34b632fb2582eb479e15a08125.tar.gz
sonarqube-189a12a09eb4fd34b632fb2582eb479e15a08125.zip
SONAR-3825 improve performance of SQL request
* UNION is replaced by INNER JOINs * sorting is done by Java but not by db
Diffstat (limited to 'sonar-core/src/test/java')
-rw-r--r--sonar-core/src/test/java/org/sonar/core/measure/MeasureFilterConditionTest.java8
-rw-r--r--sonar-core/src/test/java/org/sonar/core/measure/MeasureFilterFactoryTest.java4
2 files changed, 6 insertions, 6 deletions
diff --git a/sonar-core/src/test/java/org/sonar/core/measure/MeasureFilterConditionTest.java b/sonar-core/src/test/java/org/sonar/core/measure/MeasureFilterConditionTest.java
index 112975ff908..73b5cdb7c74 100644
--- a/sonar-core/src/test/java/org/sonar/core/measure/MeasureFilterConditionTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/measure/MeasureFilterConditionTest.java
@@ -59,9 +59,9 @@ public class MeasureFilterConditionTest {
assertThat(condition.operator()).isEqualTo(MeasureFilterCondition.Operator.GREATER);
assertThat(condition.period()).isNull();
assertThat(condition.value()).isEqualTo(10.0);
- assertThat(condition.valueColumn()).isEqualTo("pm.value");
+ assertThat(condition.appendSqlColumn(new StringBuilder(), 1).toString()).isEqualTo("pmcond1.value");
assertThat(condition.toString()).isNotEmpty();
- assertThat(condition.appendSqlCondition(new StringBuilder()).toString()).isEqualTo(" pm.metric_id=123 AND pm.value>10.0");
+ assertThat(condition.appendSqlCondition(new StringBuilder(), 1).toString()).isEqualTo(" pmcond1.metric_id=123 AND pmcond1.value>10.0");
}
@Test
@@ -75,8 +75,8 @@ public class MeasureFilterConditionTest {
assertThat(condition.operator()).isEqualTo(MeasureFilterCondition.Operator.LESS_OR_EQUALS);
assertThat(condition.period()).isEqualTo(3);
assertThat(condition.value()).isEqualTo(10.0);
- assertThat(condition.valueColumn()).isEqualTo("pm.variation_value_3");
+ assertThat(condition.appendSqlColumn(new StringBuilder(), 2).toString()).isEqualTo("pmcond2.variation_value_3");
assertThat(condition.toString()).isNotEmpty();
- assertThat(condition.appendSqlCondition(new StringBuilder()).toString()).isEqualTo(" pm.metric_id=123 AND pm.variation_value_3<=10.0");
+ assertThat(condition.appendSqlCondition(new StringBuilder(), 2).toString()).isEqualTo(" pmcond2.metric_id=123 AND pmcond2.variation_value_3<=10.0");
}
}
diff --git a/sonar-core/src/test/java/org/sonar/core/measure/MeasureFilterFactoryTest.java b/sonar-core/src/test/java/org/sonar/core/measure/MeasureFilterFactoryTest.java
index 936b3afff77..472976e65ca 100644
--- a/sonar-core/src/test/java/org/sonar/core/measure/MeasureFilterFactoryTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/measure/MeasureFilterFactoryTest.java
@@ -43,7 +43,7 @@ public class MeasureFilterFactoryTest {
Map<String, Object> props = ImmutableMap.<String, Object>of("sort", "metric:ncloc");
MeasureFilter filter = factory.create(props);
- assertThat(filter.sort().column()).isEqualTo("pm.value");
+ assertThat(filter.sort().column()).isEqualTo("pmsort.value");
assertThat(filter.sort().metric().getKey()).isEqualTo("ncloc");
assertThat(filter.sort().period()).isNull();
}
@@ -54,7 +54,7 @@ public class MeasureFilterFactoryTest {
Map<String, Object> props = ImmutableMap.<String, Object>of("sort", "metric:ncloc:3");
MeasureFilter filter = factory.create(props);
- assertThat(filter.sort().column()).isEqualTo("pm.variation_value_3");
+ assertThat(filter.sort().column()).isEqualTo("pmsort.variation_value_3");
assertThat(filter.sort().metric().getKey()).isEqualTo("ncloc");
assertThat(filter.sort().period()).isEqualTo(3);
}