diff options
author | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2017-03-22 16:07:06 +0100 |
---|---|---|
committer | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2017-03-23 17:54:56 +0100 |
commit | 8f1a1c279652ca60e555057c96b3db03d5132c71 (patch) | |
tree | dbbb91db997439d2db363413bbb475fb00d8dee1 /server | |
parent | 436be5476fd12d45b1e20eb58079904ef61b3eea (diff) | |
download | sonarqube-8f1a1c279652ca60e555057c96b3db03d5132c71.tar.gz sonarqube-8f1a1c279652ca60e555057c96b3db03d5132c71.zip |
SONAR-8867 drop metadata columns from table RULES
Diffstat (limited to 'server')
31 files changed, 700 insertions, 332 deletions
diff --git a/server/sonar-db-core/src/main/resources/org/sonar/db/version/rows-h2.sql b/server/sonar-db-core/src/main/resources/org/sonar/db/version/rows-h2.sql index a4705b31fc7..0dd7c8e771d 100644 --- a/server/sonar-db-core/src/main/resources/org/sonar/db/version/rows-h2.sql +++ b/server/sonar-db-core/src/main/resources/org/sonar/db/version/rows-h2.sql @@ -549,6 +549,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1613'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1614'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1615'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1616'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1617'); INSERT INTO USERS(ID, LOGIN, NAME, EMAIL, EXTERNAL_IDENTITY, EXTERNAL_IDENTITY_PROVIDER, USER_LOCAL, CRYPTED_PASSWORD, SALT, IS_ROOT, CREATED_AT, UPDATED_AT) VALUES (1, 'admin', 'Administrator', '', 'admin', 'sonarqube', true, 'a373a0e667abb2604c1fd571eb4ad47fe8cc0878', '48bc4b0d93179b5103fd3885ea9119498e9d161b', false, '1418215735482', '1418215735482'); ALTER TABLE USERS ALTER COLUMN ID RESTART WITH 2; diff --git a/server/sonar-db-core/src/main/resources/org/sonar/db/version/schema-h2.ddl b/server/sonar-db-core/src/main/resources/org/sonar/db/version/schema-h2.ddl index d2a2e5c4dca..d662a5fd67b 100644 --- a/server/sonar-db-core/src/main/resources/org/sonar/db/version/schema-h2.ddl +++ b/server/sonar-db-core/src/main/resources/org/sonar/db/version/schema-h2.ddl @@ -138,18 +138,10 @@ CREATE TABLE "RULES" ( "NAME" VARCHAR(200), "STATUS" VARCHAR(40), "LANGUAGE" VARCHAR(20), - "NOTE_DATA" CLOB(2147483647), - "NOTE_USER_LOGIN" VARCHAR(255), - "NOTE_CREATED_AT" TIMESTAMP, - "NOTE_UPDATED_AT" TIMESTAMP, - "REMEDIATION_FUNCTION" VARCHAR(20), "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "REMEDIATION_GAP_MULT" VARCHAR(20), "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "REMEDIATION_BASE_EFFORT" VARCHAR(20), "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), "GAP_DESCRIPTION" VARCHAR(4000), - "TAGS" VARCHAR(4000), "SYSTEM_TAGS" VARCHAR(4000), "RULE_TYPE" TINYINT, "CREATED_AT" BIGINT, diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/insert_parameter-result.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/insert_parameter-result.xml index 09c5a0403c7..36b0c887fcd 100644 --- a/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/insert_parameter-result.xml +++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/insert_parameter-result.xml @@ -1,12 +1,27 @@ <dataset> - <rules tags="[null]" system_tags="[null]" id="1" plugin_rule_key="NewRuleKey" plugin_name="plugin" name="new name" description="new description" status="DEPRECATED" - plugin_config_key="NewConfigKey" priority="0" is_template="[true]" language="dart" template_id="3" - note_data="[null]" note_user_login="[null]" note_created_at="[null]" note_updated_at="[null]" - remediation_function="linear" def_remediation_function="linear_offset" - remediation_gap_mult="1h" def_remediation_gap_mult="5d" - remediation_base_effort="5min" def_remediation_base_effort="10h" - gap_description="squid.S115.effortToFix" - created_at="[null]" updated_at="[null]" - /> - <rules_parameters id="1" rule_id="1" name="max" param_type="INTEGER" default_value="30" description="My Parameter"/> + <rules system_tags="[null]" + id="1" + plugin_rule_key="NewRuleKey" + plugin_name="plugin" + name="new name" + description="new description" + status="DEPRECATED" + plugin_config_key="NewConfigKey" + priority="0" + is_template="[true]" + language="dart" + template_id="3" + def_remediation_function="linear_offset" + def_remediation_gap_mult="5d" + def_remediation_base_effort="10h" + gap_description="squid.S115.effortToFix" + created_at="[null]" + updated_at="[null]" + /> + <rules_parameters id="1" + rule_id="1" + name="max" + param_type="INTEGER" + default_value="30" + description="My Parameter"/> </dataset> diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/insert_parameter.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/insert_parameter.xml index 82a2fb6c472..bf6dd1ccf8e 100644 --- a/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/insert_parameter.xml +++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/insert_parameter.xml @@ -1,11 +1,21 @@ <dataset> - <rules tags="[null]" system_tags="[null]" id="1" plugin_rule_key="NewRuleKey" plugin_name="plugin" name="new name" description="new description" status="DEPRECATED" - plugin_config_key="NewConfigKey" priority="0" is_template="[true]" language="dart" template_id="3" - note_data="[null]" note_user_login="[null]" note_created_at="[null]" note_updated_at="[null]" - remediation_function="linear" def_remediation_function="linear_offset" - remediation_gap_mult="1h" def_remediation_gap_mult="5d" - remediation_base_effort="5min" def_remediation_base_effort="10h" - gap_description="squid.S115.effortToFix" - created_at="[null]" updated_at="[null]" - /> + <rules system_tags="[null]" + id="1" + plugin_rule_key="NewRuleKey" + plugin_name="plugin" + name="new name" + description="new description" + status="DEPRECATED" + plugin_config_key="NewConfigKey" + priority="0" + is_template="[true]" + language="dart" + template_id="3" + def_remediation_function="linear_offset" + def_remediation_gap_mult="5d" + def_remediation_base_effort="10h" + gap_description="squid.S115.effortToFix" + created_at="[null]" + updated_at="[null]" + /> </dataset> diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/selectEnabled.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/selectEnabled.xml index e17e6ca13db..66427866042 100644 --- a/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/selectEnabled.xml +++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/selectEnabled.xml @@ -1,21 +1,35 @@ <dataset> - <rules tags="[null]" system_tags="[null]" id="1" plugin_rule_key="AvoidNull" plugin_name="checkstyle" name="Avoid Null" description="Should avoid NULL" status="READY" - note_data="Rule note with accents éèà" note_user_login="polop.palap" note_created_at="2013-12-25" description_format="HTML" - remediation_function="LINEAR" def_remediation_function="LINEAR_OFFSET" - remediation_gap_mult="1h" def_remediation_gap_mult="5d" - remediation_base_effort="5min" def_remediation_base_effort="10h" + <rules system_tags="[null]" + id="1" + plugin_rule_key="AvoidNull" + plugin_name="checkstyle" + name="Avoid Null" + description="Should avoid NULL" + description_format="HTML" + status="READY" + def_remediation_function="LINEAR_OFFSET" + def_remediation_gap_mult="5d" + def_remediation_base_effort="10h" gap_description="squid.S115.effortToFix" - created_at="1500000000000" updated_at="1600000000000" + created_at="1500000000000" + updated_at="1600000000000" /> - <rules tags="[null]" system_tags="[null]" id="2" plugin_rule_key="AvoidNull" plugin_name="squid" name="Avoid Null" description="Should avoid NULL" status="REMOVED" - note_data="[null]" note_user_login="[null]" note_created_at="[null]" description_format="HTML" - remediation_function="[null]" def_remediation_function="[null]" - remediation_gap_mult="[null]" def_remediation_gap_mult="[null]" - remediation_base_effort="[null]" def_remediation_base_effort="[null]" + <rules system_tags="[null]" + id="2" + plugin_rule_key="AvoidNull" + plugin_name="squid" + name="Avoid Null" + description="Should avoid NULL" + description_format="HTML" + status="REMOVED" + def_remediation_function="[null]" + def_remediation_gap_mult="[null]" + def_remediation_base_effort="[null]" gap_description="[null]" - created_at="1500000000000" updated_at="1600000000000" + created_at="1500000000000" + updated_at="1600000000000" /> </dataset> diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/selectNonManual.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/selectNonManual.xml index f4c6a9bc32f..3d49bf1ac0a 100644 --- a/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/selectNonManual.xml +++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/selectNonManual.xml @@ -1,10 +1,24 @@ <dataset> - <rules tags="[null]" system_tags="[null]" id="1" plugin_rule_key="AvoidNull" plugin_name="checkstyle" - name="Avoid Null" description="Should avoid NULL" status="READY" description_format="HTML" - created_at="1500000000000" updated_at="1600000000000"/> - <rules tags="[null]" system_tags="[null]" id="2" plugin_rule_key="AvoidNull" plugin_name="manual" name="Manual Rule" - description="Should not appear" status="READY" description_format="HTML" - created_at="1500000000000" updated_at="1600000000000"/> + <rules system_tags="[null]" + id="1" + plugin_rule_key="AvoidNull" + plugin_name="checkstyle" + name="Avoid Null" + description="Should avoid NULL" + status="READY" + description_format="HTML" + created_at="1500000000000" + updated_at="1600000000000"/> + <rules system_tags="[null]" + id="2" + plugin_rule_key="AvoidNull" + plugin_name="manual" + name="Manual Rule" + description="Should not appear" + status="READY" + description_format="HTML" + created_at="1500000000000" + updated_at="1600000000000"/> </dataset> diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/select_parameters_by_rule_key.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/select_parameters_by_rule_key.xml index 65d9b4e5a45..f96c1359147 100644 --- a/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/select_parameters_by_rule_key.xml +++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/select_parameters_by_rule_key.xml @@ -1,15 +1,35 @@ <dataset> - <rules tags="[null]" system_tags="[null]" id="1" plugin_rule_key="AvoidNull" plugin_name="checkstyle" - name="Avoid Null" description="Should avoid NULL" status="READY" - created_at="1500000000000" updated_at="1600000000000"/> - <rules_parameters id="1" rule_id="1" name="myParameter" param_type="plop" default_value="plouf" + <rules system_tags="[null]" + id="1" + plugin_rule_key="AvoidNull" + plugin_name="checkstyle" + name="Avoid Null" + description="Should avoid NULL" + status="READY" + created_at="1500000000000" + updated_at="1600000000000"/> + <rules_parameters id="1" + rule_id="1" + name="myParameter" + param_type="plop" + default_value="plouf" description="My Parameter"/> - <rules tags="[null]" system_tags="[null]" id="2" plugin_rule_key="Unused" plugin_name="unused" name="Unused Rule" - description="Not used" status="REMOVED" - created_at="1500000000000" updated_at="1600000000000"/> - <rules_parameters id="2" rule_id="2" name="otherParam" param_type="plop" default_value="plouf" + <rules system_tags="[null]" + id="2" + plugin_rule_key="Unused" + plugin_name="unused" + name="Unused Rule" + description="Not used" + status="REMOVED" + created_at="1500000000000" + updated_at="1600000000000"/> + <rules_parameters id="2" + rule_id="2" + name="otherParam" + param_type="plop" + default_value="plouf" description="Other Parameter"/> </dataset> diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/shared.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/shared.xml index 25f223c5f55..2619953014a 100644 --- a/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/shared.xml +++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/shared.xml @@ -10,7 +10,6 @@ status="READY" is_template="[false]" template_id="[null]" - tags="bug,performance" system_tags="cwe" created_at="1500000000000" updated_at="1600000000000" @@ -26,7 +25,6 @@ status="BETA" is_template="[false]" template_id="[null]" - tags="[null]" system_tags="[null]" created_at="1500000000000" updated_at="1600000000000" @@ -42,7 +40,6 @@ status="REMOVED" is_template="[false]" template_id="[null]" - tags="[null]" system_tags="[null]" created_at="1500000000000" updated_at="1600000000000" diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/update.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/update.xml index b862d51da43..eed68c92290 100644 --- a/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/update.xml +++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/update.xml @@ -1,7 +1,6 @@ <dataset> - <rules tags="[null]" - system_tags="[null]" + <rules system_tags="[null]" id="1" plugin_rule_key="AvoidNull" plugin_name="checkstyle" diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/update_parameter-result.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/update_parameter-result.xml index 3907b7d23c6..6f7b4c7f679 100644 --- a/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/update_parameter-result.xml +++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/update_parameter-result.xml @@ -1,8 +1,18 @@ <dataset> - <rules tags="[null]" system_tags="[null]" id="1" plugin_rule_key="AvoidNull" plugin_name="checkstyle" - name="Avoid Null" description="Should avoid NULL" status="READY" - created_at="1500000000000" updated_at="1600000000000"/> + <rules system_tags="[null]" + id="1" + plugin_rule_key="AvoidNull" + plugin_name="checkstyle" + name="Avoid Null" + description="Should avoid NULL" + status="READY" + created_at="1500000000000" + updated_at="1600000000000"/> - <rules_parameters id="1" rule_id="1" name="max" param_type="STRING" default_value="^[a-z]+(\.[a-z][a-z0-9]*)*$" + <rules_parameters id="1" + rule_id="1" + name="max" + param_type="STRING" + default_value="^[a-z]+(\.[a-z][a-z0-9]*)*$" description="Regular expression used to check the package names against."/> </dataset> diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/update_parameter.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/update_parameter.xml index 2eb61cc7029..26bc299306c 100644 --- a/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/update_parameter.xml +++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/rule/RuleDaoTest/update_parameter.xml @@ -1,7 +1,18 @@ <dataset> - <rules tags="[null]" system_tags="[null]" id="1" plugin_rule_key="AvoidNull" plugin_name="checkstyle" - name="Avoid Null" description="Should avoid NULL" status="READY" - created_at="1500000000000" updated_at="1600000000000"/> + <rules system_tags="[null]" + id="1" + plugin_rule_key="AvoidNull" + plugin_name="checkstyle" + name="Avoid Null" + description="Should avoid NULL" + status="READY" + created_at="1500000000000" + updated_at="1600000000000"/> - <rules_parameters id="1" rule_id="1" name="max" param_type="INTEGER" default_value="30" description="My Parameter"/> + <rules_parameters id="1" + rule_id="1" + name="max" + param_type="INTEGER" + default_value="30" + description="My Parameter"/> </dataset> diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DbVersion64.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DbVersion64.java index 5ee08ddf7b9..e000208527b 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DbVersion64.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DbVersion64.java @@ -43,6 +43,7 @@ public class DbVersion64 implements DbVersion { .add(1613, "Add index LOADED_TEMPLATES_TYPE", AddIndexLoadedTemplatesType.class) .add(1614, "Upgrade loaded template entries for quality profiles", UpgradeQualityTemplateLoadedTemplates.class) .add(1615, "Create table RULES_METADATA", CreateRulesMetadata.class) - .add(1616, "Populate table RULES_METADATA", PopulateRulesMetadata.class); + .add(1616, "Populate table RULES_METADATA", PopulateRulesMetadata.class) + .add(1617, "Drop metadata columns from RULES", DropMetadataColumnsFromRules.class); } } diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DropMetadataColumnsFromRules.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DropMetadataColumnsFromRules.java new file mode 100644 index 00000000000..c9971650276 --- /dev/null +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DropMetadataColumnsFromRules.java @@ -0,0 +1,44 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.server.platform.db.migration.version.v64; + +import java.sql.SQLException; +import org.sonar.db.Database; +import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; +import org.sonar.server.platform.db.migration.step.DdlChange; + +public class DropMetadataColumnsFromRules extends DdlChange { + + private static final String TABLE_RULES = "rules"; + + public DropMetadataColumnsFromRules(Database db) { + super(db); + } + + @Override + public void execute(Context context) throws SQLException { + context.execute(new DropColumnsBuilder( + getDialect(), TABLE_RULES, + "note_data", "note_user_login", "note_created_at", "note_updated_at", + "remediation_function", "remediation_gap_mult", "remediation_base_effort", + "tags") + .build()); + } +} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/DbVersion64Test.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/DbVersion64Test.java index 4ca458bbdde..727a9de26f4 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/DbVersion64Test.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/DbVersion64Test.java @@ -35,7 +35,7 @@ public class DbVersion64Test { @Test public void verify_migration_count() { - verifyMigrationCount(underTest, 17); + verifyMigrationCount(underTest, 18); } } diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/DropMetadataColumnsFromRulesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/DropMetadataColumnsFromRulesTest.java new file mode 100644 index 00000000000..6834f330619 --- /dev/null +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/DropMetadataColumnsFromRulesTest.java @@ -0,0 +1,49 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.server.platform.db.migration.version.v64; + +import java.sql.SQLException; +import org.junit.Rule; +import org.junit.Test; +import org.sonar.db.CoreDbTester; + +public class DropMetadataColumnsFromRulesTest { + + private static final String TABLE_RULES = "rules"; + + @Rule + public CoreDbTester db = CoreDbTester.createForSchema(DropMetadataColumnsFromRulesTest.class, "rules.sql"); + + private DropMetadataColumnsFromRules underTest = new DropMetadataColumnsFromRules(db.database()); + + @Test + public void execute_drops_metadata_columns_from_table_RULES() throws SQLException { + underTest.execute(); + + db.assertColumnDoesNotExist(TABLE_RULES, "note_data"); + db.assertColumnDoesNotExist(TABLE_RULES, "note_user_login"); + db.assertColumnDoesNotExist(TABLE_RULES, "note_created_at"); + db.assertColumnDoesNotExist(TABLE_RULES, "note_updated_at"); + db.assertColumnDoesNotExist(TABLE_RULES, "remediation_function"); + db.assertColumnDoesNotExist(TABLE_RULES, "remediation_gap_mult"); + db.assertColumnDoesNotExist(TABLE_RULES, "remediation_base_effort"); + db.assertColumnDoesNotExist(TABLE_RULES, "tags"); + } +} diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/DropMetadataColumnsFromRulesTest/rules.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/DropMetadataColumnsFromRulesTest/rules.sql new file mode 100644 index 00000000000..de12d87f46a --- /dev/null +++ b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/DropMetadataColumnsFromRulesTest/rules.sql @@ -0,0 +1,31 @@ +CREATE TABLE "RULES" ( + "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, + "PLUGIN_NAME" VARCHAR(255) NOT NULL, + "DESCRIPTION" VARCHAR(16777215), + "DESCRIPTION_FORMAT" VARCHAR(20), + "PRIORITY" INTEGER, + "IS_TEMPLATE" BOOLEAN DEFAULT FALSE, + "TEMPLATE_ID" INTEGER, + "PLUGIN_CONFIG_KEY" VARCHAR(200), + "NAME" VARCHAR(200), + "STATUS" VARCHAR(40), + "LANGUAGE" VARCHAR(20), + "NOTE_DATA" CLOB(2147483647), + "NOTE_USER_LOGIN" VARCHAR(255), + "NOTE_CREATED_AT" TIMESTAMP, + "NOTE_UPDATED_AT" TIMESTAMP, + "REMEDIATION_FUNCTION" VARCHAR(20), + "DEF_REMEDIATION_FUNCTION" VARCHAR(20), + "REMEDIATION_GAP_MULT" VARCHAR(20), + "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), + "REMEDIATION_BASE_EFFORT" VARCHAR(20), + "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), + "GAP_DESCRIPTION" VARCHAR(4000), + "TAGS" VARCHAR(4000), + "SYSTEM_TAGS" VARCHAR(4000), + "RULE_TYPE" TINYINT, + "CREATED_AT" BIGINT, + "UPDATED_AT" BIGINT +); +CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES" ("PLUGIN_NAME", "PLUGIN_RULE_KEY"); diff --git a/server/sonar-server/src/test/resources/org/sonar/server/computation/task/projectanalysis/step/PersistIssuesStepTest/insert_new_issue.xml b/server/sonar-server/src/test/resources/org/sonar/server/computation/task/projectanalysis/step/PersistIssuesStepTest/insert_new_issue.xml index 2c62945895a..fb442813aae 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/computation/task/projectanalysis/step/PersistIssuesStepTest/insert_new_issue.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/computation/task/projectanalysis/step/PersistIssuesStepTest/insert_new_issue.xml @@ -1,14 +1,24 @@ <dataset> - <rules id="1" plugin_rule_key="S01" plugin_name="xoo" name="name" description="description" status="READY" - plugin_config_key="[null]" priority="0" is_template="[true]" language="xoo" template_id="[null]" - note_data="[null]" note_user_login="[null]" note_created_at="[null]" note_updated_at="[null]" - remediation_function="LINEAR_OFFSET" def_remediation_function="LINEAR_OFFSET" - remediation_coeff="1h" def_remediation_coeff="5d" - remediation_offset="5min" def_remediation_offset="10h" - effort_to_fix_description="[null]" description_format="MARKDOWN" - tags="[null]" system_tags="[null]" - created_at="1500000000000" updated_at="1500000000000" - /> + <rules id="1" + plugin_rule_key="S01" + plugin_name="xoo" + name="name" + description="description" + status="READY" + plugin_config_key="[null]" + priority="0" + is_template="[true]" + language="xoo" + template_id="[null]" + def_remediation_function="LINEAR_OFFSET" + def_remediation_coeff="5d" + def_remediation_offset="10h" + effort_to_fix_description="[null]" + description_format="MARKDOWN" + system_tags="[null]" + created_at="1500000000000" + updated_at="1500000000000" + /> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/computation/task/projectanalysis/step/PersistIssuesStepTest/shared.xml b/server/sonar-server/src/test/resources/org/sonar/server/computation/task/projectanalysis/step/PersistIssuesStepTest/shared.xml index c014ac83323..5398346c73f 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/computation/task/projectanalysis/step/PersistIssuesStepTest/shared.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/computation/task/projectanalysis/step/PersistIssuesStepTest/shared.xml @@ -1,15 +1,25 @@ <dataset> - <rules id="1" plugin_rule_key="S01" plugin_name="xoo" name="name" description="description" status="READY" - plugin_config_key="[null]" priority="0" is_template="[true]" language="xoo" template_id="[null]" - note_data="[null]" note_user_login="[null]" note_created_at="[null]" note_updated_at="[null]" - remediation_function="LINEAR" def_remediation_function="LINEAR_OFFSET" - remediation_gap_mult="1h" def_remediation_gap_mult="5d" - remediation_base_effort="5min" def_remediation_base_effort="10h" - gap_description="[null]" description_format="MARKDOWN" - tags="[null]" system_tags="[null]" - created_at="1500000000000" updated_at="1500000000000" - /> + <rules id="1" + plugin_rule_key="S01" + plugin_name="xoo" + name="name" + description="description" + status="READY" + plugin_config_key="[null]" + priority="0" + is_template="[true]" + language="xoo" + template_id="[null]" + def_remediation_function="LINEAR_OFFSET" + def_remediation_gap_mult="5d" + def_remediation_base_effort="10h" + gap_description="[null]" + description_format="MARKDOWN" + system_tags="[null]" + created_at="1500000000000" + updated_at="1500000000000" + /> <issues id="1" @@ -39,6 +49,6 @@ updated_at="1300000000000" locations="[null]" issue_type="[null]" - /> + /> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueIndexerTest/index.xml b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueIndexerTest/index.xml index 27fe454d76f..d2b73d2647d 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueIndexerTest/index.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueIndexerTest/index.xml @@ -1,6 +1,5 @@ <dataset> <rules id="1" - tags="[null]" system_tags="[null]" name="Avoid Cycles" plugin_rule_key="AvoidCycles" diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueIndexerTest/index_project.xml b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueIndexerTest/index_project.xml index 7784843c4a7..f3cb6776b57 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueIndexerTest/index_project.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueIndexerTest/index_project.xml @@ -1,6 +1,5 @@ <dataset> <rules id="1" - tags="[null]" system_tags="[null]" name="Avoid Cycles" plugin_rule_key="AvoidCycles" diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/extract_directory_path.xml b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/extract_directory_path.xml index b25c4bf8c30..ba40134ef9d 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/extract_directory_path.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/extract_directory_path.xml @@ -1,6 +1,5 @@ <dataset> - <rules tags="[null]" - system_tags="[null]" + <rules system_tags="[null]" id="200" name="Avoid Cycles" plugin_rule_key="AvoidCycles" @@ -52,120 +51,119 @@ kee="pom" name="pom.xml"/> - <issues - id="1" - kee="ABC" - resolution="FIXED" - status="RESOLVED" - severity="BLOCKER" - manual_severity="[false]" - assignee="guy1" - author_login="guy2" - checksum="FFFFF" - gap="[null]" - effort="10" - message="[null]" - line="444" - component_uuid="FILE" - project_uuid="PROJECT" - rule_id="200" - reporter="[null]" - issue_attributes="JIRA=http://jira.com" - action_plan_key="[null]" - tags="tag1,tag2,tag3" - created_at="1400000000000" - updated_at="1400000000000" - issue_creation_date="1115848800000" - issue_update_date="1356994800000" - issue_close_date="[null]" - locations="[null]" - issue_type="1"/> + <issues id="1" + kee="ABC" + resolution="FIXED" + status="RESOLVED" + severity="BLOCKER" + manual_severity="[false]" + assignee="guy1" + author_login="guy2" + checksum="FFFFF" + gap="[null]" + effort="10" + message="[null]" + line="444" + component_uuid="FILE" + project_uuid="PROJECT" + rule_id="200" + reporter="[null]" + issue_attributes="JIRA=http://jira.com" + action_plan_key="[null]" + tags="tag1,tag2,tag3" + created_at="1400000000000" + updated_at="1400000000000" + issue_creation_date="1115848800000" + issue_update_date="1356994800000" + issue_close_date="[null]" + locations="[null]" + issue_type="1"/> <issues - id="2" - kee="DEF" - resolution="[null]" - status="OPEN" - severity="MAJOR" - manual_severity="[false]" - assignee="guy2" - author_login="[null]" - checksum="FFFFF" - gap="[null]" - effort="15" - message="[null]" - line="444" - component_uuid="ROOT_FILE" - project_uuid="PROJECT" - rule_id="200" - reporter="[null]" - issue_attributes="JIRA=http://jira.com" - action_plan_key="[null]" - tags="[null]" - created_at="1400000000000" - updated_at="1450000000000" - issue_creation_date="1115848800000" - issue_update_date="1368828000000" - issue_close_date="[null]" - locations="[null]" - issue_type="1"/> + id="2" + kee="DEF" + resolution="[null]" + status="OPEN" + severity="MAJOR" + manual_severity="[false]" + assignee="guy2" + author_login="[null]" + checksum="FFFFF" + gap="[null]" + effort="15" + message="[null]" + line="444" + component_uuid="ROOT_FILE" + project_uuid="PROJECT" + rule_id="200" + reporter="[null]" + issue_attributes="JIRA=http://jira.com" + action_plan_key="[null]" + tags="[null]" + created_at="1400000000000" + updated_at="1450000000000" + issue_creation_date="1115848800000" + issue_update_date="1368828000000" + issue_close_date="[null]" + locations="[null]" + issue_type="1"/> <issues - id="3" - kee="EFG" - resolution="[null]" - status="OPEN" - severity="MAJOR" - manual_severity="[false]" - assignee="guy2" - author_login="[null]" - checksum="FFFFF" - gap="[null]" - effort="15" - message="[null]" - line="[null]" - component_uuid="PROJECT" - project_uuid="PROJECT" - rule_id="200" - reporter="[null]" - issue_attributes="JIRA=http://jira.com" - action_plan_key="[null]" - tags="[null]" - created_at="1400000000000" - updated_at="1450000000000" - issue_creation_date="1115848800000" - issue_update_date="1368828000000" - issue_close_date="[null]" - locations="[null]" - issue_type="1"/> + id="3" + kee="EFG" + resolution="[null]" + status="OPEN" + severity="MAJOR" + manual_severity="[false]" + assignee="guy2" + author_login="[null]" + checksum="FFFFF" + gap="[null]" + effort="15" + message="[null]" + line="[null]" + component_uuid="PROJECT" + project_uuid="PROJECT" + rule_id="200" + reporter="[null]" + issue_attributes="JIRA=http://jira.com" + action_plan_key="[null]" + tags="[null]" + created_at="1400000000000" + updated_at="1450000000000" + issue_creation_date="1115848800000" + issue_update_date="1368828000000" + issue_close_date="[null]" + locations="[null]" + issue_type="1"/> <issues - id="4" - kee="FGH" - resolution="[null]" - status="OPEN" - severity="MAJOR" - manual_severity="[false]" - assignee="guy2" - author_login="[null]" - checksum="FFFFF" - gap="[null]" - effort="15" - message="[null]" - line="[null]" - component_uuid="MODULE" - project_uuid="PROJECT" - rule_id="200" - reporter="[null]" - issue_attributes="JIRA=http://jira.com" - action_plan_key="[null]" - tags="[null]" - created_at="1400000000000" - updated_at="1450000000000" - issue_creation_date="1115848800000" - issue_update_date="1368828000000" - issue_close_date="[null]" - locations="[null]" - issue_type="1"/> + id="4" + kee="FGH" + resolution="[null]" + status="OPEN" + severity="MAJOR" + manual_severity="[false]" + assignee="guy2" + author_login="[null]" + checksum="FFFFF" + gap="[null]" + effort="15" + message="[null]" + line="[null]" + component_uuid="MODULE" + project_uuid="PROJECT" + rule_id="200" + reporter="[null]" + issue_attributes="JIRA=http://jira.com" + action_plan_key="[null]" + tags="[null]" + created_at="1400000000000" + updated_at="1450000000000" + issue_creation_date="1115848800000" + issue_update_date="1368828000000" + issue_close_date="[null]" + locations="[null]" + issue_type="1"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/extract_file_path.xml b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/extract_file_path.xml index b7765c8a690..b49c887546e 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/extract_file_path.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/extract_file_path.xml @@ -1,6 +1,5 @@ <dataset> - <rules tags="[null]" - system_tags="[null]" + <rules system_tags="[null]" id="200" name="Avoid Cycles" plugin_rule_key="AvoidCycles" diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/many_projects.xml b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/many_projects.xml index 64f6bd3d24a..6364fe7b662 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/many_projects.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/many_projects.xml @@ -1,6 +1,5 @@ <dataset> <rules id="1" - tags="[null]" system_tags="[null]" name="Avoid Cycles" plugin_rule_key="AvoidCycles" @@ -33,32 +32,33 @@ kee="the_file_1" name="TheFile1"/> - <issues id="1" - kee="ABCDE" - resolution="FIXED" - status="RESOLVED" - severity="BLOCKER" - manual_severity="[false]" - assignee="winner" - author_login="[null]" - checksum="FFFFF" - gap="[null]" - effort="[null]" - message="[null]" - line="444" - component_uuid="THE_FILE_1" - project_uuid="THE_PROJECT_1" - rule_id="1" - reporter="[null]" - issue_attributes="JIRA=http://jira.com" - action_plan_key="[null]" - created_at="1500000000000" - updated_at="1550000000000" - issue_creation_date="1115848800000" - issue_update_date="1368828000000" - issue_close_date="[null]" - locations="[null]" - issue_type="1" + <issues + id="1" + kee="ABCDE" + resolution="FIXED" + status="RESOLVED" + severity="BLOCKER" + manual_severity="[false]" + assignee="winner" + author_login="[null]" + checksum="FFFFF" + gap="[null]" + effort="[null]" + message="[null]" + line="444" + component_uuid="THE_FILE_1" + project_uuid="THE_PROJECT_1" + rule_id="1" + reporter="[null]" + issue_attributes="JIRA=http://jira.com" + action_plan_key="[null]" + created_at="1500000000000" + updated_at="1550000000000" + issue_creation_date="1115848800000" + issue_update_date="1368828000000" + issue_close_date="[null]" + locations="[null]" + issue_type="1" /> <issues id="2" diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/one_issue.xml b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/one_issue.xml index cc7c0e8bc56..76fe1f7c612 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/one_issue.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/one_issue.xml @@ -1,6 +1,5 @@ <dataset> - <rules tags="[null]" - system_tags="[null]" + <rules system_tags="[null]" id="200" name="Avoid Cycles" plugin_rule_key="AvoidCycles" @@ -53,33 +52,33 @@ name="Action"/> <issues - id="1" - kee="ABC" - resolution="FIXED" - status="RESOLVED" - severity="BLOCKER" - manual_severity="[false]" - assignee="guy1" - author_login="guy2" - checksum="FFFFF" - gap="2" - effort="10" - message="[null]" - line="444" - component_uuid="FILE1" - project_uuid="PROJECT1" - rule_id="200" - reporter="[null]" - issue_attributes="JIRA=http://jira.com" - action_plan_key="PLAN1" - tags="tag1,tag2,tag3" - created_at="1400000000000" - updated_at="1400000000000" - issue_creation_date="1115848800000" - issue_update_date="1356994800000" - issue_close_date="[null]" - locations="[null]" - issue_type="2" + id="1" + kee="ABC" + resolution="FIXED" + status="RESOLVED" + severity="BLOCKER" + manual_severity="[false]" + assignee="guy1" + author_login="guy2" + checksum="FFFFF" + gap="2" + effort="10" + message="[null]" + line="444" + component_uuid="FILE1" + project_uuid="PROJECT1" + rule_id="200" + reporter="[null]" + issue_attributes="JIRA=http://jira.com" + action_plan_key="PLAN1" + tags="tag1,tag2,tag3" + created_at="1400000000000" + updated_at="1400000000000" + issue_creation_date="1115848800000" + issue_update_date="1356994800000" + issue_close_date="[null]" + locations="[null]" + issue_type="2" /> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/shared.xml b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/shared.xml index 298a31dd536..173a7baf3c6 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/shared.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/shared.xml @@ -1,6 +1,5 @@ <dataset> - <rules tags="[null]" - system_tags="[null]" + <rules system_tags="[null]" id="200" name="Avoid Cycles" plugin_rule_key="AvoidCycles" diff --git a/server/sonar-server/src/test/resources/org/sonar/server/platform/BackendCleanupTest/shared.xml b/server/sonar-server/src/test/resources/org/sonar/server/platform/BackendCleanupTest/shared.xml index 170a15ced6f..1733b52abe4 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/platform/BackendCleanupTest/shared.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/platform/BackendCleanupTest/shared.xml @@ -24,8 +24,7 @@ version="[null]" /> - <rules tags="[null]" - system_tags="[null]" + <rules system_tags="[null]" id="1" plugin_rule_key="NewRuleKey" plugin_name="plugin" @@ -37,15 +36,8 @@ is_template="[true]" language="dart" template_id="3" - note_data="[null]" - note_user_login="[null]" - note_created_at="[null]" - note_updated_at="[null]" - remediation_function="LINEAR" def_remediation_function="LINEAR_OFFSET" - remediation_gap_mult="1h" def_remediation_gap_mult="5d" - remediation_base_effort="5min" def_remediation_base_effort="10h" gap_description="squid.S115.effortToFix" description_format="MARKDOWN" diff --git a/server/sonar-server/src/test/resources/org/sonar/server/qualityprofile/index/ActiveRuleIndexerTest/index.xml b/server/sonar-server/src/test/resources/org/sonar/server/qualityprofile/index/ActiveRuleIndexerTest/index.xml index 80edf1f9035..c0d3dfcafa5 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/qualityprofile/index/ActiveRuleIndexerTest/index.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/qualityprofile/index/ActiveRuleIndexerTest/index.xml @@ -1,13 +1,34 @@ <dataset> - <rules id="10" name="Null Pointer" plugin_name="xoo" plugin_rule_key="S001" - plugin_config_key="S1" description_format="HTML" description="S001 desc" language="xoo" - priority="4" status="READY" is_template="[false]" template_id="[null]" - tags="bug,performance" system_tags="cwe" - created_at="1500000000000" updated_at="1600000000000"/> + <rules id="10" + name="Null Pointer" + plugin_name="xoo" + plugin_rule_key="S001" + plugin_config_key="S1" + description_format="HTML" + description="S001 desc" + language="xoo" + priority="4" + status="READY" + is_template="[false]" + template_id="[null]" + system_tags="cwe" + created_at="1500000000000" + updated_at="1600000000000"/> - <rules_profiles id="100" name="Sonar Way" organization_uuid="org-123" kee="sonar-way" language="xoo" parent_kee="[null]" is_default="[false]"/> + <rules_profiles id="100" + name="Sonar Way" + organization_uuid="org-123" + kee="sonar-way" + language="xoo" + parent_kee="[null]" + is_default="[false]"/> - <active_rules id="1" profile_id="100" rule_id="10" failure_level="3" inheritance="[null]" - created_at="1500000000000" updated_at="1600000000000"/> + <active_rules id="1" + profile_id="100" + rule_id="10" + failure_level="3" + inheritance="[null]" + created_at="1500000000000" + updated_at="1600000000000"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/qualityprofile/index/ActiveRuleResultSetIteratorTest/active_rule_with_inherited_inheritance.xml b/server/sonar-server/src/test/resources/org/sonar/server/qualityprofile/index/ActiveRuleResultSetIteratorTest/active_rule_with_inherited_inheritance.xml index 52b6bca6dfc..b2dc134a2b8 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/qualityprofile/index/ActiveRuleResultSetIteratorTest/active_rule_with_inherited_inheritance.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/qualityprofile/index/ActiveRuleResultSetIteratorTest/active_rule_with_inherited_inheritance.xml @@ -1,20 +1,52 @@ <dataset> - <rules id="10" name="Null Pointer" plugin_rule_key="S001" plugin_name="xoo" - plugin_config_key="S1" description_format="HTML" description="S001 desc" language="xoo" - priority="4" status="READY" is_template="[false]" template_id="[null]" - tags="bug,performance" system_tags="cwe" - created_at="1500000000000" updated_at="1600000000000"/> + <rules id="10" + name="Null Pointer" + plugin_rule_key="S001" + plugin_name="xoo" + plugin_config_key="S1" + description_format="HTML" + description="S001 desc" + language="xoo" + priority="4" + status="READY" + is_template="[false]" + template_id="[null]" + system_tags="cwe" + created_at="1500000000000" + updated_at="1600000000000"/> - <rules_profiles id="1" name="Parent" organization_uuid="org-123" kee="parent" language="xoo" parent_kee="[null]" is_default="[false]"/> + <rules_profiles id="1" + name="Parent" + organization_uuid="org-123" + kee="parent" + language="xoo" + parent_kee="[null]" + is_default="[false]"/> - <rules_profiles id="2" name="Child" organization_uuid="org-123" kee="child" language="xoo" parent_kee="parent" is_default="[false]"/> + <rules_profiles id="2" + name="Child" + organization_uuid="org-123" + kee="child" + language="xoo" + parent_kee="parent" + is_default="[false]"/> - <active_rules id="1" profile_id="2" rule_id="10" failure_level="4" inheritance="INHERITED" - created_at="1500000000000" updated_at="1600000000000"/> + <active_rules id="1" + profile_id="2" + rule_id="10" + failure_level="4" + inheritance="INHERITED" + created_at="1500000000000" + updated_at="1600000000000"/> <!-- Parent of Active rule 1 --> - <active_rules id="2" profile_id="1" rule_id="10" failure_level="0" inheritance="[null]" - created_at="1500000000000" updated_at="1600000000000"/> + <active_rules id="2" + profile_id="1" + rule_id="10" + failure_level="0" + inheritance="[null]" + created_at="1500000000000" + updated_at="1600000000000"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/qualityprofile/index/ActiveRuleResultSetIteratorTest/active_rule_with_overrides_inheritance.xml b/server/sonar-server/src/test/resources/org/sonar/server/qualityprofile/index/ActiveRuleResultSetIteratorTest/active_rule_with_overrides_inheritance.xml index 9becffa199f..93db43f64a5 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/qualityprofile/index/ActiveRuleResultSetIteratorTest/active_rule_with_overrides_inheritance.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/qualityprofile/index/ActiveRuleResultSetIteratorTest/active_rule_with_overrides_inheritance.xml @@ -1,20 +1,52 @@ <dataset> - <rules id="10" name="Null Pointer" plugin_rule_key="S001" plugin_name="xoo" - plugin_config_key="S1" description_format="HTML" description="S001 desc" language="xoo" - priority="4" status="READY" is_template="[false]" template_id="[null]" - tags="bug,performance" system_tags="cwe" - created_at="1500000000000" updated_at="1600000000000"/> + <rules id="10" + name="Null Pointer" + plugin_rule_key="S001" + plugin_name="xoo" + plugin_config_key="S1" + description_format="HTML" + description="S001 desc" + language="xoo" + priority="4" + status="READY" + is_template="[false]" + template_id="[null]" + system_tags="cwe" + created_at="1500000000000" + updated_at="1600000000000"/> - <rules_profiles id="1" name="Parent" organization_uuid="org-123" kee="parent" language="xoo" parent_kee="[null]" is_default="[false]"/> + <rules_profiles id="1" + name="Parent" + organization_uuid="org-123" + kee="parent" + language="xoo" + parent_kee="[null]" + is_default="[false]"/> - <rules_profiles id="2" name="Child" organization_uuid="org-123" kee="child" language="xoo" parent_kee="parent" is_default="[false]"/> + <rules_profiles id="2" + name="Child" + organization_uuid="org-123" + kee="child" + language="xoo" + parent_kee="parent" + is_default="[false]"/> - <active_rules id="1" profile_id="2" rule_id="10" failure_level="2" inheritance="OVERRIDES" - created_at="1500000000000" updated_at="1600000000000"/> + <active_rules id="1" + profile_id="2" + rule_id="10" + failure_level="2" + inheritance="OVERRIDES" + created_at="1500000000000" + updated_at="1600000000000"/> <!-- Parent of Active rule 1 --> - <active_rules id="2" profile_id="1" rule_id="10" failure_level="0" inheritance="[null]" - created_at="1500000000000" updated_at="1600000000000"/> + <active_rules id="2" + profile_id="1" + rule_id="10" + failure_level="0" + inheritance="[null]" + created_at="1500000000000" + updated_at="1600000000000"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/qualityprofile/index/ActiveRuleResultSetIteratorTest/one_active_rule.xml b/server/sonar-server/src/test/resources/org/sonar/server/qualityprofile/index/ActiveRuleResultSetIteratorTest/one_active_rule.xml index 80edf1f9035..c0d3dfcafa5 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/qualityprofile/index/ActiveRuleResultSetIteratorTest/one_active_rule.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/qualityprofile/index/ActiveRuleResultSetIteratorTest/one_active_rule.xml @@ -1,13 +1,34 @@ <dataset> - <rules id="10" name="Null Pointer" plugin_name="xoo" plugin_rule_key="S001" - plugin_config_key="S1" description_format="HTML" description="S001 desc" language="xoo" - priority="4" status="READY" is_template="[false]" template_id="[null]" - tags="bug,performance" system_tags="cwe" - created_at="1500000000000" updated_at="1600000000000"/> + <rules id="10" + name="Null Pointer" + plugin_name="xoo" + plugin_rule_key="S001" + plugin_config_key="S1" + description_format="HTML" + description="S001 desc" + language="xoo" + priority="4" + status="READY" + is_template="[false]" + template_id="[null]" + system_tags="cwe" + created_at="1500000000000" + updated_at="1600000000000"/> - <rules_profiles id="100" name="Sonar Way" organization_uuid="org-123" kee="sonar-way" language="xoo" parent_kee="[null]" is_default="[false]"/> + <rules_profiles id="100" + name="Sonar Way" + organization_uuid="org-123" + kee="sonar-way" + language="xoo" + parent_kee="[null]" + is_default="[false]"/> - <active_rules id="1" profile_id="100" rule_id="10" failure_level="3" inheritance="[null]" - created_at="1500000000000" updated_at="1600000000000"/> + <active_rules id="1" + profile_id="100" + rule_id="10" + failure_level="3" + inheritance="[null]" + created_at="1500000000000" + updated_at="1600000000000"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/qualityprofile/index/ActiveRuleResultSetIteratorTest/shared.xml b/server/sonar-server/src/test/resources/org/sonar/server/qualityprofile/index/ActiveRuleResultSetIteratorTest/shared.xml index dbb7ec73cca..8ffde1cefe0 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/qualityprofile/index/ActiveRuleResultSetIteratorTest/shared.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/qualityprofile/index/ActiveRuleResultSetIteratorTest/shared.xml @@ -1,35 +1,84 @@ <dataset> - <rules id="10" name="Null Pointer" plugin_rule_key="S001" - plugin_config_key="S1" plugin_name="xoo" - description_format="HTML" description="S001 desc" language="xoo" - priority="4" status="READY" - is_template="[false]" template_id="[null]" - tags="bug,performance" system_tags="cwe" - created_at="1500000000000" updated_at="1600000000000"/> + <rules id="10" + name="Null Pointer" + plugin_rule_key="S001" + plugin_config_key="S1" + plugin_name="xoo" + description_format="HTML" + description="S001 desc" + language="xoo" + priority="4" + status="READY" + is_template="[false]" + template_id="[null]" + system_tags="cwe" + created_at="1500000000000" + updated_at="1600000000000"/> - <rules id="11" name="Slow" plugin_rule_key="S002" - plugin_config_key="S2" plugin_name="xoo" - description_format="MARKDOWN" description="*S002 desc*" language="xoo" - priority="3" status="BETA" - is_template="[true]" template_id="[null]" - tags="[null]" system_tags="[null]" - created_at="2000000000000" updated_at="2100000000000"/> + <rules id="11" + name="Slow" + plugin_rule_key="S002" + plugin_config_key="S2" + plugin_name="xoo" + description_format="MARKDOWN" + description="*S002 desc*" + language="xoo" + priority="3" + status="BETA" + is_template="[true]" + template_id="[null]" + system_tags="[null]" + created_at="2000000000000" + updated_at="2100000000000"/> - <rules_profiles id="1" name="Parent" organization_uuid="org-123" kee="parent" language="xoo" parent_kee="[null]" is_default="[false]"/> + <rules_profiles id="1" + name="Parent" + organization_uuid="org-123" + kee="parent" + language="xoo" + parent_kee="[null]" + is_default="[false]"/> - <rules_profiles id="2" name="Child" organization_uuid="org-123" kee="child" language="xoo" parent_kee="parent" is_default="[false]"/> + <rules_profiles id="2" + name="Child" + organization_uuid="org-123" + kee="child" + language="xoo" + parent_kee="parent" + is_default="[false]"/> - <active_rules id="1" profile_id="2" rule_id="10" failure_level="4" inheritance="INHERITED" - created_at="1500000000000" updated_at="1600000000000"/> + <active_rules id="1" + profile_id="2" + rule_id="10" + failure_level="4" + inheritance="INHERITED" + created_at="1500000000000" + updated_at="1600000000000"/> <!-- Parent of Active rule 1 --> - <active_rules id="2" profile_id="1" rule_id="10" failure_level="0" inheritance="[null]" - created_at="1700000000000" updated_at="1800000000000"/> + <active_rules id="2" + profile_id="1" + rule_id="10" + failure_level="0" + inheritance="[null]" + created_at="1700000000000" + updated_at="1800000000000"/> - <rules_profiles id="3" name="Sonar Way" organization_uuid="org-123" kee="sonar-way" language="xoo" parent_kee="[null]" is_default="[false]"/> + <rules_profiles id="3" + name="Sonar Way" + organization_uuid="org-123" + kee="sonar-way" + language="xoo" + parent_kee="[null]" + is_default="[false]"/> - <active_rules id="3" profile_id="3" rule_id="11" failure_level="3" inheritance="[null]" - created_at="2000000000000" updated_at="2100000000000"/> + <active_rules id="3" + profile_id="3" + rule_id="11" + failure_level="3" + inheritance="[null]" + created_at="2000000000000" + updated_at="2100000000000"/> </dataset> |