Skip to content

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

Open
duncdrum wants to merge 9 commits into
eXist-db:developfrom
duncdrum:dp-fixture-codegen
Open

Generate test conf.xml/controller-config.xml fixtures from canonical at build time#6531
duncdrum wants to merge 9 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 and controller-config.xml test fixture copies with XSLT codegen from the canonical exist-distribution sources at generate-test-resources time. The generated fixtures stay in sync with the canonical automatically; no more manual updates when conf.xml changes.

  • Normalizes existing fixture copies: strips stale attributes, aligns schemaVersion, standardises whitespace/comments — one-time cleanup before switching to codegen
  • Codegen pipeline: two shared base stylesheets (schema/generate-conf-fixture.xsl, schema/generate-controller-config-fixture.xsl) + per-fixture conf-fixture.xsl/controller-config-fixture.xsl override + xml-maven-plugin execution in generate-test-resources phase. Per-fixture stylesheets redeclare xsl:param defaults covering keep-modules, keep-indexes, data-path, catalog-uri, and more
  • URN-stable imports: schema/catalog.xml maps stable URNs for both base stylesheets; all 35 fixture XSLs use xsl:import href="urn:exist-db:codegen:generate-conf-fixture" instead of fragile depth-relative hrefs — works identically in Maven build and IDE tooling
  • Parent profile: conf-fixture-codegen profile in exist-parent/pom.xml auto-activates for any module with src/test/resources-filtered/conf-fixture.xsl, removing boilerplate xml-maven-plugin config from 19 modules

What changed

Area Files
Base stylesheets schema/generate-conf-fixture.xsl, schema/generate-controller-config-fixture.xsl
OASIS catalog schema/catalog.xml
Per-fixture XSLs 35× conf-fixture.xsl (new), 7× controller-config-fixture.xsl (new)
Removed fixtures ~35× conf.xml, 7× controller-config.xml (generated at build time now)
Parent profile exist-parent/pom.xml
Module poms ~25 module pom.xml files (simplifications)
Docs schema/README.md (new "Adding a new native schema" and "Test fixture codegen" sections), AGENTS.md
Bug fix XMLReaderExpansionTest ineffective runtime feature override

Dependency

Requires #6528 and #6530 merged first. Transform.java in #6530 introduces a setResourceResolver lambda that this PR edits a comment inside — cherry-picking this branch onto develop without #6530 fails.

Test plan

  • Full exist-core suite: 7046/7046, 0 failures, 0 errors
  • SchemaVersionFixtureAuditTest — all generated fixtures carry correct schemaVersion
  • expathrepo tests — skip.conf.fixture.profile override works correctly
  • CI green across all modules (Test & documentation + XQTS)

Notes

This is PR-D of a 5-PR split from #6505. Merge order: #6528#6530 → this PR → #6550#6551. The diff is large by file count (~120 files) but highly mechanical: 35 conf.xml deletions, 35 conf-fixture.xsl additions, and pom.xml simplifications. Reviewers can validate structurally rather than line-by-line.

Closes #6505 (superseded by this 5-PR split).

🤖 Generated with Claude Code

…antic changes

Add a mvn validate execution (xml:transform@schema-governance) that catches
semantic edits to the seven native XSD schemas without a matching @Version
bump; bump all seven XSDs to reflect post-2023 semantic changes.

Closes eXist-db#6190
@duncdrum duncdrum force-pushed the dp-fixture-codegen branch from d836374 to e063e63 Compare July 7, 2026 13:10
duncdrum added 3 commits July 7, 2026 15:32
…consolidate governance CI

Add schemaVersion="x.y.z" to all five canonical config instances so
administrators can see at a glance which XSD version a config file targets,
and so startup code can log a DEBUG or WARN when it doesn't match.
Consolidate the four separate governance shell scripts into a single
governance.xsl, making the version-bump check fully Maven-native. Add
SchemaVersionSyncTest to guard the generated constants against drift.
Include schema/ (conf.xsd, collection.xconf.xsd, descriptor.xsd,
controller-config.xsd, mime-types.xsd, users.xsd, server.xsd,
security-manager.xsd, expath-pkg.xsd and its extensions) in the
tarball, zip, Docker image, IzPack installer, and macOS .app bundle
as $EXIST_HOME/schema/. Also fix the "abrev" -> "abbrev" typo
in expath-pkg.xsd.

Closes eXist-db#6189
Partially addresses eXist-db#6008
…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
@duncdrum duncdrum force-pushed the dp-fixture-codegen branch from e063e63 to 3cd74e0 Compare July 7, 2026 13:33
duncdrum added 5 commits July 7, 2026 15:57
…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
Set a Jetty stop timeout so shutdown does not block indefinitely on
active connections; move ShutdownListenerImpl.shutdown() to a daemon
thread so it does not deadlock the Jetty shutdown-hook thread that
also holds the BrokerPool write lock.
…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.
@duncdrum duncdrum force-pushed the dp-fixture-codegen branch from 3cd74e0 to ecf2cc5 Compare July 7, 2026 13:57
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.

1 participant