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/10 00:05:38 UTC

[PR] CAMEL-25509: camel-ldif - Apply newsuperior of modrdn, and keep the parent of moddn without it [camel]

allthingssecurity opened a new pull request, #27642:
URL: https://github.com/apache/camel/pull/27642

   # Description
   
   [CAMEL-25509](https://issues.apache.org/jira/browse/CAMEL-25509)
   
   RFC 2849 defines `changetype: modrdn` and `changetype: moddn` as the same change: the entry gets the new RDN, and moves under `newsuperior` only when it is given. `LdifProducer` handled them as two operations:
   
   - `modrdn` with `newsuperior` was a rename in place: the entry was not moved, and the result was still `success`;
   - `moddn` without `newsuperior` became `moveAndRename(dn, new Dn(newRdn, null))`, a move to the one-RDN DN `newRdn` directly under the root, which the server rejects.
   
   Both change types now move the entry with `moveAndRename` when `newsuperior` is given and rename it in place with `rename` otherwise. The requests for `moddn` with `newsuperior` and `modrdn` without it (the cases in `LdifRouteIT`) are unchanged. A short 4.23 upgrade guide note describes the two changed cases.
   
   Tests:
   - New `LdifModDnTest` with a stub `LdapConnection` (a `java.lang.reflect.Proxy` that records the resulting DN), so no LDAP server is needed: the four combinations of change type and `newsuperior`.
   - Without the change: two fail, e.g. `expected: <uid=b,ou=new,dc=example,dc=org deleteOldRdn=true> but was: <uid=b,ou=old,dc=example,dc=org deleteOldRdn=true>`.
   - With the change: camel-ldif unit tests 5, 0 failures. `LdifRouteIT` needs the OpenLDAP container and was not run.
   
   Found with a Lean 4 model of the dispatch (DNs as lists of RDNs): "the new DN is newrdn under newsuperior if given, else under the current parent" fails for both records, and the fix is proved correct for every record and to send the same request as before in the two cases that worked. I then reproduced it with the producer and the LDAP API.
   
   # 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 camel-ldif, including the formatter and import-sort plugins. 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-25509: camel-ldif - Apply newsuperior of modrdn, and keep the parent of moddn without it [camel]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on code in PR #27642:
URL: https://github.com/apache/camel/pull/27642#discussion_r4236604452


##########
components/camel-ldif/src/test/java/org/apache/camel/component/ldif/LdifModDnTest.java:
##########
@@ -0,0 +1,111 @@
+/*
+ * 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.ldif;
+
+import java.lang.reflect.Proxy;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit6.CamelTestSupport;
+import org.apache.directory.api.ldap.model.name.Dn;
+import org.apache.directory.api.ldap.model.name.Rdn;
+import org.apache.directory.ldap.client.api.LdapConnection;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * RFC 2849: "modrdn" and "moddn" are the same change type. The entry gets the new RDN, and moves under the new superior
+ * only when "newsuperior" is given. The connection is a stub that records the resulting DN, so this test needs no LDAP
+ * server.
+ */
+class LdifModDnTest extends CamelTestSupport {
+
+    private final List<String> renames = new ArrayList<>();
+
+    @BindToRegistry("conn")
+    private final LdapConnection conn = (LdapConnection) Proxy.newProxyInstance(
+            LdapConnection.class.getClassLoader(), new Class<?>[] { LdapConnection.class },
+            (proxy, method, args) -> {
+                switch (method.getName()) {
+                    case "rename" -> {
+                        Dn dn = (Dn) args[0];
+                        renames.add(new Dn((Rdn) args[1], dn.getParent()) + " deleteOldRdn=" + args[2]);
+                    }
+                    case "moveAndRename" ->
+                        renames.add(args[1] + " deleteOldRdn=" + args[2]);
+                    case "move" -> renames.add(new Dn(((Dn) args[0]).getRdn(), (Dn) args[1]) + " deleteOldRdn=true");

Review Comment:
   Optional nit: the producer never calls `move`, so this branch is dead code. You could drop it, or make the `default` branch record the method name so an unexpected call shows up in the assertion. Also, the stub returns `null` for every non-boolean method, so if anything ever called `hashCode()` on the proxy it would fail with an unboxing NPE. That doesn't happen today, so this is fine as it is.



-- 
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-25509: camel-ldif - Apply newsuperior of modrdn, and keep the parent of moddn without it [camel]

Posted by "allthingssecurity (via GitHub)" <gi...@apache.org>.
allthingssecurity commented on code in PR #27642:
URL: https://github.com/apache/camel/pull/27642#discussion_r4236660850


##########
components/camel-ldif/src/test/java/org/apache/camel/component/ldif/LdifModDnTest.java:
##########
@@ -0,0 +1,111 @@
+/*
+ * 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.ldif;
+
+import java.lang.reflect.Proxy;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit6.CamelTestSupport;
+import org.apache.directory.api.ldap.model.name.Dn;
+import org.apache.directory.api.ldap.model.name.Rdn;
+import org.apache.directory.ldap.client.api.LdapConnection;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * RFC 2849: "modrdn" and "moddn" are the same change type. The entry gets the new RDN, and moves under the new superior
+ * only when "newsuperior" is given. The connection is a stub that records the resulting DN, so this test needs no LDAP
+ * server.
+ */
+class LdifModDnTest extends CamelTestSupport {
+
+    private final List<String> renames = new ArrayList<>();
+
+    @BindToRegistry("conn")
+    private final LdapConnection conn = (LdapConnection) Proxy.newProxyInstance(
+            LdapConnection.class.getClassLoader(), new Class<?>[] { LdapConnection.class },
+            (proxy, method, args) -> {
+                switch (method.getName()) {
+                    case "rename" -> {
+                        Dn dn = (Dn) args[0];
+                        renames.add(new Dn((Rdn) args[1], dn.getParent()) + " deleteOldRdn=" + args[2]);
+                    }
+                    case "moveAndRename" ->
+                        renames.add(args[1] + " deleteOldRdn=" + args[2]);
+                    case "move" -> renames.add(new Dn(((Dn) args[0]).getRdn(), (Dn) args[1]) + " deleteOldRdn=true");

Review Comment:
   Done in 71879abfdd: the `move` branch is gone, the default branch records the method name (shown in the assertion message), and the proxy answers `hashCode`/`equals`/`toString` by identity. Recording surfaced the producer's `close()` call, which is now an explicit expected no-op.
   
   _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-25509: camel-ldif - Apply newsuperior of modrdn, and keep the parent of moddn without it [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27642:
URL: https://github.com/apache/camel/pull/27642#issuecomment-6094369857

   :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


Re: [PR] CAMEL-25509: camel-ldif - Apply newsuperior of modrdn, and keep the parent of moddn without it [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27642:
URL: https://github.com/apache/camel/pull/27642#issuecomment-6094594251

   <!-- ci-tested-modules -->
   :test_tube: **CI tested the following changed modules:**
   
   - `components/camel-ldif`
   - `docs`
   
   ---
   
   <details><summary>:microscope: Scalpel shadow comparison — Scalpel: 9 of 704 tested, 26 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** (2 direct + 8 downstream), **skip tests for 26** (generated code, meta-modules)
   
   <details><summary>Modules Scalpel would test (9)</summary>
   
   - `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-ldif` ← components/camel-ldif/src/main/java/org/apache/camel/component/ldif/LdifProducer.java, components/camel-ldif/src/test/java/org/apache/camel/component/ldif/LdifModDnTest.java
   - `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 (26)</summary>
   
   - `apache-camel`
   - `camel-allcomponents`
   - `camel-catalog`
   - `camel-catalog-console`
   - `camel-catalog-maven`
   - `camel-catalog-suggest`
   - `camel-componentdsl`
   - `camel-endpointdsl`
   - `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>
   
   <details><summary>All tested modules (36 modules, 6m 46s total)</summary>
   
   **Total reactor time:** 6m 46s
   
   | Module | Duration | Status |
   | --- | --- | --- |
   | Camel :: JBang :: Plugin :: TUI | 56.4s | SUCCESS |
   | Camel :: Launcher | 51.3s | SUCCESS |
   | Camel :: JBang :: MCP | 43.0s | SUCCESS |
   | Camel :: Component DSL | 30.1s | SUCCESS |
   | Camel :: Catalog :: Camel Catalog | 23.9s | SUCCESS |
   | Camel :: LDIF | 22.4s | SUCCESS |
   | Camel :: JBang :: Plugin :: Kubernetes | 22.2s | SUCCESS |
   | Camel :: YAML DSL | 21.6s | SUCCESS |
   | Camel :: YAML DSL :: Validator | 19.9s | SUCCESS |
   | Camel :: JBang :: Plugin :: Validate | 16.8s | SUCCESS |
   | Camel :: Docs | 15.7s | SUCCESS |
   | Camel :: Kamelet Main | 13.3s | SUCCESS |
   | Camel :: JBang :: Plugin :: Testing | 10.7s | SUCCESS |
   | Camel :: YAML DSL :: Deserializers | 10.7s | SUCCESS |
   | Camel :: Catalog :: Camel Route Parser | 8.4s | SUCCESS |
   | Camel :: Catalog :: Camel Report Maven Plugin | 7.5s | SUCCESS |
   | Camel :: All Components Sync point | 5.6s | SUCCESS |
   | Camel :: YAML DSL :: Validator Maven Plugin | 5.0s | SUCCESS |
   | Camel :: YAML DSL :: Maven Plugins | 3.6s | SUCCESS |
   | Camel :: Catalog :: Maven | 2.3s | SUCCESS |
   | Camel :: Catalog :: Suggest (deprecated) | 2.1s | SUCCESS |
   | Camel :: Coverage | 1.8s | SUCCESS |
   | Camel :: Assembly | 1.7s | SUCCESS |
   | Camel :: JBang :: Plugin :: Edit | 1.6s | SUCCESS |
   | Camel :: JBang :: Plugin :: MCP | 1.4s | SUCCESS |
   | Camel :: Catalog :: Dummy Component | 1.3s | SUCCESS |
   | Camel :: JBang :: Integration tests | 1.1s | SUCCESS |
   | Camel :: JBang :: Plugin :: Generate | 1.0s | SUCCESS |
   | Camel :: Catalog :: Console | 0.9s | SUCCESS |
   | Camel :: Launcher :: Container | 0.7s | SUCCESS |
   | Camel :: Endpoint DSL :: Support | 0.7s | SUCCESS |
   | Camel :: JBang :: Main | 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 :: JBang :: Plugin :: TUI` (56.4s)
   - `Camel :: Launcher` (51.3s)
   - `Camel :: JBang :: MCP` (43.0s)
   - `Camel :: Component DSL` (30.1s)
   - `Camel :: Catalog :: Camel Catalog` (23.9s)
   - `Camel :: LDIF` (22.4s)
   - `Camel :: JBang :: Plugin :: Kubernetes` (22.2s)
   - `Camel :: YAML DSL` (21.6s)
   - `Camel :: YAML DSL :: Validator` (19.9s)
   - `Camel :: JBang :: Plugin :: Validate` (16.8s)
   - `Camel :: Docs` (15.7s)
   - `Camel :: Kamelet Main` (13.3s)
   - `Camel :: JBang :: Plugin :: Testing` (10.7s)
   - `Camel :: YAML DSL :: Deserializers` (10.7s)
   - `Camel :: Catalog :: Camel Route Parser` (8.4s)
   - `Camel :: Catalog :: Camel Report Maven Plugin` (7.5s)
   - `Camel :: All Components Sync point` (5.6s)
   - `Camel :: YAML DSL :: Validator Maven Plugin` (5.0s)
   - `Camel :: YAML DSL :: Maven Plugins` (3.6s)
   - `Camel :: Catalog :: Maven` (2.3s)
   
   </details>
   
   ---
   :gear: [View full build and test results](https://github.com/apache/camel/actions/runs/38007523801)


-- 
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-25509: camel-ldif - Apply newsuperior of modrdn, and keep the parent of moddn without it [camel]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus merged PR #27642:
URL: https://github.com/apache/camel/pull/27642


-- 
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