blob: baf9bfb35027b2db6e3fc2e923fb557cfe02973a (
plain)
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
|
package org.openecomp.core.utilities.Yaml;
import org.openecomp.core.utilities.yaml.YamlUtil;
import org.junit.Before;
import org.junit.Test;
import testobjects.yaml.YamlFile;
public class YamlUtilTest {
String yamlContent;
@Before
public void setup() {
initYamlFileContent();
}
void initYamlFileContent() {
yamlContent = "heat_template_version: ss\n" +
"description: ab\n" +
"parameters:\n" +
" jsa_net_name: \n" +
" description: network name of jsa log network\n" +
" hidden: true\n" +
" inner:\n" +
" inner1:\n" +
" name: shiri\n" +
" inner2:\n" +
" name: avi";
}
@Test
public void shouldConvertSimpleYamlToObject() {
new YamlUtil().yamlToObject(yamlContent, YamlFile.class);
}
/*public void loadCassandraParameters(){
YamlUtil yamlutil = new YamlUtil();
String cassandraKey = "cassandraConfig";
String configurationFile = "/configuration.yaml";
InputStream yamlAsIS = yamlutil.loadYamlFileIs(configurationFile);
Map<String, LinkedHashMap<String, Object>> configurationMap = yamlutil.yamlToMap(yamlAsIS);
LinkedHashMap<String, Object> cassandraConfiguration = configurationMap.get(cassandraKey);
System.out.println(cassandraConfiguration.entrySet());
}*/
}
|