diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2013-03-15 20:23:21 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2013-03-15 20:23:21 +0100 |
commit | f2df9622b581fa34da9265f01dbbb73375818739 (patch) | |
tree | 3c3a8692af9a22fecd0b799740e43899c1505585 /plugins/sonar-dbcleaner-plugin | |
parent | 65cf6e0ac9b9bb42dec7df31c371fe05d116c876 (diff) | |
download | sonarqube-f2df9622b581fa34da9265f01dbbb73375818739.tar.gz sonarqube-f2df9622b581fa34da9265f01dbbb73375818739.zip |
Remove deprecated and unused API of dbcleaner plugin
Diffstat (limited to 'plugins/sonar-dbcleaner-plugin')
8 files changed, 1 insertions, 659 deletions
diff --git a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/api/PeriodCleaner.java b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/api/PeriodCleaner.java deleted file mode 100644 index 44c02d9a503..00000000000 --- a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/api/PeriodCleaner.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar 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. - * - * Sonar 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 Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.dbcleaner.api; - -import org.sonar.api.task.TaskExtension; - -import org.sonar.api.resources.Project; - -/** - * @deprecated in 2.14 - */ -@Deprecated -public interface PeriodCleaner extends TaskExtension { - void purge(Project project, int projectSnapshotId); -} diff --git a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/api/Purge.java b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/api/Purge.java deleted file mode 100644 index 5a147f72028..00000000000 --- a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/api/Purge.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar 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. - * - * Sonar 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 Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.dbcleaner.api; - -import org.sonar.api.BatchExtension; -import org.sonar.api.database.DatabaseSession; - -/** - * Implement this component in order to define your own rules to cleanup database. - * - * @since 2.5 - * @deprecated in 2.14 - */ -@Deprecated -public abstract class Purge implements BatchExtension { - - private DatabaseSession session; - - protected Purge(DatabaseSession session) { - this.session = session; - } - - protected final DatabaseSession getSession() { - return session; - } - - /** - * Snapshots include the current snapshot (flagged as last) and optionally the penultimate one. - * - * @snapshots never null. - */ - public abstract void purge(PurgeContext context); - - @Override - public String toString() { - return getClass().getName(); - } -} diff --git a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/api/PurgeContext.java b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/api/PurgeContext.java deleted file mode 100644 index 544949a3d7e..00000000000 --- a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/api/PurgeContext.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar 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. - * - * Sonar 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 Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.dbcleaner.api; - -import org.sonar.api.resources.Project; - -/** - * @since 2.5 - * @deprecated in 2.14 - */ -@Deprecated -public interface PurgeContext { - - Project getProject(); - - /** - * @return the snapshot id of the current project - */ - Integer getSnapshotId(); - - /** - * Can be null - */ - Integer getPreviousSnapshotId(); -} diff --git a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/api/PurgeUtils.java b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/api/PurgeUtils.java deleted file mode 100644 index e84b513e27d..00000000000 --- a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/api/PurgeUtils.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar 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. - * - * Sonar 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 Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.dbcleaner.api; - -import com.google.common.annotations.VisibleForTesting; -import org.apache.commons.configuration.Configuration; -import org.sonar.api.batch.Event; -import org.sonar.api.database.DatabaseSession; -import org.sonar.api.database.model.*; -import org.sonar.api.design.DependencyDto; -import org.sonar.api.utils.TimeProfiler; - -import javax.persistence.Query; -import java.util.List; - -/** - * @since 2.5 - * @deprecated Useless since version 2.14 because of the refactoring of the cleanup mechanism (see SONAR-2757). - */ -@Deprecated -public final class PurgeUtils { - - public static final int DEFAULT_MINIMUM_PERIOD_IN_HOURS = 12; - public static final String PROP_KEY_MINIMUM_PERIOD_IN_HOURS = "sonar.purge.minimumPeriodInHours"; - - /** - * Maximum elements in the SQL statement "IN" due to an Oracle limitation (see error ORA-01795) - */ - public static final int MAX_IN_ELEMENTS = 950; - - private PurgeUtils() { - // only static methods - } - - public static int getMinimumPeriodInHours(Configuration conf) { - int hours = DEFAULT_MINIMUM_PERIOD_IN_HOURS; - if (conf != null) { - hours = conf.getInt(PROP_KEY_MINIMUM_PERIOD_IN_HOURS, DEFAULT_MINIMUM_PERIOD_IN_HOURS); - } - return hours; - } - - public static void deleteSnapshotsData(DatabaseSession session, List<Integer> snapshotIds) { - deleteMeasuresBySnapshotId(session, snapshotIds); - deleteSources(session, snapshotIds); - deleteViolations(session, snapshotIds); - deleteDependencies(session, snapshotIds); - deleteDuplicationBlocks(session, snapshotIds); - deleteEvents(session, snapshotIds); - deleteSnapshots(session, snapshotIds); - } - - public static void deleteDependencies(DatabaseSession session, List<Integer> snapshotIds) { - executeQuery(session, "delete dependencies", snapshotIds, "delete from " + DependencyDto.class.getSimpleName() + " d where d.fromSnapshotId in (:ids)"); - executeQuery(session, "delete dependencies", snapshotIds, "delete from " + DependencyDto.class.getSimpleName() + " d where d.toSnapshotId in (:ids)"); - } - - /** - * Delete all measures, including MEASURE_DATA - */ - public static void deleteMeasuresBySnapshotId(DatabaseSession session, List<Integer> snapshotIds) { - executeQuery(session, "delete measures by snapshot id", snapshotIds, "delete from " + MeasureData.class.getSimpleName() + " m where m.snapshotId in (:ids)"); - executeQuery(session, "delete measures by snapshot id", snapshotIds, "delete from " + MeasureModel.class.getSimpleName() + " m where m.snapshotId in (:ids)"); - } - - /** - * Delete all measures, including MEASURE_DATA - */ - public static void deleteMeasuresById(DatabaseSession session, List<Integer> measureIds) { - executeQuery(session, "delete measures by id", measureIds, "delete from " + MeasureData.class.getSimpleName() + " m where m.measure.id in (:ids)"); - executeQuery(session, "delete measures by id", measureIds, "delete from " + MeasureModel.class.getSimpleName() + " m where m.id in (:ids)"); - } - - /** - * Delete SNAPSHOT_SOURCES table - */ - public static void deleteSources(DatabaseSession session, List<Integer> snapshotIds) { - executeQuery(session, "delete sources", snapshotIds, "delete from " + SnapshotSource.class.getSimpleName() + " e where e.snapshotId in (:ids)"); - } - - /** - * Delete violations (RULE_FAILURES table) - */ - public static void deleteViolations(DatabaseSession session, List<Integer> snapshotIds) { - executeQuery(session, "delete violations", snapshotIds, "delete from " + RuleFailureModel.class.getSimpleName() + " e where e.snapshotId in (:ids)"); - } - - /** - * Delete DUPLICATIONS_INDEX table - * - * @since 2.11 - */ - private static void deleteDuplicationBlocks(DatabaseSession session, List<Integer> snapshotIds) { - executeNativeQuery(session, "delete duplication blocks", snapshotIds, "delete from duplications_index where snapshot_id in (:ids)"); - } - - /** - * Delete EVENTS table - */ - public static void deleteEvents(DatabaseSession session, List<Integer> snapshotIds) { - executeQuery(session, "delete events", snapshotIds, "delete from " + Event.class.getSimpleName() + " e where e.snapshot.id in (:ids)"); - } - - /** - * Delete SNAPSHOTS table - */ - public static void deleteSnapshots(DatabaseSession session, List<Integer> snapshotIds) { - executeQuery(session, "delete snapshots", snapshotIds, "delete from " + Snapshot.class.getSimpleName() + " s where s.id in (:ids)"); - } - - public static void deleteResources(DatabaseSession session, List<Integer> ids) { - executeQuery(session, "", ids, "DELETE FROM " + ResourceModel.class.getSimpleName() + " WHERE id in (:ids)"); - deleteResourceIndex(session, ids); - } - - /** - * Delete RESOURCE_INDEX table - */ - public static void deleteResourceIndex(DatabaseSession session, List<Integer> resourceIds) { - executeNativeQuery(session, "delete resource_index", resourceIds, "delete from resource_index where resource_id in (:ids)"); - } - - /** - * Paginate execution of SQL requests to avoid exceeding size of rollback segment - */ - public static void executeQuery(DatabaseSession session, String description, List<Integer> ids, String hql) { - if (ids == null || ids.isEmpty()) { - return; - } - TimeProfiler profiler = new TimeProfiler().setLevelToDebug().start("Execute " + description); - int index = 0; - while (index < ids.size()) { - List<Integer> paginedSids = ids.subList(index, Math.min(ids.size(), index + MAX_IN_ELEMENTS)); - Query query = session.createQuery(hql); - query.setParameter("ids", paginedSids); - query.executeUpdate(); - index += MAX_IN_ELEMENTS; - session.commit(); - } - profiler.stop(); - } - - /** - * @since 2.13 - */ - @VisibleForTesting - static void executeNativeQuery(DatabaseSession session, String description, List<Integer> ids, String sql) { - if (ids == null || ids.isEmpty()) { - return; - } - TimeProfiler profiler = new TimeProfiler().setLevelToDebug().start("Execute " + description); - int index = 0; - while (index < ids.size()) { - List<Integer> paginedSids = ids.subList(index, Math.min(ids.size(), index + MAX_IN_ELEMENTS)); - Query query = session.createNativeQuery(sql); - query.setParameter("ids", paginedSids); - query.executeUpdate(); - index += MAX_IN_ELEMENTS; - session.commit(); - } - profiler.stop(); - } - -} diff --git a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/period/DefaultPeriodCleaner.java b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/period/DefaultPeriodCleaner.java index 016e11eeceb..d4339204747 100644 --- a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/period/DefaultPeriodCleaner.java +++ b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/period/DefaultPeriodCleaner.java @@ -28,11 +28,10 @@ import org.sonar.api.utils.DateUtils; import org.sonar.core.purge.PurgeDao; import org.sonar.core.purge.PurgeSnapshotQuery; import org.sonar.core.purge.PurgeableSnapshotDto; -import org.sonar.plugins.dbcleaner.api.PeriodCleaner; import java.util.List; -public class DefaultPeriodCleaner implements PeriodCleaner { +public class DefaultPeriodCleaner { private static final Logger LOG = LoggerFactory.getLogger(DefaultPeriodCleaner.class); private PurgeDao purgeDao; diff --git a/plugins/sonar-dbcleaner-plugin/src/test/java/org/sonar/plugins/dbcleaner/api/PurgeUtilsTest.java b/plugins/sonar-dbcleaner-plugin/src/test/java/org/sonar/plugins/dbcleaner/api/PurgeUtilsTest.java deleted file mode 100644 index bea6ed413b6..00000000000 --- a/plugins/sonar-dbcleaner-plugin/src/test/java/org/sonar/plugins/dbcleaner/api/PurgeUtilsTest.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar 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. - * - * Sonar 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 Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.dbcleaner.api; - -import com.google.common.collect.Lists; -import org.apache.commons.configuration.PropertiesConfiguration; -import org.junit.Test; -import org.sonar.api.database.DatabaseSession; -import org.sonar.jpa.test.AbstractDbUnitTestCase; - -import javax.persistence.Query; - -import java.util.Arrays; -import java.util.List; - -import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertThat; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class PurgeUtilsTest extends AbstractDbUnitTestCase { - - @Test - public void shouldReturnDefaultMinimumPeriod() { - assertThat(PurgeUtils.getMinimumPeriodInHours(new PropertiesConfiguration()), is(PurgeUtils.DEFAULT_MINIMUM_PERIOD_IN_HOURS)); - } - - @Test - public void shouldReturnMinimumPeriod() { - PropertiesConfiguration conf = new PropertiesConfiguration(); - conf.setProperty(PurgeUtils.PROP_KEY_MINIMUM_PERIOD_IN_HOURS, "9"); - assertThat(PurgeUtils.getMinimumPeriodInHours(conf), is(9)); - } - - @Test - public void purgeSnapshots() { - setupData("purgeSnapshots"); - - PurgeUtils.deleteSnapshotsData(getSession(), Arrays.asList(3, 4)); - - checkTables("purgeSnapshots", "snapshots", "project_measures", "measure_data", "rule_failures", "snapshot_sources", "dependencies", "events", "duplications_index"); - } - - @Test - public void shouldPaginate() throws Exception { - DatabaseSession session = mock(DatabaseSession.class); - Query query = mock(Query.class); - when(session.createQuery(anyString())).thenReturn(query); - when(session.createNativeQuery(anyString())).thenReturn(query); - - List<Integer> ids = Lists.newArrayList(); - for (int i = 0; i < (PurgeUtils.MAX_IN_ELEMENTS + 1); i++) { - ids.add(i); - } - - // createQuery() and createNativeQuery() should be invoked as many times as commit(), because it starts new transaction - - PurgeUtils.executeQuery(session, "description", ids, "hql"); - verify(session, times(2)).createQuery(anyString()); - verify(session, times(2)).commit(); - - PurgeUtils.executeNativeQuery(session, "description", ids, "sql"); - verify(session, times(2)).createNativeQuery(anyString()); - verify(session, times(4)).commit(); - } - -} diff --git a/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/api/PurgeUtilsTest/purgeSnapshots-result.xml b/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/api/PurgeUtilsTest/purgeSnapshots-result.xml deleted file mode 100644 index 4818b2d8b75..00000000000 --- a/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/api/PurgeUtilsTest/purgeSnapshots-result.xml +++ /dev/null @@ -1,127 +0,0 @@ -<dataset> - <rules id="1" name="foo" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1" - plugin_name="maven-checkstyle-plugin" description="description" cardinality="SINGLE" parent_id="[null]"/> - - <metrics delete_historical_data="[null]" id="1" name="ncloc" val_type="INT" description="[null]" domain="[null]" - short_name="" qualitative="false" user_managed="false" enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/> - - <!-- project --> - <projects long_name="[null]" id="1" scope="PRJ" qualifier="TRK" kee="mygroup:myartifact" name="project" - root_id="[null]" - description="[null]" - enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> - - <!-- package --> - <projects long_name="[null]" id="2" scope="DIR" qualifier="PAC" kee="mygroup:myartifact:my.package" name="package" - root_id="1" - description="[null]" - enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> - - <!-- files --> - <projects long_name="[null]" id="3" scope="FIL" qualifier="CLA" kee="mygroup:myartifact:my.package.Class1" - name="class" root_id="1" - description="[null]" - enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> - - <projects long_name="[null]" id="4" scope="FIL" qualifier="CLA" kee="mygroup:myartifact:my.package.Class2" - name="class" root_id="1" - description="[null]" - enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> - - - <snapshots purge_status="[null]" 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]" depth="[null]" id="1" - scope="PRJ" qualifier="TRK" created_at="2008-12-02 13:58:00.00" build_date="2008-12-02 13:58:00.00" version="[null]" - project_id="1" - parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="false" - path="[null]"/> - - <snapshots purge_status="[null]" 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]" depth="[null]" id="2" - scope="DIR" qualifier="PAC" created_at="2008-12-02 13:58:00.00" build_date="2008-12-02 13:58:00.00" version="[null]" - project_id="2" - parent_snapshot_id="2" root_project_id="[null]" root_snapshot_id="1" status="P" islast="false" - path="[null]"/> - - - <!--<snapshots purge_status="[null]" 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]" depth="[null]" id="3" scope="FIL" qualifier="CLA" created_at="2008-12-02 13:58:00.00" build_date="2008-12-02 13:58:00.00" version="[null]"--> - <!--project_id="3"--> - <!--parent_snapshot_id="2" root_project_id="[null]" root_snapshot_id="1" status="P" islast="false"--> - <!--path="[null]"/>--> - - <!--<snapshots purge_status="[null]" 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]" depth="[null]" id="4" scope="FIL" qualifier="CLA" created_at="2008-12-02 13:58:00.00" build_date="2008-12-02 13:58:00.00" version="[null]"--> - <!--project_id="4"--> - <!--parent_snapshot_id="2" root_project_id="[null]" root_snapshot_id="1" status="P" islast="false"--> - <!--path="[null]"/>--> - - - <SNAPSHOT_SOURCES ID="1" SNAPSHOT_ID="30" DATA="some sources"/> - <!--<SNAPSHOT_SOURCES ID="2" SNAPSHOT_ID="4" DATA="some sources"/>--> - - - <rule_failures switched_off="[null]" permanent_id="[null]" ID="1" SNAPSHOT_ID="1" RULE_ID="1" FAILURE_LEVEL="2" MESSAGE="msg1" LINE="[null]" COST="[null]" created_at="2008-12-02 13:58:00.00" - checksum="[null]" person_id="[null]"/> - <rule_failures switched_off="[null]" permanent_id="[null]" ID="2" SNAPSHOT_ID="2" RULE_ID="1" FAILURE_LEVEL="2" MESSAGE="msg2" LINE="[null]" COST="[null]" created_at="2008-12-02 13:58:00.00" - checksum="[null]" person_id="[null]"/> - <!--<rule_failures switched_off="[null]" permanent_id="[null]" ID="3" SNAPSHOT_ID="3" RULE_ID="1" FAILURE_LEVEL="2" MESSAGE="msg3" LINE="[null]" COST="[null]" created_at="2008-12-02 13:58:00.00" checksum="[null]" person_id="[null]" />--> - <!--<rule_failures switched_off="[null]" permanent_id="[null]" ID="4" SNAPSHOT_ID="4" RULE_ID="1" FAILURE_LEVEL="2" MESSAGE="msg4" LINE="[null]" COST="[null]" created_at="2008-12-02 13:58:00.00" checksum="[null]" person_id="[null]" />--> - - - <project_measures 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]" - rule_priority="[null]" - alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" rules_category_id="[null]" - RULE_ID="1" - person_id="[null]" - text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]"/> - - <project_measures 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]" - rule_priority="[null]" - alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" rules_category_id="[null]" - RULE_ID="1" - person_id="[null]" - text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]"/> - - <!--<project_measures 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]"--> - <!--rule_priority="[null]"--> - <!--alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" rules_category_id="[null]"--> - <!--RULE_ID="1"--> - <!--person_id="[null]"--> - <!--text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"--> - <!--alert_status="[null]" description="[null]"/>--> - - <!--<project_measures 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]"--> - <!--rule_priority="[null]"--> - <!--alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" rules_category_id="[null]"--> - <!--RULE_ID="1"--> - <!--person_id="[null]"--> - <!--text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"--> - <!--alert_status="[null]" description="[null]"/>--> - - - <measure_data id="1" measure_id="1" snapshot_id="1" data="[null]"/> - <measure_data id="2" measure_id="2" snapshot_id="2" data="[null]"/> - <!--<measure_data id="3" measure_id="3" snapshot_id="3" data="[null]"/>--> - <!--<measure_data id="4" measure_id="4" snapshot_id="4" data="[null]"/>--> - - <dependencies id="1" from_resource_id="1" from_snapshot_id="1" to_resource_id="30" to_snapshot_id="30" - parent_dependency_id="[null]" project_snapshot_id="1" - dep_usage="USES" dep_weight="1" from_scope="PRJ" to_scope="LIB"/> - - <!--<dependencies id="2" from_resource_id="3" from_snapshot_id="3" to_resource_id="40" to_snapshot_id="40"--> - <!--parent_dependency_id="[null]" project_snapshot_id="1"--> - <!--dep_usage="INHERITS" dep_weight="1" from_scope="FIL" to_scope="FIL"/>--> - - <!--<dependencies id="3" from_resource_id="50" from_snapshot_id="50" to_resource_id="3" to_snapshot_id="3"--> - <!--parent_dependency_id="[null]" project_snapshot_id="1"--> - <!--dep_usage="INHERITS" dep_weight="1" from_scope="FIL" to_scope="FIL"/>--> - - <duplications_index project_snapshot_id="1" snapshot_id="1" hash="bb" index_in_file="0" start_line="0" end_line="0"/> - <!--<duplications_index project_snapshot_id="1" snapshot_id="3" hash="bb" index_in_file="0" start_line="0" end_line="0" />--> - <!--<duplications_index project_snapshot_id="1" snapshot_id="4" hash="bb" index_in_file="0" start_line="0" end_line="0" />--> - - <events id="1" name="Version 1.0" resource_id="1" snapshot_id="1" category="VERSION" description="[null]" event_date="2008-12-02 13:58:00.00" created_at="[null]"/> - <!--events id="2" name="Version 2.0" resource_id="3" snapshot_id="3" category="VERSION" description="[null]" event_date="2008-12-02 13:58:00.00" created_at="[null]"/--> - -</dataset> diff --git a/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/api/PurgeUtilsTest/purgeSnapshots.xml b/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/api/PurgeUtilsTest/purgeSnapshots.xml deleted file mode 100644 index 7c719cc0df3..00000000000 --- a/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/api/PurgeUtilsTest/purgeSnapshots.xml +++ /dev/null @@ -1,133 +0,0 @@ -<dataset> - <rules id="1" name="foo" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1" - plugin_name="maven-checkstyle-plugin" description="description" cardinality="SINGLE" parent_id="[null]"/> - - <metrics delete_historical_data="[null]" id="1" name="ncloc" val_type="INT" description="[null]" domain="[null]" - short_name="" qualitative="false" user_managed="false" enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/> - - <!-- project --> - <projects long_name="[null]" id="1" scope="PRJ" qualifier="TRK" kee="mygroup:myartifact" name="project" - root_id="[null]" - description="[null]" - enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> - - <!-- package --> - <projects long_name="[null]" id="2" scope="DIR" qualifier="PAC" kee="mygroup:myartifact:my.package" name="package" - root_id="1" - description="[null]" - enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> - - <!-- files --> - <projects long_name="[null]" id="3" scope="FIL" qualifier="CLA" kee="mygroup:myartifact:my.package.Class1" - name="class" root_id="1" - description="[null]" - enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> - - <projects long_name="[null]" id="4" scope="FIL" qualifier="CLA" kee="mygroup:myartifact:my.package.Class2" - name="class" root_id="1" - description="[null]" - enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> - - - <snapshots purge_status="[null]" 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]" depth="[null]" id="1" - scope="PRJ" qualifier="TRK" created_at="2008-12-02 13:58:00.00" build_date="2008-12-02 13:58:00.00" version="[null]" - project_id="1" - parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="false" - path="[null]"/> - - <snapshots purge_status="[null]" 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]" depth="[null]" id="2" - scope="DIR" qualifier="PAC" created_at="2008-12-02 13:58:00.00" build_date="2008-12-02 13:58:00.00" version="[null]" - project_id="2" - parent_snapshot_id="2" root_project_id="[null]" root_snapshot_id="1" status="P" islast="false" - path="[null]"/> - - - <snapshots purge_status="[null]" 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]" depth="[null]" id="3" - scope="FIL" qualifier="CLA" created_at="2008-12-02 13:58:00.00" build_date="2008-12-02 13:58:00.00" version="[null]" - project_id="3" - parent_snapshot_id="2" root_project_id="[null]" root_snapshot_id="1" status="P" islast="false" - path="[null]"/> - - <snapshots purge_status="[null]" 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]" depth="[null]" id="4" - scope="FIL" qualifier="CLA" created_at="2008-12-02 13:58:00.00" build_date="2008-12-02 13:58:00.00" version="[null]" - project_id="4" - parent_snapshot_id="2" root_project_id="[null]" root_snapshot_id="1" status="P" islast="false" - path="[null]"/> - - - <SNAPSHOT_SOURCES ID="1" SNAPSHOT_ID="30" DATA="some sources"/> - <SNAPSHOT_SOURCES ID="2" SNAPSHOT_ID="4" DATA="some sources"/> - - - <rule_failures switched_off="[null]" permanent_id="[null]" ID="1" SNAPSHOT_ID="1" RULE_ID="1" FAILURE_LEVEL="2" MESSAGE="msg1" LINE="[null]" COST="[null]" created_at="2008-12-02 13:58:00.00" - checksum="[null]" person_id="[null]"/> - <rule_failures switched_off="[null]" permanent_id="[null]" ID="2" SNAPSHOT_ID="2" RULE_ID="1" FAILURE_LEVEL="2" MESSAGE="msg2" LINE="[null]" COST="[null]" created_at="2008-12-02 13:58:00.00" - checksum="[null]" person_id="[null]"/> - <rule_failures switched_off="[null]" permanent_id="[null]" ID="3" SNAPSHOT_ID="3" RULE_ID="1" FAILURE_LEVEL="2" MESSAGE="msg3" LINE="[null]" COST="[null]" created_at="2008-12-02 13:58:00.00" - checksum="[null]" person_id="[null]"/> - <rule_failures switched_off="[null]" permanent_id="[null]" ID="4" SNAPSHOT_ID="4" RULE_ID="1" FAILURE_LEVEL="2" MESSAGE="msg4" LINE="[null]" COST="[null]" created_at="2008-12-02 13:58:00.00" - checksum="[null]" person_id="[null]"/> - - - <project_measures 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]" - rule_priority="[null]" - alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" rules_category_id="[null]" - RULE_ID="1" - person_id="[null]" - text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]"/> - - <project_measures 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]" - rule_priority="[null]" - alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" rules_category_id="[null]" - RULE_ID="1" - person_id="[null]" - text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]"/> - - <project_measures 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]" - rule_priority="[null]" - alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" rules_category_id="[null]" - RULE_ID="1" - person_id="[null]" - text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]"/> - - <project_measures 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]" - rule_priority="[null]" - alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" rules_category_id="[null]" - RULE_ID="1" - person_id="[null]" - text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" - alert_status="[null]" description="[null]"/> - - - <measure_data id="1" measure_id="1" snapshot_id="1" data="[null]"/> - <measure_data id="2" measure_id="2" snapshot_id="2" data="[null]"/> - <measure_data id="3" measure_id="3" snapshot_id="3" data="[null]"/> - <measure_data id="4" measure_id="4" snapshot_id="4" data="[null]"/> - - <dependencies id="1" from_resource_id="1" from_snapshot_id="1" to_resource_id="30" to_snapshot_id="30" - parent_dependency_id="[null]" project_snapshot_id="1" - dep_usage="USES" dep_weight="1" from_scope="PRJ" to_scope="LIB"/> - - <dependencies id="2" from_resource_id="3" from_snapshot_id="3" to_resource_id="40" to_snapshot_id="40" - parent_dependency_id="[null]" project_snapshot_id="1" - dep_usage="INHERITS" dep_weight="1" from_scope="FIL" to_scope="FIL"/> - - <dependencies id="3" from_resource_id="50" from_snapshot_id="50" to_resource_id="3" to_snapshot_id="3" - parent_dependency_id="[null]" project_snapshot_id="1" - dep_usage="INHERITS" dep_weight="1" from_scope="FIL" to_scope="FIL"/> - - <duplications_index project_snapshot_id="1" snapshot_id="1" hash="bb" index_in_file="0" start_line="0" end_line="0"/> - <duplications_index project_snapshot_id="1" snapshot_id="3" hash="bb" index_in_file="0" start_line="0" end_line="0"/> - <duplications_index project_snapshot_id="1" snapshot_id="4" hash="bb" index_in_file="0" start_line="0" end_line="0"/> - - <events id="1" name="Version 1.0" resource_id="1" snapshot_id="1" category="VERSION" description="[null]" event_date="2008-12-02 13:58:00.00" created_at="[null]"/> - <events id="2" name="Version 2.0" resource_id="3" snapshot_id="3" category="VERSION" description="[null]" event_date="2008-12-02 13:58:00.00" created_at="[null]"/> - -</dataset> |