allthingssecurity opened a new pull request, #30995: URL: https://github.com/apache/camel/pull/30995
# Description [CAMEL-27601](https://issues.apache.org/jira/browse/CAMEL-27601) The ticket lists seven problems of camel-cassandraql that came up while the option descriptions were written for CAMEL-23832 (#30937). I checked each one against main. Six are fixed here, one is left as it is. Fixed: 1. **clusterName does nothing.** It is stored but not read: `createSessionBuilder()` does not pass it on, and the session builder of the Cassandra Java Driver 4.x has no cluster name setting. Up to Camel 3.4 the component used driver 3.x and passed it to `Cluster.Builder.withClusterName()`; it has had no effect since the move to driver 4.x in Camel 3.5. The option is deprecated with a note that says so. It is not removed, so URIs and code that set it keep working. 2. **`resultSetConversionStrategy=limit_10` failed.** `CassandraComponent.createEndpoint()` matched `ALL` and `ONE` ignoring case but `LIMIT_` with `startsWith`, so a lower-case `limit_10` went on to the property binding, which has no type converter for `ResultSetConversionStrategy`. The prefix is now matched ignoring case, as `ResultSetConversionStrategies.fromName()` already does. 3. **An unknown name in extraTypeCodecs was ignored.** A typo such as `BLOB_TO_ARAY` registered no codec and logged nothing. `createSessionBuilder()` now throws an `IllegalArgumentException` that lists the possible names, so the endpoint fails to start. The names are still converted with the type converter as before, so every name that worked before still works, and empty names (after a trailing comma) are still skipped. 4. **consistencyLevel had no `@UriParam`.** `prepareStatement()` sets it on every prepared statement, and `?consistencyLevel=ANY` worked only through the reflection fallback of the property binding. It is now an advanced endpoint option (an enum of the driver's `DefaultConsistencyLevel`), so it is in the configurer, the component JSON, the doc page and the Endpoint DSL. The description says which statements it applies to: the prepared ones (the `cql` option and a CQL String in the header), not simple statements or a `SimpleStatement` in the header. I kept the `ConsistencyLevel` return type of the getter: changing it would break compiled code that calls it, and the generated configurer does not need it. 6. **CamelCqlQuery had javaType String.** The producer also takes a `SimpleStatement`, so the javaType is now `Object` and the description names both types. 7. **resultSetConversionStrategy had no defaultValue.** It is now `ALL`, the value of the field. Not changed: 5. **CamelCqlResumeAction is listed as a consumer header.** It is indeed the name of a `ResumeAction` bean, not a header. Removing its `@Metadata` would also remove the generated `cqlResumeAction()` method of the Endpoint DSL header name builder, which user code may call. #30937 already describes it as "Not a message header" and gives the bean meaning, so I left the metadata in place. Upgrade guide (4.24): an unknown name in `extraTypeCodecs` now fails the start of the endpoint, and `clusterName` is deprecated (no effect since Camel 3.5). The entry sits next to the other camel-cassandraql entries of 4.24. Overlap with #30937: both change the `@UriParam` of `clusterName` and `resultSetConversionStrategy`, the `@Metadata` of `CamelCqlQuery`, and the generated files, so whichever is merged second needs a small rebase. The new description of `extraTypeCodecs` in #30937 ends with "An unknown name is ignored."; with this change an unknown name fails the start of the endpoint. Its description of `CamelCqlQuery` (a String or a SimpleStatement) fits the new javaType `Object`. Tests (new, unit test, no Cassandra server: the endpoints are created but not started): - `CassandraEndpointOptionsTest`: `limit_10` gives a strategy that returns 10 of 20 rows; an unknown codec name fails `createSessionBuilder()` with the name and the list of possible names in the message; known names with a trailing comma pass (control); the generated configurer sets `consistencyLevel`; the component JSON has the `consistencyLevel` enum, the `ALL` default, `clusterName` deprecated and the `Object` javaType of `CamelCqlQuery`. Against the main sources 4 of the 5 fail (the endpoint for `limit_10` cannot be created, no exception for the typo, the configurer does not know `consistencyLevel`, the metadata is missing); the control passes. Results (offline, module build of camel-cassandraql, test phase, integration tests skipped as they need Docker): 20 tests run, 0 failures, 0 errors. The new test class passes 5 runs in a row. Generated files: `cql.json` of the component and its catalog copy, `CassandraEndpointConfigurer`, `CassandraEndpointUriFactory`, and `CassandraEndpointBuilderFactory` of the endpoint DSL (new `consistencyLevel` methods, the deprecation of `clusterName`, the `Default: ALL` lines and the header javadoc). # Target - [x] I checked that the commit is targeting the correct branch (Camel 4 uses the `main` branch) # Tracking - [x] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it): [CAMEL-27601](https://issues.apache.org/jira/browse/CAMEL-27601). # Apache Camel coding standards and style - [x] I checked that each commit in the pull request has a meaningful subject line and body. - [ ] I have run `mvn clean install -DskipTests` locally from root folder and I have committed all auto-generated changes. (I built camel-cassandraql and ran its unit tests, and committed the regenerated component files. The catalog copy and the endpoint DSL were updated to match, as an offline build of those modules was not possible here; the endpoint DSL file was generated by the camel-package-maven-plugin goal from the updated catalog JSON. I did not run the full root build.) # AI-assisted contributions - [x] If this PR includes AI-generated code, commits have proper co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR description identifies the AI tool used. This PR was prepared with Claude Code (Claude Opus 5.5). The commit carries a `Co-Authored-By` trailer. _Claude Code on behalf of allthingssecurity_ 🤖 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]
