本文整理汇总了Java中org.dbunit.assertion.FailureHandler类的典型用法代码示例。如果您正苦于以下问题:Java FailureHandler类的具体用法?Java FailureHandler怎么用?Java FailureHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FailureHandler类属于org.dbunit.assertion包,在下文中一共展示了FailureHandler类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: compareDataContains
import org.dbunit.assertion.FailureHandler; //导入依赖的package包/类
private void compareDataContains(ITable expectedTable, ITable actualTable, ComparisonColumn[] comparisonCols, FailureHandler failureHandler) throws DataSetException {
logger.debug("compareData(expectedTable={}, actualTable={}, " + "comparisonCols={}, failureHandler={}) - start", new Object[] { expectedTable, actualTable, comparisonCols, failureHandler });
if (expectedTable == null) {
throw new NullPointerException("The parameter 'expectedTable' must not be null");
}
if (actualTable == null) {
throw new NullPointerException("The parameter 'actualTable' must not be null");
}
if (comparisonCols == null) {
throw new NullPointerException("The parameter 'comparisonCols' must not be null");
}
if (failureHandler == null) {
throw new NullPointerException("The parameter 'failureHandler' must not be null");
}
for (int index = 0; index < actualTable.getRowCount(); index++) {
if (!findRowInExpectedTable(expectedTable, actualTable, comparisonCols, failureHandler, index)) {
throw new IllegalStateException();
}
}
}
开发者ID:apache,项目名称:kylin,代码行数:24,代码来源:HackedDbUnitAssert.java
示例2: getComparisonColumns
import org.dbunit.assertion.FailureHandler; //导入依赖的package包/类
@Override
protected ComparisonColumn[] getComparisonColumns(String expectedTableName, Column[] expectedColumns, Column[] actualColumns, FailureHandler failureHandler) {
ComparisonColumn[] result = new ComparisonColumn[expectedColumns.length];
for (int j = 0; j < expectedColumns.length; j++) {
Column expectedColumn = expectedColumns[j];
Column actualColumn = actualColumns[j];
result[j] = new HackedComparisonColumn(expectedTableName, expectedColumn, actualColumn, failureHandler);
}
return result;
}
开发者ID:apache,项目名称:kylin,代码行数:12,代码来源:HackedDbUnitAssert.java
示例3: HackedComparisonColumn
import org.dbunit.assertion.FailureHandler; //导入依赖的package包/类
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);
}
开发者ID:apache,项目名称:kylin,代码行数:9,代码来源:HackedDbUnitAssert.java
示例4: getComparisonDataType
import org.dbunit.assertion.FailureHandler; //导入依赖的package包/类
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;
}
开发者ID:apache,项目名称:kylin,代码行数:33,代码来源:HackedDbUnitAssert.java
示例5: findRowInExpectedTable
import org.dbunit.assertion.FailureHandler; //导入依赖的package包/类
private boolean findRowInExpectedTable(ITable expectedTable, ITable actualTable, ComparisonColumn[] comparisonCols, FailureHandler failureHandler, int index) throws DataSetException {
// iterate over all rows
for (int i = 0; i < expectedTable.getRowCount(); i++) {
// iterate over all columns of the current row
for (int j = 0; j < comparisonCols.length; j++) {
ComparisonColumn compareColumn = comparisonCols[j];
String columnName = compareColumn.getColumnName();
DataType dataType = compareColumn.getDataType();
Object expectedValue = expectedTable.getValue(i, columnName);
Object actualValue = actualTable.getValue(index, columnName);
// Compare the values
if (skipCompare(columnName, expectedValue, actualValue)) {
if (logger.isTraceEnabled()) {
logger.trace("ignoring comparison " + expectedValue + "=" + actualValue + " on column " + columnName);
}
continue;
}
if (dataType.compare(expectedValue, actualValue) != 0) {
break;
// Difference diff = new Difference(expectedTable, actualTable, i, columnName, expectedValue, actualValue);
//
// // Handle the difference (throw error immediately or something else)
// failureHandler.handle(diff);
} else {
if (j == comparisonCols.length - 1) {
return true;
} else {
continue;
}
}
}
}
return false;
}
开发者ID:apache,项目名称:kylin,代码行数:42,代码来源:HackedDbUnitAssert.java
示例6: ValidatorFailureHandler
import org.dbunit.assertion.FailureHandler; //导入依赖的package包/类
/**
* @param delegateFailureHandler
*/
public ValidatorFailureHandler(FailureHandler delegateFailureHandler) {
super();
this.delegateFailureHandler = delegateFailureHandler;
}
开发者ID:opensource21,项目名称:dbunit-validation,代码行数:8,代码来源:ValidatorFailureHandler.java
注:本文中的org.dbunit.assertion.FailureHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论