This is an automated email from the ASF dual-hosted git repository. zbendhiba pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit f9b58c69d62213a527345080d9f1372c753b2eb5 Author: Zineb Bendhiba <bendhiba.zi...@gmail.com> AuthorDate: Mon Mar 14 21:00:29 2022 +0100 📝Slack test : update Readme with new Oauth Configuration and set a channel name that isn't dependent on user slack language --- integration-tests/slack/README.adoc | 27 +++++++++++++++++++++- .../quarkus/component/slack/it/SlackResource.java | 4 ++-- .../resources/mappings/slackChatPostMessage.json | 2 +- .../mappings/slackGetConversationHistory.json | 2 +- .../mappings/slackGetConversationsList.json | 2 +- 5 files changed, 31 insertions(+), 6 deletions(-) diff --git a/integration-tests/slack/README.adoc b/integration-tests/slack/README.adoc index 4a4dd49..4925dc7 100644 --- a/integration-tests/slack/README.adoc +++ b/integration-tests/slack/README.adoc @@ -4,7 +4,32 @@ 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. +Create a channel named `test-channel`. + +You’ll need to create a Slack app and use it on your workspace. + +Use the 'User OAuth Token' as token for the producer abd consumer endpoints. Set the corresponding scopes for Bot Token: + +* `channels:history` +* `groups:history` +* `im:history` +* `mpim:history` +* `channels:read` +* `groups:read` +* `im:read` +* `mpim:read` +* `chat:write` + +Install your app for the channel `test-channel`. + +Add an `Incoming Webhook` for you app. + +Invite the bot in the channel `test-channel`. + +[source] +---- +/invite @BOT_NAME +---- Next set the following environment variables: 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 1badb99..aa01596 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 @@ -52,7 +52,7 @@ public class SlackResource { @GET @Produces(MediaType.TEXT_PLAIN) public String getSlackMessages() throws Exception { - Message message = consumerTemplate.receiveBody("slack://general?maxResults=1&" + getSlackAuthParams(), + Message message = consumerTemplate.receiveBody("slack://test-channel?maxResults=1&" + getSlackAuthParams(), 5000L, Message.class); return message.getText(); } @@ -61,7 +61,7 @@ public class SlackResource { @POST @Consumes(MediaType.TEXT_PLAIN) public Response createSlackMessage(String message) throws Exception { - producerTemplate.requestBody("slack://general?" + getSlackAuthParams(), message); + producerTemplate.requestBody("slack://test-channel?" + getSlackAuthParams(), message); return Response .created(new URI("https://camel.apache.org/")) .build(); diff --git a/integration-tests/slack/src/test/resources/mappings/slackChatPostMessage.json b/integration-tests/slack/src/test/resources/mappings/slackChatPostMessage.json index 825527a..d811dac 100644 --- a/integration-tests/slack/src/test/resources/mappings/slackChatPostMessage.json +++ b/integration-tests/slack/src/test/resources/mappings/slackChatPostMessage.json @@ -5,7 +5,7 @@ "url" : "/api/chat.postMessage", "method" : "POST", "bodyPatterns" : [ { - "equalTo" : "channel=general&text=Hello%20Camel%20Quarkus%20Slack&link_names=0&mrkdwn=1&unfurl_links=0&unfurl_media=0&reply_broadcast=0", + "equalTo" : "channel=test-channel&text=Hello%20Camel%20Quarkus%20Slack&link_names=0&mrkdwn=1&unfurl_links=0&unfurl_media=0&reply_broadcast=0", "caseInsensitive" : false } ] }, diff --git a/integration-tests/slack/src/test/resources/mappings/slackGetConversationHistory.json b/integration-tests/slack/src/test/resources/mappings/slackGetConversationHistory.json index 5dba994..affefc2 100644 --- a/integration-tests/slack/src/test/resources/mappings/slackGetConversationHistory.json +++ b/integration-tests/slack/src/test/resources/mappings/slackGetConversationHistory.json @@ -5,7 +5,7 @@ "url" : "/api/conversations.history", "method" : "POST", "bodyPatterns" : [ { - "equalTo" : "channel=test&limit=1&inclusive=0", + "equalTo" : "channel=test-channel&limit=1&inclusive=0", "caseInsensitive" : false } ] }, diff --git a/integration-tests/slack/src/test/resources/mappings/slackGetConversationsList.json b/integration-tests/slack/src/test/resources/mappings/slackGetConversationsList.json index 2de6764..b719a99 100644 --- a/integration-tests/slack/src/test/resources/mappings/slackGetConversationsList.json +++ b/integration-tests/slack/src/test/resources/mappings/slackGetConversationsList.json @@ -11,7 +11,7 @@ }, "response" : { "status" : 200, - "body" : "{\"ok\":true,\"channels\":[{\"id\":\"test\",\"name\":\"java-development\",\"is_channel\":true,\"is_group\":false,\"is_im\":false,\"created\":1571904170,\"is_archived\":false,\"is_general\":false,\"unlinked\":0,\"name_normalized\":\"java-development\",\"is_shared\":false,\"parent_conversation\":null,\"creator\":\"test\",\"is_ext_shared\":false,\"is_org_shared\":false,\"shared_team_ids\":[\"test\"],\"pending_shared\":[],\"pending_connected_team_ids\":[],\"is_pending_ext_share [...] + "body" : "{\"ok\":true,\"channels\":[{\"id\":\"test\",\"name\":\"java-development\",\"is_channel\":true,\"is_group\":false,\"is_im\":false,\"created\":1571904170,\"is_archived\":false,\"is_general\":false,\"unlinked\":0,\"name_normalized\":\"java-development\",\"is_shared\":false,\"parent_conversation\":null,\"creator\":\"test\",\"is_ext_shared\":false,\"is_org_shared\":false,\"shared_team_ids\":[\"test\"],\"pending_shared\":[],\"pending_connected_team_ids\":[],\"is_pending_ext_share [...] "headers" : { "date" : "Wed, 10 Mar 2021 12:02:58 GMT", "server" : "Apache",