DBZ-2670 Modify testing approach

This commit is contained in:
Jiri Pechanec 2020-10-21 15:14:51 +02:00
parent 4898d18184
commit b699e37359
4 changed files with 14 additions and 53 deletions

View File

@ -62,6 +62,19 @@ public void beforeEach() {
tables = new Tables();
}
@Test
@FixFor("DBZ-2670")
public void shouldAllowNonAsciiIdentifiers() {
String ddl = "create table žluťoučký (kůň int);";
parser.parse(ddl, tables);
assertThat(((MySqlAntlrDdlParser) parser).getParsingExceptionsFromWalker().size()).isEqualTo(0);
assertThat(tables.size()).isEqualTo(1);
Table table = tables.forTable(null, null, "žluťoučký");
assertThat(table.columns()).hasSize(1);
assertThat(table.columnWithName("kůň")).isNotNull();
}
@Test
@FixFor("DBZ-2641")
public void shouldProcessDimensionalBlob() {

View File

@ -190,22 +190,6 @@ public void shouldAllowDecimalPrecision() {
assertHistoryRecorded();
}
@Test
public void shouldAllowNonASSIICCharacters() {
mysql = build
.with(DatabaseHistory.SKIP_UNPARSEABLE_DDL_STATEMENTS, false)
.storeDatabaseHistoryInFile(TEST_FILE_PATH)
.serverName(SERVER_NAME)
.createSchemas();
mysql.start();
source.setBinlogStartPoint("binlog-001", 400);
mysql.applyDdl(source, "db1", readFile("ddl/mysql-dbz-2670.ddl"), this::printStatements);
assertTableIncluded("connector_test.business_order_1");
assertTableIncluded("connector_test.business_order_2");
assertHistoryRecorded();
}
protected void assertTableIncluded(String fullyQualifiedTableName) {
TableId tableId = TableId.parse(fullyQualifiedTableName);
TableSchema tableSchema = mysql.schemaFor(tableId);

View File

@ -1,37 +0,0 @@
CREATE TABLE connector_test.business_order_1 (
`id` int(11) NOT NULL AUTO_INCREMENT,
`code` varchar(32) NOT NULL COMMENT 'order code',
PRIMARY KEY (`id`),
KEY `order_code_index` (`code`) COMMENT 'order index'
) ENGINE=InnoDB AUTO_INCREMENT=2000022760 DEFAULT CHARSET=utf8 COMMENT='order table';
CREATE TABLE connector_test.business_order_2 (
`id` int(11) NOT NULL AUTO_INCREMENT,
`code` varchar(32) NOT NULL COMMENT 'order code',
PRIMARY KEY (`id`),
KEY `order_code_index` (`code`) COMMENT 'order index'
) ENGINE=InnoDB AUTO_INCREMENT=2000022760 DEFAULT CHARSET=utf8 COMMENT='order table';
CREATE TEMPORARY TABLE connector_test.temp1
SELECT
bo.id 'id',
bo.code '测试'
from
business_order_1 bo
;
CREATE TEMPORARY TABLE connector_test.temp2
SELECT
bo.id 'id',
bo.code '测试'
from
business_order_2 bo
;
SELECT
t1.测试
FROM temp1 t1
LEFT JOIN
temp2 t2 on t1.id = t2.id;

View File

@ -33,6 +33,7 @@ create table transactional(name varchar(255), class_id int, id int);
create table add_test(col1 varchar(255), col2 int, col3 int);
create table blob_test(id int, col1 blob(45));
CREATE TABLE `user_account` ( `id1` bigint(20) unsigned NOT NULL DEFAULT nextval(`useraccount`.`user_account_id_seq`));
create table žluťoučký (kůň int);
#end
#begin
-- Rename table