davsclaus opened a new pull request, #27130: URL: https://github.com/apache/camel/pull/27130
_Claude Code on behalf of davsclaus_ [CAMEL-25182](https://issues.apache.org/jira/browse/CAMEL-25182) The YAML and XML route examples of the documentation are validated in the build. Until now the Java examples were only import-checked. This PR checks the Java DSL calls too, using the Java DSL parser of CAMEL-25148 (`LwJavaParser`). It replays each chain against Camel's DSL without compiling the snippet. ### The check `CatalogDocJavaExamplesTest` (camel-jbang-core, next to `CatalogDocExamplesTest`) reads the Java route examples of the catalog pages and the user manual; upgrade and migration guides are left out. It fails when an example calls a DSL method that does not exist, or with arguments the method does not take. Lambdas, variables, helper methods and objects of the project are fine, because the parser reports them as values it cannot see. Blocks titled "pseudo", "incorrect", "will not compile" or "before migration" are skipped, since they are wrong on purpose. It covers more than 2,000 examples. ### Documentation fixes - `setBody("x")` → `setBody(constant("x"))` (jdbc, aws2-translate, hwcloud obs/dms/iam) - `.thread(5)` → `.threads(5)` (seda, disruptor) - `filter("${...}")` → `filter(simple(...))` (aws2-sqs); `.header(...)` → `.setHeader(...)` (google-bigquery) - `setHeader("...$top", "5")` → `constant("5")` (olingo2/4) - `onException(ValidationException)` → `.class`; `.onRedeliver(` → `.onRedelivery(`; `body(String.class)` → `bodyAs(...)` - Missing parentheses: dead-letter-channel, intercept, aws2-ses, route-template, xmlSecurity - `resumable(strategy).intermittent(true)` → `resumable().resumeStrategy(strategy).intermittent(true)` - `rest().openApi("spec").missingOperation(...)` → `rest().openApi().specification("spec").missingOperation(...)` - jq: reading from a header uses the `source` option (`header:books`); the removed `jq(expr, type, headerName)` is gone from the page - keycloak-security: the policy wraps the steps after it, so the `doTry` example closes with `endDoTry()` before `doCatch` - xmlSecurity: the namespace example has a `passPhrase` in all three DSLs. There is no default key, so it failed at runtime before. - exception-advanced: the "Using Custom ExceptionPolicyStrategy" section is removed. `exceptionPolicyStrategy` left the DSL in Camel 3.7 (CAMEL-15802). - exception-redelivery: the "point of entry" example is a real route with an `onException` ### Java DSL `DataFormatClause` gets `univocityCsv()`, `univocityFixed()`, `univocityTsv()` and `yaml()`. The pages of these data formats always showed `.marshal().univocityCsv()` and `.marshal().yaml()`, but only the `dataFormat()` builder factory had them. New tests in camel-univocity-parsers and camel-snakeyaml. ### Parser (camel-java-io) - Char literals are chars (`xtokenize(path, 'i', ns)`). - `Map.of`, `List.of`, `Set.of`, `Arrays.asList` and `Collections.singletonList` are read as values; only JDK collections of values already worked out are created. - JDK constants in snippets without imports (`Deflater.BEST_COMPRESSION`, `TimeUnit.SECONDS`); `name()`/`toString()` of enum constants; `TimeUnit` conversions. - For an object of a class the parser cannot create (`Namespaces ns`), null stands in and is reported. When the DSL then fails on a stand-in, the parser reports "needs a value the parser cannot see" instead of "the DSL refused it". - `configure` and `configuration` are denied as the builder's life cycle only on the route builder. Model methods of that name are no longer blocked, such as `circuitBreaker().configuration("myConfig")` and `resumable().configuration(...)`. The pinned builder surface (`replay-builder-methods.txt`) does not change. ### Endpoint DSL resolver (camel-jbang-core) A call is taken as an endpoint only when the scheme is a known component and its arguments are paths. Before, `and(user, admin)` became an `and://` endpoint, and `split(stax(Record.class))` a stax endpoint. ### Tests - camel-java-io: 170 tests - `CatalogDocJavaExamplesTest` and `CatalogDocExamplesTest` (camel-jbang-core) - `DocExamplesXmlSchemaTest` and `DocExamplesJavaImportsTest` (camel-catalog) - `UniVocityDataFormatClauseTest` and `SnakeYAMLDataFormatClauseTest` 🤖 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]
