Skip to content

Commit f8387b4

Browse files
committed
add test for DirectoryReader
1 parent e92c5ab commit f8387b4

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

net.lecousin.core/src/test/java/net/lecousin/framework/core/test/io/TestReadableSeekable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public void testSeekableByteByByteSync() throws Exception {
7777
}
7878

7979
@SuppressWarnings({ "resource" })
80-
@Test(timeout=240000)
80+
@Test(timeout=300000)
8181
public void testSeekableByteByByteAsync() throws Exception {
8282
IO.Readable.Seekable io = createReadableSeekableFromFile(openFile(), getFileSize());
8383
byte[] b = new byte[1];

net.lecousin.core/src/test/java/net/lecousin/framework/core/tests/concurrent/TestDirectoryTasks.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import net.lecousin.framework.concurrent.Task;
1212
import net.lecousin.framework.concurrent.tasks.drives.CreateDirectoryTask;
13+
import net.lecousin.framework.concurrent.tasks.drives.DirectoryReader;
1314
import net.lecousin.framework.concurrent.tasks.drives.RemoveDirectoryContentTask;
1415
import net.lecousin.framework.concurrent.tasks.drives.RemoveDirectoryTask;
1516
import net.lecousin.framework.core.test.LCCoreAbstractTest;
@@ -47,4 +48,24 @@ public void testCreateAndRemove() throws Exception {
4748
root.toFile().deleteOnExit();
4849
}
4950

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+
5071
}

0 commit comments

Comments
 (0)