aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core/src/test
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2015-05-21 17:30:43 +0200
committerJulien Lancelot <julien.lancelot@sonarsource.com>2015-05-21 17:41:08 +0200
commitdb30e4ece39c2dfd0c41b4d9eb612d5b494afd18 (patch)
tree759cefdab7022de255290fc0264334b276571100 /sonar-core/src/test
parenta27d5efd0aa3ce834ee20bccd5044c3c36a3467a (diff)
downloadsonarqube-db30e4ece39c2dfd0c41b4d9eb612d5b494afd18.tar.gz
sonarqube-db30e4ece39c2dfd0c41b4d9eb612d5b494afd18.zip
SONAR-6259 Use component caches to get id or uuid
Diffstat (limited to 'sonar-core/src/test')
-rw-r--r--sonar-core/src/test/java/org/sonar/core/persistence/DbTester.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/DbTester.java b/sonar-core/src/test/java/org/sonar/core/persistence/DbTester.java
index a2dae090bdc..bf5d14b0200 100644
--- a/sonar-core/src/test/java/org/sonar/core/persistence/DbTester.java
+++ b/sonar-core/src/test/java/org/sonar/core/persistence/DbTester.java
@@ -62,7 +62,12 @@ import java.math.BigDecimal;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URISyntaxException;
-import java.sql.*;
+import java.sql.Clob;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -198,7 +203,7 @@ public class DbTester extends ExternalResource {
throw new IllegalStateException("No results for " + sql);
} catch (Exception e) {
- throw new IllegalStateException("Fail to execute sql: " + sql);
+ throw new IllegalStateException("Fail to execute sql: " + sql, e);
}
}
@@ -209,7 +214,7 @@ public class DbTester extends ExternalResource {
ResultSet rs = stmt.executeQuery()) {
return getHashMap(rs);
} catch (Exception e) {
- throw new IllegalStateException("Fail to execute sql: " + selectSql);
+ throw new IllegalStateException("Fail to execute sql: " + selectSql, e);
}
}
@@ -237,7 +242,12 @@ public class DbTester extends ExternalResource {
doClobFree(clob);
} else if (value instanceof BigDecimal) {
// In Oracle, INTEGER types are mapped as BigDecimal
- value = ((BigDecimal) value).longValue();
+ BigDecimal bgValue = ((BigDecimal)value);
+ if (bgValue.scale() == 0) {
+ value = bgValue.longValue();
+ } else {
+ value = bgValue.doubleValue();
+ }
} else if (value instanceof Integer) {
// To be consistent, all INTEGER types are mapped as Long
value = ((Integer) value).longValue();