mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
upgrade fastjson 1.2.58
This commit is contained in:
@@ -3,6 +3,7 @@ package com.alibaba.otter.canal.parse.inbound.mysql.tsdb;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@@ -12,7 +13,9 @@ import org.junit.runner.RunWith;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.alibaba.fastsql.sql.repository.Schema;
|
||||
import com.alibaba.otter.canal.parse.inbound.TableMeta;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
/**
|
||||
* @author agapple 2017年8月1日 下午7:15:54
|
||||
@@ -66,4 +69,24 @@ public class MemoryTableMeta_DDL_Test {
|
||||
System.out.println(meta);
|
||||
Assert.assertTrue(meta.getFields().get(0).getColumnName().equalsIgnoreCase("id"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_any() throws Throwable {
|
||||
MemoryTableMeta memoryTableMeta = new MemoryTableMeta();
|
||||
URL url = Thread.currentThread().getContextClassLoader().getResource("dummy.txt");
|
||||
File dummyFile = new File(url.getFile());
|
||||
File create = new File(dummyFile.getParent() + "/ddl", "ddl_any.sql");
|
||||
String sql = StringUtils.join(IOUtils.readLines(new FileInputStream(create)), "\n");
|
||||
memoryTableMeta.apply(null, "test", sql, null);
|
||||
|
||||
List<String> tableNames = Lists.newArrayList();
|
||||
for (Schema schema : memoryTableMeta.getRepository().getSchemas()) {
|
||||
tableNames.addAll(schema.showTables());
|
||||
}
|
||||
|
||||
for (String table : tableNames) {
|
||||
TableMeta sourceMeta = memoryTableMeta.find("test", table);
|
||||
System.out.println(sourceMeta.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
12
parse/src/test/resources/ddl/ddl_any.sql
Normal file
12
parse/src/test/resources/ddl/ddl_any.sql
Normal file
@@ -0,0 +1,12 @@
|
||||
CREATE TABLE procs_priv (
|
||||
Host char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
Db char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
User char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
Routine_name char(64) CHARACTER SET utf8 NOT NULL DEFAULT '',
|
||||
Routine_type enum('FUNCTION','PROCEDURE') COLLATE utf8_bin NOT NULL,
|
||||
Grantor char(77) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
Proc_priv set('Execute','Alter Routine','Grant') CHARACTER SET utf8 NOT NULL DEFAULT '',
|
||||
Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (Host,Db,User,Routine_name,Routine_type),
|
||||
KEY Grantor (Grantor)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Procedure privileges'
|
||||
Reference in New Issue
Block a user