1 package org.openecomp.sdc.ci.tests.config;
4 import org.apache.commons.io.IOUtils;
5 import org.json.JSONObject;
6 import org.openecomp.sdc.ci.tests.utils.general.FileHandling;
7 import org.yaml.snakeyaml.Yaml;
10 import java.nio.charset.Charset;
13 public class MainToTest {
15 private static final String CREDENTIALS_FILE = "credentials.yaml";
17 // public static void main(String[] args) throws Exception {
18 // System.out.println("Hello World!"); // Display the string.
19 // System.out.println("user.dir: " + System.getProperty("user.dir"));
20 // System.out.println(UserRoleEnum.DESIGNER.getFirstName());
21 // String file = readFile();
22 // convertToJson(file);
23 // Either<Service, RestResponse> createDefaultService1e = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true);
29 private static String convertToJson(String yamlString) {
30 Yaml yaml = new Yaml();
31 Map<String, Object> map = (Map<String, Object>) yaml.load(yamlString);
33 JSONObject jsonObject = new JSONObject(map);
34 return jsonObject.toString();
37 private static String readFile() {
39 File credentialsFileLocal = new File(FileHandling.getSdcVnfsPath() + File.separator + "conf"
40 + File.separator + CREDENTIALS_FILE);
42 InputStream inputStream = null;
44 inputStream = new FileInputStream(credentialsFileLocal);
45 } catch (FileNotFoundException e) {
50 String mystr = IOUtils.toString(inputStream, Charset.forName("UTF-8"));
53 } catch(IOException e) {