Skip to content

Commit

Permalink
Start of adding XSuite tests to Maven for XQSuite
Browse files Browse the repository at this point in the history
  • Loading branch information
adamretter committed Jan 3, 2023
1 parent e231ae8 commit d5c9715
Show file tree
Hide file tree
Showing 5 changed files with 161 additions and 23 deletions.
32 changes: 31 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,21 @@
</plugins>
</reporting>

<dependencies>
<!-- test dependencies -->
<dependency>
<groupId>org.exist-db</groupId>
<artifactId>exist-core</artifactId>
<version>${exist.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<resources>
<resource>
Expand All @@ -98,6 +113,21 @@
</resource>
</resources>

<!--
Makes the XQuery files of the app available
on the Java classpath for XSuite during tests.
-->
<testResources>
<testResource>
<directory>src/main/xar-resources</directory>
<filtering>false</filtering>
<targetPath>xquery/</targetPath>
<includes>
<include>modules/**</include>
</includes>
</testResource>
</testResources>

<pluginManagement>
<plugins>
<plugin>
Expand Down Expand Up @@ -471,7 +501,7 @@
<pluginRepositories>
<pluginRepository>
<id>clojars.org</id>
<url>http://clojars.org/repo</url>
<url>https://clojars.org/repo</url>
</pluginRepository>
</pluginRepositories>

Expand Down
19 changes: 0 additions & 19 deletions src/main/xar-resources/modules/test-runner.xql

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.exist.documentation.xquery;

import org.exist.test.runner.XSuite;
import org.junit.runner.RunWith;

@RunWith(XSuite.class)
@XSuite.XSuiteFiles({
"src/test/xquery/documentation"
})
public class DocumentationTests {
}
113 changes: 113 additions & 0 deletions src/test/resources/conf.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<exist>

<db-connection cacheSize="256M" checkMaxCacheSize="true" collectionCache="64M" database="native"
files="webapp/WEB-INF/data" pageSize="4096" nodesBuffer="1000" cacheShrinkThreshold="10000"
doc-ids="default" minDiskSpace="128M" posix-chown-restricted="true" preserve-on-copy="false">
<startup>
<triggers>
<trigger class="org.exist.security.BouncyCastleJceProviderStartupTrigger"/>
</triggers>
</startup>
<pool max="20" min="1" sync-period="120000" wait-before-shutdown="120000"/>
<query-pool max-stack-size="64" size="128" timeout="120000"/>
<recovery enabled="yes" group-commit="no" journal-dir="webapp/WEB-INF/data"
size="100M" sync-on-commit="no" force-restart="no" consistency-check="yes"/>
<watchdog output-size-limit="1000000" query-timeout="-1"/>
</db-connection>

<repository root="/db/apps"/>

<binary-manager>
<cache class="org.exist.util.io.FileFilterInputStreamCache"/>
</binary-manager>

<indexer caseSensitive="yes" index-depth="5" preserve-whitespace-mixed-content="no"
suppress-whitespace="none">
<modules>
<module id="lucene-index" buffer="32" class="org.exist.indexing.lucene.LuceneIndex" />
<module id="range-index" class="org.exist.indexing.range.RangeIndex"/>
</modules>
<index/>
</indexer>

<scheduler/>

<parser>
<xml>
<features>
<feature name="http://xml.org/sax/features/external-general-entities" value="false"/>
<feature name="http://xml.org/sax/features/external-parameter-entities" value="false"/>
<feature name="http://javax.xml.XMLConstants/feature/secure-processing" value="true"/>
</features>
</xml>
<html-to-xml class="org.cyberneko.html.parsers.SAXParser">
<properties>
<property name="http://cyberneko.org/html/properties/names/elems" value="match"/>
<property name="http://cyberneko.org/html/properties/names/attrs" value="no-change"/>
</properties>
</html-to-xml>
</parser>

<serializer add-exist-id="none" compress-output="no" enable-xinclude="yes"
enable-xsl="no" indent="yes" match-tagging-attributes="no"
match-tagging-elements="no"/>

<transformer class="net.sf.saxon.TransformerFactoryImpl" caching="yes">
<attribute name="http://saxon.sf.net/feature/version-warning" value="false" type="boolean"/>
</transformer>

<validation mode="no">
<entity-resolver>
<catalog uri="${WEBAPP_HOME}/WEB-INF/catalog.xml"/>
</entity-resolver>
</validation>

<xquery enable-java-binding="no" disable-deprecated-functions="no"
enable-query-rewriting="yes" backwardCompatible="no"
enforce-index-use="always"
raise-error-on-failed-retrieval="no">

<builtin-modules>
<!--
Modularized Indexes
-->
<module uri="http://exist-db.org/xquery/lucene" class="org.exist.xquery.modules.lucene.LuceneModule" />
<module uri="http://exist-db.org/xquery/range" class="org.exist.xquery.modules.range.RangeIndexModule" />

<!--
Default Modules
-->

<module uri="http://exist-db.org/xquery/inspection" class="org.exist.xquery.functions.inspect.InspectionModule"/>
<module uri="http://exist-db.org/xquery/request" class="org.exist.xquery.functions.request.RequestModule" />
<module uri="http://exist-db.org/xquery/response" class="org.exist.xquery.functions.response.ResponseModule" />
<module uri="http://exist-db.org/xquery/securitymanager" class="org.exist.xquery.functions.securitymanager.SecurityManagerModule"/>
<module uri="http://exist-db.org/xquery/session" class="org.exist.xquery.functions.session.SessionModule" />
<module uri="http://exist-db.org/xquery/system" class="org.exist.xquery.functions.system.SystemModule" />
<module uri="http://exist-db.org/xquery/transform" class="org.exist.xquery.functions.transform.TransformModule" />

<module uri="http://exist-db.org/xquery/util" class="org.exist.xquery.functions.util.UtilModule">
<parameter name="evalDisabled" value="false"/>
</module>

<module uri="http://exist-db.org/xquery/xmldb" class="org.exist.xquery.functions.xmldb.XMLDBModule" />

<module uri="http://www.w3.org/2005/xpath-functions/map" class="org.exist.xquery.functions.map.MapModule" />
<module uri="http://www.w3.org/2005/xpath-functions/math" class="org.exist.xquery.functions.math.MathModule" />
<module uri="http://www.w3.org/2005/xpath-functions/array" class="org.exist.xquery.functions.array.ArrayModule" />

<module uri="http://expath.org/ns/http-client" class="org.expath.exist.HttpClientModule"/>

<module uri="http://expath.org/ns/zip" class="org.expath.exist.ZipModule" />

<!-- Test module -->
<module uri="http://exist-db.org/xquery/testing" src="resource:org/exist/xquery/lib/test.xq" />
<module uri="http://exist-db.org/xquery/scheduler" class="org.exist.xquery.modules.scheduler.SchedulerModule" />

</builtin-modules>
</xquery>

<xupdate allowed-fragmentation="50000" enable-consistency-checks="no"/>

</exist>
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ xquery version "3.1";

module namespace tests = "http://exist-db.org/xquery/documentation/tests";

import module namespace docbook = "http://docbook.org/ns/docbook" at "docbook.xql";
import module namespace config = "http://exist-db.org/xquery/apps/config" at "config.xqm";
import module namespace diag = "http://exist-db.org/xquery/diagnostics" at "diagnostics.xql";
import module namespace docbook = "http://docbook.org/ns/docbook"
at "resource:xquery/modules/docbook.xql";
import module namespace config = "http://exist-db.org/xquery/apps/config"
at "resource:xquery/modules/config.xql";
import module namespace diag = "http://exist-db.org/xquery/diagnostics"
at "resource:xquery/modules/diagnostics.xql";

declare namespace test = "http://exist-db.org/xquery/xqsuite";
declare namespace db5 = "http://docbook.org/ns/docbook";
Expand Down

0 comments on commit d5c9715

Please sign in to comment.