aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2011-10-27 13:37:43 +0200
committersimonbrandhof <simon.brandhof@gmail.com>2011-10-27 19:51:36 +0200
commit851fee23dbc02e601121f162ea73cd38fe01a213 (patch)
tree5cfffb6204e5caaa6be5f2bc610c0bd8756db320 /sonar-batch
parentc5ff5521a3c3b5775557745fda19db642d56772f (diff)
downloadsonarqube-851fee23dbc02e601121f162ea73cd38fe01a213.tar.gz
sonarqube-851fee23dbc02e601121f162ea73cd38fe01a213.zip
Improve boolean parameters of Hibernate HQL queries
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java3
-rw-r--r--sonar-batch/src/test/resources/org/sonar/batch/components/PastMeasuresLoaderTest/shared.xml4
-rw-r--r--sonar-batch/src/test/resources/org/sonar/batch/phases/UpdateStatusJobTest/sharedFixture.xml2
3 files changed, 5 insertions, 4 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java
index 157867cbe2a..dd8bf85d196 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java
@@ -193,11 +193,12 @@ public final class DefaultResourcePersister implements ResourcePersister {
}
public Snapshot getLastSnapshot(Snapshot snapshot, boolean onlyOlder) {
- String hql = "SELECT s FROM " + Snapshot.class.getSimpleName() + " s WHERE s.last=true AND s.resourceId=:resourceId";
+ String hql = "SELECT s FROM " + Snapshot.class.getSimpleName() + " s WHERE s.last=:last AND s.resourceId=:resourceId";
if (onlyOlder) {
hql += " AND s.createdAt<:date";
}
Query query = session.createQuery(hql);
+ query.setParameter("last", true);
query.setParameter("resourceId", snapshot.getResourceId());
if (onlyOlder) {
query.setParameter("date", snapshot.getCreatedAt());
diff --git a/sonar-batch/src/test/resources/org/sonar/batch/components/PastMeasuresLoaderTest/shared.xml b/sonar-batch/src/test/resources/org/sonar/batch/components/PastMeasuresLoaderTest/shared.xml
index bcde5f6100f..79218a9e46d 100644
--- a/sonar-batch/src/test/resources/org/sonar/batch/components/PastMeasuresLoaderTest/shared.xml
+++ b/sonar-batch/src/test/resources/org/sonar/batch/components/PastMeasuresLoaderTest/shared.xml
@@ -6,8 +6,8 @@
enabled="true" worst_value="0" optimized_best_value="true" best_value="100" direction="1" hidden="false"/>
- <rules_categories id="1" name="Efficiency" description="[null]"/>
- <rules_categories id="6" name="Usability" description="[null]"/>
+ <rules_categories id="1" name="Efficiency" description="Efficiency"/>
+ <rules_categories id="6" name="Usability" description="Usability"/>
<rules id="30" name="Check Header" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck"
plugin_config_key="Checker/Treewalker/HeaderCheck" plugin_name="checkstyle" description="[null]" priority="4" enabled="true"
diff --git a/sonar-batch/src/test/resources/org/sonar/batch/phases/UpdateStatusJobTest/sharedFixture.xml b/sonar-batch/src/test/resources/org/sonar/batch/phases/UpdateStatusJobTest/sharedFixture.xml
index 48565e5fbdf..262433c5fc5 100644
--- a/sonar-batch/src/test/resources/org/sonar/batch/phases/UpdateStatusJobTest/sharedFixture.xml
+++ b/sonar-batch/src/test/resources/org/sonar/batch/phases/UpdateStatusJobTest/sharedFixture.xml
@@ -1,5 +1,5 @@
<dataset>
- <rules_categories id="1" name="category one" description="[null]"/>
+ <rules_categories id="1" name="category one" description="One"/>
<rules id="1" name="foo" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1"
plugin_name="maven-checkstyle-plugin" description="description" cardinality="SINGLE" parent_id="[null]"/>