diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2011-02-07 17:40:42 +0100 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2011-02-07 17:40:42 +0100 |
commit | a34a3671bd0c8427ae3cdf165f7a2136713e875e (patch) | |
tree | 935f87c27ad5d31f62a0aeab92683e83bebcc1ea /plugins | |
parent | 9354714ba90720b6bf74213e65e2766831f46292 (diff) | |
download | sonarqube-a34a3671bd0c8427ae3cdf165f7a2136713e875e.tar.gz sonarqube-a34a3671bd0c8427ae3cdf165f7a2136713e875e.zip |
Remove useless purge
Diffstat (limited to 'plugins')
6 files changed, 1 insertions, 258 deletions
diff --git a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/DbCleanerPlugin.java b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/DbCleanerPlugin.java index 2ab4c945bca..68308e30f6a 100644 --- a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/DbCleanerPlugin.java +++ b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/DbCleanerPlugin.java @@ -69,7 +69,7 @@ public final class DbCleanerPlugin implements Plugin { // purges PurgeOrphanResources.class, PurgeEntities.class, PurgeRuleMeasures.class, PurgeUnprocessed.class, - PurgeDeletedResources.class, PurgeDeprecatedLast.class, UnflagLastDoublons.class, PurgeDisabledResources.class, + PurgeDeletedResources.class, PurgeDeprecatedLast.class, PurgeDisabledResources.class, PurgeResourceRoles.class, PurgeEventOrphans.class, PurgePropertyOrphans.class, PeriodPurge.class, PurgeDependencies.class, // post-job diff --git a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/purges/UnflagLastDoublons.java b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/purges/UnflagLastDoublons.java deleted file mode 100644 index 5799850f8e8..00000000000 --- a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/purges/UnflagLastDoublons.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2011 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.purges; - -import org.sonar.api.database.DatabaseSession; -import org.sonar.api.database.model.Snapshot; -import org.sonar.plugins.dbcleaner.api.Purge; -import org.sonar.plugins.dbcleaner.api.PurgeContext; -import org.sonar.plugins.dbcleaner.api.PurgeUtils; - -import java.util.List; - -import javax.persistence.Query; - -/** - * @since 1.11 - */ -public final class UnflagLastDoublons extends Purge { - - public UnflagLastDoublons(DatabaseSession session) { - super(session); - } - - public void purge(PurgeContext context) { - Query query = getSession().createQuery( - "SELECT olds.id FROM " + Snapshot.class.getSimpleName() + " olds " + - " where olds.last=true AND EXISTS (from " + Snapshot.class.getSimpleName() + " news WHERE news.last=true AND news.resourceId=olds.resourceId AND news.createdAt>olds.createdAt)"); - List<Integer> snapshotIds = query.getResultList(); - - PurgeUtils.executeQuery(getSession(), "", snapshotIds, "UPDATE " + Snapshot.class.getSimpleName() + " SET last=false WHERE id in (:ids)"); - } -} diff --git a/plugins/sonar-dbcleaner-plugin/src/test/java/org/sonar/plugins/dbcleaner/purges/UnflagLastDoublonsTest.java b/plugins/sonar-dbcleaner-plugin/src/test/java/org/sonar/plugins/dbcleaner/purges/UnflagLastDoublonsTest.java deleted file mode 100644 index e9204a462d9..00000000000 --- a/plugins/sonar-dbcleaner-plugin/src/test/java/org/sonar/plugins/dbcleaner/purges/UnflagLastDoublonsTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2011 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.purges; - -import org.junit.Test; -import org.sonar.jpa.test.AbstractDbUnitTestCase; - -import java.sql.SQLException; - -public class UnflagLastDoublonsTest extends AbstractDbUnitTestCase { - - @Test - public void unflagLastDoublons() throws SQLException { - setupData("sharedFixture", "unflagLastDoublons"); - - new UnflagLastDoublons(getSession()).purge(null); - - checkTables("unflagLastDoublons", "snapshots"); - } -} - diff --git a/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/purges/UnflagLastDoublonsTest/sharedFixture.xml b/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/purges/UnflagLastDoublonsTest/sharedFixture.xml deleted file mode 100644 index b0485cc36ca..00000000000 --- a/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/purges/UnflagLastDoublonsTest/sharedFixture.xml +++ /dev/null @@ -1,34 +0,0 @@ -<!-- - ~ Sonar, open source software quality management tool. - ~ Copyright (C) 2008-2011 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 - --> -<dataset> - - <!-- 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]"/> - - <!-- package --> - <projects long_name="[null]" id="2" scope="DIR" qualifier="PAC" kee="mygroup:myartifact:my.package" name="package" - root_id="[null]" - description="[null]" - enabled="true" language="java" copy_resource_id="[null]"/> - -</dataset>
\ No newline at end of file diff --git a/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/purges/UnflagLastDoublonsTest/unflagLastDoublons-result.xml b/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/purges/UnflagLastDoublonsTest/unflagLastDoublons-result.xml deleted file mode 100644 index 61e0dfbce33..00000000000 --- a/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/purges/UnflagLastDoublonsTest/unflagLastDoublons-result.xml +++ /dev/null @@ -1,68 +0,0 @@ -<!-- - ~ Sonar, open source software quality management tool. - ~ Copyright (C) 2008-2011 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 - --> -<dataset> - - <!-- first analysis, not flagged as last --> - - <snapshots depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="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]" 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]" /> - - <snapshots depth="[null]" id="2" scope="DIR" qualifier="PAC" created_at="2008-12-02 13:58:00.00" version="[null]" - project_id="2" - parent_snapshot_id="1" root_project_id="[null]" root_snapshot_id="1" status="P" islast="false" - path="[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]" /> - - - <!-- second analysis, flag islast => false --> - <snapshots depth="[null]" id="3" scope="PRJ" qualifier="TRK" created_at="2009-02-14 00:00: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]" 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]" /> - - <snapshots depth="[null]" id="4" scope="DIR" qualifier="PAC" created_at="2009-02-14 00:00:00.00" version="[null]" - project_id="2" - parent_snapshot_id="3" root_project_id="[null]" root_snapshot_id="3" status="P" islast="false" - path="[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]" /> - - <!-- third analysis, flag islast => false --> - <snapshots depth="[null]" id="5" scope="PRJ" qualifier="TRK" created_at="2009-04-01 00:00: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]" 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]" /> - - <snapshots depth="[null]" id="6" scope="DIR" qualifier="PAC" created_at="2009-04-01 00:00:00.00" version="[null]" - project_id="2" - parent_snapshot_id="5" root_project_id="[null]" root_snapshot_id="5" status="P" islast="false" - path="[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]" /> - - - <!-- last analysis --> - <snapshots depth="[null]" id="7" scope="PRJ" qualifier="TRK" created_at="2009-05-18 00:00:00.00" version="[null]" - project_id="1" - parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true" - path="[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]" /> - - <snapshots depth="[null]" id="8" scope="DIR" qualifier="PAC" created_at="2009-05-18 00:00:00.00" version="[null]" - project_id="2" - parent_snapshot_id="7" root_project_id="[null]" root_snapshot_id="7" status="P" islast="true" - path="[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]" /> -</dataset>
\ No newline at end of file diff --git a/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/purges/UnflagLastDoublonsTest/unflagLastDoublons.xml b/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/purges/UnflagLastDoublonsTest/unflagLastDoublons.xml deleted file mode 100644 index 97a76b074fd..00000000000 --- a/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/purges/UnflagLastDoublonsTest/unflagLastDoublons.xml +++ /dev/null @@ -1,68 +0,0 @@ -<!-- - ~ Sonar, open source software quality management tool. - ~ Copyright (C) 2008-2011 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 - --> -<dataset> - - <!-- first analysis, not flagged as last --> - - <snapshots depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="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]" 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]" /> - - <snapshots depth="[null]" id="2" scope="DIR" qualifier="PAC" created_at="2008-12-02 13:58:00.00" version="[null]" - project_id="2" - parent_snapshot_id="1" root_project_id="[null]" root_snapshot_id="1" status="P" islast="false" - path="[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]"/> - - - <!-- second analysis, crazy state : project not last, but package flagged as last --> - <snapshots depth="[null]" id="3" scope="PRJ" qualifier="TRK" created_at="2009-02-14 00:00: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]" 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]"/> - - <snapshots depth="[null]" id="4" scope="DIR" qualifier="PAC" created_at="2009-02-14 00:00:00.00" version="[null]" - project_id="2" - parent_snapshot_id="3" root_project_id="[null]" root_snapshot_id="3" status="P" islast="true" - path="[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]"/> - - <!-- third analysis, flagged as last --> - <snapshots depth="[null]" id="5" scope="PRJ" qualifier="TRK" created_at="2009-04-01 00:00:00.00" version="[null]" - project_id="1" - parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true" - path="[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]"/> - - <snapshots depth="[null]" id="6" scope="DIR" qualifier="PAC" created_at="2009-04-01 00:00:00.00" version="[null]" - project_id="2" - parent_snapshot_id="5" root_project_id="[null]" root_snapshot_id="5" status="P" islast="true" - path="[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]"/> - - - <!-- last analysis --> - <snapshots depth="[null]" id="7" scope="PRJ" qualifier="TRK" created_at="2009-05-18 00:00:00.00" version="[null]" - project_id="1" - parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true" - path="[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]"/> - - <snapshots depth="[null]" id="8" scope="DIR" qualifier="PAC" created_at="2009-05-18 00:00:00.00" version="[null]" - project_id="2" - parent_snapshot_id="7" root_project_id="[null]" root_snapshot_id="7" status="P" islast="true" - path="[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]"/> -</dataset>
\ No newline at end of file |