Search in sources :

Example 1 with FunctionCall

use of org.exist.xquery.FunctionCall in project exist by eXist-db.

the class XMLTestRunner method run.

@Override
public void run(final RunNotifier notifier) {
    try {
        final String pkgName = getClass().getPackage().getName().replace('.', '/');
        final Source query = new ClassLoaderSource(pkgName + "/xml-test-runner.xq");
        final List<java.util.function.Function<XQueryContext, Tuple2<String, Object>>> externalVariableDeclarations = Arrays.asList(context -> new Tuple2<>("doc", doc), context -> new Tuple2<>("id", Sequence.EMPTY_SEQUENCE), // set callback functions for notifying junit!
        context -> new Tuple2<>("test-ignored-function", new FunctionReference(new FunctionCall(context, new ExtTestIgnoredFunction(context, getSuiteName(), notifier)))), context -> new Tuple2<>("test-started-function", new FunctionReference(new FunctionCall(context, new ExtTestStartedFunction(context, getSuiteName(), notifier)))), context -> new Tuple2<>("test-failure-function", new FunctionReference(new FunctionCall(context, new ExtTestFailureFunction(context, getSuiteName(), notifier)))), context -> new Tuple2<>("test-assumption-failed-function", new FunctionReference(new FunctionCall(context, new ExtTestAssumptionFailedFunction(context, getSuiteName(), notifier)))), context -> new Tuple2<>("test-error-function", new FunctionReference(new FunctionCall(context, new ExtTestErrorFunction(context, getSuiteName(), notifier)))), context -> new Tuple2<>("test-finished-function", new FunctionReference(new FunctionCall(context, new ExtTestFinishedFunction(context, getSuiteName(), notifier)))));
        // NOTE: at this stage EXIST_EMBEDDED_SERVER_CLASS_INSTANCE in XSuite will be usable
        final BrokerPool brokerPool = XSuite.EXIST_EMBEDDED_SERVER_CLASS_INSTANCE.getBrokerPool();
        executeQuery(brokerPool, query, externalVariableDeclarations);
    } catch (final DatabaseConfigurationException | IOException | EXistException | PermissionDeniedException | XPathException e) {
        // TODO(AR) what to do here?
        throw new RuntimeException(e);
    }
}
Also used : ClassLoaderSource(org.exist.source.ClassLoaderSource) XPathException(org.exist.xquery.XPathException) IOException(java.io.IOException) EXistException(org.exist.EXistException) ClassLoaderSource(org.exist.source.ClassLoaderSource) Source(org.exist.source.Source) InputSource(org.xml.sax.InputSource) DatabaseConfigurationException(org.exist.util.DatabaseConfigurationException) FunctionReference(org.exist.xquery.value.FunctionReference) PermissionDeniedException(org.exist.security.PermissionDeniedException) FunctionCall(org.exist.xquery.FunctionCall) BrokerPool(org.exist.storage.BrokerPool)

Aggregations

IOException (java.io.IOException)1 EXistException (org.exist.EXistException)1 PermissionDeniedException (org.exist.security.PermissionDeniedException)1 ClassLoaderSource (org.exist.source.ClassLoaderSource)1 Source (org.exist.source.Source)1 BrokerPool (org.exist.storage.BrokerPool)1 DatabaseConfigurationException (org.exist.util.DatabaseConfigurationException)1 FunctionCall (org.exist.xquery.FunctionCall)1 XPathException (org.exist.xquery.XPathException)1 FunctionReference (org.exist.xquery.value.FunctionReference)1 InputSource (org.xml.sax.InputSource)1