Unverified Commit eec92ed1 authored by dailidong's avatar dailidong Committed by GitHub
Browse files

simplify and optimize config (#2469)

* [Refactor worker] simplify and optimize config (#2386)

* simplify config

* simplify config

* simplify and optimize config

* Update HadoopUtils.java

optimize HadoopUtils

* Update HadoopUtilsTest.java

* Update HadoopUtilsTest.java

* Update HadoopUtilsTest.java

* Update HttpUtils.java

* Update pom.xml

* Update HadoopUtilsTest.java

* Update HadoopUtilsTest.java

* Update HadoopUtilsTest.java

* Update HadoopUtilsTest.java

* Update HadoopUtilsTest.java

* Update HadoopUtilsTest.java
parent dc36c77b
Loading
Loading
Loading
Loading
+1 −16
Original line number Diff line number Diff line
@@ -17,9 +17,6 @@
package org.apache.dolphinscheduler.alert.template;

import org.apache.dolphinscheduler.alert.template.impl.DefaultHTMLTemplate;
import org.apache.dolphinscheduler.alert.utils.Constants;
import org.apache.dolphinscheduler.alert.utils.PropertyUtils;
import org.apache.dolphinscheduler.common.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@@ -30,8 +27,6 @@ public class AlertTemplateFactory {

    private static final Logger logger = LoggerFactory.getLogger(AlertTemplateFactory.class);

    private static final String alertTemplate = PropertyUtils.getString(Constants.ALERT_TEMPLATE);

    private AlertTemplateFactory(){}

    /**
@@ -39,16 +34,6 @@ public class AlertTemplateFactory {
     * @return a template, default is DefaultHTMLTemplate
     */
    public static AlertTemplate getMessageTemplate() {

        if(StringUtils.isEmpty(alertTemplate)){
            return new DefaultHTMLTemplate();
        }

        switch (alertTemplate){
            case "html":
        return new DefaultHTMLTemplate();
            default:
                throw new IllegalArgumentException(String.format("not support alert template: %s",alertTemplate));
        }
    }
}
+0 −2
Original line number Diff line number Diff line
@@ -77,8 +77,6 @@ public class Constants {

    public static final int NUMBER_1000 = 1000;

    public static final String ALERT_TEMPLATE = "alert.template";

    public static final String SPRING_DATASOURCE_DRIVER_CLASS_NAME = "spring.datasource.driver-class-name";

    public static final String SPRING_DATASOURCE_URL = "spring.datasource.url";
+7 −2
Original line number Diff line number Diff line
@@ -260,9 +260,14 @@ public class MailUtils {
        part1.setContent(partContent, Constants.TEXT_HTML_CHARSET_UTF_8);
        // set attach file
        MimeBodyPart part2 = new MimeBodyPart();
        File file = new File(xlsFilePath + Constants.SINGLE_SLASH +  title + Constants.EXCEL_SUFFIX_XLS);
        if (!file.getParentFile().exists()) {
            file.getParentFile().mkdirs();
        }
        // make excel file

        ExcelUtils.genExcelFile(content,title,xlsFilePath);
        File file = new File(xlsFilePath + Constants.SINGLE_SLASH +  title + Constants.EXCEL_SUFFIX_XLS);

        part2.attachFile(file);
        part2.setFileName(MimeUtility.encodeText(title + Constants.EXCEL_SUFFIX_XLS,Constants.UTF_8,"B"));
        // add components to collection
+0 −3
Original line number Diff line number Diff line
@@ -18,9 +18,6 @@
#alert type is EMAIL/SMS
alert.type=EMAIL

# alter msg template, default is html template
#alert.template=html

# mail server configuration
mail.protocol=SMTP
mail.server.host=xxx.xxx.com
+0 −1
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@ public class AlertTemplateFactoryTest {
    public void testGetMessageTemplate(){

        PowerMockito.mockStatic(PropertyUtils.class);
        when(PropertyUtils.getString(Constants.ALERT_TEMPLATE)).thenReturn("html");

        AlertTemplate defaultTemplate = AlertTemplateFactory.getMessageTemplate();

Loading