DBZ-6990 Fix db2 truncate table case using plain jdbc connection

This commit is contained in:
mfvitale 2023-10-05 12:32:02 +02:00 committed by Fiore Mario Vitale
parent ded6d2775e
commit 3bc252871f

View File

@ -35,14 +35,14 @@ public JdbcSinkDeleteEnabledIT(Sink sink) {
@Test
public void testShouldHandleTruncateTableStatementWithoutHibernate() throws SQLException {
Sink sink = getSink();
sink.execute("create table DB2INST1.TEST_TRUNCATE_DB2_TABLE(id int not null, name varchar(255), primary key(id))");
sink.execute("insert into DB2INST1.TEST_TRUNCATE_DB2_TABLE(id,name) values(1,'jdbc')");
sink.execute("create table TEST_TRUNCATE_DB2_TABLE(id int not null, name varchar(255), primary key(id))");
sink.execute("insert into TEST_TRUNCATE_DB2_TABLE(id,name) values(1,'jdbc')");
TableAssert tableAssert = TestHelper.assertTable(dataSource(), "DB2INST1.TEST_TRUNCATE_DB2_TABLE");
TableAssert tableAssert = TestHelper.assertTable(dataSource(), "TEST_TRUNCATE_DB2_TABLE");
tableAssert.exists().hasNumberOfRows(1).hasNumberOfColumns(2);
sink.execute("truncate table DB2INST1.TEST_TRUNCATE_DB2_TABLE");
tableAssert = TestHelper.assertTable(dataSource(), "DB2INST1.TEST_TRUNCATE_DB2_TABLE");
sink.execute("truncate table TEST_TRUNCATE_DB2_TABLE IMMEDIATE");
tableAssert = TestHelper.assertTable(dataSource(), "TEST_TRUNCATE_DB2_TABLE");
tableAssert.exists().hasNumberOfRows(0).hasNumberOfColumns(2);
}