aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core/src
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2014-03-31 10:46:29 +0200
committerJulien Lancelot <julien.lancelot@sonarsource.com>2014-03-31 10:46:29 +0200
commit62c057b6ccdb70867ae9161ed926a4ddfc3e8e08 (patch)
treef2131b00f921665676ba6cc5012820e7cd4831cc /sonar-core/src
parent42ecd06743223ce51ef03d592236acc91ad4458c (diff)
downloadsonarqube-62c057b6ccdb70867ae9161ed926a4ddfc3e8e08.tar.gz
sonarqube-62c057b6ccdb70867ae9161ed926a4ddfc3e8e08.zip
Add a migration to replace rules.default_remediation_factor by rules.default_remediation_coeff and rules.remediation_factor by rules.remediation_coeff and remove duration with value 0X
Diffstat (limited to 'sonar-core/src')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java2
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql1
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl4
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/rule/RuleMapper.xml10
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/insert-result.xml2
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/insert_all-result.xml4
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/selectAll.xml2
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/select_by_sub_characteristic_id.xml10
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/select_enables_and_non_manual.xml6
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/update-result.xml2
10 files changed, 22 insertions, 21 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java
index 7d920dacaf2..6af72131229 100644
--- a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java
+++ b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java
@@ -33,7 +33,7 @@ import java.util.List;
*/
public class DatabaseVersion implements BatchComponent, ServerComponent {
- public static final int LAST_VERSION = 522;
+ public static final int LAST_VERSION = 523;
public static enum Status {
UP_TO_DATE, REQUIRES_UPGRADE, REQUIRES_DOWNGRADE, FRESH_INSTALL
diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql
index b924803a886..66880b5398d 100644
--- a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql
+++ b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql
@@ -221,6 +221,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('519');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('520');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('521');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('522');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('523');
INSERT INTO USERS(ID, LOGIN, NAME, EMAIL, CRYPTED_PASSWORD, SALT, CREATED_AT, UPDATED_AT, REMEMBER_TOKEN, REMEMBER_TOKEN_EXPIRES_AT) VALUES (1, 'admin', 'Administrator', '', 'a373a0e667abb2604c1fd571eb4ad47fe8cc0878', '48bc4b0d93179b5103fd3885ea9119498e9d161b', '2011-09-26 22:27:48.0', '2011-09-26 22:27:48.0', null, null);
ALTER TABLE USERS ALTER COLUMN ID RESTART WITH 2;
diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl
index 1e87ced7ec7..df9ba235350 100644
--- a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl
+++ b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl
@@ -159,8 +159,8 @@ CREATE TABLE "RULES" (
"DEFAULT_CHARACTERISTIC_ID" INTEGER,
"REMEDIATION_FUNCTION" VARCHAR(20),
"DEFAULT_REMEDIATION_FUNCTION" VARCHAR(20),
- "REMEDIATION_FACTOR" VARCHAR(20),
- "DEFAULT_REMEDIATION_FACTOR" VARCHAR(20),
+ "REMEDIATION_COEFF" VARCHAR(20),
+ "DEFAULT_REMEDIATION_COEFF" VARCHAR(20),
"REMEDIATION_OFFSET" VARCHAR(20),
"DEFAULT_REMEDIATION_OFFSET" VARCHAR(20),
"EFFORT_TO_FIX_DESCRIPTION" VARCHAR(4000),
diff --git a/sonar-core/src/main/resources/org/sonar/core/rule/RuleMapper.xml b/sonar-core/src/main/resources/org/sonar/core/rule/RuleMapper.xml
index 1b5f75a1542..f6e69e2ca11 100644
--- a/sonar-core/src/main/resources/org/sonar/core/rule/RuleMapper.xml
+++ b/sonar-core/src/main/resources/org/sonar/core/rule/RuleMapper.xml
@@ -23,8 +23,8 @@
r.default_characteristic_id as "defaultSubCharacteristicId",
r.remediation_function as "remediationFunction",
r.default_remediation_function as "defaultRemediationFunction",
- r.remediation_factor as "remediationCoefficient",
- r.default_remediation_factor as "defaultRemediationCoefficient",
+ r.remediation_coeff as "remediationCoefficient",
+ r.default_remediation_coeff as "defaultRemediationCoefficient",
r.remediation_offset as "remediationOffset",
r.default_remediation_offset as "defaultRemediationOffset",
r.effort_to_fix_description as "effortToFixDescription",
@@ -84,8 +84,8 @@
default_characteristic_id=#{defaultSubCharacteristicId},
remediation_function=#{remediationFunction},
default_remediation_function=#{defaultRemediationFunction},
- remediation_factor=#{remediationCoefficient},
- default_remediation_factor=#{defaultRemediationCoefficient},
+ remediation_coeff=#{remediationCoefficient},
+ default_remediation_coeff=#{defaultRemediationCoefficient},
remediation_offset=#{remediationOffset},
default_remediation_offset=#{defaultRemediationOffset},
effort_to_fix_description=#{effortToFixDescription},
@@ -96,7 +96,7 @@
<sql id="insertColumns">
(plugin_rule_key, plugin_name, description, status, name, plugin_config_key, priority, cardinality, language, parent_id,
characteristic_id, default_characteristic_id, remediation_function, default_remediation_function,
- remediation_factor, default_remediation_factor, remediation_offset, default_remediation_offset,
+ remediation_coeff, default_remediation_coeff, remediation_offset, default_remediation_offset,
effort_to_fix_description,
created_at, updated_at)
</sql>
diff --git a/sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/insert-result.xml b/sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/insert-result.xml
index ff959688dc4..e7e1d53d554 100644
--- a/sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/insert-result.xml
+++ b/sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/insert-result.xml
@@ -25,7 +25,7 @@
note_data="[null]" note_user_login="[null]" note_created_at="[null]" note_updated_at="[null]"
characteristic_id="100" default_characteristic_id="101"
remediation_function="linear" default_remediation_function="linear_offset"
- remediation_factor="1h" default_remediation_factor="5d"
+ remediation_coeff="1h" default_remediation_coeff="5d"
remediation_offset="5min" default_remediation_offset="10h"
effort_to_fix_description="squid.S115.effortToFix"
/>
diff --git a/sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/insert_all-result.xml b/sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/insert_all-result.xml
index dce46d3845d..878e3d586ed 100644
--- a/sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/insert_all-result.xml
+++ b/sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/insert_all-result.xml
@@ -25,7 +25,7 @@
note_data="[null]" note_user_login="[null]" note_created_at="[null]" note_updated_at="[null]"
characteristic_id="100" default_characteristic_id="101"
remediation_function="linear" default_remediation_function="linear_offset"
- remediation_factor="1h" default_remediation_factor="5d"
+ remediation_coeff="1h" default_remediation_coeff="5d"
remediation_offset="5min" default_remediation_offset="10h"
effort_to_fix_description="squid.S115.effortToFix"
/>
@@ -35,7 +35,7 @@
note_data="[null]" note_user_login="[null]" note_created_at="[null]" note_updated_at="[null]"
characteristic_id="102" default_characteristic_id="103"
remediation_function="linear_offset" default_remediation_function="linear"
- remediation_factor="5d" default_remediation_factor="1h"
+ remediation_coeff="5d" default_remediation_coeff="1h"
remediation_offset="10h" default_remediation_offset="5min"
effort_to_fix_description="squid.S115.effortToFix2"
/>
diff --git a/sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/selectAll.xml b/sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/selectAll.xml
index 1511b2e67f9..04f7a7fb3da 100644
--- a/sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/selectAll.xml
+++ b/sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/selectAll.xml
@@ -5,7 +5,7 @@
note_data="Rule note with accents éèà" note_user_login="polop.palap" note_created_at="2013-12-25"
characteristic_id="100" default_characteristic_id="101"
remediation_function="linear" default_remediation_function="linear_offset"
- remediation_factor="1h" default_remediation_factor="5d"
+ remediation_coeff="1h" default_remediation_coeff="5d"
remediation_offset="5min" default_remediation_offset="10h"
effort_to_fix_description="squid.S115.effortToFix"
/>
diff --git a/sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/select_by_sub_characteristic_id.xml b/sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/select_by_sub_characteristic_id.xml
index b712b6ec0b1..a6677ee6b63 100644
--- a/sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/select_by_sub_characteristic_id.xml
+++ b/sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/select_by_sub_characteristic_id.xml
@@ -27,35 +27,35 @@
<rules id="1" plugin_rule_key="UselessImportCheck" plugin_name="squid" name="UselessImportCheck" description="Useless imports should be removed" status="READY"
characteristic_id="2" default_characteristic_id="50"
remediation_function="LINEAR_OFFSET" default_remediation_function="LINEAR_OFFSET"
- remediation_factor="5d" default_remediation_factor="5d"
+ remediation_coeff="5d" default_remediation_coeff="5d"
remediation_offset="10h" default_remediation_offset="10h" updated_at="2014-02-19"/>
<!-- Rule linked to a sub characteristic -->
<rules id="2" plugin_rule_key="LeftCurlyBraceStartLineCheck" plugin_name="squid" name="LeftCurlyBraceStartLineCheck" description="Left curly braces should be located at the beginning of lines of code" status="READY"
characteristic_id="3" default_characteristic_id="50"
remediation_function="LINEAR_OFFSET" default_remediation_function="LINEAR_OFFSET"
- remediation_factor="5d" default_remediation_factor="5d"
+ remediation_coeff="5d" default_remediation_coeff="5d"
remediation_offset="10h" default_remediation_offset="10h" updated_at="2014-02-19"/>
<!-- Rule linked to a disabled sub characteristic -> should never be returned -->
<rules id="3" plugin_rule_key="CallToFileDeleteOnExitMethod" plugin_name="squid" name="CallToFileDeleteOnExitMethod" description="CallToFileDeleteOnExitMethod" status="READY"
characteristic_id="11" default_characteristic_id="50"
remediation_function="LINEAR" default_remediation_function="LINEAR_OFFSET"
- remediation_factor="5d" default_remediation_factor="5d"
+ remediation_coeff="5d" default_remediation_coeff="5d"
remediation_offset="[null]" default_remediation_offset="10h" updated_at="2014-02-19"/>
<!-- Removed rule linked to one enable sub characteristic -->
<rules id="4" plugin_rule_key="ObjectFinalizeOverridenCallsSuperFinalizeCheck" plugin_name="squid" name="ObjectFinalizeOverridenCallsSuperFinalizeCheck" description="super.finalize() should be called at the end of Object.finalize() implementations" status="REMOVED"
characteristic_id="3" default_characteristic_id="50"
remediation_function="LINEAR" default_remediation_function="LINEAR_OFFSET"
- remediation_factor="5d" default_remediation_factor="5min"
+ remediation_coeff="5d" default_remediation_coeff="5min"
remediation_offset="[null]" default_remediation_offset="10h" updated_at="2014-02-19"/>
<!-- Rule linked to a sub characteristic, but only default characteristic is linked -->
<rules id="5" plugin_rule_key="RightCurlyBraceStartLineCheck" plugin_name="squid" name="RightCurlyBraceStartLineCheck" description="Right curly braces should be located at the beginning of lines of code" status="READY"
characteristic_id="[null]" default_characteristic_id="3"
remediation_function="[null]" default_remediation_function="LINEAR"
- remediation_factor="[null]" default_remediation_factor="5d"
+ remediation_coeff="[null]" default_remediation_coeff="5d"
remediation_offset="[null]" default_remediation_offset="[null]" updated_at="2014-02-19"/>
</dataset>
diff --git a/sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/select_enables_and_non_manual.xml b/sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/select_enables_and_non_manual.xml
index 971e58bead8..b29914ea915 100644
--- a/sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/select_enables_and_non_manual.xml
+++ b/sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/select_enables_and_non_manual.xml
@@ -4,7 +4,7 @@
note_data="Rule note with accents éèà" note_user_login="polop.palap" note_created_at="2013-12-25"
characteristic_id="100" default_characteristic_id="101"
remediation_function="LINEAR" default_remediation_function="LINEAR_OFFSET"
- remediation_factor="1h" default_remediation_factor="5d"
+ remediation_coeff="1h" default_remediation_coeff="5d"
remediation_offset="5min" default_remediation_offset="10h"
effort_to_fix_description="squid.S115.effortToFix"/>
@@ -12,7 +12,7 @@
note_data="[null]" note_user_login="[null]" note_created_at="[null]"
characteristic_id="[null]" default_characteristic_id="[null]"
remediation_function="[null]" default_remediation_function="[null]"
- remediation_factor="[null]" default_remediation_factor="[null]"
+ remediation_coeff="[null]" default_remediation_coeff="[null]"
remediation_offset="[null]" default_remediation_offset="[null]"
effort_to_fix_description="[null]"/>
@@ -20,7 +20,7 @@
note_data="[null]" note_user_login="[null]" note_created_at="[null]"
characteristic_id="[null]" default_characteristic_id="[null]"
remediation_function="[null]" default_remediation_function="[null]"
- remediation_factor="[null]" default_remediation_factor="[null]"
+ remediation_coeff="[null]" default_remediation_coeff="[null]"
remediation_offset="[null]" default_remediation_offset="[null]"
effort_to_fix_description="[null]"/>
diff --git a/sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/update-result.xml b/sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/update-result.xml
index d54cff88519..5c2ad7484e4 100644
--- a/sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/update-result.xml
+++ b/sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/update-result.xml
@@ -5,7 +5,7 @@
note_data="My note" note_user_login="admin" note_created_at="2013-12-19" note_updated_at="2013-12-20"
characteristic_id="100" default_characteristic_id="101"
remediation_function="linear" default_remediation_function="linear_offset"
- remediation_factor="1h" default_remediation_factor="5d"
+ remediation_coeff="1h" default_remediation_coeff="5d"
remediation_offset="5min" default_remediation_offset="10h"
effort_to_fix_description="squid.S115.effortToFix"
/>