Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
DolphinScheduler
提交
4be5e159
DolphinScheduler
项目概览
apache
/
DolphinScheduler
上一次同步 1 年多
通知
704
Star
9572
Fork
3514
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
DolphinScheduler
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
4be5e159
编写于
2月 06, 2021
作者:
C
chengshiwen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix unit tests
上级
045980b7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
11 addition
and
11 deletion
+11
-11
dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPlugin.java
...pache/dolphinscheduler/alert/plugin/EmailAlertPlugin.java
+6
-7
dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java
...e/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java
+2
-1
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java
...ache/dolphinscheduler/server/worker/task/sql/SqlTask.java
+3
-3
未找到文件。
dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPlugin.java
浏览文件 @
4be5e159
...
...
@@ -96,9 +96,6 @@ public class EmailAlertPlugin implements AlertPlugin {
retMaps
=
emailManager
.
send
(
receviersList
,
receviersCcList
,
alert
.
getTitle
(),
alert
.
getContent
(),
alert
.
getShowType
());
//send flag
boolean
flag
=
false
;
if
(
retMaps
==
null
)
{
retMaps
=
new
HashMap
<>();
retMaps
.
put
(
Constants
.
MESSAGE
,
"alert send error."
);
...
...
@@ -107,9 +104,12 @@ public class EmailAlertPlugin implements AlertPlugin {
return
retMaps
;
}
flag
=
Boolean
.
parseBoolean
(
String
.
valueOf
(
retMaps
.
get
(
Constants
.
STATUS
)));
if
(
flag
)
{
boolean
enabled
=
Boolean
.
parseBoolean
(
String
.
valueOf
(
retMaps
.
get
(
Constants
.
MAIL_ENABLED
)));
boolean
status
=
Boolean
.
parseBoolean
(
String
.
valueOf
(
retMaps
.
get
(
Constants
.
STATUS
)));
if
(!
enabled
)
{
logger
.
warn
(
"mail wasn't sent since the mail config isn't set"
);
retMaps
.
put
(
Constants
.
MESSAGE
,
"mail wasn't sent since the mail config isn't set"
);
}
else
if
(
status
)
{
logger
.
info
(
"alert send success"
);
retMaps
.
put
(
Constants
.
MESSAGE
,
"email send success."
);
if
(
EnterpriseWeChatUtils
.
isEnable
())
{
...
...
@@ -121,7 +121,6 @@ public class EmailAlertPlugin implements AlertPlugin {
logger
.
error
(
e
.
getMessage
(),
e
);
}
}
}
else
{
retMaps
.
put
(
Constants
.
MESSAGE
,
"alert send error."
);
logger
.
info
(
"alert send error : {}"
,
retMaps
.
get
(
Constants
.
MESSAGE
));
...
...
dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java
浏览文件 @
4be5e159
...
...
@@ -75,6 +75,7 @@ public class EmailAlertPluginTest {
List
<
String
>
list
=
new
ArrayList
<
String
>(){{
add
(
"xx@xx.com"
);
}};
alertInfo
.
addProp
(
"receivers"
,
list
);
Map
<
String
,
Object
>
ret
=
plugin
.
process
(
alertInfo
);
assertFalse
(
Boolean
.
parseBoolean
(
String
.
valueOf
(
ret
.
get
(
Constants
.
STATUS
))));
assertFalse
(
Boolean
.
parseBoolean
(
String
.
valueOf
(
ret
.
get
(
Constants
.
MAIL_ENABLED
))));
assertTrue
(
Boolean
.
parseBoolean
(
String
.
valueOf
(
ret
.
get
(
Constants
.
STATUS
))));
}
}
\ No newline at end of file
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java
浏览文件 @
4be5e159
...
...
@@ -453,11 +453,11 @@ public class SqlTask extends AbstractTask {
if
(
EnumUtils
.
isValidEnum
(
ShowType
.
class
,
showTypeName
)){
Map
<
String
,
Object
>
mailResult
=
MailUtils
.
sendMails
(
receiversList
,
receiversCcList
,
title
,
content
,
ShowType
.
valueOf
(
showTypeName
).
getDescp
());
if
(!(
boolean
)
mailResult
.
get
(
STATUS
)){
throw
new
RuntimeException
(
"send mail failed!"
);
}
else
if
(!(
boolean
)
mailResult
.
get
(
MAIL_ENABLED
)){
if
(!(
boolean
)
mailResult
.
get
(
MAIL_ENABLED
)){
logger
.
info
(
"mail info : {} {}"
,
title
,
content
);
logger
.
warn
(
"mail wasn't sent since the mail config isn't set"
);
}
else
if
(!(
boolean
)
mailResult
.
get
(
STATUS
)){
throw
new
RuntimeException
(
"send mail failed!"
);
}
}
else
{
logger
.
error
(
"showType: {} is not valid "
,
showTypeName
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录