-
Notifications
You must be signed in to change notification settings - Fork 0
/
Configuration.java
51 lines (37 loc) · 1.15 KB
/
Configuration.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package com.logicalpath.sandbox.utils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Map;
import java.util.stream.Stream;
import org.yaml.snakeyaml.Yaml;
@SuppressWarnings("unused")
public final class Configuration {
ArrayList<String> suiteName = new ArrayList<String>();
ArrayList<String> suiteDir = new ArrayList<String>();
@SuppressWarnings("unchecked")
public Configuration(String fname) {
Yaml yaml = new Yaml();
try {
InputStream is = new FileInputStream(new File(fname));
Map<String, Map<String, String>> values = (Map<String, Map<String, String>>)
yaml.load(is);
for (String key : values.keySet()) {
Map<String, String> subValues = values.get(key);
for (String subValueKey : subValues.keySet()) {
suiteName.add(subValueKey);
suiteDir.add(subValues.get(subValueKey));
}
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public ArrayList getSuites() {
return suiteDir;
}
}