Java Code Examples for io.debezium.util.Testing#debug()

The following examples show how to use io.debezium.util.Testing#debug() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractOracleDatatypesTest.java    From debezium-incubator with Apache License 2.0 5 votes vote down vote up
@Test
public void stringTypes() throws Exception {
    int expectedRecordCount = 0;

    if (insertRecordsDuringTest()) {
        insertStringTypes();
    }

    Testing.debug("Inserted");
    expectedRecordCount++;

    final SourceRecords records = consumeRecordsByTopic(expectedRecordCount);

    List<SourceRecord> testTableRecords = records.recordsForTopic("server1.DEBEZIUM.TYPE_STRING");
    assertThat(testTableRecords).hasSize(expectedRecordCount);
    SourceRecord record = testTableRecords.get(0);

    VerifyRecord.isValid(record);

    // insert
    if (insertRecordsDuringTest()) {
        VerifyRecord.isValidInsert(record, "ID", 1);
    }
    else {
        VerifyRecord.isValidRead(record, "ID", 1);
    }

    Struct after = (Struct) ((Struct) record.value()).get("after");
    assertRecord(after, EXPECTED_STRING);
}
 
Example 2
Source File: AbstractOracleDatatypesTest.java    From debezium-incubator with Apache License 2.0 5 votes vote down vote up
@Test
public void fpTypes() throws Exception {
    int expectedRecordCount = 0;

    if (insertRecordsDuringTest()) {
        insertFpTypes();
    }

    Testing.debug("Inserted");
    expectedRecordCount++;

    final SourceRecords records = consumeRecordsByTopic(expectedRecordCount);

    List<SourceRecord> testTableRecords = records.recordsForTopic("server1.DEBEZIUM.TYPE_FP");
    assertThat(testTableRecords).hasSize(expectedRecordCount);
    SourceRecord record = testTableRecords.get(0);

    VerifyRecord.isValid(record);

    // insert
    if (insertRecordsDuringTest()) {
        VerifyRecord.isValidInsert(record, "ID", 1);
    }
    else {
        VerifyRecord.isValidRead(record, "ID", 1);
    }

    Struct after = (Struct) ((Struct) record.value()).get("after");
    assertRecord(after, EXPECTED_FP);
}
 
Example 3
Source File: AbstractOracleDatatypesTest.java    From debezium-incubator with Apache License 2.0 5 votes vote down vote up
@Test
public void intTypes() throws Exception {
    int expectedRecordCount = 0;

    if (insertRecordsDuringTest()) {
        insertIntTypes();
    }

    Testing.debug("Inserted");
    expectedRecordCount++;

    final SourceRecords records = consumeRecordsByTopic(expectedRecordCount);

    List<SourceRecord> testTableRecords = records.recordsForTopic("server1.DEBEZIUM.TYPE_INT");
    assertThat(testTableRecords).hasSize(expectedRecordCount);
    SourceRecord record = testTableRecords.get(0);

    VerifyRecord.isValid(record);

    // insert
    if (insertRecordsDuringTest()) {
        VerifyRecord.isValidInsert(record, "ID", 1);
    }
    else {
        VerifyRecord.isValidRead(record, "ID", 1);
    }

    Struct after = (Struct) ((Struct) record.value()).get("after");
    assertRecord(after, EXPECTED_INT);
}
 
Example 4
Source File: AbstractOracleDatatypesTest.java    From debezium-incubator with Apache License 2.0 5 votes vote down vote up
@Test
public void timeTypes() throws Exception {
    int expectedRecordCount = 0;

    if (insertRecordsDuringTest()) {
        insertTimeTypes();
    }

    Testing.debug("Inserted");
    expectedRecordCount++;

    final SourceRecords records = consumeRecordsByTopic(expectedRecordCount);

    List<SourceRecord> testTableRecords = records.recordsForTopic("server1.DEBEZIUM.TYPE_TIME");
    assertThat(testTableRecords).hasSize(expectedRecordCount);
    SourceRecord record = testTableRecords.get(0);

    VerifyRecord.isValid(record);

    // insert
    if (insertRecordsDuringTest()) {
        VerifyRecord.isValidInsert(record, "ID", 1);
    }
    else {
        VerifyRecord.isValidRead(record, "ID", 1);
    }

    Struct after = (Struct) ((Struct) record.value()).get("after");
    assertRecord(after, EXPECTED_TIME);
}
 
Example 5
Source File: AbstractOracleDatatypesTest.java    From debezium-incubator with Apache License 2.0 4 votes vote down vote up
@Test
@FixFor("DBZ-1552")
public void fpTypesAsString() throws Exception {
    stopConnector();
    initializeConnectorTestFramework();
    final Configuration config = connectorConfig()
            .with(OracleConnectorConfig.DECIMAL_HANDLING_MODE, DecimalMode.STRING)
            .build();

    start(OracleConnector.class, config);
    assertConnectorIsRunning();

    waitForSnapshotToBeCompleted(TestHelper.CONNECTOR_NAME, TestHelper.SERVER_NAME);

    int expectedRecordCount = 0;

    if (insertRecordsDuringTest()) {
        insertFpTypes();
    }

    Testing.debug("Inserted");
    expectedRecordCount++;

    final SourceRecords records = consumeRecordsByTopic(expectedRecordCount);

    List<SourceRecord> testTableRecords = records.recordsForTopic("server1.DEBEZIUM.TYPE_FP");
    assertThat(testTableRecords).hasSize(expectedRecordCount);
    SourceRecord record = testTableRecords.get(0);

    VerifyRecord.isValid(record);

    // insert
    if (insertRecordsDuringTest()) {
        VerifyRecord.isValidInsert(record, "ID", 1);
    }
    else {
        VerifyRecord.isValidRead(record, "ID", 1);
    }

    Struct after = (Struct) ((Struct) record.value()).get("after");
    assertRecord(after, EXPECTED_FP_AS_STRING);
}
 
Example 6
Source File: AbstractOracleDatatypesTest.java    From debezium-incubator with Apache License 2.0 4 votes vote down vote up
@Test
@FixFor("DBZ-1552")
public void fpTypesAsDouble() throws Exception {
    stopConnector();
    initializeConnectorTestFramework();
    final Configuration config = connectorConfig()
            .with(OracleConnectorConfig.DECIMAL_HANDLING_MODE, DecimalMode.DOUBLE)
            .build();

    start(OracleConnector.class, config);
    assertConnectorIsRunning();

    waitForSnapshotToBeCompleted(TestHelper.CONNECTOR_NAME, TestHelper.SERVER_NAME);

    int expectedRecordCount = 0;

    if (insertRecordsDuringTest()) {
        insertFpTypes();
    }

    Testing.debug("Inserted");
    expectedRecordCount++;

    final SourceRecords records = consumeRecordsByTopic(expectedRecordCount);

    List<SourceRecord> testTableRecords = records.recordsForTopic("server1.DEBEZIUM.TYPE_FP");
    assertThat(testTableRecords).hasSize(expectedRecordCount);
    SourceRecord record = testTableRecords.get(0);

    VerifyRecord.isValid(record);

    // insert
    if (insertRecordsDuringTest()) {
        VerifyRecord.isValidInsert(record, "ID", 1);
    }
    else {
        VerifyRecord.isValidRead(record, "ID", 1);
    }

    Struct after = (Struct) ((Struct) record.value()).get("after");
    assertRecord(after, EXPECTED_FP_AS_DOUBLE);
}