Skip to content

Commit

Permalink
optimize unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
wangjunbo committed Jul 25, 2024
1 parent fb67b5c commit cb8b722
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -253,20 +253,25 @@ public void testAddChunkKeyColumns() {
options.put(TABLES.key(), inventoryDatabase.getDatabaseName() + ".\\.*");
options.put(
SCAN_INCREMENTAL_SNAPSHOT_CHUNK_KEY_COLUMN.key(),
inventoryDatabase.getDatabaseName() + ".multi_max_\\.*:order_id");
inventoryDatabase.getDatabaseName()
+ ".multi_max_\\.*:order_id;"
+ inventoryDatabase.getDatabaseName()
+ ".products:id;");
Factory.Context context = new MockContext(Configuration.fromMap(options));

MySqlDataSourceFactory factory = new MySqlDataSourceFactory();
MySqlDataSource dataSource = (MySqlDataSource) factory.createDataSource(context);
ObjectPath multiMaxTable =
new ObjectPath(inventoryDatabase.getDatabaseName(), "multi_max_table");
ObjectPath productsTable = new ObjectPath(inventoryDatabase.getDatabaseName(), "products");

assertThat(dataSource.getSourceConfig().getChunkKeyColumns())
.isNotEmpty()
.isEqualTo(
new HashMap<ObjectPath, String>() {
{
put(multiMaxTable, "order_id");
put(productsTable, "id");
}
});
}
Expand Down

0 comments on commit cb8b722

Please sign in to comment.