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 2022/09/09 18:06:28 UTC

[camel] branch main updated: CAMEL-18484 Camel-xchange: Enable mock testing without neaed of real account (#8326)

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 a62b1fbbbd2 CAMEL-18484 Camel-xchange: Enable mock testing without neaed of real account (#8326)
a62b1fbbbd2 is described below

commit a62b1fbbbd2fb27e6ddf58babfb4cd2f610c8adc
Author: JiriOndrusek <on...@gmail.com>
AuthorDate: Fri Sep 9 20:06:20 2022 +0200

    CAMEL-18484 Camel-xchange: Enable mock testing without neaed of real account (#8326)
---
 components/camel-xchange/README.adoc               | 16 +++++
 components/camel-xchange/pom.xml                   |  8 +++
 .../camel/component/xchange/XChangeComponent.java  |  4 ++
 .../component/xchange/XChangeTestSupport.java      | 76 ++++++++++++++++++++++
 .../xchange/account/AccountProducerTest.java       | 13 ++--
 .../xchange/market/MarketDataProducerTest.java     |  6 +-
 .../xchange/metadata/MetaDataProducerTest.java     |  6 +-
 .../src/test/resources/mappings/account.json       | 40 ++++++++++++
 .../src/test/resources/mappings/currencies.json    | 40 ++++++++++++
 .../src/test/resources/mappings/ticker01.json      | 43 ++++++++++++
 .../src/test/resources/mappings/ticker02.json      | 42 ++++++++++++
 .../test/resources/mappings/tickerBTCUSDT_01.json  | 40 ++++++++++++
 12 files changed, 319 insertions(+), 15 deletions(-)

diff --git a/components/camel-xchange/README.adoc b/components/camel-xchange/README.adoc
new file mode 100644
index 00000000000..d85f3b02ed9
--- /dev/null
+++ b/components/camel-xchange/README.adoc
@@ -0,0 +1,16 @@
+== Camel Xchange integration tests
+
+Connection to `https://api.binance.com` has to be enabled by providing system property `enable.xchange.itests` with value `true`. If not provided mocked test (using Wiremock is used).
+
+Several tests require real credentials (to access acount/wallet/..)
+Please provide system properties:
+
+```
+... -Dxchange.api.key=#your_api_key -Dxchange.secret.key=#your_secret_key
+```
+
+or environmental properties:
+
+```
+export XCHANGE_API_KEY=#your_api_key
+export XCHANGE_SECRET_KEY=#your_secret_key
diff --git a/components/camel-xchange/pom.xml b/components/camel-xchange/pom.xml
index 2d50b3407f2..0fc3f189db0 100644
--- a/components/camel-xchange/pom.xml
+++ b/components/camel-xchange/pom.xml
@@ -77,6 +77,14 @@
             <artifactId>log4j-slf4j-impl</artifactId>
             <scope>test</scope>
         </dependency>
+
+        <dependency>
+            <groupId>com.github.tomakehurst</groupId>
+            <artifactId>wiremock-jre8</artifactId>
+            <version>${wiremock-version}</version>
+            <scope>test</scope>
+        </dependency>
+
     </dependencies>
 
 </project>
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 f609e7687f7..8983ce00267 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
@@ -50,6 +50,10 @@ public class XChangeComponent extends DefaultComponent {
         return xchanges.get(name);
     }
 
+    void putXChange(String name, XChange xchange) {
+        xchanges.put(name, xchange);
+    }
+
     @Override
     protected void doShutdown() throws Exception {
         super.doShutdown();
diff --git a/components/camel-xchange/src/test/java/org/apache/camel/component/xchange/XChangeTestSupport.java b/components/camel-xchange/src/test/java/org/apache/camel/component/xchange/XChangeTestSupport.java
new file mode 100644
index 00000000000..cf39c001eef
--- /dev/null
+++ b/components/camel-xchange/src/test/java/org/apache/camel/component/xchange/XChangeTestSupport.java
@@ -0,0 +1,76 @@
+/*
+ * 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.xchange;
+
+import com.github.tomakehurst.wiremock.WireMockServer;
+import org.apache.camel.CamelContext;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.knowm.xchange.Exchange;
+import org.knowm.xchange.ExchangeFactory;
+import org.knowm.xchange.ExchangeSpecification;
+
+import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
+
+public abstract class XChangeTestSupport extends CamelTestSupport {
+    public static WireMockServer wireMockServer = new WireMockServer(wireMockConfig().dynamicPort());
+
+    @BeforeAll
+    public static void startWireMockServer() {
+        if (useMockedBackend()) {
+            wireMockServer.start();
+        }
+    }
+
+    @AfterAll
+    public static void stopWireMockServer() {
+        if (useMockedBackend()) {
+            wireMockServer.stop();
+        }
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        CamelContext context = super.createCamelContext();
+        addXChangeClient(context);
+        return context;
+    }
+
+    protected void addXChangeClient(CamelContext context) {
+        XChangeComponent xChangeComponent = new XChangeComponent();
+
+        Class<? extends Exchange> exchangeClass = XChangeHelper.loadXChangeClass(context, "binance");
+        ExchangeSpecification specification = new ExchangeSpecification(exchangeClass);
+
+        if (useMockedBackend()) {
+            specification.setSslUri("http://localhost:" + wireMockServer.port());
+        } else {
+            specification.setApiKey(System.getProperty("xchange.api.key", System.getenv("XCHANGE_API_KEY")));
+            specification.setSecretKey(System.getProperty("xchange.secret.key", System.getenv("XCHANGE_SECRET_KEY")));
+        }
+
+        XChange xchange = new XChange(ExchangeFactory.INSTANCE.createExchange(specification));
+        xChangeComponent.putXChange("binance", xchange);
+
+        context.addComponent("xchange", xChangeComponent);
+    }
+
+    protected static boolean useMockedBackend() {
+        return !Boolean.TRUE.toString().equals(System.getProperty("enable.xchange.itests"));
+    }
+}
diff --git a/components/camel-xchange/src/test/java/org/apache/camel/component/xchange/account/AccountProducerTest.java b/components/camel-xchange/src/test/java/org/apache/camel/component/xchange/account/AccountProducerTest.java
index 5ab49c00ee7..f2f84727a3b 100644
--- a/components/camel-xchange/src/test/java/org/apache/camel/component/xchange/account/AccountProducerTest.java
+++ b/components/camel-xchange/src/test/java/org/apache/camel/component/xchange/account/AccountProducerTest.java
@@ -20,9 +20,8 @@ import java.util.List;
 
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.xchange.XChangeComponent;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.component.xchange.XChangeTestSupport;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
 import org.knowm.xchange.dto.account.Balance;
 import org.knowm.xchange.dto.account.FundingRecord;
 import org.knowm.xchange.dto.account.Wallet;
@@ -30,8 +29,7 @@ import org.knowm.xchange.dto.account.Wallet;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assumptions.assumeTrue;
 
-@EnabledIfSystemProperty(named = "enable.xchange.itests", matches = "true", disabledReason = "Requires API credentials")
-public class AccountProducerTest extends CamelTestSupport {
+public class AccountProducerTest extends XChangeTestSupport {
 
     @Override
     protected RouteBuilder createRouteBuilder() {
@@ -52,7 +50,7 @@ public class AccountProducerTest extends CamelTestSupport {
 
     @Test
     public void testBalances() {
-        assumeTrue(hasAPICredentials());
+        assumeTrue(useMockedBackend() || hasAPICredentials());
 
         List<Balance> balances = template.requestBody("direct:balances", null, List.class);
         assertNotNull(balances, "Balances not null");
@@ -60,7 +58,7 @@ public class AccountProducerTest extends CamelTestSupport {
 
     @Test
     public void testWallets() {
-        assumeTrue(hasAPICredentials());
+        assumeTrue(useMockedBackend() || hasAPICredentials());
 
         List<Wallet> wallets = template.requestBody("direct:wallets", null, List.class);
         assertNotNull(wallets, "Wallets not null");
@@ -68,7 +66,8 @@ public class AccountProducerTest extends CamelTestSupport {
 
     @Test
     public void testFundingHistory() {
-        assumeTrue(hasAPICredentials());
+        //disabled with mocked backend, see https://issues.apache.org/jira/browse/CAMEL-18486 for more details
+        assumeTrue(/*useMockedBackend() ||*/ hasAPICredentials());
 
         List<FundingRecord> records = template.requestBody("direct:fundingHistory", null, List.class);
         assertNotNull(records, "Funding records not null");
diff --git a/components/camel-xchange/src/test/java/org/apache/camel/component/xchange/market/MarketDataProducerTest.java b/components/camel-xchange/src/test/java/org/apache/camel/component/xchange/market/MarketDataProducerTest.java
index c89bc5c0818..eb9ad472f2d 100644
--- a/components/camel-xchange/src/test/java/org/apache/camel/component/xchange/market/MarketDataProducerTest.java
+++ b/components/camel-xchange/src/test/java/org/apache/camel/component/xchange/market/MarketDataProducerTest.java
@@ -17,17 +17,15 @@
 package org.apache.camel.component.xchange.market;
 
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.component.xchange.XChangeTestSupport;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
 import org.knowm.xchange.currency.CurrencyPair;
 import org.knowm.xchange.dto.marketdata.Ticker;
 
 import static org.apache.camel.component.xchange.XChangeConfiguration.HEADER_CURRENCY_PAIR;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 
-@EnabledIfSystemProperty(named = "enable.xchange.itests", matches = "true", disabledReason = "Requires API credentials")
-public class MarketDataProducerTest extends CamelTestSupport {
+public class MarketDataProducerTest extends XChangeTestSupport {
 
     @Override
     protected RouteBuilder createRouteBuilder() {
diff --git a/components/camel-xchange/src/test/java/org/apache/camel/component/xchange/metadata/MetaDataProducerTest.java b/components/camel-xchange/src/test/java/org/apache/camel/component/xchange/metadata/MetaDataProducerTest.java
index 2eabbc5565e..a93987d4e91 100644
--- a/components/camel-xchange/src/test/java/org/apache/camel/component/xchange/metadata/MetaDataProducerTest.java
+++ b/components/camel-xchange/src/test/java/org/apache/camel/component/xchange/metadata/MetaDataProducerTest.java
@@ -19,9 +19,8 @@ package org.apache.camel.component.xchange.metadata;
 import java.util.List;
 
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.component.xchange.XChangeTestSupport;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
 import org.knowm.xchange.currency.Currency;
 import org.knowm.xchange.currency.CurrencyPair;
 import org.knowm.xchange.dto.meta.CurrencyMetaData;
@@ -32,8 +31,7 @@ import static org.apache.camel.component.xchange.XChangeConfiguration.HEADER_CUR
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
-@EnabledIfSystemProperty(named = "enable.xchange.itests", matches = "true", disabledReason = "Requires API credentials")
-public class MetaDataProducerTest extends CamelTestSupport {
+public class MetaDataProducerTest extends XChangeTestSupport {
 
     @Override
     protected RouteBuilder createRouteBuilder() {
diff --git a/components/camel-xchange/src/test/resources/mappings/account.json b/components/camel-xchange/src/test/resources/mappings/account.json
new file mode 100644
index 00000000000..d55c8f7c179
--- /dev/null
+++ b/components/camel-xchange/src/test/resources/mappings/account.json
@@ -0,0 +1,40 @@
+{
+  "id" : "ac6f2724-72fa-4b2b-99fa-bb2f3626587f",
+  "name" : "api_v3_account",
+  "request" : {
+    "urlPattern" : "/api/v3/account?.*",
+    "method" : "GET"
+  },
+  "response" : {
+    "status" : 200,
+    "body" : "{\"makerCommission\":10,\"takerCommission\":10,\"buyerCommission\":0,\"sellerCommission\":0,\"canTrade\":true,\"canWithdraw\":true,\"canDeposit\":true,\"brokered\":false,\"updateTime\":1645730533098,\"accountType\":\"SPOT\",\"balances\":[{\"asset\":\"ETC\",\"free\":\"1.00000000\",\"locked\":\"0.00000000\"}],\"permissions\":[\"SPOT\"]}",
+    "headers" : {
+      "Content-Type" : "application/json;charset=UTF-8",
+      "Date" : "Thu, 08 Sep 2022 07:00:20 GMT",
+      "Server" : "nginx",
+      "Vary" : "Accept-Encoding",
+      "x-mbx-uuid" : "a66c5739-91a4-41d5-bed7-86611d3763a9",
+      "x-mbx-used-weight" : "20",
+      "x-mbx-used-weight-1m" : "20",
+      "Strict-Transport-Security" : "max-age=31536000; includeSubdomains",
+      "X-Frame-Options" : "SAMEORIGIN",
+      "X-Xss-Protection" : "1; mode=block",
+      "X-Content-Type-Options" : "nosniff",
+      "Content-Security-Policy" : "default-src 'self'",
+      "X-Content-Security-Policy" : "default-src 'self'",
+      "X-WebKit-CSP" : "default-src 'self'",
+      "Cache-Control" : "no-cache, no-store, must-revalidate",
+      "Pragma" : "no-cache",
+      "Expires" : "0",
+      "Access-Control-Allow-Origin" : "*",
+      "Access-Control-Allow-Methods" : "GET, HEAD, OPTIONS",
+      "X-Cache" : "Miss from cloudfront",
+      "Via" : "1.1 a5a1b1bd5c5ec5b1378fad5d0770b5e0.cloudfront.net (CloudFront)",
+      "X-Amz-Cf-Pop" : "CDG50-P2",
+      "X-Amz-Cf-Id" : "CJa6sVZma2nlgT0gEvGahWq_ZkPZb-r8wpm9ZkDmtl_WayDBm5l_fA=="
+    }
+  },
+  "uuid" : "ac6f2724-72fa-4b2b-99fa-bb2f3626587f",
+  "persistent" : true,
+  "insertionIndex" : 25
+}
\ No newline at end of file
diff --git a/components/camel-xchange/src/test/resources/mappings/currencies.json b/components/camel-xchange/src/test/resources/mappings/currencies.json
new file mode 100644
index 00000000000..9aa43cac3ce
--- /dev/null
+++ b/components/camel-xchange/src/test/resources/mappings/currencies.json
@@ -0,0 +1,40 @@
+{
+  "id" : "9cb75fc6-cce4-429c-874c-844e1a909b22",
+  "name" : "api_v3_exchangeinfo",
+  "request" : {
+    "url" : "/api/v3/exchangeInfo",
+    "method" : "GET"
+  },
+  "response" : {
+    "status" : 200,
+    "body" : "{\"timezone\":\"UTC\",\"serverTime\":1662462069763,\"rateLimits\":[{\"rateLimitType\":\"REQUEST_WEIGHT\",\"interval\":\"MINUTE\",\"intervalNum\":1,\"limit\":1200},{\"rateLimitType\":\"ORDERS\",\"interval\":\"SECOND\",\"intervalNum\":10,\"limit\":50},{\"rateLimitType\":\"ORDERS\",\"interval\":\"DAY\",\"intervalNum\":1,\"limit\":160000},{\"rateLimitType\":\"RAW_REQUESTS\",\"interval\":\"MINUTE\",\"intervalNum\":5,\"limit\":6100}],\"exchangeFilters\":[],\"symbols\":[{\"symbol\ [...]
+    "headers" : {
+      "Content-Type" : "application/json;charset=UTF-8",
+      "Date" : "Tue, 06 Sep 2022 11:01:09 GMT",
+      "Server" : "nginx",
+      "Vary" : "Accept-Encoding",
+      "x-mbx-uuid" : "2f494656-9539-4cf6-ae6d-2e78ca2586f5",
+      "x-mbx-used-weight" : "10",
+      "x-mbx-used-weight-1m" : "10",
+      "Strict-Transport-Security" : "max-age=31536000; includeSubdomains",
+      "X-Frame-Options" : "SAMEORIGIN",
+      "X-Xss-Protection" : "1; mode=block",
+      "X-Content-Type-Options" : "nosniff",
+      "Content-Security-Policy" : "default-src 'self'",
+      "X-Content-Security-Policy" : "default-src 'self'",
+      "X-WebKit-CSP" : "default-src 'self'",
+      "Cache-Control" : "no-cache, no-store, must-revalidate",
+      "Pragma" : "no-cache",
+      "Expires" : "0",
+      "Access-Control-Allow-Origin" : "*",
+      "Access-Control-Allow-Methods" : "GET, HEAD, OPTIONS",
+      "X-Cache" : "Miss from cloudfront",
+      "Via" : "1.1 444dde5644fa29b8d8dfac109693e2a2.cloudfront.net (CloudFront)",
+      "X-Amz-Cf-Pop" : "VIE50-C2",
+      "X-Amz-Cf-Id" : "DuI71hQObZum2O31Zr8oLQiw022FKnioP4-l-bS6VomqoIILr9AZ4Q=="
+    }
+  },
+  "uuid" : "9cb75fc6-cce4-429c-874c-844e1a909b22",
+  "persistent" : true,
+  "insertionIndex" : 22
+}
\ No newline at end of file
diff --git a/components/camel-xchange/src/test/resources/mappings/ticker01.json b/components/camel-xchange/src/test/resources/mappings/ticker01.json
new file mode 100644
index 00000000000..c068f3bce0a
--- /dev/null
+++ b/components/camel-xchange/src/test/resources/mappings/ticker01.json
@@ -0,0 +1,43 @@
+{
+  "id" : "bc2489dd-b116-4c7a-b991-b36c2721f1a3",
+  "name" : "api_v3_ticker_24hr",
+  "request" : {
+    "url" : "/api/v3/ticker/24hr?symbol=EOSETH",
+    "method" : "GET"
+  },
+  "response" : {
+    "status" : 200,
+    "body" : "{\"symbol\":\"EOSETH\",\"priceChange\":\"0.00000700\",\"priceChangePercent\":\"0.763\",\"weightedAvgPrice\":\"0.00094579\",\"prevClosePrice\":\"0.00091900\",\"lastPrice\":\"0.00092500\",\"lastQty\":\"529.10000000\",\"bidPrice\":\"0.00092500\",\"bidQty\":\"454.60000000\",\"askPrice\":\"0.00092600\",\"askQty\":\"950.30000000\",\"openPrice\":\"0.00091800\",\"highPrice\":\"0.00099000\",\"lowPrice\":\"0.00091200\",\"volume\":\"266500.80000000\",\"quoteVolume\":\"252.05406430\",\ [...]
+    "headers" : {
+      "Content-Type" : "application/json;charset=UTF-8",
+      "Date" : "Tue, 06 Sep 2022 10:44:55 GMT",
+      "Server" : "nginx",
+      "Vary" : "Accept-Encoding",
+      "x-mbx-uuid" : "cc51120c-a2a5-4eb2-9ca0-6f1ce936422a",
+      "x-mbx-used-weight" : "11",
+      "x-mbx-used-weight-1m" : "11",
+      "Strict-Transport-Security" : "max-age=31536000; includeSubdomains",
+      "X-Frame-Options" : "SAMEORIGIN",
+      "X-Xss-Protection" : "1; mode=block",
+      "X-Content-Type-Options" : "nosniff",
+      "Content-Security-Policy" : "default-src 'self'",
+      "X-Content-Security-Policy" : "default-src 'self'",
+      "X-WebKit-CSP" : "default-src 'self'",
+      "Cache-Control" : "no-cache, no-store, must-revalidate",
+      "Pragma" : "no-cache",
+      "Expires" : "0",
+      "Access-Control-Allow-Origin" : "*",
+      "Access-Control-Allow-Methods" : "GET, HEAD, OPTIONS",
+      "X-Cache" : "Miss from cloudfront",
+      "Via" : "1.1 ddcc5754acfb5d436bc0a20046a15158.cloudfront.net (CloudFront)",
+      "X-Amz-Cf-Pop" : "CDG50-C1",
+      "X-Amz-Cf-Id" : "YEKb_39Scv-oVMMFMZGY8hs7Xk8uuKSfAF2P0KexTwRbX83q0B-z3Q=="
+    }
+  },
+  "uuid" : "bc2489dd-b116-4c7a-b991-b36c2721f1a3",
+  "persistent" : true,
+  "scenarioName" : "scenario-1-api-v3-ticker-24hr",
+  "requiredScenarioState" : "Started",
+  "newScenarioState" : "scenario-1-api-v3-ticker-24hr-2",
+  "insertionIndex" : 16
+}
\ No newline at end of file
diff --git a/components/camel-xchange/src/test/resources/mappings/ticker02.json b/components/camel-xchange/src/test/resources/mappings/ticker02.json
new file mode 100644
index 00000000000..acca493868e
--- /dev/null
+++ b/components/camel-xchange/src/test/resources/mappings/ticker02.json
@@ -0,0 +1,42 @@
+{
+  "id" : "c783b5d3-461c-4e0e-9ed9-838a1d134d9e",
+  "name" : "api_v3_ticker_24hr",
+  "request" : {
+    "url" : "/api/v3/ticker/24hr?symbol=EOSETH",
+    "method" : "GET"
+  },
+  "response" : {
+    "status" : 200,
+    "body" : "{\"symbol\":\"EOSETH\",\"priceChange\":\"0.00000700\",\"priceChangePercent\":\"0.763\",\"weightedAvgPrice\":\"0.00094579\",\"prevClosePrice\":\"0.00091900\",\"lastPrice\":\"0.00092500\",\"lastQty\":\"529.10000000\",\"bidPrice\":\"0.00092500\",\"bidQty\":\"454.60000000\",\"askPrice\":\"0.00092600\",\"askQty\":\"1599.30000000\",\"openPrice\":\"0.00091800\",\"highPrice\":\"0.00099000\",\"lowPrice\":\"0.00091200\",\"volume\":\"266500.80000000\",\"quoteVolume\":\"252.05406430\", [...]
+    "headers" : {
+      "Content-Type" : "application/json;charset=UTF-8",
+      "Date" : "Tue, 06 Sep 2022 10:44:55 GMT",
+      "Server" : "nginx",
+      "Vary" : "Accept-Encoding",
+      "x-mbx-uuid" : "e564f738-cb2e-4a33-aea2-43d53c1f9494",
+      "x-mbx-used-weight" : "12",
+      "x-mbx-used-weight-1m" : "12",
+      "Strict-Transport-Security" : "max-age=31536000; includeSubdomains",
+      "X-Frame-Options" : "SAMEORIGIN",
+      "X-Xss-Protection" : "1; mode=block",
+      "X-Content-Type-Options" : "nosniff",
+      "Content-Security-Policy" : "default-src 'self'",
+      "X-Content-Security-Policy" : "default-src 'self'",
+      "X-WebKit-CSP" : "default-src 'self'",
+      "Cache-Control" : "no-cache, no-store, must-revalidate",
+      "Pragma" : "no-cache",
+      "Expires" : "0",
+      "Access-Control-Allow-Origin" : "*",
+      "Access-Control-Allow-Methods" : "GET, HEAD, OPTIONS",
+      "X-Cache" : "Miss from cloudfront",
+      "Via" : "1.1 50bea678ec8eb5af41be54d11f9c4872.cloudfront.net (CloudFront)",
+      "X-Amz-Cf-Pop" : "CDG50-C1",
+      "X-Amz-Cf-Id" : "ETBATVeU45RBl7u4xBtfcRKenJ1X6LjjZkZvlGcl9EC4DDzOTydEIw=="
+    }
+  },
+  "uuid" : "c783b5d3-461c-4e0e-9ed9-838a1d134d9e",
+  "persistent" : true,
+  "scenarioName" : "scenario-1-api-v3-ticker-24hr",
+  "requiredScenarioState" : "scenario-1-api-v3-ticker-24hr-2",
+  "insertionIndex" : 17
+}
\ No newline at end of file
diff --git a/components/camel-xchange/src/test/resources/mappings/tickerBTCUSDT_01.json b/components/camel-xchange/src/test/resources/mappings/tickerBTCUSDT_01.json
new file mode 100644
index 00000000000..29deea7985c
--- /dev/null
+++ b/components/camel-xchange/src/test/resources/mappings/tickerBTCUSDT_01.json
@@ -0,0 +1,40 @@
+{
+  "id" : "407a66b1-4ef0-4905-b279-86bc63e4ba3f",
+  "name" : "api_v3_ticker_24hr",
+  "request" : {
+    "url" : "/api/v3/ticker/24hr?symbol=BTCUSDT",
+    "method" : "GET"
+  },
+  "response" : {
+    "status" : 200,
+    "body" : "{\"symbol\":\"BTCUSDT\",\"priceChange\":\"189.53000000\",\"priceChangePercent\":\"0.958\",\"weightedAvgPrice\":\"19816.85356468\",\"prevClosePrice\":\"19782.48000000\",\"lastPrice\":\"19972.01000000\",\"lastQty\":\"0.00519000\",\"bidPrice\":\"19972.01000000\",\"bidQty\":\"0.00205000\",\"askPrice\":\"19972.59000000\",\"askQty\":\"0.00052000\",\"openPrice\":\"19782.48000000\",\"highPrice\":\"20180.00000000\",\"lowPrice\":\"19633.83000000\",\"volume\":\"266370.69903000\",\"quo [...]
+    "headers" : {
+      "Content-Type" : "application/json;charset=UTF-8",
+      "Date" : "Tue, 06 Sep 2022 08:56:20 GMT",
+      "Server" : "nginx",
+      "Vary" : "Accept-Encoding",
+      "x-mbx-uuid" : "d6348505-0a09-4422-a654-29551f44535f",
+      "x-mbx-used-weight" : "11",
+      "x-mbx-used-weight-1m" : "11",
+      "Strict-Transport-Security" : "max-age=31536000; includeSubdomains",
+      "X-Frame-Options" : "SAMEORIGIN",
+      "X-Xss-Protection" : "1; mode=block",
+      "X-Content-Type-Options" : "nosniff",
+      "Content-Security-Policy" : "default-src 'self'",
+      "X-Content-Security-Policy" : "default-src 'self'",
+      "X-WebKit-CSP" : "default-src 'self'",
+      "Cache-Control" : "no-cache, no-store, must-revalidate",
+      "Pragma" : "no-cache",
+      "Expires" : "0",
+      "Access-Control-Allow-Origin" : "*",
+      "Access-Control-Allow-Methods" : "GET, HEAD, OPTIONS",
+      "X-Cache" : "Miss from cloudfront",
+      "Via" : "1.1 f0f31e95ac261ee02dea9c554605a186.cloudfront.net (CloudFront)",
+      "X-Amz-Cf-Pop" : "LHR61-P4",
+      "X-Amz-Cf-Id" : "EtyxG5Wbcwb664kgyg5wORsJDlROre5w7JwjbODjqYpXFLp8g-k3gg=="
+    }
+  },
+  "uuid" : "407a66b1-4ef0-4905-b279-86bc63e4ba3f",
+  "persistent" : true,
+  "insertionIndex" : 9
+}
\ No newline at end of file