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