@Test public void testParseTosca() { logger.debug("testParseTosca: enter"); boolean isLocalTesting = true; String fileName = null; try { ClassLoader classLoader = getClass().getClassLoader(); fileName = new File(classLoader.getResource("TESTMODEL-v1806.yml").getFile()).getAbsolutePath(); } catch (Exception e1) { logger.error("Exception Occured while loading file" + e1); } MsModelUtils controller = new MsModelUtils(commonClassDao); if (isLocalTesting) { try { controller.parseTosca(fileName); } catch (Exception e) { fail("parseTosca caused error: " + e); } } logger.debug("testParseTosca: exit"); }
public String parseTosca(String fileName) { Map<String, String> map = new LinkedHashMap<>(); try { map = load(fileName); if (map != null && map.get(ERROR) != null) { return map.get(ERROR); } parseDataAndPolicyNodes(map); LinkedHashMap<String, String> dataMapForJson = parseDataNodes(map); constructJsonForDataFields(dataMapForJson); LinkedHashMap<String, LinkedHashMap<String, String>> mapKey = parsePolicyNodes(map); createAttributes(mapKey); } catch (IOException e) { logger.error(e); } catch (ParserException e) { logger.error(e); return e.getMessage(); } return null; }
MsModelUtils { public String parseTosca(String fileName) { Map<String, String> map = new LinkedHashMap<>(); try { map = load(fileName); if (map != null && map.get(ERROR) != null) { return map.get(ERROR); } parseDataAndPolicyNodes(map); LinkedHashMap<String, String> dataMapForJson = parseDataNodes(map); constructJsonForDataFields(dataMapForJson); LinkedHashMap<String, LinkedHashMap<String, String>> mapKey = parsePolicyNodes(map); createAttributes(mapKey); } catch (IOException e) { logger.error(e); } catch (ParserException e) { logger.error(e); return e.getMessage(); } return null; } }
MsModelUtils { public String parseTosca(String fileName) { Map<String, String> map = new LinkedHashMap<>(); try { map = load(fileName); if (map != null && map.get(ERROR) != null) { return map.get(ERROR); } parseDataAndPolicyNodes(map); LinkedHashMap<String, String> dataMapForJson = parseDataNodes(map); constructJsonForDataFields(dataMapForJson); LinkedHashMap<String, LinkedHashMap<String, String>> mapKey = parsePolicyNodes(map); createAttributes(mapKey); } catch (IOException e) { logger.error(e); } catch (ParserException e) { logger.error(e); return e.getMessage(); } return null; } MsModelUtils();  MsModelUtils(CommonClassDao commonClassDao);  MsModelUtils(String onap, String policy); }
MsModelUtils { public String parseTosca(String fileName) { Map<String, String> map = new LinkedHashMap<>(); try { map = load(fileName); if (map != null && map.get(ERROR) != null) { return map.get(ERROR); } parseDataAndPolicyNodes(map); LinkedHashMap<String, String> dataMapForJson = parseDataNodes(map); constructJsonForDataFields(dataMapForJson); LinkedHashMap<String, LinkedHashMap<String, String>> mapKey = parsePolicyNodes(map); createAttributes(mapKey); } catch (IOException e) { logger.error(e); } catch (ParserException e) { logger.error(e); return e.getMessage(); } return null; } MsModelUtils();  MsModelUtils(CommonClassDao commonClassDao);  MsModelUtils(String onap, String policy); Map<String, MsAttributeObject> processEpackage(String file, ModelType model); void getAttributes(String className, String dependency, EPackage root); String checkDefultValue(String defultValue); String checkRequiredPattern(int upper, int lower); JSONObject buildJavaObject(Map<String, String> map); Map<String, String> getRefAttributeList(EPackage root, String className, String superClass); boolean isRequiredAttribute(EObject obj, String className); Map<String, String> getAttributeList(EPackage root, String className, String superClass); String arrayCheck(int upperBound); List<String> getDependencyList(EClassifier eclassifier); Map<String, String> buildSubList(Map<String, String> subClassAttributes,
                    Map<String, MsAttributeObject> classMap, String className); Map<String, Map<String, String>> recursiveReference(Map<String, MsAttributeObject> classMap,
                    String className); String createJson(Map<String, MsAttributeObject> classMap, String className); Map<String, String> getRefclass(Map<String, MsAttributeObject> classMap, String className); String createSubAttributes(List<String> dependency, Map<String, MsAttributeObject> classMap,
                    String modelName); List<String> getFullDependencyList(List<String> dependency, Map<String, MsAttributeObject> classMap); String parseTosca(String fileName); Map<String, String> load(String fileName); int stringBetweenDots(String str); void stringBetweenDotsForDataFields(String str); }
MsModelUtils { public String parseTosca(String fileName) { Map<String, String> map = new LinkedHashMap<>(); try { map = load(fileName); if (map != null && map.get(ERROR) != null) { return map.get(ERROR); } parseDataAndPolicyNodes(map); LinkedHashMap<String, String> dataMapForJson = parseDataNodes(map); constructJsonForDataFields(dataMapForJson); LinkedHashMap<String, LinkedHashMap<String, String>> mapKey = parsePolicyNodes(map); createAttributes(mapKey); } catch (IOException e) { logger.error(e); } catch (ParserException e) { logger.error(e); return e.getMessage(); } return null; } MsModelUtils();  MsModelUtils(CommonClassDao commonClassDao);  MsModelUtils(String onap, String policy); Map<String, MsAttributeObject> processEpackage(String file, ModelType model); void getAttributes(String className, String dependency, EPackage root); String checkDefultValue(String defultValue); String checkRequiredPattern(int upper, int lower); JSONObject buildJavaObject(Map<String, String> map); Map<String, String> getRefAttributeList(EPackage root, String className, String superClass); boolean isRequiredAttribute(EObject obj, String className); Map<String, String> getAttributeList(EPackage root, String className, String superClass); String arrayCheck(int upperBound); List<String> getDependencyList(EClassifier eclassifier); Map<String, String> buildSubList(Map<String, String> subClassAttributes,
                    Map<String, MsAttributeObject> classMap, String className); Map<String, Map<String, String>> recursiveReference(Map<String, MsAttributeObject> classMap,
                    String className); String createJson(Map<String, MsAttributeObject> classMap, String className); Map<String, String> getRefclass(Map<String, MsAttributeObject> classMap, String className); String createSubAttributes(List<String> dependency, Map<String, MsAttributeObject> classMap,
                    String modelName); List<String> getFullDependencyList(List<String> dependency, Map<String, MsAttributeObject> classMap); String parseTosca(String fileName); Map<String, String> load(String fileName); int stringBetweenDots(String str); void stringBetweenDotsForDataFields(String str);  }