2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.ci.tests.config;
24 import org.apache.commons.io.IOUtils;
25 import org.json.JSONObject;
26 import org.openecomp.sdc.ci.tests.utils.general.FileHandling;
27 import org.yaml.snakeyaml.Yaml;
30 import java.nio.charset.Charset;
33 public class MainToTest {
35 private static final String CREDENTIALS_FILE = "credentials.yaml";
37 // public static void main(String[] args) throws Exception {
38 // System.out.println("Hello World!"); // Display the string.
39 // System.out.println("user.dir: " + System.getProperty("user.dir"));
40 // System.out.println(UserRoleEnum.DESIGNER.getFirstName());
41 // String file = readFile();
42 // convertToJson(file);
43 // Either<Service, RestResponse> createDefaultService1e = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true);
49 private static String convertToJson(String yamlString) {
50 Yaml yaml = new Yaml();
51 Map<String, Object> map = (Map<String, Object>) yaml.load(yamlString);
53 JSONObject jsonObject = new JSONObject(map);
54 return jsonObject.toString();
57 private static String readFile() {
59 File credentialsFileLocal = new File(FileHandling.getSdcVnfsPath() + File.separator + "conf"
60 + File.separator + CREDENTIALS_FILE);
62 InputStream inputStream = null;
64 inputStream = new FileInputStream(credentialsFileLocal);
65 } catch (FileNotFoundException e) {
70 String mystr = IOUtils.toString(inputStream, Charset.forName("UTF-8"));
73 } catch(IOException e) {