private static void sanitize(UnitTestIndex index) { for (String classname : index.getClassnames()) { if (StringUtils.contains(classname, "$")) { // Surefire reports classes whereas sonar supports files String parentClassName = StringUtils.substringBefore(classname, "$"); index.merge(classname, parentClassName); } } }
public UnitTestClassReport merge(String classname, String intoClassname) { UnitTestClassReport from = indexByClassname.get(classname); if (from!=null) { UnitTestClassReport to = index(intoClassname); to.add(from); indexByClassname.remove(classname); return to; } return null; }
private void parseFiles(SensorContext context, List<File> reports) { UnitTestIndex index = new UnitTestIndex(); parseFiles(reports, index); sanitize(index); save(index, context); }
private void save(UnitTestIndex index, SensorContext context) { for (Map.Entry<String, UnitTestClassReport> entry : index.getIndexByClassname().entrySet()) { UnitTestClassReport report = entry.getValue(); if (report.getTests() > 0) { InputFile resource = getUnitTestResource(entry.getKey()); if (resource != null) { save(entry.getValue(), resource, context); } else { LOGGER.warn("Resource not found: {}", entry.getKey()); } } } }
private void parseFiles(SensorContext context, File[] reports) { UnitTestIndex index = new UnitTestIndex(); parseFiles(reports, index); sanitize(index); save(index, context); }
private void save(UnitTestIndex index, SensorContext context) { for (Map.Entry<String, UnitTestClassReport> entry : index.getIndexByClassname().entrySet()) { UnitTestClassReport report = entry.getValue(); if (report.getTests() > 0) { Resource resource = getUnitTestResource(entry.getKey()); if (resource != null) { save(entry.getValue(), resource, context); } else { LOGGER.warn("Resource not found: {}", entry.getKey()); } } } }
private void sanitize(UnitTestIndex index) { for (String classname : index.getClassnames()) { if (StringUtils.contains(classname, "$")) { // Surefire reports classes whereas sonar supports files String parentClassName = StringUtils.substringBefore(classname, "$"); index.merge(classname, parentClassName); } } }
private void parseFiles(SensorContext context, File[] reports) { UnitTestIndex index = new UnitTestIndex(); parseFiles(reports, index); sanitize(index); save(index, context); }
private void save(UnitTestIndex index, SensorContext context, FileSystem myFS) { for (Map.Entry<String, UnitTestClassReport> entry : index.getIndexByClassname().entrySet()) { UnitTestClassReport report = entry.getValue(); if (report.getTests() > 0) { InputFile inputFile = getUnitTestInputFile(entry.getKey(), myFS); if (inputFile != null) { save(entry.getValue(), inputFile, context); } } } }
public UnitTestClassReport merge(String classname, String intoClassname) { UnitTestClassReport from = indexByClassname.get(classname); if (from!=null) { UnitTestClassReport to = index(intoClassname); to.add(from); indexByClassname.remove(classname); return to; } return null; }
private void sanitize(UnitTestIndex index) { for (String classname : index.getClassnames()) { if (StringUtils.contains(classname, "$")) { // Surefire reports classes whereas sonar supports files String parentClassName = StringUtils.substringBefore(classname, "$"); index.merge(classname, parentClassName); } } }
private void parseFiles(SensorContext context, List<File> reports) { UnitTestIndex index = new UnitTestIndex(); parseFiles(reports, index); sanitize(index); save(index, context); }
private void save(UnitTestIndex index, SensorContext context) { long negativeTimeTestNumber = 0; for (Map.Entry<String, UnitTestClassReport> entry : index.getIndexByClassname().entrySet()) { UnitTestClassReport report = entry.getValue(); if (report.getTests() > 0) { negativeTimeTestNumber += report.getNegativeTimeTestNumber(); Resource resource = getUnitTestResource(entry.getKey()); if (resource != null) { save(report, resource, context); } else { LOGGER.warn("Resource not found: {}", entry.getKey()); } } } if (negativeTimeTestNumber > 0) { LOGGER.warn("There is {} test(s) reported with negative time by surefire, total duration may not be accurate.", negativeTimeTestNumber); } }
public UnitTestClassReport merge(String classname, String intoClassname) { UnitTestClassReport from = indexByClassname.get(classname); if (from!=null) { UnitTestClassReport to = index(intoClassname); to.add(from); indexByClassname.remove(classname); return to; } return null; }
private void sanitize(UnitTestIndex index) { for (String classname : index.getClassnames()) { if (StringUtils.contains(classname, "$")) { // Surefire reports classes whereas sonar supports files String parentClassName = StringUtils.substringBefore(classname, "$"); index.merge(classname, parentClassName); } } }
private void parseFiles(SensorContext context, File[] reports, FileSystem myFS) { UnitTestIndex index = new UnitTestIndex(); parseFiles(reports, index); sanitize(index); save(index, context, myFS); }
private void save(UnitTestIndex index, SensorContext context) { long negativeTimeTestNumber = 0; Map<InputFile, UnitTestClassReport> indexByInputFile = mapToInputFile(index.getIndexByClassname()); for (Map.Entry<InputFile, UnitTestClassReport> entry : indexByInputFile.entrySet()) { UnitTestClassReport report = entry.getValue(); if (report.getTests() > 0) { negativeTimeTestNumber += report.getNegativeTimeTestNumber(); save(report, entry.getKey(), context); } } if (negativeTimeTestNumber > 0) { LOGGER.warn("There is {} test(s) reported with negative time by surefire, total duration may not be accurate.", negativeTimeTestNumber); } }
public UnitTestClassReport merge(String classname, String intoClassname) { UnitTestClassReport from = indexByClassname.get(classname); if (from!=null) { UnitTestClassReport to = index(intoClassname); to.add(from); indexByClassname.remove(classname); return to; } return null; }
private void sanitize(UnitTestIndex index) { for (String classname : index.getClassnames()) { if (StringUtils.contains(classname, "$")) { // Surefire reports classes whereas sonar supports files String parentClassName = StringUtils.substringBefore(classname, "$"); index.merge(classname, parentClassName); } } }
private void parseFiles(SensorContext context, File[] reports) { UnitTestIndex index = new UnitTestIndex(); parseFiles(reports, index); sanitize(index); save(index, context); }