@Test public void processStep_ShouldMoveFileToNewDestination_WithOtherFileExtension() throws Exception { Path source = createFile(getPath("0", "subdir", "file.mp4")); Path temp = createFile(getPath("tmp", "file.mkv")); transcodeFinishedEvent.setTemporaryPath(temp); media.setSourcePath(source); CleanupContext result = subject.processStep(context); Path expected = getPath("output", "subdir", "file.mkv"); assertThat(result.getOutputPath()).isEqualTo(expected); assertThat(expected).exists(); }
@Override public CleanupContext processStep(CleanupContext context) { log.entry(context); TranscodeFinishedEvent result = context.getTranscodeFinishedEvent(); if (isFailed(result)) return log.exit(context); Path source = result.getTemporaryPath(); Path media = result.getMedia().getSourcePath(); Path target = createOutputDirectoryTree(media); Path tempFile = source.getFileName(); Path finalPath = target.getParent().resolve(tempFile); FileUtil.createParentDirectoriesFor(finalPath); context.setOutputPath(moveAndReplaceExisting(source, finalPath, cleanupConfig.overwrite_files())); return log.exit(context); }
StructuredOutputDirectoryProcessor extends AbstractOutputDirectoryProcessor { @Override public CleanupContext processStep(CleanupContext context) { log.entry(context); TranscodeFinishedEvent result = context.getTranscodeFinishedEvent(); if (isFailed(result)) return log.exit(context); Path source = result.getTemporaryPath(); Path media = result.getMedia().getSourcePath(); Path target = createOutputDirectoryTree(media); Path tempFile = source.getFileName(); Path finalPath = target.getParent().resolve(tempFile); FileUtil.createParentDirectoriesFor(finalPath); context.setOutputPath(moveAndReplaceExisting(source, finalPath, cleanupConfig.overwrite_files())); return log.exit(context); } }
StructuredOutputDirectoryProcessor extends AbstractOutputDirectoryProcessor { @Override public CleanupContext processStep(CleanupContext context) { log.entry(context); TranscodeFinishedEvent result = context.getTranscodeFinishedEvent(); if (isFailed(result)) return log.exit(context); Path source = result.getTemporaryPath(); Path media = result.getMedia().getSourcePath(); Path target = createOutputDirectoryTree(media); Path tempFile = source.getFileName(); Path finalPath = target.getParent().resolve(tempFile); FileUtil.createParentDirectoriesFor(finalPath); context.setOutputPath(moveAndReplaceExisting(source, finalPath, cleanupConfig.overwrite_files())); return log.exit(context); } @Inject  StructuredOutputDirectoryProcessor(CleanupConfig cleanupConfig,
                                       Clock clock); }
StructuredOutputDirectoryProcessor extends AbstractOutputDirectoryProcessor { @Override public CleanupContext processStep(CleanupContext context) { log.entry(context); TranscodeFinishedEvent result = context.getTranscodeFinishedEvent(); if (isFailed(result)) return log.exit(context); Path source = result.getTemporaryPath(); Path media = result.getMedia().getSourcePath(); Path target = createOutputDirectoryTree(media); Path tempFile = source.getFileName(); Path finalPath = target.getParent().resolve(tempFile); FileUtil.createParentDirectoriesFor(finalPath); context.setOutputPath(moveAndReplaceExisting(source, finalPath, cleanupConfig.overwrite_files())); return log.exit(context); } @Inject  StructuredOutputDirectoryProcessor(CleanupConfig cleanupConfig,
                                       Clock clock); @Override CleanupContext processStep(CleanupContext context); }
StructuredOutputDirectoryProcessor extends AbstractOutputDirectoryProcessor { @Override public CleanupContext processStep(CleanupContext context) { log.entry(context); TranscodeFinishedEvent result = context.getTranscodeFinishedEvent(); if (isFailed(result)) return log.exit(context); Path source = result.getTemporaryPath(); Path media = result.getMedia().getSourcePath(); Path target = createOutputDirectoryTree(media); Path tempFile = source.getFileName(); Path finalPath = target.getParent().resolve(tempFile); FileUtil.createParentDirectoriesFor(finalPath); context.setOutputPath(moveAndReplaceExisting(source, finalPath, cleanupConfig.overwrite_files())); return log.exit(context); } @Inject  StructuredOutputDirectoryProcessor(CleanupConfig cleanupConfig,
                                       Clock clock); @Override CleanupContext processStep(CleanupContext context);  }