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 2020/11/04 16:43:26 UTC

[camel-quarkus] branch master updated (63a1bf3 -> 5302af6)

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

jamesnetherton pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git.


    from 63a1bf3  Added nagios native support #1726
     new 98c2f39  Fix WireMock server field injection for native tests
     new edb21d5  Discover WireMock mappings from the classpath to keep quarkus-platform happy
     new 8f311be  Stub ServiceNow tests with WireMock
     new 06d0b0a  Stub Slack tests with WireMock
     new b774567  Stub Geocoder tests with WireMock
     new be675db  Add missing geocoder reflective class
     new 5302af6  Stub Telegram tests with WireMock

The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../geocoder/deployment/GeocoderProcessor.java     |   1 +
 .../WireMockTestResourceLifecycleManager.java      |  56 +-
 integration-tests/geocoder/README.adoc             |  10 +
 integration-tests/geocoder/pom.xml                 |   2 +-
 .../geocoder/it/GeocoderGoogleResource.java        |   6 +-
 .../component/geocoder/it/GeocoderProducers.java   |  55 ++
 .../quarkus/component/geocoder/it/Routes.java      | 129 ----
 .../src/main/resources/application.properties      |   8 +-
 .../component/geocoder/it/GeocoderGoogleTest.java  |  25 +-
 .../geocoder/it/GeocoderNominationTest.java        |   2 +
 .../geocoder/it/GeocoderTestResource.java}         |  22 +-
 .../test/resources/__files/mapsApiAddresses.json   | 771 +++++++++++++++++++++
 .../resources/mappings/geocodeGetFromAddress.json  |  28 +
 .../resources/mappings/geocodeGetFromFile.json     |  29 +
 .../resources/mappings/geocodeGetFromLatLng.json   |  28 +
 integration-tests/servicenow/README.adoc           |  10 +
 integration-tests/servicenow/pom.xml               |   5 +
 .../servicenow/it/ServicenowResource.java          |   2 +-
 .../component/servicenow/it/model/Incident.java    |   2 +
 .../src/main/resources/application.properties      |  23 -
 .../component/servicenow/it/ServicenowIT.java      |   4 -
 .../component/servicenow/it/ServicenowTest.java    |   6 +-
 .../servicenow/it/ServicenowTestResource.java}     |  27 +-
 .../mappings/servicenowConfirmDeleteIncident.json  |  29 +
 .../mappings/servicenowCreateIncident.json         |  33 +
 .../mappings/servicenowDeleteIncident.json         |  22 +
 .../resources/mappings/servicenowGetIncident.json  |  30 +
 integration-tests/slack/README.adoc                |  24 +
 integration-tests/slack/pom.xml                    |   4 +
 .../quarkus/component/slack/it/SlackResource.java  |   2 +-
 .../quarkus/component/slack/it/SlackRoutes.java    |  48 --
 .../src/main/resources/application.properties      |  21 -
 .../quarkus/component/slack/it/SlackTest.java      |   7 +-
 .../component/slack/it/SlackTestResource.java}     |  28 +-
 .../test/resources/mappings/slackGetChannels.json  |  37 +
 .../mappings/slackGetConversationHistory.json      |  37 +
 .../resources/mappings/slackWebhookMesagePost.json |  30 +
 integration-tests/telegram/README.adoc             |  16 +-
 integration-tests/telegram/pom.xml                 |   9 +-
 .../component/telegram/it/TelegramResource.java    |   2 +-
 .../component/telegram/it/TelegramRoutes.java      | 110 ---
 .../src/main/resources/application.properties      |  12 +-
 .../mock-messages/editMessageLiveLocation.json     |  24 -
 .../main/resources/mock-messages/getUpdates.json   |  41 --
 .../main/resources/mock-messages/sendAudio.json    |  25 -
 .../main/resources/mock-messages/sendDocument.json |  24 -
 .../main/resources/mock-messages/sendLocation.json |  23 -
 .../main/resources/mock-messages/sendMessage.json  |  20 -
 .../main/resources/mock-messages/sendPhoto.json    |  27 -
 .../main/resources/mock-messages/sendVenue.json    |  31 -
 .../main/resources/mock-messages/sendVideo.json    |  33 -
 .../mock-messages/stopMessageLiveLocation.json     |  24 -
 .../component/telegram/it/TelegramTest.java        |  26 +-
 .../telegram/it/TelegramTestResource.java}         |  26 +-
 .../mappings/telegramEditMessageLiveLocation.json  |  26 +
 .../test/resources/mappings/telegramSendAudio.json |  24 +
 .../resources/mappings/telegramSendDocument.json   |  24 +
 .../resources/mappings/telegramSendLocation.json   |  26 +
 .../resources/mappings/telegramSendMessage.json    |  26 +
 .../test/resources/mappings/telegramSendPhoto.json |  24 +
 .../test/resources/mappings/telegramSendVenue.json |  26 +
 .../test/resources/mappings/telegramSendVideo.json |  24 +
 .../mappings/telegramStopMessageLiveAction.json    |  26 +
 63 files changed, 1581 insertions(+), 721 deletions(-)
 create mode 100644 integration-tests/geocoder/src/main/java/org/apache/camel/quarkus/component/geocoder/it/GeocoderProducers.java
 delete mode 100644 integration-tests/geocoder/src/main/java/org/apache/camel/quarkus/component/geocoder/it/Routes.java
 copy integration-tests/geocoder/src/{main/java/org/apache/camel/quarkus/component/geocoder/it/Country.java => test/java/org/apache/camel/quarkus/component/geocoder/it/GeocoderTestResource.java} (62%)
 create mode 100644 integration-tests/geocoder/src/test/resources/__files/mapsApiAddresses.json
 create mode 100644 integration-tests/geocoder/src/test/resources/mappings/geocodeGetFromAddress.json
 create mode 100644 integration-tests/geocoder/src/test/resources/mappings/geocodeGetFromFile.json
 create mode 100644 integration-tests/geocoder/src/test/resources/mappings/geocodeGetFromLatLng.json
 delete mode 100644 integration-tests/servicenow/src/main/resources/application.properties
 copy integration-tests/{zendesk/src/test/java/org/apache/camel/quarkus/component/zendesk/it/ZendeskTestResource.java => servicenow/src/test/java/org/apache/camel/quarkus/component/servicenow/it/ServicenowTestResource.java} (56%)
 create mode 100644 integration-tests/servicenow/src/test/resources/mappings/servicenowConfirmDeleteIncident.json
 create mode 100644 integration-tests/servicenow/src/test/resources/mappings/servicenowCreateIncident.json
 create mode 100644 integration-tests/servicenow/src/test/resources/mappings/servicenowDeleteIncident.json
 create mode 100644 integration-tests/servicenow/src/test/resources/mappings/servicenowGetIncident.json
 create mode 100644 integration-tests/slack/README.adoc
 delete mode 100644 integration-tests/slack/src/main/java/org/apache/camel/quarkus/component/slack/it/SlackRoutes.java
 delete mode 100644 integration-tests/slack/src/main/resources/application.properties
 copy integration-tests/{zendesk/src/test/java/org/apache/camel/quarkus/component/zendesk/it/ZendeskTestResource.java => slack/src/test/java/org/apache/camel/quarkus/component/slack/it/SlackTestResource.java} (61%)
 create mode 100644 integration-tests/slack/src/test/resources/mappings/slackGetChannels.json
 create mode 100644 integration-tests/slack/src/test/resources/mappings/slackGetConversationHistory.json
 create mode 100644 integration-tests/slack/src/test/resources/mappings/slackWebhookMesagePost.json
 delete mode 100644 integration-tests/telegram/src/main/java/org/apache/camel/quarkus/component/telegram/it/TelegramRoutes.java
 delete mode 100644 integration-tests/telegram/src/main/resources/mock-messages/editMessageLiveLocation.json
 delete mode 100644 integration-tests/telegram/src/main/resources/mock-messages/getUpdates.json
 delete mode 100644 integration-tests/telegram/src/main/resources/mock-messages/sendAudio.json
 delete mode 100644 integration-tests/telegram/src/main/resources/mock-messages/sendDocument.json
 delete mode 100644 integration-tests/telegram/src/main/resources/mock-messages/sendLocation.json
 delete mode 100644 integration-tests/telegram/src/main/resources/mock-messages/sendMessage.json
 delete mode 100644 integration-tests/telegram/src/main/resources/mock-messages/sendPhoto.json
 delete mode 100644 integration-tests/telegram/src/main/resources/mock-messages/sendVenue.json
 delete mode 100644 integration-tests/telegram/src/main/resources/mock-messages/sendVideo.json
 delete mode 100644 integration-tests/telegram/src/main/resources/mock-messages/stopMessageLiveLocation.json
 copy integration-tests/{zendesk/src/test/java/org/apache/camel/quarkus/component/zendesk/it/ZendeskTestResource.java => telegram/src/test/java/org/apache/camel/quarkus/component/telegram/it/TelegramTestResource.java} (53%)
 create mode 100644 integration-tests/telegram/src/test/resources/mappings/telegramEditMessageLiveLocation.json
 create mode 100644 integration-tests/telegram/src/test/resources/mappings/telegramSendAudio.json
 create mode 100644 integration-tests/telegram/src/test/resources/mappings/telegramSendDocument.json
 create mode 100644 integration-tests/telegram/src/test/resources/mappings/telegramSendLocation.json
 create mode 100644 integration-tests/telegram/src/test/resources/mappings/telegramSendMessage.json
 create mode 100644 integration-tests/telegram/src/test/resources/mappings/telegramSendPhoto.json
 create mode 100644 integration-tests/telegram/src/test/resources/mappings/telegramSendVenue.json
 create mode 100644 integration-tests/telegram/src/test/resources/mappings/telegramSendVideo.json
 create mode 100644 integration-tests/telegram/src/test/resources/mappings/telegramStopMessageLiveAction.json


[camel-quarkus] 06/07: Add missing geocoder reflective class

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit be675dbf34e024499b95d20bbdb502c847682e02
Author: James Netherton <ja...@gmail.com>
AuthorDate: Tue Nov 3 10:39:02 2020 +0000

    Add missing geocoder reflective class
---
 .../camel/quarkus/component/geocoder/deployment/GeocoderProcessor.java   | 1 +
 1 file changed, 1 insertion(+)

diff --git a/extensions/geocoder/deployment/src/main/java/org/apache/camel/quarkus/component/geocoder/deployment/GeocoderProcessor.java b/extensions/geocoder/deployment/src/main/java/org/apache/camel/quarkus/component/geocoder/deployment/GeocoderProcessor.java
index c5fbdf1..70de198 100644
--- a/extensions/geocoder/deployment/src/main/java/org/apache/camel/quarkus/component/geocoder/deployment/GeocoderProcessor.java
+++ b/extensions/geocoder/deployment/src/main/java/org/apache/camel/quarkus/component/geocoder/deployment/GeocoderProcessor.java
@@ -50,6 +50,7 @@ class GeocoderProcessor {
         items.add(new ReflectiveClassBuildItem(false, true, "com.google.maps.model.Bounds"));
         items.add(new ReflectiveClassBuildItem(false, true, "com.google.maps.model.LatLng"));
         items.add(new ReflectiveClassBuildItem(false, true, "com.google.maps.model.LocationType"));
+        items.add(new ReflectiveClassBuildItem(false, true, "com.google.maps.model.GeolocationPayload"));
         return items;
     }
 }


[camel-quarkus] 05/07: Stub Geocoder tests with WireMock

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit b774567e890688340dd1d569acac3c657fc81f1e
Author: James Netherton <ja...@gmail.com>
AuthorDate: Tue Nov 3 09:50:58 2020 +0000

    Stub Geocoder tests with WireMock
---
 integration-tests/geocoder/README.adoc             |  10 +
 integration-tests/geocoder/pom.xml                 |   2 +-
 .../geocoder/it/GeocoderGoogleResource.java        |   6 +-
 .../component/geocoder/it/GeocoderProducers.java   |  55 ++
 .../quarkus/component/geocoder/it/Routes.java      | 129 ----
 .../src/main/resources/application.properties      |   8 +-
 .../component/geocoder/it/GeocoderGoogleTest.java  |  25 +-
 .../geocoder/it/GeocoderNominationTest.java        |   2 +
 .../geocoder/it/GeocoderTestResource.java          |  35 +
 .../test/resources/__files/mapsApiAddresses.json   | 771 +++++++++++++++++++++
 .../resources/mappings/geocodeGetFromAddress.json  |  28 +
 .../resources/mappings/geocodeGetFromFile.json     |  29 +
 .../resources/mappings/geocodeGetFromLatLng.json   |  28 +
 13 files changed, 987 insertions(+), 141 deletions(-)

diff --git a/integration-tests/geocoder/README.adoc b/integration-tests/geocoder/README.adoc
index a47b4b2..aa048bc 100644
--- a/integration-tests/geocoder/README.adoc
+++ b/integration-tests/geocoder/README.adoc
@@ -1,5 +1,7 @@
 == Camel Quarkus Geocoder Integration Tests
 
+By default the Geocoder integration tests use WireMock to stub the API interactions.
+
 To run `camel-quarkus-geocoder` integration tests using google maps service, you will need a google cloud https://developers.google.com/maps/documentation/javascript/get-api-key[API key].
 
 Then set the following environment variable:
@@ -8,3 +10,11 @@ Then set the following environment variable:
 ----
 GOOGLE_API_KEY=your-api-id
 ----
+
+If the WireMock stub recordings need updating, then remove the existing files from `src/test/resources/mappings` and run tests with either:
+
+System property `-Dwiremock.record=true`
+
+Or
+
+Set environment variable `WIREMOCK_RECORD=true`
diff --git a/integration-tests/geocoder/pom.xml b/integration-tests/geocoder/pom.xml
index 05e2c98..e882ad3 100644
--- a/integration-tests/geocoder/pom.xml
+++ b/integration-tests/geocoder/pom.xml
@@ -62,7 +62,7 @@
         </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-integration-test-support-mock-backend</artifactId>
+            <artifactId>camel-quarkus-integration-wiremock-support</artifactId>
         </dependency>
 
 
diff --git a/integration-tests/geocoder/src/main/java/org/apache/camel/quarkus/component/geocoder/it/GeocoderGoogleResource.java b/integration-tests/geocoder/src/main/java/org/apache/camel/quarkus/component/geocoder/it/GeocoderGoogleResource.java
index 36c0a47..6db2186 100644
--- a/integration-tests/geocoder/src/main/java/org/apache/camel/quarkus/component/geocoder/it/GeocoderGoogleResource.java
+++ b/integration-tests/geocoder/src/main/java/org/apache/camel/quarkus/component/geocoder/it/GeocoderGoogleResource.java
@@ -46,7 +46,7 @@ public class GeocoderGoogleResource {
         LOG.infof("Retrieve info from current location");
         final GeocodingResult[] response = producerTemplate.requestBody(
                 String.format("geocoder:address:current?apiKey=%s", googleApiKey),
-                "Hello World", GeocodingResult[].class);
+                null, GeocodingResult[].class);
         LOG.infof("Response : %s", response);
         return response;
     }
@@ -57,7 +57,7 @@ public class GeocoderGoogleResource {
         LOG.infof("Retrieve info from address : %s", address);
         final GeocodingResult[] response = producerTemplate.requestBody(
                 String.format("geocoder:address:%s?apiKey=%s", address, googleApiKey),
-                "Hello World", GeocodingResult[].class);
+                null, GeocodingResult[].class);
         LOG.infof("Response: %s", response);
         return response;
     }
@@ -68,7 +68,7 @@ public class GeocoderGoogleResource {
         LOG.infof("Retrieve  info from georgraphic coordinates latitude : %s, longitude %s", latitude, longitude);
         final GeocodingResult[] response = producerTemplate.requestBody(
                 String.format("geocoder:latlng:%s,%s?apiKey=%s", latitude, longitude, googleApiKey),
-                "Hello World", GeocodingResult[].class);
+                null, GeocodingResult[].class);
         LOG.infof("Response : %s", response);
         return response;
     }
diff --git a/integration-tests/geocoder/src/main/java/org/apache/camel/quarkus/component/geocoder/it/GeocoderProducers.java b/integration-tests/geocoder/src/main/java/org/apache/camel/quarkus/component/geocoder/it/GeocoderProducers.java
new file mode 100644
index 0000000..b6f24a3
--- /dev/null
+++ b/integration-tests/geocoder/src/main/java/org/apache/camel/quarkus/component/geocoder/it/GeocoderProducers.java
@@ -0,0 +1,55 @@
+/*
+ * 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.quarkus.component.geocoder.it;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+import io.quarkus.arc.Unremovable;
+import org.apache.camel.CamelContext;
+import org.apache.camel.component.geocoder.GeoCoderComponent;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
+
+@ApplicationScoped
+public class GeocoderProducers {
+
+    @ConfigProperty(name = "google.api.key")
+    String googleApiKey;
+
+    /**
+     * We need to implement some conditional configuration of the {@link GeoCoderComponent} thus we create it
+     * programmatically and publish via CDI.
+     *
+     * @return a configured {@link GeoCoderComponent}
+     */
+    @Produces
+    @ApplicationScoped
+    @Unremovable
+    @Named("geocoder")
+    GeoCoderComponent geocoderComponent(CamelContext camelContext, MockApiService mockApiService)
+            throws IllegalAccessException, NoSuchFieldException, InstantiationException {
+        final String wireMockUrl = System.getProperty("wiremock.url");
+        final GeoCoderComponent result = new GeoCoderComponent();
+        result.setCamelContext(camelContext);
+
+        if (wireMockUrl != null) {
+            result.setGeoApiContext(mockApiService.createGeoApiContext(wireMockUrl, googleApiKey));
+        }
+        return result;
+    }
+}
diff --git a/integration-tests/geocoder/src/main/java/org/apache/camel/quarkus/component/geocoder/it/Routes.java b/integration-tests/geocoder/src/main/java/org/apache/camel/quarkus/component/geocoder/it/Routes.java
deleted file mode 100644
index 3d96cde..0000000
--- a/integration-tests/geocoder/src/main/java/org/apache/camel/quarkus/component/geocoder/it/Routes.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * 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.quarkus.component.geocoder.it;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.inject.Produces;
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import io.quarkus.arc.Unremovable;
-import org.apache.camel.Exchange;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.geocoder.GeoCoderComponent;
-import org.apache.camel.quarkus.test.mock.backend.MockBackendUtils;
-import org.eclipse.microprofile.config.inject.ConfigProperty;
-
-@ApplicationScoped
-public class Routes extends RouteBuilder {
-
-    @ConfigProperty(name = "google.api.key")
-    String googleApiKey;
-    @ConfigProperty(name = "quarkus.http.test-port")
-    int httpTestPort;
-    @ConfigProperty(name = "quarkus.http.port")
-    int httpPort;
-    @Inject
-    MockApiService mockApiService;
-
-    private String getBaseUri() {
-        final boolean isNativeMode = "executable".equals(System.getProperty("org.graalvm.nativeimage.kind"));
-        return "AIzaFakeKey".equals(googleApiKey)
-                ? "http://localhost:" + (isNativeMode ? httpPort : httpTestPort)
-                : "https://maps.googleapis.com";
-    }
-
-    /**
-     * We need to implement some conditional configuration of the {@link GeoCoderComponent} thus we create it
-     * programmatically and publish via CDI.
-     *
-     * @return a configured {@link GeoCoderComponent}
-     */
-    @Produces
-    @ApplicationScoped
-    @Unremovable
-    @Named("geocoder")
-    GeoCoderComponent geocoderComponent() throws IllegalAccessException, NoSuchFieldException, InstantiationException {
-        final GeoCoderComponent result = new GeoCoderComponent();
-        result.setCamelContext(getContext());
-        result.setGeoApiContext(mockApiService.createGeoApiContext(getBaseUri(), googleApiKey));
-        return result;
-    }
-
-    @Override
-    public void configure() throws Exception {
-        if (MockBackendUtils.startMockBackend(true)) {
-            from("platform-http:///maps/api/geocode/json?httpMethodRestrict=GET")
-                    .process(e -> load(createMockGeocodeResponse(), e));
-            from("platform-http:///geolocation/v1/geolocate?httpMethodRestrict=POST")
-                    .process(e -> load(createMockGeolocateResponse(), e));
-        }
-    }
-
-    private String createMockGeolocateResponse() {
-        return "{\n" +
-                "  \"location\": {\n" +
-                "    \"lat\": 71.5388001,\n" +
-                "    \"lng\": -66.885417\n" +
-                "  },\n" +
-                "  \"accuracy\": 578963\n" +
-                "} ";
-    }
-
-    private String createMockGeocodeResponse() {
-        return "{\n"
-                + "   \"results\" : [\n"
-                + "      {\n"
-                + "         \"address_components\" : [\n"
-                + "            {\n"
-                + "               \"long_name\" : \"1600\",\n"
-                + "               \"short_name\" : \"1600\",\n"
-                + "               \"types\" : [ \"street_number\" ]\n"
-                + "            }\n"
-                + "         ],\n"
-                + "         \"formatted_address\" : \"1600 Amphitheatre Parkway, Mountain View, "
-                + "CA 94043, USA\",\n"
-                + "         \"geometry\" : {\n"
-                + "            \"location\" : {\n"
-                + "               \"lat\" : 37.4220033,\n"
-                + "               \"lng\" : -122.0839778\n"
-                + "            },\n"
-                + "            \"location_type\" : \"ROOFTOP\",\n"
-                + "            \"viewport\" : {\n"
-                + "               \"northeast\" : {\n"
-                + "                  \"lat\" : 37.4233522802915,\n"
-                + "                  \"lng\" : -122.0826288197085\n"
-                + "               },\n"
-                + "               \"southwest\" : {\n"
-                + "                  \"lat\" : 37.4206543197085,\n"
-                + "                  \"lng\" : -122.0853267802915\n"
-                + "               }\n"
-                + "            }\n"
-                + "         },\n"
-                + "         \"types\" : [ \"street_address\" ]\n"
-                + "      }\n"
-                + "   ],\n"
-                + "   \"status\" : \"OK\"\n"
-                + "}";
-
-    }
-
-    private void load(String response, Exchange exchange) {
-        exchange.getMessage().setBody(response);
-    }
-
-}
diff --git a/integration-tests/geocoder/src/main/resources/application.properties b/integration-tests/geocoder/src/main/resources/application.properties
index 8668957..d3bb1dc 100644
--- a/integration-tests/geocoder/src/main/resources/application.properties
+++ b/integration-tests/geocoder/src/main/resources/application.properties
@@ -21,13 +21,7 @@
 # add your API KEY to run the examples
 google.api.key=${GOOGLE_API_KEY:AIzaFakeKey}
 
-# You may want to export CAMEL_QUARKUS_START_MOCK_BACKEND=false to avoid starting he the mock Google Maps API
-# to make sure that you test against the real remote Google Maps API
-camel.quarkus.start-mock-backend=true
-
 # this configuration is needed only to mock Google Maps API
 quarkus.index-dependency.gmaps.group-id=com.google.maps
 quarkus.index-dependency.gmaps.artifact-id=google-maps-services
-quarkus.camel.native.reflection.include-patterns=com.google.maps.GeoApiContext$Builder
-
-
+quarkus.camel.native.reflection.include-patterns=com.google.maps.GeoApiContext$Builder
\ No newline at end of file
diff --git a/integration-tests/geocoder/src/test/java/org/apache/camel/quarkus/component/geocoder/it/GeocoderGoogleTest.java b/integration-tests/geocoder/src/test/java/org/apache/camel/quarkus/component/geocoder/it/GeocoderGoogleTest.java
index 673002b..3387faf 100644
--- a/integration-tests/geocoder/src/test/java/org/apache/camel/quarkus/component/geocoder/it/GeocoderGoogleTest.java
+++ b/integration-tests/geocoder/src/test/java/org/apache/camel/quarkus/component/geocoder/it/GeocoderGoogleTest.java
@@ -16,20 +16,43 @@
  */
 package org.apache.camel.quarkus.component.geocoder.it;
 
+import com.github.tomakehurst.wiremock.WireMockServer;
+import io.quarkus.test.common.QuarkusTestResource;
 import io.quarkus.test.common.http.TestHTTPEndpoint;
 import io.quarkus.test.junit.QuarkusTest;
 import io.restassured.RestAssured;
+import org.apache.camel.quarkus.test.wiremock.MockServer;
 import org.junit.jupiter.api.Test;
 
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson;
+import static com.github.tomakehurst.wiremock.client.WireMock.matching;
+import static com.github.tomakehurst.wiremock.client.WireMock.request;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
 import static org.hamcrest.Matchers.hasKey;
 
 @QuarkusTest
 @TestHTTPEndpoint(GeocoderGoogleResource.class)
+@QuarkusTestResource(GeocoderTestResource.class)
 class GeocoderGoogleTest {
 
+    @MockServer
+    WireMockServer server;
+
     @Test
     public void loadCurrentLocation() {
-        // disable test if no API KEY
+        // We need to manually stub this API call because it invokes multiple API targets:
+        // - googleapis.com
+        // - maps.googleapis.com
+        if (server != null) {
+            server.stubFor(request("POST", urlPathEqualTo("/geolocation/v1/geolocate"))
+                    .withQueryParam("key", matching(".*"))
+                    .withRequestBody(equalToJson("{\"considerIp\": true}"))
+                    .willReturn(aResponse()
+                            .withHeader("Content-Type", "application/json")
+                            .withBody("{\"location\":{\"lat\":24.7768404,\"lng\":-76.2849047},\"accuracy\":8252}")));
+        }
+
         RestAssured.get()
                 .then()
                 .statusCode(200)
diff --git a/integration-tests/geocoder/src/test/java/org/apache/camel/quarkus/component/geocoder/it/GeocoderNominationTest.java b/integration-tests/geocoder/src/test/java/org/apache/camel/quarkus/component/geocoder/it/GeocoderNominationTest.java
index f3cd27c..b01962a 100644
--- a/integration-tests/geocoder/src/test/java/org/apache/camel/quarkus/component/geocoder/it/GeocoderNominationTest.java
+++ b/integration-tests/geocoder/src/test/java/org/apache/camel/quarkus/component/geocoder/it/GeocoderNominationTest.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.quarkus.component.geocoder.it;
 
+import io.quarkus.test.common.QuarkusTestResource;
 import io.quarkus.test.common.http.TestHTTPEndpoint;
 import io.quarkus.test.junit.QuarkusTest;
 import io.restassured.RestAssured;
@@ -25,6 +26,7 @@ import static org.hamcrest.Matchers.equalTo;
 
 @QuarkusTest
 @TestHTTPEndpoint(GeocoderNominationResource.class)
+@QuarkusTestResource(GeocoderTestResource.class)
 public class GeocoderNominationTest {
 
     @Test
diff --git a/integration-tests/geocoder/src/test/java/org/apache/camel/quarkus/component/geocoder/it/GeocoderTestResource.java b/integration-tests/geocoder/src/test/java/org/apache/camel/quarkus/component/geocoder/it/GeocoderTestResource.java
new file mode 100644
index 0000000..260e9c4
--- /dev/null
+++ b/integration-tests/geocoder/src/test/java/org/apache/camel/quarkus/component/geocoder/it/GeocoderTestResource.java
@@ -0,0 +1,35 @@
+/*
+ * 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.quarkus.component.geocoder.it;
+
+import org.apache.camel.quarkus.test.wiremock.WireMockTestResourceLifecycleManager;
+
+public class GeocoderTestResource extends WireMockTestResourceLifecycleManager {
+
+    private static final String GOOGLE_API_BASE_URL = "https://maps.googleapis.com/";
+    private static final String GOOGLE_API_ENV_KEY = "GOOGLE_API_KEY";
+
+    @Override
+    protected String getRecordTargetBaseUrl() {
+        return GOOGLE_API_BASE_URL;
+    }
+
+    @Override
+    protected boolean isMockingEnabled() {
+        return !envVarsPresent(GOOGLE_API_ENV_KEY);
+    }
+}
diff --git a/integration-tests/geocoder/src/test/resources/__files/mapsApiAddresses.json b/integration-tests/geocoder/src/test/resources/__files/mapsApiAddresses.json
new file mode 100644
index 0000000..8a3c552
--- /dev/null
+++ b/integration-tests/geocoder/src/test/resources/__files/mapsApiAddresses.json
@@ -0,0 +1,771 @@
+{
+   "plus_code" : {
+      "compound_code" : "P27Q+MC New York, NY, USA",
+      "global_code" : "87G8P27Q+MC"
+   },
+   "results" : [
+      {
+         "address_components" : [
+            {
+               "long_name" : "277",
+               "short_name" : "277",
+               "types" : [ "street_number" ]
+            },
+            {
+               "long_name" : "Bedford Avenue",
+               "short_name" : "Bedford Ave",
+               "types" : [ "route" ]
+            },
+            {
+               "long_name" : "Williamsburg",
+               "short_name" : "Williamsburg",
+               "types" : [ "neighborhood", "political" ]
+            },
+            {
+               "long_name" : "Brooklyn",
+               "short_name" : "Brooklyn",
+               "types" : [ "political", "sublocality", "sublocality_level_1" ]
+            },
+            {
+               "long_name" : "Kings County",
+               "short_name" : "Kings County",
+               "types" : [ "administrative_area_level_2", "political" ]
+            },
+            {
+               "long_name" : "New York",
+               "short_name" : "NY",
+               "types" : [ "administrative_area_level_1", "political" ]
+            },
+            {
+               "long_name" : "United States",
+               "short_name" : "US",
+               "types" : [ "country", "political" ]
+            },
+            {
+               "long_name" : "11211",
+               "short_name" : "11211",
+               "types" : [ "postal_code" ]
+            }
+         ],
+         "formatted_address" : "277 Bedford Ave, Brooklyn, NY 11211, USA",
+         "geometry" : {
+            "location" : {
+               "lat" : 40.7142205,
+               "lng" : -73.9612903
+            },
+            "location_type" : "ROOFTOP",
+            "viewport" : {
+               "northeast" : {
+                  "lat" : 40.71556948029149,
+                  "lng" : -73.95994131970849
+               },
+               "southwest" : {
+                  "lat" : 40.7128715197085,
+                  "lng" : -73.9626392802915
+               }
+            }
+         },
+         "place_id" : "ChIJd8BlQ2BZwokRAFUEcm_qrcA",
+         "plus_code" : {
+            "compound_code" : "P27Q+MF New York, NY, USA",
+            "global_code" : "87G8P27Q+MF"
+         },
+         "types" : [ "street_address" ]
+      },
+      {
+         "address_components" : [
+            {
+               "long_name" : "279",
+               "short_name" : "279",
+               "types" : [ "street_number" ]
+            },
+            {
+               "long_name" : "Bedford Avenue",
+               "short_name" : "Bedford Ave",
+               "types" : [ "route" ]
+            },
+            {
+               "long_name" : "Williamsburg",
+               "short_name" : "Williamsburg",
+               "types" : [ "neighborhood", "political" ]
+            },
+            {
+               "long_name" : "Brooklyn",
+               "short_name" : "Brooklyn",
+               "types" : [ "political", "sublocality", "sublocality_level_1" ]
+            },
+            {
+               "long_name" : "Kings County",
+               "short_name" : "Kings County",
+               "types" : [ "administrative_area_level_2", "political" ]
+            },
+            {
+               "long_name" : "New York",
+               "short_name" : "NY",
+               "types" : [ "administrative_area_level_1", "political" ]
+            },
+            {
+               "long_name" : "United States",
+               "short_name" : "US",
+               "types" : [ "country", "political" ]
+            },
+            {
+               "long_name" : "11211",
+               "short_name" : "11211",
+               "types" : [ "postal_code" ]
+            },
+            {
+               "long_name" : "4203",
+               "short_name" : "4203",
+               "types" : [ "postal_code_suffix" ]
+            }
+         ],
+         "formatted_address" : "279 Bedford Ave, Brooklyn, NY 11211, USA",
+         "geometry" : {
+            "bounds" : {
+               "northeast" : {
+                  "lat" : 40.7142628,
+                  "lng" : -73.96121309999999
+               },
+               "southwest" : {
+                  "lat" : 40.7141534,
+                  "lng" : -73.9613792
+               }
+            },
+            "location" : {
+               "lat" : 40.7142015,
+               "lng" : -73.96130769999999
+            },
+            "location_type" : "ROOFTOP",
+            "viewport" : {
+               "northeast" : {
+                  "lat" : 40.7155570802915,
+                  "lng" : -73.95994716970849
+               },
+               "southwest" : {
+                  "lat" : 40.7128591197085,
+                  "lng" : -73.96264513029149
+               }
+            }
+         },
+         "place_id" : "ChIJRYYERGBZwokRAM4n1GlcYX4",
+         "types" : [ "premise" ]
+      },
+      {
+         "address_components" : [
+            {
+               "long_name" : "279",
+               "short_name" : "279",
+               "types" : [ "street_number" ]
+            },
+            {
+               "long_name" : "Bedford Avenue",
+               "short_name" : "Bedford Ave",
+               "types" : [ "route" ]
+            },
+            {
+               "long_name" : "Williamsburg",
+               "short_name" : "Williamsburg",
+               "types" : [ "neighborhood", "political" ]
+            },
+            {
+               "long_name" : "Brooklyn",
+               "short_name" : "Brooklyn",
+               "types" : [ "political", "sublocality", "sublocality_level_1" ]
+            },
+            {
+               "long_name" : "Kings County",
+               "short_name" : "Kings County",
+               "types" : [ "administrative_area_level_2", "political" ]
+            },
+            {
+               "long_name" : "New York",
+               "short_name" : "NY",
+               "types" : [ "administrative_area_level_1", "political" ]
+            },
+            {
+               "long_name" : "United States",
+               "short_name" : "US",
+               "types" : [ "country", "political" ]
+            },
+            {
+               "long_name" : "11211",
+               "short_name" : "11211",
+               "types" : [ "postal_code" ]
+            }
+         ],
+         "formatted_address" : "279 Bedford Ave, Brooklyn, NY 11211, USA",
+         "geometry" : {
+            "location" : {
+               "lat" : 40.7142077,
+               "lng" : -73.96131149999999
+            },
+            "location_type" : "ROOFTOP",
+            "viewport" : {
+               "northeast" : {
+                  "lat" : 40.7155566802915,
+                  "lng" : -73.9599625197085
+               },
+               "southwest" : {
+                  "lat" : 40.7128587197085,
+                  "lng" : -73.9626604802915
+               }
+            }
+         },
+         "place_id" : "ChIJT2x8Q2BZwokRpBu2jUzX3dE",
+         "plus_code" : {
+            "compound_code" : "P27Q+MF New York, NY, USA",
+            "global_code" : "87G8P27Q+MF"
+         },
+         "types" : [
+            "bakery",
+            "cafe",
+            "establishment",
+            "food",
+            "point_of_interest",
+            "store"
+         ]
+      },
+      {
+         "address_components" : [
+            {
+               "long_name" : "291-275",
+               "short_name" : "291-275",
+               "types" : [ "street_number" ]
+            },
+            {
+               "long_name" : "Bedford Avenue",
+               "short_name" : "Bedford Ave",
+               "types" : [ "route" ]
+            },
+            {
+               "long_name" : "Williamsburg",
+               "short_name" : "Williamsburg",
+               "types" : [ "neighborhood", "political" ]
+            },
+            {
+               "long_name" : "Brooklyn",
+               "short_name" : "Brooklyn",
+               "types" : [ "political", "sublocality", "sublocality_level_1" ]
+            },
+            {
+               "long_name" : "Kings County",
+               "short_name" : "Kings County",
+               "types" : [ "administrative_area_level_2", "political" ]
+            },
+            {
+               "long_name" : "New York",
+               "short_name" : "NY",
+               "types" : [ "administrative_area_level_1", "political" ]
+            },
+            {
+               "long_name" : "United States",
+               "short_name" : "US",
+               "types" : [ "country", "political" ]
+            },
+            {
+               "long_name" : "11211",
+               "short_name" : "11211",
+               "types" : [ "postal_code" ]
+            }
+         ],
+         "formatted_address" : "291-275 Bedford Ave, Brooklyn, NY 11211, USA",
+         "geometry" : {
+            "bounds" : {
+               "northeast" : {
+                  "lat" : 40.7145065,
+                  "lng" : -73.9612923
+               },
+               "southwest" : {
+                  "lat" : 40.7139055,
+                  "lng" : -73.96168349999999
+               }
+            },
+            "location" : {
+               "lat" : 40.7142045,
+               "lng" : -73.9614845
+            },
+            "location_type" : "GEOMETRIC_CENTER",
+            "viewport" : {
+               "northeast" : {
+                  "lat" : 40.7155549802915,
+                  "lng" : -73.96013891970848
+               },
+               "southwest" : {
+                  "lat" : 40.7128570197085,
+                  "lng" : -73.96283688029149
+               }
+            }
+         },
+         "place_id" : "ChIJ8ThWRGBZwokR3E1zUisk3LU",
+         "types" : [ "route" ]
+      },
+      {
+         "address_components" : [
+            {
+               "long_name" : "South Williamsburg",
+               "short_name" : "South Williamsburg",
+               "types" : [ "neighborhood", "political" ]
+            },
+            {
+               "long_name" : "Brooklyn",
+               "short_name" : "Brooklyn",
+               "types" : [ "political", "sublocality", "sublocality_level_1" ]
+            },
+            {
+               "long_name" : "Kings County",
+               "short_name" : "Kings County",
+               "types" : [ "administrative_area_level_2", "political" ]
+            },
+            {
+               "long_name" : "New York",
+               "short_name" : "NY",
+               "types" : [ "administrative_area_level_1", "political" ]
+            },
+            {
+               "long_name" : "United States",
+               "short_name" : "US",
+               "types" : [ "country", "political" ]
+            }
+         ],
+         "formatted_address" : "South Williamsburg, Brooklyn, NY, USA",
+         "geometry" : {
+            "bounds" : {
+               "northeast" : {
+                  "lat" : 40.7167119,
+                  "lng" : -73.9420904
+               },
+               "southwest" : {
+                  "lat" : 40.6984866,
+                  "lng" : -73.9699432
+               }
+            },
+            "location" : {
+               "lat" : 40.7043921,
+               "lng" : -73.9565551
+            },
+            "location_type" : "APPROXIMATE",
+            "viewport" : {
+               "northeast" : {
+                  "lat" : 40.7167119,
+                  "lng" : -73.9420904
+               },
+               "southwest" : {
+                  "lat" : 40.6984866,
+                  "lng" : -73.9699432
+               }
+            }
+         },
+         "place_id" : "ChIJR3_ODdlbwokRYtN19kNtcuk",
+         "types" : [ "neighborhood", "political" ]
+      },
+      {
+         "address_components" : [
+            {
+               "long_name" : "11211",
+               "short_name" : "11211",
+               "types" : [ "postal_code" ]
+            },
+            {
+               "long_name" : "Brooklyn",
+               "short_name" : "Brooklyn",
+               "types" : [ "political", "sublocality", "sublocality_level_1" ]
+            },
+            {
+               "long_name" : "New York",
+               "short_name" : "New York",
+               "types" : [ "locality", "political" ]
+            },
+            {
+               "long_name" : "New York",
+               "short_name" : "NY",
+               "types" : [ "administrative_area_level_1", "political" ]
+            },
+            {
+               "long_name" : "United States",
+               "short_name" : "US",
+               "types" : [ "country", "political" ]
+            }
+         ],
+         "formatted_address" : "Brooklyn, NY 11211, USA",
+         "geometry" : {
+            "bounds" : {
+               "northeast" : {
+                  "lat" : 40.7280089,
+                  "lng" : -73.9207299
+               },
+               "southwest" : {
+                  "lat" : 40.7008331,
+                  "lng" : -73.9644697
+               }
+            },
+            "location" : {
+               "lat" : 40.7093358,
+               "lng" : -73.9565551
+            },
+            "location_type" : "APPROXIMATE",
+            "viewport" : {
+               "northeast" : {
+                  "lat" : 40.7280089,
+                  "lng" : -73.9207299
+               },
+               "southwest" : {
+                  "lat" : 40.7008331,
+                  "lng" : -73.9644697
+               }
+            }
+         },
+         "place_id" : "ChIJvbEjlVdZwokR4KapM3WCFRw",
+         "types" : [ "postal_code" ]
+      },
+      {
+         "address_components" : [
+            {
+               "long_name" : "Williamsburg",
+               "short_name" : "Williamsburg",
+               "types" : [ "neighborhood", "political" ]
+            },
+            {
+               "long_name" : "Brooklyn",
+               "short_name" : "Brooklyn",
+               "types" : [ "political", "sublocality", "sublocality_level_1" ]
+            },
+            {
+               "long_name" : "Kings County",
+               "short_name" : "Kings County",
+               "types" : [ "administrative_area_level_2", "political" ]
+            },
+            {
+               "long_name" : "New York",
+               "short_name" : "NY",
+               "types" : [ "administrative_area_level_1", "political" ]
+            },
+            {
+               "long_name" : "United States",
+               "short_name" : "US",
+               "types" : [ "country", "political" ]
+            }
+         ],
+         "formatted_address" : "Williamsburg, Brooklyn, NY, USA",
+         "geometry" : {
+            "bounds" : {
+               "northeast" : {
+                  "lat" : 40.7251773,
+                  "lng" : -73.936498
+               },
+               "southwest" : {
+                  "lat" : 40.6979329,
+                  "lng" : -73.96984499999999
+               }
+            },
+            "location" : {
+               "lat" : 40.7081156,
+               "lng" : -73.9570696
+            },
+            "location_type" : "APPROXIMATE",
+            "viewport" : {
+               "northeast" : {
+                  "lat" : 40.7251773,
+                  "lng" : -73.936498
+               },
+               "southwest" : {
+                  "lat" : 40.6979329,
+                  "lng" : -73.96984499999999
+               }
+            }
+         },
+         "place_id" : "ChIJQSrBBv1bwokRbNfFHCnyeYI",
+         "types" : [ "neighborhood", "political" ]
+      },
+      {
+         "address_components" : [
+            {
+               "long_name" : "Brooklyn",
+               "short_name" : "Brooklyn",
+               "types" : [ "political", "sublocality", "sublocality_level_1" ]
+            },
+            {
+               "long_name" : "Kings County",
+               "short_name" : "Kings County",
+               "types" : [ "administrative_area_level_2", "political" ]
+            },
+            {
+               "long_name" : "New York",
+               "short_name" : "NY",
+               "types" : [ "administrative_area_level_1", "political" ]
+            },
+            {
+               "long_name" : "United States",
+               "short_name" : "US",
+               "types" : [ "country", "political" ]
+            }
+         ],
+         "formatted_address" : "Brooklyn, NY, USA",
+         "geometry" : {
+            "bounds" : {
+               "northeast" : {
+                  "lat" : 40.739446,
+                  "lng" : -73.83336509999999
+               },
+               "southwest" : {
+                  "lat" : 40.551042,
+                  "lng" : -74.05663
+               }
+            },
+            "location" : {
+               "lat" : 40.6781784,
+               "lng" : -73.94415789999999
+            },
+            "location_type" : "APPROXIMATE",
+            "viewport" : {
+               "northeast" : {
+                  "lat" : 40.739446,
+                  "lng" : -73.83336509999999
+               },
+               "southwest" : {
+                  "lat" : 40.551042,
+                  "lng" : -74.05663
+               }
+            }
+         },
+         "place_id" : "ChIJCSF8lBZEwokRhngABHRcdoI",
+         "types" : [ "political", "sublocality", "sublocality_level_1" ]
+      },
+      {
+         "address_components" : [
+            {
+               "long_name" : "Kings County",
+               "short_name" : "Kings County",
+               "types" : [ "administrative_area_level_2", "political" ]
+            },
+            {
+               "long_name" : "Brooklyn",
+               "short_name" : "Brooklyn",
+               "types" : [ "political", "sublocality", "sublocality_level_1" ]
+            },
+            {
+               "long_name" : "New York",
+               "short_name" : "NY",
+               "types" : [ "administrative_area_level_1", "political" ]
+            },
+            {
+               "long_name" : "United States",
+               "short_name" : "US",
+               "types" : [ "country", "political" ]
+            }
+         ],
+         "formatted_address" : "Kings County, Brooklyn, NY, USA",
+         "geometry" : {
+            "bounds" : {
+               "northeast" : {
+                  "lat" : 40.739446,
+                  "lng" : -73.83336509999999
+               },
+               "southwest" : {
+                  "lat" : 40.551042,
+                  "lng" : -74.05663
+               }
+            },
+            "location" : {
+               "lat" : 40.6528762,
+               "lng" : -73.95949399999999
+            },
+            "location_type" : "APPROXIMATE",
+            "viewport" : {
+               "northeast" : {
+                  "lat" : 40.739446,
+                  "lng" : -73.83336509999999
+               },
+               "southwest" : {
+                  "lat" : 40.551042,
+                  "lng" : -74.05663
+               }
+            }
+         },
+         "place_id" : "ChIJOwE7_GTtwokRs75rhW4_I6M",
+         "types" : [ "administrative_area_level_2", "political" ]
+      },
+      {
+         "address_components" : [
+            {
+               "long_name" : "New York",
+               "short_name" : "New York",
+               "types" : [ "locality", "political" ]
+            },
+            {
+               "long_name" : "New York",
+               "short_name" : "NY",
+               "types" : [ "administrative_area_level_1", "political" ]
+            },
+            {
+               "long_name" : "United States",
+               "short_name" : "US",
+               "types" : [ "country", "political" ]
+            }
+         ],
+         "formatted_address" : "New York, NY, USA",
+         "geometry" : {
+            "bounds" : {
+               "northeast" : {
+                  "lat" : 40.9175771,
+                  "lng" : -73.70027209999999
+               },
+               "southwest" : {
+                  "lat" : 40.4773991,
+                  "lng" : -74.25908989999999
+               }
+            },
+            "location" : {
+               "lat" : 40.7127753,
+               "lng" : -74.0059728
+            },
+            "location_type" : "APPROXIMATE",
+            "viewport" : {
+               "northeast" : {
+                  "lat" : 40.9175771,
+                  "lng" : -73.70027209999999
+               },
+               "southwest" : {
+                  "lat" : 40.4773991,
+                  "lng" : -74.25908989999999
+               }
+            }
+         },
+         "place_id" : "ChIJOwg_06VPwokRYv534QaPC8g",
+         "types" : [ "locality", "political" ]
+      },
+      {
+         "address_components" : [
+            {
+               "long_name" : "Long Island",
+               "short_name" : "Long Island",
+               "types" : [ "establishment", "natural_feature" ]
+            },
+            {
+               "long_name" : "New York",
+               "short_name" : "NY",
+               "types" : [ "administrative_area_level_1", "political" ]
+            },
+            {
+               "long_name" : "United States",
+               "short_name" : "US",
+               "types" : [ "country", "political" ]
+            }
+         ],
+         "formatted_address" : "Long Island, New York, USA",
+         "geometry" : {
+            "bounds" : {
+               "northeast" : {
+                  "lat" : 41.1612401,
+                  "lng" : -71.85620109999999
+               },
+               "southwest" : {
+                  "lat" : 40.5429789,
+                  "lng" : -74.0419497
+               }
+            },
+            "location" : {
+               "lat" : 40.789142,
+               "lng" : -73.13496099999999
+            },
+            "location_type" : "APPROXIMATE",
+            "viewport" : {
+               "northeast" : {
+                  "lat" : 41.1612401,
+                  "lng" : -71.85620109999999
+               },
+               "southwest" : {
+                  "lat" : 40.5429789,
+                  "lng" : -74.0419497
+               }
+            }
+         },
+         "place_id" : "ChIJy6Xu4VRE6IkRGA2UhmH59x0",
+         "types" : [ "establishment", "natural_feature" ]
+      },
+      {
+         "address_components" : [
+            {
+               "long_name" : "New York",
+               "short_name" : "NY",
+               "types" : [ "administrative_area_level_1", "political" ]
+            },
+            {
+               "long_name" : "United States",
+               "short_name" : "US",
+               "types" : [ "country", "political" ]
+            }
+         ],
+         "formatted_address" : "New York, USA",
+         "geometry" : {
+            "bounds" : {
+               "northeast" : {
+                  "lat" : 45.015861,
+                  "lng" : -71.777491
+               },
+               "southwest" : {
+                  "lat" : 40.4773991,
+                  "lng" : -79.7625901
+               }
+            },
+            "location" : {
+               "lat" : 43.2994285,
+               "lng" : -74.21793260000001
+            },
+            "location_type" : "APPROXIMATE",
+            "viewport" : {
+               "northeast" : {
+                  "lat" : 45.015861,
+                  "lng" : -71.777491
+               },
+               "southwest" : {
+                  "lat" : 40.4773991,
+                  "lng" : -79.7625901
+               }
+            }
+         },
+         "place_id" : "ChIJqaUj8fBLzEwRZ5UY3sHGz90",
+         "types" : [ "administrative_area_level_1", "political" ]
+      },
+      {
+         "address_components" : [
+            {
+               "long_name" : "United States",
+               "short_name" : "US",
+               "types" : [ "country", "political" ]
+            }
+         ],
+         "formatted_address" : "United States",
+         "geometry" : {
+            "bounds" : {
+               "northeast" : {
+                  "lat" : 71.5388001,
+                  "lng" : -66.885417
+               },
+               "southwest" : {
+                  "lat" : 18.7763,
+                  "lng" : 170.5957
+               }
+            },
+            "location" : {
+               "lat" : 37.09024,
+               "lng" : -95.712891
+            },
+            "location_type" : "APPROXIMATE",
+            "viewport" : {
+               "northeast" : {
+                  "lat" : 71.5388001,
+                  "lng" : -66.885417
+               },
+               "southwest" : {
+                  "lat" : 18.7763,
+                  "lng" : 170.5957
+               }
+            }
+         },
+         "place_id" : "ChIJCzYy5IS16lQRQrfeQ5K5Oxw",
+         "types" : [ "country", "political" ]
+      }
+   ],
+   "status" : "OK"
+}
diff --git a/integration-tests/geocoder/src/test/resources/mappings/geocodeGetFromAddress.json b/integration-tests/geocoder/src/test/resources/mappings/geocodeGetFromAddress.json
new file mode 100644
index 0000000..4881c65
--- /dev/null
+++ b/integration-tests/geocoder/src/test/resources/mappings/geocodeGetFromAddress.json
@@ -0,0 +1,28 @@
+{
+  "id" : "09aa79df-8a19-41df-8655-e414d390d6eb",
+  "name" : "maps_api_geocode_json",
+  "request" : {
+    "url" : "/maps/api/geocode/json?key=AIzaFakeKey&address=calle+marie+curie%2C+sevilla%2C+sevilla",
+    "method" : "GET"
+  },
+  "response" : {
+    "status" : 200,
+    "body" : "{\n   \"results\" : [\n      {\n         \"address_components\" : [\n            {\n               \"long_name\" : \"Calle Marie Curie\",\n               \"short_name\" : \"Calle Marie Curie\",\n               \"types\" : [ \"route\" ]\n            },\n            {\n               \"long_name\" : \"Sevilla\",\n               \"short_name\" : \"Sevilla\",\n               \"types\" : [ \"locality\", \"political\" ]\n            },\n            {\n               \"long_name\" [...]
+    "headers" : {
+      "Content-Type" : "application/json; charset=UTF-8",
+      "Date" : "Tue, 03 Nov 2020 09:39:11 GMT",
+      "Pragma" : "no-cache",
+      "Expires" : "Fri, 01 Jan 1990 00:00:00 GMT",
+      "Cache-Control" : "no-cache, must-revalidate",
+      "Vary" : "Accept-Language",
+      "Server" : "mafe",
+      "X-XSS-Protection" : "0",
+      "X-Frame-Options" : "SAMEORIGIN",
+      "Server-Timing" : "gfet4t7; dur=263",
+      "Alt-Svc" : "h3-Q050=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-T050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\""
+    }
+  },
+  "uuid" : "09aa79df-8a19-41df-8655-e414d390d6eb",
+  "persistent" : true,
+  "insertionIndex" : 2
+}
\ No newline at end of file
diff --git a/integration-tests/geocoder/src/test/resources/mappings/geocodeGetFromFile.json b/integration-tests/geocoder/src/test/resources/mappings/geocodeGetFromFile.json
new file mode 100644
index 0000000..383e19f
--- /dev/null
+++ b/integration-tests/geocoder/src/test/resources/mappings/geocodeGetFromFile.json
@@ -0,0 +1,29 @@
+{
+  "id" : "01626380-6d65-4cdb-8080-4e7b8c3565e4",
+  "name" : "maps_api_geocode_json",
+  "request" : {
+    "url" : "/maps/api/geocode/json?key=AIzaFakeKey&latlng=40.71422400%2C-73.96145200",
+    "method" : "GET"
+  },
+  "response" : {
+    "status" : 200,
+    "bodyFileName" : "mapsApiAddresses.json",
+    "headers" : {
+      "Content-Type" : "application/json; charset=UTF-8",
+      "Date" : "Tue, 03 Nov 2020 09:39:12 GMT",
+      "Pragma" : "no-cache",
+      "Expires" : "Fri, 01 Jan 1990 00:00:00 GMT",
+      "Cache-Control" : "no-cache, must-revalidate",
+      "Vary" : "Accept-Language",
+      "X-Goog-Maps-Metro-Area" : "New York, NY",
+      "Server" : "mafe",
+      "X-XSS-Protection" : "0",
+      "X-Frame-Options" : "SAMEORIGIN",
+      "Server-Timing" : "gfet4t7; dur=44",
+      "Alt-Svc" : "h3-Q050=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-T050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\""
+    }
+  },
+  "uuid" : "01626380-6d65-4cdb-8080-4e7b8c3565e4",
+  "persistent" : true,
+  "insertionIndex" : 3
+}
\ No newline at end of file
diff --git a/integration-tests/geocoder/src/test/resources/mappings/geocodeGetFromLatLng.json b/integration-tests/geocoder/src/test/resources/mappings/geocodeGetFromLatLng.json
new file mode 100644
index 0000000..3f9e959
--- /dev/null
+++ b/integration-tests/geocoder/src/test/resources/mappings/geocodeGetFromLatLng.json
@@ -0,0 +1,28 @@
+{
+  "id" : "93b092b6-d2d4-485c-b9a8-a1e4625e343a",
+  "name" : "maps_api_geocode_json",
+  "request" : {
+    "url" : "/maps/api/geocode/json?key=AIzaFakeKey&latlng=24.77684040%2C-76.28490470",
+    "method" : "GET"
+  },
+  "response" : {
+    "status" : 200,
+    "body" : "{\n   \"plus_code\" : {\n      \"compound_code\" : \"QPG8+P2 Freetown, The Bahamas\",\n      \"global_code\" : \"77P5QPG8+P2\"\n   },\n   \"results\" : [\n      {\n         \"address_components\" : [\n            {\n               \"long_name\" : \"Unnamed Road\",\n               \"short_name\" : \"Unnamed Road\",\n               \"types\" : [ \"route\" ]\n            },\n            {\n               \"long_name\" : \"Freetown\",\n               \"short_name\" : \"Freetown [...]
+    "headers" : {
+      "Content-Type" : "application/json; charset=UTF-8",
+      "Date" : "Tue, 03 Nov 2020 09:39:12 GMT",
+      "Pragma" : "no-cache",
+      "Expires" : "Fri, 01 Jan 1990 00:00:00 GMT",
+      "Cache-Control" : "no-cache, must-revalidate",
+      "Vary" : "Accept-Language",
+      "Server" : "mafe",
+      "X-XSS-Protection" : "0",
+      "X-Frame-Options" : "SAMEORIGIN",
+      "Server-Timing" : "gfet4t7; dur=45",
+      "Alt-Svc" : "h3-Q050=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-T050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\""
+    }
+  },
+  "uuid" : "93b092b6-d2d4-485c-b9a8-a1e4625e343a",
+  "persistent" : true,
+  "insertionIndex" : 4
+}
\ No newline at end of file


[camel-quarkus] 02/07: Discover WireMock mappings from the classpath to keep quarkus-platform happy

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit edb21d583208ac4d602989d6c6ee0bfa5ad1eb9b
Author: James Netherton <ja...@gmail.com>
AuthorDate: Wed Nov 4 11:59:20 2020 +0000

    Discover WireMock mappings from the classpath to keep quarkus-platform happy
---
 .../WireMockTestResourceLifecycleManager.java        | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/integration-tests-support/wiremock/src/main/java/org/apache/camel/quarkus/test/wiremock/WireMockTestResourceLifecycleManager.java b/integration-tests-support/wiremock/src/main/java/org/apache/camel/quarkus/test/wiremock/WireMockTestResourceLifecycleManager.java
index 5308534..6086b6d 100644
--- a/integration-tests-support/wiremock/src/main/java/org/apache/camel/quarkus/test/wiremock/WireMockTestResourceLifecycleManager.java
+++ b/integration-tests-support/wiremock/src/main/java/org/apache/camel/quarkus/test/wiremock/WireMockTestResourceLifecycleManager.java
@@ -26,6 +26,8 @@ import java.util.List;
 import java.util.Map;
 
 import com.github.tomakehurst.wiremock.WireMockServer;
+import com.github.tomakehurst.wiremock.common.ClasspathFileSource;
+import com.github.tomakehurst.wiremock.common.FileSource;
 import com.github.tomakehurst.wiremock.recording.RecordingStatus;
 import com.github.tomakehurst.wiremock.recording.SnapshotRecordResult;
 import com.github.tomakehurst.wiremock.stubbing.StubMapping;
@@ -200,7 +202,9 @@ public abstract class WireMockTestResourceLifecycleManager implements QuarkusTes
     private WireMockServer createServer() {
         LOG.info("Starting WireMockServer");
         MockBackendUtils.startMockBackend(true);
-        return new WireMockServer(options().dynamicPort());
+        return new WireMockServer(options()
+                .dynamicPort()
+                .fileSource(new CamelQuarkusFileSource()));
     }
 
     /**
@@ -212,4 +216,18 @@ public abstract class WireMockTestResourceLifecycleManager implements QuarkusTes
         String recordEnabled = System.getProperty("wiremock.record", System.getenv("WIREMOCK_RECORD"));
         return recordEnabled != null && recordEnabled.equals("true");
     }
+
+    /**
+     * A custom ClasspathFileSource so that WireMock mapping files can be resolved in the quarkus-platform build
+     */
+    private static class CamelQuarkusFileSource extends ClasspathFileSource {
+        private CamelQuarkusFileSource() {
+            super("");
+        }
+
+        @Override
+        public FileSource child(String subDirectoryName) {
+            return new ClasspathFileSource(subDirectoryName);
+        }
+    }
 }


[camel-quarkus] 04/07: Stub Slack tests with WireMock

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 06d0b0acf942943f37f4d2fbdaee25a4df88bf4d
Author: James Netherton <ja...@gmail.com>
AuthorDate: Mon Nov 2 10:00:06 2020 +0000

    Stub Slack tests with WireMock
---
 integration-tests/slack/README.adoc                | 24 ++++++++++
 integration-tests/slack/pom.xml                    |  4 ++
 .../quarkus/component/slack/it/SlackResource.java  |  2 +-
 .../quarkus/component/slack/it/SlackRoutes.java    | 48 -------------------
 .../src/main/resources/application.properties      | 21 ---------
 .../quarkus/component/slack/it/SlackTest.java      |  7 ++-
 .../component/slack/it/SlackTestResource.java      | 55 ++++++++++++++++++++++
 .../test/resources/mappings/slackGetChannels.json  | 37 +++++++++++++++
 .../mappings/slackGetConversationHistory.json      | 37 +++++++++++++++
 .../resources/mappings/slackWebhookMesagePost.json | 30 ++++++++++++
 10 files changed, 191 insertions(+), 74 deletions(-)

diff --git a/integration-tests/slack/README.adoc b/integration-tests/slack/README.adoc
new file mode 100644
index 0000000..4a4dd49
--- /dev/null
+++ b/integration-tests/slack/README.adoc
@@ -0,0 +1,24 @@
+== Camel Quarkus Slack Integration Tests
+
+By default the Slack integration tests use WireMock to stub the API interactions.
+
+To run the `camel-quarkus-Slack` integration tests against the real API, you must first create a Slack account and workspace https://slack.com/get-started#/create.
+
+Then configure Slack custom configurations for 'Incoming Webhooks' & the 'Slack API Tester' on your workspace.
+
+Next set the following environment variables:
+
+[source,shell]
+----
+export SLACK_TOKEN=your-slack-token
+export SLACK_SERVER_URL=https://slack.com
+export SLACK_WEBHOOK_URL=https://hooks.slack.com/services/some/webhook/path
+----
+
+If the WireMock stub recordings need updating, then remove the existing files from `src/test/resources/mappings` and run tests with either:
+
+System property `-Dwiremock.record=true`
+
+Or
+
+Set environment variable `WIREMOCK_RECORD=true`
diff --git a/integration-tests/slack/pom.xml b/integration-tests/slack/pom.xml
index aef247a..09fc268 100644
--- a/integration-tests/slack/pom.xml
+++ b/integration-tests/slack/pom.xml
@@ -62,6 +62,10 @@
             <artifactId>rest-assured</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-integration-wiremock-support</artifactId>
+        </dependency>
 
         <!-- The following dependencies guarantee that this module is built after them. You can update them by running `mvn process-resources -Pformat -N` from the source tree root directory -->
         <dependency>
diff --git a/integration-tests/slack/src/main/java/org/apache/camel/quarkus/component/slack/it/SlackResource.java b/integration-tests/slack/src/main/java/org/apache/camel/quarkus/component/slack/it/SlackResource.java
index 38ff208..a8a1556 100644
--- a/integration-tests/slack/src/main/java/org/apache/camel/quarkus/component/slack/it/SlackResource.java
+++ b/integration-tests/slack/src/main/java/org/apache/camel/quarkus/component/slack/it/SlackResource.java
@@ -36,7 +36,7 @@ import org.apache.camel.component.slack.helper.SlackMessage;
 @ApplicationScoped
 public class SlackResource {
 
-    private static final String SLACK_AUTH_PARAMS = "serverUrl={{env:SLACK_SERVER_URL:http://localhost:8099/slack}}&token={{env:SLACK_TOKEN:a-fake-token-for-testing}}";
+    private static final String SLACK_AUTH_PARAMS = "serverUrl={{sys:slack.server-url}}&token={{sys:slack.token}}";
 
     @Inject
     ProducerTemplate producerTemplate;
diff --git a/integration-tests/slack/src/main/java/org/apache/camel/quarkus/component/slack/it/SlackRoutes.java b/integration-tests/slack/src/main/java/org/apache/camel/quarkus/component/slack/it/SlackRoutes.java
deleted file mode 100644
index 02d8d1e..0000000
--- a/integration-tests/slack/src/main/java/org/apache/camel/quarkus/component/slack/it/SlackRoutes.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.quarkus.component.slack.it;
-
-import org.apache.camel.builder.RouteBuilder;
-
-public class SlackRoutes extends RouteBuilder {
-    @Override
-    public void configure() throws Exception {
-
-        // Stubbed API endpoints for testing without slack API credentials
-        restConfiguration()
-                .component("netty-http")
-                .host("0.0.0.0")
-                .port(8099);
-
-        rest()
-                .post("/webhook")
-                .route()
-                .setBody(constant("{\"ok\": true}"))
-                .endRest()
-                .post("/slack/api/conversations.list")
-                .route()
-                .setBody(constant(
-                        "{\"ok\":true,\"channels\":[{\"id\":\"ABC12345\",\"name\":\"general\",\"is_channel\":true,\"created\":1571904169}]}"))
-                .endRest()
-                .post("/slack/api/conversations.history")
-                .route()
-                .setBody(constant(
-                        "{\"ok\":true,\"messages\":[{\"type\":\"message\",\"subtype\":\"bot_message\",\"text\":\"Hello Camel Quarkus Slack\""
-                                + ",\"ts\":\"1571912155.001300\",\"bot_id\":\"ABC12345C\"}],\"has_more\":true"
-                                + ",\"channel_actions_ts\":null,\"channel_actions_count\":0}"));
-    }
-}
diff --git a/integration-tests/slack/src/main/resources/application.properties b/integration-tests/slack/src/main/resources/application.properties
deleted file mode 100644
index cdbbe3f..0000000
--- a/integration-tests/slack/src/main/resources/application.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-## ---------------------------------------------------------------------------
-## 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.
-## ---------------------------------------------------------------------------
-
-#
-# Camel :: Slack
-#
-camel.component.slack.webhook-url={{env:SLACK_WEBHOOK_URL:http://localhost:8099/webhook}}
diff --git a/integration-tests/slack/src/test/java/org/apache/camel/quarkus/component/slack/it/SlackTest.java b/integration-tests/slack/src/test/java/org/apache/camel/quarkus/component/slack/it/SlackTest.java
index 77877af..c7b23b9 100644
--- a/integration-tests/slack/src/test/java/org/apache/camel/quarkus/component/slack/it/SlackTest.java
+++ b/integration-tests/slack/src/test/java/org/apache/camel/quarkus/component/slack/it/SlackTest.java
@@ -18,6 +18,7 @@ package org.apache.camel.quarkus.component.slack.it;
 
 import java.util.UUID;
 
+import io.quarkus.test.common.QuarkusTestResource;
 import io.quarkus.test.junit.QuarkusTest;
 import io.restassured.RestAssured;
 import io.restassured.http.ContentType;
@@ -28,9 +29,6 @@ import static org.hamcrest.CoreMatchers.equalTo;
 /**
  * Camel Slack component tests.
  *
- * By default tests configure the Slack component to use stubbed Slack API responses
- * that are configured in {@link SlackRoutes}
- *
  * To test against a real Slack instance. Set up environment variables like the following:
  *
  * SLACK_WEBHOOK_URL=https://hooks.slack.com/services/unique/hook/path
@@ -38,6 +36,7 @@ import static org.hamcrest.CoreMatchers.equalTo;
  * SLACK_TOKEN=your-slack-api-access-token
  */
 @QuarkusTest
+@QuarkusTestResource(SlackTestResource.class)
 class SlackTest {
 
     @Test
@@ -57,6 +56,6 @@ class SlackTest {
     }
 
     boolean externalSlackEnabled() {
-        return System.getenv("SLACK_WEBHOOK_URL") != null;
+        return System.getProperty("wiremock.url") == null;
     }
 }
diff --git a/integration-tests/slack/src/test/java/org/apache/camel/quarkus/component/slack/it/SlackTestResource.java b/integration-tests/slack/src/test/java/org/apache/camel/quarkus/component/slack/it/SlackTestResource.java
new file mode 100644
index 0000000..1ce4ffc
--- /dev/null
+++ b/integration-tests/slack/src/test/java/org/apache/camel/quarkus/component/slack/it/SlackTestResource.java
@@ -0,0 +1,55 @@
+/*
+ * 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.quarkus.component.slack.it;
+
+import java.util.Map;
+
+import org.apache.camel.quarkus.test.wiremock.WireMockTestResourceLifecycleManager;
+import org.apache.camel.util.CollectionHelper;
+
+public class SlackTestResource extends WireMockTestResourceLifecycleManager {
+
+    private static final String SLACK_API_BASE_URL = "https://api.slack.com/";
+    private static final String SLACK_ENV_WEBHOOK_URL = "SLACK_WEBHOOK_URL";
+    private static final String SLACK_ENV_SERVER_URL = "SLACK_SERVER_URL";
+    private static final String SLACK_ENV_TOKEN = "SLACK_TOKEN";
+
+    @Override
+    public Map<String, String> start() {
+        Map<String, String> properties = super.start();
+        String wiremockUrl = properties.get("wiremock.url");
+        String serverUrl = wiremockUrl != null ? wiremockUrl : System.getenv(SLACK_ENV_SERVER_URL);
+        String webhookUrl = wiremockUrl != null ? wiremockUrl + "/services/webhook" : System.getenv(SLACK_ENV_WEBHOOK_URL);
+        return CollectionHelper.mergeMaps(properties, CollectionHelper.mapOf(
+                "camel.component.slack.webhook-url", webhookUrl,
+                "slack.server-url", serverUrl,
+                "slack.token", envOrDefault(SLACK_ENV_TOKEN, "test-token")));
+    }
+
+    @Override
+    protected String getRecordTargetBaseUrl() {
+        return SLACK_API_BASE_URL;
+    }
+
+    @Override
+    protected boolean isMockingEnabled() {
+        return !envVarsPresent(
+                SLACK_ENV_WEBHOOK_URL,
+                SLACK_ENV_SERVER_URL,
+                SLACK_ENV_TOKEN);
+    }
+}
diff --git a/integration-tests/slack/src/test/resources/mappings/slackGetChannels.json b/integration-tests/slack/src/test/resources/mappings/slackGetChannels.json
new file mode 100644
index 0000000..ec06cbd
--- /dev/null
+++ b/integration-tests/slack/src/test/resources/mappings/slackGetChannels.json
@@ -0,0 +1,37 @@
+{
+  "id" : "2a011f82-a594-4f21-91f6-7be02c035fa5",
+  "name" : "api_conversationslist",
+  "request" : {
+    "url" : "/api/conversations.list",
+    "method" : "POST",
+    "bodyPatterns" : [ {
+      "equalTo" : "token=test-token",
+      "caseInsensitive" : false
+    } ]
+  },
+  "response" : {
+    "status" : 200,
+    "body" : "{\"ok\":true,\"channels\":[{\"id\":\"CPT2U8YSK\",\"name\":\"random\",\"is_channel\":true,\"is_group\":false,\"is_im\":false,\"created\":1571904169,\"is_archived\":false,\"is_general\":false,\"unlinked\":0,\"name_normalized\":\"random\",\"is_shared\":false,\"parent_conversation\":null,\"creator\":\"UPJPHCRUH\",\"is_ext_shared\":false,\"is_org_shared\":false,\"shared_team_ids\":[\"TPR71CS7J\"],\"pending_shared\":[],\"pending_connected_team_ids\":[],\"is_pending_ext_shared\":f [...]
+    "headers" : {
+      "date" : "Mon, 02 Nov 2020 09:53:19 GMT",
+      "server" : "Apache",
+      "x-xss-protection" : "0",
+      "pragma" : "no-cache",
+      "cache-control" : "private, no-cache, no-store, must-revalidate",
+      "strict-transport-security" : "max-age=31536000; includeSubDomains; preload",
+      "x-slack-req-id" : "8500fbbc3969104df3a1a00fcf57ca3c",
+      "x-content-type-options" : "nosniff",
+      "referrer-policy" : "no-referrer",
+      "x-slack-backend" : "r",
+      "x-oauth-scopes" : "read,client,admin,identify,post,apps",
+      "x-accepted-oauth-scopes" : "channels:read,groups:read,mpim:read,im:read,read",
+      "expires" : "Mon, 26 Jul 1997 05:00:00 GMT",
+      "vary" : "Accept-Encoding",
+      "content-type" : "application/json; charset=utf-8",
+      "x-via" : "haproxy-www-0tj6,haproxy-edge-lhr-fchm"
+    }
+  },
+  "uuid" : "2a011f82-a594-4f21-91f6-7be02c035fa5",
+  "persistent" : true,
+  "insertionIndex" : 2
+}
\ No newline at end of file
diff --git a/integration-tests/slack/src/test/resources/mappings/slackGetConversationHistory.json b/integration-tests/slack/src/test/resources/mappings/slackGetConversationHistory.json
new file mode 100644
index 0000000..1d9fbff
--- /dev/null
+++ b/integration-tests/slack/src/test/resources/mappings/slackGetConversationHistory.json
@@ -0,0 +1,37 @@
+{
+  "id" : "6e638406-ee78-4a8d-baff-bf20096039ca",
+  "name" : "api_conversationshistory",
+  "request" : {
+    "url" : "/api/conversations.history",
+    "method" : "POST",
+    "bodyPatterns" : [ {
+      "equalTo" : "channel=CPTD6F086&count=1&token=test-token",
+      "caseInsensitive" : false
+    } ]
+  },
+  "response" : {
+    "status" : 200,
+    "body" : "{\"ok\":true,\"messages\":[{\"type\":\"message\",\"subtype\":\"bot_message\",\"text\":\"Hello Camel Quarkus Slack\",\"ts\":\"1604310723.000600\",\"bot_id\":\"BTWSZ6PGX\"}],\"has_more\":true,\"pin_count\":0,\"channel_actions_ts\":null,\"channel_actions_count\":0,\"response_metadata\":{\"next_cursor\":\"bmV4dF90czoxNjA0MzEwNDg4MDAwNTAw\"}}",
+    "headers" : {
+      "date" : "Mon, 02 Nov 2020 09:53:20 GMT",
+      "server" : "Apache",
+      "x-xss-protection" : "0",
+      "pragma" : "no-cache",
+      "cache-control" : "private, no-cache, no-store, must-revalidate",
+      "strict-transport-security" : "max-age=31536000; includeSubDomains; preload",
+      "x-slack-req-id" : "4c02fef93a98415344290ac4dbc10bde",
+      "x-content-type-options" : "nosniff",
+      "referrer-policy" : "no-referrer",
+      "x-slack-backend" : "r",
+      "x-oauth-scopes" : "read,client,admin,identify,post,apps",
+      "x-accepted-oauth-scopes" : "channels:history,groups:history,mpim:history,im:history,read",
+      "expires" : "Mon, 26 Jul 1997 05:00:00 GMT",
+      "vary" : "Accept-Encoding",
+      "content-type" : "application/json; charset=utf-8",
+      "x-via" : "haproxy-www-6ya7,haproxy-edge-lhr-fchm"
+    }
+  },
+  "uuid" : "6e638406-ee78-4a8d-baff-bf20096039ca",
+  "persistent" : true,
+  "insertionIndex" : 3
+}
\ No newline at end of file
diff --git a/integration-tests/slack/src/test/resources/mappings/slackWebhookMesagePost.json b/integration-tests/slack/src/test/resources/mappings/slackWebhookMesagePost.json
new file mode 100644
index 0000000..621acc3
--- /dev/null
+++ b/integration-tests/slack/src/test/resources/mappings/slackWebhookMesagePost.json
@@ -0,0 +1,30 @@
+{
+  "id" : "b83207ea-d573-449e-bf3f-6e55660166bd",
+  "name" : "services_webhook",
+  "request" : {
+    "url" : "/services/webhook",
+    "method" : "POST",
+    "bodyPatterns" : [ {
+      "equalTo" : "{\"icon_url\":null,\"icon_emoji\":null,\"channel\":\"general\",\"text\":\"Hello Camel Quarkus Slack\",\"username\":null}",
+      "caseInsensitive" : false
+    } ]
+  },
+  "response" : {
+    "status" : 200,
+    "body" : "ok",
+    "headers" : {
+      "date" : "Mon, 02 Nov 2020 09:52:03 GMT",
+      "server" : "Apache",
+      "strict-transport-security" : "max-age=31536000; includeSubDomains; preload",
+      "x-slack-backend" : "r",
+      "x-frame-options" : "SAMEORIGIN",
+      "vary" : "Accept-Encoding",
+      "referrer-policy" : "no-referrer",
+      "content-type" : "text/html",
+      "x-via" : "haproxy-www-plhy,haproxy-edge-lhr-s8de"
+    }
+  },
+  "uuid" : "b83207ea-d573-449e-bf3f-6e55660166bd",
+  "persistent" : true,
+  "insertionIndex" : 1
+}
\ No newline at end of file


[camel-quarkus] 01/07: Fix WireMock server field injection for native tests

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 98c2f396e522fa1a770c01bf72737db7c105afe6
Author: James Netherton <ja...@gmail.com>
AuthorDate: Wed Nov 4 10:17:20 2020 +0000

    Fix WireMock server field injection for native tests
---
 .../WireMockTestResourceLifecycleManager.java      | 36 ++++++++++++----------
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/integration-tests-support/wiremock/src/main/java/org/apache/camel/quarkus/test/wiremock/WireMockTestResourceLifecycleManager.java b/integration-tests-support/wiremock/src/main/java/org/apache/camel/quarkus/test/wiremock/WireMockTestResourceLifecycleManager.java
index dc64c87..5308534 100644
--- a/integration-tests-support/wiremock/src/main/java/org/apache/camel/quarkus/test/wiremock/WireMockTestResourceLifecycleManager.java
+++ b/integration-tests-support/wiremock/src/main/java/org/apache/camel/quarkus/test/wiremock/WireMockTestResourceLifecycleManager.java
@@ -116,26 +116,30 @@ public abstract class WireMockTestResourceLifecycleManager implements QuarkusTes
     @Override
     public void inject(Object testInstance) {
         if (isMockingEnabled() || isRecordingEnabled()) {
-            Class<?> c = testInstance.getClass();
-            for (Field field : c.getDeclaredFields()) {
-                if (field.getAnnotation(MockServer.class) != null) {
-                    if (!WireMockServer.class.isAssignableFrom(field.getType())) {
-                        throw new RuntimeException("@MockServer can only be used on fields of type WireMockServer");
-                    }
+            Class<?> testClass = testInstance.getClass();
+            while (testClass != Object.class) {
+                for (Field field : testClass.getDeclaredFields()) {
+                    if (field.getAnnotation(MockServer.class) != null) {
+                        if (!WireMockServer.class.isAssignableFrom(field.getType())) {
+                            throw new RuntimeException("@MockServer can only be used on fields of type WireMockServer");
+                        }
 
-                    field.setAccessible(true);
-                    try {
-                        if (server == null) {
-                            server = createServer();
-                            server.start();
+                        field.setAccessible(true);
+                        try {
+                            if (server == null) {
+                                LOG.info("Starting WireMockServer");
+                                server = createServer();
+                                server.start();
+                            }
+                            LOG.infof("Injecting WireMockServer for field %s", field.getName());
+                            field.set(testInstance, server);
+                            return;
+                        } catch (Exception e) {
+                            throw new RuntimeException(e);
                         }
-                        LOG.infof("Injecting WireMockServer for field %s", field.getName());
-                        field.set(testInstance, server);
-                        return;
-                    } catch (Exception e) {
-                        throw new RuntimeException(e);
                     }
                 }
+                testClass = testClass.getSuperclass();
             }
         }
     }


[camel-quarkus] 03/07: Stub ServiceNow tests with WireMock

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 8f311bebcac9897b573a01a0fc8b54b9f9609491
Author: James Netherton <ja...@gmail.com>
AuthorDate: Fri Oct 30 14:26:09 2020 +0000

    Stub ServiceNow tests with WireMock
---
 integration-tests/servicenow/README.adoc           | 10 ++++
 integration-tests/servicenow/pom.xml               |  5 ++
 .../servicenow/it/ServicenowResource.java          |  2 +-
 .../component/servicenow/it/model/Incident.java    |  2 +
 .../src/main/resources/application.properties      | 23 ---------
 .../component/servicenow/it/ServicenowIT.java      |  4 --
 .../component/servicenow/it/ServicenowTest.java    |  6 +--
 .../servicenow/it/ServicenowTestResource.java      | 54 ++++++++++++++++++++++
 .../mappings/servicenowConfirmDeleteIncident.json  | 29 ++++++++++++
 .../mappings/servicenowCreateIncident.json         | 33 +++++++++++++
 .../mappings/servicenowDeleteIncident.json         | 22 +++++++++
 .../resources/mappings/servicenowGetIncident.json  | 30 ++++++++++++
 12 files changed, 188 insertions(+), 32 deletions(-)

diff --git a/integration-tests/servicenow/README.adoc b/integration-tests/servicenow/README.adoc
index 528da26..8c2ef6f 100644
--- a/integration-tests/servicenow/README.adoc
+++ b/integration-tests/servicenow/README.adoc
@@ -1,5 +1,7 @@
 == Camel Quarkus ServiceNow Integration Tests
 
+By default the ServiceNow integration tests use WireMock to stub the API interactions.
+
 To run the `camel-quarkus-servicenow` integration tests, you will need a https://servicenow.com[ServiceNow] instance.
 
 Then set the following environment variables:
@@ -10,3 +12,11 @@ export SERVICENOW_INSTANCE=my-instance
 export SERVICENOW_USERNAME=my-username
 export SERVICENOW_PASSWORD=my-password
 ----
+
+If the WireMock stub recordings need updating, then remove the existing files from `src/test/resources/mappings` and run tests with either:
+
+System property `-Dwiremock.record=true`
+
+Or
+
+Set environment variable `WIREMOCK_RECORD=true`
diff --git a/integration-tests/servicenow/pom.xml b/integration-tests/servicenow/pom.xml
index 95ee843..4fa2f09 100644
--- a/integration-tests/servicenow/pom.xml
+++ b/integration-tests/servicenow/pom.xml
@@ -54,6 +54,11 @@
             <artifactId>rest-assured</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-integration-wiremock-support</artifactId>
+            <scope>test</scope>
+        </dependency>
 
         <!-- The following dependencies guarantee that this module is built after them. You can update them by running `mvn process-resources -Pformat -N` from the source tree root directory -->
         <dependency>
diff --git a/integration-tests/servicenow/src/main/java/org/apache/camel/quarkus/component/servicenow/it/ServicenowResource.java b/integration-tests/servicenow/src/main/java/org/apache/camel/quarkus/component/servicenow/it/ServicenowResource.java
index d280741..ce2d17c 100644
--- a/integration-tests/servicenow/src/main/java/org/apache/camel/quarkus/component/servicenow/it/ServicenowResource.java
+++ b/integration-tests/servicenow/src/main/java/org/apache/camel/quarkus/component/servicenow/it/ServicenowResource.java
@@ -49,7 +49,7 @@ public class ServicenowResource {
     @Inject
     ProducerTemplate producerTemplate;
 
-    @ConfigProperty(name = "servicenow.instance")
+    @ConfigProperty(name = "camel.component.servicenow.instance-name")
     String instance;
 
     @Path("/post")
diff --git a/integration-tests/servicenow/src/main/java/org/apache/camel/quarkus/component/servicenow/it/model/Incident.java b/integration-tests/servicenow/src/main/java/org/apache/camel/quarkus/component/servicenow/it/model/Incident.java
index 91f5f18..9a6b902 100644
--- a/integration-tests/servicenow/src/main/java/org/apache/camel/quarkus/component/servicenow/it/model/Incident.java
+++ b/integration-tests/servicenow/src/main/java/org/apache/camel/quarkus/component/servicenow/it/model/Incident.java
@@ -19,9 +19,11 @@ package org.apache.camel.quarkus.component.servicenow.it.model;
 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.annotation.JsonProperty;
+import io.quarkus.runtime.annotations.RegisterForReflection;
 
 @JsonIgnoreProperties(ignoreUnknown = true)
 @JsonInclude(JsonInclude.Include.NON_NULL)
+@RegisterForReflection
 public class Incident {
     @JsonProperty("sys_id")
     private String id;
diff --git a/integration-tests/servicenow/src/main/resources/application.properties b/integration-tests/servicenow/src/main/resources/application.properties
deleted file mode 100644
index 1950833..0000000
--- a/integration-tests/servicenow/src/main/resources/application.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-## ---------------------------------------------------------------------------
-## 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.
-## ---------------------------------------------------------------------------
-
-#
-# Camel :: ServiceNow
-#
-servicenow.instance={{env:SERVICENOW_INSTANCE}}
-camel.component.servicenow.username={{env:SERVICENOW_USERNAME}}
-camel.component.servicenow.password={{env:SERVICENOW_PASSWORD}}
diff --git a/integration-tests/servicenow/src/test/java/org/apache/camel/quarkus/component/servicenow/it/ServicenowIT.java b/integration-tests/servicenow/src/test/java/org/apache/camel/quarkus/component/servicenow/it/ServicenowIT.java
index 0d0e0c1..6a5acf7 100644
--- a/integration-tests/servicenow/src/test/java/org/apache/camel/quarkus/component/servicenow/it/ServicenowIT.java
+++ b/integration-tests/servicenow/src/test/java/org/apache/camel/quarkus/component/servicenow/it/ServicenowIT.java
@@ -17,12 +17,8 @@
 package org.apache.camel.quarkus.component.servicenow.it;
 
 import io.quarkus.test.junit.NativeImageTest;
-import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
 
 @NativeImageTest
-@EnabledIfEnvironmentVariable(named = "SERVICENOW_INSTANCE", matches = ".+")
-@EnabledIfEnvironmentVariable(named = "SERVICENOW_USERNAME", matches = ".+")
-@EnabledIfEnvironmentVariable(named = "SERVICENOW_PASSWORD", matches = ".+")
 class ServicenowIT extends ServicenowTest {
 
 }
diff --git a/integration-tests/servicenow/src/test/java/org/apache/camel/quarkus/component/servicenow/it/ServicenowTest.java b/integration-tests/servicenow/src/test/java/org/apache/camel/quarkus/component/servicenow/it/ServicenowTest.java
index 7b88a56..f328841 100644
--- a/integration-tests/servicenow/src/test/java/org/apache/camel/quarkus/component/servicenow/it/ServicenowTest.java
+++ b/integration-tests/servicenow/src/test/java/org/apache/camel/quarkus/component/servicenow/it/ServicenowTest.java
@@ -16,18 +16,16 @@
  */
 package org.apache.camel.quarkus.component.servicenow.it;
 
+import io.quarkus.test.common.QuarkusTestResource;
 import io.quarkus.test.junit.QuarkusTest;
 import io.restassured.RestAssured;
 import io.restassured.http.ContentType;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
 
 import static org.hamcrest.Matchers.matchesPattern;
 
 @QuarkusTest
-@EnabledIfEnvironmentVariable(named = "SERVICENOW_INSTANCE", matches = ".+")
-@EnabledIfEnvironmentVariable(named = "SERVICENOW_USERNAME", matches = ".+")
-@EnabledIfEnvironmentVariable(named = "SERVICENOW_PASSWORD", matches = ".+")
+@QuarkusTestResource(ServicenowTestResource.class)
 class ServicenowTest {
 
     @Test
diff --git a/integration-tests/servicenow/src/test/java/org/apache/camel/quarkus/component/servicenow/it/ServicenowTestResource.java b/integration-tests/servicenow/src/test/java/org/apache/camel/quarkus/component/servicenow/it/ServicenowTestResource.java
new file mode 100644
index 0000000..c92a4a1
--- /dev/null
+++ b/integration-tests/servicenow/src/test/java/org/apache/camel/quarkus/component/servicenow/it/ServicenowTestResource.java
@@ -0,0 +1,54 @@
+/*
+ * 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.quarkus.component.servicenow.it;
+
+import java.util.Map;
+
+import org.apache.camel.quarkus.test.wiremock.WireMockTestResourceLifecycleManager;
+import org.apache.camel.util.CollectionHelper;
+
+public class ServicenowTestResource extends WireMockTestResourceLifecycleManager {
+
+    private static final String SERVICENOW_ENV_INSTANCE = "SERVICENOW_INSTANCE";
+    private static final String SERVICENOW_ENV_USERNAME = "SERVICENOW_USERNAME";
+    private static final String SERVICENOW_ENV_PASSWORD = "SERVICENOW_PASSWORD";
+
+    @Override
+    public Map<String, String> start() {
+        Map<String, String> properties = super.start();
+        String wiremockUrl = properties.get("wiremock.url");
+        String apiUrl = wiremockUrl != null ? wiremockUrl : getRecordTargetBaseUrl();
+        return CollectionHelper.mergeMaps(properties, CollectionHelper.mapOf(
+                "camel.component.servicenow.instance-name", envOrDefault(SERVICENOW_ENV_INSTANCE, "fake"),
+                "camel.component.servicenow.username", envOrDefault(SERVICENOW_ENV_USERNAME, "test"),
+                "camel.component.servicenow.password", envOrDefault(SERVICENOW_ENV_PASSWORD, "2se3r3t"),
+                "camel.component.servicenow.api-url", apiUrl));
+    }
+
+    @Override
+    protected String getRecordTargetBaseUrl() {
+        return String.format("https://%s.service-now.com/api", System.getenv(SERVICENOW_ENV_INSTANCE));
+    }
+
+    @Override
+    protected boolean isMockingEnabled() {
+        return !envVarsPresent(
+                SERVICENOW_ENV_INSTANCE,
+                SERVICENOW_ENV_USERNAME,
+                SERVICENOW_ENV_PASSWORD);
+    }
+}
diff --git a/integration-tests/servicenow/src/test/resources/mappings/servicenowConfirmDeleteIncident.json b/integration-tests/servicenow/src/test/resources/mappings/servicenowConfirmDeleteIncident.json
new file mode 100644
index 0000000..4149714
--- /dev/null
+++ b/integration-tests/servicenow/src/test/resources/mappings/servicenowConfirmDeleteIncident.json
@@ -0,0 +1,29 @@
+{
+  "id" : "a5b46fb7-d51e-49f5-84d2-5f22a4eadeb3",
+  "name" : "now_v1_table_incident_9aae36efdb4020505b022ad94b9619cc",
+  "request" : {
+    "url" : "/now/v1/table/incident/9aae36efdb4020505b022ad94b9619cc?sysparm_display_value=false&sysparm_exclude_reference_link=false",
+    "method" : "GET"
+  },
+  "response" : {
+    "status" : 404,
+    "body" : "{\"error\":{\"message\":\"No Record found\",\"detail\":\"Record doesn't exist or ACL restricts the record retrieval\"},\"status\":\"failure\"}",
+    "headers" : {
+      "X-Is-Logged-In" : "true",
+      "X-Transaction-ID" : "faaeba2f1bc4",
+      "Pragma" : "no-store,no-cache",
+      "Cache-control" : "no-cache,no-store,must-revalidate,max-age=-1",
+      "Expires" : "0",
+      "Content-Type" : "application/json;charset=UTF-8",
+      "Date" : "Fri, 30 Oct 2020 14:12:31 GMT",
+      "Server" : "ServiceNow",
+      "Set-Cookie" : [ "JSESSIONID=4BF3C6F757D76F05F9B24C9F04E22358; Path=/; HttpOnly; SameSite=None; Secure", "glide_user=; Max-Age=0; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly; SameSite=None; Secure", "glide_user_session=; Max-Age=0; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly; SameSite=None; Secure", "glide_user_route=glide.47b57eb1ea96b0d680a38a6721421254; Max-Age=2147483647; Expires=Wed, 17-Nov-2088 17:26:39 GMT; Path=/; HttpOnly; SameSite=None; Secure", "g [...]
+      "Strict-Transport-Security" : "max-age=63072000; includeSubDomains"
+    }
+  },
+  "uuid" : "a5b46fb7-d51e-49f5-84d2-5f22a4eadeb3",
+  "persistent" : true,
+  "scenarioName" : "scenario-1-now-v1-table-incident-9aae36efdb4020505b022ad94b9619cc",
+  "requiredScenarioState" : "scenario-1-now-v1-table-incident-9aae36efdb4020505b022ad94b9619cc-2",
+  "insertionIndex" : 4
+}
\ No newline at end of file
diff --git a/integration-tests/servicenow/src/test/resources/mappings/servicenowCreateIncident.json b/integration-tests/servicenow/src/test/resources/mappings/servicenowCreateIncident.json
new file mode 100644
index 0000000..e5a966c
--- /dev/null
+++ b/integration-tests/servicenow/src/test/resources/mappings/servicenowCreateIncident.json
@@ -0,0 +1,33 @@
+{
+  "id" : "eff347f9-40ff-40b8-aa22-3fd1f10548bb",
+  "name" : "now_v1_table_incident",
+  "request" : {
+    "url" : "/now/v1/table/incident?sysparm_display_value=false&sysparm_exclude_reference_link=false&sysparm_input_display_value=false&sysparm_suppress_auto_sys_field=false",
+    "method" : "POST",
+    "bodyPatterns" : [ {
+      "equalToJson" : "{\"description\":\"Demo incident\",\"severity\":1,\"impact\":1}",
+      "ignoreArrayOrder" : true,
+      "ignoreExtraElements" : true
+    } ]
+  },
+  "response" : {
+    "status" : 201,
+    "body" : "{\"result\":{\"parent\":\"\",\"made_sla\":\"true\",\"caused_by\":\"\",\"watch_list\":\"\",\"upon_reject\":\"cancel\",\"sys_updated_on\":\"2020-10-30 14:12:31\",\"child_incidents\":\"0\",\"approval_history\":\"\",\"skills\":\"\",\"number\":\"INC0011411\",\"resolved_by\":\"\",\"sys_updated_by\":\"admin\",\"opened_by\":{\"link\":\"https://fake.service-now.com/api/now/v1/table/sys_user/6816f79cc0a8016401c5a33be04be441\",\"value\":\"6816f79cc0a8016401c5a33be04be441\"},\"user_inp [...]
+    "headers" : {
+      "X-Is-Logged-In" : "true",
+      "X-Transaction-ID" : "deae726fdbcc",
+      "Location" : "https://fake.service-now.com/api/now/v1/table/incident/9aae36efdb4020505b022ad94b9619cc",
+      "Pragma" : "no-store,no-cache",
+      "Cache-control" : "no-cache,no-store,must-revalidate,max-age=-1",
+      "Expires" : "0",
+      "Content-Type" : "application/json;charset=UTF-8",
+      "Date" : "Fri, 30 Oct 2020 14:12:31 GMT",
+      "Server" : "ServiceNow",
+      "Set-Cookie" : [ "JSESSIONID=97FE019CBE537FADAA5D3BBC643BB0EB; Path=/; HttpOnly; SameSite=None; Secure", "glide_user=; Max-Age=0; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly; SameSite=None; Secure", "glide_user_session=; Max-Age=0; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly; SameSite=None; Secure", "glide_user_route=glide.1b928f91f1244fdcdc488a67644bfe83; Max-Age=2147483647; Expires=Wed, 17-Nov-2088 17:26:38 GMT; Path=/; HttpOnly; SameSite=None; Secure", "g [...]
+      "Strict-Transport-Security" : "max-age=63072000; includeSubDomains"
+    }
+  },
+  "uuid" : "eff347f9-40ff-40b8-aa22-3fd1f10548bb",
+  "persistent" : true,
+  "insertionIndex" : 1
+}
\ No newline at end of file
diff --git a/integration-tests/servicenow/src/test/resources/mappings/servicenowDeleteIncident.json b/integration-tests/servicenow/src/test/resources/mappings/servicenowDeleteIncident.json
new file mode 100644
index 0000000..0119c98
--- /dev/null
+++ b/integration-tests/servicenow/src/test/resources/mappings/servicenowDeleteIncident.json
@@ -0,0 +1,22 @@
+{
+  "id" : "96dff3b5-f262-449e-9898-afae52a7e035",
+  "name" : "now_v1_table_incident_9aae36efdb4020505b022ad94b9619cc",
+  "request" : {
+    "url" : "/now/v1/table/incident/9aae36efdb4020505b022ad94b9619cc",
+    "method" : "DELETE"
+  },
+  "response" : {
+    "status" : 204,
+    "headers" : {
+      "X-Is-Logged-In" : "true",
+      "X-Transaction-ID" : "a2ae36efdb40",
+      "Date" : "Fri, 30 Oct 2020 14:12:32 GMT",
+      "Server" : "ServiceNow",
+      "Set-Cookie" : [ "JSESSIONID=90305EB445391DB5306650D650364F5F; Path=/; HttpOnly; SameSite=None; Secure", "glide_user=; Max-Age=0; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly; SameSite=None; Secure", "glide_user_session=; Max-Age=0; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly; SameSite=None; Secure", "glide_user_route=glide.1b928f91f1244fdcdc488a67644bfe83; Max-Age=2147483647; Expires=Wed, 17-Nov-2088 17:26:39 GMT; Path=/; HttpOnly; SameSite=None; Secure", "g [...]
+      "Strict-Transport-Security" : "max-age=63072000; includeSubDomains"
+    }
+  },
+  "uuid" : "96dff3b5-f262-449e-9898-afae52a7e035",
+  "persistent" : true,
+  "insertionIndex" : 3
+}
\ No newline at end of file
diff --git a/integration-tests/servicenow/src/test/resources/mappings/servicenowGetIncident.json b/integration-tests/servicenow/src/test/resources/mappings/servicenowGetIncident.json
new file mode 100644
index 0000000..bdcbf05
--- /dev/null
+++ b/integration-tests/servicenow/src/test/resources/mappings/servicenowGetIncident.json
@@ -0,0 +1,30 @@
+{
+  "id" : "a167cd27-014f-4b33-8251-e142206925e0",
+  "name" : "now_v1_table_incident_9aae36efdb4020505b022ad94b9619cc",
+  "request" : {
+    "url" : "/now/v1/table/incident/9aae36efdb4020505b022ad94b9619cc?sysparm_display_value=false&sysparm_exclude_reference_link=false",
+    "method" : "GET"
+  },
+  "response" : {
+    "status" : 200,
+    "body" : "{\"result\":{\"parent\":\"\",\"made_sla\":\"true\",\"caused_by\":\"\",\"watch_list\":\"\",\"upon_reject\":\"cancel\",\"sys_updated_on\":\"2020-10-30 14:12:31\",\"child_incidents\":\"0\",\"approval_history\":\"\",\"skills\":\"\",\"number\":\"INC0011411\",\"resolved_by\":\"\",\"sys_updated_by\":\"admin\",\"opened_by\":{\"link\":\"https://fake.service-now.com/api/now/v1/table/sys_user/6816f79cc0a8016401c5a33be04be441\",\"value\":\"6816f79cc0a8016401c5a33be04be441\"},\"user_inp [...]
+    "headers" : {
+      "X-Is-Logged-In" : "true",
+      "X-Transaction-ID" : "e2ae36eb1bc4",
+      "Pragma" : "no-store,no-cache",
+      "Cache-control" : "no-cache,no-store,must-revalidate,max-age=-1",
+      "Expires" : "0",
+      "Content-Type" : "application/json;charset=UTF-8",
+      "Date" : "Fri, 30 Oct 2020 14:12:31 GMT",
+      "Server" : "ServiceNow",
+      "Set-Cookie" : [ "JSESSIONID=41F549D2595A94AE9FE0B8FAFB1509E9; Path=/; HttpOnly; SameSite=None; Secure", "glide_user=; Max-Age=0; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly; SameSite=None; Secure", "glide_user_session=; Max-Age=0; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly; SameSite=None; Secure", "glide_user_route=glide.47b57eb1ea96b0d680a38a6721421254; Max-Age=2147483647; Expires=Wed, 17-Nov-2088 17:26:38 GMT; Path=/; HttpOnly; SameSite=None; Secure", "g [...]
+      "Strict-Transport-Security" : "max-age=63072000; includeSubDomains"
+    }
+  },
+  "uuid" : "a167cd27-014f-4b33-8251-e142206925e0",
+  "persistent" : true,
+  "scenarioName" : "scenario-1-now-v1-table-incident-9aae36efdb4020505b022ad94b9619cc",
+  "requiredScenarioState" : "Started",
+  "newScenarioState" : "scenario-1-now-v1-table-incident-9aae36efdb4020505b022ad94b9619cc-2",
+  "insertionIndex" : 2
+}
\ No newline at end of file


[camel-quarkus] 07/07: Stub Telegram tests with WireMock

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 5302af6af071b2a156454c9cc042fb2d62269273
Author: James Netherton <ja...@gmail.com>
AuthorDate: Tue Nov 3 14:41:31 2020 +0000

    Stub Telegram tests with WireMock
---
 integration-tests/telegram/README.adoc             |  16 +--
 integration-tests/telegram/pom.xml                 |   9 +-
 .../component/telegram/it/TelegramResource.java    |   2 +-
 .../component/telegram/it/TelegramRoutes.java      | 110 ---------------------
 .../src/main/resources/application.properties      |  12 +--
 .../mock-messages/editMessageLiveLocation.json     |  24 -----
 .../main/resources/mock-messages/getUpdates.json   |  41 --------
 .../main/resources/mock-messages/sendAudio.json    |  25 -----
 .../main/resources/mock-messages/sendDocument.json |  24 -----
 .../main/resources/mock-messages/sendLocation.json |  23 -----
 .../main/resources/mock-messages/sendMessage.json  |  20 ----
 .../main/resources/mock-messages/sendPhoto.json    |  27 -----
 .../main/resources/mock-messages/sendVenue.json    |  31 ------
 .../main/resources/mock-messages/sendVideo.json    |  33 -------
 .../mock-messages/stopMessageLiveLocation.json     |  24 -----
 .../component/telegram/it/TelegramTest.java        |  26 ++++-
 .../telegram/it/TelegramTestResource.java          |  47 +++++++++
 .../mappings/telegramEditMessageLiveLocation.json  |  26 +++++
 .../test/resources/mappings/telegramSendAudio.json |  24 +++++
 .../resources/mappings/telegramSendDocument.json   |  24 +++++
 .../resources/mappings/telegramSendLocation.json   |  26 +++++
 .../resources/mappings/telegramSendMessage.json    |  26 +++++
 .../test/resources/mappings/telegramSendPhoto.json |  24 +++++
 .../test/resources/mappings/telegramSendVenue.json |  26 +++++
 .../test/resources/mappings/telegramSendVideo.json |  24 +++++
 .../mappings/telegramStopMessageLiveAction.json    |  26 +++++
 26 files changed, 316 insertions(+), 404 deletions(-)

diff --git a/integration-tests/telegram/README.adoc b/integration-tests/telegram/README.adoc
index e735210..a62d745 100644
--- a/integration-tests/telegram/README.adoc
+++ b/integration-tests/telegram/README.adoc
@@ -1,5 +1,7 @@
 == Camel Quarkus Telegram Integration Tests
 
+By default the Telegram integration tests use WireMock to stub the API interactions.
+
 To run `camel-quarkus-telegram` integration tests against the real remote Telegram API, you must first create
 a Telegram bot following this guide:
 https://www.nicolaferraro.me/2016/05/27/creating-a-telegram-bot-in-5-minutes-with-apache-camel/
@@ -8,12 +10,14 @@ Then set the following environment variables:
 
 [source,shell]
 ----
-$ export TELEGRAM_AUTHORIZATION_TOKEN=my-authorization-token
-$ export TELEGRAM_CHAT_ID=my-chatId
+export TELEGRAM_AUTHORIZATION_TOKEN=my-authorization-token
+export TELEGRAM_CHAT_ID=my-chatId
 ----
 
-If you do not set `TELEGRAM_AUTHORIZATION_TOKEN` environment variable, the test will be run against a mock
-Telegram API started on `localhost`.
+If the WireMock stub recordings need updating, then remove the existing files from `src/test/resources/mappings` and run tests with either:
+
+System property `-Dwiremock.record=true`
+
+Or
 
-You may want to `export CAMEL_QUARKUS_START_MOCK_BACKEND=false` to avoid starting he the mock Telegram API
-to make sure that you test against the real remote Telegram API.
+Set environment variable `WIREMOCK_RECORD=true`
diff --git a/integration-tests/telegram/pom.xml b/integration-tests/telegram/pom.xml
index bda7807..4de58fc 100644
--- a/integration-tests/telegram/pom.xml
+++ b/integration-tests/telegram/pom.xml
@@ -56,10 +56,6 @@
             <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-attachments</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-integration-test-support-mock-backend</artifactId>
-        </dependency>
 
         <!-- test dependencies -->
         <dependency>
@@ -68,6 +64,11 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-integration-wiremock-support</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>io.quarkus</groupId>
             <artifactId>quarkus-junit5</artifactId>
             <scope>test</scope>
diff --git a/integration-tests/telegram/src/main/java/org/apache/camel/quarkus/component/telegram/it/TelegramResource.java b/integration-tests/telegram/src/main/java/org/apache/camel/quarkus/component/telegram/it/TelegramResource.java
index 52b929c..a6dc6fe 100644
--- a/integration-tests/telegram/src/main/java/org/apache/camel/quarkus/component/telegram/it/TelegramResource.java
+++ b/integration-tests/telegram/src/main/java/org/apache/camel/quarkus/component/telegram/it/TelegramResource.java
@@ -59,7 +59,7 @@ public class TelegramResource {
     @GET
     @Produces(MediaType.TEXT_PLAIN)
     public String getMessages() {
-        final String messages = consumerTemplate.receiveBodyNoWait("telegram://bots", String.class);
+        final String messages = consumerTemplate.receiveBody("telegram://bots", 5000L, String.class);
         log.infof("Received telegram messages: %s", messages);
         return messages;
     }
diff --git a/integration-tests/telegram/src/main/java/org/apache/camel/quarkus/component/telegram/it/TelegramRoutes.java b/integration-tests/telegram/src/main/java/org/apache/camel/quarkus/component/telegram/it/TelegramRoutes.java
deleted file mode 100644
index a56da2c..0000000
--- a/integration-tests/telegram/src/main/java/org/apache/camel/quarkus/component/telegram/it/TelegramRoutes.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * 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.quarkus.component.telegram.it;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.stream.Stream;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.inject.Produces;
-import javax.inject.Named;
-
-import io.quarkus.arc.Unremovable;
-import org.apache.camel.Exchange;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.telegram.TelegramComponent;
-import org.apache.camel.quarkus.test.mock.backend.MockBackendUtils;
-import org.apache.camel.support.ResourceHelper;
-import org.apache.camel.util.IOHelper;
-import org.eclipse.microprofile.config.inject.ConfigProperty;
-
-@ApplicationScoped
-public class TelegramRoutes extends RouteBuilder {
-
-    @ConfigProperty(name = "telegram.authorization-token", defaultValue = "default-dummy-token")
-    String authToken;
-
-    @ConfigProperty(name = "quarkus.http.test-port")
-    int httpTestPort;
-    @ConfigProperty(name = "quarkus.http.port")
-    int httpPort;
-
-    private String getBaseUri() {
-        final boolean isNativeMode = "executable".equals(System.getProperty("org.graalvm.nativeimage.kind"));
-        return "default-dummy-token".equals(authToken)
-                ? "http://localhost:" + (isNativeMode ? httpPort : httpTestPort)
-                : "https://api.telegram.org";
-    }
-
-    /**
-     * We need to implement some conditional configuration of the {@link TelegramComponent} thus we create it
-     * programmatically and publish via CDI.
-     *
-     * @return a configured {@link TelegramComponent}
-     */
-    @Produces
-    @ApplicationScoped
-    @Unremovable
-    @Named
-    TelegramComponent telegram() {
-        final TelegramComponent result = new TelegramComponent();
-        result.setCamelContext(getContext());
-        result.setBaseUri(getBaseUri());
-        result.setAuthorizationToken(authToken);
-        return result;
-    }
-
-    @Override
-    public void configure() throws Exception {
-        if (MockBackendUtils.startMockBackend(true)) {
-            /* Start the mock Telegram API unless the user did export CAMEL_QUARKUS_START_MOCK_BACKEND=false */
-            from("platform-http:/bot" + authToken + "/getUpdates?httpMethodRestrict=GET")
-                    .process(e -> load("mock-messages/getUpdates.json", e));
-
-            Stream.of(
-                    "sendMessage",
-                    "sendAudio",
-                    "sendVideo",
-                    "sendDocument",
-                    "sendPhoto",
-                    "sendVenue",
-                    "sendLocation",
-                    "stopMessageLiveLocation")
-                    .forEach(endpoint -> {
-                        from("platform-http:/bot" + authToken + "/" + endpoint + "?httpMethodRestrict=POST")
-                                .process(e -> load("mock-messages/" + endpoint + ".json", e));
-                    });
-        }
-
-    }
-
-    private void load(String path, Exchange exchange) {
-        try (ByteArrayOutputStream out = new ByteArrayOutputStream(IOHelper.DEFAULT_BUFFER_SIZE);
-                InputStream in = ResourceHelper.resolveMandatoryResourceAsInputStream(exchange.getContext(), path)) {
-            IOHelper.copy(in, out, IOHelper.DEFAULT_BUFFER_SIZE);
-
-            final byte[] bytes = out.toByteArray();
-            exchange.getMessage().setBody(bytes);
-            exchange.getMessage().setHeader("Content-Length", bytes.length);
-            exchange.getMessage().setHeader("Content-Type", "application/json; charset=UTF-8");
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-    }
-}
diff --git a/integration-tests/telegram/src/main/resources/application.properties b/integration-tests/telegram/src/main/resources/application.properties
index 8443bf9..a394805 100644
--- a/integration-tests/telegram/src/main/resources/application.properties
+++ b/integration-tests/telegram/src/main/resources/application.properties
@@ -17,21 +17,15 @@
 #
 # Quarkus
 #
-quarkus.log.category."org.apache.camel.support.DefaultComponent".level = TRACE
+#quarkus.log.category."org.apache.camel.support.DefaultComponent".level = TRACE
 #quarkus.log.category."org.asynchttpclient".level = TRACE
 #quarkus.log.category."org.apache.camel.component.telegram.TelegramComponent".level = TRACE
 # You can check in this directory what requests the client is sending when you run against the mock Telegram API
 quarkus.http.body.uploads-directory=target/uploads
 
-quarkus.native.additional-build-args = -H:IncludeResources=.*mock-messages/.*
 #
 # Camel :: Telegram
 #
-# Set the authorization token here or via environment variable TELEGRAM_AUTHORIZATION_TOKEN
-#telegram.authorization-token=...
 
-telegram.chatId=${TELEGRAM_CHAT_ID:-1}
-
-# You may want to export CAMEL_QUARKUS_START_MOCK_BACKEND=false to avoid starting he the mock Telegram API
-# to make sure that you test against the real remote Telegram API
-camel.quarkus.start-mock-backend=true
\ No newline at end of file
+camel.component.telegram.authorization-token=${TELEGRAM_AUTHORIZATION_TOKEN:fake-token}
+telegram.chatId=${TELEGRAM_CHAT_ID:1426416050}
diff --git a/integration-tests/telegram/src/main/resources/mock-messages/editMessageLiveLocation.json b/integration-tests/telegram/src/main/resources/mock-messages/editMessageLiveLocation.json
deleted file mode 100644
index a6a060d..0000000
--- a/integration-tests/telegram/src/main/resources/mock-messages/editMessageLiveLocation.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
-    "ok": true,
-    "result": {
-        "message_id": 938,
-        "from": {
-            "id": 770882310,
-            "is_bot": true,
-            "first_name": "camelDemoBot",
-            "username": "camelDemoBot"
-        },
-        "chat": {
-            "id": 434822960,
-            "first_name": "Peter",
-            "last_name": "Palaga",
-            "type": "private"
-        },
-        "date": 1576249600,
-        "edit_date": 1576249601,
-        "location": {
-            "latitude": 29.974934,
-            "longitude": 31.131109
-        }
-    }
-}
\ No newline at end of file
diff --git a/integration-tests/telegram/src/main/resources/mock-messages/getUpdates.json b/integration-tests/telegram/src/main/resources/mock-messages/getUpdates.json
deleted file mode 100644
index 85fbd55..0000000
--- a/integration-tests/telegram/src/main/resources/mock-messages/getUpdates.json
+++ /dev/null
@@ -1,41 +0,0 @@
-{
-  "ok": true,
-  "result": [
-    {
-      "update_id": 525704898,
-      "message": {
-        "message_id": 179,
-        "from": {
-          "id": 1585844777,
-          "first_name": "John",
-          "last_name": "Doe"
-        },
-        "chat": {
-          "id": -45658,
-          "title": "A chat group",
-          "type": "group"
-        },
-        "date": 1463436626,
-        "text": "a message"
-      }
-    },
-    {
-      "update_id": 525704899,
-      "message": {
-        "message_id": 180,
-        "from": {
-          "id": 1585844777,
-          "first_name": "John",
-          "last_name": "Doe"
-        },
-        "chat": {
-          "id": -45658,
-          "title": "A chat group",
-          "type": "group"
-        },
-        "date": 1463466626,
-        "text": "another message"
-      }
-    }
-  ]
-}
\ No newline at end of file
diff --git a/integration-tests/telegram/src/main/resources/mock-messages/sendAudio.json b/integration-tests/telegram/src/main/resources/mock-messages/sendAudio.json
deleted file mode 100644
index ed4ac2d..0000000
--- a/integration-tests/telegram/src/main/resources/mock-messages/sendAudio.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
-    "ok": true,
-    "result": {
-        "message_id": 932,
-        "from": {
-            "id": 770882310,
-            "is_bot": true,
-            "first_name": "camelDemoBot",
-            "username": "camelDemoBot"
-        },
-        "chat": {
-            "id": 434822960,
-            "first_name": "Peter",
-            "last_name": "Palaga",
-            "type": "private"
-        },
-        "date": 1576249599,
-        "audio": {
-            "duration": 1,
-            "mime_type": "audio/mpeg",
-            "file_id": "CQADBAAD5QUAAmcaoVMYrfWhEfLFTBYE",
-            "file_size": 9657
-        }
-    }
-}
\ No newline at end of file
diff --git a/integration-tests/telegram/src/main/resources/mock-messages/sendDocument.json b/integration-tests/telegram/src/main/resources/mock-messages/sendDocument.json
deleted file mode 100644
index f352d13..0000000
--- a/integration-tests/telegram/src/main/resources/mock-messages/sendDocument.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
-    "ok": true,
-    "result": {
-        "message_id": 934,
-        "from": {
-            "id": 770882310,
-            "is_bot": true,
-            "first_name": "camelDemoBot",
-            "username": "camelDemoBot"
-        },
-        "chat": {
-            "id": 434822960,
-            "first_name": "Peter",
-            "last_name": "Palaga",
-            "type": "private"
-        },
-        "date": 1576249600,
-        "document": {
-            "file_name": "file",
-            "file_id": "BQADBAAD5wUAAmcaoVNbRjnV8IcCmhYE",
-            "file_size": 7638
-        }
-    }
-}
\ No newline at end of file
diff --git a/integration-tests/telegram/src/main/resources/mock-messages/sendLocation.json b/integration-tests/telegram/src/main/resources/mock-messages/sendLocation.json
deleted file mode 100644
index 5b645a1..0000000
--- a/integration-tests/telegram/src/main/resources/mock-messages/sendLocation.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
-    "ok": true,
-    "result": {
-        "message_id": 938,
-        "from": {
-            "id": 770882310,
-            "is_bot": true,
-            "first_name": "camelDemoBot",
-            "username": "camelDemoBot"
-        },
-        "chat": {
-            "id": 434822960,
-            "first_name": "Peter",
-            "last_name": "Palaga",
-            "type": "private"
-        },
-        "date": 1576249600,
-        "location": {
-            "latitude": 29.974830,
-            "longitude": 31.138579
-        }
-    }
-}
\ No newline at end of file
diff --git a/integration-tests/telegram/src/main/resources/mock-messages/sendMessage.json b/integration-tests/telegram/src/main/resources/mock-messages/sendMessage.json
deleted file mode 100644
index 8f37da2..0000000
--- a/integration-tests/telegram/src/main/resources/mock-messages/sendMessage.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
-    "ok": true,
-    "result": {
-        "message_id": 937,
-        "from": {
-            "id": 770882310,
-            "is_bot": true,
-            "first_name": "camelDemoBot",
-            "username": "camelDemoBot"
-        },
-        "chat": {
-            "id": 434822960,
-            "first_name": "Peter",
-            "last_name": "Palaga",
-            "type": "private"
-        },
-        "date": 1576249600,
-        "text": "A message from camel-quarkus-telegram ffdcc8ef72a34053a3e75daec74676a9"
-    }
-}
\ No newline at end of file
diff --git a/integration-tests/telegram/src/main/resources/mock-messages/sendPhoto.json b/integration-tests/telegram/src/main/resources/mock-messages/sendPhoto.json
deleted file mode 100644
index 8523d11..0000000
--- a/integration-tests/telegram/src/main/resources/mock-messages/sendPhoto.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
-    "ok": true,
-    "result": {
-        "message_id": 935,
-        "from": {
-            "id": 770882310,
-            "is_bot": true,
-            "first_name": "camelDemoBot",
-            "username": "camelDemoBot"
-        },
-        "chat": {
-            "id": 434822960,
-            "first_name": "Peter",
-            "last_name": "Palaga",
-            "type": "private"
-        },
-        "date": 1576249600,
-        "photo": [
-            {
-                "file_id": "AgADBAADYbExG2caoVPPY5I2XKLPM3lKqBsABAEAAwIAA20AA80nBQABFgQ",
-                "file_size": 1005,
-                "width": 108,
-                "height": 10
-            }
-        ]
-    }
-}
\ No newline at end of file
diff --git a/integration-tests/telegram/src/main/resources/mock-messages/sendVenue.json b/integration-tests/telegram/src/main/resources/mock-messages/sendVenue.json
deleted file mode 100644
index f098ac2..0000000
--- a/integration-tests/telegram/src/main/resources/mock-messages/sendVenue.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
-    "ok": true,
-    "result": {
-        "message_id": 936,
-        "from": {
-            "id": 770882310,
-            "is_bot": true,
-            "first_name": "camelDemoBot",
-            "username": "camelDemoBot"
-        },
-        "chat": {
-            "id": 434822960,
-            "first_name": "Peter",
-            "last_name": "Palaga",
-            "type": "private"
-        },
-        "date": 1576249600,
-        "location": {
-            "latitude": 29.977826,
-            "longitude": 31.136330
-        },
-        "venue": {
-            "location": {
-                "latitude": 29.977826,
-                "longitude": 31.136330
-            },
-            "title": "Pyramid of Queen Henutsen",
-            "address": "El-Hussein Ibn Ali Ln, Nazlet El-Semman, Al Haram, Giza Governorate, Egypt"
-        }
-    }
-}
\ No newline at end of file
diff --git a/integration-tests/telegram/src/main/resources/mock-messages/sendVideo.json b/integration-tests/telegram/src/main/resources/mock-messages/sendVideo.json
deleted file mode 100644
index 4f8d0ef..0000000
--- a/integration-tests/telegram/src/main/resources/mock-messages/sendVideo.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
-    "ok": true,
-    "result": {
-        "message_id": 933,
-        "from": {
-            "id": 770882310,
-            "is_bot": true,
-            "first_name": "camelDemoBot",
-            "username": "camelDemoBot"
-        },
-        "chat": {
-            "id": 434822960,
-            "first_name": "Peter",
-            "last_name": "Palaga",
-            "type": "private"
-        },
-        "date": 1576249600,
-        "video": {
-            "duration": 4,
-            "width": 108,
-            "height": 10,
-            "mime_type": "video/mp4",
-            "thumb": {
-                "file_id": "AAQEAAPmBQACZxqhU8LAVawXPI5dMWO3GwAEAQAHbQADcxQAAhYE",
-                "file_size": 991,
-                "width": 108,
-                "height": 10
-            },
-            "file_id": "BAADBAAD5gUAAmcaoVPCwFWsFzyOXRYE",
-            "file_size": 27845
-        }
-    }
-}
\ No newline at end of file
diff --git a/integration-tests/telegram/src/main/resources/mock-messages/stopMessageLiveLocation.json b/integration-tests/telegram/src/main/resources/mock-messages/stopMessageLiveLocation.json
deleted file mode 100644
index a6a060d..0000000
--- a/integration-tests/telegram/src/main/resources/mock-messages/stopMessageLiveLocation.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
-    "ok": true,
-    "result": {
-        "message_id": 938,
-        "from": {
-            "id": 770882310,
-            "is_bot": true,
-            "first_name": "camelDemoBot",
-            "username": "camelDemoBot"
-        },
-        "chat": {
-            "id": 434822960,
-            "first_name": "Peter",
-            "last_name": "Palaga",
-            "type": "private"
-        },
-        "date": 1576249600,
-        "edit_date": 1576249601,
-        "location": {
-            "latitude": 29.974934,
-            "longitude": 31.131109
-        }
-    }
-}
\ No newline at end of file
diff --git a/integration-tests/telegram/src/test/java/org/apache/camel/quarkus/component/telegram/it/TelegramTest.java b/integration-tests/telegram/src/test/java/org/apache/camel/quarkus/component/telegram/it/TelegramTest.java
index 38e40ff..c797f6f 100644
--- a/integration-tests/telegram/src/test/java/org/apache/camel/quarkus/component/telegram/it/TelegramTest.java
+++ b/integration-tests/telegram/src/test/java/org/apache/camel/quarkus/component/telegram/it/TelegramTest.java
@@ -21,6 +21,7 @@ import java.io.InputStream;
 import java.util.UUID;
 import java.util.concurrent.TimeUnit;
 
+import com.github.tomakehurst.wiremock.WireMockServer;
 import io.quarkus.test.common.QuarkusTestResource;
 import io.quarkus.test.junit.QuarkusTest;
 import io.restassured.RestAssured;
@@ -31,10 +32,15 @@ import org.apache.camel.component.telegram.model.SendLocationMessage;
 import org.apache.camel.component.telegram.model.SendVenueMessage;
 import org.apache.camel.component.telegram.model.StopMessageLiveLocationMessage;
 import org.apache.camel.quarkus.test.TrustStoreResource;
+import org.apache.camel.quarkus.test.wiremock.MockServer;
 import org.awaitility.Awaitility;
 import org.jboss.logging.Logger;
 import org.junit.jupiter.api.Test;
 
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
+import static com.github.tomakehurst.wiremock.client.WireMock.request;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
 import static org.hamcrest.Matchers.both;
 import static org.hamcrest.Matchers.greaterThanOrEqualTo;
 import static org.hamcrest.Matchers.is;
@@ -42,14 +48,19 @@ import static org.hamcrest.Matchers.lessThan;
 
 @QuarkusTest
 @QuarkusTestResource(TrustStoreResource.class)
+@QuarkusTestResource(TelegramTestResource.class)
 public class TelegramTest {
 
     private static final Logger LOG = Logger.getLogger(TelegramTest.class);
 
+    @MockServer
+    WireMockServer server;
+
     @Test
     public void postText() {
         final String uuid = UUID.randomUUID().toString().replace("-", "");
-        final String msg = String.format("A message from camel-quarkus-telegram %s", uuid);
+        final String msg = "A message from camel-quarkus-telegram"
+                + (System.getenv("TELEGRAM_AUTHORIZATION_TOKEN") != null ? " " + uuid : "");
 
         /* Send a message */
         RestAssured.given()
@@ -63,6 +74,17 @@ public class TelegramTest {
 
     @Test
     public void getText() {
+        // Manually stub the getUpdates response as the addition of the offset query param seems to confuse WireMock
+        if (server != null) {
+            server.stubFor(request("GET", urlPathMatching("/.*/getUpdates"))
+                    .withQueryParam("limit", equalTo("100"))
+                    .withQueryParam("timeout", equalTo("30"))
+                    .willReturn(aResponse()
+                            .withHeader("Content-Type", "application/json")
+                            .withBody(
+                                    "{\"ok\":true,\"result\":[{\"update_id\":123488937,\n\"message\":{\"message_id\":37,\"from\":{\"id\":1426416050,\"is_bot\":false,\"first_name\":\"Apache\",\"last_name\":\"Camel\",\"language_code\":\"en\"},\"chat\":{\"id\":1426416050,\"first_name\":\"Apache\",\"last_name\":\"Camel\",\"type\":\"private\"},\"date\":1604406332,\"text\":\"test\"}}]}")));
+        }
+
         /* Telegram bots by design see neither their own messages nor other bots' messages.
          * So receiving messages is currently possible only if you ping the bot manually.
          * If you do so, you should see your messages in the test log. */
@@ -155,7 +177,7 @@ public class TelegramTest {
                             .post("/telegram/edit-location")
                             .then()
                             .extract().statusCode();
-                    return code != 201;
+                    return code == 201;
                 });
 
         /* Stop updating */
diff --git a/integration-tests/telegram/src/test/java/org/apache/camel/quarkus/component/telegram/it/TelegramTestResource.java b/integration-tests/telegram/src/test/java/org/apache/camel/quarkus/component/telegram/it/TelegramTestResource.java
new file mode 100644
index 0000000..a93ee6c
--- /dev/null
+++ b/integration-tests/telegram/src/test/java/org/apache/camel/quarkus/component/telegram/it/TelegramTestResource.java
@@ -0,0 +1,47 @@
+/*
+ * 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.quarkus.component.telegram.it;
+
+import java.util.Map;
+
+import org.apache.camel.quarkus.test.wiremock.WireMockTestResourceLifecycleManager;
+import org.apache.camel.util.CollectionHelper;
+
+public class TelegramTestResource extends WireMockTestResourceLifecycleManager {
+
+    private static final String TELEGRAM_API_BASE_URL = "https://api.telegram.org";
+    private static final String TELEGRAM_ENV_AUTHORIZATION_TOKEN = "TELEGRAM_AUTHORIZATION_TOKEN";
+
+    @Override
+    public Map<String, String> start() {
+        Map<String, String> properties = super.start();
+        String wireMockUrl = properties.get("wiremock.url");
+        String baseUri = wireMockUrl != null ? wireMockUrl : TELEGRAM_API_BASE_URL;
+        return CollectionHelper.mergeMaps(properties,
+                CollectionHelper.mapOf("camel.component.telegram.base-uri", baseUri));
+    }
+
+    @Override
+    protected String getRecordTargetBaseUrl() {
+        return TELEGRAM_API_BASE_URL;
+    }
+
+    @Override
+    protected boolean isMockingEnabled() {
+        return !envVarsPresent(TELEGRAM_ENV_AUTHORIZATION_TOKEN);
+    }
+}
diff --git a/integration-tests/telegram/src/test/resources/mappings/telegramEditMessageLiveLocation.json b/integration-tests/telegram/src/test/resources/mappings/telegramEditMessageLiveLocation.json
new file mode 100644
index 0000000..ce73094
--- /dev/null
+++ b/integration-tests/telegram/src/test/resources/mappings/telegramEditMessageLiveLocation.json
@@ -0,0 +1,26 @@
+{
+  "id" : "7ebe6ed5-1c57-48f9-8d7f-9972e1acf6e7",
+  "name" : "botfake-token_editmessagelivelocation",
+  "request" : {
+    "url" : "/botfake-token/editMessageLiveLocation",
+    "method" : "POST",
+    "bodyPatterns" : [ {
+      "equalToJson" : "{\"chat_id\":\"1426416050\",\"latitude\":29.974928,\"longitude\":31.131115,\"message_id\":44}",
+      "ignoreArrayOrder" : true,
+      "ignoreExtraElements" : true
+    } ]
+  },
+  "response" : {
+    "status" : 200,
+    "body" : "{\"ok\":true,\"result\":{\"message_id\":44,\"from\":{\"id\":1459045600,\"is_bot\":true,\"first_name\":\"camel-quarkus-test\",\"username\":\"CamelQuarkusTestBot\"},\"chat\":{\"id\":1426416050,\"first_name\":\"Apache\",\"last_name\":\"Camel\",\"type\":\"private\"},\"date\":1604406366,\"edit_date\":1604406367,\"location\":{\"latitude\":29.974934,\"longitude\":31.131109,\"live_period\":120}}}",
+    "headers" : {
+      "Server" : "nginx/1.16.1",
+      "Date" : "Tue, 03 Nov 2020 12:26:07 GMT",
+      "Content-Type" : "application/json",
+      "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload"
+    }
+  },
+  "uuid" : "7ebe6ed5-1c57-48f9-8d7f-9972e1acf6e7",
+  "persistent" : true,
+  "insertionIndex" : 9
+}
\ No newline at end of file
diff --git a/integration-tests/telegram/src/test/resources/mappings/telegramSendAudio.json b/integration-tests/telegram/src/test/resources/mappings/telegramSendAudio.json
new file mode 100644
index 0000000..a2e5404
--- /dev/null
+++ b/integration-tests/telegram/src/test/resources/mappings/telegramSendAudio.json
@@ -0,0 +1,24 @@
+{
+  "id" : "7a3286d0-9606-4ee2-a0c0-85fdd4f15f8b",
+  "name" : "botfake-token_sendaudio",
+  "request" : {
+    "url" : "/botfake-token/sendAudio",
+    "method" : "POST",
+    "bodyPatterns" : [ {
+      "anything" : "anything"
+    } ]
+  },
+  "response" : {
+    "status" : 200,
+    "body" : "{\"ok\":true,\"result\":{\"message_id\":38,\"from\":{\"id\":1459045600,\"is_bot\":true,\"first_name\":\"camel-quarkus-test\",\"username\":\"CamelQuarkusTestBot\"},\"chat\":{\"id\":1426416050,\"first_name\":\"Apache\",\"last_name\":\"Camel\",\"type\":\"private\"},\"date\":1604406365,\"audio\":{\"duration\":1,\"file_name\":\"audio.mp3\",\"mime_type\":\"audio/mpeg\",\"file_id\":\"CQACAgQAAxkDAAMmX6FMXVbf-mYVeRWmBctoH0OAXlkAAu8GAAJd1glRHPsZNTQzO4YeBA\",\"file_unique_id\":\"AgAD [...]
+    "headers" : {
+      "Server" : "nginx/1.16.1",
+      "Date" : "Tue, 03 Nov 2020 12:26:05 GMT",
+      "Content-Type" : "application/json",
+      "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload"
+    }
+  },
+  "uuid" : "7a3286d0-9606-4ee2-a0c0-85fdd4f15f8b",
+  "persistent" : true,
+  "insertionIndex" : 2
+}
\ No newline at end of file
diff --git a/integration-tests/telegram/src/test/resources/mappings/telegramSendDocument.json b/integration-tests/telegram/src/test/resources/mappings/telegramSendDocument.json
new file mode 100644
index 0000000..afaf3e2
--- /dev/null
+++ b/integration-tests/telegram/src/test/resources/mappings/telegramSendDocument.json
@@ -0,0 +1,24 @@
+{
+  "id" : "cfbaf69c-3be7-45e9-8512-f3769a98611a",
+  "name" : "botfake-token_senddocument",
+  "request" : {
+    "url" : "/botfake-token/sendDocument",
+    "method" : "POST",
+    "bodyPatterns" : [ {
+      "anything" : "anything"
+    } ]
+  },
+  "response" : {
+    "status" : 200,
+    "body" : "{\"ok\":true,\"result\":{\"message_id\":40,\"from\":{\"id\":1459045600,\"is_bot\":true,\"first_name\":\"camel-quarkus-test\",\"username\":\"CamelQuarkusTestBot\"},\"chat\":{\"id\":1426416050,\"first_name\":\"Apache\",\"last_name\":\"Camel\",\"type\":\"private\"},\"date\":1604406366,\"document\":{\"file_name\":\"file\",\"file_id\":\"BQACAgQAAxkDAAMoX6FMXo_mepgCTW_GwQQHyXl00NwAAvEGAAJd1glRq8h45cblYl0eBA\",\"file_unique_id\":\"AgAD8QYAAl3WCVE\",\"file_size\":7638}}}",
+    "headers" : {
+      "Server" : "nginx/1.16.1",
+      "Date" : "Tue, 03 Nov 2020 12:26:06 GMT",
+      "Content-Type" : "application/json",
+      "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload"
+    }
+  },
+  "uuid" : "cfbaf69c-3be7-45e9-8512-f3769a98611a",
+  "persistent" : true,
+  "insertionIndex" : 4
+}
\ No newline at end of file
diff --git a/integration-tests/telegram/src/test/resources/mappings/telegramSendLocation.json b/integration-tests/telegram/src/test/resources/mappings/telegramSendLocation.json
new file mode 100644
index 0000000..3bdc635
--- /dev/null
+++ b/integration-tests/telegram/src/test/resources/mappings/telegramSendLocation.json
@@ -0,0 +1,26 @@
+{
+  "id" : "f47c81d1-def8-4246-b14f-2a0555829f7d",
+  "name" : "botfake-token_sendlocation",
+  "request" : {
+    "url" : "/botfake-token/sendLocation",
+    "method" : "POST",
+    "bodyPatterns" : [ {
+      "equalToJson" : "{\"chat_id\":\"1426416050\",\"longitude\":31.138577,\"latitude\":29.974834,\"live_period\":120}",
+      "ignoreArrayOrder" : true,
+      "ignoreExtraElements" : true
+    } ]
+  },
+  "response" : {
+    "status" : 200,
+    "body" : "{\"ok\":true,\"result\":{\"message_id\":44,\"from\":{\"id\":1459045600,\"is_bot\":true,\"first_name\":\"camel-quarkus-test\",\"username\":\"CamelQuarkusTestBot\"},\"chat\":{\"id\":1426416050,\"first_name\":\"Apache\",\"last_name\":\"Camel\",\"type\":\"private\"},\"date\":1604406366,\"location\":{\"latitude\":29.974830,\"longitude\":31.138579,\"live_period\":120}}}",
+    "headers" : {
+      "Server" : "nginx/1.16.1",
+      "Date" : "Tue, 03 Nov 2020 12:26:06 GMT",
+      "Content-Type" : "application/json",
+      "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload"
+    }
+  },
+  "uuid" : "f47c81d1-def8-4246-b14f-2a0555829f7d",
+  "persistent" : true,
+  "insertionIndex" : 8
+}
\ No newline at end of file
diff --git a/integration-tests/telegram/src/test/resources/mappings/telegramSendMessage.json b/integration-tests/telegram/src/test/resources/mappings/telegramSendMessage.json
new file mode 100644
index 0000000..eb561fd
--- /dev/null
+++ b/integration-tests/telegram/src/test/resources/mappings/telegramSendMessage.json
@@ -0,0 +1,26 @@
+{
+  "id" : "99cc4134-7c83-446f-83db-5d9fb6886e08",
+  "name" : "botfake-token_sendmessage",
+  "request" : {
+    "url" : "/botfake-token/sendMessage",
+    "method" : "POST",
+    "bodyPatterns" : [ {
+      "equalToJson" : "{\"text\":\"A message from camel-quarkus-telegram\",\"chat_id\":\"1426416050\"}",
+      "ignoreArrayOrder" : true,
+      "ignoreExtraElements" : true
+    } ]
+  },
+  "response" : {
+    "status" : 200,
+    "body" : "{\"ok\":true,\"result\":{\"message_id\":43,\"from\":{\"id\":1459045600,\"is_bot\":true,\"first_name\":\"camel-quarkus-test\",\"username\":\"CamelQuarkusTestBot\"},\"chat\":{\"id\":1426416050,\"first_name\":\"Apache\",\"last_name\":\"Camel\",\"type\":\"private\"},\"date\":1604406366,\"text\":\"A message from camel-quarkus-telegram\"}}",
+    "headers" : {
+      "Server" : "nginx/1.16.1",
+      "Date" : "Tue, 03 Nov 2020 12:26:06 GMT",
+      "Content-Type" : "application/json",
+      "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload"
+    }
+  },
+  "uuid" : "99cc4134-7c83-446f-83db-5d9fb6886e08",
+  "persistent" : true,
+  "insertionIndex" : 7
+}
\ No newline at end of file
diff --git a/integration-tests/telegram/src/test/resources/mappings/telegramSendPhoto.json b/integration-tests/telegram/src/test/resources/mappings/telegramSendPhoto.json
new file mode 100644
index 0000000..0877a37
--- /dev/null
+++ b/integration-tests/telegram/src/test/resources/mappings/telegramSendPhoto.json
@@ -0,0 +1,24 @@
+{
+  "id" : "009be0d0-2a9f-42d9-8e59-e10e4c21e658",
+  "name" : "botfake-token_sendphoto",
+  "request" : {
+    "url" : "/botfake-token/sendPhoto",
+    "method" : "POST",
+    "bodyPatterns" : [ {
+      "anything" : "anything"
+    } ]
+  },
+  "response" : {
+    "status" : 200,
+    "body" : "{\"ok\":true,\"result\":{\"message_id\":41,\"from\":{\"id\":1459045600,\"is_bot\":true,\"first_name\":\"camel-quarkus-test\",\"username\":\"CamelQuarkusTestBot\"},\"chat\":{\"id\":1426416050,\"first_name\":\"Apache\",\"last_name\":\"Camel\",\"type\":\"private\"},\"date\":1604406366,\"photo\":[{\"file_id\":\"AgACAgQAAxkDAAMpX6FMXuAp6zF9JdQ0RT2yUzp3Kc4AAgWzMRtd1glRWa9enePW3hnwkAYnXQADAQADAgADbQADhucBAAEeBA\",\"file_unique_id\":\"AQAD8JAGJ10AA4bnAQAB\",\"file_size\":1005,\"wid [...]
+    "headers" : {
+      "Server" : "nginx/1.16.1",
+      "Date" : "Tue, 03 Nov 2020 12:26:06 GMT",
+      "Content-Type" : "application/json",
+      "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload"
+    }
+  },
+  "uuid" : "009be0d0-2a9f-42d9-8e59-e10e4c21e658",
+  "persistent" : true,
+  "insertionIndex" : 5
+}
\ No newline at end of file
diff --git a/integration-tests/telegram/src/test/resources/mappings/telegramSendVenue.json b/integration-tests/telegram/src/test/resources/mappings/telegramSendVenue.json
new file mode 100644
index 0000000..669ad30
--- /dev/null
+++ b/integration-tests/telegram/src/test/resources/mappings/telegramSendVenue.json
@@ -0,0 +1,26 @@
+{
+  "id" : "ddf71eec-1f76-4467-8611-d8ec74edc885",
+  "name" : "botfake-token_sendvenue",
+  "request" : {
+    "url" : "/botfake-token/sendVenue",
+    "method" : "POST",
+    "bodyPatterns" : [ {
+      "equalToJson" : "{\"chat_id\":\"1426416050\",\"longitude\":31.136329,\"latitude\":29.977818,\"title\":\"Pyramid of Queen Henutsen\",\"address\":\"El-Hussein Ibn Ali Ln, Nazlet El-Semman, Al Haram, Giza Governorate, Egypt\"}",
+      "ignoreArrayOrder" : true,
+      "ignoreExtraElements" : true
+    } ]
+  },
+  "response" : {
+    "status" : 200,
+    "body" : "{\"ok\":true,\"result\":{\"message_id\":42,\"from\":{\"id\":1459045600,\"is_bot\":true,\"first_name\":\"camel-quarkus-test\",\"username\":\"CamelQuarkusTestBot\"},\"chat\":{\"id\":1426416050,\"first_name\":\"Apache\",\"last_name\":\"Camel\",\"type\":\"private\"},\"date\":1604406366,\"location\":{\"latitude\":29.977826,\"longitude\":31.136330},\"venue\":{\"location\":{\"latitude\":29.977826,\"longitude\":31.136330},\"title\":\"Pyramid of Queen Henutsen\",\"address\":\"El-Hus [...]
+    "headers" : {
+      "Server" : "nginx/1.16.1",
+      "Date" : "Tue, 03 Nov 2020 12:26:06 GMT",
+      "Content-Type" : "application/json",
+      "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload"
+    }
+  },
+  "uuid" : "ddf71eec-1f76-4467-8611-d8ec74edc885",
+  "persistent" : true,
+  "insertionIndex" : 6
+}
\ No newline at end of file
diff --git a/integration-tests/telegram/src/test/resources/mappings/telegramSendVideo.json b/integration-tests/telegram/src/test/resources/mappings/telegramSendVideo.json
new file mode 100644
index 0000000..0b30364
--- /dev/null
+++ b/integration-tests/telegram/src/test/resources/mappings/telegramSendVideo.json
@@ -0,0 +1,24 @@
+{
+  "id" : "5a3b6a9a-8043-4612-8144-b7db9d42a481",
+  "name" : "botfake-token_sendvideo",
+  "request" : {
+    "url" : "/botfake-token/sendVideo",
+    "method" : "POST",
+    "bodyPatterns" : [ {
+      "anything" : "anything"
+    } ]
+  },
+  "response" : {
+    "status" : 200,
+    "body" : "{\"ok\":true,\"result\":{\"message_id\":39,\"from\":{\"id\":1459045600,\"is_bot\":true,\"first_name\":\"camel-quarkus-test\",\"username\":\"CamelQuarkusTestBot\"},\"chat\":{\"id\":1426416050,\"first_name\":\"Apache\",\"last_name\":\"Camel\",\"type\":\"private\"},\"date\":1604406365,\"video\":{\"duration\":4,\"width\":108,\"height\":10,\"file_name\":\"video.mp4\",\"mime_type\":\"video/mp4\",\"thumb\":{\"file_id\":\"AAMCBAADGQMAAydfoUxdmnzfbyDrFSbggnNcxC62vgAC8AYAAl3WCVEmSbAa [...]
+    "headers" : {
+      "Server" : "nginx/1.16.1",
+      "Date" : "Tue, 03 Nov 2020 12:26:05 GMT",
+      "Content-Type" : "application/json",
+      "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload"
+    }
+  },
+  "uuid" : "5a3b6a9a-8043-4612-8144-b7db9d42a481",
+  "persistent" : true,
+  "insertionIndex" : 3
+}
\ No newline at end of file
diff --git a/integration-tests/telegram/src/test/resources/mappings/telegramStopMessageLiveAction.json b/integration-tests/telegram/src/test/resources/mappings/telegramStopMessageLiveAction.json
new file mode 100644
index 0000000..8d86009
--- /dev/null
+++ b/integration-tests/telegram/src/test/resources/mappings/telegramStopMessageLiveAction.json
@@ -0,0 +1,26 @@
+{
+  "id" : "70c0a770-2a98-4f46-ba01-8ba3a71d8e3d",
+  "name" : "botfake-token_stopmessagelivelocation",
+  "request" : {
+    "url" : "/botfake-token/stopMessageLiveLocation",
+    "method" : "POST",
+    "bodyPatterns" : [ {
+      "equalToJson" : "{\"chat_id\":\"1426416050\",\"message_id\":44}",
+      "ignoreArrayOrder" : true,
+      "ignoreExtraElements" : true
+    } ]
+  },
+  "response" : {
+    "status" : 200,
+    "body" : "{\"ok\":true,\"result\":{\"message_id\":44,\"from\":{\"id\":1459045600,\"is_bot\":true,\"first_name\":\"camel-quarkus-test\",\"username\":\"CamelQuarkusTestBot\"},\"chat\":{\"id\":1426416050,\"first_name\":\"Apache\",\"last_name\":\"Camel\",\"type\":\"private\"},\"date\":1604406366,\"edit_date\":1604406367,\"location\":{\"latitude\":29.974934,\"longitude\":31.131109}}}",
+    "headers" : {
+      "Server" : "nginx/1.16.1",
+      "Date" : "Tue, 03 Nov 2020 12:26:07 GMT",
+      "Content-Type" : "application/json",
+      "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload"
+    }
+  },
+  "uuid" : "70c0a770-2a98-4f46-ba01-8ba3a71d8e3d",
+  "persistent" : true,
+  "insertionIndex" : 11
+}
\ No newline at end of file