|
1 | 1 | /*
|
2 |
| - * Copyright 2012-2023 the original author or authors. |
| 2 | + * Copyright 2012-2024 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -94,6 +94,32 @@ void shouldWatchFile(@TempDir Path tempDir) throws Exception {
|
94 | 94 | callback.expectChanges();
|
95 | 95 | }
|
96 | 96 |
|
| 97 | + @Test |
| 98 | + void shouldFollowSymlink(@TempDir Path tempDir) throws Exception { |
| 99 | + Path realFile = tempDir.resolve("realFile.txt"); |
| 100 | + Path symLink = tempDir.resolve("symlink.txt"); |
| 101 | + Files.createFile(realFile); |
| 102 | + Files.createSymbolicLink(symLink, realFile); |
| 103 | + WaitingCallback callback = new WaitingCallback(); |
| 104 | + this.fileWatcher.watch(Set.of(symLink), callback); |
| 105 | + Files.writeString(realFile, "Some content"); |
| 106 | + callback.expectChanges(); |
| 107 | + } |
| 108 | + |
| 109 | + @Test |
| 110 | + void shouldFollowSymlinkRecursively(@TempDir Path tempDir) throws Exception { |
| 111 | + Path realFile = tempDir.resolve("realFile.txt"); |
| 112 | + Path symLink = tempDir.resolve("symlink.txt"); |
| 113 | + Path symLink2 = tempDir.resolve("symlink2.txt"); |
| 114 | + Files.createFile(realFile); |
| 115 | + Files.createSymbolicLink(symLink, symLink2); |
| 116 | + Files.createSymbolicLink(symLink2, realFile); |
| 117 | + WaitingCallback callback = new WaitingCallback(); |
| 118 | + this.fileWatcher.watch(Set.of(symLink), callback); |
| 119 | + Files.writeString(realFile, "Some content"); |
| 120 | + callback.expectChanges(); |
| 121 | + } |
| 122 | + |
97 | 123 | @Test
|
98 | 124 | void shouldIgnoreNotWatchedFiles(@TempDir Path tempDir) throws Exception {
|
99 | 125 | Path watchedFile = tempDir.resolve("watched.txt");
|
|
0 commit comments