Skip to content

Commit f296369

Browse files
committed
[refactor] Use XSuite to execute XQSuite tests from Maven
1 parent ed091b8 commit f296369

File tree

5 files changed

+149
-23
lines changed

5 files changed

+149
-23
lines changed

pom.xml

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,30 @@
7878
</plugins>
7979
</reporting>
8080

81+
<dependencies>
82+
<!-- test dependencies -->
83+
<dependency>
84+
<groupId>org.exist-db</groupId>
85+
<artifactId>exist-core</artifactId>
86+
<version>${exist.version}</version>
87+
<scope>test</scope>
88+
</dependency>
89+
<dependency>
90+
<!--
91+
Needed by the documentation app under test
92+
-->
93+
<groupId>org.exist-db</groupId>
94+
<artifactId>exist-index-lucene</artifactId>
95+
<version>${exist.version}</version>
96+
<scope>test</scope>
97+
</dependency>
98+
<dependency>
99+
<groupId>junit</groupId>
100+
<artifactId>junit</artifactId>
101+
<scope>test</scope>
102+
</dependency>
103+
</dependencies>
104+
81105
<build>
82106
<resources>
83107
<resource>
@@ -262,6 +286,16 @@
262286
<xmlIncludes>*/*.xml</xmlIncludes>
263287
</configuration>
264288
</plugin>
289+
<plugin>
290+
<groupId>org.apache.maven.plugins</groupId>
291+
<artifactId>maven-surefire-plugin</artifactId>
292+
<version>3.0.0-M7</version>
293+
</plugin>
294+
<plugin>
295+
<groupId>org.apache.maven.plugins</groupId>
296+
<artifactId>maven-surefire-report-plugin</artifactId>
297+
<version>3.0.0-M7</version>
298+
</plugin>
265299
<plugin>
266300
<groupId>ro.kuberam.maven.plugins</groupId>
267301
<artifactId>kuberam-expath-plugin</artifactId>
@@ -471,7 +505,7 @@
471505
<pluginRepositories>
472506
<pluginRepository>
473507
<id>clojars.org</id>
474-
<url>http://clojars.org/repo</url>
508+
<url>https://clojars.org/repo</url>
475509
</pluginRepository>
476510
</pluginRepositories>
477511

src/main/xar-resources/modules/test-runner.xql

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package org.exist.documentation.xquery;
2+
3+
import org.exist.test.runner.XSuite;
4+
import org.junit.runner.RunWith;
5+
6+
@RunWith(XSuite.class)
7+
@XSuite.XSuiteFiles({
8+
"src/test/xquery/documentation"
9+
})
10+
public class DocumentationTests {
11+
}

src/test/resources/conf.xml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<exist>
3+
4+
<db-connection cacheSize="256M" checkMaxCacheSize="true" collectionCache="64M" database="native"
5+
files="webapp/WEB-INF/data" pageSize="4096" nodesBuffer="1000" cacheShrinkThreshold="10000"
6+
doc-ids="default" minDiskSpace="128M" posix-chown-restricted="true" preserve-on-copy="false">
7+
<startup>
8+
<triggers>
9+
<trigger class="org.exist.security.BouncyCastleJceProviderStartupTrigger"/>
10+
</triggers>
11+
</startup>
12+
<pool max="20" min="1" sync-period="120000" wait-before-shutdown="120000"/>
13+
<query-pool max-stack-size="64" size="128" timeout="120000"/>
14+
<recovery enabled="yes" group-commit="no" journal-dir="webapp/WEB-INF/data"
15+
size="100M" sync-on-commit="no" force-restart="no" consistency-check="yes"/>
16+
<watchdog output-size-limit="1000000" query-timeout="-1"/>
17+
</db-connection>
18+
19+
<repository root="/db/apps"/>
20+
21+
<binary-manager>
22+
<cache class="org.exist.util.io.FileFilterInputStreamCache"/>
23+
</binary-manager>
24+
25+
<indexer caseSensitive="yes" index-depth="5" preserve-whitespace-mixed-content="no"
26+
suppress-whitespace="none">
27+
<modules>
28+
29+
<!--
30+
Needed by the documentation app under test
31+
-->
32+
<module id="lucene-index" buffer="32" class="org.exist.indexing.lucene.LuceneIndex" />
33+
34+
</modules>
35+
<index/>
36+
</indexer>
37+
38+
<scheduler/>
39+
40+
<parser>
41+
<xml>
42+
<features>
43+
<feature name="http://xml.org/sax/features/external-general-entities" value="false"/>
44+
<feature name="http://xml.org/sax/features/external-parameter-entities" value="false"/>
45+
<feature name="http://javax.xml.XMLConstants/feature/secure-processing" value="true"/>
46+
</features>
47+
</xml>
48+
<html-to-xml class="org.cyberneko.html.parsers.SAXParser">
49+
<properties>
50+
<property name="http://cyberneko.org/html/properties/names/elems" value="match"/>
51+
<property name="http://cyberneko.org/html/properties/names/attrs" value="no-change"/>
52+
</properties>
53+
</html-to-xml>
54+
</parser>
55+
56+
<serializer add-exist-id="none" compress-output="no" enable-xinclude="yes"
57+
enable-xsl="no" indent="yes" match-tagging-attributes="no"
58+
match-tagging-elements="no"/>
59+
60+
<transformer class="net.sf.saxon.TransformerFactoryImpl" caching="yes">
61+
<attribute name="http://saxon.sf.net/feature/version-warning" value="false" type="boolean"/>
62+
</transformer>
63+
64+
<validation mode="no">
65+
<entity-resolver>
66+
<catalog uri="${WEBAPP_HOME}/WEB-INF/catalog.xml"/>
67+
</entity-resolver>
68+
</validation>
69+
70+
<xquery enable-java-binding="no" disable-deprecated-functions="no"
71+
enable-query-rewriting="yes" backwardCompatible="no"
72+
enforce-index-use="always"
73+
raise-error-on-failed-retrieval="no">
74+
75+
<builtin-modules>
76+
<!--
77+
Needed by the documentation app under test
78+
-->
79+
<module uri="http://exist-db.org/xquery/lucene" class="org.exist.xquery.modules.lucene.LuceneModule" />
80+
81+
<!-- Needed for XQSuite! -->
82+
<module uri="http://www.w3.org/2005/xpath-functions/map" class="org.exist.xquery.functions.map.MapModule" />
83+
<module uri="http://www.w3.org/2005/xpath-functions/array" class="org.exist.xquery.functions.array.ArrayModule" />
84+
<module uri="http://exist-db.org/xquery/inspection" class="org.exist.xquery.functions.inspect.InspectionModule"/>
85+
<module uri="http://exist-db.org/xquery/response" class="org.exist.xquery.functions.response.ResponseModule" />
86+
<module uri="http://exist-db.org/xquery/system" class="org.exist.xquery.functions.system.SystemModule" />
87+
<module uri="http://exist-db.org/xquery/util" class="org.exist.xquery.functions.util.UtilModule">
88+
<parameter name="evalDisabled" value="false"/>
89+
</module>
90+
<module uri="http://exist-db.org/xquery/xmldb" class="org.exist.xquery.functions.xmldb.XMLDBModule"/>
91+
92+
</builtin-modules>
93+
</xquery>
94+
95+
<xupdate allowed-fragmentation="50000" enable-consistency-checks="no"/>
96+
97+
</exist>

src/main/xar-resources/modules/test-suite.xql renamed to src/test/xquery/documentation/test-suite.xql

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ xquery version "3.1";
88

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

11-
import module namespace docbook = "http://docbook.org/ns/docbook" at "docbook.xql";
12-
import module namespace config = "http://exist-db.org/xquery/apps/config" at "config.xqm";
13-
import module namespace diag = "http://exist-db.org/xquery/diagnostics" at "diagnostics.xql";
11+
import module namespace docbook = "http://docbook.org/ns/docbook"
12+
at "resource:modules/docbook.xql";
13+
import module namespace config = "http://exist-db.org/xquery/apps/config"
14+
at "resource:modules/config.xql";
15+
import module namespace diag = "http://exist-db.org/xquery/diagnostics"
16+
at "resource:modules/diagnostics.xql";
1417

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

0 commit comments

Comments
 (0)