Skip to content

Commit

Permalink
Update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
solth committed Oct 17, 2023
1 parent d29184c commit 0eb49dd
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,20 +167,21 @@ public void testRevertingOriginalFilenamesAfterRenamingError() throws DAOExcepti
ProcessTestUtils.copyTestFiles(revertMediaRenamingProcessId, TEST_RENAME_MEDIA_FILE);
Path processScansDir = Paths.get(ConfigCore.getKitodoDataDirectory(), revertMediaRenamingProcessId
+ "/images/scans/").toAbsolutePath();
// 1. delete last referenced image to provoke failed media renaming attempt
Path lastImagePath = processScansDir.resolve("03.tif");
ServiceManager.getFileService().delete(lastImagePath.toUri());
// 1. determine filenames before failed media renaming attempt
// 2. determine filenames before failed media renaming attempt
List<URI> scanURIsBeforeRenaming = ServiceManager.getFileService().getSubUris(ImageHelper.dataFilter,
processScansDir.toUri()).stream().sorted().collect(Collectors.toList());
// 2. perform failing media renaming
// 3. perform failing media renaming
Process process = ServiceManager.getProcessService().getById(revertMediaRenamingProcessId);
RenameMediaThread renameMediaThread = new RenameMediaThread(Collections.singletonList(process));
renameMediaThread.start();
renameMediaThread.join();
// 3. determine filenames after failed media renaming attempt
// 4. determine filenames after failed media renaming attempt
List<URI> scanURIsAfterRenaming = ServiceManager.getFileService().getSubUris(ImageHelper.dataFilter,
processScansDir.toUri()).stream().sorted().collect(Collectors.toList());
// 4. assert that filenames before and after failed media renaming attempt are equal
// 5. assert that filenames have been successfully reverted after failed media renaming attempt
assertEquals(scanURIsBeforeRenaming.size(), scanURIsAfterRenaming.size());
for (int i = 0; i < scanURIsBeforeRenaming.size(); i++) {
assertEquals(scanURIsBeforeRenaming.get(i).toString(), scanURIsAfterRenaming.get(i).toString());
Expand Down

0 comments on commit 0eb49dd

Please sign in to comment.