Search in sources :

Example 1 with TestProcessingMap

use of uk.ac.ed.ph.jqtiplus.state.TestProcessingMap in project OpenOLAT by OpenOLAT.

the class AssessmentTestDisplayController method getTestProcessingMap.

private TestProcessingMap getTestProcessingMap() {
    boolean assessmentPackageIsValid = true;
    BadResourceException ex = resolvedAssessmentTest.getTestLookup().getBadResourceException();
    if (ex instanceof QtiXmlInterpretationException) {
        try {
            // try to log some informations
            QtiXmlInterpretationException exml = (QtiXmlInterpretationException) ex;
            logError(exml.getInterpretationFailureReason().toString(), null);
            for (QtiModelBuildingError err : exml.getQtiModelBuildingErrors()) {
                logError(err.toString(), null);
            }
        } catch (Exception e) {
            logError("", e);
        }
    }
    TestProcessingInitializer initializer = new TestProcessingInitializer(resolvedAssessmentTest, assessmentPackageIsValid);
    TestProcessingMap result = initializer.initialize();
    return result;
}
Also used : TestProcessingMap(uk.ac.ed.ph.jqtiplus.state.TestProcessingMap) BadResourceException(uk.ac.ed.ph.jqtiplus.provision.BadResourceException) QtiXmlInterpretationException(uk.ac.ed.ph.jqtiplus.reading.QtiXmlInterpretationException) TestProcessingInitializer(uk.ac.ed.ph.jqtiplus.running.TestProcessingInitializer) QtiModelBuildingError(uk.ac.ed.ph.jqtiplus.reading.QtiModelBuildingError) ResponseBindingException(uk.ac.ed.ph.jqtiplus.exception.ResponseBindingException) QtiXmlInterpretationException(uk.ac.ed.ph.jqtiplus.reading.QtiXmlInterpretationException) QtiCandidateStateException(uk.ac.ed.ph.jqtiplus.exception.QtiCandidateStateException) BadResourceException(uk.ac.ed.ph.jqtiplus.provision.BadResourceException) OLATRuntimeException(org.olat.core.logging.OLATRuntimeException)

Example 2 with TestProcessingMap

use of uk.ac.ed.ph.jqtiplus.state.TestProcessingMap in project OpenOLAT by OpenOLAT.

the class AssessmentTestDisplayController method createNewTestSessionStateAndController.

private TestSessionController createNewTestSessionStateAndController(NotificationRecorder notificationRecorder) {
    TestProcessingMap testProcessingMap = getTestProcessingMap();
    /* Generate a test plan for this session */
    final TestPlanner testPlanner = new TestPlanner(testProcessingMap);
    if (notificationRecorder != null) {
        testPlanner.addNotificationListener(notificationRecorder);
    }
    final TestPlan testPlan = testPlanner.generateTestPlan();
    final TestSessionState testSessionState = new TestSessionState(testPlan);
    final TestSessionControllerSettings testSessionControllerSettings = new TestSessionControllerSettings();
    testSessionControllerSettings.setTemplateProcessingLimit(computeTemplateProcessingLimit());
    testProcessingMap.reduceItemProcessingMapMap(testPlan.getTestPlanNodeList());
    /* Create controller and wire up notification recorder */
    final TestSessionController result = new TestSessionController(qtiService.jqtiExtensionManager(), testSessionControllerSettings, testProcessingMap, testSessionState);
    if (notificationRecorder != null) {
        result.addNotificationListener(notificationRecorder);
    }
    return result;
}
Also used : TestSessionControllerSettings(uk.ac.ed.ph.jqtiplus.running.TestSessionControllerSettings) TestProcessingMap(uk.ac.ed.ph.jqtiplus.state.TestProcessingMap) TestPlanner(uk.ac.ed.ph.jqtiplus.running.TestPlanner) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) TestPlan(uk.ac.ed.ph.jqtiplus.state.TestPlan) TestSessionController(uk.ac.ed.ph.jqtiplus.running.TestSessionController)

Example 3 with TestProcessingMap

use of uk.ac.ed.ph.jqtiplus.state.TestProcessingMap in project OpenOLAT by OpenOLAT.

the class AssessmentTestDisplayController method createTestSessionController.

public TestSessionController createTestSessionController(TestSessionState testSessionState, NotificationRecorder notificationRecorder) {
    /* Try to resolve the underlying JQTI+ object */
    final TestProcessingMap testProcessingMap = getTestProcessingMap();
    if (testProcessingMap == null) {
        return null;
    }
    /* Create config for TestSessionController */
    final TestSessionControllerSettings testSessionControllerSettings = new TestSessionControllerSettings();
    testSessionControllerSettings.setTemplateProcessingLimit(computeTemplateProcessingLimit());
    /* Create controller and wire up notification recorder (if passed) */
    final TestSessionController result = new TestSessionController(qtiService.jqtiExtensionManager(), testSessionControllerSettings, testProcessingMap, testSessionState);
    if (notificationRecorder != null) {
        result.addNotificationListener(notificationRecorder);
    }
    return result;
}
Also used : TestSessionControllerSettings(uk.ac.ed.ph.jqtiplus.running.TestSessionControllerSettings) TestProcessingMap(uk.ac.ed.ph.jqtiplus.state.TestProcessingMap) TestSessionController(uk.ac.ed.ph.jqtiplus.running.TestSessionController)

Example 4 with TestProcessingMap

use of uk.ac.ed.ph.jqtiplus.state.TestProcessingMap in project openolat by klemens.

the class AssessmentTestDisplayController method createNewTestSessionStateAndController.

private TestSessionController createNewTestSessionStateAndController(NotificationRecorder notificationRecorder) {
    TestProcessingMap testProcessingMap = getTestProcessingMap();
    /* Generate a test plan for this session */
    final TestPlanner testPlanner = new TestPlanner(testProcessingMap);
    if (notificationRecorder != null) {
        testPlanner.addNotificationListener(notificationRecorder);
    }
    final TestPlan testPlan = testPlanner.generateTestPlan();
    final TestSessionState testSessionState = new TestSessionState(testPlan);
    final TestSessionControllerSettings testSessionControllerSettings = new TestSessionControllerSettings();
    testSessionControllerSettings.setTemplateProcessingLimit(computeTemplateProcessingLimit());
    testProcessingMap.reduceItemProcessingMapMap(testPlan.getTestPlanNodeList());
    /* Create controller and wire up notification recorder */
    final TestSessionController result = new TestSessionController(qtiService.jqtiExtensionManager(), testSessionControllerSettings, testProcessingMap, testSessionState);
    if (notificationRecorder != null) {
        result.addNotificationListener(notificationRecorder);
    }
    return result;
}
Also used : TestSessionControllerSettings(uk.ac.ed.ph.jqtiplus.running.TestSessionControllerSettings) TestProcessingMap(uk.ac.ed.ph.jqtiplus.state.TestProcessingMap) TestPlanner(uk.ac.ed.ph.jqtiplus.running.TestPlanner) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) TestPlan(uk.ac.ed.ph.jqtiplus.state.TestPlan) TestSessionController(uk.ac.ed.ph.jqtiplus.running.TestSessionController)

Example 5 with TestProcessingMap

use of uk.ac.ed.ph.jqtiplus.state.TestProcessingMap in project openolat by klemens.

the class AssessmentTestDisplayController method createTestSessionController.

public TestSessionController createTestSessionController(TestSessionState testSessionState, NotificationRecorder notificationRecorder) {
    /* Try to resolve the underlying JQTI+ object */
    final TestProcessingMap testProcessingMap = getTestProcessingMap();
    if (testProcessingMap == null) {
        return null;
    }
    /* Create config for TestSessionController */
    final TestSessionControllerSettings testSessionControllerSettings = new TestSessionControllerSettings();
    testSessionControllerSettings.setTemplateProcessingLimit(computeTemplateProcessingLimit());
    /* Create controller and wire up notification recorder (if passed) */
    final TestSessionController result = new TestSessionController(qtiService.jqtiExtensionManager(), testSessionControllerSettings, testProcessingMap, testSessionState);
    if (notificationRecorder != null) {
        result.addNotificationListener(notificationRecorder);
    }
    return result;
}
Also used : TestSessionControllerSettings(uk.ac.ed.ph.jqtiplus.running.TestSessionControllerSettings) TestProcessingMap(uk.ac.ed.ph.jqtiplus.state.TestProcessingMap) TestSessionController(uk.ac.ed.ph.jqtiplus.running.TestSessionController)

Aggregations

TestProcessingMap (uk.ac.ed.ph.jqtiplus.state.TestProcessingMap)6 TestSessionController (uk.ac.ed.ph.jqtiplus.running.TestSessionController)4 TestSessionControllerSettings (uk.ac.ed.ph.jqtiplus.running.TestSessionControllerSettings)4 OLATRuntimeException (org.olat.core.logging.OLATRuntimeException)2 QtiCandidateStateException (uk.ac.ed.ph.jqtiplus.exception.QtiCandidateStateException)2 ResponseBindingException (uk.ac.ed.ph.jqtiplus.exception.ResponseBindingException)2 BadResourceException (uk.ac.ed.ph.jqtiplus.provision.BadResourceException)2 QtiModelBuildingError (uk.ac.ed.ph.jqtiplus.reading.QtiModelBuildingError)2 QtiXmlInterpretationException (uk.ac.ed.ph.jqtiplus.reading.QtiXmlInterpretationException)2 TestPlanner (uk.ac.ed.ph.jqtiplus.running.TestPlanner)2 TestProcessingInitializer (uk.ac.ed.ph.jqtiplus.running.TestProcessingInitializer)2 TestPlan (uk.ac.ed.ph.jqtiplus.state.TestPlan)2 TestSessionState (uk.ac.ed.ph.jqtiplus.state.TestSessionState)2