use of com.alibaba.otter.canal.parse.inbound.mysql.ddl.DdlResult in project canal by alibaba.
the class SimpleDdlParserTest method testIndex.
@Test
public void testIndex() {
String queryString = "CREATE UNIQUE INDEX index_1 ON retl_mark(id,x)";
DdlResult result = SimpleDdlParser.parse(queryString, "retl");
Assert.assertNotNull(result);
Assert.assertEquals("retl", result.getSchemaName());
Assert.assertEquals("retl_mark", result.getTableName());
queryString = "create index idx_qca_cid_mcid on q_contract_account (contract_id,main_contract_id)";
result = SimpleDdlParser.parse(queryString, "retl");
Assert.assertNotNull(result);
Assert.assertEquals("retl", result.getSchemaName());
Assert.assertEquals("q_contract_account", result.getTableName());
queryString = "DROP INDEX index_str ON retl_mark";
result = SimpleDdlParser.parse(queryString, "retl");
Assert.assertNotNull(result);
Assert.assertEquals("retl", result.getSchemaName());
Assert.assertEquals("retl_mark", result.getTableName());
// test index name contains 'on' -- version
queryString = "create index schema_new_index_version_s_idx on q_contract_account (contract_id,main_contract_id)";
result = SimpleDdlParser.parse(queryString, "retl");
Assert.assertNotNull(result);
Assert.assertEquals("retl", result.getSchemaName());
Assert.assertEquals("q_contract_account", result.getTableName());
queryString = "drop index schema_new_index_version_s_idx on q_contract_account";
result = SimpleDdlParser.parse(queryString, "retl");
Assert.assertNotNull(result);
Assert.assertEquals("retl", result.getSchemaName());
Assert.assertEquals("q_contract_account", result.getTableName());
}
use of com.alibaba.otter.canal.parse.inbound.mysql.ddl.DdlResult in project canal by alibaba.
the class DdlResultTest method setTableNameInputNotNullOutputVoid.
// Test written by Diffblue Cover.
@Test
public void setTableNameInputNotNullOutputVoid() {
// Arrange
final DdlResult objectUnderTest = new DdlResult();
final String tableName = "3";
// Act
objectUnderTest.setTableName(tableName);
// Assert side effects
Assert.assertEquals("3", objectUnderTest.getTableName());
}
use of com.alibaba.otter.canal.parse.inbound.mysql.ddl.DdlResult in project canal by alibaba.
the class DdlResultTest method setOriTableNameInputNotNullOutputVoid.
// Test written by Diffblue Cover.
@Test
public void setOriTableNameInputNotNullOutputVoid() {
// Arrange
final DdlResult objectUnderTest = new DdlResult();
final String oriTableName = "3";
// Act
objectUnderTest.setOriTableName(oriTableName);
// Assert side effects
Assert.assertEquals("3", objectUnderTest.getOriTableName());
}
use of com.alibaba.otter.canal.parse.inbound.mysql.ddl.DdlResult in project canal by alibaba.
the class DdlResultTest method toStringOutputNotNull2.
// Test written by Diffblue Cover.
@Test
public void toStringOutputNotNull2() throws InvocationTargetException {
// Arrange
final DdlResult objectUnderTest = new DdlResult();
objectUnderTest.setSchemaName(null);
objectUnderTest.setType(null);
objectUnderTest.setOriSchemaName(null);
objectUnderTest.setTableName(",");
final DdlResult ddlResult = new DdlResult();
objectUnderTest.setRenameTableResult(ddlResult);
objectUnderTest.setOriTableName("2");
// Act
final String actual = objectUnderTest.toString();
// Assert result
Assert.assertEquals("DdlResult [schemaName=null , tableName=, , oriSchemaName=null , oriTableName=2 , type=null ];DdlResult [schemaName=null , tableName=null , oriSchemaName=null , oriTableName=null , type=null ];", actual);
}
use of com.alibaba.otter.canal.parse.inbound.mysql.ddl.DdlResult in project canal by alibaba.
the class DdlResultTest method constructorInputNotNullNotNullOutputVoid.
// Test written by Diffblue Cover.
@Test
public void constructorInputNotNullNotNullOutputVoid() {
// Arrange
final String schemaName = ",";
final String tableName = "BAZ";
// Act, creating object to test constructor
final DdlResult objectUnderTest = new DdlResult(schemaName, tableName);
// Assert side effects
Assert.assertEquals(",", objectUnderTest.getSchemaName());
Assert.assertEquals("BAZ", objectUnderTest.getTableName());
}
Aggregations