-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Slack : fix native support for Webhook URL + add test coverage
Fixes #3541
- Loading branch information
Showing
12 changed files
with
338 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...src/main/java/org/apache/camel/quarkus/component/slack/it/model/SlackMessageResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* 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.model; | ||
|
||
import io.quarkus.runtime.annotations.RegisterForReflection; | ||
|
||
@RegisterForReflection | ||
public class SlackMessageResponse { | ||
String text; | ||
int nbBlocks; | ||
|
||
public SlackMessageResponse() { | ||
} | ||
|
||
public SlackMessageResponse(String text, int nbBlocks) { | ||
this.text = text; | ||
this.nbBlocks = nbBlocks; | ||
} | ||
|
||
public String getText() { | ||
return text; | ||
} | ||
|
||
public void setText(String text) { | ||
this.text = text; | ||
} | ||
|
||
public int getNbBlocks() { | ||
return nbBlocks; | ||
} | ||
|
||
public void setNbBlocks(int nbBlocks) { | ||
this.nbBlocks = nbBlocks; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
integration-tests/slack/src/test/resources/mappings/slackChatPostMessageWithBlocks.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"id" : "c86380a0-2c6e-41ec-8183-467013109f96", | ||
"name" : "chatpostmessage", | ||
"request" : { | ||
"url" : "/api/chat.postMessage", | ||
"method" : "POST", | ||
"bodyPatterns" : [ { | ||
"equalTo" : "channel=test-channel&text=Hello%20Camel%20Quarkus%20Slack%20using%20Blocks&link_names=0&mrkdwn=1&blocks=%5B%7B%22type%22%3A%22section%22%2C%22text%22%3A%7B%22type%22%3A%22mrkdwn%22%2C%22text%22%3A%22Hello%20Camel%20Quarkus%20Slack%20using%20Blocks%22%7D%7D%2C%7B%22type%22%3A%22section%22%2C%22fields%22%3A%5B%7B%22type%22%3A%22mrkdwn%22%2C%22text%22%3A%22*Testing%20Camel%20Quarkus%20blocks*%22%7D%2C%7B%22type%22%3A%22mrkdwn%22%2C%22text%22%3A%22*You%20should%20be%20able%20to%20see%20these%20blocks%22%7D%5D%7D%2C%7B%22type%22%3A%22divider%22%7D%5D&unfurl_links=0&unfurl_media=0&reply_broadcast=0", | ||
"caseInsensitive" : false | ||
} ] | ||
}, | ||
"response" : { | ||
"status" : 200, | ||
"body" : "{\"ok\":true,\"channel\":\"test\",\"ts\":\"1615377778.002900\",\"message\":{\"bot_id\":\"test\",\"type\":\"message\",\"text\":\"Hello Camel Quarkus Slack\",\"user\":\"test\",\"ts\":\"1615377778.002900\",\"team\":\"test\",\"bot_profile\":{\"id\":\"test\",\"deleted\":false,\"name\":\"API Test\",\"updated\":1615375056,\"app_id\":\"test\",\"icons\":{\"image_36\":\"https:\\/\\/a.slack-edge.com\\/80588\\/img\\/plugins\\/app\\/bot_36.png\",\"image_48\":\"https:\\/\\/a.slack-edge.com\\/80588\\/img\\/plugins\\/app\\/bot_48.png\",\"image_72\":\"https:\\/\\/a.slack-edge.com\\/80588\\/img\\/plugins\\/app\\/service_72.png\"},\"team_id\":\"test\"}}}", | ||
"headers" : { | ||
"date" : "Wed, 10 Mar 2021 12:02:58 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" : "f353e4e5fc6450a0ca4a32ed0ad4e203", | ||
"x-content-type-options" : "nosniff", | ||
"referrer-policy" : "no-referrer", | ||
"x-slack-backend" : "r", | ||
"x-oauth-scopes" : "incoming-webhook,chat:write,channels:read,groups:read,mpim:read,im:read,channels:history,groups:history,mpim:history,im:history", | ||
"x-accepted-oauth-scopes" : "chat:write", | ||
"expires" : "Mon, 26 Jul 1997 05:00:00 GMT", | ||
"vary" : "Accept-Encoding", | ||
"content-type" : "application/json; charset=utf-8", | ||
"x-envoy-upstream-service-time" : "61", | ||
"x-backend" : "main_normal main_canary_with_overflow main_control_with_overflow", | ||
"x-server" : "slack-www-hhvm-main-iad-au28", | ||
"x-via" : "envoy-www-iad-yrq3, haproxy-edge-lhr-ubwz", | ||
"x-slack-shared-secret-outcome" : "shared-secret", | ||
"via" : "envoy-www-iad-yrq3" | ||
} | ||
}, | ||
"uuid" : "c86380a0-2c6e-41ec-8183-467013109f96", | ||
"persistent" : true, | ||
"insertionIndex" : 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
integration-tests/slack/src/test/resources/mappings/slackChatPostMessageWithWebhook.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"id" : "c86380a0-2c6e-41ec-8183-467013109f96", | ||
"name" : "chatpostmessage", | ||
"request" : { | ||
"url" : "/services/webhook", | ||
"method" : "POST", | ||
"bodyPatterns" : [ { | ||
"equalTo" : "{\"text\":\"Hello Camel Quarkus Slack using Webhook URL\",\"channel\":\"test-channel\"}", | ||
"caseInsensitive" : false | ||
} ] | ||
}, | ||
"response" : { | ||
"status" : 200, | ||
"body" : "{\"ok\":true,\"channel\":\"test\",\"ts\":\"1615377778.002900\",\"message\":{\"bot_id\":\"test\",\"type\":\"message\",\"text\":\"Hello Camel Quarkus Slack\",\"user\":\"test\",\"ts\":\"1615377778.002900\",\"team\":\"test\",\"bot_profile\":{\"id\":\"test\",\"deleted\":false,\"name\":\"API Test\",\"updated\":1615375056,\"app_id\":\"test\",\"icons\":{\"image_36\":\"https:\\/\\/a.slack-edge.com\\/80588\\/img\\/plugins\\/app\\/bot_36.png\",\"image_48\":\"https:\\/\\/a.slack-edge.com\\/80588\\/img\\/plugins\\/app\\/bot_48.png\",\"image_72\":\"https:\\/\\/a.slack-edge.com\\/80588\\/img\\/plugins\\/app\\/service_72.png\"},\"team_id\":\"test\"}}}", | ||
"headers" : { | ||
"date" : "Wed, 10 Mar 2021 12:02:58 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" : "f353e4e5fc6450a0ca4a32ed0ad4e203", | ||
"x-content-type-options" : "nosniff", | ||
"referrer-policy" : "no-referrer", | ||
"x-slack-backend" : "r", | ||
"x-oauth-scopes" : "incoming-webhook,chat:write,channels:read,groups:read,mpim:read,im:read,channels:history,groups:history,mpim:history,im:history", | ||
"x-accepted-oauth-scopes" : "chat:write", | ||
"expires" : "Mon, 26 Jul 1997 05:00:00 GMT", | ||
"vary" : "Accept-Encoding", | ||
"content-type" : "application/json; charset=utf-8", | ||
"x-envoy-upstream-service-time" : "61", | ||
"x-backend" : "main_normal main_canary_with_overflow main_control_with_overflow", | ||
"x-server" : "slack-www-hhvm-main-iad-au28", | ||
"x-via" : "envoy-www-iad-yrq3, haproxy-edge-lhr-ubwz", | ||
"x-slack-shared-secret-outcome" : "shared-secret", | ||
"via" : "envoy-www-iad-yrq3" | ||
} | ||
}, | ||
"uuid" : "c86380a0-2c6e-41ec-8183-467013109f96", | ||
"persistent" : true, | ||
"insertionIndex" : 2 | ||
} |
Oops, something went wrong.