Skip to content

Commit

Permalink
update: 测试类;
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouhongfa committed Aug 5, 2019
1 parent 9832cee commit dbc2b16
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private JobJdbcDatasource getWriterDatasource() {
writerDatasource.setDatasourceName("z01_mysql_3306");
writerDatasource.setJdbcUsername("root");
writerDatasource.setJdbcPassword("root");
writerDatasource.setJdbcUrl("jdbc:mysql://z01:3306/datax_web_demo?serverTimezone=Asia/Shanghai&useLegacyDatetimeCode=false&useSSL=false&nullNamePatternMatchesAll=true&useUnicode=true&characterEncoding=UTF-8");
writerDatasource.setJdbcUrl("jdbc:mysql://localhost:3306/datax_web_demo?serverTimezone=Asia/Shanghai&useLegacyDatetimeCode=false&useSSL=false&nullNamePatternMatchesAll=true&useUnicode=true&characterEncoding=UTF-8");
writerDatasource.setJdbcDriverClass("com.mysql.jdbc.Driver");
return writerDatasource;
}
Expand Down Expand Up @@ -78,6 +78,7 @@ public void buildReader() {
public void buildWriter() {
DataxJsonHelper dataxJsonHelper = new DataxJsonHelper();
dataxJsonHelper.initWriter(getWriterDatasource(), ImmutableList.of("datax_plugin"), ImmutableList.of("id"));
dataxJsonHelper.setPreSql("delete from datax_prubin");
Map<String, Object> writer = dataxJsonHelper.buildWriter();
System.out.println(JSONUtils.formatJson(writer));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ public void getTableNames() {

@Test
public void getColumnNames() {
List<String> columns = queryTool.getColumnNames("datax_plugin");
List<String> columns = queryTool.getColumnNames("job_config");
log.info(columns.toString());
columns = queryTool.getColumnNames("job_log");
log.info(columns.toString());
}

@Test
public void getColumnsByQuerySql() {
String querySql = "select l.log_file_path, c.name, c.job_group\n" +
"from job_log l left join job_config c on c.id = l.job_id where l.status = 1";
String querySql = "select l.log_file_path, c.name, c.job_group from job_log l left join job_config c on c.id = l.job_id where l.status = 1";
List<String> columns = queryTool.getColumnsByQuerySql(querySql);
log.info(columns.toString());
}
Expand Down

0 comments on commit dbc2b16

Please sign in to comment.