-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
MysqlJobLoggerTest.java
44 lines (34 loc) · 1.24 KB
/
MysqlJobLoggerTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package com.lts.biz.logger.mysql;
import com.lts.biz.logger.domain.JobLogPo;
import com.lts.biz.logger.domain.LogType;
import com.lts.core.cluster.Config;
import com.lts.core.commons.utils.DateUtils;
import com.lts.core.constant.Level;
import com.lts.core.domain.Job;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.*;
/**
* @author Robert HG (254963746@qq.com) on 6/12/15.
*/
public class MysqlJobLoggerTest {
@Test
public void testLog() throws Exception {
Config config = new Config();
// 任务队列用mysql
config.setParameter("job.queue", "mysql");
// mysql 配置
config.setParameter("jdbc.url", "jdbc:mysql://127.0.0.1:3306/lts");
config.setParameter("jdbc.username", "root");
config.setParameter("jdbc.password", "root");
MysqlJobLogger mysqlJobLogger = new MysqlJobLogger(config);
List<JobLogPo> jobLogPoList = new ArrayList<JobLogPo>();
JobLogPo jobLogPo = new JobLogPo();
jobLogPo.setTimestamp(DateUtils.currentTimeMillis());
jobLogPo.setLevel(Level.INFO);
jobLogPo.setLogType(LogType.BIZ);
jobLogPoList.add(jobLogPo);
mysqlJobLogger.log(jobLogPoList);
}
}