@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");
}
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
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) {
+++ /dev/null
-<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>