You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2022/05/11 07:16:09 UTC
[camel] branch main updated: camel-xchange: Enable XChange Exchange configuration to be overridable for testing purposes
This is an automated email from the ASF dual-hosted git repository.
jamesnetherton 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 cac158c6fa0 camel-xchange: Enable XChange Exchange configuration to be overridable for testing purposes
cac158c6fa0 is described below
commit cac158c6fa01be1a487f8638744f9d14385c8a0b
Author: James Netherton <ja...@gmail.com>
AuthorDate: Wed May 11 08:10:51 2022 +0100
camel-xchange: Enable XChange Exchange configuration to be overridable for testing purposes
---
.../java/org/apache/camel/component/xchange/XChangeComponent.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/components/camel-xchange/src/main/java/org/apache/camel/component/xchange/XChangeComponent.java b/components/camel-xchange/src/main/java/org/apache/camel/component/xchange/XChangeComponent.java
index 3d866e91295..f609e7687f7 100644
--- a/components/camel-xchange/src/main/java/org/apache/camel/component/xchange/XChangeComponent.java
+++ b/components/camel-xchange/src/main/java/org/apache/camel/component/xchange/XChangeComponent.java
@@ -56,12 +56,16 @@ public class XChangeComponent extends DefaultComponent {
xchanges.clear();
}
+ protected Exchange createExchange(Class<? extends Exchange> exchangeClass) {
+ return ExchangeFactory.INSTANCE.createExchange(exchangeClass);
+ }
+
private synchronized XChange getOrCreateXChange(String name) {
XChange xchange = xchanges.get(name);
if (xchange == null) {
Class<? extends Exchange> exchangeClass = XChangeHelper.loadXChangeClass(getCamelContext(), name);
Assert.notNull(exchangeClass, "XChange not supported: " + name);
- xchange = new XChange(ExchangeFactory.INSTANCE.createExchange(exchangeClass));
+ xchange = new XChange(createExchange(exchangeClass));
xchanges.put(name, xchange);
}