//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void symbolicLinkAsTargetShouldNotBreakTheMove() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void SymbolicLinkAsTargetShouldNotBreakTheMove() { /* * Setup the following structure * - realSourceFile: a dummy file serving as the file to copy, the original source * - realTargetDirectory: the real directory to move the file into * - linkTargetDirectory: a symbolic link pointing to realTargetDirectory. */ string realFileFilename = "realFile"; // we need this for the assert at the end Path realSourceFile = Files.createFile((new File(TestDirectory.absolutePath(), realFileFilename)).toPath()); Path realTargetDirectory = Files.createDirectory((new File(TestDirectory.absolutePath(), "realTargetDirectory")).toPath()); Path linkTargetDirectory = Files.createSymbolicLink((new File(TestDirectory.absolutePath(), "linkToTarget")).toPath(), realTargetDirectory); /* * We now try to copy the realSourceFile to the linkTargetDirectory. This must succeed. * As a reminder, the FileMoveAction.copyViaFileSystem() will prepare a file move operation for the real source file * (contained in the top level test directory). The move() call will accept as an argument the symbolic link and * try to move the source in there. */ FileMoveAction.copyViaFileSystem(realSourceFile.toFile(), TestDirectory.absolutePath()).move(linkTargetDirectory.toFile()); File target = new File(linkTargetDirectory.toFile(), realFileFilename); assertTrue(Files.exists(target.toPath())); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void nonPageCacheFilesCopiedLeaveOriginal() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void NonPageCacheFilesCopiedLeaveOriginal() { // given File baseDirectory = TestDirectory.directory(); File sourceDirectory = new File(baseDirectory, "source"); File targetDirectory = new File(baseDirectory, "destination"); File sourceFile = new File(sourceDirectory, "theFileName"); File targetFile = new File(targetDirectory, "theFileName"); sourceFile.ParentFile.mkdirs(); targetDirectory.mkdirs(); // and sanity check assertTrue(sourceFile.createNewFile()); assertTrue(sourceFile.exists()); assertFalse(targetFile.exists()); // when FileMoveAction.copyViaFileSystem(sourceFile, sourceDirectory).move(targetDirectory); // then assertTrue(targetFile.exists()); assertTrue(sourceFile.exists()); }
/// <summary> /// Some files are handled via page cache for CAPI flash, others are only used on the default file system. This /// contains the logic for handling files between the 2 systems /// </summary> private FileMoveAction MoveFileCorrectly(File fileToMove, File basePath) { return(FileMoveAction.moveViaFileSystem(fileToMove, basePath)); }