You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(5) |
Jul
(7) |
Aug
(37) |
Sep
|
Oct
|
Nov
(1) |
Dec
(22) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(8) |
Feb
(68) |
Mar
(72) |
Apr
(149) |
May
(32) |
Jun
(46) |
Jul
(26) |
Aug
(59) |
Sep
(25) |
Oct
(18) |
Nov
(4) |
Dec
(3) |
2004 |
Jan
(90) |
Feb
(19) |
Mar
(38) |
Apr
(41) |
May
(44) |
Jun
(2) |
Jul
(10) |
Aug
|
Sep
(14) |
Oct
|
Nov
(1) |
Dec
|
2005 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(15) |
Jun
(1) |
Jul
|
Aug
(9) |
Sep
|
Oct
(17) |
Nov
|
Dec
|
2006 |
Jan
(1) |
Feb
(16) |
Mar
|
Apr
(1) |
May
(48) |
Jun
|
Jul
(2) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(29) |
2007 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
(23) |
Mar
(31) |
Apr
|
May
(26) |
Jun
(6) |
Jul
(1) |
Aug
|
Sep
(7) |
Oct
(1) |
Nov
(8) |
Dec
(8) |
2009 |
Jan
(5) |
Feb
(9) |
Mar
(1) |
Apr
|
May
(23) |
Jun
(3) |
Jul
|
Aug
(1) |
Sep
(9) |
Oct
(28) |
Nov
(18) |
Dec
(8) |
2010 |
Jan
(19) |
Feb
(24) |
Mar
(3) |
Apr
|
May
(5) |
Jun
(4) |
Jul
|
Aug
(1) |
Sep
(11) |
Oct
|
Nov
(2) |
Dec
(1) |
2011 |
Jan
|
Feb
(7) |
Mar
|
Apr
(6) |
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(32) |
Oct
(6) |
Nov
|
Dec
|
From: <mla...@us...> - 2003-05-20 01:01:24
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/ext/mssqlserver In directory sc8-pr-cvs1:/tmp/cvs-serv16025/src/java/org/dbunit/ext/mssqlserver Added Files: MsSqlConnection.java MsSqlDataTypeFactory.java Log Message: Added MS SQL Server data type factory. Custom data types still need to be implemented. --- NEW FILE: MsSqlConnection.java --- /* * * The DbUnit Database Testing Framework * Copyright (C)2002, Manuel Laflamme * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package org.dbunit.ext.mssqlserver; import org.dbunit.database.DatabaseConnection; import org.dbunit.dataset.FilteredDataSet; import org.dbunit.dataset.IDataSet; import org.dbunit.dataset.datatype.IDataTypeFactory; import org.dbunit.dataset.filter.ExcludeTableFilter; import org.dbunit.dataset.filter.ITableFilter; import java.sql.Connection; import java.sql.SQLException; /** * @author Manuel Laflamme * @since May 19, 2003 * @version $Revision: 1.1 $ */ public class MsSqlConnection extends DatabaseConnection { private final IDataTypeFactory _dataTypeFactory = new MsSqlDataTypeFactory(); private final ITableFilter _filter = new ExcludeTableFilter( new String[] {"dtproperties"}); /** * Creates a new <code>MsSqlConnection</code>. * * @param connection the adapted JDBC connection * @param schema the database schema */ public MsSqlConnection(Connection connection, String schema) { super(connection, schema); } /** * Creates a new <code>MsSqlConnection</code>. * * @param connection the adapted JDBC connection */ public MsSqlConnection(Connection connection) { super(connection); } //////////////////////////////////////////////////////////////////////////// // IDatabaseConnection public IDataSet createDataSet() throws SQLException { IDataSet dataSet = super.createDataSet(); return new FilteredDataSet(_filter, dataSet); } public IDataSet createDataSet(String[] tableNames) throws SQLException { IDataSet dataSet = super.createDataSet(tableNames); return new FilteredDataSet(_filter, dataSet); } //////////////////////////////////////////////////////////////////////////// // AbstractDatabaseConnection protected IDataTypeFactory getDataTypeFactory() { return _dataTypeFactory; } } --- NEW FILE: MsSqlDataTypeFactory.java --- /* * * The DbUnit Database Testing Framework * Copyright (C)2002, Manuel Laflamme * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package org.dbunit.ext.mssqlserver; import org.dbunit.dataset.datatype.IDataTypeFactory; import org.dbunit.dataset.datatype.DataType; import org.dbunit.dataset.datatype.DataTypeException; import org.dbunit.dataset.datatype.DefaultDataTypeFactory; /** * Specialized factory that recognizes MS SQL Server data types. * * @author Manuel Laflamme * @since May 19, 2003 * @version $Revision: 1.1 $ */ public class MsSqlDataTypeFactory extends DefaultDataTypeFactory { public DataType createDataType(int sqlType, String sqlTypeName) throws DataTypeException { // TODO : Process MS SQL Server custom datatype here // if (sqlType == custom1) // { // return CUSTOM1; // } // // if (sqlType == custom2) // { // return CUSTOM2; // } return super.createDataType(sqlType, sqlTypeName); } } |
From: <mla...@us...> - 2003-05-20 01:01:24
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype In directory sc8-pr-cvs1:/tmp/cvs-serv16025/src/java/org/dbunit/dataset/datatype Modified Files: AbstractDataType.java DefaultDataTypeFactory.java Log Message: Added MS SQL Server data type factory. Custom data types still need to be implemented. Index: AbstractDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/AbstractDataType.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AbstractDataType.java 17 May 2003 15:38:52 -0000 1.7 --- AbstractDataType.java 20 May 2003 01:01:20 -0000 1.8 *************** *** 31,35 **** * @version $Revision$ */ ! abstract class AbstractDataType extends DataType { private final String _name; --- 31,35 ---- * @version $Revision$ */ ! public abstract class AbstractDataType extends DataType { private final String _name; Index: DefaultDataTypeFactory.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/DefaultDataTypeFactory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DefaultDataTypeFactory.java 19 May 2003 22:09:21 -0000 1.1 --- DefaultDataTypeFactory.java 20 May 2003 01:01:20 -0000 1.2 *************** *** 24,27 **** --- 24,29 ---- /** + * Generic factory that handle standard JDBC types. + * * @author Manuel Laflamme * @since May 17, 2003 |
From: <mla...@us...> - 2003-05-20 00:55:30
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/ext/mssqlserver In directory sc8-pr-cvs1:/tmp/cvs-serv11403/mssqlserver Log Message: Directory /cvsroot/dbunit/dbunit/src/java/org/dbunit/ext/mssqlserver added to the repository |
From: <mla...@us...> - 2003-05-20 00:55:25
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/ext In directory sc8-pr-cvs1:/tmp/cvs-serv11315a/ext Log Message: Directory /cvsroot/dbunit/dbunit/src/java/org/dbunit/ext added to the repository |
From: <mla...@us...> - 2003-05-19 22:09:27
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/database In directory sc8-pr-cvs1:/tmp/cvs-serv23537/src/java/org/dbunit/database Modified Files: AbstractDatabaseConnection.java AbstractResultSetTable.java CachedResultSetTable.java DatabaseDataSet.java DatabaseTableMetaData.java ForwardOnlyResultSetTable.java ScrollableResultSetTable.java Log Message: Added DataType factory to allows integration of custom type with DbUnit core. Index: AbstractDatabaseConnection.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/AbstractDatabaseConnection.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** AbstractDatabaseConnection.java 13 Apr 2003 02:40:09 -0000 1.14 --- AbstractDatabaseConnection.java 19 May 2003 22:09:19 -0000 1.15 *************** *** 26,29 **** --- 26,31 ---- import org.dbunit.database.statement.IStatementFactory; import org.dbunit.dataset.*; + import org.dbunit.dataset.datatype.IDataTypeFactory; + import org.dbunit.dataset.datatype.DefaultDataTypeFactory; import java.lang.reflect.Constructor; *************** *** 42,45 **** --- 44,48 ---- private final IStatementFactory _statementFactory; + private final IDataTypeFactory _dataTypeFactory = new DefaultDataTypeFactory(); private IDataSet _dataSet = null; *************** *** 83,86 **** --- 86,94 ---- } + protected IDataTypeFactory getDataTypeFactory() + { + return _dataTypeFactory; + } + //////////////////////////////////////////////////////////////////////////// // IDatabaseConnection interface *************** *** 90,94 **** if (_dataSet == null) { ! _dataSet = new DatabaseDataSet(this); } --- 98,102 ---- if (_dataSet == null) { ! _dataSet = new DatabaseDataSet(this, getDataTypeFactory()); } *************** *** 111,116 **** try { ! ITableMetaData metaData = ScrollableResultSetTable.createTableMetaData( ! resultName, resultSet); return new CachedResultSetTable(metaData, resultSet); } --- 119,124 ---- try { ! ITableMetaData metaData = AbstractResultSetTable.createTableMetaData( ! resultName, resultSet, getDataTypeFactory()); return new CachedResultSetTable(metaData, resultSet); } Index: AbstractResultSetTable.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/AbstractResultSetTable.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AbstractResultSetTable.java 13 Apr 2003 02:40:09 -0000 1.1 --- AbstractResultSetTable.java 19 May 2003 22:09:20 -0000 1.2 *************** *** 27,30 **** --- 27,31 ---- import org.dbunit.dataset.DefaultTableMetaData; import org.dbunit.dataset.datatype.DataType; + import org.dbunit.dataset.datatype.IDataTypeFactory; import java.sql.ResultSet; *************** *** 54,58 **** public AbstractResultSetTable(String tableName, String selectStatement, ! IDatabaseConnection connection) throws DataSetException, SQLException { Connection jdbcConnection = connection.getConnection(); --- 55,60 ---- public AbstractResultSetTable(String tableName, String selectStatement, ! IDatabaseConnection connection, IDataTypeFactory dataTypeFactory) ! throws DataSetException, SQLException { Connection jdbcConnection = connection.getConnection(); *************** *** 63,67 **** { _resultSet = _statement.executeQuery(selectStatement); ! _metaData = createTableMetaData(tableName, _resultSet); } catch (SQLException e) --- 65,69 ---- { _resultSet = _statement.executeQuery(selectStatement); ! _metaData = createTableMetaData(tableName, _resultSet, dataTypeFactory); } catch (SQLException e) *************** *** 102,106 **** static ITableMetaData createTableMetaData(String name, ! ResultSet resultSet) throws DataSetException, SQLException { ResultSetMetaData metaData = resultSet.getMetaData(); --- 104,108 ---- static ITableMetaData createTableMetaData(String name, ! ResultSet resultSet, IDataTypeFactory dataTypeFactory) throws DataSetException, SQLException { ResultSetMetaData metaData = resultSet.getMetaData(); *************** *** 108,115 **** for (int i = 0; i < columns.length; i++) { columns[i] = new Column( metaData.getColumnName(i + 1), ! DataType.forSqlType(metaData.getColumnType(i + 1)), ! metaData.getColumnTypeName(i + 1), Column.nullableValue(metaData.isNullable(i + 1))); } --- 110,121 ---- for (int i = 0; i < columns.length; i++) { + int columnType = metaData.getColumnType(i + 1); + String columnTypeName = metaData.getColumnTypeName(i + 1); + DataType dataType = dataTypeFactory.createDataType( + columnType, columnTypeName); columns[i] = new Column( metaData.getColumnName(i + 1), ! dataType, ! columnTypeName, Column.nullableValue(metaData.isNullable(i + 1))); } Index: CachedResultSetTable.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/CachedResultSetTable.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** CachedResultSetTable.java 13 Apr 2003 02:40:09 -0000 1.8 --- CachedResultSetTable.java 19 May 2003 22:09:20 -0000 1.9 *************** *** 26,29 **** --- 26,30 ---- import org.dbunit.dataset.DataSetException; import org.dbunit.dataset.ITableMetaData; + import org.dbunit.dataset.datatype.IDataTypeFactory; import java.sql.ResultSet; *************** *** 36,41 **** public class CachedResultSetTable extends CachedTable implements IResultSetTable { ! public CachedResultSetTable(ITableMetaData metaData, ResultSet resultSet) ! throws SQLException, DataSetException { this(new ForwardOnlyResultSetTable(metaData, resultSet)); --- 37,42 ---- public class CachedResultSetTable extends CachedTable implements IResultSetTable { ! public CachedResultSetTable(ITableMetaData metaData, ResultSet resultSet ! ) throws SQLException, DataSetException { this(new ForwardOnlyResultSetTable(metaData, resultSet)); Index: DatabaseDataSet.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/DatabaseDataSet.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** DatabaseDataSet.java 13 Apr 2003 03:38:01 -0000 1.21 --- DatabaseDataSet.java 19 May 2003 22:09:20 -0000 1.22 *************** *** 23,31 **** package org.dbunit.database; ! import org.dbunit.dataset.*; ! import org.dbunit.dataset.filter.SequenceTableIterator; ! import java.sql.*; ! import java.util.*; /** --- 23,46 ---- package org.dbunit.database; ! import org.dbunit.dataset.AbstractDataSet; ! import org.dbunit.dataset.Column; ! import org.dbunit.dataset.DataSetException; ! import org.dbunit.dataset.DataSetUtils; ! import org.dbunit.dataset.ITable; ! import org.dbunit.dataset.ITableIterator; ! import org.dbunit.dataset.ITableMetaData; ! import org.dbunit.dataset.NoSuchTableException; ! import org.dbunit.dataset.datatype.IDataTypeFactory; ! import java.sql.Connection; ! import java.sql.DatabaseMetaData; ! import java.sql.ResultSet; ! import java.sql.SQLException; ! import java.sql.Statement; ! import java.util.ArrayList; ! import java.util.HashMap; ! import java.util.Iterator; ! import java.util.List; ! import java.util.Map; /** *************** *** 40,49 **** private final IDatabaseConnection _connection; private final Map _tableMap = new HashMap(); private List _nameList = null; ! DatabaseDataSet(IDatabaseConnection connection) throws SQLException { _connection = connection; } --- 55,66 ---- private final IDatabaseConnection _connection; + private final IDataTypeFactory _dataTypeFactory; private final Map _tableMap = new HashMap(); private List _nameList = null; ! DatabaseDataSet(IDatabaseConnection connection, IDataTypeFactory dataTypeFactory) throws SQLException { _connection = connection; + _dataTypeFactory = dataTypeFactory; } *************** *** 203,207 **** // Create metadata and cache it metaData = new DatabaseTableMetaData( ! databaseTableName, _connection); _tableMap.put(upperTableName, metaData); break; --- 220,224 ---- // Create metadata and cache it metaData = new DatabaseTableMetaData( ! databaseTableName, _connection, _dataTypeFactory); _tableMap.put(upperTableName, metaData); break; Index: DatabaseTableMetaData.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/DatabaseTableMetaData.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** DatabaseTableMetaData.java 14 Feb 2003 05:02:28 -0000 1.14 --- DatabaseTableMetaData.java 19 May 2003 22:09:20 -0000 1.15 *************** *** 23,31 **** package org.dbunit.database; ! import org.dbunit.dataset.*; import org.dbunit.dataset.datatype.DataType; ! import java.sql.*; ! import java.util.*; /** --- 23,41 ---- package org.dbunit.database; ! import org.dbunit.dataset.AbstractTableMetaData; ! import org.dbunit.dataset.Column; ! import org.dbunit.dataset.DataSetException; ! import org.dbunit.dataset.NoColumnsFoundException; import org.dbunit.dataset.datatype.DataType; + import org.dbunit.dataset.datatype.IDataTypeFactory; ! import java.sql.Connection; ! import java.sql.DatabaseMetaData; ! import java.sql.ResultSet; ! import java.sql.SQLException; ! import java.util.ArrayList; ! import java.util.Arrays; ! import java.util.Collections; ! import java.util.List; /** *************** *** 37,47 **** private final String _tableName; private final IDatabaseConnection _connection; private Column[] _columns; private Column[] _primaryKeys; ! public DatabaseTableMetaData(String tableName, IDatabaseConnection connection) { _tableName = tableName; _connection = connection; } --- 47,60 ---- private final String _tableName; private final IDatabaseConnection _connection; + private final IDataTypeFactory _dataTypeFactory; private Column[] _columns; private Column[] _primaryKeys; ! DatabaseTableMetaData(String tableName, IDatabaseConnection connection, ! IDataTypeFactory dataTypeFactory) { _tableName = tableName; _connection = connection; + _dataTypeFactory = dataTypeFactory; } *************** *** 160,174 **** int nullable = resultSet.getInt(11); ! // convert sql type to DataType ! DataType dataType = DataType.UNKNOWN; ! if (sqlType != Types.OTHER) ! { ! dataType = DataType.forSqlType(sqlType); ! } ! else ! { ! dataType = DataType.forSqlTypeName(sqlTypeName); ! } ! if (dataType != DataType.UNKNOWN) { --- 173,179 ---- int nullable = resultSet.getInt(11); ! // Convert SQL type to DataType ! DataType dataType = ! _dataTypeFactory.createDataType(sqlType, sqlTypeName); if (dataType != DataType.UNKNOWN) { Index: ForwardOnlyResultSetTable.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/ForwardOnlyResultSetTable.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ForwardOnlyResultSetTable.java 17 May 2003 15:38:51 -0000 1.3 --- ForwardOnlyResultSetTable.java 19 May 2003 22:09:20 -0000 1.4 *************** *** 25,28 **** --- 25,29 ---- import org.dbunit.dataset.RowOutOfBoundsException; import org.dbunit.dataset.Column; + import org.dbunit.dataset.datatype.DefaultDataTypeFactory; import java.sql.ResultSet; *************** *** 45,58 **** } ! public ForwardOnlyResultSetTable(String tableName, String selectStatement, IDatabaseConnection connection) throws DataSetException, SQLException { ! super(tableName, selectStatement, connection); } ! public ForwardOnlyResultSetTable(ITableMetaData metaData, IDatabaseConnection connection) throws DataSetException, SQLException { ! super(metaData, connection); } --- 46,59 ---- } ! public ForwardOnlyResultSetTable(ITableMetaData metaData, IDatabaseConnection connection) throws DataSetException, SQLException { ! super(metaData, connection); } ! public ForwardOnlyResultSetTable(String tableName, String selectStatement, IDatabaseConnection connection) throws DataSetException, SQLException { ! super(tableName, selectStatement, connection, new DefaultDataTypeFactory()); } Index: ScrollableResultSetTable.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/ScrollableResultSetTable.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ScrollableResultSetTable.java 17 May 2003 15:38:51 -0000 1.2 --- ScrollableResultSetTable.java 19 May 2003 22:09:20 -0000 1.3 *************** *** 26,29 **** --- 26,30 ---- import org.dbunit.dataset.ITableMetaData; import org.dbunit.dataset.Column; + import org.dbunit.dataset.datatype.DefaultDataTypeFactory; import java.sql.ResultSet; *************** *** 60,67 **** } ! public ScrollableResultSetTable(String tableName, String selectStatement, IDatabaseConnection connection) throws DataSetException, SQLException { ! super(tableName, selectStatement, connection); try --- 61,68 ---- } ! public ScrollableResultSetTable(ITableMetaData metaData, IDatabaseConnection connection) throws DataSetException, SQLException { ! super(metaData, connection); try *************** *** 82,89 **** } ! public ScrollableResultSetTable(ITableMetaData metaData, IDatabaseConnection connection) throws DataSetException, SQLException { ! super(metaData, connection); try --- 83,90 ---- } ! public ScrollableResultSetTable(String tableName, String selectStatement, IDatabaseConnection connection) throws DataSetException, SQLException { ! super(tableName, selectStatement, connection, new DefaultDataTypeFactory()); try |
From: <mla...@us...> - 2003-05-19 22:09:27
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/database In directory sc8-pr-cvs1:/tmp/cvs-serv23537/src/test/org/dbunit/database Modified Files: DatabaseTableMetaDataTest.java Log Message: Added DataType factory to allows integration of custom type with DbUnit core. Index: DatabaseTableMetaDataTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/database/DatabaseTableMetaDataTest.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** DatabaseTableMetaDataTest.java 13 Apr 2003 02:40:11 -0000 1.15 --- DatabaseTableMetaDataTest.java 19 May 2003 22:09:21 -0000 1.16 *************** *** 27,30 **** --- 27,31 ---- import org.dbunit.dataset.*; import org.dbunit.dataset.datatype.DataType; + import org.dbunit.dataset.datatype.DefaultDataTypeFactory; /** *************** *** 75,79 **** String tableName = "UNKNOWN_TABLE"; ! ITableMetaData metaData = new DatabaseTableMetaData(tableName, getConnection()); try { --- 76,81 ---- String tableName = "UNKNOWN_TABLE"; ! ITableMetaData metaData = new DatabaseTableMetaData(tableName, ! getConnection(), new DefaultDataTypeFactory()); try { |
From: <mla...@us...> - 2003-05-19 22:09:27
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype In directory sc8-pr-cvs1:/tmp/cvs-serv23537/src/java/org/dbunit/dataset/datatype Modified Files: DataType.java Added Files: DefaultDataTypeFactory.java IDataTypeFactory.java Log Message: Added DataType factory to allows integration of custom type with DbUnit core. --- NEW FILE: DefaultDataTypeFactory.java --- /* * * The DbUnit Database Testing Framework * Copyright (C)2002, Manuel Laflamme * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package org.dbunit.dataset.datatype; import java.sql.Types; /** * @author Manuel Laflamme * @since May 17, 2003 * @version $Revision: 1.1 $ */ public class DefaultDataTypeFactory implements IDataTypeFactory { public DataType createDataType(int sqlType, String sqlTypeName) throws DataTypeException { DataType dataType = DataType.UNKNOWN; if (sqlType != Types.OTHER) { dataType = DataType.forSqlType(sqlType); } else { dataType = DataType.forSqlTypeName(sqlTypeName); } return dataType; } } --- NEW FILE: IDataTypeFactory.java --- /* * * The DbUnit Database Testing Framework * Copyright (C)2002, Manuel Laflamme * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package org.dbunit.dataset.datatype; /** * A factory for creating {@link DataType}. * * @author Manuel Laflamme * @since May 17, 2003 * @version $Revision: 1.1 $ */ public interface IDataTypeFactory { /** * Returns the DataType object that corresponds to the specified * {@link java.sql.Types}. * * @param sqlType SQL type from {@link java.sql.Types} * @param sqlTypeName Data source dependent type name */ public DataType createDataType(int sqlType, String sqlTypeName) throws DataTypeException; } Index: DataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/DataType.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** DataType.java 17 May 2003 15:49:07 -0000 1.19 --- DataType.java 19 May 2003 22:09:20 -0000 1.20 *************** *** 35,40 **** { public static final DataType UNKNOWN = new UnknownDataType(); - // public static final DataType UNKNOWN = new UnknownDataType( - // "UNKNOWN", Types.OTHER); public static final DataType CHAR = new StringDataType( --- 35,38 ---- |
From: <mla...@us...> - 2003-05-17 15:49:11
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype In directory sc8-pr-cvs1:/tmp/cvs-serv30415/src/java/org/dbunit/dataset/datatype Modified Files: DataType.java Log Message: Oups! There is an error at the construction of the DataType.UNKNOWN constant. Index: DataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/DataType.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** DataType.java 17 May 2003 15:38:52 -0000 1.18 --- DataType.java 17 May 2003 15:49:07 -0000 1.19 *************** *** 34,39 **** public abstract class DataType { ! public static final DataType UNKNOWN = new UnknownDataType( ! "UNKNOWN", Types.OTHER); public static final DataType CHAR = new StringDataType( --- 34,40 ---- public abstract class DataType { ! public static final DataType UNKNOWN = new UnknownDataType(); ! // public static final DataType UNKNOWN = new UnknownDataType( ! // "UNKNOWN", Types.OTHER); public static final DataType CHAR = new StringDataType( |
From: <mla...@us...> - 2003-05-17 15:38:55
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/operation In directory sc8-pr-cvs1:/tmp/cvs-serv26040/src/java/org/dbunit/operation Modified Files: RefreshOperation.java Log Message: Fix for bug #736967 ("Wrong scale for numeric value") and Informix interval problem (TBC). I modified the way DbUnit get/set values from/to JDBC driver. So instead of using ResultSet.getObject(), DbUnit now use the ResultSet.getXXX() (getString(), getLong(), etc) method that corresponds to the JDBC datatype reported by the driver. I have done the same modification for PreparedStatement.setObject() calls. Index: RefreshOperation.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/operation/RefreshOperation.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** RefreshOperation.java 13 Apr 2003 16:49:58 -0000 1.25 --- RefreshOperation.java 17 May 2003 15:38:52 -0000 1.26 *************** *** 269,274 **** Object value = table.getValue(row, _columns[i].getColumnName()); DataType dataType = _columns[i].getDataType(); ! _countStatement.setObject(i + 1, dataType.typeCast(value), ! dataType.getSqlType()); } --- 269,273 ---- Object value = table.getValue(row, _columns[i].getColumnName()); DataType dataType = _columns[i].getDataType(); ! dataType.setSqlValue(value, i + 1, _countStatement); } |
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype In directory sc8-pr-cvs1:/tmp/cvs-serv26040/src/java/org/dbunit/dataset/datatype Modified Files: AbstractDataType.java BooleanDataType.java BytesDataType.java DataType.java DateDataType.java DoubleDataType.java FloatDataType.java IntegerDataType.java LongDataType.java NumberDataType.java StringDataType.java TimeDataType.java TimestampDataType.java Log Message: Fix for bug #736967 ("Wrong scale for numeric value") and Informix interval problem (TBC). I modified the way DbUnit get/set values from/to JDBC driver. So instead of using ResultSet.getObject(), DbUnit now use the ResultSet.getXXX() (getString(), getLong(), etc) method that corresponds to the JDBC datatype reported by the driver. I have done the same modification for PreparedStatement.setObject() calls. Index: AbstractDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/AbstractDataType.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AbstractDataType.java 31 Mar 2003 13:21:59 -0000 1.6 --- AbstractDataType.java 17 May 2003 15:38:52 -0000 1.7 *************** *** 23,26 **** --- 23,30 ---- package org.dbunit.dataset.datatype; + import java.sql.ResultSet; + import java.sql.SQLException; + import java.sql.PreparedStatement; + /** * @author Manuel Laflamme *************** *** 89,92 **** --- 93,108 ---- { return _isNumber; + } + + public Object getSqlValue(int column, ResultSet resultSet) + throws SQLException, TypeCastException + { + return resultSet.getObject(column); + } + + public void setSqlValue(Object value, int column, PreparedStatement statement) + throws SQLException, TypeCastException + { + statement.setObject(column, typeCast(value), getSqlType()); } Index: BooleanDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/BooleanDataType.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** BooleanDataType.java 31 Mar 2003 13:21:59 -0000 1.10 --- BooleanDataType.java 17 May 2003 15:38:52 -0000 1.11 *************** *** 23,26 **** --- 23,29 ---- import java.sql.Types; + import java.sql.ResultSet; + import java.sql.SQLException; + import java.sql.PreparedStatement; /** *************** *** 108,111 **** --- 111,127 ---- return 1; } + + public Object getSqlValue(int column, ResultSet resultSet) + throws SQLException, TypeCastException + { + return resultSet.getBoolean(column) ? Boolean.TRUE : Boolean.FALSE; + } + + public void setSqlValue(Object value, int column, PreparedStatement statement) + throws SQLException, TypeCastException + { + statement.setBoolean(column, ((Boolean)typeCast(value)).booleanValue()); + } + } Index: BytesDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/BytesDataType.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** BytesDataType.java 31 Mar 2003 13:22:00 -0000 1.9 --- BytesDataType.java 17 May 2003 15:38:52 -0000 1.10 *************** *** 27,30 **** --- 27,32 ---- import java.sql.Blob; import java.sql.SQLException; + import java.sql.ResultSet; + import java.sql.PreparedStatement; /** *************** *** 143,146 **** --- 145,169 ---- return len1 - len2; } + + public Object getSqlValue(int column, ResultSet resultSet) + throws SQLException, TypeCastException + { + return resultSet.getBytes(column); + } + + public void setSqlValue(Object value, int column, PreparedStatement statement) + throws SQLException, TypeCastException + { + // Special BLOB handling + if (this == DataType.BLOB) + { + statement.setObject(column, typeCast(value), + DataType.LONGVARBINARY.getSqlType()); + return; + } + + super.setSqlValue(value, column, statement); + } + } Index: DataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/DataType.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** DataType.java 31 Mar 2003 13:22:00 -0000 1.17 --- DataType.java 17 May 2003 15:38:52 -0000 1.18 *************** *** 23,26 **** --- 23,29 ---- import java.sql.Types; + import java.sql.ResultSet; + import java.sql.SQLException; + import java.sql.PreparedStatement; *************** *** 31,35 **** public abstract class DataType { ! public static final DataType UNKNOWN = new UnknownDataType(); public static final DataType CHAR = new StringDataType( --- 34,39 ---- public abstract class DataType { ! public static final DataType UNKNOWN = new UnknownDataType( ! "UNKNOWN", Types.OTHER); public static final DataType CHAR = new StringDataType( *************** *** 115,118 **** --- 119,134 ---- */ public abstract boolean isNumber(); + + /** + * Returns the specified column value from the specified resultset object. + */ + public abstract Object getSqlValue(int column, ResultSet resultSet) + throws SQLException, TypeCastException; + + /** + * Set the specified value to the specified prepared statement object. + */ + public abstract void setSqlValue(Object value, int column, + PreparedStatement statement) throws SQLException, TypeCastException; /** Index: DateDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/DateDataType.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** DateDataType.java 13 Jun 2002 17:24:56 -0000 1.9 --- DateDataType.java 17 May 2003 15:38:52 -0000 1.10 *************** *** 24,27 **** --- 24,30 ---- import java.sql.Types; + import java.sql.ResultSet; + import java.sql.SQLException; + import java.sql.PreparedStatement; /** *************** *** 76,79 **** --- 79,94 ---- throw new TypeCastException(value.toString()); + } + + public Object getSqlValue(int column, ResultSet resultSet) + throws SQLException, TypeCastException + { + return resultSet.getDate(column); + } + + public void setSqlValue(Object value, int column, PreparedStatement statement) + throws SQLException, TypeCastException + { + statement.setDate(column, (java.sql.Date)typeCast(value)); } } Index: DoubleDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/DoubleDataType.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** DoubleDataType.java 13 Jun 2002 17:24:56 -0000 1.9 --- DoubleDataType.java 17 May 2003 15:38:52 -0000 1.10 *************** *** 23,26 **** --- 23,29 ---- import java.math.BigDecimal; + import java.sql.ResultSet; + import java.sql.SQLException; + import java.sql.PreparedStatement; /** *************** *** 59,62 **** --- 62,78 ---- } } + + public Object getSqlValue(int column, ResultSet resultSet) + throws SQLException, TypeCastException + { + return new Double(resultSet.getDouble(column)); + } + + public void setSqlValue(Object value, int column, PreparedStatement statement) + throws SQLException, TypeCastException + { + statement.setDouble(column, ((Number)typeCast(value)).doubleValue()); + } + } Index: FloatDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/FloatDataType.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** FloatDataType.java 13 Jun 2002 17:24:57 -0000 1.9 --- FloatDataType.java 17 May 2003 15:38:52 -0000 1.10 *************** *** 24,27 **** --- 24,30 ---- import java.math.BigDecimal; import java.sql.Types; + import java.sql.ResultSet; + import java.sql.SQLException; + import java.sql.PreparedStatement; /** *************** *** 59,62 **** --- 62,77 ---- throw new TypeCastException(e); } + } + + public Object getSqlValue(int column, ResultSet resultSet) + throws SQLException, TypeCastException + { + return new Float(resultSet.getFloat(column)); + } + + public void setSqlValue(Object value, int column, PreparedStatement statement) + throws SQLException, TypeCastException + { + statement.setFloat(column, ((Number)typeCast(value)).floatValue()); } } Index: IntegerDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/IntegerDataType.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** IntegerDataType.java 13 Jun 2002 17:24:57 -0000 1.9 --- IntegerDataType.java 17 May 2003 15:38:52 -0000 1.10 *************** *** 23,26 **** --- 23,29 ---- import java.math.BigDecimal; + import java.sql.ResultSet; + import java.sql.SQLException; + import java.sql.PreparedStatement; /** *************** *** 58,61 **** --- 61,76 ---- throw new TypeCastException(e); } + } + + public Object getSqlValue(int column, ResultSet resultSet) + throws SQLException, TypeCastException + { + return new Integer(resultSet.getInt(column)); + } + + public void setSqlValue(Object value, int column, PreparedStatement statement) + throws SQLException, TypeCastException + { + statement.setInt(column, ((Integer)typeCast(value)).intValue()); } } Index: LongDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/LongDataType.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** LongDataType.java 13 Jun 2002 17:24:57 -0000 1.9 --- LongDataType.java 17 May 2003 15:38:52 -0000 1.10 *************** *** 24,27 **** --- 24,30 ---- import java.math.BigDecimal; import java.sql.Types; + import java.sql.ResultSet; + import java.sql.SQLException; + import java.sql.PreparedStatement; /** *************** *** 59,62 **** --- 62,77 ---- throw new TypeCastException(e); } + } + + public Object getSqlValue(int column, ResultSet resultSet) + throws SQLException, TypeCastException + { + return new Long(resultSet.getLong(column)); + } + + public void setSqlValue(Object value, int column, PreparedStatement statement) + throws SQLException, TypeCastException + { + statement.setLong(column, ((Number)typeCast(value)).longValue()); } } Index: NumberDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/NumberDataType.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** NumberDataType.java 17 Mar 2003 00:51:25 -0000 1.9 --- NumberDataType.java 17 May 2003 15:38:52 -0000 1.10 *************** *** 24,27 **** --- 24,30 ---- import java.math.BigDecimal; + import java.sql.ResultSet; + import java.sql.SQLException; + import java.sql.PreparedStatement; /** *************** *** 67,70 **** --- 70,85 ---- throw new TypeCastException(e); } + } + + public Object getSqlValue(int column, ResultSet resultSet) + throws SQLException, TypeCastException + { + return resultSet.getBigDecimal(column); + } + + public void setSqlValue(Object value, int column, PreparedStatement statement) + throws SQLException, TypeCastException + { + statement.setBigDecimal(column, (BigDecimal)typeCast(value)); } } Index: StringDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/StringDataType.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** StringDataType.java 13 Jun 2002 17:24:57 -0000 1.14 --- StringDataType.java 17 May 2003 15:38:52 -0000 1.15 *************** *** 110,113 **** --- 110,133 ---- throw new TypeCastException(value.toString()); } + + public Object getSqlValue(int column, ResultSet resultSet) + throws SQLException, TypeCastException + { + return resultSet.getString(column); + } + + public void setSqlValue(Object value, int column, PreparedStatement statement) + throws SQLException, TypeCastException + { + // Special CLOB handling + if (this == DataType.CLOB) + { + statement.setObject(column, typeCast(value), + DataType.LONGVARCHAR.getSqlType()); + return; + } + + statement.setString(column, asString(value)); + } } Index: TimeDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/TimeDataType.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** TimeDataType.java 13 Jun 2002 17:24:57 -0000 1.9 --- TimeDataType.java 17 May 2003 15:38:52 -0000 1.10 *************** *** 25,28 **** --- 25,31 ---- import java.sql.Time; import java.sql.Types; + import java.sql.ResultSet; + import java.sql.SQLException; + import java.sql.PreparedStatement; /** *************** *** 77,80 **** --- 80,95 ---- throw new TypeCastException(value.toString()); + } + + public Object getSqlValue(int column, ResultSet resultSet) + throws SQLException, TypeCastException + { + return resultSet.getTime(column); + } + + public void setSqlValue(Object value, int column, PreparedStatement statement) + throws SQLException, TypeCastException + { + statement.setTime(column, (java.sql.Time)typeCast(value)); } } Index: TimestampDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/TimestampDataType.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** TimestampDataType.java 13 Jun 2002 17:24:57 -0000 1.9 --- TimestampDataType.java 17 May 2003 15:38:52 -0000 1.10 *************** *** 25,28 **** --- 25,31 ---- import java.sql.Timestamp; import java.sql.Types; + import java.sql.ResultSet; + import java.sql.SQLException; + import java.sql.PreparedStatement; /** *************** *** 77,80 **** --- 80,95 ---- throw new TypeCastException(value.toString()); + } + + public Object getSqlValue(int column, ResultSet resultSet) + throws SQLException, TypeCastException + { + return resultSet.getTimestamp(column); + } + + public void setSqlValue(Object value, int column, PreparedStatement statement) + throws SQLException, TypeCastException + { + statement.setTimestamp(column, (java.sql.Timestamp)typeCast(value)); } } |
From: <mla...@us...> - 2003-05-17 15:38:54
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/statement In directory sc8-pr-cvs1:/tmp/cvs-serv26040/src/java/org/dbunit/database/statement Modified Files: PreparedBatchStatement.java SimplePreparedStatement.java Log Message: Fix for bug #736967 ("Wrong scale for numeric value") and Informix interval problem (TBC). I modified the way DbUnit get/set values from/to JDBC driver. So instead of using ResultSet.getObject(), DbUnit now use the ResultSet.getXXX() (getString(), getLong(), etc) method that corresponds to the JDBC datatype reported by the driver. I have done the same modification for PreparedStatement.setObject() calls. Index: PreparedBatchStatement.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/statement/PreparedBatchStatement.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PreparedBatchStatement.java 31 Mar 2003 19:48:40 -0000 1.9 --- PreparedBatchStatement.java 17 May 2003 15:38:52 -0000 1.10 *************** *** 57,77 **** } ! // Special BLOB handling ! if (dataType == DataType.CLOB) ! { ! _statement.setObject(++_index, dataType.typeCast(value), ! DataType.LONGVARCHAR.getSqlType()); ! return; ! } ! ! // Special CLOB handling ! if (dataType == DataType.BLOB) ! { ! _statement.setObject(++_index, dataType.typeCast(value), ! DataType.LONGVARBINARY.getSqlType()); ! return; ! } ! ! _statement.setObject(++_index, dataType.typeCast(value), dataType.getSqlType()); } --- 57,61 ---- } ! dataType.setSqlValue(value, ++_index, _statement); } Index: SimplePreparedStatement.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/statement/SimplePreparedStatement.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** SimplePreparedStatement.java 31 Mar 2003 19:48:38 -0000 1.9 --- SimplePreparedStatement.java 17 May 2003 15:38:52 -0000 1.10 *************** *** 59,79 **** } ! // Special BLOB handling ! if (dataType == DataType.CLOB) ! { ! _statement.setObject(++_index, dataType.typeCast(value), ! DataType.LONGVARCHAR.getSqlType()); ! return; ! } ! ! // Special CLOB handling ! if (dataType == DataType.BLOB) ! { ! _statement.setObject(++_index, dataType.typeCast(value), ! DataType.LONGVARBINARY.getSqlType()); ! return; ! } ! ! _statement.setObject(++_index, dataType.typeCast(value), dataType.getSqlType()); } --- 59,63 ---- } ! dataType.setSqlValue(value, ++_index, _statement); } |
From: <mla...@us...> - 2003-05-17 15:38:54
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/database In directory sc8-pr-cvs1:/tmp/cvs-serv26040/src/java/org/dbunit/database Modified Files: ForwardOnlyResultSetTable.java ScrollableResultSetTable.java Log Message: Fix for bug #736967 ("Wrong scale for numeric value") and Informix interval problem (TBC). I modified the way DbUnit get/set values from/to JDBC driver. So instead of using ResultSet.getObject(), DbUnit now use the ResultSet.getXXX() (getString(), getLong(), etc) method that corresponds to the JDBC datatype reported by the driver. I have done the same modification for PreparedStatement.setObject() calls. Index: ForwardOnlyResultSetTable.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/ForwardOnlyResultSetTable.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ForwardOnlyResultSetTable.java 13 Apr 2003 05:14:43 -0000 1.2 --- ForwardOnlyResultSetTable.java 17 May 2003 15:38:51 -0000 1.3 *************** *** 24,27 **** --- 24,28 ---- import org.dbunit.dataset.DataSetException; import org.dbunit.dataset.RowOutOfBoundsException; + import org.dbunit.dataset.Column; import java.sql.ResultSet; *************** *** 64,68 **** } ! public Object getValue(int row, String column) throws DataSetException { try --- 65,69 ---- } ! public Object getValue(int row, String columnName) throws DataSetException { try *************** *** 87,91 **** } ! return _resultSet.getObject(getColumnIndex(column) + 1); } catch (SQLException e) --- 88,94 ---- } ! int columnIndex = getColumnIndex(columnName); ! Column column = _metaData.getColumns()[columnIndex]; ! return column.getDataType().getSqlValue(columnIndex + 1, _resultSet); } catch (SQLException e) Index: ScrollableResultSetTable.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/ScrollableResultSetTable.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ScrollableResultSetTable.java 13 Apr 2003 02:40:09 -0000 1.1 --- ScrollableResultSetTable.java 17 May 2003 15:38:51 -0000 1.2 *************** *** 25,28 **** --- 25,29 ---- import org.dbunit.dataset.DataSetException; import org.dbunit.dataset.ITableMetaData; + import org.dbunit.dataset.Column; import java.sql.ResultSet; *************** *** 111,115 **** } ! public Object getValue(int row, String column) throws DataSetException { assertValidRowIndex(row); --- 112,116 ---- } ! public Object getValue(int row, String columnName) throws DataSetException { assertValidRowIndex(row); *************** *** 118,122 **** { _resultSet.absolute(row + 1); ! return _resultSet.getObject(getColumnIndex(column) + 1); } catch (SQLException e) --- 119,126 ---- { _resultSet.absolute(row + 1); ! ! int columnIndex = getColumnIndex(columnName); ! Column column = _metaData.getColumns()[columnIndex]; ! return column.getDataType().getSqlValue(columnIndex + 1, _resultSet); } catch (SQLException e) |
From: <mla...@us...> - 2003-05-17 14:27:20
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/filter In directory sc8-pr-cvs1:/tmp/cvs-serv16777/src/java/org/dbunit/dataset/filter Modified Files: Tag: branch-exml2sax IncludeTableFilter.java Log Message: Fixed comments modified during Producers' classes renaming. Index: IncludeTableFilter.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/filter/IncludeTableFilter.java,v retrieving revision 1.4.4.1 retrieving revision 1.4.4.2 diff -C2 -d -r1.4.4.1 -r1.4.4.2 *** IncludeTableFilter.java 30 Apr 2003 00:27:46 -0000 1.4.4.1 --- IncludeTableFilter.java 17 May 2003 14:27:17 -0000 1.4.4.2 *************** *** 207,211 **** } ! // produce pattern between stars. padIdxStart and patIdxEnd point // always to a '*'. while (patIdxStart != patIdxEnd && strIdxStart <= strIdxEnd) --- 207,211 ---- } ! // process pattern between stars. padIdxStart and patIdxEnd point // always to a '*'. while (patIdxStart != patIdxEnd && strIdxStart <= strIdxEnd) |
From: <mla...@us...> - 2003-05-17 14:27:20
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/operation In directory sc8-pr-cvs1:/tmp/cvs-serv16777/src/java/org/dbunit/operation Modified Files: Tag: branch-exml2sax RefreshOperation.java Log Message: Fixed comments modified during Producers' classes renaming. Index: RefreshOperation.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/operation/RefreshOperation.java,v retrieving revision 1.25.2.1 retrieving revision 1.25.2.2 diff -C2 -d -r1.25.2.1 -r1.25.2.2 *** RefreshOperation.java 30 Apr 2003 00:27:47 -0000 1.25.2.1 --- RefreshOperation.java 17 May 2003 14:27:17 -0000 1.25.2.2 *************** *** 77,81 **** ITable table = iterator.getTable(); ! // Do not produce empty table if (isEmpty(table)) { --- 77,81 ---- ITable table = iterator.getTable(); ! // Do not process empty table if (isEmpty(table)) { |
From: <mla...@us...> - 2003-05-17 14:27:20
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv16777/src/java/org/dbunit/dataset Modified Files: Tag: branch-exml2sax CompositeDataSet.java Log Message: Fixed comments modified during Producers' classes renaming. Index: CompositeDataSet.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/CompositeDataSet.java,v retrieving revision 1.12.2.1 retrieving revision 1.12.2.2 diff -C2 -d -r1.12.2.1 -r1.12.2.2 *** CompositeDataSet.java 30 Apr 2003 00:27:45 -0000 1.12.2.1 --- CompositeDataSet.java 17 May 2003 14:27:17 -0000 1.12.2.2 *************** *** 128,132 **** List tableList = new ArrayList(); ! // produce each table for (int j = 0; j < tables.length; j++) { --- 128,132 ---- List tableList = new ArrayList(); ! // process each table for (int j = 0; j < tables.length; j++) { |
From: <mla...@us...> - 2003-05-01 16:35:21
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv11025/src/test/org/dbunit/dataset Modified Files: Tag: branch-exml2sax MockDataSetConsumer.java Log Message: Fixed classes headers. Index: MockDataSetConsumer.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/Attic/MockDataSetConsumer.java,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -d -r1.1.2.4 -r1.1.2.5 *** MockDataSetConsumer.java 30 Apr 2003 21:12:51 -0000 1.1.2.4 --- MockDataSetConsumer.java 1 May 2003 16:35:17 -0000 1.1.2.5 *************** *** 1,4 **** --- 1,24 ---- package org.dbunit.dataset; + /* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002, Manuel Laflamme + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ import com.mockobjects.ExpectationList; import com.mockobjects.Verifiable; *************** *** 7,14 **** /** ! * ! * <p> Copyright (c) 2002 OZ.COM. All Rights Reserved. </p> ! * @author manuel.laflamme$ ! * @since Apr 29, 2003$ */ public class MockDataSetConsumer implements Verifiable, IDataSetConsumer --- 27,33 ---- /** ! * @author Manuel Laflamme ! * @since Apr 29, 2003 ! * @version $Revision$ */ public class MockDataSetConsumer implements Verifiable, IDataSetConsumer |
From: <mla...@us...> - 2003-05-01 16:35:21
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/xml In directory sc8-pr-cvs1:/tmp/cvs-serv11025/src/test/org/dbunit/dataset/xml Modified Files: Tag: branch-exml2sax FlatXmlProducerTest.java Log Message: Fixed classes headers. Index: FlatXmlProducerTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/xml/Attic/FlatXmlProducerTest.java,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** FlatXmlProducerTest.java 1 May 2003 12:09:13 -0000 1.1.2.3 --- FlatXmlProducerTest.java 1 May 2003 16:35:17 -0000 1.1.2.4 *************** *** 1,2 **** --- 1,22 ---- + /* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002, Manuel Laflamme + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ package org.dbunit.dataset.xml; *************** *** 19,26 **** /** ! * ! * <p> Copyright (c) 2002 OZ.COM. All Rights Reserved. </p> ! * @author manuel.laflamme$ ! * @since Apr 28, 2003$ * @version $Revision$ */ --- 39,44 ---- /** ! * @author Manuel Laflamme ! * @since Apr 28, 2003 * @version $Revision$ */ |
From: <mla...@us...> - 2003-05-01 16:35:20
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv11025/src/java/org/dbunit/dataset Modified Files: Tag: branch-exml2sax CachedTable.java Log Message: Fixed classes headers. Index: CachedTable.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/CachedTable.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** CachedTable.java 23 Apr 2003 02:30:33 -0000 1.1.2.1 --- CachedTable.java 1 May 2003 16:35:16 -0000 1.1.2.2 *************** *** 1,2 **** --- 1,22 ---- + /* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002, Manuel Laflamme + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ package org.dbunit.dataset; *************** *** 5,12 **** /** ! * ! * <p> Copyright (c) 2002 OZ.COM. All Rights Reserved. </p> ! * @author manuel.laflamme$ ! * @since Apr 10, 2003$ */ public class CachedTable extends DefaultTable --- 25,31 ---- /** ! * @author Manuel Laflamme ! * @since Apr 10, 2003 ! * @version $Revision$ */ public class CachedTable extends DefaultTable |
From: <mla...@us...> - 2003-05-01 12:53:36
|
Update of /cvsroot/dbunit/dbunit In directory sc8-pr-cvs1:/tmp/cvs-serv2216 Modified Files: Tag: branch-exml2sax build.xml Log Message: Added validation support to XmlProducer class: * Moved "dataset.dtd" file into "org.dbunit.dataset.xml" package. The XmlProducer class now load it from there as a system resource. * Modified build.xml to include resource files in JAR. The "dataset.dtd" file is also copied to the root distribution directory. This way DbUnit users can use the file without having to dig in the JAR file. Index: build.xml =================================================================== RCS file: /cvsroot/dbunit/dbunit/build.xml,v retrieving revision 1.7 retrieving revision 1.7.6.1 diff -C2 -d -r1.7 -r1.7.6.1 *** build.xml 24 Feb 2003 01:43:39 -0000 1.7 --- build.xml 1 May 2003 12:53:03 -0000 1.7.6.1 *************** *** 35,43 **** --- 35,56 ---- <mkdir dir="${build.dir}"/> </target> + <target name="clean" depends="init"> <delete dir="${build.dir}"/> </target> + <target name="compile" depends="init"> + <mkdir dir="${java.classes.dir}"/> + + <!-- Copy resource files --> + <copy todir="${java.classes.dir}" includeEmptyDirs="no"> + <fileset dir="${java.src.dir}"> + <!-- <include name="**/*.xml"/> --> + <exclude name="**/*.java"/> + </fileset> + </copy> + + <!-- Compile src --> <javac srcdir="${java.src.dir}" destdir="${java.classes.dir}" debug="${debug}" > <classpath> *************** *** 104,107 **** --- 117,126 ---- </copy> + <!-- Copy XML dataset DTD from src to root dist dir --> + <copy tofile="${dist.dir}/dataset.dtd" includeEmptyDirs="no"> + <fileset dir="${src.dir}"> + <include name="**/dataset.dtd"/> + </fileset> + </copy> <!-- Copy html doc --> |
From: <mla...@us...> - 2003-05-01 12:53:09
|
Update of /cvsroot/dbunit/dbunit/src/dtd In directory sc8-pr-cvs1:/tmp/cvs-serv2216/src/dtd Removed Files: Tag: branch-exml2sax dataset.dtd Log Message: Added validation support to XmlProducer class: * Moved "dataset.dtd" file into "org.dbunit.dataset.xml" package. The XmlProducer class now load it from there as a system resource. * Modified build.xml to include resource files in JAR. The "dataset.dtd" file is also copied to the root distribution directory. This way DbUnit users can use the file without having to dig in the JAR file. --- dataset.dtd DELETED --- |
From: <mla...@us...> - 2003-05-01 12:53:08
|
Update of /cvsroot/dbunit/dbunit/src/xml In directory sc8-pr-cvs1:/tmp/cvs-serv2216/src/xml Modified Files: Tag: branch-exml2sax xmlProducerTest.xml Log Message: Added validation support to XmlProducer class: * Moved "dataset.dtd" file into "org.dbunit.dataset.xml" package. The XmlProducer class now load it from there as a system resource. * Modified build.xml to include resource files in JAR. The "dataset.dtd" file is also copied to the root distribution directory. This way DbUnit users can use the file without having to dig in the JAR file. Index: xmlProducerTest.xml =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/xml/Attic/xmlProducerTest.xml,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** xmlProducerTest.xml 1 May 2003 03:14:54 -0000 1.1.2.1 --- xmlProducerTest.xml 1 May 2003 12:53:04 -0000 1.1.2.2 *************** *** 1,3 **** --- 1,4 ---- <?xml version='1.0' encoding='UTF-8'?> + <!DOCTYPE dataset SYSTEM "dataset.dtd" > <dataset> <table name='DUPLICATE_TABLE'> |
From: <mla...@us...> - 2003-05-01 12:53:08
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/xml In directory sc8-pr-cvs1:/tmp/cvs-serv2216/src/test/org/dbunit/dataset/xml Modified Files: Tag: branch-exml2sax XmlProducerTest.java Log Message: Added validation support to XmlProducer class: * Moved "dataset.dtd" file into "org.dbunit.dataset.xml" package. The XmlProducer class now load it from there as a system resource. * Modified build.xml to include resource files in JAR. The "dataset.dtd" file is also copied to the root distribution directory. This way DbUnit users can use the file without having to dig in the JAR file. Index: XmlProducerTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/xml/Attic/XmlProducerTest.java,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** XmlProducerTest.java 1 May 2003 12:09:14 -0000 1.1.2.2 --- XmlProducerTest.java 1 May 2003 12:53:04 -0000 1.1.2.3 *************** *** 53,57 **** InputSource source = new InputSource(uri); ! return new XmlProducer(source); } --- 53,59 ---- InputSource source = new InputSource(uri); ! XmlProducer producer = new XmlProducer(source); ! producer.setValidating(true); ! return producer; } *************** *** 178,181 **** --- 180,212 ---- InputSource source = new InputSource(new StringReader(content)); IDataSetProducer producer = new XmlProducer(source); + producer.setConsumer(consumer); + + // Produce and verify consumer + try + { + producer.produce(); + fail("Should not be here!"); + } + catch (DataSetException e) + { + } + + consumer.verify(); + } + + public void testProduceInvalidXml() throws Exception + { + // Setup consumer + MockDataSetConsumer consumer = new MockDataSetConsumer(); + + // Setup producer + String content = + "<?xml version=\"1.0\"?>" + + "<!DOCTYPE dataset SYSTEM \"dataset.dtd\" >" + + "<invalid/>"; + InputSource source = new InputSource(new StringReader(content)); + source.setSystemId("http:/nowhere.to.go"); + XmlProducer producer = new XmlProducer(source); + producer.setValidating(true); producer.setConsumer(consumer); |
From: <mla...@us...> - 2003-05-01 12:53:08
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml In directory sc8-pr-cvs1:/tmp/cvs-serv2216/src/java/org/dbunit/dataset/xml Modified Files: Tag: branch-exml2sax XmlProducer.java Added Files: Tag: branch-exml2sax dataset.dtd Log Message: Added validation support to XmlProducer class: * Moved "dataset.dtd" file into "org.dbunit.dataset.xml" package. The XmlProducer class now load it from there as a system resource. * Modified build.xml to include resource files in JAR. The "dataset.dtd" file is also copied to the root distribution directory. This way DbUnit users can use the file without having to dig in the JAR file. --- NEW FILE: dataset.dtd --- <?xml version='1.0' encoding='UTF-8' ?> <!ELEMENT dataset (table+)> <!ELEMENT table (column* , row*)> <!ATTLIST table name CDATA #REQUIRED > <!ELEMENT column (#PCDATA)> <!ELEMENT row (value | null)*> <!ELEMENT value (#PCDATA)> <!ELEMENT null EMPTY> Index: XmlProducer.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/Attic/XmlProducer.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** XmlProducer.java 1 May 2003 03:14:53 -0000 1.1.2.1 --- XmlProducer.java 1 May 2003 12:53:03 -0000 1.1.2.2 *************** *** 32,44 **** import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.DefaultHandler; import javax.xml.parsers.ParserConfigurationException; - import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import java.io.IOException; import java.util.LinkedList; import java.util.List; --- 32,46 ---- import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; + import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; + import org.xml.sax.SAXParseException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.DefaultHandler; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParserFactory; import java.io.IOException; + import java.io.InputStream; import java.util.LinkedList; import java.util.List; *************** *** 50,54 **** */ public class XmlProducer extends DefaultHandler ! implements IDataSetProducer, ContentHandler { private static final IDataSetConsumer EMPTY_CONSUMER = new DefaultConsumer(); --- 52,56 ---- */ public class XmlProducer extends DefaultHandler ! implements IDataSetProducer, ContentHandler, ErrorHandler { private static final IDataSetConsumer EMPTY_CONSUMER = new DefaultConsumer(); *************** *** 63,67 **** private final InputSource _inputSource; ! private XMLReader _xmlReader; private IDataSetConsumer _consumer = EMPTY_CONSUMER; --- 65,69 ---- private final InputSource _inputSource; ! private boolean _validating = false; private IDataSetConsumer _consumer = EMPTY_CONSUMER; *************** *** 89,92 **** --- 91,99 ---- } + public void setValidating(boolean validating) + { + _validating = validating; + } + //////////////////////////////////////////////////////////////////////////// // IDataSetProducer interface *************** *** 101,113 **** try { ! if (_xmlReader == null) ! { ! SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser(); ! _xmlReader = saxParser.getXMLReader(); ! } ! _xmlReader.setContentHandler(this); ! _xmlReader.setEntityResolver(this); ! _xmlReader.parse(_inputSource); } catch (ParserConfigurationException e) --- 108,119 ---- try { ! SAXParserFactory saxParserFactory = SAXParserFactory.newInstance(); ! saxParserFactory.setValidating(_validating); ! XMLReader xmlReader = saxParserFactory.newSAXParser().getXMLReader(); ! xmlReader.setContentHandler(this); ! xmlReader.setEntityResolver(this); ! xmlReader.setErrorHandler(this); ! xmlReader.parse(_inputSource); } catch (ParserConfigurationException e) *************** *** 132,137 **** throws SAXException { ! // TODO - returns dataset.dtd contents... ! return null; } --- 138,144 ---- throws SAXException { ! InputStream in = getClass().getClassLoader().getResourceAsStream( ! "org/dbunit/dataset/xml/dataset.dtd"); ! return (new InputSource(in)); } *************** *** 266,270 **** throws SAXException { - // TODO - remove when EntityResolver is implemented... if (_activeCharacters != null) { --- 273,276 ---- *************** *** 272,274 **** --- 278,303 ---- } } + + //////////////////////////////////////////////////////////////////////////// + // ErrorHandler interface + + // public void warning(SAXParseException e) + // throws SAXException + // { + // throw e; + // } + + public void error(SAXParseException e) + throws SAXException + { + throw e; + } + + // public void fatalError(SAXParseException e) + // throws SAXException + // { + // throw e; + // } + + } |
From: <mla...@us...> - 2003-05-01 12:09:17
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/xml In directory sc8-pr-cvs1:/tmp/cvs-serv8734/src/test/org/dbunit/dataset/xml Modified Files: Tag: branch-exml2sax FlatXmlProducerTest.java XmlProducerTest.java Log Message: Added more XML producer tests. Index: FlatXmlProducerTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/xml/Attic/FlatXmlProducerTest.java,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** FlatXmlProducerTest.java 30 Apr 2003 21:12:54 -0000 1.1.2.2 --- FlatXmlProducerTest.java 1 May 2003 12:09:13 -0000 1.1.2.3 *************** *** 7,10 **** --- 7,11 ---- import org.dbunit.dataset.DefaultDataSet; import org.dbunit.dataset.DefaultTable; + import org.dbunit.dataset.DataSetException; import org.xml.sax.InputSource; *************** *** 180,183 **** --- 181,211 ---- // Produce and verify consumer producer.produce(); + consumer.verify(); + } + + public void testProduceNotWellFormedXml() throws Exception + { + // Setup consumer + MockDataSetConsumer consumer = new MockDataSetConsumer(); + consumer.addExpectedStartDataSet(); + + // Setup producer + String content = + "<?xml version=\"1.0\"?>" + + "<dataset>"; + InputSource source = new InputSource(new StringReader(content)); + IDataSetProducer producer = new FlatXmlProducer(source); + producer.setConsumer(consumer); + + // Produce and verify consumer + try + { + producer.produce(); + fail("Should not be here!"); + } + catch (DataSetException e) + { + } + consumer.verify(); } Index: XmlProducerTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/xml/Attic/XmlProducerTest.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** XmlProducerTest.java 1 May 2003 03:14:53 -0000 1.1.2.1 --- XmlProducerTest.java 1 May 2003 12:09:14 -0000 1.1.2.2 *************** *** 22,31 **** import org.dbunit.dataset.AbstractProducerTest; - import org.dbunit.dataset.IDataSetProducer; import org.dbunit.dataset.Column; import org.xml.sax.InputSource; import java.io.File; /** --- 22,35 ---- import org.dbunit.dataset.AbstractProducerTest; import org.dbunit.dataset.Column; + import org.dbunit.dataset.DataSetException; + import org.dbunit.dataset.IDataSetProducer; + import org.dbunit.dataset.MockDataSetConsumer; + import org.dbunit.dataset.datatype.DataType; import org.xml.sax.InputSource; import java.io.File; + import java.io.StringReader; /** *************** *** 56,58 **** --- 60,195 ---- return super.createExpectedColumns(Column.NULLABLE_UNKNOWN); } + + public void testProduceEmptyDataSet() throws Exception + { + // Setup consumer + MockDataSetConsumer consumer = new MockDataSetConsumer(); + consumer.addExpectedStartDataSet(); + consumer.addExpectedEndDataSet(); + + // Setup producer + String content = + "<?xml version=\"1.0\"?>" + + "<dataset/>"; + InputSource source = new InputSource(new StringReader(content)); + IDataSetProducer producer = new XmlProducer(source); + producer.setConsumer(consumer); + + // Produce and verify consumer + producer.produce(); + consumer.verify(); + } + + public void testProduceNullValue() throws Exception + { + String tableName = "TEST_TABLE"; + Column[] expectedColumns = new Column[]{ + new Column("c1", DataType.UNKNOWN), + new Column("c2", DataType.UNKNOWN), + new Column("c3", DataType.UNKNOWN), + }; + Object[] expectedValues = new Object[]{null, "", "value"}; + + // Setup consumer + MockDataSetConsumer consumer = new MockDataSetConsumer(); + consumer.addExpectedStartDataSet(); + consumer.addExpectedStartTable(tableName, expectedColumns); + consumer.addExpectedRow(tableName, expectedValues); + consumer.addExpectedEndTable(tableName); + consumer.addExpectedEndDataSet(); + + // Setup producer + String content = + "<?xml version=\"1.0\"?>" + + "<dataset>" + + " <table name='TEST_TABLE'>" + + " <column>c1</column>" + + " <column>c2</column>" + + " <column>c3</column>" + + " <row>" + + " <null/>" + + " <value></value>" + + " <value>value</value>" + + " </row>" + + " </table>" + + "</dataset>"; + InputSource source = new InputSource(new StringReader(content)); + IDataSetProducer producer = new XmlProducer(source); + producer.setConsumer(consumer); + + // Produce and verify consumer + producer.produce(); + consumer.verify(); + } + + public void testProduceMissingColumn() throws Exception + { + String tableName = "TEST_TABLE"; + Column[] expectedColumns = new Column[]{ + new Column("c1", DataType.UNKNOWN), + new Column("c2", DataType.UNKNOWN), + new Column("c3", DataType.UNKNOWN), + }; + Object[] expectedValues = new Object[]{null, "", "value", "extra"}; + + // Setup consumer + MockDataSetConsumer consumer = new MockDataSetConsumer(); + consumer.addExpectedStartDataSet(); + consumer.addExpectedStartTable(tableName, expectedColumns); + consumer.addExpectedRow(tableName, expectedValues); + consumer.addExpectedEndTable(tableName); + consumer.addExpectedEndDataSet(); + + // Setup producer + String content = + "<?xml version=\"1.0\"?>" + + "<dataset>" + + " <table name='TEST_TABLE'>" + + " <column>c1</column>" + + " <column>c2</column>" + + " <column>c3</column>" + + " <row>" + + " <null/>" + + " <value></value>" + + " <value>value</value>" + + " <value>extra</value>" + + " </row>" + + " </table>" + + "</dataset>"; + InputSource source = new InputSource(new StringReader(content)); + IDataSetProducer producer = new XmlProducer(source); + producer.setConsumer(consumer); + + // Produce and verify consumer + producer.produce(); + consumer.verify(); + } + + public void testProduceNotWellFormedXml() throws Exception + { + // Setup consumer + MockDataSetConsumer consumer = new MockDataSetConsumer(); + consumer.addExpectedStartDataSet(); + + // Setup producer + String content = + "<?xml version=\"1.0\"?>" + + "<dataset>"; + InputSource source = new InputSource(new StringReader(content)); + IDataSetProducer producer = new XmlProducer(source); + producer.setConsumer(consumer); + + // Produce and verify consumer + try + { + producer.produce(); + fail("Should not be here!"); + } + catch (DataSetException e) + { + } + + consumer.verify(); + } + } |
From: <mla...@us...> - 2003-05-01 03:14:56
|
Update of /cvsroot/dbunit/dbunit/src/xml In directory sc8-pr-cvs1:/tmp/cvs-serv23664/src/xml Added Files: Tag: branch-exml2sax xmlProducerTest.xml Log Message: Added new XML producer. --- NEW FILE: xmlProducerTest.xml --- <?xml version='1.0' encoding='UTF-8'?> <dataset> <table name='DUPLICATE_TABLE'> <column>COLUMN0</column> <column>COLUMN1</column> <column>COLUMN2</column> <column>COLUMN3</column> <row> <value>row 0 col 0</value> <value>row 0 col 1</value> <value>row 0 col 2</value> <value>row 0 col 3</value> </row> </table> <table name='SECOND_TABLE'> <column>COLUMN0</column> <column>COLUMN1</column> <column>COLUMN2</column> <column>COLUMN3</column> <row> <value>row 0 col 0</value> <value>row 0 col 1</value> <value>row 0 col 2</value> <value>row 0 col 3</value> </row> <row> <value>row 1 col 0</value> <value>row 1 col 1</value> <value>row 1 col 2</value> <value>row 1 col 3</value> </row> </table> <table name='TEST_TABLE'> <column>COLUMN0</column> <column>COLUMN1</column> <column>COLUMN2</column> <column>COLUMN3</column> <row> <value>row 0 col 0</value> <value>row 0 col 1</value> <value>row 0 col 2</value> <value>row 0 col 3</value> </row> <row> <value>row 1 col 0</value> <value>row 1 col 1</value> <value>row 1 col 2</value> <value>row 1 col 3</value> </row> <row> <value>row 2 col 0</value> <value>row 2 col 1</value> <value>row 2 col 2</value> <value>row 2 col 3</value> </row> </table> <table name='DUPLICATE_TABLE'> <column>COLUMN0</column> <column>COLUMN1</column> <column>COLUMN2</column> <column>COLUMN3</column> <row> <value>row 0 col 0</value> <value>row 0 col 1</value> <value>row 0 col 2</value> <value>row 0 col 3</value> </row> <row> <value>row 1 col 0</value> <value>row 1 col 1</value> <value>row 1 col 2</value> <value>row 1 col 3</value> </row> </table> <table name='NOT_NULL_TABLE'> <column>COLUMN0</column> <column>COLUMN1</column> <column>COLUMN2</column> <column>COLUMN3</column> <row> <value>row 0 col 0</value> <value>row 0 col 1</value> <value>row 0 col 2</value> <value>row 0 col 3</value> </row> </table> <table name='EMPTY_TABLE'> <column>COLUMN0</column> <column>COLUMN1</column> <column>COLUMN2</column> <column>COLUMN3</column> </table> </dataset> |