1
2
3
4
5
6
7
8
9
10
11
12
13
14 package ch.qos.logback.core.rolling.helper;
15
16 import ch.qos.logback.core.rolling.RolloverFailure;
17 import ch.qos.logback.core.testUtil.CoreTestConstants;
18 import ch.qos.logback.core.testUtil.RandomUtil;
19 import ch.qos.logback.core.util.EnvUtil;
20 import ch.qos.logback.core.util.FileUtil;
21 import org.junit.jupiter.api.Disabled;
22 import org.junit.jupiter.api.Test;
23
24 import java.io.File;
25 import java.io.IOException;
26
27 import static org.junit.jupiter.api.Assertions.assertFalse;
28 import static org.junit.jupiter.api.Assertions.assertTrue;
29
30 public class FileStoreUtilTest {
31
32 int diff = RandomUtil.getPositiveInt();
33 String pathPrefix = CoreTestConstants.OUTPUT_DIR_PREFIX + "fs" + diff + "/";
34
35 @Test
36 public void filesOnSameFolderShouldBeOnTheSameFileStore() throws RolloverFailure, IOException {
37 if (!EnvUtil.isJDK7OrHigher())
38 return;
39
40 File parent = new File(pathPrefix);
41 File file = new File(pathPrefix + "filesOnSameFolderShouldBeOnTheSameFileStore");
42 FileUtil.createMissingParentDirectories(file);
43 file.createNewFile();
44 assertTrue(FileStoreUtil.areOnSameFileStore(parent, file));
45 }
46
47
48 @Disabled
49 @Test
50 public void manual_filesOnDifferentVolumesShouldBeDetectedAsSuch() throws RolloverFailure {
51 if (!EnvUtil.isJDK7OrHigher())
52 return;
53
54
55 File c = new File("c:/tmp/");
56 File d = new File("d:/");
57 assertFalse(FileStoreUtil.areOnSameFileStore(c, d));
58 }
59 }