]> source.dussan.org Git - sonarqube.git/commitdiff
Remove useless purge
authorsimonbrandhof <simon.brandhof@gmail.com>
Mon, 7 Feb 2011 16:40:42 +0000 (17:40 +0100)
committersimonbrandhof <simon.brandhof@gmail.com>
Mon, 7 Feb 2011 16:40:42 +0000 (17:40 +0100)
plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/DbCleanerPlugin.java
plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/purges/UnflagLastDoublons.java [deleted file]
plugins/sonar-dbcleaner-plugin/src/test/java/org/sonar/plugins/dbcleaner/purges/UnflagLastDoublonsTest.java [deleted file]
plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/purges/UnflagLastDoublonsTest/sharedFixture.xml [deleted file]
plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/purges/UnflagLastDoublonsTest/unflagLastDoublons-result.xml [deleted file]
plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/purges/UnflagLastDoublonsTest/unflagLastDoublons.xml [deleted file]

index 2ab4c945bcabab6f69f2d696012cbdb20d09b590..68308e30f6adb3c16a48a7604d763bb152cef9ff 100644 (file)
@@ -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 (file)
index 5799850..0000000
+++ /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 (file)
index e9204a4..0000000
+++ /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 (file)
index b0485cc..0000000
+++ /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 (file)
index 61e0dfb..0000000
+++ /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 (file)
index 97a76b0..0000000
+++ /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