Search in sources :

Example 1 with Notification

use of uk.ac.ed.ph.jqtiplus.notification.Notification in project OpenOLAT by OpenOLAT.

the class QTI21AssessmentTestHandlerTest method validateAssessmentTest.

private boolean validateAssessmentTest(File assessmentTestFile) {
    QtiXmlReader qtiXmlReader = new QtiXmlReader(new JqtiExtensionManager());
    ResourceLocator fileResourceLocator = new PathResourceLocator(assessmentTestFile.toPath());
    AssessmentObjectXmlLoader assessmentObjectXmlLoader = new AssessmentObjectXmlLoader(qtiXmlReader, fileResourceLocator);
    TestValidationResult test = assessmentObjectXmlLoader.loadResolveAndValidateTest(assessmentTestFile.toURI());
    for (Notification notification : test.getModelValidationErrors()) {
        log.error(notification.getQtiNode() + " : " + notification.getMessage());
    }
    BadResourceException e = test.getResolvedAssessmentTest().getTestLookup().getBadResourceException();
    StringBuilder err = new StringBuilder();
    BadRessourceHelper.extractMessage(e, err);
    log.error(err.toString());
    return test.getModelValidationErrors().isEmpty();
}
Also used : AssessmentObjectXmlLoader(uk.ac.ed.ph.jqtiplus.reading.AssessmentObjectXmlLoader) QtiXmlReader(uk.ac.ed.ph.jqtiplus.reading.QtiXmlReader) BadResourceException(uk.ac.ed.ph.jqtiplus.provision.BadResourceException) JqtiExtensionManager(uk.ac.ed.ph.jqtiplus.JqtiExtensionManager) PathResourceLocator(org.olat.fileresource.types.ImsQTI21Resource.PathResourceLocator) TestValidationResult(uk.ac.ed.ph.jqtiplus.validation.TestValidationResult) Notification(uk.ac.ed.ph.jqtiplus.notification.Notification) ResourceLocator(uk.ac.ed.ph.jqtiplus.xmlutils.locators.ResourceLocator) PathResourceLocator(org.olat.fileresource.types.ImsQTI21Resource.PathResourceLocator)

Example 2 with Notification

use of uk.ac.ed.ph.jqtiplus.notification.Notification in project openolat by klemens.

the class QTI21AssessmentTestHandlerTest method validateAssessmentTest.

private boolean validateAssessmentTest(File assessmentTestFile) {
    QtiXmlReader qtiXmlReader = new QtiXmlReader(new JqtiExtensionManager());
    ResourceLocator fileResourceLocator = new PathResourceLocator(assessmentTestFile.toPath());
    AssessmentObjectXmlLoader assessmentObjectXmlLoader = new AssessmentObjectXmlLoader(qtiXmlReader, fileResourceLocator);
    TestValidationResult test = assessmentObjectXmlLoader.loadResolveAndValidateTest(assessmentTestFile.toURI());
    for (Notification notification : test.getModelValidationErrors()) {
        log.error(notification.getQtiNode() + " : " + notification.getMessage());
    }
    BadResourceException e = test.getResolvedAssessmentTest().getTestLookup().getBadResourceException();
    StringBuilder err = new StringBuilder();
    BadRessourceHelper.extractMessage(e, err);
    log.error(err.toString());
    return test.getModelValidationErrors().isEmpty();
}
Also used : AssessmentObjectXmlLoader(uk.ac.ed.ph.jqtiplus.reading.AssessmentObjectXmlLoader) QtiXmlReader(uk.ac.ed.ph.jqtiplus.reading.QtiXmlReader) BadResourceException(uk.ac.ed.ph.jqtiplus.provision.BadResourceException) JqtiExtensionManager(uk.ac.ed.ph.jqtiplus.JqtiExtensionManager) PathResourceLocator(org.olat.fileresource.types.ImsQTI21Resource.PathResourceLocator) TestValidationResult(uk.ac.ed.ph.jqtiplus.validation.TestValidationResult) Notification(uk.ac.ed.ph.jqtiplus.notification.Notification) ResourceLocator(uk.ac.ed.ph.jqtiplus.xmlutils.locators.ResourceLocator) PathResourceLocator(org.olat.fileresource.types.ImsQTI21Resource.PathResourceLocator)

Example 3 with Notification

use of uk.ac.ed.ph.jqtiplus.notification.Notification in project OpenOLAT by OpenOLAT.

the class QTI12To21ConverterTest method validateAssessmentTest.

private boolean validateAssessmentTest(File assessmentTestFile) {
    QtiXmlReader qtiXmlReader = new QtiXmlReader(new JqtiExtensionManager());
    ResourceLocator fileResourceLocator = new PathResourceLocator(assessmentTestFile.toPath());
    AssessmentObjectXmlLoader assessmentObjectXmlLoader = new AssessmentObjectXmlLoader(qtiXmlReader, fileResourceLocator);
    TestValidationResult test = assessmentObjectXmlLoader.loadResolveAndValidateTest(assessmentTestFile.toURI());
    for (Notification notification : test.getModelValidationErrors()) {
        log.error(notification.getQtiNode() + " : " + notification.getMessage());
    }
    BadResourceException e = test.getResolvedAssessmentTest().getTestLookup().getBadResourceException();
    if (e != null) {
        StringBuilder err = new StringBuilder();
        BadRessourceHelper.extractMessage(e, err);
        log.error(err.toString());
    }
    return test.getModelValidationErrors().isEmpty();
}
Also used : AssessmentObjectXmlLoader(uk.ac.ed.ph.jqtiplus.reading.AssessmentObjectXmlLoader) QtiXmlReader(uk.ac.ed.ph.jqtiplus.reading.QtiXmlReader) BadResourceException(uk.ac.ed.ph.jqtiplus.provision.BadResourceException) JqtiExtensionManager(uk.ac.ed.ph.jqtiplus.JqtiExtensionManager) PathResourceLocator(org.olat.fileresource.types.ImsQTI21Resource.PathResourceLocator) TestValidationResult(uk.ac.ed.ph.jqtiplus.validation.TestValidationResult) Notification(uk.ac.ed.ph.jqtiplus.notification.Notification) ResourceLocator(uk.ac.ed.ph.jqtiplus.xmlutils.locators.ResourceLocator) PathResourceLocator(org.olat.fileresource.types.ImsQTI21Resource.PathResourceLocator)

Example 4 with Notification

use of uk.ac.ed.ph.jqtiplus.notification.Notification in project openolat by klemens.

the class QTI12To21ConverterTest method validateAssessmentTest.

private boolean validateAssessmentTest(File assessmentTestFile) {
    QtiXmlReader qtiXmlReader = new QtiXmlReader(new JqtiExtensionManager());
    ResourceLocator fileResourceLocator = new PathResourceLocator(assessmentTestFile.toPath());
    AssessmentObjectXmlLoader assessmentObjectXmlLoader = new AssessmentObjectXmlLoader(qtiXmlReader, fileResourceLocator);
    TestValidationResult test = assessmentObjectXmlLoader.loadResolveAndValidateTest(assessmentTestFile.toURI());
    for (Notification notification : test.getModelValidationErrors()) {
        log.error(notification.getQtiNode() + " : " + notification.getMessage());
    }
    BadResourceException e = test.getResolvedAssessmentTest().getTestLookup().getBadResourceException();
    if (e != null) {
        StringBuilder err = new StringBuilder();
        BadRessourceHelper.extractMessage(e, err);
        log.error(err.toString());
    }
    return test.getModelValidationErrors().isEmpty();
}
Also used : AssessmentObjectXmlLoader(uk.ac.ed.ph.jqtiplus.reading.AssessmentObjectXmlLoader) QtiXmlReader(uk.ac.ed.ph.jqtiplus.reading.QtiXmlReader) BadResourceException(uk.ac.ed.ph.jqtiplus.provision.BadResourceException) JqtiExtensionManager(uk.ac.ed.ph.jqtiplus.JqtiExtensionManager) PathResourceLocator(org.olat.fileresource.types.ImsQTI21Resource.PathResourceLocator) TestValidationResult(uk.ac.ed.ph.jqtiplus.validation.TestValidationResult) Notification(uk.ac.ed.ph.jqtiplus.notification.Notification) ResourceLocator(uk.ac.ed.ph.jqtiplus.xmlutils.locators.ResourceLocator) PathResourceLocator(org.olat.fileresource.types.ImsQTI21Resource.PathResourceLocator)

Aggregations

PathResourceLocator (org.olat.fileresource.types.ImsQTI21Resource.PathResourceLocator)4 JqtiExtensionManager (uk.ac.ed.ph.jqtiplus.JqtiExtensionManager)4 Notification (uk.ac.ed.ph.jqtiplus.notification.Notification)4 BadResourceException (uk.ac.ed.ph.jqtiplus.provision.BadResourceException)4 AssessmentObjectXmlLoader (uk.ac.ed.ph.jqtiplus.reading.AssessmentObjectXmlLoader)4 QtiXmlReader (uk.ac.ed.ph.jqtiplus.reading.QtiXmlReader)4 TestValidationResult (uk.ac.ed.ph.jqtiplus.validation.TestValidationResult)4 ResourceLocator (uk.ac.ed.ph.jqtiplus.xmlutils.locators.ResourceLocator)4