Skip to content

Commit

Permalink
[bugfix] fix AlertTemplateUtilTest test exception and update code sty…
Browse files Browse the repository at this point in the history
…le (#1969)

Signed-off-by: yuluo-yx <yuluo08290126@gmail.com>
Co-authored-by: tomsun28 <tomsun28@outlook.com>
  • Loading branch information
yuluo-yx and tomsun28 authored May 13, 2024
1 parent aa3331e commit 39a587f
Show file tree
Hide file tree
Showing 13 changed files with 10 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,5 @@ public static class KafkaProperties {
private String groupId;

}

}


}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.io.OutputStream;
import java.util.List;


/**
* Configuration Import Export
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.apache.hertzbeat.alert.service.impl;


import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelTarget;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;


/**
* Configure the import and export EXCEL format
*/
Expand Down Expand Up @@ -263,6 +262,4 @@ void writeOs(List<ExportAlertDefineDTO> exportAlertDefineList, OutputStream os)
throw new RuntimeException(e);
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.apache.hertzbeat.alert.service.impl;


import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
Expand All @@ -28,7 +27,6 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;


/**
* Configure the import and export JSON format
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.apache.hertzbeat.alert.service.impl;


import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
Expand All @@ -28,7 +27,6 @@
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;


/**
* Configure the import and export Yaml format
*/
Expand All @@ -39,7 +37,6 @@ public class AlertDefineYamlImExportServiceImpl extends AlertDefineAbstractImExp
public static final String TYPE = "YAML";
public static final String FILE_SUFFIX = ".yaml";


@Override
public String type() {
return TYPE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,4 @@ private Alert buildAlertData(AlertReport alertReport){
.gmtUpdate(dateTime)
.build();
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ public static String render(String template, Map<String, Object> replaceData) {
if (template == null) {
return null;
}
if (replaceData == null) {
log.warn("The replaceData is null.");
return template;
}
try {
Matcher matcher = PATTERN.matcher(template);
StringBuilder builder = new StringBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public class DateUtil {

private static final String[] DATE_FORMATS = {
"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'",
"yyyy-MM-dd HH:mm:ss"};
"yyyy-MM-dd HH:mm:ss"
};

/**
* convert date to timestamp
Expand Down
2 changes: 1 addition & 1 deletion alerter/src/main/resources/META-INF/spring.factories
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
# limitations under the License.

org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
org.apache.hertzbeat.alert.config.AlerterAutoConfiguration
org.apache.hertzbeat.alert.config.AlerterAutoConfiguration
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;


/**
* Test case for {@link AlerterWorkerPool}
*/
Expand Down Expand Up @@ -53,4 +52,4 @@ void executeJob() throws InterruptedException {

assertEquals(NUMBER_OF_THREADS, counter.get());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,4 @@ void getBindAlertDefineMonitors() {
when(alertDefineBindDao.getAlertDefineBindsByAlertDefineIdEquals(id)).thenReturn(alertDefineMonitorBinds);
assertDoesNotThrow(() -> alertDefineService.getBindAlertDefineMonitors(id));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ void getAlertsSummary() {
@Test
void addNewAlertReport() {
}
}
}

0 comments on commit 39a587f

Please sign in to comment.