Search in sources :

Example 1 with ElementFilter

use of org.codehaus.staxmate.in.ElementFilter in project sonar-java by SonarSource.

the class SurefireStaxHandler method stream.

public void stream(SMHierarchicCursor rootCursor) throws XMLStreamException {
    SMInputCursor testSuite = rootCursor.constructDescendantCursor(new ElementFilter("testsuite"));
    SMEvent testSuiteEvent;
    for (testSuiteEvent = testSuite.getNext(); testSuiteEvent != null; testSuiteEvent = testSuite.getNext()) {
        if (testSuiteEvent.compareTo(SMEvent.START_ELEMENT) == 0) {
            String testSuiteClassName = testSuite.getAttrValue("name");
            parseTestCase(testSuiteClassName, testSuite.childCursor(new ElementFilter("testcase")));
        }
    }
}
Also used : SMInputCursor(org.codehaus.staxmate.in.SMInputCursor) ElementFilter(org.codehaus.staxmate.in.ElementFilter) SMEvent(org.codehaus.staxmate.in.SMEvent)

Example 2 with ElementFilter

use of org.codehaus.staxmate.in.ElementFilter in project sonar-python by SonarSource.

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));
        }
    }
}
Also used : SMInputCursor(org.codehaus.staxmate.in.SMInputCursor) ElementFilter(org.codehaus.staxmate.in.ElementFilter)

Example 3 with ElementFilter

use of org.codehaus.staxmate.in.ElementFilter 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));
        }
    }
}
Also used : SMInputCursor(org.codehaus.staxmate.in.SMInputCursor) ElementFilter(org.codehaus.staxmate.in.ElementFilter)

Aggregations

ElementFilter (org.codehaus.staxmate.in.ElementFilter)3 SMInputCursor (org.codehaus.staxmate.in.SMInputCursor)3 SMEvent (org.codehaus.staxmate.in.SMEvent)1