From c9a535a0b20abd025c79345fe8432211580aea5c Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Lievremont Date: Wed, 18 Mar 2015 16:53:20 +0100 Subject: [PATCH] Fix database tests --- .../server/startup/RenameIssueWidgets.java | 6 ++-- .../sonar/core/dashboard/WidgetMapper.java | 31 ++++++++++--------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/server/sonar-server/src/main/java/org/sonar/server/startup/RenameIssueWidgets.java b/server/sonar-server/src/main/java/org/sonar/server/startup/RenameIssueWidgets.java index d63c5db20e0..63436e32df1 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/startup/RenameIssueWidgets.java +++ b/server/sonar-server/src/main/java/org/sonar/server/startup/RenameIssueWidgets.java @@ -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 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) { diff --git a/sonar-core/src/main/java/org/sonar/core/dashboard/WidgetMapper.java b/sonar-core/src/main/java/org/sonar/core/dashboard/WidgetMapper.java index 20bde27df8a..56abd720345 100644 --- a/sonar-core/src/main/java/org/sonar/core/dashboard/WidgetMapper.java +++ b/sonar-core/src/main/java/org/sonar/core/dashboard/WidgetMapper.java @@ -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 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); } -- 2.39.5