From: Julien Lancelot Date: Thu, 23 Apr 2015 11:55:35 +0000 (+0200) Subject: Fix quality flaws X-Git-Tag: 5.2-RC1~2138 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=95e69a01662afe0ec65636ba4c5afeada4cb51e8;p=sonarqube.git Fix quality flaws --- diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStep.java index 3f0ef33b29b..6b2142ddc79 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStep.java +++ b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStep.java @@ -20,10 +20,6 @@ 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 index 00000000000..9ec7e533efc --- /dev/null +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest.java @@ -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> 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 index 2e755192bb4..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationTest.java +++ /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> 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 index 00000000000..f92e48eb2cf --- /dev/null +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest.java @@ -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 index d96c8e86390..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationTest.java +++ /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 index 00000000000..1f8e3e2b451 --- /dev/null +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest.java @@ -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 index 18f2106ca6b..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/IssueChangelogMigrationTest.java +++ /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 index 00000000000..bc8b1f0f5f4 --- /dev/null +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest.java @@ -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 index 9f126ab9991..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationTest.java +++ /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 index 00000000000..2ab4f606e94 --- /dev/null +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest.java @@ -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 index be7c894a762..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationTest.java +++ /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 index 00000000000..bb83cac65f3 --- /dev/null +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest.java @@ -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 index 9b64cb67a45..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest.java +++ /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 index 00000000000..7717330b452 --- /dev/null +++ b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/migrate_issues_debt.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + 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 index 00000000000..c8d9eaecc06 --- /dev/null +++ b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/migrate_issues_debt_result.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + 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 index 00000000000..f3f71cfa229 --- /dev/null +++ b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/schema.sql @@ -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 index 7717330b452..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationTest/migrate_issues_debt.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - 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 index c8d9eaecc06..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationTest/migrate_issues_debt_result.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - 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 index f3f71cfa229..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationTest/schema.sql +++ /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 index 00000000000..0fb812f9a3d --- /dev/null +++ b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/metric_does_not_exist.xml @@ -0,0 +1,12 @@ + + + + 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 index 00000000000..0fb812f9a3d --- /dev/null +++ b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/metric_does_not_exist_result.xml @@ -0,0 +1,12 @@ + + + + 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 index 00000000000..2d1633de2ff --- /dev/null +++ b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/migrate_dev_cost_measures.xml @@ -0,0 +1,12 @@ + + + + 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 index 00000000000..6db169e5b2e --- /dev/null +++ b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/migrate_dev_cost_measures_result.xml @@ -0,0 +1,8 @@ + + + + + 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 index 00000000000..1e29613934e --- /dev/null +++ b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/schema.sql @@ -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 index 0fb812f9a3d..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationTest/metric_does_not_exist.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - 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 index 0fb812f9a3d..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationTest/metric_does_not_exist_result.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - 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 index 2d1633de2ff..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationTest/migrate_dev_cost_measures.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - 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 index 6db169e5b2e..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationTest/migrate_dev_cost_measures_result.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - 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 index 1e29613934e..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationTest/schema.sql +++ /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 index 00000000000..5116d3e270d --- /dev/null +++ b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest/migrate_issue_changelog_debt.xml @@ -0,0 +1,10 @@ + + + + + + + + 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 index 00000000000..a42f67e500b --- /dev/null +++ b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest/migrate_issue_changelog_debt_result.xml @@ -0,0 +1,11 @@ + + + + + + + + + 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 index 00000000000..b6bcd85c6ff --- /dev/null +++ b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest/schema.sql @@ -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 index 5116d3e270d..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationTest/migrate_issue_changelog_debt.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - 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 index a42f67e500b..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationTest/migrate_issue_changelog_debt_result.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - 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 index b6bcd85c6ff..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationTest/schema.sql +++ /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 index 00000000000..1e7e5ab984c --- /dev/null +++ b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/migrate_issues.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + 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 index 00000000000..4509c279724 --- /dev/null +++ b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/migrate_issues_result.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + 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 index 00000000000..c0129aa79f5 --- /dev/null +++ b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/schema.sql @@ -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 index 1e7e5ab984c..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationTest/migrate_issues.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - 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 index 4509c279724..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationTest/migrate_issues_result.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - 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 index c0129aa79f5..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationTest/schema.sql +++ /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 index 00000000000..a5249ee19f0 --- /dev/null +++ b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest/migrate_measures_on_requirements.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + 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 index 00000000000..df20f63c880 --- /dev/null +++ b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest/migrate_measures_on_requirements_result.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + 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 index 00000000000..a60b5de5b5d --- /dev/null +++ b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest/schema.sql @@ -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 index a5249ee19f0..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationTest/migrate_measures_on_requirements.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - 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 index df20f63c880..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationTest/migrate_measures_on_requirements_result.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - 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 index a60b5de5b5d..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationTest/schema.sql +++ /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 index 00000000000..fec9c9c2d58 --- /dev/null +++ b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_new_technical_debt_measures.xml @@ -0,0 +1,29 @@ + + + + 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 index 00000000000..0c77c0fb524 --- /dev/null +++ b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_new_technical_debt_measures_result.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + 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 index 00000000000..d4e3f4a0101 --- /dev/null +++ b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_nothing.xml @@ -0,0 +1,11 @@ + + + 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 index 00000000000..d4e3f4a0101 --- /dev/null +++ b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_nothing_result.xml @@ -0,0 +1,11 @@ + + + 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 index 00000000000..b9081d8e285 --- /dev/null +++ b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_sqale_measures.xml @@ -0,0 +1,64 @@ + + + + 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 index 00000000000..b0e80bd9cf8 --- /dev/null +++ b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_sqale_measures_result.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + 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 index 00000000000..80c512c14dd --- /dev/null +++ b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_technical_debt_measures.xml @@ -0,0 +1,35 @@ + + + + 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 index 00000000000..2a3e2068a0f --- /dev/null +++ b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_technical_debt_measures_result.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + 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 index 00000000000..1e29613934e --- /dev/null +++ b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/schema.sql @@ -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 index fec9c9c2d58..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_new_technical_debt_measures.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - 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 index 0c77c0fb524..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_new_technical_debt_measures_result.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - 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 index d4e3f4a0101..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_nothing.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - 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 index d4e3f4a0101..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_nothing_result.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - 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 index b9081d8e285..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_sqale_measures.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - 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 index b0e80bd9cf8..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_sqale_measures_result.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - 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 index 80c512c14dd..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_technical_debt_measures.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - 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 index 2a3e2068a0f..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_technical_debt_measures_result.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - 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 index 1e29613934e..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/schema.sql +++ /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 -);