]> source.dussan.org Git - sonarqube.git/commitdiff
Improve naming of migration IssueMigration
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 19 Jun 2014 13:10:18 +0000 (15:10 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 19 Jun 2014 13:10:27 +0000 (15:10 +0200)
13 files changed:
sonar-server/src/main/java/org/sonar/server/db/migrations/DatabaseMigrations.java
sonar-server/src/main/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigration.java [new file with mode: 0644]
sonar-server/src/main/java/org/sonar/server/db/migrations/v43/IssueMigration.java [deleted file]
sonar-server/src/main/webapp/WEB-INF/db/migrate/513_convert_issue_debt_to_minutes.rb [new file with mode: 0644]
sonar-server/src/main/webapp/WEB-INF/db/migrate/513_update_issue_debt_to_minutes.rb [deleted file]
sonar-server/src/test/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationTest.java [new file with mode: 0644]
sonar-server/src/test/java/org/sonar/server/db/migrations/v43/IssueMigrationTest.java [deleted file]
sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationTest/migrate_issues_debt.xml [new file with mode: 0644]
sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationTest/migrate_issues_debt_result.xml [new file with mode: 0644]
sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationTest/schema.sql [new file with mode: 0644]
sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueMigrationTest/migrate_issues_debt.xml [deleted file]
sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueMigrationTest/migrate_issues_debt_result.xml [deleted file]
sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueMigrationTest/schema.sql [deleted file]

index 414c27a7e3d9b68bfe86ef55723ef58531e51bc6..6576795845290ff7ee9968384f5a7d62b69cf0fc 100644 (file)
@@ -23,9 +23,9 @@ import com.google.common.collect.ImmutableList;
 import org.sonar.server.db.migrations.v36.ViolationMigration;
 import org.sonar.server.db.migrations.v42.CompleteIssueMessageMigration;
 import org.sonar.server.db.migrations.v42.PackageKeysMigration;
+import org.sonar.server.db.migrations.v43.ConvertIssueDebtToMinutesMigration;
 import org.sonar.server.db.migrations.v43.DevelopmentCostMeasuresMigration;
 import org.sonar.server.db.migrations.v43.IssueChangelogMigration;
-import org.sonar.server.db.migrations.v43.IssueMigration;
 import org.sonar.server.db.migrations.v43.NotResolvedIssuesOnRemovedComponentsMigration;
 import org.sonar.server.db.migrations.v43.RequirementMeasuresMigration;
 import org.sonar.server.db.migrations.v43.TechnicalDebtMeasuresMigration;
@@ -45,7 +45,7 @@ public interface DatabaseMigrations {
     PackageKeysMigration.class, CompleteIssueMessageMigration.class,
 
     // 4.3
-    IssueMigration.class,
+    ConvertIssueDebtToMinutesMigration.class,
     IssueChangelogMigration.class,
     TechnicalDebtMeasuresMigration.class,
     DevelopmentCostMeasuresMigration.class,
diff --git a/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigration.java b/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigration.java
new file mode 100644 (file)
index 0000000..7739ea4
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * 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 com.google.common.annotations.VisibleForTesting;
+import org.sonar.api.utils.System2;
+import org.sonar.core.persistence.Database;
+import org.sonar.core.properties.PropertiesDao;
+import org.sonar.server.db.migrations.DatabaseMigration;
+import org.sonar.server.db.migrations.MassUpdater;
+import org.sonar.server.db.migrations.SqlUtil;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Timestamp;
+
+/**
+ * Used in the Active Record Migration 513
+ * @since 4.3
+ */
+public class ConvertIssueDebtToMinutesMigration implements DatabaseMigration {
+
+  private final WorkDurationConvertor workDurationConvertor;
+  private final System2 system2;
+  private final Database db;
+
+  public ConvertIssueDebtToMinutesMigration(Database database, PropertiesDao propertiesDao) {
+    this(database, propertiesDao, System2.INSTANCE);
+  }
+
+  @VisibleForTesting
+  ConvertIssueDebtToMinutesMigration(Database database, PropertiesDao propertiesDao, System2 system2) {
+    this.db = database;
+    this.workDurationConvertor = new WorkDurationConvertor(propertiesDao);
+    this.system2 = system2;
+  }
+
+  @Override
+  public void execute() {
+    new MassUpdater(db).execute(
+      new MassUpdater.InputLoader<Row>() {
+        @Override
+        public String selectSql() {
+          return "SELECT i.id, i.technical_debt FROM issues i";
+        }
+
+        @Override
+        public Row load(ResultSet rs) throws SQLException {
+          Long debt = SqlUtil.getLong(rs, 2);
+          if (!rs.wasNull() && debt != null) {
+            // See https://jira.codehaus.org/browse/SONAR-5394
+            // The SQL request should not set the filter on technical_debt is not null. There's no index
+            // on this column, so filtering is done programmatically.
+            Row row = new Row();
+            row.id = SqlUtil.getLong(rs, 1);
+            row.debt = debt;
+            return row;
+          }
+          return null;
+        }
+      },
+      new MassUpdater.InputConverter<Row>() {
+        @Override
+        public String updateSql() {
+          return "UPDATE issues SET technical_debt=?,updated_at=? WHERE id=?";
+        }
+
+        @Override
+        public boolean convert(Row row, PreparedStatement updateStatement) throws SQLException {
+          updateStatement.setLong(1, workDurationConvertor.createFromLong(row.debt));
+          updateStatement.setTimestamp(2, new Timestamp(system2.now()));
+          updateStatement.setLong(3, row.id);
+          return true;
+        }
+      }
+    );
+  }
+
+  private static class Row {
+    private Long id;
+    private Long debt;
+  }
+
+}
diff --git a/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/IssueMigration.java b/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/IssueMigration.java
deleted file mode 100644 (file)
index 019c3c0..0000000
+++ /dev/null
@@ -1,103 +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 com.google.common.annotations.VisibleForTesting;
-import org.sonar.api.utils.System2;
-import org.sonar.core.persistence.Database;
-import org.sonar.core.properties.PropertiesDao;
-import org.sonar.server.db.migrations.DatabaseMigration;
-import org.sonar.server.db.migrations.MassUpdater;
-import org.sonar.server.db.migrations.SqlUtil;
-
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Timestamp;
-
-/**
- * Used in the Active Record Migration 513
- * @since 4.3
- */
-public class IssueMigration implements DatabaseMigration {
-
-  private final WorkDurationConvertor workDurationConvertor;
-  private final System2 system2;
-  private final Database db;
-
-  public IssueMigration(Database database, PropertiesDao propertiesDao) {
-    this(database, propertiesDao, System2.INSTANCE);
-  }
-
-  @VisibleForTesting
-  IssueMigration(Database database, PropertiesDao propertiesDao, System2 system2) {
-    this.db = database;
-    this.workDurationConvertor = new WorkDurationConvertor(propertiesDao);
-    this.system2 = system2;
-  }
-
-  @Override
-  public void execute() {
-    new MassUpdater(db).execute(
-      new MassUpdater.InputLoader<Row>() {
-        @Override
-        public String selectSql() {
-          return "SELECT i.id, i.technical_debt FROM issues i";
-        }
-
-        @Override
-        public Row load(ResultSet rs) throws SQLException {
-          Long debt = SqlUtil.getLong(rs, 2);
-          if (!rs.wasNull() && debt != null) {
-            // See https://jira.codehaus.org/browse/SONAR-5394
-            // The SQL request should not set the filter on technical_debt is not null. There's no index
-            // on this column, so filtering is done programmatically.
-            Row row = new Row();
-            row.id = SqlUtil.getLong(rs, 1);
-            row.debt = debt;
-            return row;
-          }
-          return null;
-        }
-      },
-      new MassUpdater.InputConverter<Row>() {
-        @Override
-        public String updateSql() {
-          return "UPDATE issues SET technical_debt=?,updated_at=? WHERE id=?";
-        }
-
-        @Override
-        public boolean convert(Row row, PreparedStatement updateStatement) throws SQLException {
-          updateStatement.setLong(1, workDurationConvertor.createFromLong(row.debt));
-          updateStatement.setTimestamp(2, new Timestamp(system2.now()));
-          updateStatement.setLong(3, row.id);
-          return true;
-        }
-      }
-    );
-  }
-
-  private static class Row {
-    private Long id;
-    private Long debt;
-  }
-
-}
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/513_convert_issue_debt_to_minutes.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/513_convert_issue_debt_to_minutes.rb
new file mode 100644 (file)
index 0000000..96a9ce3
--- /dev/null
@@ -0,0 +1,30 @@
+#
+# 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.
+#
+
+#
+# SonarQube 4.3
+# SONAR-4996
+#
+class ConvertIssueDebtToMinutes < ActiveRecord::Migration
+
+  def self.up
+    Java::OrgSonarServerUi::JRubyFacade.getInstance().databaseMigrator().executeMigration('org.sonar.server.db.migrations.v43.ConvertIssueDebtToMinutesMigration')
+  end
+end
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/513_update_issue_debt_to_minutes.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/513_update_issue_debt_to_minutes.rb
deleted file mode 100644 (file)
index 4c46e52..0000000
+++ /dev/null
@@ -1,30 +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.
-#
-
-#
-# SonarQube 4.3
-# SONAR-4996
-#
-class UpdateIssueDebtToMinutes < ActiveRecord::Migration
-
-  def self.up
-    Java::OrgSonarServerUi::JRubyFacade.getInstance().databaseMigrator().executeMigration('org.sonar.server.db.migrations.v43.IssueMigration')
-  end
-end
diff --git a/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationTest.java b/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationTest.java
new file mode 100644 (file)
index 0000000..ceaeafc
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * 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.TestDatabase;
+import org.sonar.core.properties.PropertiesDao;
+import org.sonar.core.properties.PropertyDto;
+
+import static org.mockito.Mockito.when;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ConvertIssueDebtToMinutesMigrationTest {
+
+  @ClassRule
+  public static TestDatabase db = new TestDatabase().schema(ConvertIssueDebtToMinutesMigrationTest.class, "schema.sql");
+
+  @Mock
+  System2 system2;
+
+  @Mock
+  PropertiesDao propertiesDao;
+
+  ConvertIssueDebtToMinutesMigration 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 ConvertIssueDebtToMinutesMigration(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", "issues");
+  }
+
+}
diff --git a/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/IssueMigrationTest.java b/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/IssueMigrationTest.java
deleted file mode 100644 (file)
index 3b4eace..0000000
+++ /dev/null
@@ -1,68 +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.TestDatabase;
-import org.sonar.core.properties.PropertiesDao;
-import org.sonar.core.properties.PropertyDto;
-
-import static org.mockito.Mockito.when;
-
-@RunWith(MockitoJUnitRunner.class)
-public class IssueMigrationTest {
-
-  @ClassRule
-  public static TestDatabase db = new TestDatabase().schema(IssueMigrationTest.class, "schema.sql");
-
-  @Mock
-  System2 system2;
-
-  @Mock
-  PropertiesDao propertiesDao;
-
-  IssueMigration 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 IssueMigration(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", "issues");
-  }
-
-}
diff --git a/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationTest/migrate_issues_debt.xml b/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationTest/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/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationTest/migrate_issues_debt_result.xml b/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationTest/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/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationTest/schema.sql b/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationTest/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/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueMigrationTest/migrate_issues_debt.xml b/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueMigrationTest/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/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueMigrationTest/migrate_issues_debt_result.xml b/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueMigrationTest/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/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueMigrationTest/schema.sql b/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueMigrationTest/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
-);