1 package org.openecomp.sdc.heat.datatypes.model;
3 import org.openecomp.core.utilities.yaml.YamlUtil;
6 import java.io.InputStream;
8 public class EnvironmentTest {
11 public void testYamlToServiceTemplateObj() {
12 YamlUtil yamlUtil = new YamlUtil();
13 InputStream yamlFile = yamlUtil.loadYamlFileIs("/mock/model/envSettings.env");
14 Environment envVars = yamlUtil.yamlToObject(yamlFile, Environment.class);
20 String heatResourceName = "server_abc_0u";
21 String novaServerPrefix = "server_";
22 if (heatResourceName.startsWith(novaServerPrefix)) {
23 heatResourceName = heatResourceName.substring(novaServerPrefix.length());
25 int lastIndexOfUnderscore = heatResourceName.lastIndexOf("_");
26 if (heatResourceName.length() == lastIndexOfUnderscore) {
27 System.out.println(heatResourceName);
29 String heatResourceNameSuffix = heatResourceName.substring(lastIndexOfUnderscore + 1);
31 Integer.parseInt(heatResourceNameSuffix);
32 System.out.println(heatResourceName.substring(0, lastIndexOfUnderscore));
33 } catch (NumberFormatException ignored) {
34 System.out.println(heatResourceName);