コード例 #1
0
def test_process_empty_message(operation_code, mocker):
    oracle_message = OracleMessage()
    oracle_message.operation_code = operation_code

    processor = processor_factory.build(const.ORACLE)
    statement = processor.process(oracle_message)
    assert statement is None
コード例 #2
0
def build_applier(mode, argv):
    """
    Build an applier to apply CDCs to target db
    """
    source_processor = processor_factory.build(argv.sourcedbtype,
                                               argv.metacols)
    db = get_target_db(argv)
    return applier_factory.build(mode, source_processor, db, argv,
                                 AuditFactory(argv))
コード例 #3
0
def test_process_returns_correct_instance_type(operation_code, commit_statement, expected_type, mocker):

    oracle_message = OracleMessage()
    oracle_message.operation_code = operation_code
    oracle_message.commit_statement = commit_statement
    oracle_message.primary_key_fields = ""

    processor = processor_factory.build(const.ORACLE)
    statement = processor.process(oracle_message)

    assert type(statement).__name__ == expected_type
コード例 #4
0
def execute_statement_parsing_test(operation, data, mocker):
    print("Running test: '{}'".format(data.description))
    
    oracle_message = OracleMessage()
    oracle_message.operation_code = operation
    oracle_message.table_name = data.input_table_name
    oracle_message.commit_statement = data.input_commit_statement
    oracle_message.primary_key_fields = data.input_primary_key_fields

    processor = processor_factory.build(const.ORACLE)
    output = processor.process(oracle_message)
    return output
コード例 #5
0
def execute_statement_parsing_test(operation, data, mocker):
    print("Running test: '{}'".format(data.description))

    message = MssqlMessage()
    message.operation_code = operation
    message.table_name = data.input_table_name
    message.column_names = data.input_column_names
    message.column_values = data.input_column_values
    message.primary_key_fields = data.input_primary_key_fields

    processor = processor_factory.build(const.MSSQL)
    output = processor.process(message)
    return output
コード例 #6
0
ファイル: test_factory.py プロジェクト: iagcl/data_pipeline
def test_build_unsupported():
    with pytest.raises(UnsupportedDbTypeError):
        processor = processor_factory.build("AnUnsupportedDatabase")
コード例 #7
0
ファイル: test_factory.py プロジェクト: iagcl/data_pipeline
def test_build_mssql_processor():
    processor = processor_factory.build(const.MSSQL)
    assert type(processor).__name__ == 'MssqlCdcProcessor'
コード例 #8
0
ファイル: test_factory.py プロジェクト: iagcl/data_pipeline
def test_build_oracle_processor():
    processor = processor_factory.build(const.ORACLE)
    assert type(processor).__name__ == 'OracleCdcProcessor'