You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "allthingssecurity (via GitHub)" <gi...@apache.org> on 2026/10/09 00:04:33 UTC
[PR] CAMEL-25361: camel-couchbase - use the view value as the body and document the fullDocument default [camel]
allthingssecurity opened a new pull request, #27588:
URL: https://github.com/apache/camel/pull/27588
# Description
[CAMEL-25361](https://issues.apache.org/jira/browse/CAMEL-25361)
Follow-up to #27347 (CAMEL-25221), with two small defects found while preparing it.
- **View body.** With `useView=true&fullDocument=false` the body was `row.valueAs(Object.class)`, which the Couchbase SDK 3 returns as an `Optional`, so routes received `Optional[value]` (or `Optional.empty` when the view emitted `null`). The body is now the value, or `null` when the view emitted none. The SQL++ path is not affected (it uses the row as a JSON string). The code dates from CAMEL-15792 (3.7), so 4.14.x and 4.18.x have it too; as it changes what routes receive, the upgrade guide mentions it (a new `==== useView=true with fullDocument=false` subsection of the existing `=== camel-couchbase` section).
- **`fullDocument` default.** The field defaults to `true`, but `@UriParam` said `defaultValue = "false"`, so the component JSON, catalog and endpoint DSL documented the wrong default. `true` is the intended default: it keeps the behaviour from before the option existed (the consumer always fetched the document), and the SQL++ section of the component page already says so. Only the annotation changes; the generated files are regenerated. No runtime change.
- **Upgrade note asked for by @davsclaus in the review of #27347**, under the existing `==== consumerProcessedStrategy=delete`: a view or SQL++ query that returns several rows for one document now delivers only the first of these rows with `delete`. I checked that against the code: the first row marks the document in progress, the later rows are skipped, and the completed exchange removes the document. In 4.22 the next row of the already removed document failed the whole poll.
Not included: the other suggestion from that review, clearing the in-flight set in `doStop`/`doStart`. I said in #27347 that I would add it, but `stopRoute`/`startRoute` does not reuse the consumer: `RouteService` sets the route up again and `DefaultRoute.initializeServices` calls `endpoint.createConsumer`, so the set starts empty after a route restart. The set survives only a stop and start of the same consumer instance (for example a route policy that stops and starts the consumer). There, clearing it would let the next poll read again a document whose exchange is still being processed, so I left it as is; happy to clear it in `doStart` if you prefer bounding the set over that duplicate.
Tests: new `CouchbaseConsumerBodyTest` (mocked cluster). `theValueEmittedByTheViewIsTheBodyWithoutFullDocument` and `theBodyIsNullWhenTheViewEmitsNoValue` fail without the change (two runs; `expected: <[{name=Alice}, Bob]> but was: <[Optional[{name=Alice}], Optional[Bob]]>`). Module: 59 tests, 0 failures (the Docker ITs are skipped).
# 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).
# 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 and tested the affected module, including the formatter and import-sort plugins, and regenerated the catalog and endpoint DSL files for camel-couchbase. 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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25361: camel-couchbase - use the view value as the body and document the fullDocument default [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on code in PR #27588:
URL: https://github.com/apache/camel/pull/27588#discussion_r4227331284
##########
components/camel-couchbase/src/test/java/org/apache/camel/component/couchbase/CouchbaseConsumerBodyTest.java:
##########
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.couchbase;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+import com.couchbase.client.java.Bucket;
+import com.couchbase.client.java.Cluster;
+import com.couchbase.client.java.ClusterOptions;
+import com.couchbase.client.java.Collection;
+import com.couchbase.client.java.Scope;
+import com.couchbase.client.java.view.ViewOptions;
+import com.couchbase.client.java.view.ViewResult;
+import com.couchbase.client.java.view.ViewRow;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.mockito.MockedStatic;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.mockStatic;
+import static org.mockito.Mockito.when;
+
+/**
+ * The message body the consumer creates for a row, with and without {@code fullDocument}.
+ * <p/>
+ * The scheduler of the consumer is not started; the test calls {@code poll()} itself against a mocked cluster.
+ */
+class CouchbaseConsumerBodyTest {
Review Comment:
CAMEL-25361 mentions two control tests (`theQueryRowIsTheBodyWithoutFullDocument`, `theFullDocumentIsTheBodyByDefault`) that are not in this PR. The second one would pin the `fullDocument=true` default that this PR now documents; worth adding if it's still at hand. Non-blocking.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25361: camel-couchbase - use the view value as the body and document the fullDocument default [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus merged PR #27588:
URL: https://github.com/apache/camel/pull/27588
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25361: camel-couchbase - use the view value as the body and document the fullDocument default [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27588:
URL: https://github.com/apache/camel/pull/27588#issuecomment-6075301828
<!-- ci-tested-modules -->
:test_tube: **CI tested the following changed modules:**
- `catalog/camel-catalog`
- `components/camel-couchbase`
- `docs`
- `dsl/camel-endpointdsl`
:repeat: **1 test passed only after a retry on JDK 17** (1 retried attempt)
<details><summary>Recovered flaky tests on JDK 17 (1)</summary>
| Module | Test | Failed attempts | First failure |
| --- | --- | --- | --- |
| `dsl/camel-endpointdsl` | `FileConsumeCharsetTest.testConsumeAndDelete` | 1 | mock://result Body of message: 0. Expected: <Hello World 你好> but was: <null> |
> :information_source: These tests did **not** fail the build. Surefire retried them and they passed.
> Retries are enabled project-wide by `surefire.rerunFailingTestsCount` in `parent/pom.xml`.
</details>
---
<details><summary>:microscope: Scalpel shadow comparison — Scalpel: 9 of 704 tested, 24 compile-only — current: 9 all tested</summary>
[Maveniverse Scalpel](https://github.com/maveniverse/scalpel) detected **9 affected modules** (current approach: 9).
**Skip-tests mode would test 9 modules** (4 direct + 8 downstream), **skip tests for 24** (generated code, meta-modules)
<details><summary>Modules Scalpel would test (9)</summary>
- `camel-couchbase` ← components/camel-couchbase/src/generated/resources/META-INF/org/apache/camel/component/couchbase/couchbase.json, components/camel-couchbase/src/main/java/org/apache/camel/component/couchbase/CouchbaseConsumer.java, components/camel-couchbase/src/main/java/org/apache/camel/component/couchbase/CouchbaseEndpoint.java, components/camel-couchbase/src/test/java/org/apache/camel/component/couchbase/CouchbaseConsumerBodyTest.java
- `camel-jbang-mcp` ← downstream of org.apache.camel:camel-catalog
- `camel-jbang-plugin-mcp` ← downstream of org.apache.camel:camel-jbang-core
- `camel-jbang-plugin-route-parser` ← downstream of org.apache.camel:camel-route-parser
- `camel-jbang-plugin-tui` ← downstream of org.apache.camel:camel-catalog
- `camel-jbang-plugin-validate` ← downstream of org.apache.camel:camel-yaml-dsl-validator
- `camel-launcher-container` ← downstream of org.apache.camel:camel-launcher
- `camel-yaml-dsl-validator` ← downstream of org.apache.camel:camel-catalog
- `camel-yaml-dsl-validator-maven-plugin` ← downstream of org.apache.camel:camel-yaml-dsl-validator
</details>
<details><summary>Modules with tests skipped (24)</summary>
- `apache-camel`
- `camel-allcomponents`
- `camel-catalog-console`
- `camel-catalog-maven`
- `camel-catalog-suggest`
- `camel-componentdsl`
- `camel-endpointdsl-support`
- `camel-itest`
- `camel-jbang-core`
- `camel-jbang-it`
- `camel-jbang-main`
- `camel-jbang-plugin-edit`
- `camel-jbang-plugin-generate`
- `camel-jbang-plugin-kubernetes`
- `camel-jbang-plugin-test`
- `camel-kamelet-main`
- `camel-launcher`
- `camel-report-maven-plugin`
- `camel-route-parser`
- `camel-yaml-dsl`
- `camel-yaml-dsl-deserializers`
- `camel-yaml-dsl-maven-plugin`
- `coverage`
- `dummy-component`
</details>
> :information_source: Shadow mode — Scalpel observes but does not affect test execution. [Learn more](https://github.com/maveniverse/scalpel)
</details>
:warning: **Some tests are disabled on GitHub Actions** (`@DisabledIfSystemProperty(named = "ci.env.name")`) and require manual verification:
- `components/camel-couchbase`: 6 test(s) disabled on GitHub Actions
<details><summary>All tested modules (36 modules, 6m 30s total)</summary>
**Total reactor time:** 6m 30s
| Module | Duration | Status |
| --- | --- | --- |
| Camel :: Launcher | 51.2s | SUCCESS |
| Camel :: JBang :: Plugin :: TUI | 49.0s | SUCCESS |
| Camel :: JBang :: MCP | 42.1s | SUCCESS |
| Camel :: Catalog :: Camel Catalog | 25.7s | SUCCESS |
| Camel :: YAML DSL :: Validator | 24.0s | SUCCESS |
| Camel :: Component DSL | 23.9s | SUCCESS |
| Camel :: Couchbase | 23.3s | SUCCESS |
| Camel :: YAML DSL | 21.3s | SUCCESS |
| Camel :: JBang :: Plugin :: Validate | 17.2s | SUCCESS |
| Camel :: Docs | 16.8s | SUCCESS |
| Camel :: JBang :: Plugin :: Testing | 13.4s | SUCCESS |
| Camel :: JBang :: Plugin :: Kubernetes | 13.1s | SUCCESS |
| Camel :: Kamelet Main | 11.6s | SUCCESS |
| Camel :: YAML DSL :: Deserializers | 8.8s | SUCCESS |
| Camel :: Catalog :: Camel Route Parser | 8.2s | SUCCESS |
| Camel :: Catalog :: Camel Report Maven Plugin | 7.3s | SUCCESS |
| Camel :: All Components Sync point | 5.4s | SUCCESS |
| Camel :: YAML DSL :: Validator Maven Plugin | 4.9s | SUCCESS |
| Camel :: Catalog :: Maven | 3.3s | SUCCESS |
| Camel :: YAML DSL :: Maven Plugins | 3.3s | SUCCESS |
| Camel :: Catalog :: Suggest (deprecated) | 2.8s | SUCCESS |
| Camel :: Assembly | 1.9s | SUCCESS |
| Camel :: JBang :: Plugin :: Edit | 1.9s | SUCCESS |
| Camel :: Coverage | 1.5s | SUCCESS |
| Camel :: Catalog :: Dummy Component | 1.3s | SUCCESS |
| Camel :: JBang :: Plugin :: MCP | 1.2s | SUCCESS |
| Camel :: JBang :: Main | 1.1s | SUCCESS |
| Camel :: JBang :: Plugin :: Generate | 1.0s | SUCCESS |
| Camel :: JBang :: Integration tests | 0.8s | SUCCESS |
| Camel :: Catalog :: Console | 0.8s | SUCCESS |
| Camel :: Endpoint DSL :: Support | 0.7s | SUCCESS |
| Camel :: Launcher :: Container | 0.7s | SUCCESS |
| Camel :: JBang :: Plugin :: Route Parser | 0.5s | SUCCESS |
| Camel :: Endpoint DSL | n/a | |
| Camel :: Integration Tests | n/a | |
| Camel :: JBang :: Core | n/a | |
**Top 20 slowest modules:**
- `Camel :: Launcher` (51.2s)
- `Camel :: JBang :: Plugin :: TUI` (49.0s)
- `Camel :: JBang :: MCP` (42.1s)
- `Camel :: Catalog :: Camel Catalog` (25.7s)
- `Camel :: YAML DSL :: Validator` (24.0s)
- `Camel :: Component DSL` (23.9s)
- `Camel :: Couchbase` (23.3s)
- `Camel :: YAML DSL` (21.3s)
- `Camel :: JBang :: Plugin :: Validate` (17.2s)
- `Camel :: Docs` (16.8s)
- `Camel :: JBang :: Plugin :: Testing` (13.4s)
- `Camel :: JBang :: Plugin :: Kubernetes` (13.1s)
- `Camel :: Kamelet Main` (11.6s)
- `Camel :: YAML DSL :: Deserializers` (8.8s)
- `Camel :: Catalog :: Camel Route Parser` (8.2s)
- `Camel :: Catalog :: Camel Report Maven Plugin` (7.3s)
- `Camel :: All Components Sync point` (5.4s)
- `Camel :: YAML DSL :: Validator Maven Plugin` (4.9s)
- `Camel :: Catalog :: Maven` (3.3s)
- `Camel :: YAML DSL :: Maven Plugins` (3.3s)
</details>
---
:gear: [View full build and test results](https://github.com/apache/camel/actions/runs/37862877764)
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25361: camel-couchbase - use the view value as the body and document the fullDocument default [camel]
Posted by "allthingssecurity (via GitHub)" <gi...@apache.org>.
allthingssecurity commented on PR #27588:
URL: https://github.com/apache/camel/pull/27588#issuecomment-6077680550
Thanks @oscerd. Addressed in a048d0b:
- **[Suggestion] mocked `ViewRow` stubs `valueAs(Object.class)` only** — done as a comment in the `viewRow(...)` helper. It pins the `valueAs(Class)`/`keyAs(Class)` overloads that `CouchbaseConsumer` calls, and says that a move to `valueAs(TypeRef)` must be stubbed there too, since an unstubbed call returns `null` and fails as an NPE, not as a clear assertion. Test-only change.
- **[Question] not clearing the in-flight set in `doStart`/`doStop`** — no change, as explained in the PR description; that ack is for @davsclaus.
Tests: camel-couchbase `install`, 61 unit tests, 0 failures (ITs skipped without a container).
_Claude Code on behalf of allthingssecurity_
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25361: camel-couchbase - use the view value as the body and document the fullDocument default [camel]
Posted by "allthingssecurity (via GitHub)" <gi...@apache.org>.
allthingssecurity commented on code in PR #27588:
URL: https://github.com/apache/camel/pull/27588#discussion_r4227497367
##########
components/camel-couchbase/src/test/java/org/apache/camel/component/couchbase/CouchbaseConsumerBodyTest.java:
##########
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.couchbase;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+import com.couchbase.client.java.Bucket;
+import com.couchbase.client.java.Cluster;
+import com.couchbase.client.java.ClusterOptions;
+import com.couchbase.client.java.Collection;
+import com.couchbase.client.java.Scope;
+import com.couchbase.client.java.view.ViewOptions;
+import com.couchbase.client.java.view.ViewResult;
+import com.couchbase.client.java.view.ViewRow;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.mockito.MockedStatic;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.mockStatic;
+import static org.mockito.Mockito.when;
+
+/**
+ * The message body the consumer creates for a row, with and without {@code fullDocument}.
+ * <p/>
+ * The scheduler of the consumer is not started; the test calls {@code poll()} itself against a mocked cluster.
+ */
+class CouchbaseConsumerBodyTest {
Review Comment:
Added in ae67a6c2a515, in the same mock-based style: `theQueryRowIsTheBodyWithoutFullDocument` (SQL++ row as a JSON string) and `theFullDocumentIsTheBodyByDefault` (no `fullDocument` option, the body is the `GetResult` fetched by the row's ID, pinning the `true` default). Module: 61 tests, 0 failures.
_Claude Code on behalf of allthingssecurity_
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25361: camel-couchbase - use the view value as the body and document the fullDocument default [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27588:
URL: https://github.com/apache/camel/pull/27588#issuecomment-6074961638
:star2: Thank you for your contribution to the Apache Camel project! :star2:
:robot: CI automation will test this PR automatically.
:camel: Apache Camel Committers, please review the following items:
* First-time contributors **require MANUAL approval** for the GitHub Actions to run
* You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot although they are normally detected and executed by CI.
* You can label PRs using `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
* Build and test logs are available in the summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary.
:warning: Be careful when sharing logs. Review their contents before sharing them publicly.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org