Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-boot-admin
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
spring-boot-admin
Commits
2bb88304
Commit
2bb88304
authored
May 30, 2016
by
Johannes Edmeier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SlackNotifier#setMessage should accept strings
fixes #202
parent
7ee97cff
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
9 deletions
+4
-9
SlackNotifier.java
.../java/de/codecentric/boot/admin/notify/SlackNotifier.java
+3
-3
SlackNotifierTest.java
...a/de/codecentric/boot/admin/notify/SlackNotifierTest.java
+1
-6
No files found.
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/notify/SlackNotifier.java
View file @
2bb88304
...
...
@@ -77,11 +77,11 @@ public class SlackNotifier extends AbstractStatusChangeNotifier {
this
.
username
=
username
;
}
public
void
setMessage
(
Expression
message
)
{
this
.
message
=
message
;
public
void
setMessage
(
String
message
)
{
this
.
message
=
parser
.
parseExpression
(
message
,
ParserContext
.
TEMPLATE_EXPRESSION
)
;
}
pr
ivate
Object
createMessage
(
ClientApplicationStatusChangedEvent
event
)
{
pr
otected
Object
createMessage
(
ClientApplicationStatusChangedEvent
event
)
{
Map
<
String
,
Object
>
messageJson
=
new
HashMap
<>();
messageJson
.
put
(
"username"
,
username
);
if
(
icon
!=
null
)
{
...
...
spring-boot-admin-server/src/test/java/de/codecentric/boot/admin/notify/SlackNotifierTest.java
View file @
2bb88304
...
...
@@ -14,9 +14,6 @@ import javax.annotation.Nullable;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.springframework.expression.Expression
;
import
org.springframework.expression.ParserContext
;
import
org.springframework.expression.spel.standard.SpelExpressionParser
;
import
org.springframework.web.client.RestTemplate
;
import
de.codecentric.boot.admin.event.ClientApplicationStatusChangedEvent
;
...
...
@@ -93,9 +90,7 @@ public class SlackNotifierTest {
StatusInfo
infoDown
=
StatusInfo
.
ofDown
();
StatusInfo
infoUp
=
StatusInfo
.
ofUp
();
Expression
expression
=
new
SpelExpressionParser
().
parseExpression
(
message
,
ParserContext
.
TEMPLATE_EXPRESSION
);
notifier
.
setMessage
(
expression
);
notifier
.
setMessage
(
message
);
notifier
.
setChannel
(
channel
);
notifier
.
setIcon
(
icon
);
notifier
.
notify
(
getEvent
(
infoDown
,
infoUp
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment