use of com.alibaba.otter.canal.parse.inbound.mysql.ddl.DdlResult in project canal by alibaba.
the class DdlResultTest method cloneOutputNotNull.
/* testedClasses: DdlResult */
// Test written by Diffblue Cover.
@Test
public void cloneOutputNotNull() {
// Arrange
final DdlResult objectUnderTest = new DdlResult();
// Act
final DdlResult actual = objectUnderTest.clone();
// Assert result
Assert.assertNotNull(actual);
Assert.assertNull(actual.getSchemaName());
Assert.assertNull(actual.getType());
Assert.assertNull(actual.getOriSchemaName());
Assert.assertNull(actual.getTableName());
Assert.assertNull(actual.getRenameTableResult());
Assert.assertNull(actual.getOriTableName());
}
use of com.alibaba.otter.canal.parse.inbound.mysql.ddl.DdlResult in project canal by alibaba.
the class DruidDdlParserTest method testDrop.
@Test
public void testDrop() {
String queryString = "DROP TABLE retl_mark";
DdlResult result = DruidDdlParser.parse(queryString, "retl").get(0);
Assert.assertNotNull(result);
Assert.assertEquals("retl", result.getSchemaName());
Assert.assertEquals("retl_mark", result.getTableName());
queryString = "DROP TABLE IF EXISTS test.retl_mark;";
result = DruidDdlParser.parse(queryString, "retl").get(0);
Assert.assertNotNull(result);
Assert.assertEquals("test", result.getSchemaName());
Assert.assertEquals("retl_mark", result.getTableName());
queryString = "DROP TABLE IF EXISTS \n \"test\".`retl_mark`;";
result = DruidDdlParser.parse(queryString, "retl").get(0);
Assert.assertNotNull(result);
Assert.assertEquals("test", result.getSchemaName());
Assert.assertEquals("retl_mark", result.getTableName());
queryString = "DROP TABLE IF EXISTS \n retl.retl_mark , retl_test";
result = DruidDdlParser.parse(queryString, "test").get(0);
Assert.assertNotNull(result);
Assert.assertEquals("retl", result.getSchemaName());
Assert.assertEquals("retl_mark", result.getTableName());
result = DruidDdlParser.parse(queryString, "test").get(1);
Assert.assertNotNull(result);
Assert.assertEquals("test", result.getSchemaName());
Assert.assertEquals("retl_test", result.getTableName());
queryString = "DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `temp_bond_keys`.`temp_bond_key_id`;";
result = DruidDdlParser.parse(queryString, "retl").get(0);
Assert.assertNotNull(result);
Assert.assertEquals("temp_bond_keys", result.getSchemaName());
Assert.assertEquals("temp_bond_key_id", result.getTableName());
}
use of com.alibaba.otter.canal.parse.inbound.mysql.ddl.DdlResult in project canal by alibaba.
the class DruidDdlParserTest method testAlert.
@Test
public void testAlert() {
String queryString = "alter table retl_mark drop index emp_name";
DdlResult result = DruidDdlParser.parse(queryString, "retl").get(0);
Assert.assertNotNull(result);
Assert.assertEquals("retl_mark", result.getTableName());
queryString = "alter table retl.retl_mark drop index emp_name";
result = DruidDdlParser.parse(queryString, "retl").get(0);
Assert.assertNotNull(result);
Assert.assertEquals("retl_mark", result.getTableName());
queryString = "alter table \n retl.`retl_mark` drop index emp_name;";
result = DruidDdlParser.parse(queryString, "retl").get(0);
Assert.assertNotNull(result);
Assert.assertEquals("retl_mark", result.getTableName());
queryString = "alter table retl.retl_mark drop index emp_name , add index emp_name(id)";
result = DruidDdlParser.parse(queryString, "retl").get(0);
Assert.assertNotNull(result);
Assert.assertEquals("retl_mark", result.getTableName());
Assert.assertEquals(EventType.DINDEX, result.getType());
result = DruidDdlParser.parse(queryString, "retl").get(1);
Assert.assertNotNull(result);
Assert.assertEquals("retl_mark", result.getTableName());
Assert.assertEquals(EventType.CINDEX, result.getType());
}
Aggregations