Java Code Examples for org.dbunit.dataset.Column#getColumnName()

The following examples show how to use org.dbunit.dataset.Column#getColumnName() . 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: HackedDbUnitAssert.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
public HackedComparisonColumn(String tableName, Column expectedColumn, Column actualColumn, FailureHandler failureHandler) {
    
    // super class is actually useless, all public methods are overridden below
    super(tableName, expectedColumn, expectedColumn, failureHandler);
    
    this.columnName = expectedColumn.getColumnName();
    this.dataType = getComparisonDataType(tableName, expectedColumn, actualColumn, failureHandler);
}
 
Example 2
Source File: HackedDbUnitAssert.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
private DataType getComparisonDataType(String tableName, Column expectedColumn, Column actualColumn, FailureHandler failureHandler) {
    if (logger.isDebugEnabled())
        logger.debug("getComparisonDataType(tableName={}, expectedColumn={}, actualColumn={}, failureHandler={}) - start", new Object[] { tableName, expectedColumn, actualColumn, failureHandler });

    DataType expectedDataType = expectedColumn.getDataType();
    DataType actualDataType = actualColumn.getDataType();

    // The two columns have different data type
    if (!expectedDataType.getClass().isInstance(actualDataType)) {
        // Expected column data type is unknown, use actual column data type
        if (expectedDataType instanceof UnknownDataType) {
            return actualDataType;
        }

        // Actual column data type is unknown, use expected column data type
        if (actualDataType instanceof UnknownDataType) {
            return expectedDataType;
        }
        
        if (hackIgnoreIntBigIntMismatch) {
            if (expectedDataType instanceof IntegerDataType && actualDataType instanceof BigIntegerDataType)
                return actualDataType;
        }

        // Impossible to determine which data type to use
        String msg = "Incompatible data types: (table=" + tableName + ", col=" + expectedColumn.getColumnName() + ")";
        throw failureHandler.createFailure(msg, String.valueOf(expectedDataType), String.valueOf(actualDataType));
    }

    // Both columns have same data type, return any one of them
    return expectedDataType;
}
 
Example 3
Source File: HackedDbUnitAssert.java    From kylin with Apache License 2.0 5 votes vote down vote up
public HackedComparisonColumn(String tableName, Column expectedColumn, Column actualColumn, FailureHandler failureHandler) {
    
    // super class is actually useless, all public methods are overridden below
    super(tableName, expectedColumn, expectedColumn, failureHandler);
    
    this.columnName = expectedColumn.getColumnName();
    this.dataType = getComparisonDataType(tableName, expectedColumn, actualColumn, failureHandler);
}
 
Example 4
Source File: HackedDbUnitAssert.java    From kylin with Apache License 2.0 5 votes vote down vote up
private DataType getComparisonDataType(String tableName, Column expectedColumn, Column actualColumn, FailureHandler failureHandler) {
    if (logger.isDebugEnabled())
        logger.debug("getComparisonDataType(tableName={}, expectedColumn={}, actualColumn={}, failureHandler={}) - start", new Object[] { tableName, expectedColumn, actualColumn, failureHandler });

    DataType expectedDataType = expectedColumn.getDataType();
    DataType actualDataType = actualColumn.getDataType();

    // The two columns have different data type
    if (!expectedDataType.getClass().isInstance(actualDataType)) {
        // Expected column data type is unknown, use actual column data type
        if (expectedDataType instanceof UnknownDataType) {
            return actualDataType;
        }

        // Actual column data type is unknown, use expected column data type
        if (actualDataType instanceof UnknownDataType) {
            return expectedDataType;
        }
        
        if (hackIgnoreIntBigIntMismatch) {
            if (expectedDataType instanceof IntegerDataType && actualDataType instanceof BigIntegerDataType)
                return actualDataType;
        }

        // Impossible to determine which data type to use
        String msg = "Incompatible data types: (table=" + tableName + ", col=" + expectedColumn.getColumnName() + ")";
        throw failureHandler.createFailure(msg, String.valueOf(expectedDataType), String.valueOf(actualDataType));
    }

    // Both columns have same data type, return any one of them
    return expectedDataType;
}
 
Example 5
Source File: DataSetComparatorTest.java    From jpa-unit with Apache License 2.0 4 votes vote down vote up
@Override
public boolean accept(final String tableName, final Column column) {
    // reject column 1
    return column.getColumnName() != TABLE_1_COLUMN_1.getColumnName();
}