Commit | Line | Data |
---|---|---|
92fb0719 NR |
1 | package be.nikiroo.fanfix.test; |
2 | ||
22848428 NR |
3 | import java.io.File; |
4 | import java.io.FileOutputStream; | |
5 | import java.io.IOException; | |
6 | import java.util.Properties; | |
7 | ||
8 | import be.nikiroo.fanfix.bundles.ConfigBundle; | |
9 | import be.nikiroo.utils.IOUtils; | |
10 | import be.nikiroo.utils.resources.Bundles; | |
92fb0719 NR |
11 | import be.nikiroo.utils.test.TestLauncher; |
12 | ||
13 | /** | |
14 | * Tests for Fanfix. | |
15 | * | |
16 | * @author niki | |
17 | */ | |
18 | public class Test extends TestLauncher { | |
19 | public Test(String[] args) { | |
68e370a4 NR |
20 | super("Fanfix", args); |
21 | addSeries(new BasicSupportTest(args)); | |
6cac0e45 | 22 | addSeries(new LibraryTest(args)); |
92fb0719 NR |
23 | } |
24 | ||
25 | /** | |
26 | * Main entry point of the program. | |
27 | * | |
28 | * @param args | |
29 | * the arguments passed to the {@link TestLauncher}s. | |
22848428 | 30 | * @throws IOException |
92fb0719 | 31 | */ |
22848428 NR |
32 | static public void main(String[] args) throws IOException { |
33 | File tmpConfig = File.createTempFile("fanfix-config_", ".test"); | |
34 | File tmpCache = File.createTempFile("fanfix-cache_", ".test"); | |
35 | tmpConfig.delete(); | |
36 | tmpConfig.mkdir(); | |
37 | tmpCache.delete(); | |
38 | tmpCache.mkdir(); | |
39 | ||
40 | FileOutputStream out = new FileOutputStream(new File(tmpConfig, | |
41 | "config.properties")); | |
42 | Properties props = new Properties(); | |
43 | props.setProperty("CACHE_DIR", tmpCache.getAbsolutePath()); | |
44 | props.store(out, null); | |
45 | out.close(); | |
46 | ||
47 | ConfigBundle config = new ConfigBundle(); | |
48 | Bundles.setDirectory(tmpConfig.getAbsolutePath()); | |
49 | config.updateFile(tmpConfig.getPath()); | |
50 | ||
51 | System.setProperty("CONFIG_DIR", tmpConfig.getAbsolutePath()); | |
52 | ||
53 | int result = new Test(args).launch(); | |
54 | ||
55 | IOUtils.deltree(tmpConfig); | |
56 | IOUtils.deltree(tmpCache); | |
57 | ||
58 | System.exit(result); | |
92fb0719 NR |
59 | } |
60 | } |