davsclaus opened a new pull request, #26525: URL: https://github.com/apache/camel/pull/26525
Resolves [CAMEL-24774](https://issues.apache.org/jira/browse/CAMEL-24774). The census behind CAMEL-24773 (#26512) ran three checks the existing guards (`EipDocExamplesTest`, `CatalogDocExamplesTest`, CAMEL-24693/24710) cannot make, and each found real mistakes on its first run. This PR turns them into build-time tests, in the same shape as the existing ones, and corrects what they found. ## The guards **`DocExamplesXmlSchemaTest`** (camel-catalog) — every `[source,xml]` block of the catalog pages, and of the user manual when the tests run inside the source tree, validated against the schemas bundled in the catalog: - a `<camelContext>` whole against `camel-spring.xsd`, as Spring XML validates it (so the element order inside is checked, it is a real constraint there) - an xml-io root (`<camel>`, `<routes>`, `<rests>`…) against `camel-xml-io.xsd` - any other Camel element on its own (`<route>`, `<onException>`, `<marshal>`…) as the global element it is in `camel-spring.xsd` — every fragment root is one — so a fragment is judged without a wrapper imposing an order the page never meant - a block is judged only when it contains an unprefixed Camel element (`<route`, `<from`, `<marshal`, `<xpath`…): XML-Signature payloads, XSLT, StAX records and MyBatis mappers share element names with the schema and are left alone; so are top-level Spring `<bean>`s, `...` placeholder lines, AsciiDoc callouts and undeclared prefixes (`camel:`, `prop:`) of partial snippets - a skip list by page and marker text, as `EipDocExamplesTest` has, for the four examples the schemas cannot judge: two elided snippets, the endpoint page's unescaped `&` that is there to show the error, and the `<namespace>` child of `<xtokenize>` on two pages — the model and the xml-io parser support it, but no generated schema can express it next to the expression text (JAXB `@XmlValue`), so Spring XML declares namespaces as `xmlns:` attributes instead **`DocExamplesJavaImportsTest`** (camel-catalog) — every `import org.apache.camel…` line of a Java example, in the catalog pages and the user manual, resolved against `src/main/java` and `src/generated/java` of the source tree (nested classes, static members and wildcards handled). 2 seconds for the whole tree. **`UserManualDocExamplesTest`** (camel-yaml-dsl-validator) — the YAML route examples of the user manual through the YAML validator, as `EipDocExamplesTest` does for the catalog pages. A block is a route example when its first entry is a root of the YAML DSL schema (`- route:`, `- beans:`, `- rest:`…, read from the schema), so a step written on its own or the YAML of another tool is not judged. The user-manual checks read the pages from the source tree and are skipped (JUnit assumption) outside it; the upgrade and migration guides are left out, they show the syntax of older releases on purpose. Each guard has a `theCheckSeesWhatItIsFor` test with crafted good and bad examples, so a guard that silently judges nothing fails too. ## What the first run found (fixed here, catalog mirror regenerated) - **cometd** — `<camel:trustManagers>` closed by `</camel:keyManagers>`, and five unescaped `&` in a `<to uri>` - **netty** — unescaped `&` in a `<to uri>`; **seda** — a second `<from>seda:…</from>` with text content (#26512 fixed the other one) - **process-eip** — `<routes>` inside `<camelContext>`; **split-eip** — a Spring `<bean>` inside `<camelContext>`; **scatter-gather** — a block of Spring beans labelled `<camelContext>` - **resequence-eip** ×2 — `<batchConfig>`/`<streamConfig>` after the expression; the schema has the config element first - **unmarshal-eip**, **routes** (manual) — `<jaxb/>` without the required `contextPath` (the YAML tab of the routes page has it) - **xpath-language** — `<xpath headerName="…">` and `xpath(text, "header")`: `headerName` is gone since 4.0, the 4.x form is `source="header:…"` and the fluent builder, as the jsonpath page documents it - **univocityCsv / univocityFixed / univocityTsv** — all 15 XML examples use the Camel 2 element names `<univocity-csv>`, `<univocity-fixed>`, `<univocity-tsv>`, `<univocity-header>`; the elements are `univocityCsv`, `univocityFixed`, `univocityTsv`, `univocityHeader` since Camel 3 Counts on this branch: about 1,800 catalog and 273 user-manual XML examples validate, 143 imports resolve, and the 207 user-manual YAML route examples pass. camel-catalog (1061 tests) and camel-yaml-dsl-validator (107) suites pass. _Claude Code on behalf of @davsclaus_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
