diff options
Diffstat (limited to 'server')
139 files changed, 3 insertions, 6419 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/MigrationStepModule.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/MigrationStepModule.java index f20252a9e75..7685c9f02e9 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/MigrationStepModule.java +++ b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/MigrationStepModule.java @@ -20,22 +20,6 @@ package org.sonar.server.db.migrations; import org.sonar.core.platform.Module; -import org.sonar.server.db.migrations.v42.CompleteIssueMessageMigrationStep; -import org.sonar.server.db.migrations.v42.PackageKeysMigrationStep; -import org.sonar.server.db.migrations.v43.ConvertIssueDebtToMinutesMigrationStep; -import org.sonar.server.db.migrations.v43.DevelopmentCostMeasuresMigrationStep; -import org.sonar.server.db.migrations.v43.IssueChangelogMigrationStep; -import org.sonar.server.db.migrations.v43.NotResolvedIssuesOnRemovedComponentsMigrationStep; -import org.sonar.server.db.migrations.v43.RequirementMeasuresMigrationStep; -import org.sonar.server.db.migrations.v43.TechnicalDebtMeasuresMigrationStep; -import org.sonar.server.db.migrations.v44.ChangeLogMigrationStep; -import org.sonar.server.db.migrations.v44.ConvertProfileMeasuresMigrationStep; -import org.sonar.server.db.migrations.v44.FeedQProfileDatesMigrationStep; -import org.sonar.server.db.migrations.v44.FeedQProfileKeysMigrationStep; -import org.sonar.server.db.migrations.v44.IssueActionPlanKeyMigrationStep; -import org.sonar.server.db.migrations.v44.MeasureDataMigrationStep; -import org.sonar.server.db.migrations.v45.AddMissingRuleParameterDefaultValuesMigrationStep; -import org.sonar.server.db.migrations.v45.DeleteMeasuresOnDeletedProfilesMigrationStep; import org.sonar.server.db.migrations.v451.AddMissingCustomRuleParametersMigrationStep; import org.sonar.server.db.migrations.v451.DeleteUnescapedActivities; import org.sonar.server.db.migrations.v50.FeedFileSources; @@ -77,29 +61,6 @@ public class MigrationStepModule extends Module { @Override protected void configureModule() { add( - // 4.2 - PackageKeysMigrationStep.class, CompleteIssueMessageMigrationStep.class, - - // 4.3 - ConvertIssueDebtToMinutesMigrationStep.class, - IssueChangelogMigrationStep.class, - TechnicalDebtMeasuresMigrationStep.class, - DevelopmentCostMeasuresMigrationStep.class, - RequirementMeasuresMigrationStep.class, - NotResolvedIssuesOnRemovedComponentsMigrationStep.class, - - // 4.4 - IssueActionPlanKeyMigrationStep.class, - MeasureDataMigrationStep.class, - FeedQProfileKeysMigrationStep.class, - FeedQProfileDatesMigrationStep.class, - ChangeLogMigrationStep.class, - ConvertProfileMeasuresMigrationStep.class, - - // 4.5 - AddMissingRuleParameterDefaultValuesMigrationStep.class, - DeleteMeasuresOnDeletedProfilesMigrationStep.class, - // 4.5.1 AddMissingCustomRuleParametersMigrationStep.class, DeleteUnescapedActivities.class, @@ -142,7 +103,6 @@ public class MigrationStepModule extends Module { FeedManualMeasuresComponentUuid.class, RemoveSnapshotLibraries.class, RemoveComponentLibraries.class, - RemoveDuplicatedComponentKeys.class - ); + RemoveDuplicatedComponentKeys.class); } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationStep.java deleted file mode 100644 index 0f5cca7b561..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationStep.java +++ /dev/null @@ -1,58 +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.v42; - -import java.sql.SQLException; - -import org.sonar.db.Database; -import org.sonar.server.db.migrations.BaseDataChange; -import org.sonar.server.db.migrations.MassUpdate; -import org.sonar.server.db.migrations.Select; -import org.sonar.server.db.migrations.SqlStatement; - -/** - * Used in Rails migration 497 - * - * @since 4.2 - */ -public class CompleteIssueMessageMigrationStep extends BaseDataChange { - - public CompleteIssueMessageMigrationStep(Database database) { - super(database); - } - - @Override - public void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("SELECT i.id, r.name FROM issues i INNER JOIN rules r ON r.id=i.rule_id WHERE i.message IS NULL"); - massUpdate.update("UPDATE issues SET message=? WHERE id=?"); - massUpdate.execute(new MassUpdate.Handler() { - @Override - public boolean handle(Select.Row row, SqlStatement update) throws SQLException { - Long issueId = row.getNullableLong(1); - String ruleName = row.getNullableString(2); - - update.setString(1, ruleName); - update.setLong(2, issueId); - return true; - } - }); - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v42/PackageKeysMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v42/PackageKeysMigrationStep.java deleted file mode 100644 index 32af9c4becf..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v42/PackageKeysMigrationStep.java +++ /dev/null @@ -1,74 +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.v42; - -import java.sql.SQLException; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import org.apache.commons.lang.StringUtils; -import org.sonar.db.Database; -import org.sonar.server.db.migrations.BaseDataChange; -import org.sonar.server.db.migrations.MassUpdate; -import org.sonar.server.db.migrations.Select; -import org.sonar.server.db.migrations.SqlStatement; - -/** - * Used in Rails migration 490 - * - * @since 4.2 - */ -public class PackageKeysMigrationStep extends BaseDataChange { - - public PackageKeysMigrationStep(Database database) { - super(database); - } - - @Override - public void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("SELECT id, kee FROM projects WHERE qualifier='PAC'"); - massUpdate.update("UPDATE projects SET qualifier='DIR', kee=? WHERE id=?"); - massUpdate.execute(new MassUpdate.Handler() { - @Override - public boolean handle(Select.Row row, SqlStatement update) throws SQLException { - Long id = row.getNullableLong(1); - String key = row.getNullableString(2); - update.setString(1, convertKey(key)); - update.setLong(2, id); - return true; - } - }); - } - - @CheckForNull - String convertKey(@Nullable String packageKey) { - if (packageKey != null) { - String prefix = StringUtils.substringBeforeLast(packageKey, ":") + ":"; - String key = StringUtils.substringAfterLast(packageKey, ":"); - if ("[default]".equals(key)) { - return prefix + "[root]"; - } - return prefix + StringUtils.replace(key, ".", "/"); - } - return null; - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v42/package-info.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v42/package-info.java deleted file mode 100644 index 57317fff74c..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v42/package-info.java +++ /dev/null @@ -1,24 +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. - */ - -@ParametersAreNonnullByDefault -package org.sonar.server.db.migrations.v42; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStep.java deleted file mode 100644 index 34404ed8a14..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStep.java +++ /dev/null @@ -1,79 +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 java.sql.SQLException; -import java.util.Date; - -import org.sonar.api.utils.System2; -import org.sonar.db.Database; -import org.sonar.db.property.PropertiesDao; -import org.sonar.server.db.migrations.BaseDataChange; -import org.sonar.server.db.migrations.MassUpdate; -import org.sonar.server.db.migrations.Select; -import org.sonar.server.db.migrations.SqlStatement; - -/** - * Used in the Active Record Migration 513. - * WARNING - this migration is not re-entrant. - * - * @since 4.3 - */ -public class ConvertIssueDebtToMinutesMigrationStep extends BaseDataChange { - - private final WorkDurationConvertor workDurationConvertor; - private final System2 system2; - - public ConvertIssueDebtToMinutesMigrationStep(Database database, PropertiesDao propertiesDao, System2 system2) { - super(database); - this.workDurationConvertor = new WorkDurationConvertor(propertiesDao); - this.system2 = system2; - } - - @Override - public void execute(Context context) throws SQLException { - workDurationConvertor.init(); - final Date now = new Date(system2.now()); - MassUpdate massUpdate = context.prepareMassUpdate(); - - // See https://jira.sonarsource.com/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. - massUpdate.select("select id, technical_debt from issues"); - - massUpdate.update("update issues set technical_debt=?, updated_at=? where id=?"); - massUpdate.execute(new MassUpdate.Handler() { - @Override - public boolean handle(Select.Row row, SqlStatement update) throws SQLException { - Long debt = row.getNullableLong(2); - if (debt != null) { - Long id = row.getNullableLong(1); - update.setLong(1, workDurationConvertor.createFromLong(debt)); - update.setDate(2, now); - update.setLong(3, id); - return true; - } - return false; - } - }); - } - -} 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 deleted file mode 100644 index 6c3b65559f5..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStep.java +++ /dev/null @@ -1,75 +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.sonar.db.Database; -import org.sonar.db.property.PropertiesDao; -import org.sonar.server.db.migrations.BaseDataChange; -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 - * - * @since 4.3 - */ -public class DevelopmentCostMeasuresMigrationStep extends BaseDataChange { - - private final WorkDurationConvertor workDurationConvertor; - - public DevelopmentCostMeasuresMigrationStep(Database database, PropertiesDao propertiesDao) { - super(database); - this.workDurationConvertor = new WorkDurationConvertor(propertiesDao); - } - - @Override - public void execute(Context context) throws SQLException { - workDurationConvertor.init(); - - Long metricId = context.prepareSelect("select id from metrics where name='development_cost'").get(Select.LONG_READER); - if (metricId != null) { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("select id, value from project_measures where metric_id=? and value is not null").setLong(1, metricId); - massUpdate.update("update project_measures set value=NULL,text_value=? where id=?"); - massUpdate.execute(new MassUpdate.Handler() { - @Override - public boolean handle(Select.Row row, SqlStatement update) throws SQLException { - Long id = row.getLong(1); - Double value = row.getDouble(2); - - update.setString(1, convertDebtForDays(value)); - update.setLong(2, id); - return true; - } - }); - } - } - - @CheckForNull - private String convertDebtForDays(Double data) { - return Long.toString(workDurationConvertor.createFromDays(data)); - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStep.java deleted file mode 100644 index b618ffed0e2..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStep.java +++ /dev/null @@ -1,113 +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 java.sql.SQLException; -import java.util.Date; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import org.sonar.api.utils.System2; -import org.sonar.db.Database; -import org.sonar.db.property.PropertiesDao; -import org.sonar.server.db.migrations.BaseDataChange; -import org.sonar.server.db.migrations.MassUpdate; -import org.sonar.server.db.migrations.Select; -import org.sonar.server.db.migrations.SqlStatement; - -import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Strings; - -/** - * Used in the Active Record Migration 514 - * - * @since 4.3 - */ -public class IssueChangelogMigrationStep extends BaseDataChange { - - private final WorkDurationConvertor workDurationConvertor; - private final System2 system2; - private final Pattern pattern = Pattern.compile("technicalDebt=(\\d*)\\|(\\d*)", Pattern.CASE_INSENSITIVE); - - public IssueChangelogMigrationStep(Database database, System2 system2, PropertiesDao propertiesDao) { - this(database, system2, new WorkDurationConvertor(propertiesDao)); - } - - @VisibleForTesting - IssueChangelogMigrationStep(Database database, System2 system2, WorkDurationConvertor convertor) { - super(database); - this.workDurationConvertor = convertor; - this.system2 = system2; - } - - @Override - public void execute(Context context) throws SQLException { - workDurationConvertor.init(); - final Date now = new Date(system2.now()); - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("SELECT ic.id, ic.change_data FROM issue_changes ic " + - "WHERE ic.change_type = 'diff' AND ic.change_data LIKE '%technicalDebt%'"); - massUpdate.update("UPDATE issue_changes SET change_data=?,updated_at=? WHERE id=?"); - massUpdate.execute(new MassUpdate.Handler() { - @Override - public boolean handle(Select.Row row, SqlStatement update) throws SQLException { - Long id = row.getNullableLong(1); - String changeData = row.getNullableString(2); - - update.setString(1, convertChangelog(changeData)); - update.setDate(2, now); - update.setLong(3, id); - return true; - } - }); - } - - @VisibleForTesting - @CheckForNull - String convertChangelog(@Nullable String data) { - if (data == null) { - return null; - } - Matcher matcher = pattern.matcher(data); - StringBuffer sb = new StringBuffer(); - if (matcher.find()) { - String replacement = "technicalDebt="; - String oldValue = matcher.group(1); - if (!Strings.isNullOrEmpty(oldValue)) { - long oldDebt = workDurationConvertor.createFromLong(Long.parseLong(oldValue)); - replacement += Long.toString(oldDebt); - } - replacement += "|"; - String newValue = matcher.group(2); - if (!Strings.isNullOrEmpty(newValue)) { - long newDebt = workDurationConvertor.createFromLong(Long.parseLong(newValue)); - replacement += Long.toString(newDebt); - } - matcher.appendReplacement(sb, replacement); - } - matcher.appendTail(sb); - return sb.toString(); - } - -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStep.java deleted file mode 100644 index c7bf7d85150..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStep.java +++ /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 java.sql.SQLException; -import java.util.Date; - -import org.sonar.api.issue.Issue; -import org.sonar.api.utils.System2; -import org.sonar.db.Database; -import org.sonar.server.db.migrations.BaseDataChange; -import org.sonar.server.db.migrations.MassUpdate; -import org.sonar.server.db.migrations.Select; -import org.sonar.server.db.migrations.SqlStatement; - -/** - * Used in the Active Record Migration 525 - * - * @since 4.3 - */ -public class NotResolvedIssuesOnRemovedComponentsMigrationStep extends BaseDataChange { - - private final System2 system2; - - public NotResolvedIssuesOnRemovedComponentsMigrationStep(Database database, System2 system2) { - super(database); - this.system2 = system2; - } - - @Override - public void execute(Context context) throws SQLException { - final Date now = new Date(system2.now()); - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("SELECT i.id FROM issues i " + - "INNER JOIN projects p on p.id=i.component_id " + - "WHERE p.enabled=? AND i.resolution IS NULL ").setBoolean(1, false); - massUpdate.update("UPDATE issues SET status=?,resolution=?,updated_at=? WHERE id=?"); - massUpdate.execute(new MassUpdate.Handler() { - @Override - public boolean handle(Select.Row row, SqlStatement update) throws SQLException { - Long id = row.getNullableLong(1); - update.setString(1, Issue.STATUS_CLOSED); - update.setString(2, Issue.RESOLUTION_REMOVED); - update.setDate(3, now); - update.setLong(4, id); - return true; - } - }); - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStep.java deleted file mode 100644 index 3ca45b425de..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStep.java +++ /dev/null @@ -1,61 +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 java.sql.SQLException; - -import org.sonar.db.Database; -import org.sonar.server.db.migrations.BaseDataChange; -import org.sonar.server.db.migrations.MassUpdate; -import org.sonar.server.db.migrations.Select; -import org.sonar.server.db.migrations.SqlStatement; - -/** - * Used in the Active Record Migration 521 - * - * @since 4.3 - */ -public class RequirementMeasuresMigrationStep extends BaseDataChange { - - public RequirementMeasuresMigrationStep(Database database) { - super(database); - } - - @Override - public void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("SELECT project_measures.id,characteristics.rule_id FROM project_measures " + - "INNER JOIN characteristics ON characteristics.id = project_measures.characteristic_id " + - "WHERE characteristics.rule_id IS NOT NULL"); - massUpdate.update("UPDATE project_measures SET characteristic_id=null,rule_id=? WHERE id=?"); - massUpdate.execute(new MassUpdate.Handler() { - @Override - public boolean handle(Select.Row row, SqlStatement update) throws SQLException { - Long id = row.getNullableLong(1); - Long ruleId = row.getNullableLong(2); - - update.setLong(1, ruleId); - update.setLong(2, id); - return true; - } - }); - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStep.java deleted file mode 100644 index 1ca04d2898c..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStep.java +++ /dev/null @@ -1,108 +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 java.sql.SQLException; -import java.util.List; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import org.apache.commons.lang.StringUtils; -import org.sonar.db.Database; -import org.sonar.db.property.PropertiesDao; -import org.sonar.server.db.migrations.BaseDataChange; -import org.sonar.server.db.migrations.MassUpdate; -import org.sonar.server.db.migrations.Select; -import org.sonar.server.db.migrations.SqlStatement; - -/** - * Used in the Active Record Migration 515 - * - * @since 4.3 - */ -public class TechnicalDebtMeasuresMigrationStep extends BaseDataChange { - - private final WorkDurationConvertor workDurationConvertor; - - public TechnicalDebtMeasuresMigrationStep(Database database, PropertiesDao propertiesDao) { - super(database); - this.workDurationConvertor = new WorkDurationConvertor(propertiesDao); - } - - @Override - public void execute(Context context) throws SQLException { - workDurationConvertor.init(); - - List<Long> metricIds = context.prepareSelect("select id from metrics " + - "where name='sqale_index' or name='new_technical_debt' " + - "or name='sqale_effort_to_grade_a' or name='sqale_effort_to_grade_b' or name='sqale_effort_to_grade_c' " + - "or name='sqale_effort_to_grade_d' or name='blocker_remediation_cost' or name='critical_remediation_cost' " + - "or name='major_remediation_cost' or name='minor_remediation_cost' or name='info_remediation_cost'").list(Select.LONG_READER); - - if (!metricIds.isEmpty()) { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.rowPluralName("measures"); - - SqlStatement select = massUpdate.select("SELECT pm.id, pm.value " + - ", pm.variation_value_1 , pm.variation_value_2, pm.variation_value_3 " + - ", pm.variation_value_4 , pm.variation_value_5 " + - " FROM project_measures pm " + - " WHERE pm.metric_id IN (" + StringUtils.repeat("?", ",", metricIds.size()) + ")"); - for (int i = 0; i < metricIds.size(); i++) { - select.setLong(i + 1, metricIds.get(i)); - } - massUpdate.update("UPDATE project_measures SET value=?," + - "variation_value_1=?,variation_value_2=?,variation_value_3=?,variation_value_4=?,variation_value_5=? WHERE id=?"); - massUpdate.execute(new Converter()); - } - } - - private class Converter implements MassUpdate.Handler { - @Override - public boolean handle(Select.Row row, SqlStatement update) throws SQLException { - Long id = row.getNullableLong(1); - Double value = row.getNullableDouble(2); - Double var1 = row.getNullableDouble(3); - Double var2 = row.getNullableDouble(4); - Double var3 = row.getNullableDouble(5); - Double var4 = row.getNullableDouble(6); - Double var5 = row.getNullableDouble(7); - - update.setLong(1, convertDebtForDays(value)); - update.setLong(2, convertDebtForDays(var1)); - update.setLong(3, convertDebtForDays(var2)); - update.setLong(4, convertDebtForDays(var3)); - update.setLong(5, convertDebtForDays(var4)); - update.setLong(6, convertDebtForDays(var5)); - update.setLong(7, id); - return true; - } - - @CheckForNull - private Long convertDebtForDays(@Nullable Double data) { - if (data != null) { - return workDurationConvertor.createFromDays(data); - } - return null; - } - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/WorkDurationConvertor.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/WorkDurationConvertor.java deleted file mode 100644 index 692d4449e86..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/WorkDurationConvertor.java +++ /dev/null @@ -1,86 +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.sonar.db.property.PropertiesDao; -import org.sonar.db.property.PropertyDto; - -class WorkDurationConvertor { - - static final long ONE_HOUR = 60L; - - static final String HOURS_IN_DAY_PROPERTY = "sonar.technicalDebt.hoursInDay"; - - private Integer hoursInDay; - - private final PropertiesDao propertiesDao; - - WorkDurationConvertor(PropertiesDao propertiesDao) { - this.propertiesDao = propertiesDao; - } - - long createFromLong(long durationInLong) { - checkHoursInDay(); - - long durationInMinutes = 0L; - - long remainingTime = durationInLong; - Long currentTime = remainingTime / 10000; - if (currentTime > 0) { - durationInMinutes = currentTime.intValue() * hoursInDay * ONE_HOUR; - remainingTime = remainingTime - (currentTime * 10000); - } - - currentTime = remainingTime / 100; - if (currentTime > 0) { - durationInMinutes += currentTime.intValue() * ONE_HOUR; - remainingTime = remainingTime - (currentTime * 100); - } - - currentTime = remainingTime; - if (currentTime > 0) { - durationInMinutes += currentTime.intValue(); - } - - return durationInMinutes; - } - - long createFromDays(double days) { - checkHoursInDay(); - - return ((Double) (days * hoursInDay * ONE_HOUR)).longValue(); - } - - void init() { - PropertyDto propertyDto = propertiesDao.selectGlobalProperty(HOURS_IN_DAY_PROPERTY); - String value = propertyDto != null ? propertyDto.getValue() : "8"; - hoursInDay = Integer.valueOf(value); - if (hoursInDay < 0) { - throw new IllegalArgumentException(String.format("Bad value of %s: %d", HOURS_IN_DAY_PROPERTY, hoursInDay)); - } - } - - private void checkHoursInDay() { - if (hoursInDay == null) { - throw new IllegalStateException("init() has not been called"); - } - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/package-info.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/package-info.java deleted file mode 100644 index c1cb03885f8..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/package-info.java +++ /dev/null @@ -1,24 +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. - */ - -@ParametersAreNonnullByDefault -package org.sonar.server.db.migrations.v43; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/ChangeLogMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/ChangeLogMigrationStep.java deleted file mode 100644 index fab24b6f7d8..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/ChangeLogMigrationStep.java +++ /dev/null @@ -1,129 +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.v44; - -import java.util.Date; -import java.util.Iterator; -import java.util.List; - -import org.apache.commons.lang.StringUtils; -import org.sonar.api.rule.RuleKey; -import org.sonar.api.utils.KeyValueFormat; -import org.sonar.api.utils.internal.Uuids; -import org.sonar.db.activity.ActivityDto; -import org.sonar.db.DbSession; -import org.sonar.db.version.v44.ChangeLog; -import org.sonar.db.version.v44.Migration44Mapper; -import org.sonar.db.qualityprofile.ActiveRuleKey; -import org.sonar.core.rule.SeverityUtil; -import org.sonar.server.activity.Activity; -import org.sonar.db.activity.ActivityDao; -import org.sonar.db.DbClient; -import org.sonar.server.db.migrations.MigrationStep; -import org.sonar.server.qualityprofile.ActiveRuleChange; - -/** - * SONAR-5329 - * Transition ActiveRuleChanges to ActivityLog - * <p/> - * Used in the Active Record Migration 548. - * - * @since 4.4 - */ -public class ChangeLogMigrationStep implements MigrationStep { - - private final ActivityDao dao; - private final DbClient db; - - public ChangeLogMigrationStep(ActivityDao dao, DbClient db) { - this.dao = dao; - this.db = db; - } - - @Override - public void execute() { - DbSession session = db.openSession(false); - Migration44Mapper migrationMapper = session.getMapper(Migration44Mapper.class); - try { - executeUpsert(session, ActiveRuleChange.Type.ACTIVATED, migrationMapper.selectActiveRuleChange(true)); - executeUpsert(session, ActiveRuleChange.Type.UPDATED, migrationMapper.selectActiveRuleChange(null)); - executeUpsert(session, ActiveRuleChange.Type.DEACTIVATED, migrationMapper.selectActiveRuleChange(false)); - session.commit(); - } finally { - session.close(); - } - } - - private void executeUpsert(DbSession session, ActiveRuleChange.Type type, List<ChangeLog> changes) { - - Iterator<ChangeLog> changeLogIterator = changes.iterator(); - if (changeLogIterator.hasNext()) { - // startCase - ChangeLog change = changeLogIterator.next(); - int currentId = change.getId(); - Date currentTimeStamp = change.getCreatedAt(); - String currentAuthor = change.getUserLogin(); - ActiveRuleChange ruleChange = newActiveRuleChance(type, change); - processRuleChange(ruleChange, change); - - while (changeLogIterator.hasNext()) { - change = changeLogIterator.next(); - int id = change.getId(); - if (id != currentId) { - saveActiveRuleChange(session, ruleChange, currentAuthor, currentTimeStamp); - currentId = id; - currentTimeStamp = change.getCreatedAt(); - currentAuthor = change.getUserLogin(); - ruleChange = newActiveRuleChance(type, change); - } - processRuleChange(ruleChange, change); - } - // save the last - saveActiveRuleChange(session, ruleChange, currentAuthor, currentTimeStamp); - } - } - - private void saveActiveRuleChange(DbSession session, ActiveRuleChange ruleChange, String author, Date currentTimeStamp) { - Activity activity = ruleChange.toActivity(); - ActivityDto dto = new ActivityDto(); - dto.setKey(Uuids.create()); - dto.setType(Activity.Type.QPROFILE.name()); - dto.setAction(activity.getAction()); - dto.setMessage(activity.getMessage()); - dto.setAuthor(author); - dto.setData(KeyValueFormat.format(activity.getData())); - dto.setCreatedAt(currentTimeStamp); - dao.insert(session, dto); - } - - private void processRuleChange(ActiveRuleChange ruleChange, ChangeLog change) { - ruleChange.setSeverity(SeverityUtil.getSeverityFromOrdinal(change.getSeverity())); - String paramName = change.getParamKey(); - String paramValue = change.getParamValue(); - if (StringUtils.isNotEmpty(paramName)) { - ruleChange.setParameter(paramName, paramValue); - } - } - - private ActiveRuleChange newActiveRuleChance(ActiveRuleChange.Type type, ChangeLog change) { - return ActiveRuleChange.createFor(type, - ActiveRuleKey.of(change.getProfileKey(), RuleKey.of(change.getRepository(), change.getRuleKey()))); - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationStep.java deleted file mode 100644 index a9f13c6efa5..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationStep.java +++ /dev/null @@ -1,95 +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.v44; - -import java.io.StringWriter; -import java.util.Date; - -import org.apache.commons.lang.ObjectUtils; -import org.sonar.api.utils.text.JsonWriter; -import org.sonar.core.util.UtcDateUtils; -import org.sonar.db.DbSession; -import org.sonar.db.version.v44.Migration44Mapper; -import org.sonar.db.version.v44.ProfileMeasure; -import org.sonar.db.version.v44.QProfileDto44; -import org.sonar.db.DbClient; -import org.sonar.server.db.migrations.MigrationStep; - -/** - * Feed the new columns RULES_PROFILE.KEE and PARENT_KEE. - * - * @since 4.4 - */ -public class ConvertProfileMeasuresMigrationStep implements MigrationStep { - - private final DbClient db; - - public ConvertProfileMeasuresMigrationStep(DbClient db) { - this.db = db; - } - - @Override - public void execute() { - DbSession session = db.openSession(false); - try { - int i = 0; - Date now = new Date(); - Migration44Mapper mapper = session.getMapper(Migration44Mapper.class); - for (ProfileMeasure profileMeasure : mapper.selectProfileMeasures()) { - boolean updated = false; - Integer version = mapper.selectProfileVersion(profileMeasure.getSnapshotId()); - QProfileDto44 profile = mapper.selectProfileById(profileMeasure.getProfileId()); - if (profile != null) { - Date date = now; - if (version != null) { - date = (Date) ObjectUtils.defaultIfNull( - mapper.selectProfileVersionDate(profileMeasure.getProfileId(), version), now); - } - // see format of JSON in org.sonar.batch.rule.UsedQProfiles - StringWriter writer = new StringWriter(); - JsonWriter json = JsonWriter.of(writer); - json - .beginArray() - .beginObject() - .prop("key", profile.getKee()) - .prop("language", profile.getLanguage()) - .prop("name", profile.getName()) - .prop("rulesUpdatedAt", UtcDateUtils.formatDateTime(date)) - .endObject() - .endArray() - .close(); - mapper.updateProfileMeasure(profileMeasure.getId(), writer.toString()); - updated = true; - } - if (!updated) { - mapper.deleteProfileMeasure(profileMeasure.getId()); - } - if (i % 100 == 0) { - session.commit(); - i++; - } - } - session.commit(); - } finally { - session.close(); - } - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationStep.java deleted file mode 100644 index 520528ddfd4..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationStep.java +++ /dev/null @@ -1,71 +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.v44; - -import java.util.Date; - -import org.apache.commons.lang.ObjectUtils; -import org.sonar.api.utils.System2; -import org.sonar.core.util.UtcDateUtils; -import org.sonar.db.DbSession; -import org.sonar.db.version.v44.Migration44Mapper; -import org.sonar.db.version.v44.QProfileDto44; -import org.sonar.db.DbClient; -import org.sonar.server.db.migrations.MigrationStep; - -/** - * Feed the new columns RULES_PROFILES.CREATED_AT and UPDATED_AT - * - * @since 4.4 - */ -public class FeedQProfileDatesMigrationStep implements MigrationStep { - - private final DbClient db; - private final System2 system; - - public FeedQProfileDatesMigrationStep(DbClient db, System2 system) { - this.db = db; - this.system = system; - } - - @Override - public void execute() { - DbSession session = db.openSession(false); - try { - Date now = new Date(system.now()); - int i = 0; - Migration44Mapper migrationMapper = session.getMapper(Migration44Mapper.class); - for (QProfileDto44 profile : migrationMapper.selectAllProfiles()) { - Date createdAt = (Date) ObjectUtils.defaultIfNull(migrationMapper.selectProfileCreatedAt(profile.getId()), now); - Date updatedAt = (Date) ObjectUtils.defaultIfNull(migrationMapper.selectProfileUpdatedAt(profile.getId()), now); - - migrationMapper.updateProfileDates(profile.getId(), createdAt, updatedAt, UtcDateUtils.formatDateTime(updatedAt)); - if (i % 100 == 0) { - session.commit(); - i++; - } - } - session.commit(); - } finally { - session.close(); - } - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/FeedQProfileKeysMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/FeedQProfileKeysMigrationStep.java deleted file mode 100644 index cfd0b2532e7..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/FeedQProfileKeysMigrationStep.java +++ /dev/null @@ -1,87 +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.v44; - -import java.sql.SQLException; - -import org.apache.commons.lang.RandomStringUtils; -import org.sonar.db.Database; -import org.sonar.server.db.migrations.BaseDataChange; -import org.sonar.server.db.migrations.MassUpdate; -import org.sonar.server.db.migrations.Select; -import org.sonar.server.db.migrations.SqlStatement; -import org.sonar.core.util.Slug; - -/** - * Feed the new columns RULES_PROFILES.KEE and PARENT_KEE. - * - * @since 4.4 - */ -public class FeedQProfileKeysMigrationStep extends BaseDataChange { - - public FeedQProfileKeysMigrationStep(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - updateKeys(context); - updateParentKeys(context); - } - - private void updateKeys(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("SELECT id,language,name FROM rules_profiles"); - massUpdate.update("UPDATE rules_profiles SET kee=? WHERE id=?"); - massUpdate.rowPluralName("profiles"); - massUpdate.execute(new MassUpdate.Handler() { - @Override - public boolean handle(Select.Row row, SqlStatement update) throws SQLException { - Long id = row.getNullableLong(1); - String lang = row.getNullableString(2); - String name = row.getNullableString(3); - - update.setString(1, Slug.slugify(String.format("%s %s %s", lang, name, RandomStringUtils.randomNumeric(5)))); - update.setLong(2, id); - return true; - } - }); - } - - private void updateParentKeys(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("SELECT child.id,parent.kee FROM rules_profiles child, rules_profiles parent WHERE child.parent_name=parent.name " + - "and child.language=parent.language AND child.parent_name IS NOT NULL"); - massUpdate.update("UPDATE rules_profiles SET parent_kee=? WHERE id=?"); - massUpdate.execute(new MassUpdate.Handler() { - @Override - public boolean handle(Select.Row row, SqlStatement update) throws SQLException { - Long id = row.getNullableLong(1); - String parentKey = row.getNullableString(2); - - update.setString(1, parentKey); - update.setLong(2, id); - return true; - } - }); - - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationStep.java deleted file mode 100644 index fb712740740..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationStep.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.v44; - -import java.sql.SQLException; -import java.util.Date; - -import org.sonar.api.utils.System2; -import org.sonar.db.Database; -import org.sonar.server.db.migrations.BaseDataChange; -import org.sonar.server.db.migrations.MassUpdate; -import org.sonar.server.db.migrations.Select; -import org.sonar.server.db.migrations.SqlStatement; - -/** - * SONAR-5218 - * Update all issues having action plan linked on removed action plan. - * <p/> - * Used in the Active Record Migration 531. - * - * @since 4.4 - */ -public class IssueActionPlanKeyMigrationStep extends BaseDataChange { - - private final System2 system2; - - public IssueActionPlanKeyMigrationStep(Database database, System2 system2) { - super(database); - this.system2 = system2; - } - - @Override - public void execute(Context context) throws SQLException { - final Date now = new Date(system2.now()); - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("SELECT i.id FROM issues i " + - "LEFT OUTER JOIN action_plans ap ON ap.kee=i.action_plan_key " + - "WHERE i.action_plan_key IS NOT NULL " + - "AND ap.kee is null"); - massUpdate.update("UPDATE issues SET action_plan_key=NULL,updated_at=? WHERE id=?"); - massUpdate.execute(new MassUpdate.Handler() { - @Override - public boolean handle(Select.Row row, SqlStatement update) throws SQLException { - Long id = row.getNullableLong(1); - - update.setDate(1, now); - update.setLong(2, id); - return true; - } - }); - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/MeasureDataMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/MeasureDataMigrationStep.java deleted file mode 100644 index 736152f2e05..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/MeasureDataMigrationStep.java +++ /dev/null @@ -1,63 +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.v44; - -import java.sql.SQLException; - -import org.sonar.db.Database; -import org.sonar.server.db.migrations.BaseDataChange; -import org.sonar.server.db.migrations.MassUpdate; -import org.sonar.server.db.migrations.Select; -import org.sonar.server.db.migrations.SqlStatement; - -/** - * SONAR-5249 - * Merge measure data table into project_measure - * - * Used in the Active Record Migration 530. - * @since 4.4 - */ -public class MeasureDataMigrationStep extends BaseDataChange { - - public MeasureDataMigrationStep(Database database) { - super(database); - } - - @Override - public void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.rowPluralName("measures"); - massUpdate.select("select md.id, md.measure_id FROM measure_data md " + - "inner join project_measures m on m.id=md.measure_id and m.measure_data is null"); - massUpdate.update("update project_measures SET measure_data = (SELECT md.data FROM measure_data md WHERE md.id = ?) WHERE id=?"); - massUpdate.execute(new MassUpdate.Handler() { - @Override - public boolean handle(Select.Row row, SqlStatement update) throws SQLException { - Long id = row.getNullableLong(1); - Long measureId = row.getNullableLong(2); - - update.setLong(1, id); - update.setLong(2, measureId); - return true; - } - }); - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/package-info.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/package-info.java deleted file mode 100644 index 9d32d73158b..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/package-info.java +++ /dev/null @@ -1,24 +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. - */ - -@ParametersAreNonnullByDefault -package org.sonar.server.db.migrations.v44; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v45/AddMissingRuleParameterDefaultValuesMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v45/AddMissingRuleParameterDefaultValuesMigrationStep.java deleted file mode 100644 index eb383f38286..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v45/AddMissingRuleParameterDefaultValuesMigrationStep.java +++ /dev/null @@ -1,121 +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.v45; - -import java.sql.SQLException; -import java.util.Date; -import java.util.List; - -import javax.annotation.Nullable; - -import org.sonar.api.utils.System2; -import org.sonar.db.Database; -import org.sonar.server.db.migrations.BaseDataChange; -import org.sonar.server.db.migrations.Select; -import org.sonar.server.db.migrations.Upsert; - -/** - * SONAR-5446 - */ -public class AddMissingRuleParameterDefaultValuesMigrationStep extends BaseDataChange { - - private final System2 system; - - public AddMissingRuleParameterDefaultValuesMigrationStep(Database db, System2 system) { - super(db); - this.system = system; - } - - @Override - public void execute(Context context) throws SQLException { - // get all the parameters with default value - List<RuleParam> ruleParameters = context.prepareSelect("select id,rule_id,name,default_value from rules_parameters where default_value is not null") - .list(new Select.RowReader<RuleParam>() { - @Override - public RuleParam read(Select.Row row) throws SQLException { - return new RuleParam(row.getNullableLong(1), row.getNullableLong(2), row.getNullableString(3), row.getNullableString(4)); - } - }); - - for (RuleParam ruleParameter : ruleParameters) { - List<ActiveRule> activeRules = context.prepareSelect("select ar.id, ar.profile_id from active_rules ar " + - "left outer join active_rule_parameters arp on arp.active_rule_id=ar.id and arp.rules_parameter_id=? " + - "where ar.rule_id=? and arp.id is null") - .setLong(1, ruleParameter.id) - .setLong(2, ruleParameter.ruleId) - .list(new Select.RowReader<ActiveRule>() { - @Override - public ActiveRule read(Select.Row row) throws SQLException { - return new ActiveRule(row.getNullableLong(1), row.getNullableLong(2)); - } - }); - - Upsert upsert = context.prepareUpsert("insert into active_rule_parameters(active_rule_id, rules_parameter_id, value, rules_parameter_key) values (?, ?, ?, ?)"); - for (ActiveRule activeRule : activeRules) { - upsert - .setLong(1, activeRule.id) - .setLong(2, ruleParameter.id) - .setString(3, ruleParameter.defaultValue) - .setString(4, ruleParameter.name) - .addBatch(); - } - if (!activeRules.isEmpty()) { - upsert.execute().commit().close(); - } - - // update date for ES indexation - upsert = context.prepareUpsert("update active_rules set updated_at=? where id=?"); - Date now = new Date(system.now()); - for (ActiveRule activeRule : activeRules) { - upsert - .setDate(1, now) - .setLong(2, activeRule.id) - .addBatch(); - } - if (!activeRules.isEmpty()) { - upsert.execute().commit().close(); - } - } - } - - private static class RuleParam { - final Long id; - final Long ruleId; - final String defaultValue; - final String name; - - RuleParam(@Nullable Long id, @Nullable Long ruleId, @Nullable String name, @Nullable String defaultValue) { - this.id = id; - this.ruleId = ruleId; - this.name = name; - this.defaultValue = defaultValue; - } - } - - private static class ActiveRule { - final Long id; - final Long profileId; - - ActiveRule(@Nullable Long id, @Nullable Long profileId) { - this.id = id; - this.profileId = profileId; - } - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v45/DeleteMeasuresOnDeletedProfilesMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v45/DeleteMeasuresOnDeletedProfilesMigrationStep.java deleted file mode 100644 index fa2efde1b1e..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v45/DeleteMeasuresOnDeletedProfilesMigrationStep.java +++ /dev/null @@ -1,60 +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.v45; - -import org.sonar.db.DbSession; -import org.sonar.db.version.v44.Migration44Mapper; -import org.sonar.db.DbClient; -import org.sonar.server.db.migrations.MigrationStep; -import org.sonar.server.db.migrations.v44.ConvertProfileMeasuresMigrationStep; - -/** - * See http://jira.sonarsource.com/browse/SONAR-5580 - * {@link ConvertProfileMeasuresMigrationStep} - * introduced a regression in 4.4. Measures on orphan profiles were kept - * in old format (no JSON data but numeric value of profile id) - * - * @see ConvertProfileMeasuresMigrationStep - * @since 4.5 - */ -public class DeleteMeasuresOnDeletedProfilesMigrationStep implements MigrationStep { - - private final DbClient db; - - public DeleteMeasuresOnDeletedProfilesMigrationStep(DbClient db) { - this.db = db; - } - - @Override - public void execute() { - DbSession session = db.openSession(false); - try { - Migration44Mapper mapper = session.getMapper(Migration44Mapper.class); - for (Long measureId : mapper.selectMeasuresOnDeletedQualityProfiles()) { - mapper.deleteProfileMeasure(measureId); - } - session.commit(); - - } finally { - session.close(); - } - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v45/package-info.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v45/package-info.java deleted file mode 100644 index a2769c527fa..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v45/package-info.java +++ /dev/null @@ -1,24 +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. - */ - -@ParametersAreNonnullByDefault -package org.sonar.server.db.migrations.v45; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/MigrationStepModuleTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/MigrationStepModuleTest.java index c2afa75acd7..2faccd0c35b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/MigrationStepModuleTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/MigrationStepModuleTest.java @@ -29,6 +29,6 @@ public class MigrationStepModuleTest { public void verify_count_of_added_MigrationStep_types() { ComponentContainer container = new ComponentContainer(); new MigrationStepModule().configure(container); - assertThat(container.size()).isEqualTo(54); + assertThat(container.size()).isEqualTo(38); } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationTest.java deleted file mode 100644 index c73347f3f9a..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationTest.java +++ /dev/null @@ -1,43 +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.v42; - -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.db.DbTester; -import org.sonar.server.db.migrations.MigrationStep; - -public class CompleteIssueMessageMigrationTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, CompleteIssueMessageMigrationTest.class, "schema.sql"); - - MigrationStep migration = new CompleteIssueMessageMigrationStep(db.database()); - - @Test - public void execute() throws Exception { - db.prepareDbUnit(getClass(), "before.xml"); - - migration.execute(); - - db.assertDbUnit(getClass(), "after.xml", "issues"); - } -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v42/PackageKeysMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v42/PackageKeysMigrationTest.java deleted file mode 100644 index fdf970ce608..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v42/PackageKeysMigrationTest.java +++ /dev/null @@ -1,43 +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.v42; - -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.db.DbTester; -import org.sonar.server.db.migrations.MigrationStep; - -public class PackageKeysMigrationTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, PackageKeysMigrationTest.class, "schema.sql"); - - MigrationStep migration = new PackageKeysMigrationStep(db.database()); - - @Test - public void execute() throws Exception { - db.prepareDbUnit(getClass(), "before.xml"); - - migration.execute(); - - db.assertDbUnit(getClass(), "after.xml", "projects"); - } -} 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 deleted file mode 100644 index 0ea073e4ed8..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest.java +++ /dev/null @@ -1,81 +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 java.util.List; -import java.util.Map; -import org.junit.Before; -import org.junit.Rule; -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.db.DbTester; -import org.sonar.db.property.PropertiesDao; -import org.sonar.db.property.PropertyDto; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.when; - -@RunWith(MockitoJUnitRunner.class) -public class ConvertIssueDebtToMinutesMigrationStepTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, ConvertIssueDebtToMinutesMigrationStepTest.class, "schema.sql"); - - @Mock - System2 system2; - - @Mock - PropertiesDao propertiesDao; - - ConvertIssueDebtToMinutesMigrationStep migration; - - @Before - public void setUp() { - when(system2.now()).thenReturn(DateUtils.parseDateTime("2014-02-19T19:10:03+0100").getTime()); - when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue("8")); - - migration = new ConvertIssueDebtToMinutesMigrationStep(db.database(), propertiesDao, system2); - } - - @Test - public void migrate_issues_debt() throws Exception { - db.prepareDbUnit(getClass(), "migrate_issues_debt.xml"); - - migration.execute(); - - db.assertDbUnit(getClass(), "migrate_issues_debt_result.xml", new String[] {"updated_at"}, "issues"); - - // Check only updated_at columns values, but we could also remove db unit file and check all fields - List<Map<String, Object>> results = db.select("select updated_at as \"updatedAt\" from issues"); - assertThat(results).hasSize(5); - assertThat(results.get(0).get("updatedAt").toString()).startsWith("2014"); - assertThat(results.get(1).get("updatedAt").toString()).startsWith("2014"); - assertThat(results.get(2).get("updatedAt").toString()).startsWith("2014"); - assertThat(results.get(3).get("updatedAt").toString()).startsWith("2014"); - // Not updated because no debt - assertThat(results.get(4).get("updatedAt").toString()).startsWith("2012"); - } - -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest.java deleted file mode 100644 index cdd65574b63..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest.java +++ /dev/null @@ -1,71 +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.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; -import org.sonar.api.utils.System2; -import org.sonar.db.DbTester; -import org.sonar.db.property.PropertiesDao; -import org.sonar.db.property.PropertyDto; - -import static org.mockito.Mockito.when; - -@RunWith(MockitoJUnitRunner.class) -public class DevelopmentCostMeasuresMigrationStepTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, DevelopmentCostMeasuresMigrationStepTest.class, "schema.sql"); - - @Mock - PropertiesDao propertiesDao; - - DevelopmentCostMeasuresMigrationStep migration; - - @Before - public void setUp() { - 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 deleted file mode 100644 index d51b36fce56..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest.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.Rule; -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.db.DbTester; -import org.sonar.db.property.PropertiesDao; -import org.sonar.db.property.PropertyDto; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.when; - -@RunWith(MockitoJUnitRunner.class) -public class IssueChangelogMigrationStepTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, IssueChangelogMigrationStepTest.class, "schema.sql"); - - @Mock - System2 system2; - - @Mock - PropertiesDao propertiesDao; - - IssueChangelogMigrationStep migration; - - @Before - public void setUp() { - 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() { - 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() { - 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() { - 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() { - 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 deleted file mode 100644 index 015d7af03ab..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest.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.Rule; -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.db.DbTester; - -import static org.mockito.Mockito.when; - -@RunWith(MockitoJUnitRunner.class) -public class NotResolvedIssuesOnRemovedComponentsMigrationStepTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, NotResolvedIssuesOnRemovedComponentsMigrationStepTest.class, "schema.sql"); - - @Mock - System2 system2; - - NotResolvedIssuesOnRemovedComponentsMigrationStep migration; - - @Before - public void setUp() { - 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 deleted file mode 100644 index a47c06c8374..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest.java +++ /dev/null @@ -1,49 +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.Rule; -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.db.DbTester; - -public class RequirementMeasuresMigrationStepTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, RequirementMeasuresMigrationStepTest.class, "schema.sql"); - - RequirementMeasuresMigrationStep migration; - - @Before - public void setUp() { - 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 deleted file mode 100644 index 4b2e17032da..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest.java +++ /dev/null @@ -1,90 +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.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; -import org.sonar.api.utils.System2; -import org.sonar.db.DbTester; -import org.sonar.db.property.PropertiesDao; -import org.sonar.db.property.PropertyDto; - -import static org.mockito.Mockito.when; - -@RunWith(MockitoJUnitRunner.class) -public class TechnicalDebtMeasuresMigrationStepTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, TechnicalDebtMeasuresMigrationStepTest.class, "schema.sql"); - - @Mock - PropertiesDao propertiesDao; - - TechnicalDebtMeasuresMigrationStep migration; - - @Before - public void setUp() { - 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/WorkDurationConvertorTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/WorkDurationConvertorTest.java deleted file mode 100644 index b1702378e5a..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/WorkDurationConvertorTest.java +++ /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 org.junit.Test; -import org.sonar.db.property.PropertiesDao; -import org.sonar.db.property.PropertyDto; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.fail; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class WorkDurationConvertorTest { - - static final int HOURS_IN_DAY = 8; - static final Long ONE_MINUTE = 1L; - static final Long ONE_HOUR_IN_MINUTES = ONE_MINUTE * 60; - static final Long ONE_DAY_IN_MINUTES = ONE_HOUR_IN_MINUTES * HOURS_IN_DAY; - - PropertiesDao propertiesDao = mock(PropertiesDao.class); - - WorkDurationConvertor convertor = new WorkDurationConvertor(propertiesDao); - - @Test - public void convert_from_long() { - convertor.init(); - when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue(Integer.toString(HOURS_IN_DAY))); - - assertThat(convertor.createFromLong(1)).isEqualTo(ONE_MINUTE); - assertThat(convertor.createFromLong(100)).isEqualTo(ONE_HOUR_IN_MINUTES); - assertThat(convertor.createFromLong(10000)).isEqualTo(ONE_DAY_IN_MINUTES); - assertThat(convertor.createFromLong(10101)).isEqualTo(ONE_DAY_IN_MINUTES + ONE_HOUR_IN_MINUTES + ONE_MINUTE); - } - - @Test - public void convert_from_long_use_default_value_for_hours_in_day_when_no_property() { - convertor.init(); - assertThat(convertor.createFromLong(1)).isEqualTo(ONE_MINUTE); - } - - @Test - public void fail_convert_from_long_on_bad_hours_in_day_property() { - when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue("-2")); - WorkDurationConvertor workDurationConvertor = new WorkDurationConvertor(propertiesDao); - try { - workDurationConvertor.init(); - fail(); - } catch (Exception e) { - assertThat(e).isInstanceOf(IllegalArgumentException.class); - } - } - - @Test - public void convert_from_days() { - convertor.init(); - when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue(Integer.toString(HOURS_IN_DAY))); - - assertThat(convertor.createFromDays(1.0)).isEqualTo(ONE_DAY_IN_MINUTES); - assertThat(convertor.createFromDays(0.1)).isEqualTo(48L); - - // Should be 4.8 but as it's a long it's truncated after comma - assertThat(convertor.createFromDays(0.01)).isEqualTo(4L); - } - - @Test - public void fail_it_init_has_not_been_called() { - when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue(Integer.toString(HOURS_IN_DAY))); - - try { - assertThat(convertor.createFromLong(1L)); - fail(); - } catch (Exception e) { - assertThat(e).isInstanceOf(IllegalStateException.class); - } - - try { - assertThat(convertor.createFromDays(1.0)); - fail(); - } catch (Exception e) { - assertThat(e).isInstanceOf(IllegalStateException.class); - } - } - -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest.java deleted file mode 100644 index 41b654e3e3f..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest.java +++ /dev/null @@ -1,66 +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.v44; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.DateUtils; -import org.sonar.api.utils.System2; -import org.sonar.db.DbClient; -import org.sonar.db.DbTester; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class ChangeLogMigrationTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, ChangeLogMigrationTest.class, "schema.sql"); - - System2 system2 = mock(System2.class); - DbClient dbClient = db.getDbClient(); - ChangeLogMigrationStep migration; - - @Before - public void setUp() { - when(system2.now()).thenReturn(DateUtils.parseDate("2014-03-13").getTime()); - migration = new ChangeLogMigrationStep(dbClient.activityDao(), dbClient); - } - - @Test - public void migrate() { - db.prepareDbUnit(getClass(), "active_rules_changes.xml"); - migration.execute(); - assertThat(db.countRowsOfTable("activities")).isEqualTo(5); - - int count = db.countSql("select count(*) from activities where data_field like '%param_PARAM1=TODO%'"); - assertThat(count).isGreaterThan(0); - } - - @Test - public void migrate_when_no_changelog() { - db.prepareDbUnit(getClass(), "migrate_when_no_changelog.xml"); - migration.execute(); - - assertThat(db.countRowsOfTable("activities")).isEqualTo(0); - } -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest.java deleted file mode 100644 index 59207746e33..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest.java +++ /dev/null @@ -1,114 +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.v44; - -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.Statement; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.db.DbTester; -import org.sonar.server.db.DbClient; - -import static org.assertj.core.api.Assertions.assertThat; - -public class ConvertProfileMeasuresMigrationTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, ConvertProfileMeasuresMigrationTest.class, "schema.sql"); - - ConvertProfileMeasuresMigrationStep migration; - - @Before - public void setUp() { - DbClient dbClient = new DbClient(db.database(), db.myBatis()); - migration = new ConvertProfileMeasuresMigrationStep(dbClient); - } - - @Test - public void generate_profiles_measure_as_json() throws Exception { - db.prepareDbUnit(getClass(), "before.xml"); - - migration.execute(); - - Connection connection = db.openConnection(); - Statement stmt = connection.createStatement(); - ResultSet rs = stmt.executeQuery("select text_value from project_measures where id=2"); - try { - rs.next(); - // pb of comparison of timezones..., so using startsWith instead of equals - assertThat(rs.getString(1)).startsWith("[{\"key\":\"java-sonar-way\",\"language\":\"java\",\"name\":\"Sonar way\",\"rulesUpdatedAt\":\"2014-01-04T"); - } finally { - rs.close(); - stmt.close(); - connection.close(); - } - } - - /** - * http://jira.sonarsource.com/browse/SONAR-5515 - * Version of quality profile was introduced in SQ 2.9. Migration must not fail - * when there are still some projects which last analysis was done with SQ <= 2.8. - */ - @Test - public void missing_profile_version() throws Exception { - db.prepareDbUnit(getClass(), "missing_profile_version.xml"); - - migration.execute(); - - Connection connection = db.openConnection(); - Statement stmt = connection.createStatement(); - ResultSet rs = stmt.executeQuery("select text_value from project_measures where id=2"); - try { - rs.next(); - // pb of comparison of timezones..., so using startsWith instead of equals - assertThat(rs.getString(1)).startsWith("[{\"key\":\"java-sonar-way\",\"language\":\"java\",\"name\":\"Sonar way\",\"rulesUpdatedAt\":"); - } finally { - rs.close(); - stmt.close(); - connection.close(); - } - } - - /** - * http://jira.sonarsource.com/browse/SONAR-5580 - */ - @Test - public void delete_measure_when_profile_does_not_exist() throws Exception { - db.prepareDbUnit(getClass(), "measure_on_deleted_profile.xml"); - - migration.execute(); - - try (Connection connection = db.openConnection()) { - Statement stmt = connection.createStatement(); - ResultSet rs = stmt.executeQuery("select * from project_measures where id=2"); - try { - // measure is deleted - assertThat(rs.next()).isFalse(); - } finally { - rs.close(); - stmt.close(); - } - } - } -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest.java deleted file mode 100644 index b74b1d52ca3..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest.java +++ /dev/null @@ -1,76 +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.v44; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.core.util.UtcDateUtils; -import org.sonar.db.DbTester; -import org.sonar.server.db.DbClient; - -import java.util.Map; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class FeedQProfileDatesMigrationTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, FeedQProfileDatesMigrationTest.class, "schema.sql"); - - FeedQProfileDatesMigrationStep migration; - - @Before - public void setUp() { - db.executeUpdateSql("truncate table active_rule_changes"); - db.executeUpdateSql("truncate table active_rule_param_changes"); - DbClient dbClient = new DbClient(db.database(), db.myBatis()); - System2 system = mock(System2.class); - when(system.now()).thenReturn(UtcDateUtils.parseDateTime("2014-07-03T12:00:00+0000").getTime()); - migration = new FeedQProfileDatesMigrationStep(dbClient, system); - } - - @Test - public void feed_created_at_and_updated_at() { - db.prepareDbUnit(getClass(), "feed_created_at_and_updated_at.xml"); - - migration.execute(); - - Map<String, Object> columns = db.selectFirst("select created_at as \"createdAt\", updated_at as \"updatedAt\" from rules_profiles where id=10"); - assertThat(columns.get("createdAt").toString()).startsWith("2011-12-2"); - assertThat(columns.get("updatedAt").toString()).startsWith("2014-01-2"); - } - - @Test - public void use_default_dates_when_no_changes() { - db.prepareDbUnit(getClass(), "use_default_dates_when_no_changes.xml"); - - migration.execute(); - - Map<String, Object> columns = db.selectFirst("select created_at as \"createdAt\", updated_at as \"updatedAt\" from rules_profiles where id=10"); - assertThat(columns.get("createdAt").toString()).startsWith("2014-07-0"); - assertThat(columns.get("updatedAt").toString()).startsWith("2014-07-0"); - } - -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/FeedQProfileKeysMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/FeedQProfileKeysMigrationTest.java deleted file mode 100644 index 445bf8d342d..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/FeedQProfileKeysMigrationTest.java +++ /dev/null @@ -1,69 +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.v44; - -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.db.DbTester; - -import java.util.List; -import java.util.Map; - -import static org.assertj.core.api.Assertions.assertThat; - -public class FeedQProfileKeysMigrationTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, FeedQProfileKeysMigrationTest.class, "schema.sql"); - - @Test - public void feed_keys() throws Exception { - db.prepareDbUnit(getClass(), "feed_keys.xml"); - - new FeedQProfileKeysMigrationStep(db.database()).execute(); - - List<Map<String, Object>> profiles = db.select("SELECT kee, name, language, parent_kee FROM rules_profiles ORDER BY id ASC"); - - Map<String, Object> parentProfile = profiles.get(0); - assertThat((String) parentProfile.get("KEE")).startsWith("java-sonar-way-"); - assertThat(parentProfile.get("NAME")).isEqualTo("Sonar Way"); - assertThat(parentProfile.get("LANGUAGE")).isEqualTo("java"); - assertThat(parentProfile.get("PARENT_KEE")).isNull(); - - Map<String, Object> differentCaseProfile = profiles.get(1); - assertThat((String) differentCaseProfile.get("KEE")).startsWith("java-sonar-way-").isNotEqualTo(parentProfile.get("KEE")); - assertThat(differentCaseProfile.get("NAME")).isEqualTo("Sonar way"); - assertThat(differentCaseProfile.get("PARENT_KEE")).isNull(); - - Map<String, Object> childProfile = profiles.get(2); - assertThat((String) childProfile.get("KEE")).startsWith("java-child-"); - assertThat(childProfile.get("NAME")).isEqualTo("Child"); - assertThat(childProfile.get("PARENT_KEE")).isEqualTo(parentProfile.get("KEE")); - - Map<String, Object> phpProfile = profiles.get(3); - assertThat((String) phpProfile.get("KEE")).startsWith("php-sonar-way-"); - assertThat(phpProfile.get("NAME")).isEqualTo("Sonar Way"); - assertThat(phpProfile.get("LANGUAGE")).isEqualTo("php"); - assertThat(phpProfile.get("PARENT_KEE")).isNull(); - } - -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest.java deleted file mode 100644 index e684184c0af..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest.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.v44; - -import org.junit.Before; -import org.junit.Rule; -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.db.DbTester; - -import static org.mockito.Mockito.when; - -@RunWith(MockitoJUnitRunner.class) -public class IssueActionPlanKeyMigrationTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, IssueActionPlanKeyMigrationTest.class, "schema.sql"); - - @Mock - System2 system2; - - IssueActionPlanKeyMigrationStep migration; - - @Before - public void setUp() { - when(system2.now()).thenReturn(DateUtils.parseDate("2014-04-28").getTime()); - - migration = new IssueActionPlanKeyMigrationStep(db.database(), system2); - } - - @Test - public void migrate_issues_action_plan_key() throws Exception { - db.prepareDbUnit(getClass(), "migrate_issues_action_plan_key.xml"); - - migration.execute(); - - db.assertDbUnit(getClass(), "migrate_issues_action_plan_key_result.xml", "issues"); - } - -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest.java deleted file mode 100644 index 14b140e8235..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest.java +++ /dev/null @@ -1,53 +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.v44; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; -import org.sonar.api.utils.System2; -import org.sonar.db.DbTester; - -@RunWith(MockitoJUnitRunner.class) -public class MeasureDataMigrationTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, MeasureDataMigrationTest.class, "schema.sql"); - - MeasureDataMigrationStep migration; - - @Before - public void setUp() { - migration = new MeasureDataMigrationStep(db.database()); - } - - @Test - public void migrate_issues_action_plan_key() throws Exception { - db.prepareDbUnit(getClass(), "migrate_measure_data.xml"); - - migration.execute(); - - db.assertDbUnit(getClass(), "migrate_measure_data-result.xml", "project_measures"); - } - -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v45/AddMissingRuleParameterDefaultValuesMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v45/AddMissingRuleParameterDefaultValuesMigrationTest.java deleted file mode 100644 index d2de3ac8ee4..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v45/AddMissingRuleParameterDefaultValuesMigrationTest.java +++ /dev/null @@ -1,67 +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.v45; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.DateUtils; -import org.sonar.api.utils.System2; -import org.sonar.db.DbTester; -import org.sonar.server.db.migrations.MigrationStep; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class AddMissingRuleParameterDefaultValuesMigrationTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, AddMissingRuleParameterDefaultValuesMigrationTest.class, "schema.sql"); - - MigrationStep migration; - System2 system = mock(System2.class); - - @Before - public void setUp() { - db.executeUpdateSql("truncate table rules_parameters"); - db.executeUpdateSql("truncate table active_rules"); - db.executeUpdateSql("truncate table active_rule_parameters"); - migration = new AddMissingRuleParameterDefaultValuesMigrationStep(db.database(), system); - when(system.now()).thenReturn(DateUtils.parseDate("2014-04-28").getTime()); - } - - @Test - public void execute() throws Exception { - db.prepareDbUnit(getClass(), "before.xml"); - - migration.execute(); - - db.assertDbUnit(getClass(), "after.xml", "rules_parameters", "active_rules", "active_rule_parameters"); - } - - @Test - public void no_changes() throws Exception { - db.prepareDbUnit(getClass(), "no_changes.xml"); - - migration.execute(); - - db.assertDbUnit(getClass(), "no_changes.xml", "rules_parameters", "active_rules", "active_rule_parameters"); - } -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v45/DeleteMeasuresOnDeletedProfilesMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v45/DeleteMeasuresOnDeletedProfilesMigrationTest.java deleted file mode 100644 index 7972ebaebac..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v45/DeleteMeasuresOnDeletedProfilesMigrationTest.java +++ /dev/null @@ -1,69 +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.v45; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.db.DbTester; -import org.sonar.server.db.DbClient; -import org.sonar.server.db.migrations.MigrationStep; - -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.Statement; - -import static org.assertj.core.api.Assertions.assertThat; - -public class DeleteMeasuresOnDeletedProfilesMigrationTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, DeleteMeasuresOnDeletedProfilesMigrationTest.class, "schema.sql"); - - MigrationStep migration; - - @Before - public void setUp() { - DbClient dbClient = new DbClient(db.database(), db.myBatis()); - migration = new DeleteMeasuresOnDeletedProfilesMigrationStep(dbClient); - } - - @Test - public void delete_measures_with_no_json_data() throws Exception { - db.prepareDbUnit(getClass(), "before.xml"); - - migration.execute(); - - Connection connection = db.openConnection(); - Statement stmt = connection.createStatement(); - ResultSet rs = stmt.executeQuery("select id from project_measures"); - try { - assertThat(rs.next()).isTrue(); - assertThat(rs.getInt(1)).isEqualTo(2); - assertThat(rs.next()).isFalse(); - } finally { - rs.close(); - stmt.close(); - connection.close(); - } - } -} diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationTest/after.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationTest/after.xml deleted file mode 100644 index 8ff8b92f9ad..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationTest/after.xml +++ /dev/null @@ -1,26 +0,0 @@ -<dataset> - <rules id="30" name="Check Header" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck" - plugin_config_key="Checker/Treewalker/HeaderCheck" plugin_name="checkstyle" description="[null]" priority="4" status="READY" - cardinality="SINGLE" parent_id="[null]"/> - - <!-- had already message --> - <issues id="3" kee="ISSUE-3" - component_id="1" - root_component_id="1" - status="OPEN" - issue_close_date="[null]" - resolution="[null]" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="30" manual_severity="[false]" - message="here is a message" action_plan_key="[null]" effort_to_fix="[null]" technical_debt="[null]" issue_attributes="[null]" checksum="[null]" author_login="[null]" - updated_at="[null]" issue_creation_date="2013-04-16" issue_update_date="2013-04-16" created_at="2013-04-16"/> - - - <!-- did not have message. Now it's the rule name--> - <issues id="4" kee="ISSUE-4" - component_id="100" - root_component_id="1" - status="OPEN" - issue_close_date="[null]" - resolution="[null]" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="30" manual_severity="[false]" - message="Check Header" action_plan_key="[null]" effort_to_fix="[null]" technical_debt="[null]" issue_attributes="[null]" checksum="[null]" author_login="[null]" - updated_at="[null]" issue_creation_date="2013-04-16" issue_update_date="2013-04-16" created_at="2013-04-16"/> -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationTest/before.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationTest/before.xml deleted file mode 100644 index f9ffbc7001b..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationTest/before.xml +++ /dev/null @@ -1,26 +0,0 @@ -<dataset> - <rules id="30" name="Check Header" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck" - plugin_config_key="Checker/Treewalker/HeaderCheck" plugin_name="checkstyle" description="[null]" priority="4" status="READY" - cardinality="SINGLE" parent_id="[null]"/> - - <!-- has message --> - <issues id="3" kee="ISSUE-3" - component_id="1" - root_component_id="1" - status="OPEN" - issue_close_date="[null]" - resolution="[null]" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="30" manual_severity="[false]" - message="here is a message" action_plan_key="[null]" effort_to_fix="[null]" technical_debt="[null]" issue_attributes="[null]" checksum="[null]" author_login="[null]" - updated_at="[null]" issue_creation_date="2013-04-16" issue_update_date="2013-04-16" created_at="2013-04-16"/> - - - <!-- does not have message --> - <issues id="4" kee="ISSUE-4" - component_id="100" - root_component_id="1" - status="OPEN" - issue_close_date="[null]" - resolution="[null]" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="30" manual_severity="[false]" - message="[null]" action_plan_key="[null]" effort_to_fix="[null]" technical_debt="[null]" issue_attributes="[null]" checksum="[null]" author_login="[null]" - updated_at="[null]" issue_creation_date="2013-04-16" issue_update_date="2013-04-16" created_at="2013-04-16"/> -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationTest/schema.sql deleted file mode 100644 index 1e55770612e..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationTest/schema.sql +++ /dev/null @@ -1,47 +0,0 @@ --- 4.2 -CREATE TABLE "RULES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "DESCRIPTION" VARCHAR(16777215), - "PRIORITY" INTEGER, - "CARDINALITY" VARCHAR(10), - "PARENT_ID" INTEGER, - "PLUGIN_CONFIG_KEY" VARCHAR(500), - "NAME" VARCHAR(200), - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "NOTE_CREATED_AT" TIMESTAMP, - "NOTE_UPDATED_AT" TIMESTAMP, - "NOTE_USER_LOGIN" VARCHAR(40), - "NOTE_DATA" CLOB(2147483647) -); - -CREATE TABLE "ISSUES" ( - "ID" BIGINT 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, - "TECHNICAL_DEBT" INTEGER, - "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 -); diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/PackageKeysMigrationTest/after.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/PackageKeysMigrationTest/after.xml deleted file mode 100644 index 142037441e8..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/PackageKeysMigrationTest/after.xml +++ /dev/null @@ -1,23 +0,0 @@ -<dataset> - - <!-- do not touch this directory --> - <projects id="1" long_name="[null]" scope="DIR" qualifier="DIR" kee="project1:org/foo/Bar" - name="org/foo/bar" root_id="[null]" - description="[null]" - enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" - created_at="[null]" deprecated_kee="[null]" path="[null]" /> - - - <!-- packages to be changed --> - <projects id="2" long_name="[null]" scope="DIR" qualifier="DIR" kee="project2:org/foo/Bar" - name="org.foo.Bar" root_id="[null]" - description="[null]" - enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" - created_at="[null]" deprecated_kee="[null]" path="[null]"/> - - <projects id="3" long_name="[null]" scope="DIR" qualifier="DIR" kee="project2:branch2:[root]" - name="[default]" root_id="[null]" - description="[null]" - enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" - created_at="[null]" deprecated_kee="[null]" path="[null]"/> -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/PackageKeysMigrationTest/before.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/PackageKeysMigrationTest/before.xml deleted file mode 100644 index e750919484a..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/PackageKeysMigrationTest/before.xml +++ /dev/null @@ -1,23 +0,0 @@ -<dataset> - - <!-- do not touch this directory --> - <projects id="1" long_name="[null]" scope="DIR" qualifier="DIR" kee="project1:org/foo/Bar" - name="org/foo/bar" root_id="[null]" - description="[null]" - enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" - created_at="[null]" deprecated_kee="[null]" path="[null]" /> - - - <!-- packages to be changed --> - <projects id="2" long_name="[null]" scope="DIR" qualifier="PAC" kee="project2:org.foo.Bar" - name="org.foo.Bar" root_id="[null]" - description="[null]" - enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" - created_at="[null]" deprecated_kee="[null]" path="[null]"/> - - <projects id="3" long_name="[null]" scope="DIR" qualifier="PAC" kee="project2:branch2:[default]" - name="[default]" root_id="[null]" - description="[null]" - enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" - created_at="[null]" deprecated_kee="[null]" path="[null]"/> -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/PackageKeysMigrationTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/PackageKeysMigrationTest/schema.sql deleted file mode 100644 index 6860012ede7..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/PackageKeysMigrationTest/schema.sql +++ /dev/null @@ -1,18 +0,0 @@ --- 4.3 -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/ConvertIssueDebtToMinutesMigrationStepTest/migrate_issues_debt.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/migrate_issues_debt.xml deleted file mode 100644 index 7717330b452..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/migrate_issues_debt.xml +++ /dev/null @@ -1,44 +0,0 @@ -<dataset> - - <!-- 1 day, 1 hour and 1 minute of debt --> - <issues ID="1" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="1" - ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE" - EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05" - ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]" - RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05" - TECHNICAL_DEBT="010101"/> - - <!-- 1 day debt --> - <issues ID="2" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="2" - ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE" - EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05" - ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]" - RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05" - TECHNICAL_DEBT="010000"/> - - <!-- 1 hour debt --> - <issues ID="3" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="3" - ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE" - EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05" - ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]" - RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05" - TECHNICAL_DEBT="100"/> - - <!-- 1 minute debt --> - <issues ID="4" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="4" - ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE" - EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05" - ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]" - RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05" - TECHNICAL_DEBT="1"/> - - - <!-- No debt, should not be touched --> - <issues ID="100" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="100" - ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE" - EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05" - ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]" - RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05" - TECHNICAL_DEBT="[null]"/> - -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/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 deleted file mode 100644 index c8d9eaecc06..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/migrate_issues_debt_result.xml +++ /dev/null @@ -1,44 +0,0 @@ -<dataset> - - <!-- Previous debt value was 010101, it should be 1 day * 8 (nb of hours in day) * 60 + 1 hour * 60 + 1 minute = 541 minutes --> - <issues ID="1" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="1" - ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE" - EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05" - ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]" - RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2014-02-19 19:10:03.0" - TECHNICAL_DEBT="541"/> - - <!-- 1 day debt --> - <issues ID="2" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="2" - ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE" - EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05" - ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]" - RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2014-02-19 19:10:03.0" - TECHNICAL_DEBT="480"/> - - <!-- 1 hour debt --> - <issues ID="3" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="3" - ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE" - EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05" - ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]" - RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2014-02-19 19:10:03.0" - TECHNICAL_DEBT="60"/> - - <!-- 1 minute debt --> - <issues ID="4" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="4" - ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE" - EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05" - ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]" - RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2014-02-19 19:10:03.0" - TECHNICAL_DEBT="1"/> - - - <!-- No debt, should not be touched --> - <issues ID="100" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="100" - ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE" - EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05" - ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]" - RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05" - TECHNICAL_DEBT="[null]"/> - -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/schema.sql deleted file mode 100644 index f3f71cfa229..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/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 deleted file mode 100644 index 0fb812f9a3d..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/metric_does_not_exist.xml +++ /dev/null @@ -1,12 +0,0 @@ -<dataset> - - <!-- ncloc --> - <metrics delete_historical_data="[null]" id="1" name="ncloc" VAL_TYPE="STRING" DESCRIPTION="[null]" domain="[null]" short_name="" - enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/> - - <project_measures id="1" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/> - -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/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 deleted file mode 100644 index 0fb812f9a3d..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/metric_does_not_exist_result.xml +++ /dev/null @@ -1,12 +0,0 @@ -<dataset> - - <!-- ncloc --> - <metrics delete_historical_data="[null]" id="1" name="ncloc" VAL_TYPE="STRING" DESCRIPTION="[null]" domain="[null]" short_name="" - enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/> - - <project_measures id="1" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/> - -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/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 deleted file mode 100644 index 2d1633de2ff..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/migrate_dev_cost_measures.xml +++ /dev/null @@ -1,12 +0,0 @@ -<dataset> - - <!-- development_cost --> - <metrics delete_historical_data="[null]" id="1" name="development_cost" VAL_TYPE="STRING" DESCRIPTION="[null]" domain="[null]" short_name="" - enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/> - - <project_measures id="1" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/> - -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/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 deleted file mode 100644 index 6db169e5b2e..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/migrate_dev_cost_measures_result.xml +++ /dev/null @@ -1,8 +0,0 @@ -<dataset> - - <project_measures id="1" VALUE="[null]" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="480" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/> - -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/schema.sql deleted file mode 100644 index 1e29613934e..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/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 deleted file mode 100644 index 5116d3e270d..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest/migrate_issue_changelog_debt.xml +++ /dev/null @@ -1,10 +0,0 @@ -<dataset> - - <!-- Change from 1 day, 1 hour and 1 minute of debt to 2 days --> - <issue_changes ID="1" KEE="1" ISSUE_KEY="ABCD" USER_LOGIN ="[null]" CHANGE_TYPE="diff" CHANGE_DATA="technicalDebt=10101|20000,resolution=,status=RESOLVED|REOPENED" - CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05" ISSUE_CHANGE_CREATION_DATE="2012-01-05"/> - - <!-- No change on debt, should not be touched --> - <issue_changes ID="2" KEE="2" ISSUE_KEY="ABCD" USER_LOGIN ="[null]" CHANGE_TYPE="diff" CHANGE_DATA="status=RESOLVED|REOPENED" - CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05" ISSUE_CHANGE_CREATION_DATE="2012-01-05"/> -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/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 deleted file mode 100644 index a42f67e500b..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest/migrate_issue_changelog_debt_result.xml +++ /dev/null @@ -1,11 +0,0 @@ -<dataset> - - <!-- Change from 1 day, 1 hour and 1 minute of debt to 2 days --> - <issue_changes ID="1" KEE="1" ISSUE_KEY="ABCD" USER_LOGIN ="[null]" CHANGE_TYPE="diff" CHANGE_DATA="technicalDebt=541|960,resolution=,status=RESOLVED|REOPENED" - CREATED_AT="2012-01-05" UPDATED_AT="2014-02-19 19:10:03.0" ISSUE_CHANGE_CREATION_DATE="2012-01-05"/> - - <!-- No change on debt, should not be touched --> - <issue_changes ID="2" KEE="2" ISSUE_KEY="ABCD" USER_LOGIN ="[null]" CHANGE_TYPE="diff" CHANGE_DATA="status=RESOLVED|REOPENED" - CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05" ISSUE_CHANGE_CREATION_DATE="2012-01-05"/> - -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest/schema.sql deleted file mode 100644 index b6bcd85c6ff..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest/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 deleted file mode 100644 index 1e7e5ab984c..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/migrate_issues.xml +++ /dev/null @@ -1,35 +0,0 @@ -<dataset> - - <projects id="1" root_id="[null]" scope="FIL" qualifier="FIL" kee="org.struts:struts:/src/main/java/org/struts/Action.java" name="Action" - description="[null]" long_name="org.struts.Action" - enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" created_at="[null]" path="/foo/bar" deprecated_kee="org.struts:struts:org.struts.Action" /> - - <projects id="2" root_id="[null]" scope="FIL" qualifier="FIL" kee="org.struts:struts:/src/main/java/org/struts/Filter.java" name="Filter" - description="[null]" long_name="org.struts.Filter" - enabled="[false]" language="java" copy_resource_id="[null]" person_id="[null]" created_at="[null]" path="[null]" deprecated_kee="org.struts:struts:org.struts.Filter" /> - - <!-- Issue not resolved on not removed component -> Nothing to do --> - <issues ID="1" COMPONENT_ID="1" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="1" - ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE" - EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05" - ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]" - RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05" - TECHNICAL_DEBT="10"/> - - <!-- Issue not resolved on removed component -> To be closed --> - <issues ID="2" COMPONENT_ID="2" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="2" - ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE" - EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05" - ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]" - RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05" - TECHNICAL_DEBT="10"/> - - <!-- Issue resolved on removed component -> Nothing to do --> - <issues ID="3" COMPONENT_ID="2" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="3" - ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE" - EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05" - ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]" - RESOLUTION="FIXED" STATUS="CLOSED" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05" - TECHNICAL_DEBT="10"/> - -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/migrate_issues_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/migrate_issues_result.xml deleted file mode 100644 index 4509c279724..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/migrate_issues_result.xml +++ /dev/null @@ -1,27 +0,0 @@ -<dataset> - - <!-- Issue not resolved on not removed component -> Nothing to do --> - <issues ID="1" COMPONENT_ID="1" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="1" - ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE" - EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05" - ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]" - RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05" - TECHNICAL_DEBT="10"/> - - <!-- Issue not resolved on removed component -> To be closed --> - <issues ID="2" COMPONENT_ID="2" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="2" - ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE" - EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05" - ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]" - RESOLUTION="REMOVED" STATUS="CLOSED" CREATED_AT="2012-01-05" UPDATED_AT="2014-04-09 00:00:00.0" - TECHNICAL_DEBT="10"/> - - <!-- Issue resolved on removed component -> Nothing to do --> - <issues ID="3" COMPONENT_ID="2" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="3" - ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE" - EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05" - ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]" - RESOLUTION="FIXED" STATUS="CLOSED" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05" - TECHNICAL_DEBT="10"/> - -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/schema.sql deleted file mode 100644 index c0129aa79f5..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/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 deleted file mode 100644 index a5249ee19f0..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest/migrate_measures_on_requirements.xml +++ /dev/null @@ -1,44 +0,0 @@ -<dataset> - - <!-- Root characteristic --> - <characteristics id="1" kee="PORTABILITY" name="Portability" parent_id="[null]" root_id="[null]" rule_id="[null]" characteristic_order="1" - function_key="[null]" factor_value="[null]" factor_unit="[null]" offset_value="[null]" offset_unit="[null]" enabled="[true]" - created_at="2013-11-20" updated_at="2013-11-22"/> - - <!-- Characteristic --> - <characteristics id="2" kee="COMPILER_RELATED_PORTABILITY" name="Compiler related portability" parent_id="1" root_id="1" rule_id="[null]" characteristic_order="[null]" - function_key="[null]" factor_value="[null]" factor_unit="[null]" offset_value="[null]" offset_unit="[null]" enabled="[true]" - created_at="2013-11-20" updated_at="2013-11-22"/> - - <!-- Requirement --> - <characteristics id="3" kee="[null]" name="[null]" parent_id="2" root_id="1" rule_id="10" - function_key="linear_offset" factor_value="20.0" factor_unit="mn" offset_value="30.0" offset_unit="h" enabled="[true]" - created_at="2013-11-20" updated_at="[null]"/> - - - - <!-- Measure linked on requirement -> to be updated --> - <project_measures id="1" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - rule_id="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="3" url="[null]" person_id="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/> - - <!-- Measure linked on characteristic -> not to be updated --> - <project_measures id="2" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - rule_id="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/> - - <!-- Measure linked on rule -> not to be updated --> - <project_measures id="3" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - rule_id="10" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/> - - <!-- Measure not linked on rule or requirement -> not to be updated --> - <project_measures id="4" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - rule_id="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/> - -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/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 deleted file mode 100644 index df20f63c880..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest/migrate_measures_on_requirements_result.xml +++ /dev/null @@ -1,27 +0,0 @@ -<dataset> - - <!-- Measure linked on requirement -> to be updated --> - <project_measures id="1" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - rule_id="10" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/> - - <!-- Measure linked on characteristic -> not to be updated --> - <project_measures id="2" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - rule_id="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/> - - <!-- Measure linked on rule -> not to be updated --> - <project_measures id="3" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - rule_id="10" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/> - - <!-- Measure not linked on rule or requirement -> not to be updated --> - <project_measures id="4" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - rule_id="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/> - -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest/schema.sql deleted file mode 100644 index a60b5de5b5d..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest/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 deleted file mode 100644 index fec9c9c2d58..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_new_technical_debt_measures.xml +++ /dev/null @@ -1,29 +0,0 @@ -<dataset> - - <!-- Added Technical debt metric --> - <metrics delete_historical_data="[null]" id="1" name="new_technical_debt" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]" domain="[null]" short_name="" - enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/> - - <!-- Another metric --> - <metrics delete_historical_data="[null]" id="2" name="ncloc" VAL_TYPE="INT" DESCRIPTION="[null]" domain="[null]" short_name="" - enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/> - - - <!-- Measure with variations on all period --> - <project_measures id="1" VALUE="[null]" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="0.1" variation_value_2="0.2" variation_value_3="0.3" variation_value_4="0.4" variation_value_5="0.5"/> - - <!-- Measure with some variations --> - <project_measures id="2" VALUE="[null]" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="0.1" variation_value_2="0.2" variation_value_3="0.0" variation_value_4="0.0" variation_value_5="0.0"/> - - <!-- Change on another metric, should not be touched --> - <project_measures id="10" VALUE="20" METRIC_ID="2" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/> -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/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 deleted file mode 100644 index 0c77c0fb524..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_new_technical_debt_measures_result.xml +++ /dev/null @@ -1,21 +0,0 @@ -<dataset> - - <!-- Measure with variations on all period --> - <project_measures id="1" VALUE="[null]" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="48" variation_value_2="96" variation_value_3="144" variation_value_4="192" variation_value_5="240"/> - - <!-- Measure with some variations --> - <project_measures id="2" VALUE="[null]" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="48" variation_value_2="96" variation_value_3="0" variation_value_4="0" variation_value_5="0"/> - - <!-- Change on another metric, should not be touched --> - <project_measures id="10" VALUE="20" METRIC_ID="2" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/> - -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_nothing.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_nothing.xml deleted file mode 100644 index d4e3f4a0101..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_nothing.xml +++ /dev/null @@ -1,11 +0,0 @@ -<dataset> - - <metrics delete_historical_data="[null]" id="2" name="nclc" VAL_TYPE="INTEGER" DESCRIPTION="[null]" domain="[null]" short_name="" - enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/> - - <project_measures id="2" VALUE="1.0" METRIC_ID="2" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/> - -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_nothing_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_nothing_result.xml deleted file mode 100644 index d4e3f4a0101..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_nothing_result.xml +++ /dev/null @@ -1,11 +0,0 @@ -<dataset> - - <metrics delete_historical_data="[null]" id="2" name="nclc" VAL_TYPE="INTEGER" DESCRIPTION="[null]" domain="[null]" short_name="" - enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/> - - <project_measures id="2" VALUE="1.0" METRIC_ID="2" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/> - -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_sqale_measures.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_sqale_measures.xml deleted file mode 100644 index b9081d8e285..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_sqale_measures.xml +++ /dev/null @@ -1,64 +0,0 @@ -<dataset> - - <!-- sqale_effort_to_grade_X --> - <metrics delete_historical_data="[null]" id="2" name="sqale_effort_to_grade_a" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]" domain="[null]" short_name="" - enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/> - <metrics delete_historical_data="[null]" id="3" name="sqale_effort_to_grade_b" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]" domain="[null]" short_name="" - enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/> - <metrics delete_historical_data="[null]" id="4" name="sqale_effort_to_grade_c" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]" domain="[null]" short_name="" - enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/> - <metrics delete_historical_data="[null]" id="5" name="sqale_effort_to_grade_d" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]" domain="[null]" short_name="" - enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/> - - <!-- debt by severity --> - <metrics delete_historical_data="[null]" id="6" name="blocker_remediation_cost" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]" domain="[null]" short_name="" - enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/> - <metrics delete_historical_data="[null]" id="7" name="critical_remediation_cost" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]" domain="[null]" short_name="" - enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/> - <metrics delete_historical_data="[null]" id="8" name="major_remediation_cost" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]" domain="[null]" short_name="" - enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/> - <metrics delete_historical_data="[null]" id="9" name="minor_remediation_cost" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]" domain="[null]" short_name="" - enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/> - <metrics delete_historical_data="[null]" id="10" name="info_remediation_cost" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]" domain="[null]" short_name="" - enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/> - - - <project_measures id="2" VALUE="1.0" METRIC_ID="2" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/> - <project_measures id="3" VALUE="1.0" METRIC_ID="3" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/> - <project_measures id="4" VALUE="1.0" METRIC_ID="4" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/> - <project_measures id="5" VALUE="1.0" METRIC_ID="5" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/> - - <project_measures id="6" VALUE="1.0" METRIC_ID="6" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/> - <project_measures id="7" VALUE="1.0" METRIC_ID="7" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/> - <project_measures id="8" VALUE="1.0" METRIC_ID="8" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/> - <project_measures id="9" VALUE="1.0" METRIC_ID="9" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/> - <project_measures id="10" VALUE="1.0" METRIC_ID="10" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/> - -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/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 deleted file mode 100644 index b0e80bd9cf8..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_sqale_measures_result.xml +++ /dev/null @@ -1,41 +0,0 @@ -<dataset> - - <project_measures id="2" VALUE="480" METRIC_ID="2" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/> - <project_measures id="3" VALUE="480" METRIC_ID="3" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/> - <project_measures id="4" VALUE="480" METRIC_ID="4" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/> - <project_measures id="5" VALUE="480" METRIC_ID="5" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/> - - <project_measures id="6" VALUE="480" METRIC_ID="6" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/> - <project_measures id="7" VALUE="480" METRIC_ID="7" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/> - <project_measures id="8" VALUE="480" METRIC_ID="8" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/> - <project_measures id="9" VALUE="480" METRIC_ID="9" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/> - <project_measures id="10" VALUE="480" METRIC_ID="10" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/> - -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/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 deleted file mode 100644 index 80c512c14dd..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_technical_debt_measures.xml +++ /dev/null @@ -1,35 +0,0 @@ -<dataset> - - <!-- Technical debt metric --> - <metrics delete_historical_data="[null]" id="1" name="sqale_index" VAL_TYPE="WORK_DUR" DESCRIPTION="[null]" domain="[null]" short_name="" - enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/> - - <!-- Another metric --> - <metrics delete_historical_data="[null]" id="2" name="ncloc" VAL_TYPE="INT" DESCRIPTION="[null]" domain="[null]" short_name="" - enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/> - - - <!-- Value 1 day of debt --> - <project_measures id="1" VALUE="1.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/> - - <!-- Measure with variations on all period --> - <project_measures id="2" VALUE="2.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/> - - <!-- Measure with some variations --> - <project_measures id="3" VALUE="3.0" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="0.1" variation_value_2="0.2" variation_value_3="0.0" variation_value_4="0.0" variation_value_5="0.0"/> - - <!-- Change on another metric, should not be touched --> - <project_measures id="10" VALUE="20" METRIC_ID="2" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/> -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/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 deleted file mode 100644 index 2a3e2068a0f..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_technical_debt_measures_result.xml +++ /dev/null @@ -1,27 +0,0 @@ -<dataset> - - <!-- Value 1 day, 1 hour and 1 minute of debt --> - <project_measures id="1" VALUE="480" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/> - - <!-- Measure with variations on all period --> - <project_measures id="2" VALUE="960" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="480" variation_value_2="960" variation_value_3="1440" variation_value_4="1920" variation_value_5="2400"/> - - <!-- Measure with some variations --> - <project_measures id="3" VALUE="1440" METRIC_ID="1" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="48" variation_value_2="96" variation_value_3="0" variation_value_4="0" variation_value_5="0"/> - - <!-- Change on another metric, should not be touched --> - <project_measures id="10" VALUE="20" METRIC_ID="2" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/> - -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/schema.sql deleted file mode 100644 index 1e29613934e..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/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/v44/ChangeLogMigrationTest/active_rules_changes.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest/active_rules_changes.xml deleted file mode 100644 index 1f449ff8edd..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest/active_rules_changes.xml +++ /dev/null @@ -1,43 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<dataset> - - <rules_profiles id="10" name="DB_Testing" language="java" kee="java-p10" parent_kee="[null]"/> - - <active_rule_changes id="122" profile_id="10" profile_version="2" rule_id="1" change_date="2011-11-03 20:20:05.158" - enabled="true" old_severity="[null]" new_severity="1" username="Administrator"/> - - <active_rule_changes id="123" profile_id="10" profile_version="2" rule_id="1" change_date="2011-12-04 10:20:05.158" - enabled="[null]" old_severity="1" new_severity="4" username="asdasads"/> - - <active_rule_changes id="126" profile_id="10" profile_version="2" rule_id="1" change_date="2011-12-04 20:20:05.158" - enabled="[null]" old_severity="[null]" new_severity="[null]" username="Administrator"/> - <active_rule_param_changes id="1" active_rule_change_id="126" rules_parameter_id="11" old_value="[null]" - new_value="TODO"/> - <active_rule_param_changes id="2" active_rule_change_id="126" rules_parameter_id="12" old_value="[null]" - new_value="FIXME"/> - <active_rule_param_changes id="3" active_rule_change_id="126" rules_parameter_id="13" old_value="[null]" - new_value="NOSONAR"/> - - <active_rule_changes id="124" profile_id="10" profile_version="2" rule_id="2" change_date="2011-12-05 20:20:05.158" - enabled="true" old_severity="[null]" new_severity="1" username="Administrator"/> - <active_rule_param_changes id="4" active_rule_change_id="124" rules_parameter_id="21" old_value="[null]" - new_value="TODO"/> - <active_rule_param_changes id="5" active_rule_change_id="124" rules_parameter_id="22" old_value="[null]" - new_value="FIXME"/> - - <active_rule_changes id="125" profile_id="10" profile_version="2" rule_id="2" change_date="2011-12-06 20:20:05.158" - enabled="false" old_severity="1" new_severity="[null]" username="[null]"/> - - <rules id="1" plugin_name="xoo" plugin_rule_key="S001"/> - <rules id="2" plugin_name="xoo" plugin_rule_key="S002"/> - - <rules_parameters id="11" rule_id="1" param_type="STRING" name="param1"/> - <rules_parameters id="12" rule_id="1" param_type="STRING" name="param2"/> - <rules_parameters id="13" rule_id="1" param_type="STRING" name="param3"/> - - <rules_parameters id="21" rule_id="2" param_type="STRING" name="PARAM1"/> - <rules_parameters id="22" rule_id="2" param_type="STRING" name="PARAM2"/> - - <users id="1111" name="Administrator" login="admin"/> - -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest/migrate_when_no_changelog.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest/migrate_when_no_changelog.xml deleted file mode 100644 index b6c5d34d773..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest/migrate_when_no_changelog.xml +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<dataset> - - <rules_profiles id="10" name="DB_Testing" language="java" kee="java-p10" parent_kee="[null]"/> - - <rules id="1" plugin_name="xoo" plugin_rule_key="S001"/> - <rules id="2" plugin_name="xoo" plugin_rule_key="S002"/> - - <rules_parameters id="11" rule_id="1" param_type="STRING" name="param1"/> - <rules_parameters id="12" rule_id="1" param_type="STRING" name="param2"/> - <rules_parameters id="13" rule_id="1" param_type="STRING" name="param3"/> - - <rules_parameters id="21" rule_id="2" param_type="STRING" name="PARAM1"/> - <rules_parameters id="22" rule_id="2" param_type="STRING" name="PARAM2"/> - - <users id="1111" name="Administrator" login="admin"/> - -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest/schema.sql deleted file mode 100644 index 9e353e72063..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest/schema.sql +++ /dev/null @@ -1,113 +0,0 @@ - -CREATE TABLE "RULES_PARAMETERS" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "RULE_ID" INTEGER NOT NULL, - "NAME" VARCHAR(128) NOT NULL, - "PARAM_TYPE" VARCHAR(512) NOT NULL, - "DEFAULT_VALUE" VARCHAR(4000), - "DESCRIPTION" VARCHAR(4000) - ); - - CREATE TABLE "RULES_PROFILES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "NAME" VARCHAR(100) NOT NULL, - "LANGUAGE" VARCHAR(20), - "KEE" VARCHAR(255) NOT NULL, - "PARENT_KEE" VARCHAR(255), - "RULES_UPDATED_AT" VARCHAR(100), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP - ); - - CREATE TABLE "ACTIVE_RULE_PARAM_CHANGES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "ACTIVE_RULE_CHANGE_ID" INTEGER NOT NULL, - "RULES_PARAMETER_ID" INTEGER NOT NULL, - "OLD_VALUE" VARCHAR(4000), - "NEW_VALUE" VARCHAR(4000) - ); - - CREATE TABLE "RULES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "DESCRIPTION" VARCHAR(16777215), - "PRIORITY" INTEGER, - "CARDINALITY" VARCHAR(10), - "PARENT_ID" INTEGER, - "PLUGIN_CONFIG_KEY" VARCHAR(500), - "NAME" VARCHAR(200), - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "NOTE_DATA" CLOB(2147483647), - "NOTE_USER_LOGIN" VARCHAR(40), - "NOTE_CREATED_AT" TIMESTAMP, - "NOTE_UPDATED_AT" TIMESTAMP, - "CHARACTERISTIC_ID" INTEGER, - "DEFAULT_CHARACTERISTIC_ID" INTEGER, - "REMEDIATION_FUNCTION" VARCHAR(20), - "DEFAULT_REMEDIATION_FUNCTION" VARCHAR(20), - "REMEDIATION_COEFF" VARCHAR(20), - "DEFAULT_REMEDIATION_COEFF" VARCHAR(20), - "REMEDIATION_OFFSET" VARCHAR(20), - "DEFAULT_REMEDIATION_OFFSET" VARCHAR(20), - "EFFORT_TO_FIX_DESCRIPTION" VARCHAR(4000), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP - ); - - CREATE TABLE "ACTIVE_RULE_CHANGES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "USERNAME" VARCHAR(200), - "PROFILE_ID" INTEGER NOT NULL, - "PROFILE_VERSION" INTEGER NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "CHANGE_DATE" TIMESTAMP NOT NULL, - "ENABLED" BOOLEAN, - "OLD_SEVERITY" INTEGER, - "NEW_SEVERITY" INTEGER - ); - - CREATE TABLE "ACTIVE_RULES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "PROFILE_ID" INTEGER NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "FAILURE_LEVEL" INTEGER NOT NULL, - "INHERITANCE" VARCHAR(10), - "NOTE_CREATED_AT" TIMESTAMP, - "NOTE_UPDATED_AT" TIMESTAMP, - "NOTE_USER_LOGIN" VARCHAR(40), - "NOTE_DATA" CLOB(2147483647) - ); - - CREATE TABLE "ACTIVE_RULE_PARAMETERS" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "ACTIVE_RULE_ID" INTEGER NOT NULL, - "RULES_PARAMETER_ID" INTEGER NOT NULL, - "RULES_PARAMETER_KEY" VARCHAR(128), - "VALUE" VARCHAR(4000) - ); - - CREATE TABLE "USERS" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "LOGIN" VARCHAR(40), - "NAME" VARCHAR(200), - "EMAIL" VARCHAR(100), - "CRYPTED_PASSWORD" VARCHAR(40), - "SALT" VARCHAR(40), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "REMEMBER_TOKEN" VARCHAR(500), - "REMEMBER_TOKEN_EXPIRES_AT" TIMESTAMP, - "ACTIVE" BOOLEAN DEFAULT TRUE - ); - - CREATE TABLE "ACTIVITIES" ( - "LOG_KEY" VARCHAR(250), - "CREATED_AT" TIMESTAMP, - "USER_LOGIN" VARCHAR(30), - "LOG_TYPE" VARCHAR(250), - "LOG_ACTION" VARCHAR(250), - "LOG_MESSAGE" VARCHAR(250), - "DATA_FIELD" CLOB(2147483647) - ); diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest/before.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest/before.xml deleted file mode 100644 index 92cf512ca3c..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest/before.xml +++ /dev/null @@ -1,56 +0,0 @@ -<dataset> - <metrics id="1" name="ncloc" VAL_TYPE="INT" DESCRIPTION="[null]" domain="[null]" short_name="" - enabled="[true]" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="[false]" delete_historical_data="[null]" /> - <metrics id="2" name="profile" VAL_TYPE="DATA" DESCRIPTION="[null]" domain="[null]" short_name="" - enabled="[true]" worst_value="0" optimized_best_value="[true]" best_value="100" direction="1" hidden="[false]" delete_historical_data="[null]"/> - <metrics id="3" name="profile_version" VAL_TYPE="INT" DESCRIPTION="[null]" domain="[null]" short_name="" - enabled="[true]" worst_value="0" optimized_best_value="[true]" best_value="100" direction="1" hidden="[false]" delete_historical_data="[null]"/> - - <!-- old snapshot --> - <snapshots purge_status="[null]" id="1000" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" - scope="PRJ" qualifier="TRK" created_at="2008-11-01 13:58:00.00" build_date="2008-11-01 13:58:00.00" version="[null]" path="" - status="P" islast="[false]" depth="0" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" /> - - <!-- last snapshot --> - <snapshots purge_status="[null]" id="1001" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" - scope="PRJ" qualifier="TRK" created_at="2009-11-01 13:58:00.00" build_date="2009-11-01 13:58:00.00" version="[null]" path="" - status="P" islast="[true]" depth="0" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" /> - - - <!-- last measures : ncloc, profile and profile_version --> - <project_measures id="1" VALUE="60" METRIC_ID="1" SNAPSHOT_ID="1001" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/> - - <project_measures id="2" VALUE="20" text_value="Sonar way" METRIC_ID="2" SNAPSHOT_ID="1001" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/> - - <project_measures id="3" VALUE="3" METRIC_ID="3" SNAPSHOT_ID="1001" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/> - - - <!-- quality profiles --> - <rules_profiles id="20" name="Sonar way" language="java" kee="java-sonar-way" parent_kee="[null]"/> - <rules_profiles id="21" name="Other way" language="java" kee="java-other-way" parent_kee="[null]" /> - - <!-- quality profile changes --> - <active_rule_changes id="1" profile_id="20" profile_version="2" rule_id="1" change_date="2011-11-03 20:20:05.158" - enabled="true" old_severity="[null]" new_severity="1" username="Administrator"/> - - <active_rule_changes id="2" profile_id="20" profile_version="3" rule_id="1" change_date="2011-12-04 10:20:05.158" - enabled="[null]" old_severity="1" new_severity="4" username="asdasads"/> - - <!-- this is the latest change to be used --> - <active_rule_changes id="3" profile_id="20" profile_version="3" rule_id="1" change_date="2014-01-04 12:20:05.158" - enabled="[null]" old_severity="[null]" new_severity="[null]" username="Administrator"/> - -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest/measure_on_deleted_profile.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest/measure_on_deleted_profile.xml deleted file mode 100644 index 53071165f0f..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest/measure_on_deleted_profile.xml +++ /dev/null @@ -1,31 +0,0 @@ -<dataset> - <metrics id="1" name="ncloc" VAL_TYPE="INT" DESCRIPTION="[null]" domain="[null]" short_name="" - enabled="[true]" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="[false]" delete_historical_data="[null]" /> - <metrics id="2" name="profile" VAL_TYPE="DATA" DESCRIPTION="[null]" domain="[null]" short_name="" - enabled="[true]" worst_value="0" optimized_best_value="[true]" best_value="100" direction="1" hidden="[false]" delete_historical_data="[null]"/> - - <!-- last snapshot --> - <snapshots purge_status="[null]" id="1001" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" - scope="PRJ" qualifier="TRK" created_at="2009-11-01 13:58:00.00" build_date="2009-11-01 13:58:00.00" version="[null]" path="" - status="P" islast="[true]" depth="0" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" /> - - - <!-- last measures : ncloc, deleted profile --> - - <project_measures id="1" VALUE="60" METRIC_ID="1" SNAPSHOT_ID="1001" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/> - - <project_measures id="2" VALUE="22" text_value="Sonar way" METRIC_ID="2" SNAPSHOT_ID="1001" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/> - - - <!-- quality profiles --> - <rules_profiles id="20" name="Sonar way" language="java" kee="java-sonar-way" parent_kee="[null]"/> - -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest/missing_profile_version.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest/missing_profile_version.xml deleted file mode 100644 index 4366b94339d..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest/missing_profile_version.xml +++ /dev/null @@ -1,31 +0,0 @@ -<dataset> - <metrics id="1" name="ncloc" VAL_TYPE="INT" DESCRIPTION="[null]" domain="[null]" short_name="" - enabled="[true]" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="[false]" delete_historical_data="[null]" /> - <metrics id="2" name="profile" VAL_TYPE="DATA" DESCRIPTION="[null]" domain="[null]" short_name="" - enabled="[true]" worst_value="0" optimized_best_value="[true]" best_value="100" direction="1" hidden="[false]" delete_historical_data="[null]"/> - - <!-- last snapshot --> - <snapshots purge_status="[null]" id="1001" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" - scope="PRJ" qualifier="TRK" created_at="2009-11-01 13:58:00.00" build_date="2009-11-01 13:58:00.00" version="[null]" path="" - status="P" islast="[true]" depth="0" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" /> - - - <!-- last measures : ncloc, profile but no profile_version --> - <project_measures id="1" VALUE="60" METRIC_ID="1" SNAPSHOT_ID="1001" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/> - - <project_measures id="2" VALUE="20" text_value="Sonar way" METRIC_ID="2" SNAPSHOT_ID="1001" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/> - - - <!-- quality profiles --> - <rules_profiles id="20" name="Sonar way" language="java" kee="java-sonar-way" parent_kee="[null]"/> - <rules_profiles id="21" name="Other way" language="java" kee="java-other-way" parent_kee="[null]" /> - -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest/schema.sql deleted file mode 100644 index 4736d0cdb2c..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest/schema.sql +++ /dev/null @@ -1,108 +0,0 @@ -CREATE TABLE "RULES_PROFILES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "NAME" VARCHAR(100) NOT NULL, - "LANGUAGE" VARCHAR(20), - "KEE" VARCHAR(1000) NOT NULL, - "PARENT_KEE" VARCHAR(1000), - "RULES_UPDATED_AT" VARCHAR(100), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); - -CREATE TABLE "ACTIVE_RULE_CHANGES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "USERNAME" VARCHAR(255), - "PROFILE_ID" INTEGER NOT NULL, - "PROFILE_VERSION" INTEGER NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "CHANGE_DATE" TIMESTAMP NOT NULL, - "ENABLED" BOOLEAN, - "OLD_SEVERITY" INTEGER, - "NEW_SEVERITY" INTEGER -); - -CREATE TABLE "ACTIVE_RULE_PARAM_CHANGES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "ACTIVE_RULE_CHANGE_ID" INTEGER NOT NULL, - "RULES_PARAMETER_ID" INTEGER NOT NULL, - "OLD_VALUE" VARCHAR(4000), - "NEW_VALUE" VARCHAR(4000) - ); - -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(4000), - "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, - "MEASURE_DATA" BINARY(167772150) -); - -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 -); - -CREATE TABLE "SNAPSHOTS" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "CREATED_AT" TIMESTAMP, - "BUILD_DATE" TIMESTAMP, - "PROJECT_ID" INTEGER NOT NULL, - "PARENT_SNAPSHOT_ID" INTEGER, - "STATUS" VARCHAR(4) NOT NULL DEFAULT 'U', - "PURGE_STATUS" INTEGER, - "ISLAST" BOOLEAN NOT NULL DEFAULT FALSE, - "SCOPE" VARCHAR(3), - "QUALIFIER" VARCHAR(10), - "ROOT_SNAPSHOT_ID" INTEGER, - "VERSION" VARCHAR(500), - "PATH" VARCHAR(500), - "DEPTH" INTEGER, - "ROOT_PROJECT_ID" INTEGER, - "PERIOD1_MODE" VARCHAR(100), - "PERIOD1_PARAM" VARCHAR(100), - "PERIOD1_DATE" TIMESTAMP, - "PERIOD2_MODE" VARCHAR(100), - "PERIOD2_PARAM" VARCHAR(100), - "PERIOD2_DATE" TIMESTAMP, - "PERIOD3_MODE" VARCHAR(100), - "PERIOD3_PARAM" VARCHAR(100), - "PERIOD3_DATE" TIMESTAMP, - "PERIOD4_MODE" VARCHAR(100), - "PERIOD4_PARAM" VARCHAR(100), - "PERIOD4_DATE" TIMESTAMP, - "PERIOD5_MODE" VARCHAR(100), - "PERIOD5_PARAM" VARCHAR(100), - "PERIOD5_DATE" TIMESTAMP -); diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest/feed_created_at_and_updated_at.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest/feed_created_at_and_updated_at.xml deleted file mode 100644 index 5f0a7a87f60..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest/feed_created_at_and_updated_at.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<dataset> - - <rules_profiles id="10" name="Sonar Way" language="java" kee="java-sw" parent_kee="[null]" - rules_updated_at="[null]" created_at="[null]" updated_at="[null]"/> - - <!-- oldest to newest changes --> - <active_rule_changes id="122" profile_id="10" profile_version="2" rule_id="1" change_date="2011-12-25 20:20:05.158" - enabled="true" old_severity="[null]" new_severity="1" username="robert"/> - - <active_rule_changes id="123" profile_id="10" profile_version="2" rule_id="1" change_date="2013-05-18 10:20:05.158" - enabled="[null]" old_severity="1" new_severity="4" username="lucie"/> - - <active_rule_changes id="126" profile_id="10" profile_version="3" rule_id="1" change_date="2014-01-24 20:20:05.158" - enabled="[null]" old_severity="[null]" new_severity="[null]" username="tatiana"/> - - <!-- another profile --> - <active_rule_changes id="124" profile_id="11" profile_version="1" rule_id="2" change_date="2011-12-05 20:20:05.158" - enabled="true" old_severity="[null]" new_severity="1" username="Administrator"/> - -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest/schema.sql deleted file mode 100644 index a6237e63fff..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest/schema.sql +++ /dev/null @@ -1,30 +0,0 @@ -CREATE TABLE "RULES_PROFILES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "NAME" VARCHAR(100) NOT NULL, - "LANGUAGE" VARCHAR(20), - "KEE" VARCHAR(1000) NOT NULL, - "PARENT_KEE" VARCHAR(1000), - "RULES_UPDATED_AT" VARCHAR(100), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); - -CREATE TABLE "ACTIVE_RULE_CHANGES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "USERNAME" VARCHAR(255), - "PROFILE_ID" INTEGER NOT NULL, - "PROFILE_VERSION" INTEGER NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "CHANGE_DATE" TIMESTAMP NOT NULL, - "ENABLED" BOOLEAN, - "OLD_SEVERITY" INTEGER, - "NEW_SEVERITY" INTEGER -); - -CREATE TABLE "ACTIVE_RULE_PARAM_CHANGES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "ACTIVE_RULE_CHANGE_ID" INTEGER NOT NULL, - "RULES_PARAMETER_ID" INTEGER NOT NULL, - "OLD_VALUE" VARCHAR(4000), - "NEW_VALUE" VARCHAR(4000) - ); diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest/use_default_dates_when_no_changes.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest/use_default_dates_when_no_changes.xml deleted file mode 100644 index 4c01980010c..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest/use_default_dates_when_no_changes.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<dataset> - - <rules_profiles id="10" name="Sonar Way" language="java" kee="java-sw" parent_kee="[null]" - rules_updated_at="[null]" created_at="[null]" updated_at="[null]"/> - - - <!-- another profile --> - <active_rule_changes id="124" profile_id="11" profile_version="1" rule_id="2" change_date="2011-12-05 20:20:05.158" - enabled="true" old_severity="[null]" new_severity="1" username="Administrator"/> - -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileKeysMigrationTest/feed_keys.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileKeysMigrationTest/feed_keys.xml deleted file mode 100644 index e40daebdde4..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileKeysMigrationTest/feed_keys.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<dataset> - - <rules_profiles id="10" name="Sonar Way" language="java" parent_name="[null]"/> - - <!-- name is case-sensitive --> - <rules_profiles id="11" name="Sonar way" language="java" parent_name="[null]" /> - - <!-- child --> - <rules_profiles id="12" name="Child" language="java" parent_name="Sonar Way" /> - - <!-- another language --> - <rules_profiles id="13" name="Sonar Way" language="php" parent_name="[null]" /> - -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileKeysMigrationTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileKeysMigrationTest/schema.sql deleted file mode 100644 index 4a5185258d1..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileKeysMigrationTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "RULES_PROFILES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "NAME" VARCHAR(100) NOT NULL, - "LANGUAGE" VARCHAR(20), - "PARENT_NAME" VARCHAR(255), - - "KEE" VARCHAR(100), - "PARENT_KEE" VARCHAR(255), - "RULES_UPDATED_AT" VARCHAR(100), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest/migrate_issues_action_plan_key.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest/migrate_issues_action_plan_key.xml deleted file mode 100644 index 51271c7c2d3..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest/migrate_issues_action_plan_key.xml +++ /dev/null @@ -1,22 +0,0 @@ -<dataset> - - <action_plans id="1" kee="ABCD" project_id="1" name="SHORT_TERM" description="[null]" deadline="[null]" - user_login="igor" status="[null]" created_at="[null]" updated_at="[null]" /> - - <!-- linked on removed action plan --> - <issues ID="1" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="1" - ACTION_PLAN_KEY="REMOVED" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE" - EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05" - ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]" - RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05" - TECHNICAL_DEBT="10"/> - - <!-- linked on not removed action plan --> - <issues ID="2" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="2" - ACTION_PLAN_KEY="ABCD" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE" - EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05" - ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]" - RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05" - TECHNICAL_DEBT="10"/> - -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest/migrate_issues_action_plan_key_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest/migrate_issues_action_plan_key_result.xml deleted file mode 100644 index 6d10f936015..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest/migrate_issues_action_plan_key_result.xml +++ /dev/null @@ -1,19 +0,0 @@ -<dataset> - - <!-- linked on removed action plan --> - <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-04-28 00:00:00.0" - TECHNICAL_DEBT="10"/> - - <!-- linked on not removed action plan --> - <issues ID="2" COMPONENT_ID="11" ROOT_COMPONENT_ID="10" RULE_ID="20" SEVERITY="MINOR" KEE="2" - ACTION_PLAN_KEY="ABCD" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE" - EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05" - ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]" - RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2012-01-05" - TECHNICAL_DEBT="10"/> - -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest/schema.sql deleted file mode 100644 index 1ad49679f5c..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest/schema.sql +++ /dev/null @@ -1,41 +0,0 @@ --- 4.4 - -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 "ACTION_PLANS" ( - "ID" BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "KEE" VARCHAR(100), - "NAME" VARCHAR(200), - "DESCRIPTION" VARCHAR(1000), - "DEADLINE" TIMESTAMP, - "USER_LOGIN" VARCHAR(40), - "PROJECT_ID" INTEGER, - "STATUS" VARCHAR(10), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest/migrate_measure_data-result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest/migrate_measure_data-result.xml deleted file mode 100644 index 209ce80d5d5..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest/migrate_measure_data-result.xml +++ /dev/null @@ -1,23 +0,0 @@ -<dataset> - - <project_measures id="1" VALUE="[null]" METRIC_ID="1" SNAPSHOT_ID="3001" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" - tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" - person_id="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]" - measure_data="MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OQ=="/> - - <measure_data id="1" measure_id="1" snapshot_id="3001" data="MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OQ=="/> - - <!-- already migrated --> - <project_measures id="2" VALUE="[null]" METRIC_ID="1" SNAPSHOT_ID="3001" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" - tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" - person_id="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]" - measure_data="foo"/> - - <measure_data id="2" measure_id="2" snapshot_id="3001" data="foo"/> -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest/migrate_measure_data.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest/migrate_measure_data.xml deleted file mode 100644 index f15b86ae46b..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest/migrate_measure_data.xml +++ /dev/null @@ -1,24 +0,0 @@ -<dataset> - - <project_measures id="1" VALUE="[null]" METRIC_ID="1" SNAPSHOT_ID="3001" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" - tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" - person_id="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]" - measure_data="[null]"/> - - <measure_data id="1" measure_id="1" snapshot_id="3001" data="MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OQ=="/> - - <!-- already migrated --> - <project_measures id="2" VALUE="[null]" METRIC_ID="1" SNAPSHOT_ID="3001" alert_text="[null]" RULES_CATEGORY_ID="[null]" - RULE_ID="[null]" text_value="[null]" - tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" - person_id="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]" - measure_data="foo"/> - - <measure_data id="2" measure_id="2" snapshot_id="3001" data="foo"/> - -</dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest/schema.sql deleted file mode 100644 index 84a37067998..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest/schema.sql +++ /dev/null @@ -1,34 +0,0 @@ --- 4.4 - -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, - "MEASURE_DATA" BINARY(167772150) -); - -CREATE TABLE "MEASURE_DATA" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "MEASURE_ID" BIGINT, - "SNAPSHOT_ID" INTEGER, - "DATA" BINARY(167772150) -); diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/215_create_notifications.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/215_create_notifications.rb index 66fe6dec0f6..b432bc04210 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/215_create_notifications.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/215_create_notifications.rb @@ -25,7 +25,6 @@ class CreateNotifications < ActiveRecord::Migration def self.up create_table 'notifications' do |t| - t.column 'created_at', :datetime, :null => true t.column 'data', :binary, :null => true end end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/430_remove_notifications_created_at.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/430_remove_notifications_created_at.rb deleted file mode 100644 index 363bc5867f6..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/430_remove_notifications_created_at.rb +++ /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. -# - -# -# Sonar 3.7.1 -# -class RemoveNotificationsCreatedAt < ActiveRecord::Migration - - def self.up - remove_column('notifications', 'created_at') - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/431_migrate_users_names.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/431_migrate_users_names.rb deleted file mode 100644 index fc737725814..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/431_migrate_users_names.rb +++ /dev/null @@ -1,43 +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. -# - -# -# Sonar 3.7.1 -# SONAR-4434 -# -class MigrateUsersNames < ActiveRecord::Migration - - class User < ActiveRecord::Base - end - - def self.up - User.reset_column_information - - User.find(:all).each do |user| - if user.name.blank? - user.name = user.login - user.updated_at = Time.now - user.send(:update_without_callbacks) - end - end - - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/440_replace_key_regexp_by_key_search_in_measure_filters_data.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/440_replace_key_regexp_by_key_search_in_measure_filters_data.rb deleted file mode 100644 index a000edc3025..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/440_replace_key_regexp_by_key_search_in_measure_filters_data.rb +++ /dev/null @@ -1,38 +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. -# - -# -# Sonar 4.0 -# SONAR-4195 -# -class ReplaceKeyRegexpByKeySearchInMeasureFiltersData < ActiveRecord::Migration - - class MeasureFilter < ActiveRecord::Base - end - - def self.up - filters = MeasureFilter.all(:conditions => "data like '%keyRegexp%'") - filters.each do |filter| - filter.data = filter.data.sub('keyRegexp', 'keySearch') - filter.save - end - end -end - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/443_rename_widget_sqale_pyramid_to_technical_debt_pyramid.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/443_rename_widget_sqale_pyramid_to_technical_debt_pyramid.rb deleted file mode 100644 index c151be84261..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/443_rename_widget_sqale_pyramid_to_technical_debt_pyramid.rb +++ /dev/null @@ -1,35 +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. -# - -# -# Sonar 4.0 -# SONAR-4738 -# - -class RenameWidgetSqalePyramidToTechnicalDebtPyramid < ActiveRecord::Migration - - class Widget < ActiveRecord::Base - end - - def self.up - Widget.update_all({:widget_key => 'technical_debt_pyramid', :name => 'Technical Debt Pyramid'}, {:widget_key => 'sqalePyramid'}) - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/444_resize_timeline_widgets.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/444_resize_timeline_widgets.rb deleted file mode 100644 index 84a4516848d..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/444_resize_timeline_widgets.rb +++ /dev/null @@ -1,44 +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. -# - -# -# Sonar 4.0 -# SONAR-4416 - Migrate saved timeline chart heights to adapt to new render code (chartHeight += 100) -# - -class ResizeTimelineWidgets < ActiveRecord::Migration - - class Widget < ActiveRecord::Base - end - - class WidgetProperty < ActiveRecord::Base - end - - def self.up - Widget.reset_column_information - WidgetProperty.reset_column_information - - Widget.find(:all, :conditions => { :widget_key => 'timeline' }).each do |widget| - WidgetProperty.find(:all, :conditions => { :widget_id => widget.id, :kee => 'chartHeight' }).each do |property| - property.update_attributes!(:text_value => (property.read_attribute(:text_value).to_i + 100).to_s) - end - end - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/460_add_unique_constraint_to_groups_users.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/460_add_unique_constraint_to_groups_users.rb index 8eeda227be9..e054abd8dca 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/460_add_unique_constraint_to_groups_users.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/460_add_unique_constraint_to_groups_users.rb @@ -23,21 +23,7 @@ # class AddUniqueConstraintToGroupsUsers < ActiveRecord::Migration - class GroupsUser < ActiveRecord::Base - end - def self.up - GroupsUser.reset_column_information - - duplicated_ids = ActiveRecord::Base.connection.select_rows('select user_id,group_id from groups_users group by user_id,group_id having count(*) > 1') - say_with_time "Remove duplications for #{duplicated_ids.size} user group associations" do - duplicated_ids.each do |user_id, group_id| - # delete all rows, then reinsert one - GroupsUser.delete_all([ "user_id=? and group_id=?", user_id, group_id ]) - ActiveRecord::Base.connection.execute("insert into groups_users (user_id,group_id) values (%s,%s)" % [user_id, group_id]) - end - end - add_index :groups_users, [:group_id, :user_id], :name => 'GROUPS_USERS_UNIQUE', :unique => true end end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/462_migrate_characteristics.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/462_migrate_characteristics.rb deleted file mode 100644 index 0d4a182d603..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/462_migrate_characteristics.rb +++ /dev/null @@ -1,142 +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. -# - -# -# Sonar 4.1 -# SONAR-4831 -# SONAR-4895 -# -class MigrateCharacteristics < ActiveRecord::Migration - - class QualityModel < ActiveRecord::Base - end - - class Characteristic < ActiveRecord::Base - end - - class CharacteristicEdge < ActiveRecord::Base - end - - class CharacteristicProperty < ActiveRecord::Base - end - - def self.up - sqale_model = QualityModel.first(:conditions => ['name=?', 'SQALE']) - - # Do nothing if there's no SQALE model installed - if sqale_model - - QualityModel.reset_column_information - Characteristic.reset_column_information - CharacteristicEdge.reset_column_information - CharacteristicProperty.reset_column_information - - now = Time.now - characteristics = Characteristic.all(:conditions => ['quality_model_id=?', sqale_model.id]) - characteristic_edges = CharacteristicEdge.all - parent_ids_by_characteristic_id = {} - characteristic_edges.each do |edge| - parent_ids_by_characteristic_id[edge.child_id] = edge.parent_id - end - - properties = CharacteristicProperty.all - properties_by_characteristic_id = {} - properties.each do |prop| - char_properties = properties_by_characteristic_id[prop.characteristic_id] || [] - char_properties << prop - properties_by_characteristic_id[prop.characteristic_id] = char_properties - end - - characteristics.each do |characteristic| - # Requirement - if characteristic.rule_id - char_properties = properties_by_characteristic_id[characteristic.id] - function = char_properties.find { |prop| prop.kee == 'remediationFunction' } if char_properties - - if char_properties && function - factor = char_properties.find { |prop| prop.kee == 'remediationFactor' } - offset = char_properties.find { |prop| prop.kee == 'offset' } - - case function.text_value - when 'linear' - characteristic.function_key = 'linear' - characteristic.factor_value = factor.value - characteristic.factor_unit = factor.text_value - characteristic.offset_value = 0.0 - characteristic.offset_unit = 'd' - - when 'linear_offset' - characteristic.function_key = 'linear_offset' - characteristic.factor_value = factor.value - characteristic.factor_unit = factor.text_value - characteristic.offset_value = offset.value - characteristic.offset_unit = offset.text_value - - # linear_threshold is depreciated and is replaced by linear - when 'linear_threshold' - characteristic.function_key = 'linear' - characteristic.factor_value = factor.value - characteristic.factor_unit = factor.text_value - characteristic.offset_value = 0.0 - characteristic.offset_unit = 'd' - - # constant_resource is no more managed anymore, it has to be disabled - when 'constant_resource' - characteristic.enabled = false - characteristic.function_key = 'constant_resource' - characteristic.factor_value = 0.0 - characteristic.factor_unit = 'd' - characteristic.offset_value = 0.0 - characteristic.offset_unit = 'd' - - end - # requirement without properties or without remediationFunction has to be disabled - else - characteristic.enabled = false - end - end - - parent_id = parent_ids_by_characteristic_id[characteristic.id] - # Not for root characteristics - if parent_id - characteristic.parent_id = parent_id - # Requirements - if characteristic.rule_id - root_id = parent_ids_by_characteristic_id[characteristic.parent_id] - if root_id - characteristic.root_id = root_id - else - # requirement linked to a root characteristic has to be disabled - characteristic.enabled = false - end - else - # Characteristics has same root_id as parent_id - characteristic.root_id = parent_id - end - end - characteristic.created_at = now - characteristic.updated_at = now - characteristic.save - end - end - end - -end - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/466_add_network_use_sub_characteristic.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/466_add_network_use_sub_characteristic.rb deleted file mode 100644 index 1776eae0a56..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/466_add_network_use_sub_characteristic.rb +++ /dev/null @@ -1,47 +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.1 -# SONAR-4870 -# - -class AddNetworkUseSubCharacteristic < ActiveRecord::Migration - - class Characteristic < ActiveRecord::Base - end - - def self.up - Characteristic.reset_column_information - - # On an empty DB, there are no characteristics, they're all gonna be created after (so new characteristics has always to be also added in the technical-debt-model.xml file) - if Characteristic.all.size > 0 - efficiency = Characteristic.first(:conditions => ['kee=? AND enabled=?', 'EFFICIENCY', true]) - network_use = Characteristic.first(:conditions => ['name=? AND enabled=?', 'Network use ', true]) - - # The Efficiency characteristic can have been deleted from the SQALE plugin - # And the Network use can already been created - if efficiency && !network_use - Characteristic.create(:kee => 'NETWORK_USE_EFFICIENCY', :name => 'Network use', :enabled => true, :parent_id => efficiency.id, :root_id => efficiency.id) if efficiency - end - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/481_copy_rule_notes_to_rules.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/481_copy_rule_notes_to_rules.rb deleted file mode 100644 index 0d1dd5cf4c2..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/481_copy_rule_notes_to_rules.rb +++ /dev/null @@ -1,80 +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. -# - -# -# Sonar 4.2 -# SONAR-4923 -# Copy rule_notes (resp. active_rule_notes) contents to rules (resp. active_rules) -# -class CopyRuleNotesToRules < ActiveRecord::Migration - - class Rule < ActiveRecord::Base - end - - class RuleNote < ActiveRecord::Base - end - - class ActiveRule < ActiveRecord::Base - end - - class ActiveRuleNote < ActiveRecord::Base - end - - def self.up - Rule.reset_column_information - RuleNote.reset_column_information - ActiveRule.reset_column_information - ActiveRuleNote.reset_column_information - - rules = {} - Rule.all.each do |rule| - rules[rule.id] = rule - end - - RuleNote.all.each do |note| - rule = rules[note.rule_id] - if rule - rule.note_created_at = note.created_at - rule.note_updated_at = note.updated_at - rule.note_user_login = note.user_login - rule.note_data = note.data - rule.save - end - end - - active_rules = {} - ActiveRule.all.each do |rule| - active_rules[rule.id] = rule - end - - ActiveRuleNote.all.each do |note| - active_rule = active_rules[note.active_rule_id] - if active_rule - active_rule.note_created_at = note.created_at - active_rule.note_updated_at = note.updated_at - active_rule.note_user_login = note.user_login - active_rule.note_data = note.data - active_rule.save - end - end - end - -end - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/482_purge_group_roles.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/482_purge_group_roles.rb deleted file mode 100644 index b6d3d169e71..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/482_purge_group_roles.rb +++ /dev/null @@ -1,44 +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.2 -# See SONAR-4950 - reverted. Unique constraint is not created but duplications are still purged. -# -class PurgeGroupRoles < ActiveRecord::Migration - - class GroupRole < ActiveRecord::Base - end - - def self.up - GroupRole.reset_column_information - - duplicated_ids = ActiveRecord::Base.connection.select_rows('select group_id,resource_id,role from group_roles group by group_id,resource_id,role having count(*) > 1') - say_with_time "Remove #{duplicated_ids.size} duplicated group roles" do - duplicated_ids.each do |fields| - rows = GroupRole.find(:all, :conditions => {:group_id => fields[0], :resource_id => fields[1], :role => fields[2]}) - # delete all rows except the last one - rows[0...-1].each do |row| - GroupRole.delete(row.id) - end - end - end - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/484_copy_rule_parameters_name_to_active_rule_parameters.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/484_copy_rule_parameters_name_to_active_rule_parameters.rb deleted file mode 100644 index 09c4a649b5e..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/484_copy_rule_parameters_name_to_active_rule_parameters.rb +++ /dev/null @@ -1,47 +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.2 -# SONAR-4950 -# -class CopyRuleParametersNameToActiveRuleParameters < ActiveRecord::Migration - - class ActiveRuleParameter < ActiveRecord::Base - end - - class RulesParameter < ActiveRecord::Base - end - - def self.up - ActiveRuleParameter.reset_column_information - - rule_params_by_id = {} - RulesParameter.all.each do |rule_param| - rule_params_by_id[rule_param.id] = rule_param - end - - ActiveRuleParameter.all.each do |active_rule_parameter| - rule_param = rule_params_by_id[active_rule_parameter.rules_parameter_id] - active_rule_parameter.rules_parameter_key = rule_param.name if rule_param - active_rule_parameter.save - end - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/485_update_rules_without_severity.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/485_update_rules_without_severity.rb deleted file mode 100644 index 86a27c1c8ad..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/485_update_rules_without_severity.rb +++ /dev/null @@ -1,34 +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.2 -# SONAR-4993 -# -class UpdateRulesWithoutSeverity < ActiveRecord::Migration - - class Rule < ActiveRecord::Base - end - - def self.up - Rule.reset_column_information - Rule.update_all({:priority => 2, :updated_at => Time.now}, 'priority IS NULL') - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/490_migrate_package_keys.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/490_migrate_package_keys.rb deleted file mode 100644 index d17ed8c28c4..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/490_migrate_package_keys.rb +++ /dev/null @@ -1,31 +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.2 -# SONAR-926 -# -class MigratePackageKeys < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v42.PackageKeysMigrationStep') - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/493_delete_display_treemap_from_measure_filters.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/493_delete_display_treemap_from_measure_filters.rb deleted file mode 100644 index 9710fabe06a..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/493_delete_display_treemap_from_measure_filters.rb +++ /dev/null @@ -1,38 +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.2 -# SONAR-4997 -# -class DeleteDisplayTreemapFromMeasureFilters < ActiveRecord::Migration - - class MeasureFilter < ActiveRecord::Base - end - - def self.up - filters = MeasureFilter.all(:conditions => "data like '%display=treemap%'") - filters.each do |filter| - filter.data = filter.data.sub('display=treemap', '') - filter.save - end - end -end - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/494_delete_properties_on_unknown_components.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/494_delete_properties_on_unknown_components.rb deleted file mode 100644 index 587ca29d79d..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/494_delete_properties_on_unknown_components.rb +++ /dev/null @@ -1,34 +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.2 -# SONAR-5013 -# -class DeletePropertiesOnUnknownComponents < ActiveRecord::Migration - - class Property < ActiveRecord::Base - end - - def self.up - Property.delete_all('resource_id IS NOT NULL AND resource_id NOT IN (SELECT id FROM projects)') - end -end - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/495_migrate_base_id_to_base_from_measure_filters.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/495_migrate_base_id_to_base_from_measure_filters.rb deleted file mode 100644 index 9bee50e2cda..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/495_migrate_base_id_to_base_from_measure_filters.rb +++ /dev/null @@ -1,43 +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.2 -# SONAR-4921 -# -class MigrateBaseIdToBaseFromMeasureFilters < ActiveRecord::Migration - - class MeasureFilter < ActiveRecord::Base - end - - def self.up - filters = MeasureFilter.all(:conditions => "data LIKE '%baseId=%'") - filters.each do |filter| - matchBaseId = filter.data.match(/baseId=(\d+)/) - if matchBaseId - projectId = matchBaseId[1] - project = Project.find_by_id(projectId) - # If project exists, we replace the condition using project id by the condition using project key, otherwise we removed the condition - filter.data = filter.data.sub(/baseId=\d+/, project ? "base=#{project.kee}" : '') - filter.save - end - end - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/496_delete_language_property.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/496_delete_language_property.rb deleted file mode 100644 index 7f9f82d76a7..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/496_delete_language_property.rb +++ /dev/null @@ -1,34 +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.2 -# SONAR-926 -# The property sonar.language must not be set in global settings -# -class DeleteLanguageProperty < ActiveRecord::Migration - - class Property < ActiveRecord::Base - end - - def self.up - Property.delete_all("prop_key = 'sonar.language'") - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/497_update_issue_message_by_rule_name_when_no_message.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/497_update_issue_message_by_rule_name_when_no_message.rb deleted file mode 100644 index 3eb73f963f4..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/497_update_issue_message_by_rule_name_when_no_message.rb +++ /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.2 -# SONAR-4785 -# -class UpdateIssueMessageByRuleNameWhenNoMessage < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v42.CompleteIssueMessageMigrationStep') - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/498_remove_duplicate_active_rules.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/498_remove_duplicate_active_rules.rb deleted file mode 100644 index f9710ba9496..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/498_remove_duplicate_active_rules.rb +++ /dev/null @@ -1,54 +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.2 -# SONAR-5067 -# -class RemoveDuplicateActiveRules < ActiveRecord::Migration - - class ActiveRuleParameters < ActiveRecord::Base - end - - class ActiveRule < ActiveRecord::Base - end - - def self.up - # Search for all rules activated many times on a same profile - rule_actived_many_times_on_same_profile = ActiveRule.all( - :select => 'rule_id,profile_id', - :group => 'rule_id,profile_id', - :having => 'COUNT(*) > 1' - ) - - rule_actived_many_times_on_same_profile.each do |duplicate_active_rule| - # Search for all duplication on current rule and profile - active_rules = ActiveRule.all( - :conditions => {:rule_id => duplicate_active_rule.rule_id, :profile_id => duplicate_active_rule.profile_id} - ) - # Remove duplication, keep only one active rule (first one) - active_rules.drop(1).each do |active_rule| - ActiveRuleParameters.delete_all(:active_rule_id => active_rule.id) - active_rule.delete - end - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/512_convert_alerts_to_quality_gates.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/512_convert_alerts_to_quality_gates.rb deleted file mode 100644 index 408a8ebcafb..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/512_convert_alerts_to_quality_gates.rb +++ /dev/null @@ -1,78 +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 -# -class ConvertAlertsToQualityGates < ActiveRecord::Migration - - class RulesProfile < ActiveRecord::Base - end - - class Alert < ActiveRecord::Base - end - - class QualityGate < ActiveRecord::Base - end - - class QualityGateCondition < ActiveRecord::Base - end - - def self.up - - RulesProfile.reset_column_information - Alert.reset_column_information - QualityGate.reset_column_information - QualityGateCondition.reset_column_information - - alerts = {} - Alert.all.each do |alert| - alerts[alert.profile_id] ||= [] - alerts[alert.profile_id].push alert - end - - new_operators = { - '=' => 'EQ', - '!=' => 'NE', - '>' => 'GT', - '<' => 'LT' - } - - RulesProfile.all.each do |profile| - if alerts.has_key?(profile.id) - qgate_name = profile.name + ' - ' + profile.language - - # This block allows re-execution in case of failure - old_qgate = QualityGate.find_by_name(qgate_name) - unless old_qgate.nil? - QualityGateCondition.destroy_all(:qgate_id => old_qgate.id) - old_qgate.destroy - end - - qgate = QualityGate.create(:name => qgate_name) - alerts[profile.id].each do |alert| - QualityGateCondition.create(:qgate_id => qgate.id, :metric_id => alert.metric_id, :operator => new_operators[alert.operator], - :value_warning => alert.value_warning, :value_error => alert.value_error, :period => alert.period) - end - end - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/513_convert_issue_debt_to_minutes.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/513_convert_issue_debt_to_minutes.rb deleted file mode 100644 index c02eaf1a2b5..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/513_convert_issue_debt_to_minutes.rb +++ /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 ConvertIssueDebtToMinutes < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v43.ConvertIssueDebtToMinutesMigrationStep') - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/514_update_issue_changelog_debt_to_minutes.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/514_update_issue_changelog_debt_to_minutes.rb deleted file mode 100644 index 5b755a77e44..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/514_update_issue_changelog_debt_to_minutes.rb +++ /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 UpdateIssueChangelogDebtToMinutes < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v43.IssueChangelogMigrationStep') - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/515_update_measures_debt_to_minutes.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/515_update_measures_debt_to_minutes.rb deleted file mode 100644 index fe5ed6bbec6..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/515_update_measures_debt_to_minutes.rb +++ /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 UpdateMeasuresDebtToMinutes < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v43.TechnicalDebtMeasuresMigrationStep') - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/516_update_development_cost_to_minutes.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/516_update_development_cost_to_minutes.rb deleted file mode 100644 index 39eca632abb..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/516_update_development_cost_to_minutes.rb +++ /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 UpdateDevelopmentCostToMinutes < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v43.DevelopmentCostMeasuresMigrationStep') - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/517_update_work_units_by_size_point_property_to_minutes.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/517_update_work_units_by_size_point_property_to_minutes.rb deleted file mode 100644 index 212d76364ad..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/517_update_work_units_by_size_point_property_to_minutes.rb +++ /dev/null @@ -1,58 +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 UpdateWorkUnitsBySizePointPropertyToMinutes < ActiveRecord::Migration - - class Property < ActiveRecord::Base - - end - - def self.up - hours_in_day_prop = Property.find_by_prop_key('sonar.technicalDebt.hoursInDay') - hours_in_day = hours_in_day_prop && hours_in_day_prop.text_value ? hours_in_day_prop.text_value.to_i : 8 - work_units_by_size_point = Property.find_by_prop_key('workUnitsBySizePoint') - if work_units_by_size_point && work_units_by_size_point.text_value && work_units_by_size_point.text_value.to_f - work_units_by_size_point.text_value = convert_days_to_minutes(work_units_by_size_point.text_value.to_f, hours_in_day).to_s - work_units_by_size_point.save! - end - - language_specific_parameters = Property.find_by_prop_key('languageSpecificParameters') - if language_specific_parameters - values = language_specific_parameters.text_value.split(',') - values.each do |value| - prop = Property.find_by_prop_key('languageSpecificParameters.' + value + '.man_days') - if prop && prop.text_value && prop.text_value.to_f - prop.text_value = convert_days_to_minutes(prop.text_value.to_f, hours_in_day).to_s - prop.save! - end - end - end - end - - def self.convert_days_to_minutes(hours, hours_in_day) - result = hours * hours_in_day * 60 - # Round value - result.ceil - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/518_update_conditions_on_debt_to_minutes.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/518_update_conditions_on_debt_to_minutes.rb deleted file mode 100644 index a2cca32e581..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/518_update_conditions_on_debt_to_minutes.rb +++ /dev/null @@ -1,65 +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 UpdateConditionsOnDebtToMinutes < ActiveRecord::Migration - - class Property < ActiveRecord::Base - - end - - class QualityGateCondition < ActiveRecord::Base - - end - - class Metric < ActiveRecord::Base - - end - - def self.up - Property.reset_column_information - Metric.reset_column_information - QualityGateCondition.reset_column_information - - hours_in_day_prop = Property.find_by_prop_key('sonar.technicalDebt.hoursInDay') - hours_in_day = hours_in_day_prop && hours_in_day_prop.text_value ? hours_in_day_prop.text_value.to_i : 8 - - metrics = Metric.find(:all, :conditions => ['name in (?)', ['sqale_index', 'new_technical_debt', - 'sqale_effort_to_grade_a', 'sqale_effort_to_grade_b', 'sqale_effort_to_grade_c', 'sqale_effort_to_grade_d', - 'blocker_remediation_cost', 'critical_remediation_cost', 'major_remediation_cost', 'minor_remediation_cost', - 'info_remediation_cost']]) - conditions = QualityGateCondition.all(:conditions => ['metric_id in (?)', metrics.map { |m| m.id } ]) - - conditions.each do |condition| - condition.value_error = convert_days_to_minutes(condition.value_error.to_f, hours_in_day) unless condition.value_error.blank? - condition.value_warning = convert_days_to_minutes(condition.value_warning.to_f, hours_in_day) unless condition.value_warning.blank? - condition.save! - end - end - - def self.convert_days_to_minutes(hours, hours_in_day) - result = hours * hours_in_day * 60 - # Round value - result.ceil - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/519_update_measure_filters_on_debt_to_minutes.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/519_update_measure_filters_on_debt_to_minutes.rb deleted file mode 100644 index 0a45158a190..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/519_update_measure_filters_on_debt_to_minutes.rb +++ /dev/null @@ -1,69 +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 UpdateMeasureFiltersOnDebtToMinutes < ActiveRecord::Migration - - class Property < ActiveRecord::Base - - end - - class MeasureFilter < ActiveRecord::Base - - end - - def self.up - Property.reset_column_information - MeasureFilter.reset_column_information - - hours_in_day_prop = Property.find_by_prop_key('sonar.technicalDebt.hoursInDay') - hours_in_day = hours_in_day_prop && hours_in_day_prop.text_value ? hours_in_day_prop.text_value.to_i : 8 - - filters = MeasureFilter.all(:conditions => "data LIKE '%_metric=sqale_index%' OR data LIKE '%_metric=new_technical_debt%'" + - " OR data LIKE '%_metric=sqale_effort_to_grade_a%' OR data LIKE '%_metric=sqale_effort_to_grade_b%' OR data LIKE '%_metric=sqale_effort_to_grade_c%' " + - " OR data LIKE '%_metric=sqale_effort_to_grade_d%'"+ - " OR data LIKE '%_metric=blocker_remediation_cost%' OR data LIKE '%_metric=critical_remediation_cost%' OR data LIKE '%_metric=major_remediation_cost%' "+ - " OR data LIKE '%_metric=minor_remediation_cost%' OR data LIKE '%_metric=info_remediation_cost%'" - ) - filters.each do |filter| - data = filter.data.to_s - data.scan(/c(\d+)_metric=(sqale_index|new_technical_debt|sqale_effort_to_grade_a|sqale_effort_to_grade_b|sqale_effort_to_grade_c|sqale_effort_to_grade_d|blocker_remediation_cost - |critical_remediation_cost|major_remediation_cost|minor_remediation_cost|info_remediation_cost)/) do |find| - index = find[0] - # Update filter value when it's before a '|' or at the end of the string - value = /c#{index}_val=((.+?)(\||\z))?/.match(data)[2] - if value - new_value = convert_days_to_minutes(value.to_f, hours_in_day) - filter.data = filter.data.sub("c#{index}_val=#{value}", "c#{index}_val=#{new_value}") - end - end - filter.save! - end - end - - def self.convert_days_to_minutes(hours, hours_in_day) - result = hours * hours_in_day * 60 - # Round value - result.ceil - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/521_update_requirement_measures.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/521_update_requirement_measures.rb deleted file mode 100644 index 436e864ae63..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/521_update_requirement_measures.rb +++ /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-5056 -# -class UpdateRequirementMeasures < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v43.RequirementMeasuresMigrationStep') - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/523_add_characteristic_reusability_and_sub_characteristic_resource.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/523_add_characteristic_reusability_and_sub_characteristic_resource.rb deleted file mode 100644 index 3d956e6126d..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/523_add_characteristic_reusability_and_sub_characteristic_resource.rb +++ /dev/null @@ -1,69 +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-5180 -# -class AddCharacteristicReusabilityAndSubCharacteristicResource < ActiveRecord::Migration - - class Characteristic < ActiveRecord::Base - end - - def self.up - Characteristic.reset_column_information - - # On an empty DB, there are no characteristics, they're all gonna be created after - if Characteristic.all.size > 0 - create_characteristic_reusability_and_its_sub_characteristics - create_sub_characteristic_resource - end - end - - def self.create_characteristic_reusability_and_its_sub_characteristics - # 'Reusability' is the new characteristic, it has two sub characteristics : 'Modularity' and 'Transportability' - reusability = Characteristic.first(:conditions => ['kee=? AND enabled=?', 'REUSABILITY', true]) - modularity = Characteristic.first(:conditions => ['kee=? AND enabled=?', 'MODULARITY', true]) - transportability = Characteristic.first(:conditions => ['kee=? AND enabled=?', 'TRANSPORTABILITY', true]) - - unless reusability - # Reusability should become the first characteristic - reusability = Characteristic.create(:name => 'Reusability', :kee => 'REUSABILITY', :characteristic_order => 1, :enabled => true) - # So all other characteristics have to moved down - Characteristic.all(:conditions => ['enabled=? AND parent_id IS NULL AND rule_id IS NULL', true]).each do |c| - c.characteristic_order = c.characteristic_order + 1 - c.save! - end - end - - Characteristic.create(:name => 'Modularity', :kee => 'MODULARITY', :parent_id => reusability.id, :enabled => true) unless modularity - Characteristic.create(:name => 'Transportability', :kee => 'TRANSPORTABILITY', :parent_id => reusability.id, :enabled => true) unless transportability - end - - def self.create_sub_characteristic_resource - # New sub characteristic 'Resource' (under characteristic 'Reliability') - resource = Characteristic.first(:conditions => ['kee=? AND enabled=?', 'RESOURCE_RELIABILITY', true]) - unless resource - reliability = Characteristic.first(:conditions => ['kee=? AND enabled=?', 'RELIABILITY', true]) - Characteristic.create(:name => 'Resource', :kee => 'RESOURCE_RELIABILITY', :parent_id => reliability.id, :enabled => true) if reliability - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/524_update_sub_characteristic_network_use_key.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/524_update_sub_characteristic_network_use_key.rb deleted file mode 100644 index eed522f91ec..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/524_update_sub_characteristic_network_use_key.rb +++ /dev/null @@ -1,44 +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-5180 -# -class UpdateSubCharacteristicNetworkUseKey < ActiveRecord::Migration - - class Characteristic < ActiveRecord::Base - end - - def self.up - Characteristic.reset_column_information - - # On an empty DB, there are no characteristics, they're all gonna be created after - if Characteristic.all.size > 0 - # NETWORK_USE was created with a bad key in the migration 466 - network_use = Characteristic.first(:conditions => ['kee=? AND enabled=?', 'NETWORK_USE_EFFICIENCY', true]) - if network_use - network_use.kee = 'NETWORK_USE' - network_use.save! - end - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/525_update_not_resolved_issues_on_removed_components.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/525_update_not_resolved_issues_on_removed_components.rb deleted file mode 100644 index 778d82658a0..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/525_update_not_resolved_issues_on_removed_components.rb +++ /dev/null @@ -1,31 +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-5200 -# -class UpdateNotResolvedIssuesOnRemovedComponents < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v43.NotResolvedIssuesOnRemovedComponentsMigrationStep') - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/526_remove_unshared_active_dashboards.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/526_remove_unshared_active_dashboards.rb deleted file mode 100644 index 6c35790ce4e..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/526_remove_unshared_active_dashboards.rb +++ /dev/null @@ -1,44 +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-4979 -# -class RemoveUnsharedActiveDashboards < ActiveRecord::Migration - - class Dashboard < ActiveRecord::Base - set_table_name 'dashboards' - end - - class ActiveDashboard < ActiveRecord::Base - set_table_name 'active_dashboards' - belongs_to :dashboard, :class_name => 'Dashboard' - end - - def self.up - Dashboard.reset_column_information - ActiveDashboard.reset_column_information - - # Delete every active_dashboards linked on unshared dashboard not owned by the user - ActiveDashboard.all(:joins => 'inner join dashboards on dashboards.id=active_dashboards.dashboard_id', :conditions => ['dashboards.shared=? AND active_dashboards.user_id<>dashboards.user_id', false]).each {|ad| ad.delete} - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/530_merge_measure_data_into_project_measures.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/530_merge_measure_data_into_project_measures.rb index 401a74ffb42..78e35172f2c 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/530_merge_measure_data_into_project_measures.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/530_merge_measure_data_into_project_measures.rb @@ -34,18 +34,7 @@ class MergeMeasureDataIntoProjectMeasures < ActiveRecord::Migration ActiveRecord::Base.connection.commit_db_transaction end ProjectMeasure.reset_column_information - execute_java_migration('org.sonar.server.db.migrations.v44.MeasureDataMigrationStep') drop_table(:measure_data) end - - def self.execute_ddl(message, ddl) - begin - say_with_time(message) do - ActiveRecord::Base.connection.execute(ddl) - end - rescue - # already executed - end - end - + end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/531_update_issues_action_plan_key_on_removed_action_plan.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/531_update_issues_action_plan_key_on_removed_action_plan.rb deleted file mode 100644 index 479e36534ee..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/531_update_issues_action_plan_key_on_removed_action_plan.rb +++ /dev/null @@ -1,31 +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.4 -# SONAR-5218 -# -class UpdateIssuesActionPlanKeyOnRemovedActionPlan < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v44.IssueActionPlanKeyMigrationStep') - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/539_insert_active_rule_dates.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/539_insert_active_rule_dates.rb deleted file mode 100644 index 0c2e5c8fe30..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/539_insert_active_rule_dates.rb +++ /dev/null @@ -1,41 +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.4 -# SONAR-5007 -# -class InsertActiveRuleDates < ActiveRecord::Migration - - class ActiveRule < ActiveRecord::Base - end - - def self.up - ActiveRule.reset_column_information - now = Time.now - ActiveRule.find(:all).each do |active_rule| - active_rule.created_at=now - active_rule.updated_at=now - active_rule.save! - end - end - -end - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/541_add_unique_index_on_active_rule_key.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/541_add_unique_index_on_active_rule_key.rb index 9885d253f77..730847f5aa6 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/541_add_unique_index_on_active_rule_key.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/541_add_unique_index_on_active_rule_key.rb @@ -25,35 +25,7 @@ class AddUniqueIndexOnActiveRuleKey < ActiveRecord::Migration - class ActiveRuleParameter < ActiveRecord::Base - end - - class ActiveRule < ActiveRecord::Base - end - def self.up - ActiveRule.reset_column_information - ActiveRuleParameter.reset_column_information - - # Search for all rules activated many times on a same profile - rule_actived_many_times_on_same_profile = ActiveRule.all( - :select => 'rule_id,profile_id', - :group => 'rule_id,profile_id', - :having => 'COUNT(*) > 1' - ) - - rule_actived_many_times_on_same_profile.each do |duplicate_active_rule| - # Search for all duplication on current rule and profile - active_rules = ActiveRule.all( - :conditions => {:rule_id => duplicate_active_rule.rule_id, :profile_id => duplicate_active_rule.profile_id} - ) - # Remove duplication, keep only one active rule (first one) - active_rules.drop(1).each do |active_rule| - ActiveRuleParameter.delete_all(:active_rule_id => active_rule.id) - active_rule.delete - end - end - add_index :active_rules, [:profile_id, :rule_id], :name => 'uniq_profile_rule_ids', :unique => true end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/545_rename_rules_cardinality_to_is_template.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/545_rename_rules_cardinality_to_is_template.rb index c8203cba112..c6eb7b3a858 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/545_rename_rules_cardinality_to_is_template.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/545_rename_rules_cardinality_to_is_template.rb @@ -30,10 +30,6 @@ class RenameRulesCardinalityToIsTemplate < ActiveRecord::Migration def self.up add_column 'rules', 'is_template', :boolean, :null => false, :default => false Rule.reset_column_information - Rule.all.each do |r| - r.is_template = r.cardinality == 'MULTIPLE' - r.save! - end remove_column 'rules', 'cardinality' end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/546_inverse_rule_key_index.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/546_inverse_rule_key_index.rb deleted file mode 100644 index 6cf46b03186..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/546_inverse_rule_key_index.rb +++ /dev/null @@ -1,99 +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. -# - -# -# SQ 4.4 -# SONAR-5001 -# -require 'set' -class InverseRuleKeyIndex < ActiveRecord::Migration - - - class ActiveRule < ActiveRecord::Base - set_table_name 'active_rules' - end - - class Characteristic < ActiveRecord::Base - set_table_name 'characteristics' - end - - class Issue < ActiveRecord::Base - set_table_name 'issues' - end - - class ActiveRuleChange < ActiveRecord::Base - set_table_name 'active_rule_changes' - end - - class ProjectMeasure < ActiveRecord::Base - set_table_name 'project_measures' - end - - class Rule < ActiveRecord::Base - end - - class RuleParameter < ActiveRecord::Base - set_table_name 'rules_parameters' - end - - def self.up - begin - remove_index :rules, :name => 'rules_plugin_key_and_name' - rescue - #ignore - end - - # rows can be duplicated because the unique index was sometimes missing - delete_duplicated_rules - - add_index :rules, [:plugin_name, :plugin_rule_key], :unique => true, :name => 'rules_repo_key' - end - - private - def self.delete_duplicated_rules - ActiveRule.reset_column_information - ActiveRuleChange.reset_column_information - Characteristic.reset_column_information - Issue.reset_column_information - ProjectMeasure.reset_column_information - Rule.reset_column_information - RuleParameter.reset_column_information - - say_with_time 'Delete duplicated rules' do - existing_keys = Set.new - rules=Rule.find(:all, :select => 'id,plugin_name,plugin_rule_key', :order => 'id') - rules.each do |rule| - key = "#{rule.plugin_name}:#{rule.plugin_rule_key}" - if existing_keys.include?(key) - say "Delete duplicated rule '#{key}' (id=#{rule.id})" - ActiveRule.delete_all(['rule_id=?', rule.id]) - ActiveRuleChange.delete_all(['rule_id=?', rule.id]) - Characteristic.delete_all(['rule_id=?', rule.id]) - Issue.delete_all(['rule_id=?', rule.id]) - ProjectMeasure.delete_all(['rule_id=?', rule.id]) - RuleParameter.delete_all(['rule_id=?', rule.id]) - rule.destroy - else - existing_keys.add(key) - end - end - end - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/547_merge_custom_rules_extended_description_with_description.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/547_merge_custom_rules_extended_description_with_description.rb deleted file mode 100644 index b8f2377212c..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/547_merge_custom_rules_extended_description_with_description.rb +++ /dev/null @@ -1,44 +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.4 -# SONAR-5397 -# -class MergeCustomRulesExtendedDescriptionWithDescription < ActiveRecord::Migration - - class Rule < ActiveRecord::Base - end - - def self.up - Rule.reset_column_information - Rule.all(:conditions => ['template_id IS NOT NULL and note_data IS NOT NULL']).each do |r| - unless r.note_data.blank? - r.description += '<br/>' + r.note_data - r.note_data = nil - r.note_user_login = nil - r.note_created_at = nil - r.note_updated_at = nil - r.save! - end - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/549_feed_qprofile_keys.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/549_feed_qprofile_keys.rb index d2b579ccbd8..81724162b26 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/549_feed_qprofile_keys.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/549_feed_qprofile_keys.rb @@ -25,8 +25,6 @@ class FeedQprofileKeys < ActiveRecord::Migration def self.up - execute_java_migration('org.sonar.server.db.migrations.v44.FeedQProfileKeysMigrationStep') - # set as non-null and unique change_column :rules_profiles, :kee, :string, :limit => 255, :null => false add_index :rules_profiles, :kee, :name => 'uniq_qprof_key', :unique => true diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/550_convert_profile_measures.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/550_convert_profile_measures.rb deleted file mode 100644 index 1543cc3fadf..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/550_convert_profile_measures.rb +++ /dev/null @@ -1,41 +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.4 -# SONAR-5218 -# -class ConvertProfileMeasures < ActiveRecord::Migration - - class Metric < ActiveRecord::Base - end - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v44.ConvertProfileMeasuresMigrationStep') - - Metric.reset_column_information - metric = Metric.find_by_name('profile') - if metric - metric.name='quality_profiles' - metric.save! - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/551_update_logs_to_activities.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/551_update_logs_to_activities.rb deleted file mode 100644 index d11201aee8e..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/551_update_logs_to_activities.rb +++ /dev/null @@ -1,31 +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.4 -# SONAR-5218 -# -class UpdateLogsToActivities < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v44.ChangeLogMigrationStep') - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/553_feed_qprofile_dates.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/553_feed_qprofile_dates.rb deleted file mode 100644 index f8cc4868a22..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/553_feed_qprofile_dates.rb +++ /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.4 -# -class FeedQprofileDates < ActiveRecord::Migration - - def self.up - execute_java_migration 'org.sonar.server.db.migrations.v44.FeedQProfileDatesMigrationStep' - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/554_add_missing_user_unique_index.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/554_add_missing_user_unique_index.rb deleted file mode 100644 index 3101ce1beef..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/554_add_missing_user_unique_index.rb +++ /dev/null @@ -1,108 +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.4 -# See SONAR-5405 -# -require 'set' - -class AddMissingUserUniqueIndex < ActiveRecord::Migration - - class User < ActiveRecord::Base - end - - class UserRole < ActiveRecord::Base - end - - class Property < ActiveRecord::Base - set_table_name 'properties' - end - - class GroupsUsers < ActiveRecord::Base - set_table_name 'groups_users' - end - - class Dashboard < ActiveRecord::Base - set_table_name 'dashboards' - has_many :active_dashboards, :dependent => :destroy, :inverse_of => :dashboard - end - - class ActiveDashboard < ActiveRecord::Base - set_table_name 'active_dashboards' - belongs_to :dashboard - end - - class PermTemplatesUser < ActiveRecord::Base - set_table_name 'perm_templates_users' - end - - class MeasureFilter < ActiveRecord::Base - set_table_name 'measure_filters' - has_many :measure_filter_favourites, :dependent => :delete_all - end - - class MeasureFilterFavourite < ActiveRecord::Base - set_table_name 'measure_filter_favourites' - belongs_to :measure_filter - end - - def self.up - unless index_exists?(:users, :login, nil) - delete_duplicated_users - add_index :users, :login, :name => 'users_login', :unique => true - end - end - - private - def self.delete_duplicated_users - User.reset_column_information - UserRole.reset_column_information - Property.reset_column_information - GroupsUsers.reset_column_information - Dashboard.reset_column_information - ActiveDashboard.reset_column_information - PermTemplatesUser.reset_column_information - MeasureFilter.reset_column_information - MeasureFilterFavourite.reset_column_information - - say_with_time 'Delete duplicated users' do - existing_logins = Set.new - users=User.find(:all, :select => 'id,login', :order => 'id') - users.each do |user| - if existing_logins.include?(user.login) - say "Delete duplicated login '#{user.login}' (id=#{user.id})" - UserRole.delete_all(['user_id=?', user.id]) - Property.delete_all(['user_id=?', user.id]) - GroupsUsers.delete_all(['user_id=?', user.id]) - Dashboard.destroy_all(['user_id=?', user.id]) - ActiveDashboard.destroy_all(['user_id=?', user.id]) - PermTemplatesUser.destroy_all(['user_id=?', user.id]) - MeasureFilter.destroy_all(['user_id=?', user.id]) - MeasureFilterFavourite.destroy_all(['user_id=?', user.id]) - user.destroy - else - existing_logins.add(user.login) - end - end - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/556_fill_rules_empty_name_and_desc.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/556_fill_rules_empty_name_and_desc.rb deleted file mode 100644 index 28b6f96f852..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/556_fill_rules_empty_name_and_desc.rb +++ /dev/null @@ -1,45 +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.4 -# SONAR-5426 -# -class FillRulesEmptyNameAndDesc < ActiveRecord::Migration - - class Rule < ActiveRecord::Base - end - - def self.up - Rule.reset_column_information - - Rule.all(['name IS NULL OR description IS NULL']).each do |rule| - key = rule.plugin_rule_key - unless rule.name - rule.name = key - end - unless rule.description - rule.description = key - end - rule.save! - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/582_update_existing_rules_description_format.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/582_update_existing_rules_description_format.rb deleted file mode 100644 index 4f5fc6be52a..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/582_update_existing_rules_description_format.rb +++ /dev/null @@ -1,35 +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.5 -# SONAR-5001 -# -class UpdateExistingRulesDescriptionFormat < ActiveRecord::Migration - - class Rule < ActiveRecord::Base - end - - def self.up - Rule.reset_column_information - Rule.update_all({:description_format => 'HTML', :updated_at => Time.now}, "plugin_name != 'manual' AND template_id IS NULL") - Rule.update_all({:description_format => 'MARKDOWN', :updated_at => Time.now}, "plugin_name = 'manual' OR template_id IS NOT NULL") - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/583_add_missing_rule_parameter_default_values.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/583_add_missing_rule_parameter_default_values.rb deleted file mode 100644 index e8c6f8d70dd..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/583_add_missing_rule_parameter_default_values.rb +++ /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.5 -# -class AddMissingRuleParameterDefaultValues < ActiveRecord::Migration - - def self.up - execute_java_migration 'org.sonar.server.db.migrations.v45.AddMissingRuleParameterDefaultValuesMigrationStep' - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/584_delete_measures_on_deleted_profiles.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/584_delete_measures_on_deleted_profiles.rb deleted file mode 100644 index 8a075d5fba9..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/584_delete_measures_on_deleted_profiles.rb +++ /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.5 -# -class DeleteMeasuresOnDeletedProfiles < ActiveRecord::Migration - - def self.up - execute_java_migration 'org.sonar.server.db.migrations.v45.DeleteMeasuresOnDeletedProfilesMigrationStep' - end - -end |