summaryrefslogtreecommitdiffstats
path: root/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/utilities/FileHandling.java
blob: b1549741ed16ef38228bc65ce4ff75d4b1cfad7a (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
package org.openecomp.sdc.uici.tests.utilities;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.Map;

import org.yaml.snakeyaml.Yaml;

public class FileHandling {

	public static Map<?, ?> parseYamlFile(String filePath) throws FileNotFoundException {
		Yaml yaml = new Yaml();
		File file = new File(filePath);
		InputStream inputStream = new FileInputStream(file);
		Map<?, ?> map = (Map<?, ?>) yaml.load(inputStream);
		return map;
	}

	public static String getBasePath() {
		return System.getProperty("user.dir");
	}

	public static String getResourcesFilesPath() {
		return getBasePath() + File.separator + "src" + File.separator + "main" + File.separator + "resources"
				+ File.separator + "Files" + File.separator;
	}

}