]> source.dussan.org Git - sonarqube.git/commitdiff
Fix database tests
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Wed, 18 Mar 2015 15:53:20 +0000 (16:53 +0100)
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Wed, 18 Mar 2015 15:53:25 +0000 (16:53 +0100)
server/sonar-server/src/main/java/org/sonar/server/startup/RenameIssueWidgets.java
sonar-core/src/main/java/org/sonar/core/dashboard/WidgetMapper.java

index d63c5db20e078c27a5430ace16a086ab5f65bace..63436e32df1b52a80c65c44ff03a8d7b72423893 100644 (file)
@@ -38,7 +38,7 @@ import java.util.Map;
 
 public class RenameIssueWidgets implements Startable {
 
-  private final static String TASK_KEY = "RenameIssueWidgets";
+  private static final String TASK_KEY = "RenameIssueWidgets";
 
   private static final String WIDGET_FALSE_POSITIVES = "false_positive_reviews";
   private static final String WIDGET_MY_UNRESOLVED = "my_reviews";
@@ -112,14 +112,12 @@ public class RenameIssueWidgets implements Startable {
     IssueFilterDto hiddenDebt = dbClient.issueFilterDao().selectProvidedFilterByName("False Positive and Won't Fix Issues");
     IssueFilterDto myUnresolvedIssues = dbClient.issueFilterDao().selectProvidedFilterByName("My Unresolved Issues");
 
-    Map<String, IssueFilterDto> filterByWidgetKey = ImmutableMap.of(
+    return ImmutableMap.of(
       WIDGET_FALSE_POSITIVES, hiddenDebt,
       WIDGET_MY_UNRESOLVED, myUnresolvedIssues,
       WIDGET_UNRESOLVED_BY_DEVELOPER, unresolvedIssues,
       WIDGET_UNRESOLVED_BY_STATUS, unresolvedIssues
     );
-
-    return filterByWidgetKey;
   }
 
   private WidgetPropertyDto createFilterProperty(IssueFilterDto issueFilter, WidgetDto widget) {
index 20bde27df8a1883fc436ce4e2e0721a896517c1c..56abd720345923d205e9a4837d0ce934b99df2a4 100644 (file)
@@ -28,14 +28,15 @@ import java.util.Collection;
 
 public interface WidgetMapper {
 
-  String COLUMNS = "ID, DASHBOARD_ID as \"dashboardId\", WIDGET_KEY as \"widgetKey\", NAME, DESCRIPTION, " +
-    "COLUMN_INDEX as \"columnIndex\", ROW_INDEX as \"rowIndex\", CONFIGURED, CREATED_AT as \"createdAt\", " +
-    "UPDATED_AT as \"updatedAt\", RESOURCE_ID as \"resourceId\"";
+  String COLUMNS = "id, dashboard_id as \"dashboardId\", widget_key as \"widgetKey\", name, description, " +
+    "column_index as \"columnIndex\", row_index as \"rowIndex\", configured, created_at as \"createdAt\", " +
+    "updated_at as \"updatedAt\", resource_id as \"resourceId\"";
 
   @Insert("insert into widgets (dashboard_id, widget_key, name, description, column_index, " +
     " row_index, configured, created_at, updated_at, resource_id)" +
-    " values (#{dashboardId}, #{widgetKey}, #{name}, #{description}, #{columnIndex}, " +
-    " #{rowIndex}, #{configured}, #{createdAt}, #{updatedAt}, #{resourceId})")
+    " values (#{dashboardId,jdbcType=INTEGER}, #{widgetKey,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, " +
+    " #{description,jdbcType=VARCHAR}, #{columnIndex,jdbcType=INTEGER}, " +
+    " #{rowIndex,jdbcType=INTEGER}, #{configured,jdbcType=BOOLEAN}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{resourceId,jdbcType=INTEGER})")
   @Options(keyColumn = "id", useGeneratedKeys = true, keyProperty = "id")
   void insert(WidgetDto widgetDto);
 
@@ -49,16 +50,16 @@ public interface WidgetMapper {
   Collection<WidgetDto> selectAll();
 
   @Update("UPDATE widgets SET " +
-    "dashboard_id=#{dashboardId}, " +
-    "widget_key=#{widgetKey}, " +
-    "name=#{name}, " +
-    "description=#{description}, " +
-    "column_index=#{columnIndex}, " +
-    "row_index=#{rowIndex}, " +
-    "configured=#{configured}, " +
-    "created_at=#{createdAt}, " +
-    "updated_at=#{updatedAt}, " +
-    "resource_id=#{resourceId} " +
+    "dashboard_id=#{dashboardId,jdbcType=INTEGER}, " +
+    "widget_key=#{widgetKey,jdbcType=VARCHAR}, " +
+    "name=#{name,jdbcType=VARCHAR}, " +
+    "description=#{description,jdbcType=VARCHAR}, " +
+    "column_index=#{columnIndex,jdbcType=INTEGER}, " +
+    "row_index=#{rowIndex,jdbcType=INTEGER}, " +
+    "configured=#{configured,jdbcType=BOOLEAN}, " +
+    "created_at=#{createdAt,jdbcType=TIMESTAMP}, " +
+    "updated_at=#{updatedAt,jdbcType=TIMESTAMP}, " +
+    "resource_id=#{resourceId,jdbcType=INTEGER} " +
     "WHERE id=#{id}")
   void update(WidgetDto item);
 }