Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions test/jdk/java/nio/file/Files/CopyInterference.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
/* @test
* @bug 8114830
* @summary Verify FileAlreadyExistsException is not thrown for REPLACE_EXISTING
* @library ..
* @build CopyInterference
* @run junit CopyInterference
*/
import java.io.InputStream;
Expand Down Expand Up @@ -112,17 +114,22 @@ private static Stream<Arguments> pathAndOptionsProvider()
new CopyOption[] {REPLACE_EXISTING});
list.add(args);

// symblic link, followed
Path link = dir.resolve("link");
Files.createSymbolicLink(link, sourceFile);
args = Arguments.of(link, dir.resolve("linkFollowed"),
new CopyOption[] {REPLACE_EXISTING});
list.add(args);

// symblic link, not followed
args = Arguments.of(link, dir.resolve("linkNotFollowed"),
new CopyOption[] {REPLACE_EXISTING, NOFOLLOW_LINKS});
list.add(args);
if (TestUtil.supportsLinks(dir)) {
// symbolic link, followed
Path link = dir.resolve("link");
Files.createSymbolicLink(link, sourceFile);
args = Arguments.of(link, dir.resolve("linkFollowed"),
new CopyOption[] {REPLACE_EXISTING});
list.add(args);

// symbolic link, not followed
args = Arguments.of(link, dir.resolve("linkNotFollowed"),
new CopyOption[] {REPLACE_EXISTING,
NOFOLLOW_LINKS});
list.add(args);
} else {
System.out.println("Links not supported: not testing links");
}

return list.stream();
}
Expand Down