public void registerError(final String fileName) { // System.out.println("Found an error in: " + fileName); if (logFiles.containsKey(fileName)) { final Vector<PlatformStatus> aVector = logFiles.get(fileName); for (int i = 0; i < aVector.size(); i++) { aVector.elementAt(i).registerError(); } } else { // If a log file is not specified explicitly it effects // all "platforms" except JDT final Enumeration<PlatformStatus> values = platforms.elements(); while (values.hasMoreElements()) { final PlatformStatus aValue = values.nextElement(); if (!aValue.getId().equals("JA") && !aValue.getId().equals("EW") && !aValue.getId().equals("EA")) { aValue.registerError(); } } } }
public void loadFile(final String fileName) { final DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder parser = null; try { parser = docBuilderFactory.newDocumentBuilder(); } catch (final ParserConfigurationException e1) { e1.printStackTrace(); } try { final Document document = parser.parse(fileName); final NodeList elements = document.getElementsByTagName("platform"); final int elementCount = elements.getLength(); for (int i = 0; i < elementCount; i++) { final PlatformStatus aPlatform = new PlatformStatus((Element) elements.item(i)); // System.out.println("ID: " + aPlatform.getId()); platforms.put(aPlatform.getId(), aPlatform); final Node zipType = elements.item(i).getParentNode(); final String zipTypeName = zipType.getAttributes().getNamedItem("name").getNodeValue(); Vector<String> aVector = typesMap.get(zipTypeName); if (aVector == null) { typesList.add(zipTypeName); aVector = new Vector<>(); typesMap.put(zipTypeName, aVector); } aVector.add(aPlatform.getId()); } final NodeList effectedFiles = document.getElementsByTagName("effectedFile"); final int effectedFilesCount = effectedFiles.getLength(); for (int i = 0; i < effectedFilesCount; i++) { final Node anEffectedFile = effectedFiles.item(i); final Node logFile = anEffectedFile.getParentNode(); String logFileName = logFile.getAttributes().getNamedItem("name").getNodeValue(); logFileName = convertPathDelimiters(logFileName); final String effectedFileID = anEffectedFile.getAttributes().getNamedItem("id").getNodeValue(); // System.out.println(logFileName); Vector<PlatformStatus> aVector = logFiles.get(logFileName); if (aVector == null) { aVector = new Vector<>(); logFiles.put(logFileName, aVector); } final PlatformStatus ps = platforms.get(effectedFileID); if (ps != null) { aVector.addElement(ps); } } // store a list of the test logs expected after testing final NodeList testLogList = document.getElementsByTagName("logFile"); final int testLogCount = testLogList.getLength(); for (int i = 0; i < testLogCount; i++) { final Node testLog = testLogList.item(i); final String testLogName = testLog.getAttributes().getNamedItem("name").getNodeValue(); final Node typeNode = testLog.getAttributes().getNamedItem("type"); // String type = "test"; // if (typeNode != null) { // type = typeNode.getNodeValue(); // } // if (testLogName.endsWith(".xml") && type.equals("test")) { // above is how it used to be checked, prior to 4/4/2016, but // test logs are only log file in testManifest.xml without a "type" attribute // -- I test for either/or, so that new versions of testManifest.xml // can more correctly use "test" attribute, if desired. if (typeNode == null || typeNode.getNodeValue().equals("test")) { int firstUnderscore = testLogName.indexOf('_'); String initialTestName = null; if (firstUnderscore == -1) { // no underscore found. Assume testManifest xml has been updated // to mention minimal name. initialTestName = testLogName; } else { initialTestName = testLogName.substring(0, firstUnderscore); } testLogsSet.add(initialTestName); // System.out.println("Debug: initialTestName: " + initialTestName); } } } catch (final IOException e) { System.out.println("IOException: " + fileName); // e.printStackTrace(); } catch (final SAXException e) { System.out.println("SAXException: " + fileName); e.printStackTrace(); } }