本文整理汇总了Java中org.dbunit.dataset.datatype.DataTypeException类的典型用法代码示例。如果您正苦于以下问题:Java DataTypeException类的具体用法?Java DataTypeException怎么用?Java DataTypeException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataTypeException类属于org.dbunit.dataset.datatype包,在下文中一共展示了DataTypeException类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDataType
import org.dbunit.dataset.datatype.DataTypeException; //导入依赖的package包/类
@Override
public DataType createDataType(int sqlType, String sqlTypeName) throws DataTypeException {
if (sqlType == 1111) {
if ("jsonb".equals(sqlTypeName)) {
return new JsonbDataType();
}
}
return super.createDataType(sqlType, sqlTypeName);
}
示例2: createDataType
import org.dbunit.dataset.datatype.DataTypeException; //导入依赖的package包/类
@Override
public DataType createDataType(int sqlType, String sqlTypeName) throws DataTypeException {
logger.debug("createDataType(sqlType={}, sqlTypeName={}) - start", new Integer(sqlType),
sqlTypeName);
DataType customDataType = customDataTypeMap.get(sqlTypeName);
if (customDataType != null) {
logger.debug("use custom dataType(sqlTypeName={}, dataType=)", sqlTypeName, customDataType);
return customDataType;
} else {
return super.createDataType(sqlType, sqlTypeName);
}
}
示例3: testCreateDataType
import org.dbunit.dataset.datatype.DataTypeException; //导入依赖的package包/类
@Test
public void testCreateDataType() throws DataTypeException {
ClikeDataTypeFactory factory = new ClikeDataTypeFactory();
DataType dataType = factory.createDataType(Types.TIMESTAMP, "TIMESTAMP");
assertThat(dataType, is(instanceOf(IntervalNowTimestampType.class)));
}
示例4: testAddCustomType
import org.dbunit.dataset.datatype.DataTypeException; //导入依赖的package包/类
@Test
public void testAddCustomType() throws DataTypeException {
CustomableDataTypeFactory factory = new CustomableDataTypeFactory();
factory.addCustomType("MYTYPE", DataType.BOOLEAN);
factory.addCustomType("MYTYPE2", DataType.BOOLEAN);
DataType dataType = factory.createDataType(55, "MYTYPE");
DataType dataType2 = factory.createDataType(1, "MYTYPE2");
DataType dataType3 = factory.createDataType(1, "VARCHAR");
assertThat(dataType, is(DataType.BOOLEAN));
assertThat(dataType2, is(DataType.BOOLEAN));
assertThat(dataType3, not(DataType.BOOLEAN));
}
示例5: createDataType
import org.dbunit.dataset.datatype.DataTypeException; //导入依赖的package包/类
@Override
public DataType createDataType(int sqlType, String sqlTypeName, String tableName, String columnName)
throws DataTypeException {
if ((columnName.startsWith("COL") || columnName.startsWith("col")) && sqlType == Types.BIGINT) {
return DataType.INTEGER;
}
return super.createDataType(sqlType, sqlTypeName);
}
示例6: createDataType
import org.dbunit.dataset.datatype.DataTypeException; //导入依赖的package包/类
public DataType createDataType(int sqlType, String sqlTypeName)
throws DataTypeException {
if (sqlType == Types.TIMESTAMP) {
return new CustomTimestampDataType();
}
else {
return super.createDataType(sqlType, sqlTypeName);
}
}
示例7: createDataType
import org.dbunit.dataset.datatype.DataTypeException; //导入依赖的package包/类
@Override
public DataType createDataType(int sqlType, String sqlTypeName, String tableName, String columnName) throws DataTypeException {
if ((columnName.startsWith("COL") || columnName.startsWith("col")) && sqlType == Types.BIGINT) {
return DataType.INTEGER;
}
return super.createDataType(sqlType, sqlTypeName);
}
示例8: createDataType
import org.dbunit.dataset.datatype.DataTypeException; //导入依赖的package包/类
@Override
public DataType createDataType(int sqlType, String sqlTypeName) throws DataTypeException {
return super.createDataType(sqlType, sqlTypeName);
}
示例9: testRemoveCustomType
import org.dbunit.dataset.datatype.DataTypeException; //导入依赖的package包/类
@Test
public void testRemoveCustomType() throws DataTypeException {
CustomableDataTypeFactory factory = new CustomableDataTypeFactory();
DataType customedDatatype = DataType.DOUBLE;
DataType customDatatype = DataType.BOOLEAN;
factory.addCustomType(customedDatatype.toString(), customDatatype);
DataType dataType = factory.createDataType(customedDatatype.getSqlType(), customedDatatype.toString());
factory.removeCustomType(customedDatatype.toString());
DataType dataType2 = factory.createDataType(customedDatatype.getSqlType(), customedDatatype.toString());
assertThat(dataType, is(customDatatype));
assertThat(dataType2, not(customDatatype));
}
示例10: getValue
import org.dbunit.dataset.datatype.DataTypeException; //导入依赖的package包/类
public Object getValue(int row, String column) throws DataSetException {
if (logger.isDebugEnabled())
logger.debug("getValue(row={}, columnName={}) - start", Integer.toString(row), column);
assertValidRowIndex(row);
int columnIndex = getColumnIndex(column);
HSSFCell cell = _sheet.getRow(row + 1).getCell(columnIndex);
if (cell == null) {
return null;
}
int type = cell.getCellType();
switch (type) {
case HSSFCell.CELL_TYPE_NUMERIC:
HSSFCellStyle style = cell.getCellStyle();
if (HSSFDateUtil.isCellDateFormatted(cell)) {
return getDateValue(cell);
} else if (XlsDataSetWriter.DATE_FORMAT_AS_NUMBER_DBUNIT.equals(style.getDataFormatString())) {
// The special dbunit date format
return getDateValueFromJavaNumber(cell);
} else {
return getNumericValue(cell);
}
case HSSFCell.CELL_TYPE_STRING:
return cell.getRichStringCellValue().getString();
case HSSFCell.CELL_TYPE_FORMULA:
throw new DataTypeException("Formula not supported at row=" +
row + ", column=" + column);
case HSSFCell.CELL_TYPE_BLANK:
return null;
case HSSFCell.CELL_TYPE_BOOLEAN:
return cell.getBooleanCellValue() ? Boolean.TRUE : Boolean.FALSE;
case HSSFCell.CELL_TYPE_ERROR:
throw new DataTypeException("Error at row=" + row +
", column=" + column);
default:
throw new DataTypeException("Unsupported type at row=" + row +
", column=" + column);
}
}
示例11: testSetCurrentIntervalSecondLength
import org.dbunit.dataset.datatype.DataTypeException; //导入依赖的package包/类
@Test
public void testSetCurrentIntervalSecondLength() throws DataTypeException {
ClikeDataTypeFactory factory = new ClikeDataTypeFactory();
DataType dataType = factory.createDataType(Types.TIMESTAMP, "TIMESTAMP");
assertThat(dataType, is(instanceOf(IntervalNowTimestampType.class)));
factory.setCurrentIntervalSecondLength(3L);
DataType dataType2 = factory.createDataType(Types.TIMESTAMP, "TIMESTAMP");
assertThat(dataType, not(dataType2));
}