DBZ-2856 Fix passing connection adapter to Surefire tests

This commit is contained in:
Chris Cranford 2020-12-16 09:45:05 -05:00 committed by Gunnar Morling
parent b3d9f81c7d
commit ca83fd0606
3 changed files with 21 additions and 5 deletions

View File

@ -132,6 +132,18 @@
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemProperties combine.children="append">
<property>
<name>database.connection.adapter</name>
<value>${adapter.name}</value>
</property>
</systemProperties>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>

View File

@ -26,6 +26,7 @@
import io.debezium.connector.oracle.antlr.OracleDmlParser;
import io.debezium.connector.oracle.jsqlparser.SimpleDmlParser;
import io.debezium.connector.oracle.junit.SkipTestDependingOnAdapterNameRule;
import io.debezium.connector.oracle.junit.SkipWhenAdapterNameIs;
import io.debezium.connector.oracle.junit.SkipWhenAdapterNameIsNot;
import io.debezium.connector.oracle.junit.SkipWhenAdapterNameIsNot.AdapterName;
import io.debezium.connector.oracle.logminer.valueholder.LogMinerColumnValue;
@ -94,6 +95,7 @@ record = sqlDmlParser.parse(dml, tables, "1");
}
@Test
@SkipWhenAdapterNameIs(value = SkipWhenAdapterNameIs.AdapterName.LOGMINER, reason = "Validation fails, will be fixed in DBZ-2784")
public void shouldParseTimestampFormats() throws Exception {
String createStatement = IoUtil.read(IoUtil.getResourceAsStream("ddl/create_table.sql", null, getClass(), null, null));
ddlParser.parse(createStatement, tables);

View File

@ -48,17 +48,19 @@ public void testStatements() {
result = SqlUtils.logMinerContentsQuery("DATABASE", "SCHEMA", schema);
expected = "SELECT SCN, SQL_REDO, OPERATION_CODE, TIMESTAMP, XID, CSF, TABLE_NAME, SEG_OWNER, OPERATION, USERNAME " +
"FROM V$LOGMNR_CONTENTS WHERE OPERATION_CODE in (1,2,3,5) AND SEG_OWNER = 'DATABASE' AND SCN >= ? AND SCN < ? " +
"OR (OPERATION_CODE IN (5,7,34,36) AND USERNAME NOT IN ('SYS','SYSTEM','SCHEMA'))ORDER BY SCN";
assertThat(expected.equals(result)).isTrue();
"OR (OPERATION_CODE IN (5,34) AND USERNAME NOT IN ('SYS','SYSTEM','SCHEMA')) " +
" OR (OPERATION_CODE IN (7,36)) ORDER BY SCN";
assertThat(result).isEqualTo(expected);
tables.add(table1);
tables.add(table2);
result = SqlUtils.logMinerContentsQuery("DATABASE", "SCHEMA", schema);
expected = "SELECT SCN, SQL_REDO, OPERATION_CODE, TIMESTAMP, XID, CSF, TABLE_NAME, SEG_OWNER, OPERATION, USERNAME " +
"FROM V$LOGMNR_CONTENTS WHERE OPERATION_CODE in (1,2,3,5) " +
"AND SEG_OWNER = 'DATABASE' AND TABLE_NAME IN ('table1','table2') AND SEG_NAME IN ('table1','table2') " +
"AND SCN >= ? AND SCN < ? OR (OPERATION_CODE IN (5,7,34,36) AND USERNAME NOT IN ('SYS','SYSTEM','SCHEMA'))ORDER BY SCN";
assertThat(expected.equals(result)).isTrue();
"AND SEG_OWNER = 'DATABASE' AND table_name IN ('table1','table2') " +
"AND SCN >= ? AND SCN < ? OR (OPERATION_CODE IN (5,34) AND USERNAME NOT IN ('SYS','SYSTEM','SCHEMA')) " +
" OR (OPERATION_CODE IN (7,36)) ORDER BY SCN";
assertThat(result).isEqualTo(expected);
result = SqlUtils.startLogMinerStatement(10L, 20L, OracleConnectorConfig.LogMiningStrategy.ONLINE_CATALOG, true);
expected = "BEGIN sys.dbms_logmnr.start_logmnr(startScn => '10', endScn => '20', " +