1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.juneau.config;
18
19 import static org.apache.juneau.TestUtils.*;
20 import static org.apache.juneau.common.utils.StringUtils.*;
21 import static org.apache.juneau.internal.FileUtils.*;
22 import static org.junit.jupiter.api.Assertions.*;
23
24 import java.io.*;
25
26 import org.apache.juneau.*;
27 import org.apache.juneau.config.store.*;
28 import org.junit.jupiter.api.*;
29
30 class ConfigBuilder_Test extends TestBase {
31
32 private static File tempDir;
33 private static String TEMP_DIR;
34
35 @BeforeAll
36 static void setup() {
37 tempDir = new File(System.getProperty("java.io.tmpdir"), random(12));
38 TEMP_DIR = tempDir.getAbsolutePath();
39 }
40
41 @AfterAll
42 static void teardown() {
43 delete(tempDir);
44 }
45
46 @Test void a01_get_LONGRUNNING() throws Exception {
47 File f;
48 var cfs = FileStore.create().directory(TEMP_DIR).enableWatcher().watcherSensitivity(WatcherSensitivity.HIGH).build();
49 var cb = Config.create().store(cfs).name("TestGet.cfg");
50
51 var cf = cb.build();
52 cf.set("Test/A", "a");
53
54 f = new File(tempDir, "TestGet.cfg");
55 assertFalse(f.exists());
56
57 cf.commit();
58 assertJson("{'':{},Test:{A:'a'}}", cf.toMap());
59
60 var nl = System.getProperty("line.separator");
61 cf = cf.load("[Test]"+nl+"A = b"+nl, true);
62 assertJson("{'':{},Test:{A:'b'}}", cf.toMap());
63 }
64 }