Search in sources :

Example 1 with SVRLSuccessfulReport

use of com.helger.schematron.svrl.SVRLSuccessfulReport in project ph-schematron by phax.

the class Issue16Test method testIssue16.

@Test
@Ignore
public void testIssue16() throws Exception {
    final File schematronFile = new ClassPathResource("issues/github16/sample_schematron.sch").getAsFile();
    final File xmlFile = new ClassPathResource("issues/github16/test.xml").getAsFile();
    final SchematronOutputType outputType = SchematronUtil.validateXMLViaXSLTSchematronFull(schematronFile, xmlFile);
    if (outputType == null)
        throw new Exception("SchematronOutputType null");
    final List<SVRLSuccessfulReport> succeededList = SVRLHelper.getAllSuccessfulReports(outputType);
    for (final SVRLSuccessfulReport succeededReport : succeededList) {
        System.out.println(succeededReport.getTest());
    }
    int i = 1;
    final List<SVRLFailedAssert> failedList = SVRLHelper.getAllFailedAssertions(outputType);
    for (final SVRLFailedAssert failedAssert : failedList) {
        System.out.println(i++ + ". Location:" + failedAssert.getLocation());
        System.out.println("Test: " + failedAssert.getTest());
        System.out.println("Text: " + failedAssert.getText());
        final List<DiagnosticReference> diagnisticReferences = failedAssert.getDiagnisticReferences();
        for (final DiagnosticReference diagnisticRef : diagnisticReferences) {
            System.out.println("Diag ref: " + diagnisticRef.getDiagnostic());
            System.out.println("Diag text: " + diagnisticRef.getText());
        }
    }
    if (failedList.isEmpty()) {
        System.out.println("PASS");
    } else {
        System.out.println("FAIL");
    }
}
Also used : SchematronOutputType(org.oclc.purl.dsdl.svrl.SchematronOutputType) SVRLFailedAssert(com.helger.schematron.svrl.SVRLFailedAssert) DiagnosticReference(org.oclc.purl.dsdl.svrl.DiagnosticReference) SVRLSuccessfulReport(com.helger.schematron.svrl.SVRLSuccessfulReport) File(java.io.File) ClassPathResource(com.helger.commons.io.resource.ClassPathResource) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

ClassPathResource (com.helger.commons.io.resource.ClassPathResource)1 SVRLFailedAssert (com.helger.schematron.svrl.SVRLFailedAssert)1 SVRLSuccessfulReport (com.helger.schematron.svrl.SVRLSuccessfulReport)1 File (java.io.File)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1 DiagnosticReference (org.oclc.purl.dsdl.svrl.DiagnosticReference)1 SchematronOutputType (org.oclc.purl.dsdl.svrl.SchematronOutputType)1