|
10 | 10 |
|
11 | 11 | import net.lecousin.framework.concurrent.Task;
|
12 | 12 | import net.lecousin.framework.concurrent.tasks.drives.CreateDirectoryTask;
|
| 13 | +import net.lecousin.framework.concurrent.tasks.drives.DirectoryReader; |
13 | 14 | import net.lecousin.framework.concurrent.tasks.drives.RemoveDirectoryContentTask;
|
14 | 15 | import net.lecousin.framework.concurrent.tasks.drives.RemoveDirectoryTask;
|
15 | 16 | import net.lecousin.framework.core.test.LCCoreAbstractTest;
|
@@ -47,4 +48,24 @@ public void testCreateAndRemove() throws Exception {
|
47 | 48 | root.toFile().deleteOnExit();
|
48 | 49 | }
|
49 | 50 |
|
| 51 | + @Test |
| 52 | + public void testDirectoryReader() throws Exception { |
| 53 | + Path root = Files.createTempDirectory("test"); |
| 54 | + File dir = new File(root.toFile(), "toto"); |
| 55 | + Assert.assertTrue(dir.mkdir()); |
| 56 | + File file = new File(root.toFile(), "titi"); |
| 57 | + Assert.assertTrue(file.createNewFile()); |
| 58 | + DirectoryReader.Request request = new DirectoryReader.Request(); |
| 59 | + request.getCreation = true; |
| 60 | + request.getIsSymbolicLink = true; |
| 61 | + request.getLastAccess = true; |
| 62 | + request.getLastModified = true; |
| 63 | + request.getSize = true; |
| 64 | + DirectoryReader reader = new DirectoryReader(root.toFile(), Task.PRIORITY_NORMAL, request); |
| 65 | + reader.start().getOutput().blockThrow(0); |
| 66 | + DirectoryReader.ListSubDirectories lister = new DirectoryReader.ListSubDirectories(root.toFile(), Task.PRIORITY_NORMAL); |
| 67 | + lister.start().getOutput().blockThrow(0); |
| 68 | + new RemoveDirectoryContentTask(root.toFile(), null, 0, Task.PRIORITY_NORMAL, false).start().getOutput().blockThrow(0); |
| 69 | + } |
| 70 | + |
50 | 71 | }
|
0 commit comments