]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6187 Exclude requirements when getting all characteristics
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 18 Feb 2015 13:30:40 +0000 (14:30 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 18 Feb 2015 13:30:40 +0000 (14:30 +0100)
14 files changed:
server/sonar-server/src/main/java/org/sonar/server/db/migrations/v453/AddCharacteristicUsabilityAndSubCharacteristicsComplianceMigration.java
server/sonar-server/src/test/java/org/sonar/server/db/migrations/v453/AddCharacteristicUsabilityAndSubCharacteristicsComplianceMigrationTest.java
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v453/AddCharacteristicUsabilityAndSubCharacteristicsComplianceMigrationTest/do_nothing_when_already_migrated.xml
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v453/AddCharacteristicUsabilityAndSubCharacteristicsComplianceMigrationTest/fail_if_compliance_already_exists_as_characteristic.xml
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v453/AddCharacteristicUsabilityAndSubCharacteristicsComplianceMigrationTest/fail_if_compliance_already_exists_under_wrong_characteristic.xml
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v453/AddCharacteristicUsabilityAndSubCharacteristicsComplianceMigrationTest/fail_if_usability_exists_as_sub_characteristic.xml
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v453/AddCharacteristicUsabilityAndSubCharacteristicsComplianceMigrationTest/insert_usability_at_the_top_if_security_does_exists-result.xml
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v453/AddCharacteristicUsabilityAndSubCharacteristicsComplianceMigrationTest/insert_usability_at_the_top_if_security_does_exists.xml
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v453/AddCharacteristicUsabilityAndSubCharacteristicsComplianceMigrationTest/migrate-result.xml
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v453/AddCharacteristicUsabilityAndSubCharacteristicsComplianceMigrationTest/migrate.xml
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v453/AddCharacteristicUsabilityAndSubCharacteristicsComplianceMigrationTest/not_fail_if_some_deprecated_requirements_still_exists_in_db.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v453/AddCharacteristicUsabilityAndSubCharacteristicsComplianceMigrationTest/schema.sql
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v453/AddCharacteristicUsabilityAndSubCharacteristicsComplianceMigrationTest/update_usability_if_already_exists-result.xml
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v453/AddCharacteristicUsabilityAndSubCharacteristicsComplianceMigrationTest/update_usability_if_already_exists.xml

index 68c38e32495d6ef9216a6f448ae5b1c1663cbfcc..4595ae1d9f3066c5c5f641beaa85fd9056e2cf0b 100644 (file)
@@ -27,7 +27,6 @@ import org.sonar.api.utils.System2;
 import org.sonar.core.persistence.Database;
 import org.sonar.server.db.migrations.BaseDataChange;
 import org.sonar.server.db.migrations.Select;
-import org.sonar.server.db.migrations.Upsert;
 
 import javax.annotation.CheckForNull;
 import javax.annotation.Nullable;
@@ -36,8 +35,6 @@ import java.sql.SQLException;
 import java.util.Date;
 import java.util.List;
 
-import static com.google.common.collect.Lists.newArrayList;
-
 /**
  * See http://jira.codehaus.org/browse/SONAR-6187
  *
@@ -46,6 +43,8 @@ import static com.google.common.collect.Lists.newArrayList;
  *
  * Nothing will be done if there's no characteristics in db, as they're all gonna be created by {@link org.sonar.server.startup.RegisterDebtModel}
  *
+ * Before 4.3 the characteristics table contains requirements, then when selecting characteristics we should not forget to exclude them (with a filter on rule_id IS NULL)
+ *
  * @since 4.5.3
  */
 public class AddCharacteristicUsabilityAndSubCharacteristicsComplianceMigration extends BaseDataChange {
@@ -258,7 +257,8 @@ public class AddCharacteristicUsabilityAndSubCharacteristicsComplianceMigration
 
     private List<Characteristic> selectEnabledCharacteristics() throws SQLException {
       return context.prepareSelect(
-        "SELECT c.id, c.kee, c.name, c.characteristic_order, c.parent_id FROM characteristics c WHERE c.enabled=? ORDER BY c.characteristic_order")
+        // Exclude requirements (to not fail when coming from a version older than 4.3)
+        "SELECT c.id, c.kee, c.name, c.characteristic_order, c.parent_id FROM characteristics c WHERE c.enabled=? AND c.rule_id IS NULL ORDER BY c.characteristic_order")
         .setBoolean(1, true)
         .list(new CharacteristicReader());
     }
index ab44f784a89ed21c9c2eebbcb755e521ce32012f..d91905e704359cc04a8e2f592ba212c915a6fe85 100644 (file)
@@ -121,4 +121,11 @@ public class AddCharacteristicUsabilityAndSubCharacteristicsComplianceMigrationT
     }
   }
 
+  @Test
+  public void not_fail_if_some_deprecated_requirements_still_exists_in_db() throws Exception {
+    db.prepareDbUnit(getClass(), "not_fail_if_some_deprecated_requirements_still_exists_in_db.xml");
+    migration.execute();
+    db.assertDbUnit(getClass(), "not_fail_if_some_deprecated_requirements_still_exists_in_db.xml", "characteristics");
+  }
+
 }
index 684c4d4abc02e8ed4b4a6a8a638d0eabee923c00..2a67c5605ff736aa49eeb18cf7f41b1c846c5377 100644 (file)
@@ -1,33 +1,33 @@
 <dataset>
 
-  <characteristics id="1" kee="REUSABILITY" name="Reusability" parent_id="[null]" characteristic_order="1" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
-  <characteristics id="2" kee="REUSABILITY_COMPLIANCE" name="Reusability Compliance" parent_id="1" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+  <characteristics id="1" kee="REUSABILITY" name="Reusability" parent_id="[null]"  rule_id="[null]" characteristic_order="1" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+  <characteristics id="2" kee="REUSABILITY_COMPLIANCE" name="Reusability Compliance" parent_id="1"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
 
-  <characteristics id="3" kee="PORTABILITY" name="Portability" parent_id="[null]" characteristic_order="2" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
-  <characteristics id="4" kee="PORTABILITY_COMPLIANCE" name="Portability Compliance" parent_id="3" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+  <characteristics id="3" kee="PORTABILITY" name="Portability" parent_id="[null]"  rule_id="[null]" characteristic_order="2" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+  <characteristics id="4" kee="PORTABILITY_COMPLIANCE" name="Portability Compliance" parent_id="3"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
 
-  <characteristics id="5" kee="MAINTAINABILITY" name="Maintainability" parent_id="[null]" characteristic_order="3" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
-  <characteristics id="6" kee="MAINTAINABILITY_COMPLIANCE" name="Maintainability Compliance" parent_id="5" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+  <characteristics id="5" kee="MAINTAINABILITY" name="Maintainability" parent_id="[null]"  rule_id="[null]" characteristic_order="3" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+  <characteristics id="6" kee="MAINTAINABILITY_COMPLIANCE" name="Maintainability Compliance" parent_id="5"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
 
-  <characteristics id="7" kee="SECURITY" name="Security" parent_id="[null]" characteristic_order="4" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
-  <characteristics id="8" kee="SECURITY_COMPLIANCE" name="Security Compliance" parent_id="7" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+  <characteristics id="7" kee="SECURITY" name="Security" parent_id="[null]"  rule_id="[null]" characteristic_order="4" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+  <characteristics id="8" kee="SECURITY_COMPLIANCE" name="Security Compliance" parent_id="7"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
 
-  <characteristics id="9" kee="USABILITY" name="Usability" parent_id="[null]" characteristic_order="5" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
-  <characteristics id="10" kee="USABILITY_ACCESSIBILITY" name="Accessibility" parent_id="9" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
-  <characteristics id="11" kee="USABILITY_EASE_OF_USE" name="Ease of Use" parent_id="9" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
-  <characteristics id="12" kee="USABILITY_COMPLIANCE" name="Usability Compliance" parent_id="9" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+  <characteristics id="9" kee="USABILITY" name="Usability" parent_id="[null]"  rule_id="[null]" characteristic_order="5" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+  <characteristics id="10" kee="USABILITY_ACCESSIBILITY" name="Accessibility" parent_id="9"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+  <characteristics id="11" kee="USABILITY_EASE_OF_USE" name="Ease of Use" parent_id="9"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+  <characteristics id="12" kee="USABILITY_COMPLIANCE" name="Usability Compliance" parent_id="9"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
 
-  <characteristics id="13" kee="EFFICIENCY" name="Efficiency" parent_id="[null]" characteristic_order="6" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-20"/>
-  <characteristics id="14" kee="EFFICIENCY_COMPLIANCE" name="Efficiency Compliance" parent_id="13" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+  <characteristics id="13" kee="EFFICIENCY" name="Efficiency" parent_id="[null]"  rule_id="[null]" characteristic_order="6" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-20"/>
+  <characteristics id="14" kee="EFFICIENCY_COMPLIANCE" name="Efficiency Compliance" parent_id="13"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
 
-  <characteristics id="15" kee="CHANGEABILITY" name="Changeability" parent_id="[null]" characteristic_order="7" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-20"/>
-  <characteristics id="16" kee="CHANGEABILITY_COMPLIANCE" name="Changeability Compliance" parent_id="15" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+  <characteristics id="15" kee="CHANGEABILITY" name="Changeability" parent_id="[null]"  rule_id="[null]" characteristic_order="7" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-20"/>
+  <characteristics id="16" kee="CHANGEABILITY_COMPLIANCE" name="Changeability Compliance" parent_id="15"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
 
-  <characteristics id="17" kee="RELIABILITY" name="Reliability" parent_id="[null]" characteristic_order="8" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-20"/>
-  <characteristics id="18" kee="RELIABILITY_COMPLIANCE" name="Reliability Compliance" parent_id="17" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+  <characteristics id="17" kee="RELIABILITY" name="Reliability" parent_id="[null]"  rule_id="[null]" characteristic_order="8" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-20"/>
+  <characteristics id="18" kee="RELIABILITY_COMPLIANCE" name="Reliability Compliance" parent_id="17"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
 
-  <characteristics id="19" kee="TESTABILITY" name="Testability" parent_id="[null]" characteristic_order="9" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-20"/>
-  <characteristics id="20" kee="TESTABILITY_COMPLIANCE" name="Testability Compliance" parent_id="19" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+  <characteristics id="19" kee="TESTABILITY" name="Testability" parent_id="[null]"  rule_id="[null]" characteristic_order="9" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-20"/>
+  <characteristics id="20" kee="TESTABILITY_COMPLIANCE" name="Testability Compliance" parent_id="19"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
 
 
 </dataset>
index 337697d4bae17b52f31351ef24bc5ece7f0b5cbe..67ce53d954632d8001247ae8308652207e4401dc 100644 (file)
@@ -1,7 +1,7 @@
 <dataset>
 
-  <characteristics id="1" kee="REUSABILITY" name="Reusability" parent_id="[null]" characteristic_order="1" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+  <characteristics id="1" kee="REUSABILITY" name="Reusability" parent_id="[null]"  rule_id="[null]" characteristic_order="1" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
 
-  <characteristics id="2" kee="REUSABILITY_COMPLIANCE" name="Compliance" parent_id="[null]" characteristic_order="2" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+  <characteristics id="2" kee="REUSABILITY_COMPLIANCE" name="Compliance" parent_id="[null]"  rule_id="[null]" characteristic_order="2" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
 
 </dataset>
index a74b887e3b383476e5807bfc31e06e083628666f..aa6ec05c20cc1fcf993fac79a6af75ef16398d77 100644 (file)
@@ -1,9 +1,9 @@
 <dataset>
 
-  <characteristics id="1" kee="REUSABILITY" name="Reusability" parent_id="[null]" characteristic_order="1" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+  <characteristics id="1" kee="REUSABILITY" name="Reusability" parent_id="[null]"  rule_id="[null]" characteristic_order="1" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
 
-  <characteristics id="2" kee="PORTABILITY" name="Portability" parent_id="[null]" characteristic_order="2" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+  <characteristics id="2" kee="PORTABILITY" name="Portability" parent_id="[null]"  rule_id="[null]" characteristic_order="2" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
 
-  <characteristics id="3" kee="REUSABILITY_COMPLIANCE" name="Reusability Compliance" parent_id="2" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+  <characteristics id="3" kee="REUSABILITY_COMPLIANCE" name="Reusability Compliance" parent_id="2"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
 
 </dataset>
index 18cb033a7eb2254a5df665e902142cb76fa258bb..87c0da646dce34601b094d365b32a016ccddda1c 100644 (file)
@@ -1,7 +1,7 @@
 <dataset>
 
-  <characteristics id="1" kee="REUSABILITY" name="Reusability" parent_id="[null]" characteristic_order="1" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+  <characteristics id="1" kee="REUSABILITY" name="Reusability" parent_id="[null]"  rule_id="[null]" characteristic_order="1" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
 
-  <characteristics id="2" kee="USABILITY" name="Usability" parent_id="1" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+  <characteristics id="2" kee="USABILITY" name="Usability" parent_id="1"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
 
 </dataset>
index 0de66a6749d27a13deef16a6bd3dc648ff072e31..b80cffd2fa725eb247acdf7633ff21c446e39457 100644 (file)
@@ -1,22 +1,22 @@
 <dataset>
 
   <!-- Oder has changed : this characteristic is now one step lower -->
-  <characteristics id="1" kee="REUSABILITY" name="Reusability" parent_id="[null]" characteristic_order="2" enabled="[true]" created_at="2013-11-20" updated_at="2015-02-15"/>
+  <characteristics id="1" kee="REUSABILITY" name="Reusability" parent_id="[null]"  rule_id="[null]" characteristic_order="2" enabled="[true]" created_at="2013-11-20" updated_at="2015-02-15"/>
 
   <!-- Oder has changed : this characteristic is now one step lower -->
-  <characteristics id="2" kee="PORTABILITY" name="Portability" parent_id="[null]" characteristic_order="3" enabled="[true]" created_at="2013-11-20" updated_at="2015-02-15"/>
+  <characteristics id="2" kee="PORTABILITY" name="Portability" parent_id="[null]"  rule_id="[null]" characteristic_order="3" enabled="[true]" created_at="2013-11-20" updated_at="2015-02-15"/>
 
   <!-- New characteristic 'Usability' is on the top (order 1) -->
-  <characteristics id="3" kee="USABILITY" name="Usability" parent_id="[null]" characteristic_order="1" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
-  <characteristics id="4" kee="USABILITY_ACCESSIBILITY" name="Accessibility" parent_id="3" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
-  <characteristics id="5" kee="USABILITY_EASE_OF_USE" name="Ease of Use" parent_id="3" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
-  <characteristics id="6" kee="USABILITY_COMPLIANCE" name="Usability Compliance" parent_id="3" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+  <characteristics id="3" kee="USABILITY" name="Usability" parent_id="[null]"  rule_id="[null]" characteristic_order="1" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+  <characteristics id="4" kee="USABILITY_ACCESSIBILITY" name="Accessibility" parent_id="3"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+  <characteristics id="5" kee="USABILITY_EASE_OF_USE" name="Ease of Use" parent_id="3"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+  <characteristics id="6" kee="USABILITY_COMPLIANCE" name="Usability Compliance" parent_id="3"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
 
 
   <!-- New sub characteristic 'Compliance' under Reusability -->
-  <characteristics id="7" kee="REUSABILITY_COMPLIANCE" name="Reusability Compliance" parent_id="1" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+  <characteristics id="7" kee="REUSABILITY_COMPLIANCE" name="Reusability Compliance" parent_id="1"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
 
   <!-- New sub characteristic 'Compliance' under Portability -->
-  <characteristics id="8" kee="PORTABILITY_COMPLIANCE" name="Portability Compliance" parent_id="2" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+  <characteristics id="8" kee="PORTABILITY_COMPLIANCE" name="Portability Compliance" parent_id="2"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
 
 </dataset>
index 1ce991c6bfff0b5305dbc0fbc40aa63f8029007c..98744dc4592bb95779bdd57b7029a2670cce278f 100644 (file)
@@ -1,7 +1,7 @@
 <dataset>
 
-  <characteristics id="1" kee="REUSABILITY" name="Reusability" parent_id="[null]" characteristic_order="1" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+  <characteristics id="1" kee="REUSABILITY" name="Reusability" parent_id="[null]"  rule_id="[null]" characteristic_order="1" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
 
-  <characteristics id="2" kee="PORTABILITY" name="Portability" parent_id="[null]" characteristic_order="2" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+  <characteristics id="2" kee="PORTABILITY" name="Portability" parent_id="[null]"  rule_id="[null]" characteristic_order="2" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
 
 </dataset>
index f0646db4c6941d45aab4110434d4e9707b96483b..b43476e0b26f7ed7733ae0b273f99f493aaa8ffa 100644 (file)
@@ -1,54 +1,54 @@
 <dataset>
 
-  <characteristics id="1" kee="REUSABILITY" name="Reusability" parent_id="[null]" characteristic_order="1" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+  <characteristics id="1" kee="REUSABILITY" name="Reusability" parent_id="[null]"  rule_id="[null]" characteristic_order="1" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
 
-  <characteristics id="2" kee="PORTABILITY" name="Portability" parent_id="[null]" characteristic_order="2" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+  <characteristics id="2" kee="PORTABILITY" name="Portability" parent_id="[null]"  rule_id="[null]" characteristic_order="2" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
 
-  <characteristics id="3" kee="MAINTAINABILITY" name="Maintainability" parent_id="[null]" characteristic_order="3" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+  <characteristics id="3" kee="MAINTAINABILITY" name="Maintainability" parent_id="[null]"  rule_id="[null]" characteristic_order="3" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
 
-  <characteristics id="4" kee="SECURITY" name="Security" parent_id="[null]" characteristic_order="4" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+  <characteristics id="4" kee="SECURITY" name="Security" parent_id="[null]"  rule_id="[null]" characteristic_order="4" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
 
   <!-- Oder has changed : this characteristic is now one step lower -->
-  <characteristics id="5" kee="EFFICIENCY" name="Efficiency" parent_id="[null]" characteristic_order="6" enabled="[true]" created_at="2013-11-20" updated_at="2015-02-15"/>
+  <characteristics id="5" kee="EFFICIENCY" name="Efficiency" parent_id="[null]"  rule_id="[null]" characteristic_order="6" enabled="[true]" created_at="2013-11-20" updated_at="2015-02-15"/>
 
   <!-- Oder has changed : this characteristic is now one step lower -->
-  <characteristics id="6" kee="CHANGEABILITY" name="Changeability" parent_id="[null]" characteristic_order="7" enabled="[true]" created_at="2013-11-20" updated_at="2015-02-15"/>
+  <characteristics id="6" kee="CHANGEABILITY" name="Changeability" parent_id="[null]"  rule_id="[null]" characteristic_order="7" enabled="[true]" created_at="2013-11-20" updated_at="2015-02-15"/>
 
   <!-- Oder has changed : this characteristic is now one step lower -->
-  <characteristics id="7" kee="RELIABILITY" name="Reliability" parent_id="[null]" characteristic_order="8" enabled="[true]" created_at="2013-11-20" updated_at="2015-02-15"/>
+  <characteristics id="7" kee="RELIABILITY" name="Reliability" parent_id="[null]"  rule_id="[null]" characteristic_order="8" enabled="[true]" created_at="2013-11-20" updated_at="2015-02-15"/>
 
   <!-- Oder has changed : this characteristic is now one step lower -->
-  <characteristics id="8" kee="TESTABILITY" name="Testability" parent_id="[null]" characteristic_order="9" enabled="[true]" created_at="2013-11-20" updated_at="2015-02-15"/>
+  <characteristics id="8" kee="TESTABILITY" name="Testability" parent_id="[null]"  rule_id="[null]" characteristic_order="9" enabled="[true]" created_at="2013-11-20" updated_at="2015-02-15"/>
 
   <!-- New characteristic 'Usability' is after Security -->
-  <characteristics id="9" kee="USABILITY" name="Usability" parent_id="[null]" characteristic_order="5" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+  <characteristics id="9" kee="USABILITY" name="Usability" parent_id="[null]"  rule_id="[null]" characteristic_order="5" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
   <!-- New sub characteristics under Usability -->
-  <characteristics id="10" kee="USABILITY_ACCESSIBILITY" name="Accessibility" parent_id="9" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
-  <characteristics id="11" kee="USABILITY_EASE_OF_USE" name="Ease of Use" parent_id="9" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
-  <characteristics id="12" kee="USABILITY_COMPLIANCE" name="Usability Compliance" parent_id="9" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+  <characteristics id="10" kee="USABILITY_ACCESSIBILITY" name="Accessibility" parent_id="9"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+  <characteristics id="11" kee="USABILITY_EASE_OF_USE" name="Ease of Use" parent_id="9"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+  <characteristics id="12" kee="USABILITY_COMPLIANCE" name="Usability Compliance" parent_id="9"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
 
   <!-- New sub characteristic 'Compliance' under Reusability -->
-  <characteristics id="13" kee="REUSABILITY_COMPLIANCE" name="Reusability Compliance" parent_id="1" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+  <characteristics id="13" kee="REUSABILITY_COMPLIANCE" name="Reusability Compliance" parent_id="1"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
 
   <!-- New sub characteristic 'Compliance' under Portability -->
-  <characteristics id="14" kee="PORTABILITY_COMPLIANCE" name="Portability Compliance" parent_id="2" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+  <characteristics id="14" kee="PORTABILITY_COMPLIANCE" name="Portability Compliance" parent_id="2"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
 
   <!-- New sub characteristic 'Compliance' under Maintainability -->
-  <characteristics id="15" kee="MAINTAINABILITY_COMPLIANCE" name="Maintainability Compliance" parent_id="3" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+  <characteristics id="15" kee="MAINTAINABILITY_COMPLIANCE" name="Maintainability Compliance" parent_id="3"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
 
   <!-- New sub characteristic 'Compliance' under Security -->
-  <characteristics id="16" kee="SECURITY_COMPLIANCE" name="Security Compliance" parent_id="4" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+  <characteristics id="16" kee="SECURITY_COMPLIANCE" name="Security Compliance" parent_id="4"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
 
   <!-- New sub characteristic 'Compliance' under Efficiency -->
-  <characteristics id="17" kee="EFFICIENCY_COMPLIANCE" name="Efficiency Compliance" parent_id="5" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+  <characteristics id="17" kee="EFFICIENCY_COMPLIANCE" name="Efficiency Compliance" parent_id="5"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
 
   <!-- New sub characteristic 'Compliance' under Changeability -->
-  <characteristics id="18" kee="CHANGEABILITY_COMPLIANCE" name="Changeability Compliance" parent_id="6" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+  <characteristics id="18" kee="CHANGEABILITY_COMPLIANCE" name="Changeability Compliance" parent_id="6"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
 
   <!-- New sub characteristic 'Compliance' under Reliability -->
-  <characteristics id="19" kee="RELIABILITY_COMPLIANCE" name="Reliability Compliance" parent_id="7" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+  <characteristics id="19" kee="RELIABILITY_COMPLIANCE" name="Reliability Compliance" parent_id="7"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
 
   <!-- New sub characteristic 'Compliance' under Testability -->
-  <characteristics id="20" kee="TESTABILITY_COMPLIANCE" name="Testability Compliance" parent_id="8" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+  <characteristics id="20" kee="TESTABILITY_COMPLIANCE" name="Testability Compliance" parent_id="8"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
 
 </dataset>
index b10cbbfadbe64dc6a0abc6c152c79ffb7b11f9f7..392b0da830b14180d78fc64c8d98a1af88fa5a20 100644 (file)
@@ -1,19 +1,19 @@
 <dataset>
 
-  <characteristics id="1" kee="REUSABILITY" name="Reusability" parent_id="[null]" characteristic_order="1" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+  <characteristics id="1" kee="REUSABILITY" name="Reusability" parent_id="[null]"  rule_id="[null]" characteristic_order="1" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
 
-  <characteristics id="2" kee="PORTABILITY" name="Portability" parent_id="[null]" characteristic_order="2" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+  <characteristics id="2" kee="PORTABILITY" name="Portability" parent_id="[null]"  rule_id="[null]" characteristic_order="2" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
 
-  <characteristics id="3" kee="MAINTAINABILITY" name="Maintainability" parent_id="[null]" characteristic_order="3" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+  <characteristics id="3" kee="MAINTAINABILITY" name="Maintainability" parent_id="[null]"  rule_id="[null]" characteristic_order="3" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
 
-  <characteristics id="4" kee="SECURITY" name="Security" parent_id="[null]" characteristic_order="4" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+  <characteristics id="4" kee="SECURITY" name="Security" parent_id="[null]"  rule_id="[null]" characteristic_order="4" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
 
-  <characteristics id="5" kee="EFFICIENCY" name="Efficiency" parent_id="[null]" characteristic_order="5" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+  <characteristics id="5" kee="EFFICIENCY" name="Efficiency" parent_id="[null]"  rule_id="[null]" characteristic_order="5" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
 
-  <characteristics id="6" kee="CHANGEABILITY" name="Changeability" parent_id="[null]" characteristic_order="6" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+  <characteristics id="6" kee="CHANGEABILITY" name="Changeability" parent_id="[null]"  rule_id="[null]" characteristic_order="6" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
 
-  <characteristics id="7" kee="RELIABILITY" name="Reliability" parent_id="[null]" characteristic_order="7" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+  <characteristics id="7" kee="RELIABILITY" name="Reliability" parent_id="[null]"  rule_id="[null]" characteristic_order="7" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
 
-  <characteristics id="8" kee="TESTABILITY" name="Testability" parent_id="[null]" characteristic_order="8" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+  <characteristics id="8" kee="TESTABILITY" name="Testability" parent_id="[null]"  rule_id="[null]" characteristic_order="8" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
 
 </dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v453/AddCharacteristicUsabilityAndSubCharacteristicsComplianceMigrationTest/not_fail_if_some_deprecated_requirements_still_exists_in_db.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v453/AddCharacteristicUsabilityAndSubCharacteristicsComplianceMigrationTest/not_fail_if_some_deprecated_requirements_still_exists_in_db.xml
new file mode 100644 (file)
index 0000000..2e24ebc
--- /dev/null
@@ -0,0 +1,10 @@
+<dataset>
+
+  <characteristics id="1" kee="USABILITY" name="Usability" parent_id="[null]" rule_id="[null]" characteristic_order="1" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+  <characteristics id="2" kee="USABILITY_ACCESSIBILITY" name="Accessibility" parent_id="1" rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+  <characteristics id="3" kee="USABILITY_EASE_OF_USE" name="Ease of Use" parent_id="1" rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+  <characteristics id="4" kee="USABILITY_COMPLIANCE" name="Usability Compliance" parent_id="1" rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+
+  <characteristics id="5" kee="[null]" name="[null]" parent_id="3" rule_id="3" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+
+</dataset>
index c03ad0246dfd88befbfbe495dce2f9cc53574ad5..0aad220894009634f5f309e27a898cad8a06394e 100644 (file)
@@ -1,22 +1,22 @@
 <dataset>
 
-  <characteristics id="1" kee="SECURITY" name="Security" parent_id="[null]" characteristic_order="4" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+  <characteristics id="1" kee="SECURITY" name="Security" parent_id="[null]"  rule_id="[null]" characteristic_order="4" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
 
   <!-- Oder has changed : this characteristic is now one step lower -->
-  <characteristics id="2" kee="EFFICIENCY" name="Efficiency" parent_id="[null]" characteristic_order="6" enabled="[true]" created_at="2013-11-20" updated_at="2015-02-15"/>
+  <characteristics id="2" kee="EFFICIENCY" name="Efficiency" parent_id="[null]"  rule_id="[null]" characteristic_order="6" enabled="[true]" created_at="2013-11-20" updated_at="2015-02-15"/>
 
   <!-- Usability is moved after Security -->
-  <characteristics id="3" kee="USABILITY" name="Usability" parent_id="[null]" characteristic_order="5" enabled="[true]" created_at="2013-11-20" updated_at="2015-02-15"/>
+  <characteristics id="3" kee="USABILITY" name="Usability" parent_id="[null]"  rule_id="[null]" characteristic_order="5" enabled="[true]" created_at="2013-11-20" updated_at="2015-02-15"/>
 
   <!-- New sub characteristics under Usability -->
-  <characteristics id="4" kee="USABILITY_ACCESSIBILITY" name="Accessibility" parent_id="3" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
-  <characteristics id="5" kee="USABILITY_EASE_OF_USE" name="Ease of Use" parent_id="3" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
-  <characteristics id="6" kee="USABILITY_COMPLIANCE" name="Usability Compliance" parent_id="3" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+  <characteristics id="4" kee="USABILITY_ACCESSIBILITY" name="Accessibility" parent_id="3"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+  <characteristics id="5" kee="USABILITY_EASE_OF_USE" name="Ease of Use" parent_id="3"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+  <characteristics id="6" kee="USABILITY_COMPLIANCE" name="Usability Compliance" parent_id="3"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
 
   <!-- New sub characteristic 'Compliance' under Security -->
-  <characteristics id="7" kee="SECURITY_COMPLIANCE" name="Security Compliance" parent_id="1" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+  <characteristics id="7" kee="SECURITY_COMPLIANCE" name="Security Compliance" parent_id="1"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
 
   <!-- New sub characteristic 'Compliance' under Efficiency -->
-  <characteristics id="8" kee="EFFICIENCY_COMPLIANCE" name="Efficiency Compliance" parent_id="2" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+  <characteristics id="8" kee="EFFICIENCY_COMPLIANCE" name="Efficiency Compliance" parent_id="2"  rule_id="[null]" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
 
 </dataset>
index 053038789139f3d09532ff7a8fd59f2fa8bdf328..98c8d4069015e28dfec557503c32c146c351b5cb 100644 (file)
@@ -1,10 +1,10 @@
 <dataset>
 
-  <characteristics id="1" kee="SECURITY" name="Security" parent_id="[null]" characteristic_order="4" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+  <characteristics id="1" kee="SECURITY" name="Security" parent_id="[null]"  rule_id="[null]" characteristic_order="4" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
 
-  <characteristics id="2" kee="EFFICIENCY" name="Efficiency" parent_id="[null]" characteristic_order="5" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+  <characteristics id="2" kee="EFFICIENCY" name="Efficiency" parent_id="[null]"  rule_id="[null]" characteristic_order="5" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
 
   <!-- Usability should be move after Security -->
-  <characteristics id="3" kee="USABILITY" name="Usability" parent_id="[null]" characteristic_order="6" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+  <characteristics id="3" kee="USABILITY" name="Usability" parent_id="[null]"  rule_id="[null]" characteristic_order="6" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
 
 </dataset>