Browse Source

[2.0.1-prepare]revert alert plugin novalid change

2.0.7-release
CalvinKirs 3 years ago
parent
commit
70e67dfc67
  1. 2
      dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertChannelFactory.java
  2. 2
      dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertConstants.java
  3. 67
      dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java
  4. 22
      dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkParamsConstants.java
  5. 3
      dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSender.java
  6. 24
      dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailParamsConstants.java
  7. 134
      dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelTest.java
  8. 27
      dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuParamsConstants.java
  9. 10
      dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactory.java
  10. 20
      dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertConstants.java
  11. 10
      dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpSender.java
  12. 10
      dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpSenderTest.java
  13. 7
      dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptParamsConstants.java
  14. 7
      dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackParamsConstants.java
  15. 29
      dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertParamsConstants.java

2
dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertChannelFactory.java

@ -27,9 +27,9 @@ public interface AlertChannelFactory {
String name(); String name();
AlertChannel create(); AlertChannel create();
/** /**
* Returns the configurable parameters that this plugin needs to display on the web ui * Returns the configurable parameters that this plugin needs to display on the web ui
*/ */
List<PluginParams> params(); List<PluginParams> params();
} }

2
dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertConstants.java

@ -23,7 +23,7 @@ public final class AlertConstants {
/** /**
* the field name of alert show type * the field name of alert show type
**/ **/
public static final String SHOW_TYPE = "$t('showType')"; public static final String SHOW_TYPE = "show_type";
public static final String NAME_SHOW_TYPE = "showType"; public static final String NAME_SHOW_TYPE = "showType";

67
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java

@ -43,52 +43,53 @@ public final class DingTalkAlertChannelFactory implements AlertChannelFactory {
return "DingTalk"; return "DingTalk";
} }
@Override
public AlertChannel create() {
return new DingTalkAlertChannel();
}
@Override @Override
public List<PluginParams> params() { public List<PluginParams> params() {
InputParam webHookParam = InputParam.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_WEB_HOOK, DingTalkParamsConstants.DING_TALK_WEB_HOOK) InputParam webHookParam = InputParam.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_WEB_HOOK, DingTalkParamsConstants.DING_TALK_WEB_HOOK)
.addValidate(Validate.newBuilder() .addValidate(Validate.newBuilder()
.setRequired(true) .setRequired(true)
.build()) .build())
.build(); .build();
InputParam keywordParam = InputParam.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_KEYWORD, DingTalkParamsConstants.DING_TALK_KEYWORD) InputParam keywordParam = InputParam.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_KEYWORD, DingTalkParamsConstants.DING_TALK_KEYWORD)
.addValidate(Validate.newBuilder() .addValidate(Validate.newBuilder()
.setRequired(true) .setRequired(true)
.build()) .build())
.build(); .build();
RadioParam isEnableProxy = RadioParam isEnableProxy =
RadioParam.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_PROXY_ENABLE, DingTalkParamsConstants.DING_TALK_PROXY_ENABLE) RadioParam.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_PROXY_ENABLE, DingTalkParamsConstants.NAME_DING_TALK_PROXY_ENABLE)
.addParamsOptions(new ParamsOptions(STRING_YES, STRING_TRUE, false)) .addParamsOptions(new ParamsOptions(STRING_YES, STRING_TRUE, false))
.addParamsOptions(new ParamsOptions(STRING_NO, STRING_FALSE, false)) .addParamsOptions(new ParamsOptions(STRING_NO, STRING_FALSE, false))
.setValue(STRING_TRUE) .setValue(STRING_TRUE)
.addValidate(Validate.newBuilder() .addValidate(Validate.newBuilder()
.setRequired(false) .setRequired(false)
.build()) .build())
.build(); .build();
InputParam proxyParam = InputParam proxyParam =
InputParam.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_PROXY, DingTalkParamsConstants.DING_TALK_PROXY) InputParam.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_PROXY, DingTalkParamsConstants.DING_TALK_PROXY)
.addValidate(Validate.newBuilder() .addValidate(Validate.newBuilder()
.setRequired(false).build()) .setRequired(false).build())
.build(); .build();
InputParam portParam = InputParam.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_PORT, DingTalkParamsConstants.DING_TALK_PORT) InputParam portParam = InputParam.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_PORT, DingTalkParamsConstants.DING_TALK_PORT)
.addValidate(Validate.newBuilder() .addValidate(Validate.newBuilder()
.setRequired(false).build()) .setRequired(false).build())
.build(); .build();
InputParam userParam = InputParam userParam =
InputParam.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_USER, DingTalkParamsConstants.DING_TALK_USER) InputParam.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_USER, DingTalkParamsConstants.DING_TALK_USER)
.addValidate(Validate.newBuilder() .addValidate(Validate.newBuilder()
.setRequired(false).build()) .setRequired(false).build())
.build(); .build();
PasswordParam passwordParam = PasswordParam.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_PASSWORD, DingTalkParamsConstants.DING_TALK_PASSWORD) PasswordParam passwordParam = PasswordParam.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_PASSWORD, DingTalkParamsConstants.DING_TALK_PASSWORD)
.setPlaceholder("if enable use authentication, you need input password") .setPlaceholder("if enable use authentication, you need input password")
.build(); .build();
return Arrays.asList(webHookParam, keywordParam, isEnableProxy, proxyParam, portParam, userParam, passwordParam); return Arrays.asList(webHookParam, keywordParam, isEnableProxy, proxyParam, portParam, userParam, passwordParam);
} }
@Override
public AlertChannel create() {
return new DingTalkAlertChannel();
}
} }

22
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkParamsConstants.java

@ -18,25 +18,19 @@
package org.apache.dolphinscheduler.plugin.alert.dingtalk; package org.apache.dolphinscheduler.plugin.alert.dingtalk;
public final class DingTalkParamsConstants { public final class DingTalkParamsConstants {
static final String DING_TALK_PROXY_ENABLE = "$t('isEnableProxy')"; static final String DING_TALK_PROXY_ENABLE = "isEnableProxy";
static final String NAME_DING_TALK_PROXY_ENABLE = "IsEnableProxy"; static final String DING_TALK_WEB_HOOK = "webhook";
static final String DING_TALK_WEB_HOOK = "$t('webhook')";
static final String NAME_DING_TALK_WEB_HOOK = "WebHook"; static final String NAME_DING_TALK_WEB_HOOK = "WebHook";
static final String DING_TALK_KEYWORD = "keyword";
static final String DING_TALK_KEYWORD = "$t('keyword')";
static final String NAME_DING_TALK_KEYWORD = "Keyword"; static final String NAME_DING_TALK_KEYWORD = "Keyword";
static final String NAME_DING_TALK_PROXY_ENABLE = "IsEnableProxy";
static final String DING_TALK_PROXY = "$t('proxy')"; static final String DING_TALK_PROXY = "proxy";
static final String NAME_DING_TALK_PROXY = "Proxy"; static final String NAME_DING_TALK_PROXY = "Proxy";
static final String DING_TALK_PORT = "port";
static final String DING_TALK_PORT = "$t('port')";
static final String NAME_DING_TALK_PORT = "Port"; static final String NAME_DING_TALK_PORT = "Port";
static final String DING_TALK_USER = "user";
static final String DING_TALK_USER = "$t('user')";
static final String NAME_DING_TALK_USER = "User"; static final String NAME_DING_TALK_USER = "User";
static final String DING_TALK_PASSWORD = "password";
static final String DING_TALK_PASSWORD = "$t('password')";
static final String NAME_DING_TALK_PASSWORD = "Password"; static final String NAME_DING_TALK_PASSWORD = "Password";
private DingTalkParamsConstants() { private DingTalkParamsConstants() {

3
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSender.java

@ -196,6 +196,7 @@ public final class DingTalkSender {
this.errmsg = errmsg; this.errmsg = errmsg;
} }
@Override
public boolean equals(final Object o) { public boolean equals(final Object o) {
if (o == this) { if (o == this) {
return true; return true;
@ -217,6 +218,7 @@ public final class DingTalkSender {
return true; return true;
} }
@Override
public int hashCode() { public int hashCode() {
final int PRIME = 59; final int PRIME = 59;
int result = 1; int result = 1;
@ -227,6 +229,7 @@ public final class DingTalkSender {
return result; return result;
} }
@Override
public String toString() { public String toString() {
return "DingTalkSender.DingTalkSendMsgResponse(errcode=" + this.getErrcode() + ", errmsg=" + this.getErrmsg() + ")"; return "DingTalkSender.DingTalkSendMsgResponse(errcode=" + this.getErrcode() + ", errmsg=" + this.getErrmsg() + ")";
} }

24
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailParamsConstants.java

@ -18,39 +18,41 @@
package org.apache.dolphinscheduler.plugin.alert.email; package org.apache.dolphinscheduler.plugin.alert.email;
public final class MailParamsConstants { public final class MailParamsConstants {
public static final String PLUGIN_DEFAULT_EMAIL_RECEIVERS = "$t('receivers')"; public static final String PLUGIN_DEFAULT_EMAIL_RECEIVERS = "$t('receivers')";
public static final String NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS = "receivers"; public static final String NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS = "receivers";
public static final String PLUGIN_DEFAULT_EMAIL_RECEIVERCCS = "$t('receiverCcs')"; public static final String PLUGIN_DEFAULT_EMAIL_RECEIVERCCS = "$t('receiverCcs')";
public static final String NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERCCS = "receiverCcs"; public static final String NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERCCS = "receiverCcs";
public static final String MAIL_PROTOCOL = "transport.protocol";
public static final String NAME_MAIL_PROTOCOL = "mail.protocol"; public static final String NAME_MAIL_PROTOCOL = "mail.protocol";
public static final String MAIL_SMTP_HOST = "$t('mailSmtpHost')"; public static final String MAIL_SMTP_HOST = "mail.smtp.host";
public static final String NAME_MAIL_SMTP_HOST = "serverHost"; public static final String NAME_MAIL_SMTP_HOST = "serverHost";
public static final String MAIL_SMTP_PORT = "$t('mailSmtpPort')"; public static final String MAIL_SMTP_PORT = "mail.smtp.port";
public static final String NAME_MAIL_SMTP_PORT = "serverPort"; public static final String NAME_MAIL_SMTP_PORT = "serverPort";
public static final String MAIL_SENDER = "$t('mailSender')"; public static final String MAIL_SENDER = "mail.sender";
public static final String NAME_MAIL_SENDER = "sender"; public static final String NAME_MAIL_SENDER = "sender";
public static final String MAIL_SMTP_AUTH = "$t('mailSmtpAuth')"; public static final String MAIL_SMTP_AUTH = "mail.smtp.auth";
public static final String NAME_MAIL_SMTP_AUTH = "enableSmtpAuth"; public static final String NAME_MAIL_SMTP_AUTH = "enableSmtpAuth";
public static final String MAIL_USER = "$t('mailUser')"; public static final String MAIL_USER = "mail.user";
public static final String NAME_MAIL_USER = "User"; public static final String NAME_MAIL_USER = "user";
public static final String MAIL_PASSWD = "$t('mailPasswd')"; public static final String MAIL_PASSWD = "mail.passwd";
public static final String NAME_MAIL_PASSWD = "Password"; public static final String NAME_MAIL_PASSWD = "passwd";
public static final String MAIL_SMTP_STARTTLS_ENABLE = "$t('mailSmtpStarttlsEnable')"; public static final String MAIL_SMTP_STARTTLS_ENABLE = "mail.smtp.starttls.enable";
public static final String NAME_MAIL_SMTP_STARTTLS_ENABLE = "starttlsEnable"; public static final String NAME_MAIL_SMTP_STARTTLS_ENABLE = "starttlsEnable";
public static final String MAIL_SMTP_SSL_ENABLE = "$t('mailSmtpSslEnable')"; public static final String MAIL_SMTP_SSL_ENABLE = "mail.smtp.ssl.enable";
public static final String NAME_MAIL_SMTP_SSL_ENABLE = "sslEnable"; public static final String NAME_MAIL_SMTP_SSL_ENABLE = "sslEnable";
public static final String MAIL_SMTP_SSL_TRUST = "$t('mailSmtpSslTrust')"; public static final String MAIL_SMTP_SSL_TRUST = "mail.smtp.ssl.trust";
public static final String NAME_MAIL_SMTP_SSL_TRUST = "smtpSslTrust"; public static final String NAME_MAIL_SMTP_SSL_TRUST = "smtpSslTrust";
private MailParamsConstants() { private MailParamsConstants() {

134
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelTest.java

@ -40,6 +40,10 @@ import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
public class EmailAlertChannelTest { public class EmailAlertChannelTest {
/**
* Method: process(AlertInfo info)
*/
@Test @Test
public void testProcess() { public void testProcess() {
EmailAlertChannel emailAlertChannel = new EmailAlertChannel(); EmailAlertChannel emailAlertChannel = new EmailAlertChannel();
@ -55,9 +59,9 @@ public class EmailAlertChannelTest {
String mapjson = JSONUtils.toJsonString(maps); String mapjson = JSONUtils.toJsonString(maps);
alertData.setId(10) alertData.setId(10)
.setContent(mapjson) .setContent(mapjson)
.setLog("10") .setLog("10")
.setTitle("test"); .setTitle("test");
AlertInfo alertInfo = new AlertInfo(); AlertInfo alertInfo = new AlertInfo();
alertInfo.setAlertData(alertData); alertInfo.setAlertData(alertData);
Map<String, String> paramsMap = PluginParamsTransfer.getPluginParamsMap(getEmailAlertParams()); Map<String, String> paramsMap = PluginParamsTransfer.getPluginParamsMap(getEmailAlertParams());
@ -70,74 +74,74 @@ public class EmailAlertChannelTest {
public String getEmailAlertParams() { public String getEmailAlertParams() {
List<PluginParams> paramsList = new ArrayList<>(); List<PluginParams> paramsList = new ArrayList<>();
InputParam receivesParam = InputParam.newBuilder(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS, "receivers") InputParam receivesParam = InputParam.newBuilder("receivers", "receivers")
.setValue("540957506@qq.com") .setValue("540957506@qq.com")
.addValidate(Validate.newBuilder().setRequired(true).build()) .addValidate(Validate.newBuilder().setRequired(true).build())
.build(); .build();
InputParam mailSmtpHost = InputParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_HOST, "smtp.host") InputParam mailSmtpHost = InputParam.newBuilder("serverHost", "smtp.host")
.addValidate(Validate.newBuilder().setRequired(true).build()) .addValidate(Validate.newBuilder().setRequired(true).build())
.setValue("smtp.126.com") .setValue("smtp.126.com")
.build(); .build();
InputParam mailSmtpPort = InputParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_PORT, "smtp.port") InputParam mailSmtpPort = InputParam.newBuilder("serverPort", "smtp.port")
.addValidate(Validate.newBuilder() .addValidate(Validate.newBuilder()
.setRequired(true) .setRequired(true)
.build()) .build())
.setValue("25") .setValue("25")
.build(); .build();
InputParam mailSender = InputParam.newBuilder(MailParamsConstants.NAME_MAIL_SENDER, "sender") InputParam mailSender = InputParam.newBuilder("sender", "sender")
.addValidate(Validate.newBuilder().setRequired(true).build()) .addValidate(Validate.newBuilder().setRequired(true).build())
.setValue("dolphinscheduler@126.com") .setValue("dolphinscheduler@126.com")
.build(); .build();
RadioParam enableSmtpAuth = RadioParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_AUTH, "smtp.auth") RadioParam enableSmtpAuth = RadioParam.newBuilder("enableSmtpAuth", "smtp.auth")
.addParamsOptions(new ParamsOptions("YES", "true", false)) .addParamsOptions(new ParamsOptions("YES", "true", false))
.addParamsOptions(new ParamsOptions("NO", "false", false)) .addParamsOptions(new ParamsOptions("NO", "false", false))
.addValidate(Validate.newBuilder().setRequired(true).build()) .addValidate(Validate.newBuilder().setRequired(true).build())
.setValue("false") .setValue("false")
.build(); .build();
InputParam mailUser = InputParam.newBuilder(MailParamsConstants.NAME_MAIL_USER, "user") InputParam mailUser = InputParam.newBuilder("user", "user")
.setPlaceholder("if enable use authentication, you need input user") .setPlaceholder("if enable use authentication, you need input user")
.setValue("dolphinscheduler@126.com") .setValue("dolphinscheduler@126.com")
.build(); .build();
PasswordParam mailPassword = PasswordParam.newBuilder(MailParamsConstants.NAME_MAIL_PASSWD, "passwd") PasswordParam mailPassword = PasswordParam.newBuilder("passwd", "passwd")
.setPlaceholder("if enable use authentication, you need input password") .setPlaceholder("if enable use authentication, you need input password")
.setValue("escheduler123") .setValue("escheduler123")
.build(); .build();
RadioParam enableTls = RadioParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_STARTTLS_ENABLE, "starttls.enable") RadioParam enableTls = RadioParam.newBuilder("starttlsEnable", "starttls.enable")
.addParamsOptions(new ParamsOptions("YES", "true", false)) .addParamsOptions(new ParamsOptions("YES", "true", false))
.addParamsOptions(new ParamsOptions("NO", "false", false)) .addParamsOptions(new ParamsOptions("NO", "false", false))
.addValidate(Validate.newBuilder().setRequired(true).build()) .addValidate(Validate.newBuilder().setRequired(true).build())
.setValue("true") .setValue("true")
.build(); .build();
RadioParam enableSsl = RadioParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_SSL_ENABLE, "smtp.ssl.enable") RadioParam enableSsl = RadioParam.newBuilder("sslEnable", "smtp.ssl.enable")
.addParamsOptions(new ParamsOptions("YES", "true", false)) .addParamsOptions(new ParamsOptions("YES", "true", false))
.addParamsOptions(new ParamsOptions("NO", "false", false)) .addParamsOptions(new ParamsOptions("NO", "false", false))
.addValidate(Validate.newBuilder().setRequired(true).build()) .addValidate(Validate.newBuilder().setRequired(true).build())
.setValue("true") .setValue("true")
.build(); .build();
InputParam sslTrust = InputParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_SSL_TRUST, "smtp.ssl.trust") InputParam sslTrust = InputParam.newBuilder("smtpSslTrust", "smtp.ssl.trust")
.addValidate(Validate.newBuilder().setRequired(true).build()) .addValidate(Validate.newBuilder().setRequired(true).build())
.setValue("smtp.126.com") .setValue("smtp.126.com")
.build(); .build();
List<ParamsOptions> emailShowTypeList = new ArrayList<>(); List<ParamsOptions> emailShowTypeList = new ArrayList<>();
emailShowTypeList.add(new ParamsOptions(ShowType.TABLE.getDescp(), ShowType.TABLE.getDescp(), false)); emailShowTypeList.add(new ParamsOptions(ShowType.TABLE.getDescp(), ShowType.TABLE.getDescp(), false));
emailShowTypeList.add(new ParamsOptions(ShowType.TEXT.getDescp(), ShowType.TEXT.getDescp(), false)); emailShowTypeList.add(new ParamsOptions(ShowType.TEXT.getDescp(), ShowType.TEXT.getDescp(), false));
emailShowTypeList.add(new ParamsOptions(ShowType.ATTACHMENT.getDescp(), ShowType.ATTACHMENT.getDescp(), false)); emailShowTypeList.add(new ParamsOptions(ShowType.ATTACHMENT.getDescp(), ShowType.ATTACHMENT.getDescp(), false));
emailShowTypeList.add(new ParamsOptions(ShowType.TABLEATTACHMENT.getDescp(), ShowType.TABLEATTACHMENT.getDescp(), false)); emailShowTypeList.add(new ParamsOptions(ShowType.TABLEATTACHMENT.getDescp(), ShowType.TABLEATTACHMENT.getDescp(), false));
RadioParam showType = RadioParam.newBuilder(AlertConstants.NAME_SHOW_TYPE, "showType") RadioParam showType = RadioParam.newBuilder(AlertConstants.SHOW_TYPE, "showType")
.setOptions(emailShowTypeList) .setOptions(emailShowTypeList)
.setValue(ShowType.TABLE.getDescp()) .setValue(ShowType.TABLE.getDescp())
.addValidate(Validate.newBuilder().setRequired(true).build()) .addValidate(Validate.newBuilder().setRequired(true).build())
.build(); .build();
paramsList.add(receivesParam); paramsList.add(receivesParam);
paramsList.add(mailSmtpHost); paramsList.add(mailSmtpHost);

27
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuParamsConstants.java

@ -18,26 +18,29 @@
package org.apache.dolphinscheduler.plugin.alert.feishu; package org.apache.dolphinscheduler.plugin.alert.feishu;
public final class FeiShuParamsConstants { public final class FeiShuParamsConstants {
public static final String FEI_SHU_PROXY_ENABLE = "$t('isEnableProxy')"; static final String WEB_HOOK = "webhook";
static final String WEB_HOOK = "$t('webhook')";
static final String NAME_WEB_HOOK = "WebHook";
static final String NAME_FEI_SHU_PROXY_ENABLE = "IsEnableProxy";
static final String FEI_SHU_PROXY = "$t('proxy')"; static final String NAME_WEB_HOOK = "webHook";
static final String NAME_FEI_SHU_PROXY = "Proxy"; public static final String FEI_SHU_PROXY_ENABLE = "isEnableProxy";
static final String FEI_SHU_PORT = "$t('port')"; static final String NAME_FEI_SHU_PROXY_ENABLE = "isEnableProxy";
static final String NAME_FEI_SHU_PORT = "Port"; static final String FEI_SHU_PROXY = "proxy";
static final String FEI_SHU_USER = "$t('user')"; static final String NAME_FEI_SHU_PROXY = "proxy";
static final String NAME_FEI_SHU_USER = "User"; static final String FEI_SHU_PORT = "port";
static final String FEI_SHU_PASSWORD = "$t('password')"; static final String NAME_FEI_SHU_PORT = "port";
static final String NAME_FEI_SHU_PASSWORD = "Password"; static final String FEI_SHU_USER = "user";
static final String NAME_FEI_SHU_USER = "user";
static final String FEI_SHU_PASSWORD = "password";
static final String NAME_FEI_SHU_PASSWORD = "password";
private FeiShuParamsConstants() { private FeiShuParamsConstants() {
throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");

10
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactory.java

@ -38,31 +38,31 @@ public final class HttpAlertChannelFactory implements AlertChannelFactory {
@Override @Override
public List<PluginParams> params() { public List<PluginParams> params() {
InputParam url = InputParam.newBuilder(HttpAlertConstants.NAME_URL, HttpAlertConstants.URL) InputParam url = InputParam.newBuilder(HttpAlertConstants.URL, HttpAlertConstants.URL)
.addValidate(Validate.newBuilder() .addValidate(Validate.newBuilder()
.setRequired(true) .setRequired(true)
.build()) .build())
.build(); .build();
InputParam headerParams = InputParam.newBuilder(HttpAlertConstants.NAME_HEADER_PARAMS, HttpAlertConstants.HEADER_PARAMS) InputParam headerParams = InputParam.newBuilder(HttpAlertConstants.HEADER_PARAMS, HttpAlertConstants.HEADER_PARAMS)
.addValidate(Validate.newBuilder() .addValidate(Validate.newBuilder()
.setRequired(true) .setRequired(true)
.build()) .build())
.build(); .build();
InputParam bodyParams = InputParam.newBuilder(HttpAlertConstants.NAME_BODY_PARAMS, HttpAlertConstants.BODY_PARAMS) InputParam bodyParams = InputParam.newBuilder(HttpAlertConstants.BODY_PARAMS, HttpAlertConstants.BODY_PARAMS)
.addValidate(Validate.newBuilder() .addValidate(Validate.newBuilder()
.setRequired(true) .setRequired(true)
.build()) .build())
.build(); .build();
InputParam contentField = InputParam.newBuilder(HttpAlertConstants.NAME_CONTENT_FIELD, HttpAlertConstants.CONTENT_FIELD) InputParam contentField = InputParam.newBuilder(HttpAlertConstants.CONTENT_FIELD, HttpAlertConstants.CONTENT_FIELD)
.addValidate(Validate.newBuilder() .addValidate(Validate.newBuilder()
.setRequired(true) .setRequired(true)
.build()) .build())
.build(); .build();
InputParam requestType = InputParam.newBuilder(HttpAlertConstants.NAME_REQUEST_TYPE, HttpAlertConstants.REQUEST_TYPE) InputParam requestType = InputParam.newBuilder(HttpAlertConstants.REQUEST_TYPE, HttpAlertConstants.REQUEST_TYPE)
.addValidate(Validate.newBuilder() .addValidate(Validate.newBuilder()
.setRequired(true) .setRequired(true)
.build()) .build())

20
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertConstants.java

@ -18,25 +18,15 @@
package org.apache.dolphinscheduler.plugin.alert.http; package org.apache.dolphinscheduler.plugin.alert.http;
public final class HttpAlertConstants { public final class HttpAlertConstants {
public static final String URL = "$t('url')"; public static final String URL = "url";
public static final String NAME_URL = "url"; public static final String HEADER_PARAMS = "headerParams";
public static final String HEADER_PARAMS = "$t('headerParams')"; public static final String BODY_PARAMS = "bodyParams";
public static final String NAME_HEADER_PARAMS = "headerParams"; public static final String CONTENT_FIELD = "contentField";
public static final String BODY_PARAMS = "$t('bodyParams')"; public static final String REQUEST_TYPE = "requestType";
public static final String NAME_BODY_PARAMS = "bodyParams";
public static final String CONTENT_FIELD = "$t('contentField')";
public static final String NAME_CONTENT_FIELD = "contentField";
public static final String REQUEST_TYPE = "$t('requestType')";
public static final String NAME_REQUEST_TYPE = "requestType";
private HttpAlertConstants() { private HttpAlertConstants() {
throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");

10
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpSender.java

@ -56,11 +56,11 @@ public final class HttpSender {
public HttpSender(Map<String, String> paramsMap) { public HttpSender(Map<String, String> paramsMap) {
url = paramsMap.get(HttpAlertConstants.NAME_URL); url = paramsMap.get(HttpAlertConstants.URL);
headerParams = paramsMap.get(HttpAlertConstants.NAME_HEADER_PARAMS); headerParams = paramsMap.get(HttpAlertConstants.HEADER_PARAMS);
bodyParams = paramsMap.get(HttpAlertConstants.NAME_BODY_PARAMS); bodyParams = paramsMap.get(HttpAlertConstants.BODY_PARAMS);
contentField = paramsMap.get(HttpAlertConstants.NAME_CONTENT_FIELD); contentField = paramsMap.get(HttpAlertConstants.CONTENT_FIELD);
requestType = paramsMap.get(HttpAlertConstants.NAME_REQUEST_TYPE); requestType = paramsMap.get(HttpAlertConstants.REQUEST_TYPE);
} }
public AlertResult send(String msg) { public AlertResult send(String msg) {

10
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpSenderTest.java

@ -29,11 +29,11 @@ public class HttpSenderTest {
@Test @Test
public void sendTest() { public void sendTest() {
Map<String, String> paramsMap = new HashMap<>(); Map<String, String> paramsMap = new HashMap<>();
paramsMap.put(HttpAlertConstants.NAME_URL, "http://www.baidu.com"); paramsMap.put(HttpAlertConstants.URL, "http://www.baidu.com");
paramsMap.put(HttpAlertConstants.NAME_REQUEST_TYPE, "POST"); paramsMap.put(HttpAlertConstants.REQUEST_TYPE, "POST");
paramsMap.put(HttpAlertConstants.NAME_HEADER_PARAMS, "{\"Content-Type\":\"application/json\"}"); paramsMap.put(HttpAlertConstants.HEADER_PARAMS, "{\"Content-Type\":\"application/json\"}");
paramsMap.put(HttpAlertConstants.NAME_BODY_PARAMS, "{\"number\":\"13457654323\"}"); paramsMap.put(HttpAlertConstants.BODY_PARAMS, "{\"number\":\"13457654323\"}");
paramsMap.put(HttpAlertConstants.NAME_CONTENT_FIELD, "content"); paramsMap.put(HttpAlertConstants.CONTENT_FIELD, "content");
HttpSender httpSender = new HttpSender(paramsMap); HttpSender httpSender = new HttpSender(paramsMap);
AlertResult alertResult = httpSender.send("Fault tolerance warning"); AlertResult alertResult = httpSender.send("Fault tolerance warning");
Assert.assertEquals("true", alertResult.getStatus()); Assert.assertEquals("true", alertResult.getStatus());

7
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptParamsConstants.java

@ -18,15 +18,16 @@
package org.apache.dolphinscheduler.plugin.alert.script; package org.apache.dolphinscheduler.plugin.alert.script;
public final class ScriptParamsConstants { public final class ScriptParamsConstants {
static final String SCRIPT_TYPE = "$t('scriptType')";
static final String SCRIPT_TYPE = "type";
static final String NAME_SCRIPT_TYPE = "type"; static final String NAME_SCRIPT_TYPE = "type";
static final String SCRIPT_PATH = "$t('scriptPath')"; static final String SCRIPT_PATH = "path";
static final String NAME_SCRIPT_PATH = "path"; static final String NAME_SCRIPT_PATH = "path";
static final String SCRIPT_USER_PARAMS = "$t('userParams')"; static final String SCRIPT_USER_PARAMS = "user.params";
static final String NAME_SCRIPT_USER_PARAMS = "userParams"; static final String NAME_SCRIPT_USER_PARAMS = "userParams";

7
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackParamsConstants.java

@ -18,13 +18,12 @@
package org.apache.dolphinscheduler.plugin.alert.slack; package org.apache.dolphinscheduler.plugin.alert.slack;
public final class SlackParamsConstants { public final class SlackParamsConstants {
public static final String SLACK_WEB_HOOK_URL = "$t('webhook')"; public static final String SLACK_WEB_HOOK_URL = "webhook";
public static final String SLACK_WEN_HOOK_URL_NAME = "webHook"; public static final String SLACK_WEN_HOOK_URL_NAME = "WebHook";
public static final String SLACK_BOT = "$t('Username')"; public static final String SLACK_BOT = "username";
public static final String SLACK_BOT_NAME = "username"; public static final String SLACK_BOT_NAME = "username";
public static final String TEXT = "text"; public static final String TEXT = "text";
public static final String ATTACHMENT = "attachments"; public static final String ATTACHMENT = "attachments";
public static final Integer MAX_SHOW_NUMBER = 100; public static final Integer MAX_SHOW_NUMBER = 100;
private SlackParamsConstants() { private SlackParamsConstants() {

29
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertParamsConstants.java

@ -18,19 +18,36 @@
package org.apache.dolphinscheduler.plugin.alert.wechat; package org.apache.dolphinscheduler.plugin.alert.wechat;
public final class WeChatAlertParamsConstants { public final class WeChatAlertParamsConstants {
static final String ENTERPRISE_WE_CHAT_CORP_ID = "$t('corpId')"; static final String ENTERPRISE_WE_CHAT_CORP_ID = "corp.id";
static final String NAME_ENTERPRISE_WE_CHAT_CORP_ID = "corpId"; static final String NAME_ENTERPRISE_WE_CHAT_CORP_ID = "corpId";
static final String ENTERPRISE_WE_CHAT_SECRET = "$t('secret')";
static final String ENTERPRISE_WE_CHAT_SECRET = "secret";
static final String NAME_ENTERPRISE_WE_CHAT_SECRET = "secret"; static final String NAME_ENTERPRISE_WE_CHAT_SECRET = "secret";
static final String ENTERPRISE_WE_CHAT_TEAM_SEND_MSG = "$t('teamSendMsg')";
static final String ENTERPRISE_WE_CHAT_TEAM_SEND_MSG = "team.send.msg";
static final String NAME_ENTERPRISE_WE_CHAT_TEAM_SEND_MSG = "teamSendMsg"; static final String NAME_ENTERPRISE_WE_CHAT_TEAM_SEND_MSG = "teamSendMsg";
static final String ENTERPRISE_WE_CHAT_USER_SEND_MSG = "$t('userSendMsg')";
static final String ENTERPRISE_WE_CHAT_USER_SEND_MSG = "user.send.msg";
static final String NAME_ENTERPRISE_WE_CHAT_USER_SEND_MSG = "userSendMsg"; static final String NAME_ENTERPRISE_WE_CHAT_USER_SEND_MSG = "userSendMsg";
static final String ENTERPRISE_WE_CHAT_AGENT_ID = "$t('agentId')";
static final String ENTERPRISE_WE_CHAT_AGENT_ID = "agent.id";
static final String NAME_ENTERPRISE_WE_CHAT_AGENT_ID = "agentId"; static final String NAME_ENTERPRISE_WE_CHAT_AGENT_ID = "agentId";
static final String ENTERPRISE_WE_CHAT_USERS = "$t('users')";
static final String ENTERPRISE_WE_CHAT_USERS = "users";
static final String NAME_ENTERPRISE_WE_CHAT_USERS = "users"; static final String NAME_ENTERPRISE_WE_CHAT_USERS = "users";
private WeChatAlertParamsConstants() { private WeChatAlertParamsConstants() {
throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
} }

Loading…
Cancel
Save