]> source.dussan.org Git - sonarqube.git/commitdiff
Fix quality flaws
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 23 Apr 2015 11:55:35 +0000 (13:55 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 23 Apr 2015 11:55:35 +0000 (13:55 +0200)
65 files changed:
server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStep.java
server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest.java [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationTest.java [deleted file]
server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest.java [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationTest.java [deleted file]
server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest.java [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/IssueChangelogMigrationTest.java [deleted file]
server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest.java [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationTest.java [deleted file]
server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest.java [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationTest.java [deleted file]
server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest.java [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest.java [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/migrate_issues_debt.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/migrate_issues_debt_result.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/schema.sql [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationTest/migrate_issues_debt.xml [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationTest/migrate_issues_debt_result.xml [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationTest/schema.sql [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/metric_does_not_exist.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/metric_does_not_exist_result.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/migrate_dev_cost_measures.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/migrate_dev_cost_measures_result.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/schema.sql [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationTest/metric_does_not_exist.xml [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationTest/metric_does_not_exist_result.xml [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationTest/migrate_dev_cost_measures.xml [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationTest/migrate_dev_cost_measures_result.xml [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationTest/schema.sql [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest/migrate_issue_changelog_debt.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest/migrate_issue_changelog_debt_result.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest/schema.sql [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationTest/migrate_issue_changelog_debt.xml [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationTest/migrate_issue_changelog_debt_result.xml [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationTest/schema.sql [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/migrate_issues.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/migrate_issues_result.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/schema.sql [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationTest/migrate_issues.xml [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationTest/migrate_issues_result.xml [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationTest/schema.sql [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest/migrate_measures_on_requirements.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest/migrate_measures_on_requirements_result.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest/schema.sql [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationTest/migrate_measures_on_requirements.xml [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationTest/migrate_measures_on_requirements_result.xml [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationTest/schema.sql [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_new_technical_debt_measures.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_new_technical_debt_measures_result.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_nothing.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_nothing_result.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_sqale_measures.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_sqale_measures_result.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_technical_debt_measures.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_technical_debt_measures_result.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/schema.sql [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_new_technical_debt_measures.xml [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_new_technical_debt_measures_result.xml [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_nothing.xml [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_nothing_result.xml [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_sqale_measures.xml [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_sqale_measures_result.xml [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_technical_debt_measures.xml [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_technical_debt_measures_result.xml [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/schema.sql [deleted file]

index 3f0ef33b29b7015732ecef59f94a8112faa599fd..6b2142ddc79a310aa057e59b3f6543877b00460e 100644 (file)
 
 package org.sonar.server.db.migrations.v43;
 
-import java.sql.SQLException;
-
-import javax.annotation.CheckForNull;
-
 import org.sonar.core.persistence.Database;
 import org.sonar.core.properties.PropertiesDao;
 import org.sonar.server.db.migrations.BaseDataChange;
@@ -31,6 +27,10 @@ import org.sonar.server.db.migrations.MassUpdate;
 import org.sonar.server.db.migrations.Select;
 import org.sonar.server.db.migrations.SqlStatement;
 
+import javax.annotation.CheckForNull;
+
+import java.sql.SQLException;
+
 /**
  * Used in the Active Record Migration 516
  *
@@ -57,8 +57,8 @@ public class DevelopmentCostMeasuresMigrationStep extends BaseDataChange {
       massUpdate.execute(new MassUpdate.Handler() {
         @Override
         public boolean handle(Select.Row row, SqlStatement update) throws SQLException {
-          Long id = row.getNullableLong(1);
-          Double value = row.getNullableDouble(2);
+          Long id = row.getLong(1);
+          Double value = row.getDouble(2);
 
           update.setString(1, convertDebtForDays(value));
           update.setLong(2, id);
diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest.java
new file mode 100644 (file)
index 0000000..9ec7e53
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube 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.
+ *
+ * SonarQube 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.db.migrations.v43;
+
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.sonar.api.utils.DateUtils;
+import org.sonar.api.utils.System2;
+import org.sonar.core.persistence.DbTester;
+import org.sonar.core.properties.PropertiesDao;
+import org.sonar.core.properties.PropertyDto;
+
+import java.util.List;
+import java.util.Map;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.when;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ConvertIssueDebtToMinutesMigrationStepTest {
+
+  @ClassRule
+  public static DbTester db = new DbTester().schema(ConvertIssueDebtToMinutesMigrationStepTest.class, "schema.sql");
+
+  @Mock
+  System2 system2;
+
+  @Mock
+  PropertiesDao propertiesDao;
+
+  ConvertIssueDebtToMinutesMigrationStep migration;
+
+  @Before
+  public void setUp() throws Exception {
+    when(system2.now()).thenReturn(DateUtils.parseDateTime("2014-02-19T19:10:03+0100").getTime());
+    when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue("8"));
+
+    migration = new ConvertIssueDebtToMinutesMigrationStep(db.database(), propertiesDao, system2);
+  }
+
+  @Test
+  public void migrate_issues_debt() throws Exception {
+    db.prepareDbUnit(getClass(), "migrate_issues_debt.xml");
+
+    migration.execute();
+
+    db.assertDbUnit(getClass(), "migrate_issues_debt_result.xml", new String[] {"updated_at"}, "issues");
+
+    // Check only updated_at columns values, but we could also remove db unit file and check all fields
+    List<Map<String, Object>> results = db.select("select updated_at as \"updatedAt\" from issues");
+    assertThat(results).hasSize(5);
+    assertThat(results.get(0).get("updatedAt").toString()).startsWith("2014");
+    assertThat(results.get(1).get("updatedAt").toString()).startsWith("2014");
+    assertThat(results.get(2).get("updatedAt").toString()).startsWith("2014");
+    assertThat(results.get(3).get("updatedAt").toString()).startsWith("2014");
+    // Not updated because no debt
+    assertThat(results.get(4).get("updatedAt").toString()).startsWith("2012");
+  }
+
+}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationTest.java
deleted file mode 100644 (file)
index 2e75519..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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.db.migrations.v43;
-
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.sonar.api.utils.DateUtils;
-import org.sonar.api.utils.System2;
-import org.sonar.core.persistence.DbTester;
-import org.sonar.core.properties.PropertiesDao;
-import org.sonar.core.properties.PropertyDto;
-
-import java.util.List;
-import java.util.Map;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.when;
-
-@RunWith(MockitoJUnitRunner.class)
-public class ConvertIssueDebtToMinutesMigrationTest {
-
-  @ClassRule
-  public static DbTester db = new DbTester().schema(ConvertIssueDebtToMinutesMigrationTest.class, "schema.sql");
-
-  @Mock
-  System2 system2;
-
-  @Mock
-  PropertiesDao propertiesDao;
-
-  ConvertIssueDebtToMinutesMigrationStep migration;
-
-  @Before
-  public void setUp() throws Exception {
-    when(system2.now()).thenReturn(DateUtils.parseDateTime("2014-02-19T19:10:03+0100").getTime());
-    when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue("8"));
-
-    migration = new ConvertIssueDebtToMinutesMigrationStep(db.database(), propertiesDao, system2);
-  }
-
-  @Test
-  public void migrate_issues_debt() throws Exception {
-    db.prepareDbUnit(getClass(), "migrate_issues_debt.xml");
-
-    migration.execute();
-
-    db.assertDbUnit(getClass(), "migrate_issues_debt_result.xml", new String[] {"updated_at"}, "issues");
-
-    // Check only updated_at columns values, but we could also remove db unit file and check all fields
-    List<Map<String, Object>> results = db.select("select updated_at as \"updatedAt\" from issues");
-    assertThat(results).hasSize(5);
-    assertThat(results.get(0).get("updatedAt").toString()).startsWith("2014");
-    assertThat(results.get(1).get("updatedAt").toString()).startsWith("2014");
-    assertThat(results.get(2).get("updatedAt").toString()).startsWith("2014");
-    assertThat(results.get(3).get("updatedAt").toString()).startsWith("2014");
-    // Not updated because no debt
-    assertThat(results.get(4).get("updatedAt").toString()).startsWith("2012");
-  }
-
-}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest.java
new file mode 100644 (file)
index 0000000..f92e48e
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube 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.
+ *
+ * SonarQube 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.db.migrations.v43;
+
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.sonar.core.persistence.DbTester;
+import org.sonar.core.properties.PropertiesDao;
+import org.sonar.core.properties.PropertyDto;
+
+import static org.mockito.Mockito.when;
+
+@RunWith(MockitoJUnitRunner.class)
+public class DevelopmentCostMeasuresMigrationStepTest {
+
+  @ClassRule
+  public static DbTester db = new DbTester().schema(DevelopmentCostMeasuresMigrationStepTest.class, "schema.sql");
+
+  @Mock
+  PropertiesDao propertiesDao;
+
+  DevelopmentCostMeasuresMigrationStep migration;
+
+  @Before
+  public void setUp() throws Exception {
+    when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue("8"));
+
+    migration = new DevelopmentCostMeasuresMigrationStep(db.database(), propertiesDao);
+  }
+
+  @Test
+  public void migrate_dev_cost_measures() throws Exception {
+    db.prepareDbUnit(getClass(), "migrate_dev_cost_measures.xml");
+
+    migration.execute();
+
+    db.assertDbUnit(getClass(), "migrate_dev_cost_measures_result.xml", "project_measures");
+  }
+
+  @Test
+  public void metric_does_not_exist() throws Exception {
+    db.prepareDbUnit(getClass(), "metric_does_not_exist.xml");
+
+    migration.execute();
+
+    db.assertDbUnit(getClass(), "metric_does_not_exist_result.xml", "project_measures");
+  }
+}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationTest.java
deleted file mode 100644 (file)
index d96c8e8..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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.db.migrations.v43;
-
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.sonar.core.persistence.DbTester;
-import org.sonar.core.properties.PropertiesDao;
-import org.sonar.core.properties.PropertyDto;
-
-import static org.mockito.Mockito.when;
-
-@RunWith(MockitoJUnitRunner.class)
-public class DevelopmentCostMeasuresMigrationTest {
-
-  @ClassRule
-  public static DbTester db = new DbTester().schema(DevelopmentCostMeasuresMigrationTest.class, "schema.sql");
-
-  @Mock
-  PropertiesDao propertiesDao;
-
-  DevelopmentCostMeasuresMigrationStep migration;
-
-  @Before
-  public void setUp() throws Exception {
-    when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue("8"));
-
-    migration = new DevelopmentCostMeasuresMigrationStep(db.database(), propertiesDao);
-  }
-
-  @Test
-  public void migrate_dev_cost_measures() throws Exception {
-    db.prepareDbUnit(getClass(), "migrate_dev_cost_measures.xml");
-
-    migration.execute();
-
-    db.assertDbUnit(getClass(), "migrate_dev_cost_measures_result.xml", "project_measures");
-  }
-
-  @Test
-  public void metric_does_not_exist() throws Exception {
-    db.prepareDbUnit(getClass(), "metric_does_not_exist.xml");
-
-    migration.execute();
-
-    db.assertDbUnit(getClass(), "metric_does_not_exist_result.xml", "project_measures");
-  }
-}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest.java
new file mode 100644 (file)
index 0000000..1f8e3e2
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube 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.
+ *
+ * SonarQube 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.db.migrations.v43;
+
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.sonar.api.utils.DateUtils;
+import org.sonar.api.utils.System2;
+import org.sonar.core.persistence.DbTester;
+import org.sonar.core.properties.PropertiesDao;
+import org.sonar.core.properties.PropertyDto;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.when;
+
+@RunWith(MockitoJUnitRunner.class)
+public class IssueChangelogMigrationStepTest {
+
+  @ClassRule
+  public static DbTester db = new DbTester().schema(IssueChangelogMigrationStepTest.class, "schema.sql");
+
+  @Mock
+  System2 system2;
+
+  @Mock
+  PropertiesDao propertiesDao;
+
+  IssueChangelogMigrationStep migration;
+
+  @Before
+  public void setUp() throws Exception {
+    when(system2.now()).thenReturn(DateUtils.parseDateTime("2014-02-19T19:10:03+0100").getTime());
+    when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue("8"));
+
+    WorkDurationConvertor convertor = new WorkDurationConvertor(propertiesDao);
+    convertor.init();
+    migration = new IssueChangelogMigrationStep(db.database(), system2, convertor);
+  }
+
+  @Test
+  public void migrate_issue_changelog_debt() throws Exception {
+    db.prepareDbUnit(getClass(), "migrate_issue_changelog_debt.xml");
+
+    migration.execute();
+
+    db.assertDbUnit(getClass(), "migrate_issue_changelog_debt_result.xml", new String[]{"updated_at"}, "issue_changes");
+  }
+
+  @Test
+  public void convert_data_containing_only_debt_change() throws Exception {
+    assertThat(migration.convertChangelog("technicalDebt=1|2")).isEqualTo("technicalDebt=1|2");
+    assertThat(migration.convertChangelog("technicalDebt=100|200")).isEqualTo("technicalDebt=60|120");
+    assertThat(migration.convertChangelog("technicalDebt=10000|20000")).isEqualTo("technicalDebt=480|960");
+
+    assertThat(migration.convertChangelog("technicalDebt=|2")).isEqualTo("technicalDebt=|2");
+    assertThat(migration.convertChangelog("technicalDebt=1|")).isEqualTo("technicalDebt=1|");
+  }
+
+  @Test
+  public void convert_data_beginning_with_debt_change() throws Exception {
+    assertThat(migration.convertChangelog("technicalDebt=100|200,status=RESOLVED|REOPENED")).isEqualTo("technicalDebt=60|120,status=RESOLVED|REOPENED");
+    assertThat(migration.convertChangelog("technicalDebt=|200,status=RESOLVED|REOPENED")).isEqualTo("technicalDebt=|120,status=RESOLVED|REOPENED");
+    assertThat(migration.convertChangelog("technicalDebt=100|,status=RESOLVED|REOPENED")).isEqualTo("technicalDebt=60|,status=RESOLVED|REOPENED");
+  }
+
+  @Test
+  public void convert_data_finishing_with_debt_change() throws Exception {
+    assertThat(migration.convertChangelog("status=RESOLVED|REOPENED,technicalDebt=100|200")).isEqualTo("status=RESOLVED|REOPENED,technicalDebt=60|120");
+    assertThat(migration.convertChangelog("status=RESOLVED|REOPENED,technicalDebt=|200")).isEqualTo("status=RESOLVED|REOPENED,technicalDebt=|120");
+    assertThat(migration.convertChangelog("status=RESOLVED|REOPENED,technicalDebt=100|")).isEqualTo("status=RESOLVED|REOPENED,technicalDebt=60|");
+  }
+
+  @Test
+  public void convert_data_with_debt_change_in_the_middle() throws Exception {
+    assertThat(migration.convertChangelog("status=RESOLVED|REOPENED,technicalDebt=100|200,resolution=")).isEqualTo("status=RESOLVED|REOPENED,technicalDebt=60|120,resolution=");
+    assertThat(migration.convertChangelog("status=RESOLVED|REOPENED,technicalDebt=|200,resolution=")).isEqualTo("status=RESOLVED|REOPENED,technicalDebt=|120,resolution=");
+    assertThat(migration.convertChangelog("status=RESOLVED|REOPENED,technicalDebt=100|,resolution=")).isEqualTo("status=RESOLVED|REOPENED,technicalDebt=60|,resolution=");
+  }
+}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/IssueChangelogMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/IssueChangelogMigrationTest.java
deleted file mode 100644 (file)
index 18f2106..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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.db.migrations.v43;
-
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.sonar.api.utils.DateUtils;
-import org.sonar.api.utils.System2;
-import org.sonar.core.persistence.DbTester;
-import org.sonar.core.properties.PropertiesDao;
-import org.sonar.core.properties.PropertyDto;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.when;
-
-@RunWith(MockitoJUnitRunner.class)
-public class IssueChangelogMigrationTest {
-
-  @ClassRule
-  public static DbTester db = new DbTester().schema(IssueChangelogMigrationTest.class, "schema.sql");
-
-  @Mock
-  System2 system2;
-
-  @Mock
-  PropertiesDao propertiesDao;
-
-  IssueChangelogMigrationStep migration;
-
-  @Before
-  public void setUp() throws Exception {
-    when(system2.now()).thenReturn(DateUtils.parseDateTime("2014-02-19T19:10:03+0100").getTime());
-    when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue("8"));
-
-    WorkDurationConvertor convertor = new WorkDurationConvertor(propertiesDao);
-    convertor.init();
-    migration = new IssueChangelogMigrationStep(db.database(), system2, convertor);
-  }
-
-  @Test
-  public void migrate_issue_changelog_debt() throws Exception {
-    db.prepareDbUnit(getClass(), "migrate_issue_changelog_debt.xml");
-
-    migration.execute();
-
-    db.assertDbUnit(getClass(), "migrate_issue_changelog_debt_result.xml", new String[]{"updated_at"}, "issue_changes");
-  }
-
-  @Test
-  public void convert_data_containing_only_debt_change() throws Exception {
-    assertThat(migration.convertChangelog("technicalDebt=1|2")).isEqualTo("technicalDebt=1|2");
-    assertThat(migration.convertChangelog("technicalDebt=100|200")).isEqualTo("technicalDebt=60|120");
-    assertThat(migration.convertChangelog("technicalDebt=10000|20000")).isEqualTo("technicalDebt=480|960");
-
-    assertThat(migration.convertChangelog("technicalDebt=|2")).isEqualTo("technicalDebt=|2");
-    assertThat(migration.convertChangelog("technicalDebt=1|")).isEqualTo("technicalDebt=1|");
-  }
-
-  @Test
-  public void convert_data_beginning_with_debt_change() throws Exception {
-    assertThat(migration.convertChangelog("technicalDebt=100|200,status=RESOLVED|REOPENED")).isEqualTo("technicalDebt=60|120,status=RESOLVED|REOPENED");
-    assertThat(migration.convertChangelog("technicalDebt=|200,status=RESOLVED|REOPENED")).isEqualTo("technicalDebt=|120,status=RESOLVED|REOPENED");
-    assertThat(migration.convertChangelog("technicalDebt=100|,status=RESOLVED|REOPENED")).isEqualTo("technicalDebt=60|,status=RESOLVED|REOPENED");
-  }
-
-  @Test
-  public void convert_data_finishing_with_debt_change() throws Exception {
-    assertThat(migration.convertChangelog("status=RESOLVED|REOPENED,technicalDebt=100|200")).isEqualTo("status=RESOLVED|REOPENED,technicalDebt=60|120");
-    assertThat(migration.convertChangelog("status=RESOLVED|REOPENED,technicalDebt=|200")).isEqualTo("status=RESOLVED|REOPENED,technicalDebt=|120");
-    assertThat(migration.convertChangelog("status=RESOLVED|REOPENED,technicalDebt=100|")).isEqualTo("status=RESOLVED|REOPENED,technicalDebt=60|");
-  }
-
-  @Test
-  public void convert_data_with_debt_change_in_the_middle() throws Exception {
-    assertThat(migration.convertChangelog("status=RESOLVED|REOPENED,technicalDebt=100|200,resolution=")).isEqualTo("status=RESOLVED|REOPENED,technicalDebt=60|120,resolution=");
-    assertThat(migration.convertChangelog("status=RESOLVED|REOPENED,technicalDebt=|200,resolution=")).isEqualTo("status=RESOLVED|REOPENED,technicalDebt=|120,resolution=");
-    assertThat(migration.convertChangelog("status=RESOLVED|REOPENED,technicalDebt=100|,resolution=")).isEqualTo("status=RESOLVED|REOPENED,technicalDebt=60|,resolution=");
-  }
-}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest.java
new file mode 100644 (file)
index 0000000..bc8b1f0
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube 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.
+ *
+ * SonarQube 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.db.migrations.v43;
+
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.sonar.api.utils.DateUtils;
+import org.sonar.api.utils.System2;
+import org.sonar.core.persistence.DbTester;
+
+import static org.mockito.Mockito.when;
+
+@RunWith(MockitoJUnitRunner.class)
+public class NotResolvedIssuesOnRemovedComponentsMigrationStepTest {
+
+  @ClassRule
+  public static DbTester db = new DbTester().schema(NotResolvedIssuesOnRemovedComponentsMigrationStepTest.class, "schema.sql");
+
+  @Mock
+  System2 system2;
+
+  NotResolvedIssuesOnRemovedComponentsMigrationStep migration;
+
+  @Before
+  public void setUp() throws Exception {
+    when(system2.now()).thenReturn(DateUtils.parseDate("2014-04-09").getTime());
+
+    migration = new NotResolvedIssuesOnRemovedComponentsMigrationStep(db.database(), system2);
+  }
+
+  @Test
+  public void migrate_issues() throws Exception {
+    db.prepareDbUnit(getClass(), "migrate_issues.xml");
+
+    migration.execute();
+
+    db.assertDbUnit(getClass(), "migrate_issues_result.xml", "issues");
+  }
+
+}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationTest.java
deleted file mode 100644 (file)
index 9f126ab..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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.db.migrations.v43;
-
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.sonar.api.utils.DateUtils;
-import org.sonar.api.utils.System2;
-import org.sonar.core.persistence.DbTester;
-
-import static org.mockito.Mockito.when;
-
-@RunWith(MockitoJUnitRunner.class)
-public class NotResolvedIssuesOnRemovedComponentsMigrationTest {
-
-  @ClassRule
-  public static DbTester db = new DbTester().schema(NotResolvedIssuesOnRemovedComponentsMigrationTest.class, "schema.sql");
-
-  @Mock
-  System2 system2;
-
-  NotResolvedIssuesOnRemovedComponentsMigrationStep migration;
-
-  @Before
-  public void setUp() throws Exception {
-    when(system2.now()).thenReturn(DateUtils.parseDate("2014-04-09").getTime());
-
-    migration = new NotResolvedIssuesOnRemovedComponentsMigrationStep(db.database(), system2);
-  }
-
-  @Test
-  public void migrate_issues() throws Exception {
-    db.prepareDbUnit(getClass(), "migrate_issues.xml");
-
-    migration.execute();
-
-    db.assertDbUnit(getClass(), "migrate_issues_result.xml", "issues");
-  }
-
-}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest.java
new file mode 100644 (file)
index 0000000..2ab4f60
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube 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.
+ *
+ * SonarQube 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.db.migrations.v43;
+
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.core.persistence.DbTester;
+
+public class RequirementMeasuresMigrationStepTest {
+
+  @ClassRule
+  public static DbTester db = new DbTester().schema(RequirementMeasuresMigrationStepTest.class, "schema.sql");
+
+  RequirementMeasuresMigrationStep migration;
+
+  @Before
+  public void setUp() throws Exception {
+    migration = new RequirementMeasuresMigrationStep(db.database());
+  }
+
+  @Test
+  public void migrate_measures_on_requirements() throws Exception {
+    db.prepareDbUnit(getClass(), "migrate_measures_on_requirements.xml");
+
+    migration.execute();
+
+    db.assertDbUnit(getClass(), "migrate_measures_on_requirements_result.xml", "project_measures");
+  }
+}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationTest.java
deleted file mode 100644 (file)
index be7c894..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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.db.migrations.v43;
-
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.sonar.core.persistence.DbTester;
-
-public class RequirementMeasuresMigrationTest {
-
-  @ClassRule
-  public static DbTester db = new DbTester().schema(RequirementMeasuresMigrationTest.class, "schema.sql");
-
-  RequirementMeasuresMigrationStep migration;
-
-  @Before
-  public void setUp() throws Exception {
-    migration = new RequirementMeasuresMigrationStep(db.database());
-  }
-
-  @Test
-  public void migrate_measures_on_requirements() throws Exception {
-    db.prepareDbUnit(getClass(), "migrate_measures_on_requirements.xml");
-
-    migration.execute();
-
-    db.assertDbUnit(getClass(), "migrate_measures_on_requirements_result.xml", "project_measures");
-  }
-}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest.java
new file mode 100644 (file)
index 0000000..bb83cac
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube 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.
+ *
+ * SonarQube 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.db.migrations.v43;
+
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.sonar.core.persistence.DbTester;
+import org.sonar.core.properties.PropertiesDao;
+import org.sonar.core.properties.PropertyDto;
+
+import static org.mockito.Mockito.when;
+
+@RunWith(MockitoJUnitRunner.class)
+public class TechnicalDebtMeasuresMigrationStepTest {
+
+  @ClassRule
+  public static DbTester db = new DbTester().schema(TechnicalDebtMeasuresMigrationStepTest.class, "schema.sql");
+
+  @Mock
+  PropertiesDao propertiesDao;
+
+  TechnicalDebtMeasuresMigrationStep migration;
+
+  @Before
+  public void setUp() throws Exception {
+    when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue("8"));
+
+    migration = new TechnicalDebtMeasuresMigrationStep(db.database(), propertiesDao);
+  }
+
+  @Test
+  public void migrate_nothing() throws Exception {
+    db.prepareDbUnit(getClass(), "migrate_nothing.xml");
+
+    migration.execute();
+
+    db.assertDbUnit(getClass(), "migrate_nothing.xml", "project_measures");
+  }
+
+  @Test
+  public void migrate_technical_debt_measures() throws Exception {
+    db.prepareDbUnit(getClass(), "migrate_technical_debt_measures.xml");
+
+    migration.execute();
+
+    db.assertDbUnit(getClass(), "migrate_technical_debt_measures_result.xml", "project_measures");
+  }
+
+  @Test
+  public void migrate_added_technical_debt_measures() throws Exception {
+    db.prepareDbUnit(getClass(), "migrate_new_technical_debt_measures.xml");
+
+    migration.execute();
+
+    db.assertDbUnit(getClass(), "migrate_new_technical_debt_measures_result.xml", "project_measures");
+  }
+
+  @Test
+  public void migrate_sqale_measures() throws Exception {
+    db.prepareDbUnit(getClass(), "migrate_sqale_measures.xml");
+
+    migration.execute();
+
+    db.assertDbUnit(getClass(), "migrate_sqale_measures_result.xml", "project_measures");
+  }
+
+}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest.java
deleted file mode 100644 (file)
index 9b64cb6..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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.db.migrations.v43;
-
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.sonar.core.persistence.DbTester;
-import org.sonar.core.properties.PropertiesDao;
-import org.sonar.core.properties.PropertyDto;
-
-import static org.mockito.Mockito.when;
-
-@RunWith(MockitoJUnitRunner.class)
-public class TechnicalDebtMeasuresMigrationTest {
-
-  @ClassRule
-  public static DbTester db = new DbTester().schema(TechnicalDebtMeasuresMigrationTest.class, "schema.sql");
-
-  @Mock
-  PropertiesDao propertiesDao;
-
-  TechnicalDebtMeasuresMigrationStep migration;
-
-  @Before
-  public void setUp() throws Exception {
-    when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue("8"));
-
-    migration = new TechnicalDebtMeasuresMigrationStep(db.database(), propertiesDao);
-  }
-
-  @Test
-  public void migrate_nothing() throws Exception {
-    db.prepareDbUnit(getClass(), "migrate_nothing.xml");
-
-    migration.execute();
-
-    db.assertDbUnit(getClass(), "migrate_nothing.xml", "project_measures");
-  }
-
-  @Test
-  public void migrate_technical_debt_measures() throws Exception {
-    db.prepareDbUnit(getClass(), "migrate_technical_debt_measures.xml");
-
-    migration.execute();
-
-    db.assertDbUnit(getClass(), "migrate_technical_debt_measures_result.xml", "project_measures");
-  }
-
-  @Test
-  public void migrate_added_technical_debt_measures() throws Exception {
-    db.prepareDbUnit(getClass(), "migrate_new_technical_debt_measures.xml");
-
-    migration.execute();
-
-    db.assertDbUnit(getClass(), "migrate_new_technical_debt_measures_result.xml", "project_measures");
-  }
-
-  @Test
-  public void migrate_sqale_measures() throws Exception {
-    db.prepareDbUnit(getClass(), "migrate_sqale_measures.xml");
-
-    migration.execute();
-
-    db.assertDbUnit(getClass(), "migrate_sqale_measures_result.xml", "project_measures");
-  }
-
-}
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/migrate_issues_debt.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/migrate_issues_debt.xml
new file mode 100644 (file)
index 0000000..7717330
--- /dev/null
@@ -0,0 +1,44 @@
+<dataset>
+
+  <!-- 1 day, 1 hour and 1 minute of debt -->
+  <issues ID="1" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="1"
+          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
+          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
+          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
+          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05"
+          TECHNICAL_DEBT="010101"/>
+
+  <!-- 1 day debt -->
+  <issues ID="2" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="2"
+          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
+          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
+          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
+          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05"
+          TECHNICAL_DEBT="010000"/>
+
+  <!-- 1 hour debt -->
+  <issues ID="3" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="3"
+          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
+          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
+          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
+          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05"
+          TECHNICAL_DEBT="100"/>
+
+  <!-- 1 minute debt -->
+  <issues ID="4" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="4"
+          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
+          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
+          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
+          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05"
+          TECHNICAL_DEBT="1"/>
+
+
+  <!-- No debt, should not be touched -->
+  <issues ID="100" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="100"
+          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
+          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
+          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
+          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05"
+          TECHNICAL_DEBT="[null]"/>
+
+</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/migrate_issues_debt_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/migrate_issues_debt_result.xml
new file mode 100644 (file)
index 0000000..c8d9eae
--- /dev/null
@@ -0,0 +1,44 @@
+<dataset>
+
+  <!-- Previous debt value was 010101, it should be 1 day * 8 (nb of hours in day) * 60 + 1 hour * 60 + 1 minute = 541 minutes -->
+  <issues ID="1" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="1"
+          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
+          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
+          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
+          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2014-02-19 19:10:03.0"
+          TECHNICAL_DEBT="541"/>
+
+  <!-- 1 day debt -->
+  <issues ID="2" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="2"
+          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
+          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
+          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
+          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2014-02-19 19:10:03.0"
+          TECHNICAL_DEBT="480"/>
+
+  <!-- 1 hour debt -->
+  <issues ID="3" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="3"
+          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
+          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
+          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
+          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2014-02-19 19:10:03.0"
+          TECHNICAL_DEBT="60"/>
+
+  <!-- 1 minute debt -->
+  <issues ID="4" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="4"
+          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
+          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
+          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
+          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2014-02-19 19:10:03.0"
+          TECHNICAL_DEBT="1"/>
+
+
+  <!-- No debt, should not be touched -->
+  <issues ID="100" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="100"
+          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
+          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
+          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
+          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05"
+          TECHNICAL_DEBT="[null]"/>
+
+</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/schema.sql
new file mode 100644 (file)
index 0000000..f3f71cf
--- /dev/null
@@ -0,0 +1,28 @@
+-- 4.3
+
+CREATE TABLE "ISSUES" (
+  "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+  "KEE" VARCHAR(50) UNIQUE NOT NULL,
+  "COMPONENT_ID" INTEGER NOT NULL,
+  "ROOT_COMPONENT_ID" INTEGER,
+  "RULE_ID" INTEGER,
+  "SEVERITY" VARCHAR(10),
+  "MANUAL_SEVERITY" BOOLEAN NOT NULL,
+  "MESSAGE" VARCHAR(4000),
+  "LINE" INTEGER,
+  "EFFORT_TO_FIX" DOUBLE,
+  "STATUS" VARCHAR(20),
+  "RESOLUTION" VARCHAR(20),
+  "CHECKSUM" VARCHAR(1000),
+  "REPORTER" VARCHAR(40),
+  "ASSIGNEE" VARCHAR(40),
+  "AUTHOR_LOGIN" VARCHAR(100),
+  "ACTION_PLAN_KEY" VARCHAR(50) NULL,
+  "ISSUE_ATTRIBUTES" VARCHAR(4000),
+  "ISSUE_CREATION_DATE" TIMESTAMP,
+  "ISSUE_CLOSE_DATE" TIMESTAMP,
+  "ISSUE_UPDATE_DATE" TIMESTAMP,
+  "CREATED_AT" TIMESTAMP,
+  "UPDATED_AT" TIMESTAMP,
+  "TECHNICAL_DEBT" INTEGER
+);
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationTest/migrate_issues_debt.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationTest/migrate_issues_debt.xml
deleted file mode 100644 (file)
index 7717330..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<dataset>
-
-  <!-- 1 day, 1 hour and 1 minute of debt -->
-  <issues ID="1" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="1"
-          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
-          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
-          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
-          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05"
-          TECHNICAL_DEBT="010101"/>
-
-  <!-- 1 day debt -->
-  <issues ID="2" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="2"
-          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
-          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
-          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
-          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05"
-          TECHNICAL_DEBT="010000"/>
-
-  <!-- 1 hour debt -->
-  <issues ID="3" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="3"
-          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
-          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
-          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
-          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05"
-          TECHNICAL_DEBT="100"/>
-
-  <!-- 1 minute debt -->
-  <issues ID="4" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="4"
-          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
-          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
-          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
-          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05"
-          TECHNICAL_DEBT="1"/>
-
-
-  <!-- No debt, should not be touched -->
-  <issues ID="100" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="100"
-          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
-          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
-          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
-          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05"
-          TECHNICAL_DEBT="[null]"/>
-
-</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationTest/migrate_issues_debt_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationTest/migrate_issues_debt_result.xml
deleted file mode 100644 (file)
index c8d9eae..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<dataset>
-
-  <!-- Previous debt value was 010101, it should be 1 day * 8 (nb of hours in day) * 60 + 1 hour * 60 + 1 minute = 541 minutes -->
-  <issues ID="1" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="1"
-          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
-          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
-          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
-          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2014-02-19 19:10:03.0"
-          TECHNICAL_DEBT="541"/>
-
-  <!-- 1 day debt -->
-  <issues ID="2" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="2"
-          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
-          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
-          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
-          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2014-02-19 19:10:03.0"
-          TECHNICAL_DEBT="480"/>
-
-  <!-- 1 hour debt -->
-  <issues ID="3" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="3"
-          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
-          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
-          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
-          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2014-02-19 19:10:03.0"
-          TECHNICAL_DEBT="60"/>
-
-  <!-- 1 minute debt -->
-  <issues ID="4" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="4"
-          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
-          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
-          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
-          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2014-02-19 19:10:03.0"
-          TECHNICAL_DEBT="1"/>
-
-
-  <!-- No debt, should not be touched -->
-  <issues ID="100" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="100"
-          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
-          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
-          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
-          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05"
-          TECHNICAL_DEBT="[null]"/>
-
-</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationTest/schema.sql
deleted file mode 100644 (file)
index f3f71cf..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
--- 4.3
-
-CREATE TABLE "ISSUES" (
-  "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
-  "KEE" VARCHAR(50) UNIQUE NOT NULL,
-  "COMPONENT_ID" INTEGER NOT NULL,
-  "ROOT_COMPONENT_ID" INTEGER,
-  "RULE_ID" INTEGER,
-  "SEVERITY" VARCHAR(10),
-  "MANUAL_SEVERITY" BOOLEAN NOT NULL,
-  "MESSAGE" VARCHAR(4000),
-  "LINE" INTEGER,
-  "EFFORT_TO_FIX" DOUBLE,
-  "STATUS" VARCHAR(20),
-  "RESOLUTION" VARCHAR(20),
-  "CHECKSUM" VARCHAR(1000),
-  "REPORTER" VARCHAR(40),
-  "ASSIGNEE" VARCHAR(40),
-  "AUTHOR_LOGIN" VARCHAR(100),
-  "ACTION_PLAN_KEY" VARCHAR(50) NULL,
-  "ISSUE_ATTRIBUTES" VARCHAR(4000),
-  "ISSUE_CREATION_DATE" TIMESTAMP,
-  "ISSUE_CLOSE_DATE" TIMESTAMP,
-  "ISSUE_UPDATE_DATE" TIMESTAMP,
-  "CREATED_AT" TIMESTAMP,
-  "UPDATED_AT" TIMESTAMP,
-  "TECHNICAL_DEBT" INTEGER
-);
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/metric_does_not_exist.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/metric_does_not_exist.xml
new file mode 100644 (file)
index 0000000..0fb812f
--- /dev/null
@@ -0,0 +1,12 @@
+<dataset>
+
+  <!-- ncloc -->
+  <metrics delete_historical_data="[null]" id="1" name="ncloc" VAL_TYPE="STRING" DESCRIPTION="[null]"  domain="[null]" short_name=""
+           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
+
+  <project_measures id="1" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
+
+</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/metric_does_not_exist_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/metric_does_not_exist_result.xml
new file mode 100644 (file)
index 0000000..0fb812f
--- /dev/null
@@ -0,0 +1,12 @@
+<dataset>
+
+  <!-- ncloc -->
+  <metrics delete_historical_data="[null]" id="1" name="ncloc" VAL_TYPE="STRING" DESCRIPTION="[null]"  domain="[null]" short_name=""
+           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
+
+  <project_measures id="1" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
+
+</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/migrate_dev_cost_measures.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/migrate_dev_cost_measures.xml
new file mode 100644 (file)
index 0000000..2d1633d
--- /dev/null
@@ -0,0 +1,12 @@
+<dataset>
+
+  <!-- development_cost -->
+  <metrics delete_historical_data="[null]" id="1" name="development_cost" VAL_TYPE="STRING" DESCRIPTION="[null]"  domain="[null]" short_name=""
+           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
+
+  <project_measures id="1" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
+
+</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/migrate_dev_cost_measures_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/migrate_dev_cost_measures_result.xml
new file mode 100644 (file)
index 0000000..6db169e
--- /dev/null
@@ -0,0 +1,8 @@
+<dataset>
+
+  <project_measures id="1" VALUE="[null]" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="480" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
+
+</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/schema.sql
new file mode 100644 (file)
index 0000000..1e29613
--- /dev/null
@@ -0,0 +1,45 @@
+-- 4.3
+
+CREATE TABLE "PROJECT_MEASURES" (
+  "ID" BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+  "VALUE" DOUBLE,
+  "METRIC_ID" INTEGER NOT NULL,
+  "SNAPSHOT_ID" INTEGER,
+  "RULE_ID" INTEGER,
+  "RULES_CATEGORY_ID" INTEGER,
+  "TEXT_VALUE" VARCHAR(96),
+  "TENDENCY" INTEGER,
+  "MEASURE_DATE" TIMESTAMP,
+  "PROJECT_ID" INTEGER,
+  "ALERT_STATUS" VARCHAR(5),
+  "ALERT_TEXT" VARCHAR(4000),
+  "URL" VARCHAR(2000),
+  "DESCRIPTION" VARCHAR(4000),
+  "RULE_PRIORITY" INTEGER,
+  "CHARACTERISTIC_ID" INTEGER,
+  "PERSON_ID" INTEGER,
+  "VARIATION_VALUE_1" DOUBLE,
+  "VARIATION_VALUE_2" DOUBLE,
+  "VARIATION_VALUE_3" DOUBLE,
+  "VARIATION_VALUE_4" DOUBLE,
+  "VARIATION_VALUE_5" DOUBLE
+);
+
+CREATE TABLE "METRICS" (
+  "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+  "NAME" VARCHAR(64) NOT NULL,
+  "DESCRIPTION" VARCHAR(255),
+  "DIRECTION" INTEGER NOT NULL DEFAULT 0,
+  "DOMAIN" VARCHAR(64),
+  "SHORT_NAME" VARCHAR(64),
+  "QUALITATIVE" BOOLEAN NOT NULL DEFAULT FALSE,
+  "VAL_TYPE" VARCHAR(8),
+  "USER_MANAGED" BOOLEAN DEFAULT FALSE,
+  "ENABLED" BOOLEAN DEFAULT TRUE,
+  "ORIGIN" VARCHAR(3),
+  "WORST_VALUE" DOUBLE,
+  "BEST_VALUE" DOUBLE,
+  "OPTIMIZED_BEST_VALUE" BOOLEAN,
+  "HIDDEN" BOOLEAN,
+  "DELETE_HISTORICAL_DATA" BOOLEAN
+);
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationTest/metric_does_not_exist.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationTest/metric_does_not_exist.xml
deleted file mode 100644 (file)
index 0fb812f..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<dataset>
-
-  <!-- ncloc -->
-  <metrics delete_historical_data="[null]" id="1" name="ncloc" VAL_TYPE="STRING" DESCRIPTION="[null]"  domain="[null]" short_name=""
-           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
-
-  <project_measures id="1" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
-
-</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationTest/metric_does_not_exist_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationTest/metric_does_not_exist_result.xml
deleted file mode 100644 (file)
index 0fb812f..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<dataset>
-
-  <!-- ncloc -->
-  <metrics delete_historical_data="[null]" id="1" name="ncloc" VAL_TYPE="STRING" DESCRIPTION="[null]"  domain="[null]" short_name=""
-           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
-
-  <project_measures id="1" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
-
-</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationTest/migrate_dev_cost_measures.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationTest/migrate_dev_cost_measures.xml
deleted file mode 100644 (file)
index 2d1633d..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<dataset>
-
-  <!-- development_cost -->
-  <metrics delete_historical_data="[null]" id="1" name="development_cost" VAL_TYPE="STRING" DESCRIPTION="[null]"  domain="[null]" short_name=""
-           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
-
-  <project_measures id="1" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
-
-</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationTest/migrate_dev_cost_measures_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationTest/migrate_dev_cost_measures_result.xml
deleted file mode 100644 (file)
index 6db169e..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<dataset>
-
-  <project_measures id="1" VALUE="[null]" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="480" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
-
-</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationTest/schema.sql
deleted file mode 100644 (file)
index 1e29613..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
--- 4.3
-
-CREATE TABLE "PROJECT_MEASURES" (
-  "ID" BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
-  "VALUE" DOUBLE,
-  "METRIC_ID" INTEGER NOT NULL,
-  "SNAPSHOT_ID" INTEGER,
-  "RULE_ID" INTEGER,
-  "RULES_CATEGORY_ID" INTEGER,
-  "TEXT_VALUE" VARCHAR(96),
-  "TENDENCY" INTEGER,
-  "MEASURE_DATE" TIMESTAMP,
-  "PROJECT_ID" INTEGER,
-  "ALERT_STATUS" VARCHAR(5),
-  "ALERT_TEXT" VARCHAR(4000),
-  "URL" VARCHAR(2000),
-  "DESCRIPTION" VARCHAR(4000),
-  "RULE_PRIORITY" INTEGER,
-  "CHARACTERISTIC_ID" INTEGER,
-  "PERSON_ID" INTEGER,
-  "VARIATION_VALUE_1" DOUBLE,
-  "VARIATION_VALUE_2" DOUBLE,
-  "VARIATION_VALUE_3" DOUBLE,
-  "VARIATION_VALUE_4" DOUBLE,
-  "VARIATION_VALUE_5" DOUBLE
-);
-
-CREATE TABLE "METRICS" (
-  "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
-  "NAME" VARCHAR(64) NOT NULL,
-  "DESCRIPTION" VARCHAR(255),
-  "DIRECTION" INTEGER NOT NULL DEFAULT 0,
-  "DOMAIN" VARCHAR(64),
-  "SHORT_NAME" VARCHAR(64),
-  "QUALITATIVE" BOOLEAN NOT NULL DEFAULT FALSE,
-  "VAL_TYPE" VARCHAR(8),
-  "USER_MANAGED" BOOLEAN DEFAULT FALSE,
-  "ENABLED" BOOLEAN DEFAULT TRUE,
-  "ORIGIN" VARCHAR(3),
-  "WORST_VALUE" DOUBLE,
-  "BEST_VALUE" DOUBLE,
-  "OPTIMIZED_BEST_VALUE" BOOLEAN,
-  "HIDDEN" BOOLEAN,
-  "DELETE_HISTORICAL_DATA" BOOLEAN
-);
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest/migrate_issue_changelog_debt.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest/migrate_issue_changelog_debt.xml
new file mode 100644 (file)
index 0000000..5116d3e
--- /dev/null
@@ -0,0 +1,10 @@
+<dataset>
+
+  <!-- Change from 1 day, 1 hour and 1 minute of debt to 2 days -->
+  <issue_changes ID="1" KEE="1" ISSUE_KEY="ABCD" USER_LOGIN ="[null]" CHANGE_TYPE="diff" CHANGE_DATA="technicalDebt=10101|20000,resolution=,status=RESOLVED|REOPENED"
+                 CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05" ISSUE_CHANGE_CREATION_DATE="2012-01-05"/>
+
+  <!-- No change on debt, should not be touched -->
+  <issue_changes ID="2" KEE="2" ISSUE_KEY="ABCD" USER_LOGIN ="[null]" CHANGE_TYPE="diff" CHANGE_DATA="status=RESOLVED|REOPENED"
+                 CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05" ISSUE_CHANGE_CREATION_DATE="2012-01-05"/>
+</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest/migrate_issue_changelog_debt_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest/migrate_issue_changelog_debt_result.xml
new file mode 100644 (file)
index 0000000..a42f67e
--- /dev/null
@@ -0,0 +1,11 @@
+<dataset>
+
+  <!-- Change from 1 day, 1 hour and 1 minute of debt to 2 days -->
+  <issue_changes ID="1" KEE="1" ISSUE_KEY="ABCD" USER_LOGIN ="[null]" CHANGE_TYPE="diff" CHANGE_DATA="technicalDebt=541|960,resolution=,status=RESOLVED|REOPENED"
+                 CREATED_AT="2012-01-05" UPDATED_AT="2014-02-19 19:10:03.0" ISSUE_CHANGE_CREATION_DATE="2012-01-05"/>
+
+  <!-- No change on debt, should not be touched -->
+  <issue_changes ID="2" KEE="2" ISSUE_KEY="ABCD" USER_LOGIN ="[null]" CHANGE_TYPE="diff" CHANGE_DATA="status=RESOLVED|REOPENED"
+                 CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05" ISSUE_CHANGE_CREATION_DATE="2012-01-05"/>
+
+</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest/schema.sql
new file mode 100644 (file)
index 0000000..b6bcd85
--- /dev/null
@@ -0,0 +1,13 @@
+-- 4.3
+
+CREATE TABLE "ISSUE_CHANGES" (
+  "ID" BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+  "KEE" VARCHAR(50),
+  "ISSUE_KEY" VARCHAR(50) NOT NULL,
+  "USER_LOGIN" VARCHAR(40),
+  "CHANGE_TYPE" VARCHAR(40),
+  "CHANGE_DATA"  VARCHAR(16777215),
+  "CREATED_AT" TIMESTAMP,
+  "UPDATED_AT" TIMESTAMP,
+  "ISSUE_CHANGE_CREATION_DATE" TIMESTAMP,
+);
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationTest/migrate_issue_changelog_debt.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationTest/migrate_issue_changelog_debt.xml
deleted file mode 100644 (file)
index 5116d3e..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<dataset>
-
-  <!-- Change from 1 day, 1 hour and 1 minute of debt to 2 days -->
-  <issue_changes ID="1" KEE="1" ISSUE_KEY="ABCD" USER_LOGIN ="[null]" CHANGE_TYPE="diff" CHANGE_DATA="technicalDebt=10101|20000,resolution=,status=RESOLVED|REOPENED"
-                 CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05" ISSUE_CHANGE_CREATION_DATE="2012-01-05"/>
-
-  <!-- No change on debt, should not be touched -->
-  <issue_changes ID="2" KEE="2" ISSUE_KEY="ABCD" USER_LOGIN ="[null]" CHANGE_TYPE="diff" CHANGE_DATA="status=RESOLVED|REOPENED"
-                 CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05" ISSUE_CHANGE_CREATION_DATE="2012-01-05"/>
-</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationTest/migrate_issue_changelog_debt_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationTest/migrate_issue_changelog_debt_result.xml
deleted file mode 100644 (file)
index a42f67e..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<dataset>
-
-  <!-- Change from 1 day, 1 hour and 1 minute of debt to 2 days -->
-  <issue_changes ID="1" KEE="1" ISSUE_KEY="ABCD" USER_LOGIN ="[null]" CHANGE_TYPE="diff" CHANGE_DATA="technicalDebt=541|960,resolution=,status=RESOLVED|REOPENED"
-                 CREATED_AT="2012-01-05" UPDATED_AT="2014-02-19 19:10:03.0" ISSUE_CHANGE_CREATION_DATE="2012-01-05"/>
-
-  <!-- No change on debt, should not be touched -->
-  <issue_changes ID="2" KEE="2" ISSUE_KEY="ABCD" USER_LOGIN ="[null]" CHANGE_TYPE="diff" CHANGE_DATA="status=RESOLVED|REOPENED"
-                 CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05" ISSUE_CHANGE_CREATION_DATE="2012-01-05"/>
-
-</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationTest/schema.sql
deleted file mode 100644 (file)
index b6bcd85..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
--- 4.3
-
-CREATE TABLE "ISSUE_CHANGES" (
-  "ID" BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
-  "KEE" VARCHAR(50),
-  "ISSUE_KEY" VARCHAR(50) NOT NULL,
-  "USER_LOGIN" VARCHAR(40),
-  "CHANGE_TYPE" VARCHAR(40),
-  "CHANGE_DATA"  VARCHAR(16777215),
-  "CREATED_AT" TIMESTAMP,
-  "UPDATED_AT" TIMESTAMP,
-  "ISSUE_CHANGE_CREATION_DATE" TIMESTAMP,
-);
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/migrate_issues.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/migrate_issues.xml
new file mode 100644 (file)
index 0000000..1e7e5ab
--- /dev/null
@@ -0,0 +1,35 @@
+<dataset>
+
+  <projects id="1" root_id="[null]" scope="FIL" qualifier="FIL" kee="org.struts:struts:/src/main/java/org/struts/Action.java" name="Action"
+            description="[null]" long_name="org.struts.Action"
+            enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" created_at="[null]" path="/foo/bar" deprecated_kee="org.struts:struts:org.struts.Action" />
+
+  <projects id="2" root_id="[null]" scope="FIL" qualifier="FIL" kee="org.struts:struts:/src/main/java/org/struts/Filter.java" name="Filter"
+            description="[null]" long_name="org.struts.Filter"
+            enabled="[false]" language="java" copy_resource_id="[null]" person_id="[null]" created_at="[null]" path="[null]" deprecated_kee="org.struts:struts:org.struts.Filter" />
+
+  <!-- Issue not resolved on not removed component -> Nothing to do -->
+  <issues ID="1" COMPONENT_ID="1" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="1"
+          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
+          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
+          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
+          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05"
+          TECHNICAL_DEBT="10"/>
+
+  <!-- Issue not resolved on removed component -> To be closed -->
+  <issues ID="2" COMPONENT_ID="2" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="2"
+          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
+          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
+          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
+          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05"
+          TECHNICAL_DEBT="10"/>
+
+  <!-- Issue resolved on removed component -> Nothing to do -->
+  <issues ID="3" COMPONENT_ID="2" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="3"
+          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
+          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
+          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
+          RESOLUTION="FIXED" STATUS="CLOSED" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05"
+          TECHNICAL_DEBT="10"/>
+
+</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/migrate_issues_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/migrate_issues_result.xml
new file mode 100644 (file)
index 0000000..4509c27
--- /dev/null
@@ -0,0 +1,27 @@
+<dataset>
+
+  <!-- Issue not resolved on not removed component -> Nothing to do -->
+  <issues ID="1" COMPONENT_ID="1" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="1"
+          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
+          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
+          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
+          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05"
+          TECHNICAL_DEBT="10"/>
+
+  <!-- Issue not resolved on removed component -> To be closed -->
+  <issues ID="2" COMPONENT_ID="2" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="2"
+          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
+          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
+          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
+          RESOLUTION="REMOVED" STATUS="CLOSED" CREATED_AT="2012-01-05" UPDATED_AT="2014-04-09 00:00:00.0"
+          TECHNICAL_DEBT="10"/>
+
+  <!-- Issue resolved on removed component -> Nothing to do -->
+  <issues ID="3" COMPONENT_ID="2" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="3"
+          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
+          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
+          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
+          RESOLUTION="FIXED" STATUS="CLOSED" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05"
+          TECHNICAL_DEBT="10"/>
+
+</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/schema.sql
new file mode 100644 (file)
index 0000000..c0129aa
--- /dev/null
@@ -0,0 +1,46 @@
+-- 4.3
+
+CREATE TABLE "ISSUES" (
+  "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+  "KEE" VARCHAR(50) UNIQUE NOT NULL,
+  "COMPONENT_ID" INTEGER NOT NULL,
+  "ROOT_COMPONENT_ID" INTEGER,
+  "RULE_ID" INTEGER,
+  "SEVERITY" VARCHAR(10),
+  "MANUAL_SEVERITY" BOOLEAN NOT NULL,
+  "MESSAGE" VARCHAR(4000),
+  "LINE" INTEGER,
+  "EFFORT_TO_FIX" DOUBLE,
+  "STATUS" VARCHAR(20),
+  "RESOLUTION" VARCHAR(20),
+  "CHECKSUM" VARCHAR(1000),
+  "REPORTER" VARCHAR(40),
+  "ASSIGNEE" VARCHAR(40),
+  "AUTHOR_LOGIN" VARCHAR(100),
+  "ACTION_PLAN_KEY" VARCHAR(50) NULL,
+  "ISSUE_ATTRIBUTES" VARCHAR(4000),
+  "ISSUE_CREATION_DATE" TIMESTAMP,
+  "ISSUE_CLOSE_DATE" TIMESTAMP,
+  "ISSUE_UPDATE_DATE" TIMESTAMP,
+  "CREATED_AT" TIMESTAMP,
+  "UPDATED_AT" TIMESTAMP,
+  "TECHNICAL_DEBT" INTEGER
+);
+
+CREATE TABLE "PROJECTS" (
+  "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+  "NAME" VARCHAR(256),
+  "DESCRIPTION" VARCHAR(2000),
+  "ENABLED" BOOLEAN NOT NULL DEFAULT TRUE,
+  "SCOPE" VARCHAR(3),
+  "QUALIFIER" VARCHAR(10),
+  "KEE" VARCHAR(400),
+  "DEPRECATED_KEE" VARCHAR(400),
+  "PATH" VARCHAR(2000),
+  "ROOT_ID" INTEGER,
+  "LANGUAGE" VARCHAR(20),
+  "COPY_RESOURCE_ID" INTEGER,
+  "LONG_NAME" VARCHAR(256),
+  "PERSON_ID" INTEGER,
+  "CREATED_AT" TIMESTAMP
+);
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationTest/migrate_issues.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationTest/migrate_issues.xml
deleted file mode 100644 (file)
index 1e7e5ab..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<dataset>
-
-  <projects id="1" root_id="[null]" scope="FIL" qualifier="FIL" kee="org.struts:struts:/src/main/java/org/struts/Action.java" name="Action"
-            description="[null]" long_name="org.struts.Action"
-            enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" created_at="[null]" path="/foo/bar" deprecated_kee="org.struts:struts:org.struts.Action" />
-
-  <projects id="2" root_id="[null]" scope="FIL" qualifier="FIL" kee="org.struts:struts:/src/main/java/org/struts/Filter.java" name="Filter"
-            description="[null]" long_name="org.struts.Filter"
-            enabled="[false]" language="java" copy_resource_id="[null]" person_id="[null]" created_at="[null]" path="[null]" deprecated_kee="org.struts:struts:org.struts.Filter" />
-
-  <!-- Issue not resolved on not removed component -> Nothing to do -->
-  <issues ID="1" COMPONENT_ID="1" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="1"
-          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
-          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
-          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
-          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05"
-          TECHNICAL_DEBT="10"/>
-
-  <!-- Issue not resolved on removed component -> To be closed -->
-  <issues ID="2" COMPONENT_ID="2" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="2"
-          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
-          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
-          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
-          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05"
-          TECHNICAL_DEBT="10"/>
-
-  <!-- Issue resolved on removed component -> Nothing to do -->
-  <issues ID="3" COMPONENT_ID="2" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="3"
-          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
-          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
-          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
-          RESOLUTION="FIXED" STATUS="CLOSED" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05"
-          TECHNICAL_DEBT="10"/>
-
-</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationTest/migrate_issues_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationTest/migrate_issues_result.xml
deleted file mode 100644 (file)
index 4509c27..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<dataset>
-
-  <!-- Issue not resolved on not removed component -> Nothing to do -->
-  <issues ID="1" COMPONENT_ID="1" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="1"
-          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
-          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
-          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
-          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05"
-          TECHNICAL_DEBT="10"/>
-
-  <!-- Issue not resolved on removed component -> To be closed -->
-  <issues ID="2" COMPONENT_ID="2" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="2"
-          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
-          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
-          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
-          RESOLUTION="REMOVED" STATUS="CLOSED" CREATED_AT="2012-01-05" UPDATED_AT="2014-04-09 00:00:00.0"
-          TECHNICAL_DEBT="10"/>
-
-  <!-- Issue resolved on removed component -> Nothing to do -->
-  <issues ID="3" COMPONENT_ID="2" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="3"
-          ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
-          EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
-          ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
-          RESOLUTION="FIXED" STATUS="CLOSED" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05"
-          TECHNICAL_DEBT="10"/>
-
-</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationTest/schema.sql
deleted file mode 100644 (file)
index c0129aa..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
--- 4.3
-
-CREATE TABLE "ISSUES" (
-  "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
-  "KEE" VARCHAR(50) UNIQUE NOT NULL,
-  "COMPONENT_ID" INTEGER NOT NULL,
-  "ROOT_COMPONENT_ID" INTEGER,
-  "RULE_ID" INTEGER,
-  "SEVERITY" VARCHAR(10),
-  "MANUAL_SEVERITY" BOOLEAN NOT NULL,
-  "MESSAGE" VARCHAR(4000),
-  "LINE" INTEGER,
-  "EFFORT_TO_FIX" DOUBLE,
-  "STATUS" VARCHAR(20),
-  "RESOLUTION" VARCHAR(20),
-  "CHECKSUM" VARCHAR(1000),
-  "REPORTER" VARCHAR(40),
-  "ASSIGNEE" VARCHAR(40),
-  "AUTHOR_LOGIN" VARCHAR(100),
-  "ACTION_PLAN_KEY" VARCHAR(50) NULL,
-  "ISSUE_ATTRIBUTES" VARCHAR(4000),
-  "ISSUE_CREATION_DATE" TIMESTAMP,
-  "ISSUE_CLOSE_DATE" TIMESTAMP,
-  "ISSUE_UPDATE_DATE" TIMESTAMP,
-  "CREATED_AT" TIMESTAMP,
-  "UPDATED_AT" TIMESTAMP,
-  "TECHNICAL_DEBT" INTEGER
-);
-
-CREATE TABLE "PROJECTS" (
-  "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
-  "NAME" VARCHAR(256),
-  "DESCRIPTION" VARCHAR(2000),
-  "ENABLED" BOOLEAN NOT NULL DEFAULT TRUE,
-  "SCOPE" VARCHAR(3),
-  "QUALIFIER" VARCHAR(10),
-  "KEE" VARCHAR(400),
-  "DEPRECATED_KEE" VARCHAR(400),
-  "PATH" VARCHAR(2000),
-  "ROOT_ID" INTEGER,
-  "LANGUAGE" VARCHAR(20),
-  "COPY_RESOURCE_ID" INTEGER,
-  "LONG_NAME" VARCHAR(256),
-  "PERSON_ID" INTEGER,
-  "CREATED_AT" TIMESTAMP
-);
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest/migrate_measures_on_requirements.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest/migrate_measures_on_requirements.xml
new file mode 100644 (file)
index 0000000..a5249ee
--- /dev/null
@@ -0,0 +1,44 @@
+<dataset>
+
+  <!-- Root characteristic -->
+  <characteristics id="1" kee="PORTABILITY" name="Portability" parent_id="[null]" root_id="[null]" rule_id="[null]" characteristic_order="1"
+                   function_key="[null]" factor_value="[null]" factor_unit="[null]" offset_value="[null]" offset_unit="[null]" enabled="[true]"
+                   created_at="2013-11-20" updated_at="2013-11-22"/>
+
+  <!-- Characteristic -->
+  <characteristics id="2" kee="COMPILER_RELATED_PORTABILITY" name="Compiler related portability" parent_id="1" root_id="1" rule_id="[null]" characteristic_order="[null]"
+                   function_key="[null]" factor_value="[null]" factor_unit="[null]" offset_value="[null]" offset_unit="[null]" enabled="[true]"
+                   created_at="2013-11-20" updated_at="2013-11-22"/>
+
+  <!-- Requirement -->
+  <characteristics id="3" kee="[null]" name="[null]" parent_id="2" root_id="1" rule_id="10"
+                   function_key="linear_offset" factor_value="20.0" factor_unit="mn" offset_value="30.0" offset_unit="h" enabled="[true]"
+                   created_at="2013-11-20" updated_at="[null]"/>
+
+
+
+  <!-- Measure linked on requirement -> to be updated -->
+  <project_measures id="1" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    rule_id="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="3" url="[null]" person_id="[null]"
+                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
+
+  <!-- Measure linked on characteristic -> not to be updated -->
+  <project_measures id="2" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    rule_id="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
+
+  <!-- Measure linked on rule -> not to be updated -->
+  <project_measures id="3" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    rule_id="10" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
+
+  <!-- Measure not linked on rule or requirement -> not to be updated -->
+  <project_measures id="4" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    rule_id="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
+
+</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest/migrate_measures_on_requirements_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest/migrate_measures_on_requirements_result.xml
new file mode 100644 (file)
index 0000000..df20f63
--- /dev/null
@@ -0,0 +1,27 @@
+<dataset>
+
+  <!-- Measure linked on requirement -> to be updated -->
+  <project_measures id="1" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    rule_id="10" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
+
+  <!-- Measure linked on characteristic -> not to be updated -->
+  <project_measures id="2" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    rule_id="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
+
+  <!-- Measure linked on rule -> not to be updated -->
+  <project_measures id="3" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    rule_id="10" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
+
+  <!-- Measure not linked on rule or requirement -> not to be updated -->
+  <project_measures id="4" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    rule_id="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
+
+</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest/schema.sql
new file mode 100644 (file)
index 0000000..a60b5de
--- /dev/null
@@ -0,0 +1,44 @@
+-- 4.3
+
+CREATE TABLE "PROJECT_MEASURES" (
+  "ID" BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+  "VALUE" DOUBLE,
+  "METRIC_ID" INTEGER NOT NULL,
+  "SNAPSHOT_ID" INTEGER,
+  "RULE_ID" INTEGER,
+  "RULES_CATEGORY_ID" INTEGER,
+  "TEXT_VALUE" VARCHAR(96),
+  "TENDENCY" INTEGER,
+  "MEASURE_DATE" TIMESTAMP,
+  "PROJECT_ID" INTEGER,
+  "ALERT_STATUS" VARCHAR(5),
+  "ALERT_TEXT" VARCHAR(4000),
+  "URL" VARCHAR(2000),
+  "DESCRIPTION" VARCHAR(4000),
+  "RULE_PRIORITY" INTEGER,
+  "CHARACTERISTIC_ID" INTEGER,
+  "PERSON_ID" INTEGER,
+  "VARIATION_VALUE_1" DOUBLE,
+  "VARIATION_VALUE_2" DOUBLE,
+  "VARIATION_VALUE_3" DOUBLE,
+  "VARIATION_VALUE_4" DOUBLE,
+  "VARIATION_VALUE_5" DOUBLE
+);
+
+CREATE TABLE "CHARACTERISTICS" (
+  "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+  "KEE" VARCHAR(100),
+  "NAME" VARCHAR(100),
+  "PARENT_ID" INTEGER,
+  "ROOT_ID" INTEGER,
+  "RULE_ID" INTEGER,
+  "FUNCTION_KEY" VARCHAR(100),
+  "FACTOR_VALUE" DOUBLE,
+  "FACTOR_UNIT" VARCHAR(100),
+  "OFFSET_VALUE" DOUBLE,
+  "OFFSET_UNIT" VARCHAR(100),
+  "CHARACTERISTIC_ORDER" INTEGER,
+  "ENABLED" BOOLEAN,
+  "CREATED_AT" TIMESTAMP,
+  "UPDATED_AT" TIMESTAMP
+);
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationTest/migrate_measures_on_requirements.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationTest/migrate_measures_on_requirements.xml
deleted file mode 100644 (file)
index a5249ee..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<dataset>
-
-  <!-- Root characteristic -->
-  <characteristics id="1" kee="PORTABILITY" name="Portability" parent_id="[null]" root_id="[null]" rule_id="[null]" characteristic_order="1"
-                   function_key="[null]" factor_value="[null]" factor_unit="[null]" offset_value="[null]" offset_unit="[null]" enabled="[true]"
-                   created_at="2013-11-20" updated_at="2013-11-22"/>
-
-  <!-- Characteristic -->
-  <characteristics id="2" kee="COMPILER_RELATED_PORTABILITY" name="Compiler related portability" parent_id="1" root_id="1" rule_id="[null]" characteristic_order="[null]"
-                   function_key="[null]" factor_value="[null]" factor_unit="[null]" offset_value="[null]" offset_unit="[null]" enabled="[true]"
-                   created_at="2013-11-20" updated_at="2013-11-22"/>
-
-  <!-- Requirement -->
-  <characteristics id="3" kee="[null]" name="[null]" parent_id="2" root_id="1" rule_id="10"
-                   function_key="linear_offset" factor_value="20.0" factor_unit="mn" offset_value="30.0" offset_unit="h" enabled="[true]"
-                   created_at="2013-11-20" updated_at="[null]"/>
-
-
-
-  <!-- Measure linked on requirement -> to be updated -->
-  <project_measures id="1" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    rule_id="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="3" url="[null]" person_id="[null]"
-                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
-
-  <!-- Measure linked on characteristic -> not to be updated -->
-  <project_measures id="2" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    rule_id="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
-
-  <!-- Measure linked on rule -> not to be updated -->
-  <project_measures id="3" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    rule_id="10" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
-
-  <!-- Measure not linked on rule or requirement -> not to be updated -->
-  <project_measures id="4" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    rule_id="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
-
-</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationTest/migrate_measures_on_requirements_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationTest/migrate_measures_on_requirements_result.xml
deleted file mode 100644 (file)
index df20f63..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<dataset>
-
-  <!-- Measure linked on requirement -> to be updated -->
-  <project_measures id="1" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    rule_id="10" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
-
-  <!-- Measure linked on characteristic -> not to be updated -->
-  <project_measures id="2" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    rule_id="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
-
-  <!-- Measure linked on rule -> not to be updated -->
-  <project_measures id="3" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    rule_id="10" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
-
-  <!-- Measure not linked on rule or requirement -> not to be updated -->
-  <project_measures id="4" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    rule_id="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
-
-</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationTest/schema.sql
deleted file mode 100644 (file)
index a60b5de..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
--- 4.3
-
-CREATE TABLE "PROJECT_MEASURES" (
-  "ID" BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
-  "VALUE" DOUBLE,
-  "METRIC_ID" INTEGER NOT NULL,
-  "SNAPSHOT_ID" INTEGER,
-  "RULE_ID" INTEGER,
-  "RULES_CATEGORY_ID" INTEGER,
-  "TEXT_VALUE" VARCHAR(96),
-  "TENDENCY" INTEGER,
-  "MEASURE_DATE" TIMESTAMP,
-  "PROJECT_ID" INTEGER,
-  "ALERT_STATUS" VARCHAR(5),
-  "ALERT_TEXT" VARCHAR(4000),
-  "URL" VARCHAR(2000),
-  "DESCRIPTION" VARCHAR(4000),
-  "RULE_PRIORITY" INTEGER,
-  "CHARACTERISTIC_ID" INTEGER,
-  "PERSON_ID" INTEGER,
-  "VARIATION_VALUE_1" DOUBLE,
-  "VARIATION_VALUE_2" DOUBLE,
-  "VARIATION_VALUE_3" DOUBLE,
-  "VARIATION_VALUE_4" DOUBLE,
-  "VARIATION_VALUE_5" DOUBLE
-);
-
-CREATE TABLE "CHARACTERISTICS" (
-  "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
-  "KEE" VARCHAR(100),
-  "NAME" VARCHAR(100),
-  "PARENT_ID" INTEGER,
-  "ROOT_ID" INTEGER,
-  "RULE_ID" INTEGER,
-  "FUNCTION_KEY" VARCHAR(100),
-  "FACTOR_VALUE" DOUBLE,
-  "FACTOR_UNIT" VARCHAR(100),
-  "OFFSET_VALUE" DOUBLE,
-  "OFFSET_UNIT" VARCHAR(100),
-  "CHARACTERISTIC_ORDER" INTEGER,
-  "ENABLED" BOOLEAN,
-  "CREATED_AT" TIMESTAMP,
-  "UPDATED_AT" TIMESTAMP
-);
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_new_technical_debt_measures.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_new_technical_debt_measures.xml
new file mode 100644 (file)
index 0000000..fec9c9c
--- /dev/null
@@ -0,0 +1,29 @@
+<dataset>
+
+  <!-- Added Technical debt metric -->
+  <metrics delete_historical_data="[null]" id="1" name="new_technical_debt" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]"  domain="[null]" short_name=""
+           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
+
+  <!-- Another metric -->
+  <metrics delete_historical_data="[null]" id="2" name="ncloc" VAL_TYPE="INT" DESCRIPTION="[null]"  domain="[null]" short_name=""
+           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
+
+
+  <!-- Measure with variations on all period -->
+  <project_measures id="1" VALUE="[null]" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="0.1" variation_value_2="0.2" variation_value_3="0.3" variation_value_4="0.4" variation_value_5="0.5"/>
+
+  <!-- Measure with some variations -->
+  <project_measures id="2" VALUE="[null]" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="0.1" variation_value_2="0.2" variation_value_3="0.0" variation_value_4="0.0" variation_value_5="0.0"/>
+
+  <!-- Change on another metric, should not be touched -->
+  <project_measures id="10" VALUE="20" METRIC_ID="2" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
+</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_new_technical_debt_measures_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_new_technical_debt_measures_result.xml
new file mode 100644 (file)
index 0000000..0c77c0f
--- /dev/null
@@ -0,0 +1,21 @@
+<dataset>
+
+  <!-- Measure with variations on all period -->
+  <project_measures id="1" VALUE="[null]" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="48" variation_value_2="96" variation_value_3="144" variation_value_4="192" variation_value_5="240"/>
+
+  <!-- Measure with some variations -->
+  <project_measures id="2" VALUE="[null]" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="48" variation_value_2="96" variation_value_3="0" variation_value_4="0" variation_value_5="0"/>
+
+  <!-- Change on another metric, should not be touched -->
+  <project_measures id="10" VALUE="20" METRIC_ID="2" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
+
+</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_nothing.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_nothing.xml
new file mode 100644 (file)
index 0000000..d4e3f4a
--- /dev/null
@@ -0,0 +1,11 @@
+<dataset>
+
+  <metrics delete_historical_data="[null]" id="2" name="nclc" VAL_TYPE="INTEGER" DESCRIPTION="[null]"  domain="[null]" short_name=""
+           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
+
+  <project_measures id="2" VALUE="1.0" METRIC_ID="2" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/>
+
+</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_nothing_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_nothing_result.xml
new file mode 100644 (file)
index 0000000..d4e3f4a
--- /dev/null
@@ -0,0 +1,11 @@
+<dataset>
+
+  <metrics delete_historical_data="[null]" id="2" name="nclc" VAL_TYPE="INTEGER" DESCRIPTION="[null]"  domain="[null]" short_name=""
+           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
+
+  <project_measures id="2" VALUE="1.0" METRIC_ID="2" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/>
+
+</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_sqale_measures.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_sqale_measures.xml
new file mode 100644 (file)
index 0000000..b9081d8
--- /dev/null
@@ -0,0 +1,64 @@
+<dataset>
+
+  <!-- sqale_effort_to_grade_X -->
+  <metrics delete_historical_data="[null]" id="2" name="sqale_effort_to_grade_a" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]"  domain="[null]" short_name=""
+           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
+  <metrics delete_historical_data="[null]" id="3" name="sqale_effort_to_grade_b" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]"  domain="[null]" short_name=""
+           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
+  <metrics delete_historical_data="[null]" id="4" name="sqale_effort_to_grade_c" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]"  domain="[null]" short_name=""
+           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
+  <metrics delete_historical_data="[null]" id="5" name="sqale_effort_to_grade_d" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]"  domain="[null]" short_name=""
+           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
+
+  <!-- debt by severity -->
+  <metrics delete_historical_data="[null]" id="6" name="blocker_remediation_cost" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]"  domain="[null]" short_name=""
+           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
+  <metrics delete_historical_data="[null]" id="7" name="critical_remediation_cost" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]"  domain="[null]" short_name=""
+           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
+  <metrics delete_historical_data="[null]" id="8" name="major_remediation_cost" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]"  domain="[null]" short_name=""
+           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
+  <metrics delete_historical_data="[null]" id="9" name="minor_remediation_cost" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]"  domain="[null]" short_name=""
+           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
+  <metrics delete_historical_data="[null]" id="10" name="info_remediation_cost" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]"  domain="[null]" short_name=""
+           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
+
+
+  <project_measures id="2" VALUE="1.0" METRIC_ID="2" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/>
+  <project_measures id="3" VALUE="1.0" METRIC_ID="3" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/>
+  <project_measures id="4" VALUE="1.0" METRIC_ID="4" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/>
+  <project_measures id="5" VALUE="1.0" METRIC_ID="5" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/>
+
+  <project_measures id="6" VALUE="1.0" METRIC_ID="6" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/>
+  <project_measures id="7" VALUE="1.0" METRIC_ID="7" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/>
+  <project_measures id="8" VALUE="1.0" METRIC_ID="8" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/>
+  <project_measures id="9" VALUE="1.0" METRIC_ID="9" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/>
+  <project_measures id="10" VALUE="1.0" METRIC_ID="10" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/>
+
+</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_sqale_measures_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_sqale_measures_result.xml
new file mode 100644 (file)
index 0000000..b0e80bd
--- /dev/null
@@ -0,0 +1,41 @@
+<dataset>
+
+  <project_measures id="2" VALUE="480" METRIC_ID="2" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/>
+  <project_measures id="3" VALUE="480" METRIC_ID="3" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/>
+  <project_measures id="4" VALUE="480" METRIC_ID="4" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/>
+  <project_measures id="5" VALUE="480" METRIC_ID="5" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/>
+
+  <project_measures id="6" VALUE="480" METRIC_ID="6" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/>
+  <project_measures id="7" VALUE="480" METRIC_ID="7" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/>
+  <project_measures id="8" VALUE="480" METRIC_ID="8" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/>
+  <project_measures id="9" VALUE="480" METRIC_ID="9" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/>
+  <project_measures id="10" VALUE="480" METRIC_ID="10" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/>
+
+</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_technical_debt_measures.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_technical_debt_measures.xml
new file mode 100644 (file)
index 0000000..80c512c
--- /dev/null
@@ -0,0 +1,35 @@
+<dataset>
+
+  <!-- Technical debt metric -->
+  <metrics delete_historical_data="[null]" id="1" name="sqale_index" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]"  domain="[null]" short_name=""
+           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
+
+  <!-- Another metric -->
+  <metrics delete_historical_data="[null]" id="2" name="ncloc" VAL_TYPE="INT" DESCRIPTION="[null]"  domain="[null]" short_name=""
+           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
+
+
+  <!-- Value 1 day of debt -->
+  <project_measures id="1" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
+
+  <!-- Measure with variations on all period -->
+  <project_measures id="2" VALUE="2.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/>
+
+  <!-- Measure with some variations -->
+  <project_measures id="3" VALUE="3.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="0.1" variation_value_2="0.2" variation_value_3="0.0" variation_value_4="0.0" variation_value_5="0.0"/>
+
+  <!-- Change on another metric, should not be touched -->
+  <project_measures id="10" VALUE="20" METRIC_ID="2" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
+</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_technical_debt_measures_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_technical_debt_measures_result.xml
new file mode 100644 (file)
index 0000000..2a3e206
--- /dev/null
@@ -0,0 +1,27 @@
+<dataset>
+
+  <!-- Value 1 day, 1 hour and 1 minute of debt -->
+  <project_measures id="1" VALUE="480" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
+
+  <!-- Measure with variations on all period -->
+  <project_measures id="2" VALUE="960" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/>
+
+  <!-- Measure with some variations -->
+  <project_measures id="3" VALUE="1440" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="48" variation_value_2="96" variation_value_3="0" variation_value_4="0" variation_value_5="0"/>
+
+  <!-- Change on another metric, should not be touched -->
+  <project_measures id="10" VALUE="20" METRIC_ID="2" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
+                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
+
+</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/schema.sql
new file mode 100644 (file)
index 0000000..1e29613
--- /dev/null
@@ -0,0 +1,45 @@
+-- 4.3
+
+CREATE TABLE "PROJECT_MEASURES" (
+  "ID" BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+  "VALUE" DOUBLE,
+  "METRIC_ID" INTEGER NOT NULL,
+  "SNAPSHOT_ID" INTEGER,
+  "RULE_ID" INTEGER,
+  "RULES_CATEGORY_ID" INTEGER,
+  "TEXT_VALUE" VARCHAR(96),
+  "TENDENCY" INTEGER,
+  "MEASURE_DATE" TIMESTAMP,
+  "PROJECT_ID" INTEGER,
+  "ALERT_STATUS" VARCHAR(5),
+  "ALERT_TEXT" VARCHAR(4000),
+  "URL" VARCHAR(2000),
+  "DESCRIPTION" VARCHAR(4000),
+  "RULE_PRIORITY" INTEGER,
+  "CHARACTERISTIC_ID" INTEGER,
+  "PERSON_ID" INTEGER,
+  "VARIATION_VALUE_1" DOUBLE,
+  "VARIATION_VALUE_2" DOUBLE,
+  "VARIATION_VALUE_3" DOUBLE,
+  "VARIATION_VALUE_4" DOUBLE,
+  "VARIATION_VALUE_5" DOUBLE
+);
+
+CREATE TABLE "METRICS" (
+  "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+  "NAME" VARCHAR(64) NOT NULL,
+  "DESCRIPTION" VARCHAR(255),
+  "DIRECTION" INTEGER NOT NULL DEFAULT 0,
+  "DOMAIN" VARCHAR(64),
+  "SHORT_NAME" VARCHAR(64),
+  "QUALITATIVE" BOOLEAN NOT NULL DEFAULT FALSE,
+  "VAL_TYPE" VARCHAR(8),
+  "USER_MANAGED" BOOLEAN DEFAULT FALSE,
+  "ENABLED" BOOLEAN DEFAULT TRUE,
+  "ORIGIN" VARCHAR(3),
+  "WORST_VALUE" DOUBLE,
+  "BEST_VALUE" DOUBLE,
+  "OPTIMIZED_BEST_VALUE" BOOLEAN,
+  "HIDDEN" BOOLEAN,
+  "DELETE_HISTORICAL_DATA" BOOLEAN
+);
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_new_technical_debt_measures.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_new_technical_debt_measures.xml
deleted file mode 100644 (file)
index fec9c9c..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<dataset>
-
-  <!-- Added Technical debt metric -->
-  <metrics delete_historical_data="[null]" id="1" name="new_technical_debt" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]"  domain="[null]" short_name=""
-           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
-
-  <!-- Another metric -->
-  <metrics delete_historical_data="[null]" id="2" name="ncloc" VAL_TYPE="INT" DESCRIPTION="[null]"  domain="[null]" short_name=""
-           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
-
-
-  <!-- Measure with variations on all period -->
-  <project_measures id="1" VALUE="[null]" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="0.1" variation_value_2="0.2" variation_value_3="0.3" variation_value_4="0.4" variation_value_5="0.5"/>
-
-  <!-- Measure with some variations -->
-  <project_measures id="2" VALUE="[null]" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="0.1" variation_value_2="0.2" variation_value_3="0.0" variation_value_4="0.0" variation_value_5="0.0"/>
-
-  <!-- Change on another metric, should not be touched -->
-  <project_measures id="10" VALUE="20" METRIC_ID="2" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
-</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_new_technical_debt_measures_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_new_technical_debt_measures_result.xml
deleted file mode 100644 (file)
index 0c77c0f..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<dataset>
-
-  <!-- Measure with variations on all period -->
-  <project_measures id="1" VALUE="[null]" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="48" variation_value_2="96" variation_value_3="144" variation_value_4="192" variation_value_5="240"/>
-
-  <!-- Measure with some variations -->
-  <project_measures id="2" VALUE="[null]" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="48" variation_value_2="96" variation_value_3="0" variation_value_4="0" variation_value_5="0"/>
-
-  <!-- Change on another metric, should not be touched -->
-  <project_measures id="10" VALUE="20" METRIC_ID="2" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
-
-</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_nothing.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_nothing.xml
deleted file mode 100644 (file)
index d4e3f4a..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<dataset>
-
-  <metrics delete_historical_data="[null]" id="2" name="nclc" VAL_TYPE="INTEGER" DESCRIPTION="[null]"  domain="[null]" short_name=""
-           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
-
-  <project_measures id="2" VALUE="1.0" METRIC_ID="2" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/>
-
-</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_nothing_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_nothing_result.xml
deleted file mode 100644 (file)
index d4e3f4a..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<dataset>
-
-  <metrics delete_historical_data="[null]" id="2" name="nclc" VAL_TYPE="INTEGER" DESCRIPTION="[null]"  domain="[null]" short_name=""
-           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
-
-  <project_measures id="2" VALUE="1.0" METRIC_ID="2" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/>
-
-</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_sqale_measures.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_sqale_measures.xml
deleted file mode 100644 (file)
index b9081d8..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-<dataset>
-
-  <!-- sqale_effort_to_grade_X -->
-  <metrics delete_historical_data="[null]" id="2" name="sqale_effort_to_grade_a" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]"  domain="[null]" short_name=""
-           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
-  <metrics delete_historical_data="[null]" id="3" name="sqale_effort_to_grade_b" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]"  domain="[null]" short_name=""
-           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
-  <metrics delete_historical_data="[null]" id="4" name="sqale_effort_to_grade_c" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]"  domain="[null]" short_name=""
-           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
-  <metrics delete_historical_data="[null]" id="5" name="sqale_effort_to_grade_d" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]"  domain="[null]" short_name=""
-           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
-
-  <!-- debt by severity -->
-  <metrics delete_historical_data="[null]" id="6" name="blocker_remediation_cost" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]"  domain="[null]" short_name=""
-           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
-  <metrics delete_historical_data="[null]" id="7" name="critical_remediation_cost" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]"  domain="[null]" short_name=""
-           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
-  <metrics delete_historical_data="[null]" id="8" name="major_remediation_cost" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]"  domain="[null]" short_name=""
-           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
-  <metrics delete_historical_data="[null]" id="9" name="minor_remediation_cost" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]"  domain="[null]" short_name=""
-           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
-  <metrics delete_historical_data="[null]" id="10" name="info_remediation_cost" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]"  domain="[null]" short_name=""
-           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
-
-
-  <project_measures id="2" VALUE="1.0" METRIC_ID="2" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/>
-  <project_measures id="3" VALUE="1.0" METRIC_ID="3" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/>
-  <project_measures id="4" VALUE="1.0" METRIC_ID="4" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/>
-  <project_measures id="5" VALUE="1.0" METRIC_ID="5" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/>
-
-  <project_measures id="6" VALUE="1.0" METRIC_ID="6" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/>
-  <project_measures id="7" VALUE="1.0" METRIC_ID="7" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/>
-  <project_measures id="8" VALUE="1.0" METRIC_ID="8" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/>
-  <project_measures id="9" VALUE="1.0" METRIC_ID="9" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/>
-  <project_measures id="10" VALUE="1.0" METRIC_ID="10" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/>
-
-</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_sqale_measures_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_sqale_measures_result.xml
deleted file mode 100644 (file)
index b0e80bd..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-<dataset>
-
-  <project_measures id="2" VALUE="480" METRIC_ID="2" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/>
-  <project_measures id="3" VALUE="480" METRIC_ID="3" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/>
-  <project_measures id="4" VALUE="480" METRIC_ID="4" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/>
-  <project_measures id="5" VALUE="480" METRIC_ID="5" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/>
-
-  <project_measures id="6" VALUE="480" METRIC_ID="6" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/>
-  <project_measures id="7" VALUE="480" METRIC_ID="7" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/>
-  <project_measures id="8" VALUE="480" METRIC_ID="8" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/>
-  <project_measures id="9" VALUE="480" METRIC_ID="9" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/>
-  <project_measures id="10" VALUE="480" METRIC_ID="10" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/>
-
-</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_technical_debt_measures.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_technical_debt_measures.xml
deleted file mode 100644 (file)
index 80c512c..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<dataset>
-
-  <!-- Technical debt metric -->
-  <metrics delete_historical_data="[null]" id="1" name="sqale_index" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]"  domain="[null]" short_name=""
-           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
-
-  <!-- Another metric -->
-  <metrics delete_historical_data="[null]" id="2" name="ncloc" VAL_TYPE="INT" DESCRIPTION="[null]"  domain="[null]" short_name=""
-           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
-
-
-  <!-- Value 1 day of debt -->
-  <project_measures id="1" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
-
-  <!-- Measure with variations on all period -->
-  <project_measures id="2" VALUE="2.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/>
-
-  <!-- Measure with some variations -->
-  <project_measures id="3" VALUE="3.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="0.1" variation_value_2="0.2" variation_value_3="0.0" variation_value_4="0.0" variation_value_5="0.0"/>
-
-  <!-- Change on another metric, should not be touched -->
-  <project_measures id="10" VALUE="20" METRIC_ID="2" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
-</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_technical_debt_measures_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_technical_debt_measures_result.xml
deleted file mode 100644 (file)
index 2a3e206..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<dataset>
-
-  <!-- Value 1 day, 1 hour and 1 minute of debt -->
-  <project_measures id="1" VALUE="480" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
-
-  <!-- Measure with variations on all period -->
-  <project_measures id="2" VALUE="960" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/>
-
-  <!-- Measure with some variations -->
-  <project_measures id="3" VALUE="1440" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="48" variation_value_2="96" variation_value_3="0" variation_value_4="0" variation_value_5="0"/>
-
-  <!-- Change on another metric, should not be touched -->
-  <project_measures id="10" VALUE="20" METRIC_ID="2" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
-                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
-                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
-                    variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/>
-
-</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/schema.sql
deleted file mode 100644 (file)
index 1e29613..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
--- 4.3
-
-CREATE TABLE "PROJECT_MEASURES" (
-  "ID" BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
-  "VALUE" DOUBLE,
-  "METRIC_ID" INTEGER NOT NULL,
-  "SNAPSHOT_ID" INTEGER,
-  "RULE_ID" INTEGER,
-  "RULES_CATEGORY_ID" INTEGER,
-  "TEXT_VALUE" VARCHAR(96),
-  "TENDENCY" INTEGER,
-  "MEASURE_DATE" TIMESTAMP,
-  "PROJECT_ID" INTEGER,
-  "ALERT_STATUS" VARCHAR(5),
-  "ALERT_TEXT" VARCHAR(4000),
-  "URL" VARCHAR(2000),
-  "DESCRIPTION" VARCHAR(4000),
-  "RULE_PRIORITY" INTEGER,
-  "CHARACTERISTIC_ID" INTEGER,
-  "PERSON_ID" INTEGER,
-  "VARIATION_VALUE_1" DOUBLE,
-  "VARIATION_VALUE_2" DOUBLE,
-  "VARIATION_VALUE_3" DOUBLE,
-  "VARIATION_VALUE_4" DOUBLE,
-  "VARIATION_VALUE_5" DOUBLE
-);
-
-CREATE TABLE "METRICS" (
-  "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
-  "NAME" VARCHAR(64) NOT NULL,
-  "DESCRIPTION" VARCHAR(255),
-  "DIRECTION" INTEGER NOT NULL DEFAULT 0,
-  "DOMAIN" VARCHAR(64),
-  "SHORT_NAME" VARCHAR(64),
-  "QUALITATIVE" BOOLEAN NOT NULL DEFAULT FALSE,
-  "VAL_TYPE" VARCHAR(8),
-  "USER_MANAGED" BOOLEAN DEFAULT FALSE,
-  "ENABLED" BOOLEAN DEFAULT TRUE,
-  "ORIGIN" VARCHAR(3),
-  "WORST_VALUE" DOUBLE,
-  "BEST_VALUE" DOUBLE,
-  "OPTIMIZED_BEST_VALUE" BOOLEAN,
-  "HIDDEN" BOOLEAN,
-  "DELETE_HISTORICAL_DATA" BOOLEAN
-);