From db30e4ece39c2dfd0c41b4d9eb612d5b494afd18 Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Thu, 21 May 2015 17:30:43 +0200 Subject: SONAR-6259 Use component caches to get id or uuid --- .../test/java/org/sonar/core/persistence/DbTester.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'sonar-core/src/test') 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(); -- cgit v1.2.3