]> source.dussan.org Git - sonarqube.git/commitdiff
Remove no more used PurgeDao.selectPurgeableFileUuids()
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 16 Jul 2015 07:33:56 +0000 (09:33 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 16 Jul 2015 10:02:21 +0000 (12:02 +0200)
sonar-db/src/main/java/org/sonar/db/purge/PurgeDao.java
sonar-db/src/main/java/org/sonar/db/purge/PurgeMapper.java
sonar-db/src/main/resources/org/sonar/db/purge/PurgeMapper.xml
sonar-db/src/test/java/org/sonar/db/purge/PurgeDaoTest.java
sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/select_purgeable_file_uuids.xml [deleted file]

index f4ddf2478b696c15dc04562035ffd3f7b514811c..e7d1fe5a945f283b4f65b89e51c63da972c6e2f1 100644 (file)
@@ -232,10 +232,6 @@ public class PurgeDao implements Dao {
     return projects;
   }
 
-  public List<String> selectPurgeableFiles(DbSession dbSession, Long projectId) {
-    return mapper(dbSession).selectPurgeableFileUuids(projectId);
-  }
-
   private PurgeMapper mapper(DbSession session) {
     return session.getMapper(PurgeMapper.class);
   }
index b1f84d0925f7afaec45daa4a5a9befd3328f329a..2cc04037aed2235473a5ac0e4566dba4e0c31391 100644 (file)
@@ -91,5 +91,4 @@ public interface PurgeMapper {
 
   void deleteFileSourcesByUuid(String fileUuid);
 
-  List<String> selectPurgeableFileUuids(Long projectId);
 }
index 1d6bed4780618e59222fb1ae9e5b0f2df6229cfe..49555dd8ca5485c756bb24facb936d9affda2a2c 100644 (file)
     and not exists(select s.project_id from snapshots s where s.islast=${_true} and s.project_id=p.id)
   </select>
 
-  <select id="selectPurgeableFileUuids" resultType="string" parameterType="long">
-    select p.uuid from projects p
-    where (p.id=#{id} or p.root_id=#{id}) and p.enabled=${_true} and p.scope='FIL'
-    and not exists(select s.project_id from snapshots s where s.islast=${_true} and s.project_id=p.id)
-  </select>
-
   <select id="selectMetricIdsWithoutHistoricalData" resultType="long">
     select id from metrics where delete_historical_data=${_true}
   </select>
index 6f1f5e0e336de2f0a910efb720bf870cf450c171..b981084b439c8187b3e5fc87920b7ab11bd2bea8 100644 (file)
@@ -66,7 +66,7 @@ public class PurgeDaoTest {
   @Test
   public void shouldDeleteHistoricalDataOfDirectoriesAndFiles() {
     dbTester.prepareDbUnit(getClass(), "shouldDeleteHistoricalDataOfDirectoriesAndFiles.xml");
-    sut.purge(new PurgeConfiguration(new IdUuidPair(1L, "1"), new String[]{Scopes.DIRECTORY, Scopes.FILE}, 30), PurgeListener.EMPTY, new PurgeProfiler());
+    sut.purge(new PurgeConfiguration(new IdUuidPair(1L, "1"), new String[] {Scopes.DIRECTORY, Scopes.FILE}, 30), PurgeListener.EMPTY, new PurgeProfiler());
     dbTester.assertDbUnit(getClass(), "shouldDeleteHistoricalDataOfDirectoriesAndFiles-result.xml", "projects", "snapshots");
   }
 
@@ -75,7 +75,8 @@ public class PurgeDaoTest {
     dbTester.prepareDbUnit(getClass(), "disable_resources_without_last_snapshot.xml");
     when(system2.now()).thenReturn(1450000000000L);
     sut.purge(newConfigurationWith30Days(system2), PurgeListener.EMPTY, new PurgeProfiler());
-    dbTester.assertDbUnit(getClass(), "disable_resources_without_last_snapshot-result.xml", new String[]{"issue_close_date", "issue_update_date"}, "projects", "snapshots", "issues");
+    dbTester.assertDbUnit(getClass(), "disable_resources_without_last_snapshot-result.xml", new String[] {"issue_close_date", "issue_update_date"}, "projects", "snapshots",
+      "issues");
   }
 
   @Test
@@ -125,15 +126,6 @@ public class PurgeDaoTest {
     dbTester.assertDbUnit(getClass(), "should_delete_all_closed_issues-result.xml", "issues", "issue_changes");
   }
 
-  @Test
-  public void select_purgeable_file_uuids_and_only_them() {
-    dbTester.prepareDbUnit(getClass(), "select_purgeable_file_uuids.xml");
-
-    List<String> uuids = sut.selectPurgeableFiles(dbTester.getSession(), 1L);
-
-    assertThat(uuids).containsOnly("GHIJ");
-  }
-
   private static PurgeableSnapshotDto getById(List<PurgeableSnapshotDto> snapshots, long id) {
     for (PurgeableSnapshotDto snapshot : snapshots) {
       if (snapshot.getSnapshotId() == id) {
diff --git a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/select_purgeable_file_uuids.xml b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/select_purgeable_file_uuids.xml
deleted file mode 100644 (file)
index b3bca45..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-<dataset>
-
-  <!-- the project -->
-  <projects id="1" enabled="[true]" root_id="[null]" uuid="ABCD" project_uuid="ABCD" module_uuid="[null]"
-            module_uuid_path="." created_at="[null]"
-            long_name="[null]" scope="PRJ" qualifier="TRK" kee="project" name="project"
-            description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" path="[null]"
-            deprecated_kee="[null]" authorization_updated_at="[null]"/>
-
-  <!-- the directory -->
-  <projects id="2" enabled="[true]" root_id="1" uuid="EFGH" project_uuid="ABCD" module_uuid="ABCD"
-            module_uuid_path="." created_at="[null]"
-            long_name="[null]" scope="DIR" qualifier="DIR" kee="project:my/dir" name="my/dir"
-            description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" path="[null]"
-            deprecated_kee="[null]" authorization_updated_at="[null]"/>
-
-  <!-- the files -->
-  <projects id="3" enabled="[true]" root_id="1" uuid="GHIJ" project_uuid="ABCD" module_uuid="ABCD"
-            module_uuid_path=".ABCD." created_at="[null]"
-            long_name="[null]" scope="FIL" qualifier="FIL" kee="project:my/dir/File.java" name="my/dir/File.java"
-            description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" path="[null]"
-            deprecated_kee="[null]" authorization_updated_at="[null]"/>
-  <projects id="4" enabled="[true]" root_id="1" uuid="KLMN" project_uuid="ABCD" module_uuid="ABCD"
-            module_uuid_path=".ABCD." created_at="[null]"
-            long_name="[null]" scope="FIL" qualifier="FIL" kee="project:my/dir/File.java"
-            name="my/dir/File.java"
-            description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" path="[null]"
-            deprecated_kee="[null]" authorization_updated_at="[null]"/>
-  <!-- the file has already been disabled. It should not be selected -->
-  <projects id="5" enabled="[false]" root_id="1" uuid="OPQR" project_uuid="ABCD" module_uuid="ABCD"
-            module_uuid_path=".ABCD." created_at="[null]"
-            long_name="[null]" scope="FIL" qualifier="FIL" kee="project:my/dir/File.java"
-            name="my/dir/File.java"
-            description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" path="[null]"
-            deprecated_kee="[null]" authorization_updated_at="[null]"/>
-
-  <snapshots id="1"
-             project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]"
-             status="P" islast="[true]" 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]" scope="PRJ" qualifier="TRK" created_at="1228222680000"
-             build_date="1228222680000" version="[null]" path="[null]"/>
-
-  <snapshots id="2"
-             project_id="2" parent_snapshot_id="1" root_project_id="1" root_snapshot_id="1"
-             status="P" islast="[true]" 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]" scope="PRJ" qualifier="TRK" created_at="1228222680000"
-             build_date="1228222680000" version="[null]" path="[null]"/>
-
-  <!-- isLast is false -->
-  <snapshots id="3"
-             project_id="3" parent_snapshot_id="2" root_project_id="1" root_snapshot_id="1"
-             status="P" islast="[false]" 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]" scope="PRJ" qualifier="TRK" created_at="1228222680000"
-             build_date="1228222680000" version="[null]" path="[null]"/>
-
-  <snapshots id="4"
-             project_id="4" parent_snapshot_id="2" root_project_id="1" root_snapshot_id="1"
-             status="P" islast="[true]" 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]" scope="PRJ" qualifier="TRK" created_at="1228222680000"
-             build_date="1228222680000" version="[null]" path="[null]"/>
-
-  <file_sources id="1" project_uuid="ABCD" file_uuid="GHIJ" binary_data="[null]" line_hashes="[null]"
-                data_hash="321654987"
-                created_at="123456789" updated_at="123456789" data_type="SOURCE"/>
-  <file_sources id="2" project_uuid="ABCD" file_uuid="KLMN" binary_data="[null]" line_hashes="[null]"
-                data_hash="321654988"
-                created_at="123456789" updated_at="123456789" data_type="SOURCE"/>
-</dataset>