Skip to content

Generate test conf.xml/controller-config.xml fixtures from canonical at build time - #6531

Merged
line-o merged 10 commits into
eXist-db:developfrom
duncdrum:dp-fixture-codegen
Aug 17, 2026
Merged

Generate test conf.xml/controller-config.xml fixtures from canonical at build time#6531
line-o merged 10 commits into
eXist-db:developfrom
duncdrum:dp-fixture-codegen

Conversation

@duncdrum

@duncdrum duncdrum commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Replaces ~35 hand-maintained conf.xml/controller-config.xml test fixture copies with XSLT codegen from the canonical exist-distribution sources at generate-test-resources time, so fixtures can't drift from canonical.

  • Codegen pipeline: two shared base stylesheets (schema/generate-conf-fixture.xsl, schema/generate-controller-config-fixture.xsl) + a per-module override stylesheet + an xml-maven-plugin execution
  • URN-stable imports: schema/catalog.xml maps stable URNs for both base stylesheets, so all fixture XSLs import via urn:exist-db:codegen:... instead of fragile depth-relative paths
  • Parent profile: conf-fixture-codegen in exist-parent/pom.xml auto-activates per module, removing boilerplate from 19 module pom.xml files

What changed

Area Files
Base stylesheets + catalog schema/generate-conf-fixture.xsl, schema/generate-controller-config-fixture.xsl, schema/catalog.xml
Per-fixture XSLs 35× conf-fixture.xsl (new), 7× controller-config-fixture.xsl (new), replacing the equivalent static conf.xml/controller-config.xml copies
Parent profile + module poms exist-parent/pom.xml, ~25 module pom.xml simplifications
Docs schema/README.md — new "Adding a new native schema" and "Test fixture codegen" sections
License header fix extensions/exquery/restxq/pom.xmlconf-fixture.xsl/controller-config-fixture.xsl are new eXist-authored tooling, not modifications of the module's original BSD-3 files, so they get the default LGPL-21 header instead of inheriting the module's BSD-3 default

Dependency

Stacked on #6530 (open) — Transform.java there introduces a setResourceResolver lambda that this PR edits a comment inside; cherry-picking this branch alone fails. #6528 is merged.

Test plan

  • Full exist-core suite: 7046/7046, 0 failures
  • SchemaVersionFixtureAuditTest — all generated fixtures carry correct schemaVersion
  • license:check across all 25 affected modules
  • CI green (Test & documentation + XQTS)

Notes

PR-D of a 5-PR split from #6505 (superseded — needs closing separately, "Closes" keyword doesn't apply across PRs). Diff is large by file count (~120 files) but mechanical: fixture deletions/additions and pom simplifications — reviewable structurally rather than line-by-line. Merge order: #6528 (merged) → #6530 → this PR → #6550#6551.

🤖 Generated with Claude Code

Comment thread exist-core/src/main/java/org/exist/collections/MutableCollection.java Outdated
Comment thread exist-core/src/main/java/org/exist/jetty/JettyStart.java Outdated
Comment thread exist-core/src/test/java/org/exist/util/SchemaVersionSyncTest.java Outdated
@duncdrum
duncdrum force-pushed the dp-fixture-codegen branch from ecf2cc5 to b899894 Compare July 13, 2026 13:18
duncdrum and others added 3 commits July 13, 2026 16:24
…generate SchemaVersion constants

Extend the Maven validate phase to check every schema/*.xsd against the
W3C XSD 1.1 meta-schema (upgrading the bundled XMLSchema.xsd/dtd to the
2009 XSD 1.1 revision); caught and removed five xsi:type="dcterms:W3CDTF"
appinfo annotations with no backing schema, bumping the affected schema
@Version values. Wire a generate-sources execution that reads each
governed XSD's xs:schema/@Version and emits SchemaVersion.java constants
so they can never drift from the schemas.

Closes eXist-db#5541
…line

Wire the XML Catalog API into Saxon's XsltCompiler so xsl:import,
xsl:include, and document() URIs resolve via the eXist-db entity catalog
(Closes eXist-db#350). Generalize MutableCollection's at-store-time validation to
route through a JAXP 1.1 SchemaFactory when the schema or its catalog-
resolved meta-schema requires XSD 1.1; extract the detection logic into
Xsd11SchemaDetection so validation:jaxp() and org.exist.validation.Validator
share the same probe-compile path. Suppress the spurious xmlresolver WARNING
for the non-existent "default" catalog entry.

Closes eXist-db#5541
… XML_SCHEMA_NS

XML_SCHEMA_NS was never read — callers already used XMLConstants directly.
XSD_1_1_NS is promoted to Namespaces.XSD_1_1_NS so it is available
codebase-wide without duplication.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@duncdrum
duncdrum force-pushed the dp-fixture-codegen branch from b899894 to a9c9428 Compare July 13, 2026 14:25
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@duncdrum
duncdrum force-pushed the dp-fixture-codegen branch from a9c9428 to b38ca7a Compare July 13, 2026 15:07
@dizzzz
dizzzz requested review from a team, dizzzz and line-o July 20, 2026 07:25
…f MutableCollection

MutableCollection carried a schema cache (plain ConcurrentHashMap) plus the
namespace-resolution/validation logic that uses it -- neither is Collection
state. Splits this into two package-private classes:

- Xsd11SchemaCache: the per-namespace "needs XSD 1.1?" cache, now backed by
  Caffeine for consistency with the codebase's other caches (no eviction
  policy, since the namespace set is finite and admin-controlled -- this was
  never a correctness concern, just a style/testability one).
- Xsd11ValidationHelper: resolveXsd11SchemaForNamespace, the dynamic-discovery
  schema holder, parseOrValidateXmlSource, validateWithXsd11Schema, and the
  Xsd11LexicalHandlerForwarder record -- store-time XSD 1.1 validation, not
  Collection bookkeeping.

MutableCollection keeps only its public clearXsd11SchemaByNamespaceCache()
facade (GrammarTooling.java's external call site) and a single delegating
call from storeXmlDocument(); 9 imports that only the moved code needed are
dropped. Behavior-preserving: all 63 tests across the validation/XSD11 suite
pass unchanged.

Addresses dizzzz's review comments on eXist-db#6530/eXist-db#6551.
@duncdrum
duncdrum force-pushed the dp-fixture-codegen branch from b38ca7a to 9602881 Compare July 26, 2026 15:01
duncdrum added 4 commits July 26, 2026 17:17
…reated edit

4e949b4 dropped xsi:type="dcterms:W3CDTF" from the dcterms:created
annotation in 5 sibling schema files and correctly bumped @Version on 4 of
them (collection.xconf.xsd, cxan.xsd, exist.xsd, repo.xsd) -- this one was
missed, leaving expath-pkg.xsd's content changed but @Version still 1.1.0.
CI's schema governance check (ci-schema-checks.yml, added in PR-A) catches
exactly this. Bumps to 1.1.1, a documentation/non-semantic patch per
schema/README.md's policy, matching the sibling files' bumps.

Verified locally against the real merge-base with upstream/develop:
mvn -N xml:transform@schema-governance passes, SchemaVersionSyncTest passes
unaffected (expath-pkg.xsd isn't one of the 5 SchemaVersion.java-tracked
schemas).
…nical at build time

Add a Maven exec plugin execution that transforms the canonical
exist-distribution conf.xml through module-specific XSLT strip-sheets,
writing per-module fixture conf.xml and controller-config.xml files into
src/test/resources-filtered at process-test-resources time. Eliminates
~35 hand-maintained fixture copies that drift from canonical on every
schema edit.
…o URN imports

Register the repo-root schema/catalog.xml in the Maven xml-maven-plugin
catalog chain so XSD-against-XSD validation resolves locally without
network access. Migrate all 35 XSLT strip-sheets from bare http:// imports
to URN-mapped imports via the catalog. Document the new-native-schema
checklist and fix the profile location note in the README.
… stylesheets

conf-fixture.xsl and controller-config-fixture.xsl are new eXist-db-authored
XSLT codegen tooling, not modifications of Adam Retter's original BSD-3
conf.xml/controller-config.xml. They fell outside the module's existing
conf.xml/log4j2.xml excludes and so wrongly inherited the module-wide BSD-3
header. Excludes them from the BSD-3 licenseSet and adds a second licenseSet
applying eXist-db's default LGPL-21 header to just these two files instead.

Addresses review discussion between dizzzz, adamretter, and reinhapa on eXist-db#6551.
@duncdrum
duncdrum force-pushed the dp-fixture-codegen branch from 9602881 to 8f2740e Compare July 26, 2026 15:18

@line-o line-o left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@line-o
line-o merged commit 4f5b345 into eXist-db:develop Aug 17, 2026
15 of 16 checks passed
duncdrum added a commit to duncdrum/exist that referenced this pull request Aug 18, 2026
exist-indexes-jmh generated its conf.xml by transforming
extensions/indexes/indexes-integration-tests/src/test/resources-filtered/conf.xml
via its own src/main/xslt/conf-jmh.xslt. That source file was never a
real static file, only the *input* to indexes-integration-tests' own
Maven-time fixture codegen - and once that module switched to the
canonical-fixture mechanism (PR eXist-db#6531), its resources-filtered
directory holds only a conf-fixture.xsl, no static conf.xml.

Result: xml-maven-plugin's transform matched zero input files
("[WARNING] No files found for transformation"), succeeded anyway
(empty transformation sets aren't a build failure), and produced no
conf.xml at all - the shaded benchmarks jar shipped with none.  Every
benchmark method across all 5 classes failed instantly on setUp():
`DatabaseConfigurationException: Unable to read configuration file at
.../exist-indexes-jmh/etc/conf.xml`. No CI run had exercised this
module's benchmarks since eXist-db#6531 merged (the ci-benchmarks.yml run
that would have hit it was independently cancelled by the 90-minute
job timeout during exist-core-jmh's step first).

Fixed by sourcing directly from canonical
(exist-distribution/src/main/config/conf.xml) via a new
src/main/resources-filtered/conf-fixture.xsl, using the same
schema/generate-conf-fixture.xsl mechanism as ~35 other fixtures in
the repo (and the one exist-core-jmh now also uses), instead of
depending on another module's private fixture input a second time.
Removes the now-obsolete conf-jmh.xslt.

Verified all 5 benchmark classes (Ngram/RangeEq/RangeFieldEq/Lucene/
GeneralComparisonWhereClauseBenchmark) run clean via `mvn exec:exec`.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@duncdrum
duncdrum deleted the dp-fixture-codegen branch August 19, 2026 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants