@@ -0,0 +1,2109 @@
+package net.lecousin.framework.core.tests.concurrent;%0D%0A%0D%0Aimport java.io.File;%0D%0Aimport java.io.IOException;%0D%0Aimport java.nio.file.Files;%0D%0Aimport java.nio.file.Path;%0D%0A%0D%0Aimport org.junit.Assert;%0D%0Aimport org.junit.Test;%0D%0A%0D%0Aimport net.lecousin.framework.concurrent.Task;%0D%0Aimport net.lecousin.framework.concurrent.tasks.drives.CreateDirectoryTask;%0D%0Aimport net.lecousin.framework.concurrent.tasks.drives.RemoveDirectoryContentTask;%0D%0Aimport net.lecousin.framework.concurrent.tasks.drives.RemoveDirectoryTask;%0D%0Aimport net.lecousin.framework.core.test.LCCoreAbstractTest;%0D%0A%0D%0Apublic class TestDirectoryTasks extends LCCoreAbstractTest %7B%0D%0A%0D%0A%09@Test%0D%0A%09public void testCreateAndRemove() throws Exception %7B%0D%0A%09%09Path root = Files.createTempDirectory(%22test%22);%0D%0A%09%09File dir = new File(root.toFile(), %22toto%22);%0D%0A%09%09Assert.assertFalse(dir.exists());%0D%0A%09%09new CreateDirectoryTask(dir, true, true, Task.PRIORITY_NORMAL).start().getOutput().blockThrow(0);%0D%0A%09%09Assert.assertTrue(dir.exists());%0D%0A%09%09try %7B%0D%0A%09%09%09new CreateDirectoryTask(dir, true, true, Task.PRIORITY_NORMAL).start().getOutput().blockThrow(0);%0D%0A%09%09%09throw new AssertionError(%22CreateDirectoryTask should throw an exception when the directory already exists%22);%0D%0A%09%09%7D catch (IOException e) %7B%0D%0A%09%09%09// ok%0D%0A%09%09%7D%0D%0A%09%09new RemoveDirectoryTask(dir, null, 0, null, Task.PRIORITY_NORMAL, false).start().getOutput().blockThrow(0);%0D%0A%09%09Assert.assertFalse(dir.exists());%0D%0A%0D%0A%09%09new CreateDirectoryTask(dir, true, true, Task.PRIORITY_NORMAL).start().getOutput().blockThrow(0);%0D%0A%09%09Assert.assertTrue(dir.exists());%0D%0A%09%09File subDir = new File(dir, %22titi/tata%22);%0D%0A%09%09Assert.assertFalse(subDir.exists());%0D%0A%09%09new CreateDirectoryTask(subDir, true, true, Task.PRIORITY_NORMAL).start().getOutput().blockThrow(0);%0D%0A%09%09Assert.assertTrue(subDir.exists());%0D%0A%09%09Assert.assertTrue(new File(dir, %22titi%22).exists());%0D%0A%09%09new RemoveDirectoryContentTask(dir, null, 0, Task.PRIORITY_NORMAL, false).start().getOutput().blockThrow(0);%0D%0A%09%09Assert.assertTrue(dir.exists());%0D%0A%09%09Assert.assertFalse(subDir.exists());%0D%0A%09%09Assert.assertFalse(new File(dir, %22titi%22).exists());%0D%0A%09%09dir.deleteOnExit();%0D%0A%09%09root.toFile().deleteOnExit();%0D%0A%09%7D%0D%0A%09%0D%0A%7D%0D%0A

add TestDirectoryTasks