You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/02/24 09:20:58 UTC

[camel] branch main updated: CAMEL-19090: Remove deprecated getEndpointMap() on CamelContext

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 0a40bdbbe2d CAMEL-19090: Remove deprecated getEndpointMap() on CamelContext
0a40bdbbe2d is described below

commit 0a40bdbbe2d6f6b6963132043db3b60f119a6924
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Feb 24 10:20:46 2023 +0100

    CAMEL-19090: Remove deprecated getEndpointMap() on CamelContext
---
 .../http/HttpSendDynamicAwareBasicAuthTest.java    |  2 +-
 .../http/HttpSendDynamicAwareRawTest.java          |  4 +--
 .../component/http/HttpSendDynamicAwareTest.java   |  4 +--
 .../HttpSendDynamicAwareUriWithSpacesTest.java     |  3 +--
 .../HttpSendDynamicAwareUriWithoutSlashTest.java   |  5 ++--
 .../netty/http/NettyHttpSendDynamicAwareTest.java  |  4 +--
 .../camel/component/printer/PrinterPrintTest.java  |  2 +-
 .../undertow/UndertowSendDynamicAwareTest.java     |  4 +--
 .../main/java/org/apache/camel/CamelContext.java   |  9 -------
 .../org/apache/camel/spi/EndpointRegistry.java     | 14 +++++++++++
 .../camel/impl/engine/AbstractCamelContext.java    | 10 --------
 .../camel/impl/engine/AbstractDynamicRegistry.java | 27 ++++++++++++++++++++
 .../camel/impl/engine/DefaultEndpointRegistry.java |  8 ++++++
 .../impl/engine/ProvisionalEndpointRegistry.java   | 29 ++++++++++++++++++++++
 .../camel/impl/lw/LightweightCamelContext.java     |  6 -----
 .../impl/lw/LightweightRuntimeCamelContext.java    |  5 ----
 .../camel/impl/engine/DefaultCamelContextTest.java |  4 +--
 .../processor/ToDynamicSendDynamicAwareTest.java   |  2 +-
 .../ROOT/pages/camel-4-migration-guide.adoc        |  3 +++
 19 files changed, 97 insertions(+), 48 deletions(-)

diff --git a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSendDynamicAwareBasicAuthTest.java b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSendDynamicAwareBasicAuthTest.java
index 3a237458ed9..02827df9780 100644
--- a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSendDynamicAwareBasicAuthTest.java
+++ b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSendDynamicAwareBasicAuthTest.java
@@ -100,7 +100,7 @@ public class HttpSendDynamicAwareBasicAuthTest extends BaseHttpTest {
         assertEquals(2, count);
 
         // we only have 2xdirect and 2xhttp
-        assertEquals(4, context.getEndpointMap().size());
+        assertEquals(4, context.getEndpointRegistry().size());
     }
 
 }
diff --git a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSendDynamicAwareRawTest.java b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSendDynamicAwareRawTest.java
index c4ed69f6641..3445929cb17 100644
--- a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSendDynamicAwareRawTest.java
+++ b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSendDynamicAwareRawTest.java
@@ -87,12 +87,12 @@ public class HttpSendDynamicAwareRawTest extends BaseHttpTest {
         assertEquals("Drinking wine", out);
 
         // and there should only be one http endpoint as they are both on same host
-        boolean found = context.getEndpointMap()
+        boolean found = context.getEndpointRegistry()
                 .containsKey("http://localhost:" + localServer.getLocalPort() + "?throwExceptionOnFailure=false");
         assertTrue(found, "Should find static uri");
 
         // we only have 2xdirect and 1xhttp
-        assertEquals(3, context.getEndpointMap().size());
+        assertEquals(3, context.getEndpointRegistry().size());
     }
 
 }
diff --git a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSendDynamicAwareTest.java b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSendDynamicAwareTest.java
index eaee6296cc0..2d994d76452 100644
--- a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSendDynamicAwareTest.java
+++ b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSendDynamicAwareTest.java
@@ -81,12 +81,12 @@ public class HttpSendDynamicAwareTest extends BaseHttpTest {
         assertEquals("Drinking wine", out);
 
         // and there should only be one http endpoint as they are both on same host
-        boolean found = context.getEndpointMap()
+        boolean found = context.getEndpointRegistry()
                 .containsKey("http://localhost:" + localServer.getLocalPort() + "?throwExceptionOnFailure=false");
         assertTrue(found, "Should find static uri");
 
         // we only have 2xdirect and 1xhttp
-        assertEquals(3, context.getEndpointMap().size());
+        assertEquals(3, context.getEndpointRegistry().size());
     }
 
 }
diff --git a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSendDynamicAwareUriWithSpacesTest.java b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSendDynamicAwareUriWithSpacesTest.java
index e5c49143887..8c6614910a1 100644
--- a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSendDynamicAwareUriWithSpacesTest.java
+++ b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSendDynamicAwareUriWithSpacesTest.java
@@ -18,7 +18,6 @@ package org.apache.camel.component.http;
 
 import java.util.Map;
 
-import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 import org.apache.camel.RoutesBuilder;
 import org.apache.camel.builder.ExchangeBuilder;
@@ -82,7 +81,7 @@ public class HttpSendDynamicAwareUriWithSpacesTest extends BaseHttpTest {
         assertEquals("a user", out.getMessage().getBody(String.class));
 
         // and there should only be one http endpoint as they are both on same host
-        Map<String, Endpoint> endpointMap = context.getEndpointMap();
+        Map endpointMap = context.getEndpointRegistry();
         assertEquals(2, endpointMap.size());
         assertTrue(endpointMap.containsKey("http://localhost:" + localServer.getLocalPort()), "Should find static uri");
         assertTrue(endpointMap.containsKey("direct://usersDrink"), "Should find direct");
diff --git a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSendDynamicAwareUriWithoutSlashTest.java b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSendDynamicAwareUriWithoutSlashTest.java
index 250f276c51a..8c00cca6d1e 100644
--- a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSendDynamicAwareUriWithoutSlashTest.java
+++ b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSendDynamicAwareUriWithoutSlashTest.java
@@ -18,7 +18,6 @@ package org.apache.camel.component.http;
 
 import java.util.Map;
 
-import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 import org.apache.camel.RoutesBuilder;
 import org.apache.camel.builder.ExchangeBuilder;
@@ -86,7 +85,7 @@ public class HttpSendDynamicAwareUriWithoutSlashTest extends BaseHttpTest {
         assertEquals("a user", out.getMessage().getBody(String.class));
 
         // and there should only be one http endpoint as they are both on same host
-        Map<String, Endpoint> endpointMap = context.getEndpointMap();
+        Map endpointMap = context.getEndpointRegistry();
         assertTrue(endpointMap.containsKey("http://localhost:" + localServer.getLocalPort()), "Should find static uri");
         assertTrue(endpointMap.containsKey("direct://usersDrink"), "Should find direct");
         assertTrue(endpointMap.containsKey("direct://usersDrinkWithoutSlash"), "Should find direct");
@@ -104,7 +103,7 @@ public class HttpSendDynamicAwareUriWithoutSlashTest extends BaseHttpTest {
         assertEquals("a user", out.getMessage().getBody(String.class));
 
         // and there should only be one http endpoint as they are both on same host
-        Map<String, Endpoint> endpointMap = context.getEndpointMap();
+        Map endpointMap = context.getEndpointRegistry();
         assertTrue(endpointMap.containsKey("http://localhost:" + localServer.getLocalPort()), "Should find static uri");
         assertTrue(endpointMap.containsKey("direct://usersDrink"), "Should find direct");
         assertTrue(endpointMap.containsKey("direct://usersDrinkWithoutSlash"), "Should find direct");
diff --git a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSendDynamicAwareTest.java b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSendDynamicAwareTest.java
index fb4792ac2a2..cd0ce34b033 100644
--- a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSendDynamicAwareTest.java
+++ b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSendDynamicAwareTest.java
@@ -34,12 +34,12 @@ public class NettyHttpSendDynamicAwareTest extends BaseNettyTest {
         assertEquals("Drinking wine", out);
 
         // and there should only be one http endpoint as they are both on same host
-        boolean found = context.getEndpointMap()
+        boolean found = context.getEndpointRegistry()
                 .containsKey("netty-http://http://localhost:" + getPort() + "?throwExceptionOnFailure=false");
         assertTrue(found, "Should find static uri");
 
         // we only have 2xdirect and 2xnetty-http
-        assertEquals(4, context.getEndpointMap().size());
+        assertEquals(4, context.getEndpointRegistry().size());
     }
 
     @Override
diff --git a/components/camel-printer/src/test/java/org/apache/camel/component/printer/PrinterPrintTest.java b/components/camel-printer/src/test/java/org/apache/camel/component/printer/PrinterPrintTest.java
index ee0ef78608a..0d01a3d0a16 100644
--- a/components/camel-printer/src/test/java/org/apache/camel/component/printer/PrinterPrintTest.java
+++ b/components/camel-printer/src/test/java/org/apache/camel/component/printer/PrinterPrintTest.java
@@ -261,7 +261,7 @@ public class PrinterPrintTest extends CamelTestSupport {
         context.start();
 
         // Are there two different PrintConfigurations?
-        Map<String, Endpoint> epm = context().getEndpointMap();
+        Map<String, Endpoint> epm = context().getEndpointRegistry().getReadOnlyMap();
         assertEquals(4, epm.size(), "Four endpoints");
         Endpoint lp1 = null;
         Endpoint lp2 = null;
diff --git a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowSendDynamicAwareTest.java b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowSendDynamicAwareTest.java
index 602c1f17c24..7fc65c7a43b 100644
--- a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowSendDynamicAwareTest.java
+++ b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowSendDynamicAwareTest.java
@@ -34,12 +34,12 @@ public class UndertowSendDynamicAwareTest extends BaseUndertowTest {
         assertEquals("Drinking wine", out);
 
         // and there should only be one http endpoint as they are both on same host
-        boolean found = context.getEndpointMap()
+        boolean found = context.getEndpointRegistry()
                 .containsKey("undertow://http://localhost:" + getPort() + "?throwExceptionOnFailure=false");
         assertTrue(found, "Should find static uri");
 
         // we only have 2xdirect and 2xundertow
-        assertEquals(4, context.getEndpointMap().size());
+        assertEquals(4, context.getEndpointRegistry().size());
     }
 
     @Override
diff --git a/core/camel-api/src/main/java/org/apache/camel/CamelContext.java b/core/camel-api/src/main/java/org/apache/camel/CamelContext.java
index ab2d5e08629..ff5114cd0f6 100644
--- a/core/camel-api/src/main/java/org/apache/camel/CamelContext.java
+++ b/core/camel-api/src/main/java/org/apache/camel/CamelContext.java
@@ -452,15 +452,6 @@ public interface CamelContext extends CamelContextLifecycle, RuntimeConfiguratio
      */
     Collection<Endpoint> getEndpoints();
 
-    /**
-     * Returns a new {@link Map} containing all of the endpoints from the {@link org.apache.camel.spi.EndpointRegistry}
-     *
-     * @return     map of endpoints
-     * @deprecated use {@link #getEndpointRegistry()}
-     */
-    @Deprecated
-    Map<String, Endpoint> getEndpointMap();
-
     /**
      * Is the given endpoint already registered in the {@link org.apache.camel.spi.EndpointRegistry}
      *
diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/EndpointRegistry.java b/core/camel-api/src/main/java/org/apache/camel/spi/EndpointRegistry.java
index 0b0fd106ce1..de1a26c263c 100644
--- a/core/camel-api/src/main/java/org/apache/camel/spi/EndpointRegistry.java
+++ b/core/camel-api/src/main/java/org/apache/camel/spi/EndpointRegistry.java
@@ -77,6 +77,15 @@ public interface EndpointRegistry<K> extends Map<K, Endpoint>, StaticService {
      */
     boolean isDynamic(String key);
 
+    /**
+     * Whether the given endpoint is stored in the registry
+     *
+     * @param  key the endpoint key
+     * @return     <tt>true</tt> if present, <tt>false</tt> if not
+     */
+    @Override
+    boolean containsKey(Object key);
+
     /**
      * Cleanup the cache (purging stale entries)
      */
@@ -87,4 +96,9 @@ public interface EndpointRegistry<K> extends Map<K, Endpoint>, StaticService {
      */
     Collection<Endpoint> getReadOnlyValues();
 
+    /**
+     * Gets a read-only map of the endpoints currently in the registry.
+     */
+    Map<String, Endpoint> getReadOnlyMap();
+
 }
diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java
index f7c4c84d6f4..c7a6b96529f 100644
--- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java
+++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java
@@ -33,7 +33,6 @@ import java.util.Map;
 import java.util.Optional;
 import java.util.Properties;
 import java.util.Set;
-import java.util.TreeMap;
 import java.util.TreeSet;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CopyOnWriteArrayList;
@@ -787,15 +786,6 @@ public abstract class AbstractCamelContext extends BaseService
         return endpoints.getReadOnlyValues();
     }
 
-    @Override
-    public Map<String, Endpoint> getEndpointMap() {
-        Map<String, Endpoint> answer = new TreeMap<>();
-        for (Map.Entry<NormalizedUri, Endpoint> entry : endpoints.entrySet()) {
-            answer.put(entry.getKey().get(), entry.getValue());
-        }
-        return answer;
-    }
-
     @Override
     public Endpoint hasEndpoint(String uri) {
         if (endpoints.isEmpty()) {
diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractDynamicRegistry.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractDynamicRegistry.java
index aeb6def207b..469b368fa75 100644
--- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractDynamicRegistry.java
+++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractDynamicRegistry.java
@@ -24,6 +24,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.ConcurrentModificationException;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
@@ -210,6 +211,32 @@ public class AbstractDynamicRegistry<K, V> extends AbstractMap<K, V> implements
         return Collections.unmodifiableCollection(answer);
     }
 
+    public Map<String, V> getReadOnlyMap() {
+        if (isEmpty()) {
+            return Collections.emptyMap();
+        }
+
+        // we want to avoid any kind of locking in get/put methods
+        // as getReadOnlyValues is only seldom used, such as when camel-mock
+        // is asserting endpoints at end of testing
+        // so this code will then just retry in case of a concurrency update
+        Map<String, V> answer = new LinkedHashMap<>();
+        boolean done = false;
+        while (!done) {
+            try {
+                for (Entry<K, V> entry : entrySet()) {
+                    String k = entry.getKey().toString();
+                    answer.put(k, entry.getValue());
+                }
+                done = true;
+            } catch (ConcurrentModificationException e) {
+                answer.clear();
+                // try again
+            }
+        }
+        return Collections.unmodifiableMap(answer);
+    }
+
     @Override
     public void stop() {
         ServiceHelper.stopService(staticMap.values(), dynamicMap.values());
diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultEndpointRegistry.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultEndpointRegistry.java
index 1449e027caf..a7cce0d7702 100644
--- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultEndpointRegistry.java
+++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultEndpointRegistry.java
@@ -54,6 +54,14 @@ public class DefaultEndpointRegistry extends AbstractDynamicRegistry<NormalizedU
         return isDynamic(NormalizedUri.newNormalizedUri(key, false));
     }
 
+    @Override
+    public boolean containsKey(Object key) {
+        if (key instanceof String) {
+            key = NormalizedUri.newNormalizedUri(key.toString(), false);
+        }
+        return super.containsKey(key);
+    }
+
     @Override
     public String toString() {
         return "EndpointRegistry for " + context.getName() + " [capacity: " + maxCacheSize + "]";
diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/ProvisionalEndpointRegistry.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/ProvisionalEndpointRegistry.java
index 58afd9dc115..da9613034fc 100644
--- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/ProvisionalEndpointRegistry.java
+++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/ProvisionalEndpointRegistry.java
@@ -21,6 +21,8 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.ConcurrentModificationException;
 import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
 
 import org.apache.camel.Endpoint;
 import org.apache.camel.spi.EndpointRegistry;
@@ -101,4 +103,31 @@ class ProvisionalEndpointRegistry extends HashMap<NormalizedUri, Endpoint> imple
         }
         return Collections.unmodifiableCollection(answer);
     }
+
+    @Override
+    public Map<String, Endpoint> getReadOnlyMap() {
+        if (isEmpty()) {
+            return Collections.emptyMap();
+        }
+
+        // we want to avoid any kind of locking in get/put methods
+        // as getReadOnlyValues is only seldom used, such as when camel-mock
+        // is asserting endpoints at end of testing
+        // so this code will then just retry in case of a concurrency update
+        Map<String, Endpoint> answer = new LinkedHashMap<>();
+        boolean done = false;
+        while (!done) {
+            try {
+                for (Entry<NormalizedUri, Endpoint> entry : entrySet()) {
+                    String k = entry.getKey().toString();
+                    answer.put(k, entry.getValue());
+                }
+                done = true;
+            } catch (ConcurrentModificationException e) {
+                answer.clear();
+                // try again
+            }
+        }
+        return Collections.unmodifiableMap(answer);
+    }
 }
diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/impl/lw/LightweightCamelContext.java b/core/camel-core-engine/src/main/java/org/apache/camel/impl/lw/LightweightCamelContext.java
index 892d17bae7c..ad6d90138c0 100644
--- a/core/camel-core-engine/src/main/java/org/apache/camel/impl/lw/LightweightCamelContext.java
+++ b/core/camel-core-engine/src/main/java/org/apache/camel/impl/lw/LightweightCamelContext.java
@@ -504,12 +504,6 @@ public class LightweightCamelContext implements ExtendedCamelContext, CatalogCam
         return delegate.getEndpoints();
     }
 
-    @Override
-    @Deprecated
-    public Map<String, Endpoint> getEndpointMap() {
-        return delegate.getEndpointMap();
-    }
-
     @Override
     public Endpoint hasEndpoint(String uri) {
         return delegate.hasEndpoint(uri);
diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/impl/lw/LightweightRuntimeCamelContext.java b/core/camel-core-engine/src/main/java/org/apache/camel/impl/lw/LightweightRuntimeCamelContext.java
index 02d430c2073..20eea3dce5c 100644
--- a/core/camel-core-engine/src/main/java/org/apache/camel/impl/lw/LightweightRuntimeCamelContext.java
+++ b/core/camel-core-engine/src/main/java/org/apache/camel/impl/lw/LightweightRuntimeCamelContext.java
@@ -858,11 +858,6 @@ public class LightweightRuntimeCamelContext implements ExtendedCamelContext, Cat
         return new ArrayList<>(endpoints.values());
     }
 
-    @Override
-    public Map<String, Endpoint> getEndpointMap() {
-        throw new UnsupportedOperationException();
-    }
-
     @Override
     public Endpoint hasEndpoint(String uri) {
         return endpoints.get(NormalizedUri.newNormalizedUri(uri, false));
diff --git a/core/camel-core/src/test/java/org/apache/camel/impl/engine/DefaultCamelContextTest.java b/core/camel-core/src/test/java/org/apache/camel/impl/engine/DefaultCamelContextTest.java
index be379ac9817..5e236feec55 100644
--- a/core/camel-core/src/test/java/org/apache/camel/impl/engine/DefaultCamelContextTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/impl/engine/DefaultCamelContextTest.java
@@ -18,7 +18,6 @@ package org.apache.camel.impl.engine;
 
 import java.util.Collection;
 import java.util.Iterator;
-import java.util.Map;
 import java.util.Set;
 
 import org.apache.camel.CamelContext;
@@ -34,6 +33,7 @@ import org.apache.camel.component.bean.BeanComponent;
 import org.apache.camel.component.direct.DirectComponent;
 import org.apache.camel.component.log.LogComponent;
 import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.spi.EndpointRegistry;
 import org.apache.camel.spi.UuidGenerator;
 import org.apache.camel.support.CamelContextHelper;
 import org.apache.camel.support.DefaultUuidGenerator;
@@ -273,7 +273,7 @@ public class DefaultCamelContextTest extends TestSupport {
         assertNotNull(ctx.hasEndpoint("mock://foo"));
         assertNull(ctx.hasEndpoint("mock://bar"));
 
-        Map<String, Endpoint> map = ctx.getEndpointMap();
+        EndpointRegistry map = ctx.getEndpointRegistry();
         assertEquals(1, map.size());
 
         try {
diff --git a/core/camel-core/src/test/java/org/apache/camel/processor/ToDynamicSendDynamicAwareTest.java b/core/camel-core/src/test/java/org/apache/camel/processor/ToDynamicSendDynamicAwareTest.java
index 042599cd14f..9e9ddc92f56 100644
--- a/core/camel-core/src/test/java/org/apache/camel/processor/ToDynamicSendDynamicAwareTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/processor/ToDynamicSendDynamicAwareTest.java
@@ -52,7 +52,7 @@ public class ToDynamicSendDynamicAwareTest extends ContextTestSupport {
         assertMockEndpointsSatisfied();
 
         // there should only be a bar:order endpoint
-        boolean found = context.getEndpointMap().containsKey("bar://order");
+        boolean found = context.getEndpointRegistry().containsKey("bar://order");
         assertTrue(found, "There should only be one bar endpoint");
     }
 
diff --git a/docs/user-manual/modules/ROOT/pages/camel-4-migration-guide.adoc b/docs/user-manual/modules/ROOT/pages/camel-4-migration-guide.adoc
index 6bee1260c4d..f4f03322ff6 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4-migration-guide.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4-migration-guide.adoc
@@ -61,7 +61,10 @@ All the `camel-test` modules that were JUnit 4.x based has been removed. All tes
 
 == API Changes
 
+We have removed deprecated APIs such as the following.
+
 The `org.apache.camel.ExchangePattern` has removed `InOptionalOut`.
+Removed `getEndpointMap()` method from `CamelContext`.
 
 == YAML DSL