use of org.codehaus.staxmate.in.SMInputCursor in project sonar-rust by elegoff.
the class CoberturaParser method readFileContent.
private static void readFileContent(SMInputCursor classCursor, NewCoverage coverage) throws XMLStreamException {
SMInputCursor line = classCursor.childElementCursor(LINES).advance().childElementCursor(LINE);
while (line.getNext() != null) {
var linum = Integer.parseInt(line.getAttrValue(NUMBER));
coverage.lineHits(linum, Integer.parseInt(line.getAttrValue(HITS)));
String isBranch = line.getAttrValue(BRANCH);
String text = line.getAttrValue(CONDITION_COVERAGE);
if (!StringUtils.equals(isBranch, "true") || !StringUtils.isNotBlank(text)) {
continue;
}
String[] conditions = StringUtils.split(StringUtils.substringBetween(text, "(", ")"), "/");
coverage.conditions(linum, Integer.parseInt(conditions[1]), Integer.parseInt(conditions[0]));
}
}
use of org.codehaus.staxmate.in.SMInputCursor in project sonar-rust by elegoff.
the class TestSuiteParser method stream.
@Override
public void stream(SMHierarchicCursor rootCursor) throws XMLStreamException {
SMInputCursor testSuiteCursor = rootCursor.constructDescendantCursor(new ElementFilter("testsuite"));
while (testSuiteCursor.getNext() != null) {
String testSuiteClassName = getExpectedAttribute(testSuiteCursor, "name");
TestSuite testSuite = new TestSuite(testSuiteClassName);
testSuites.add(testSuite);
SMInputCursor testCaseCursor = testSuiteCursor.childElementCursor("testcase");
while (testCaseCursor.getNext() != null) {
testSuite.addTestCase(parseTestCaseTag(testCaseCursor));
}
}
}
Aggregations