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-04-02 02:06:45
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit In directory sc8-pr-cvs1:/tmp/cvs-serv17035/dbunit/src/java/org/dbunit Modified Files: Assertion.java Log Message: Now assertEquals(ITable, ITable) performs value comparison using corresponding column datatype instead of string representation. Index: Assertion.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/Assertion.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Assertion.java 15 Feb 2003 05:42:42 -0000 1.7 --- Assertion.java 2 Apr 2003 02:06:42 -0000 1.8 *************** *** 25,31 **** --- 25,34 ---- import org.dbunit.dataset.*; import org.dbunit.dataset.datatype.DataType; + import org.dbunit.dataset.datatype.DataTypeException; + import org.dbunit.dataset.datatype.UnknownDataType; import java.util.Arrays; import java.util.Comparator; + import java.util.ArrayList; import junit.framework.Assert; *************** *** 37,40 **** --- 40,45 ---- public class Assertion { + private static final ColumnComparator COLUMN_COMPARATOR = new ColumnComparator(); + private Assertion() { *************** *** 91,95 **** throws Exception { ! // do not continue if same instance if (expectedTable == actualTable) { --- 96,100 ---- throws Exception { ! // Do not continue if same instance if (expectedTable == actualTable) { *************** *** 105,129 **** // actualMetaData.getTableName()); ! // column count ! String[] expectedNames = getSortedUpperColumnNames(expectedMetaData); ! String[] actualNames = getSortedUpperColumnNames(actualMetaData); Assert.assertEquals("column count (table=" + expectedTableName + ")", ! expectedNames.length, actualNames.length); ! // columns names in no specific order ! for (int i = 0; i < expectedNames.length; i++) { ! String expectedName = expectedNames[i]; ! String actualName = actualNames[i]; ! if (!expectedName.equals(actualName)) { ! Assert.fail("expected columns " + Arrays.asList(expectedNames) + ! " but was " + Arrays.asList(actualNames) + " (table=" + ! expectedTableName + ")"); } - } ! // row count Assert.assertEquals("row count (table=" + expectedTableName + ")", expectedTable.getRowCount(), actualTable.getRowCount()); --- 110,132 ---- // actualMetaData.getTableName()); ! // Verify columns ! Column[] expectedColumns = getSortedColumns(expectedMetaData); ! Column[] actualColumns = getSortedColumns(actualMetaData); Assert.assertEquals("column count (table=" + expectedTableName + ")", ! expectedColumns.length, actualColumns.length); ! for (int i = 0; i < expectedColumns.length; i++) { ! String expectedName = expectedColumns[i].getColumnName(); ! String actualName = actualColumns[i].getColumnName(); ! if (!expectedName.equalsIgnoreCase(actualName)) { ! Assert.fail("expected columns " + getColumnNamesAsString(expectedColumns) + ! " but was " + getColumnNamesAsString(actualColumns) + ! " (table=" + expectedTableName + ")"); } } ! // Verify row count Assert.assertEquals("row count (table=" + expectedTableName + ")", expectedTable.getRowCount(), actualTable.getRowCount()); *************** *** 132,161 **** for (int i = 0; i < expectedTable.getRowCount(); i++) { ! for (int j = 0; j < expectedNames.length; j++) { ! String columnName = expectedNames[j]; Object expectedValue = expectedTable.getValue(i, columnName); Object actualValue = actualTable.getValue(i, columnName); - Assert.assertEquals("value (table=" + expectedTableName + - ", row=" + i + ", col=" + columnName + ")", - DataType.asString(expectedValue), - DataType.asString(actualValue)); } } } ! private static String[] getSortedUpperColumnNames(ITableMetaData metaData) throws DataSetException { Column[] columns = metaData.getColumns(); String[] names = new String[columns.length]; for (int i = 0; i < columns.length; i++) { ! names[i] = columns[i].getColumnName().toUpperCase(); } ! Arrays.sort(names); ! return names; } --- 135,214 ---- for (int i = 0; i < expectedTable.getRowCount(); i++) { ! for (int j = 0; j < expectedColumns.length; j++) { ! Column expectedColumn = expectedColumns[j]; ! Column actualColumn = actualColumns[j]; + String columnName = expectedColumn.getColumnName(); Object expectedValue = expectedTable.getValue(i, columnName); Object actualValue = actualTable.getValue(i, columnName); + DataType dataType = getComparisonDataType( + expectedTableName, expectedColumn, actualColumn); + if (dataType.compare(expectedValue, actualValue) != 0) + { + Assert.fail("value (table=" + expectedTableName + ", " + + "row=" + i + ", col=" + columnName + "): expected:<" + + expectedValue + "> but was:<" + actualValue + ">"); + } } } } ! static DataType getComparisonDataType(String tableName, Column expectedColumn, ! Column actualColumn) ! { ! 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; ! } ! ! // Impossible to determine which data type to use ! Assert.fail("Incompatible data types: " + expectedDataType + ", " + ! actualDataType + " (table=" + tableName + ", col=" + ! expectedColumn.getColumnName() + ")"); ! } ! // // Both columns have unknown data type, use string comparison ! // else if (expectedDataType instanceof UnknownDataType) ! // { ! // return DataType.LONGVARCHAR; ! // } ! ! // Both columns have same data type, return any one of them ! return expectedDataType; ! } ! ! private static Column[] getSortedColumns(ITableMetaData metaData) throws DataSetException { Column[] columns = metaData.getColumns(); + Column[] sortColumns = new Column[columns.length]; + System.arraycopy(columns, 0, sortColumns, 0, columns.length); + Arrays.sort(sortColumns, COLUMN_COMPARATOR); + return sortColumns; + } + + private static String getColumnNamesAsString(Column[] columns) + { String[] names = new String[columns.length]; for (int i = 0; i < columns.length; i++) { ! Column column = columns[i]; ! names[i] = column.getColumnName(); } ! return Arrays.asList(names).toString(); } *************** *** 172,175 **** --- 225,243 ---- } + //////////////////////////////////////////////////////////////////////////// + // ColumnComparator class + + private static class ColumnComparator implements Comparator + { + public int compare(Object o1, Object o2) + { + Column column1 = (Column)o1; + Column column2 = (Column)o2; + + String columnName1 = column1.getColumnName(); + String columnName2 = column2.getColumnName(); + return columnName1.compareToIgnoreCase(columnName2); + } + } } |
From: <mla...@us...> - 2003-04-02 02:06:45
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit In directory sc8-pr-cvs1:/tmp/cvs-serv17035/dbunit/src/test/org/dbunit Modified Files: AssertionTest.java Log Message: Now assertEquals(ITable, ITable) performs value comparison using corresponding column datatype instead of string representation. Index: AssertionTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/AssertionTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AssertionTest.java 15 Feb 2003 05:42:43 -0000 1.8 --- AssertionTest.java 2 Apr 2003 02:06:41 -0000 1.9 *************** *** 24,35 **** import org.dbunit.dataset.*; import org.dbunit.dataset.xml.FlatXmlDataSet; - import java.io.FileInputStream; - import java.io.FileReader; - import junit.framework.AssertionFailedError; import junit.framework.TestCase; /** * @author Manuel Laflamme --- 24,38 ---- import org.dbunit.dataset.*; + import org.dbunit.dataset.datatype.DataType; import org.dbunit.dataset.xml.FlatXmlDataSet; import junit.framework.AssertionFailedError; import junit.framework.TestCase; + import java.io.FileReader; + import java.math.BigDecimal; + import java.util.List; + import java.util.ArrayList; + /** * @author Manuel Laflamme *************** *** 139,142 **** --- 142,228 ---- { } + } + + public void testAssertTablesEqualsAndIncompatibleDataType() throws Exception + { + String tableName = "TABLE_NAME"; + + // Setup actual table + Column[] actualColumns = new Column[] { + new Column("BOOLEAN", DataType.BOOLEAN), + }; + Object[] actualRow = new Object[] { + Boolean.TRUE, + }; + List actualRowList = new ArrayList(); + actualRowList.add(actualRow); + ITable actualTable = new DefaultTable(tableName, + actualColumns, actualRowList); + + // Setup expected table + Column[] expectedColumns = new Column[] { + new Column("BOOLEAN", DataType.VARCHAR), + }; + Object[] expectedRow = new Object[] { + "1", + }; + List expectedRowList = new ArrayList(); + expectedRowList.add(expectedRow); + ITable expectedTable = new DefaultTable(tableName, + expectedColumns, expectedRowList); + + try + { + Assertion.assertEquals(expectedTable, actualTable); + } + catch (AssertionFailedError e) + { + + } + } + + public void testAssertTablesEqualsAndCompatibleDataType() throws Exception + { + String tableName = "TABLE_NAME"; + java.sql.Timestamp now = new java.sql.Timestamp( + System.currentTimeMillis()); + + // Setup actual table + Column[] actualColumns = new Column[] { + new Column("BOOLEAN", DataType.BOOLEAN), + new Column("TIMESTAMP", DataType.TIMESTAMP), + new Column("STRING", DataType.CHAR), + new Column("NUMERIC", DataType.NUMERIC), + }; + Object[] actualRow = new Object[] { + Boolean.TRUE, + now, + "0", + new BigDecimal("123.4"), + }; + List actualRowList = new ArrayList(); + actualRowList.add(actualRow); + ITable actualTable = new DefaultTable(tableName, + actualColumns, actualRowList); + + // Setup expected table + Column[] expectedColumns = new Column[] { + new Column("BOOLEAN", DataType.UNKNOWN), + new Column("TIMESTAMP", DataType.UNKNOWN), + new Column("STRING", DataType.UNKNOWN), + new Column("NUMERIC", DataType.UNKNOWN), + }; + Object[] expectedRow = new Object[] { + "1", + new Long(now.getTime()), + new Integer("0"), + "123.4000", + }; + List expectedRowList = new ArrayList(); + expectedRowList.add(expectedRow); + ITable expectedTable = new DefaultTable(tableName, + expectedColumns, expectedRowList); + + Assertion.assertEquals(expectedTable, actualTable); } |
From: <mla...@us...> - 2003-04-01 21:16:36
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/operation In directory sc8-pr-cvs1:/tmp/cvs-serv646/src/test/org/dbunit/operation Modified Files: DeleteOperationTest.java Log Message: Modified test to ensure that tables are deleted in reverse order. Index: DeleteOperationTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/operation/DeleteOperationTest.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** DeleteOperationTest.java 15 Feb 2003 05:42:42 -0000 1.14 --- DeleteOperationTest.java 1 Apr 2003 21:16:31 -0000 1.15 *************** *** 49,61 **** { String schemaName = "schema"; ! String tableName = "table"; String[] expected = { ! "delete from schema.table where c2 = 123.45 and c1 = 'qwerty'", ! "delete from schema.table where c2 = 1234 and c1 = 'toto'", }; List valueList = new ArrayList(); - valueList.add(new Object[]{"toto", "1234", Boolean.FALSE}); valueList.add(new Object[]{"qwerty", new Double("123.45"), "true"}); Column[] columns = new Column[]{ new Column("c1", DataType.VARCHAR), --- 49,64 ---- { String schemaName = "schema"; ! String tableName1 = "table1"; ! String tableName2 = "table2"; String[] expected = { ! "delete from schema.table2 where c2 = 1234 and c1 = 'toto'", ! "delete from schema.table2 where c2 = 123.45 and c1 = 'qwerty'", ! "delete from schema.table1 where c2 = 1234 and c1 = 'toto'", ! "delete from schema.table1 where c2 = 123.45 and c1 = 'qwerty'", }; List valueList = new ArrayList(); valueList.add(new Object[]{"qwerty", new Double("123.45"), "true"}); + valueList.add(new Object[]{"toto", "1234", Boolean.FALSE}); Column[] columns = new Column[]{ new Column("c1", DataType.VARCHAR), *************** *** 65,81 **** String[] primaryKeys = {"c2", "c1"}; ! ITable table = new DefaultTable(new DefaultTableMetaData( ! tableName, columns, primaryKeys), valueList); ! IDataSet dataSet = new DefaultDataSet(table); // setup mock objects MockBatchStatement statement = new MockBatchStatement(); statement.addExpectedBatchStrings(expected); ! statement.setExpectedExecuteBatchCalls(1); ! statement.setExpectedClearBatchCalls(1); ! statement.setExpectedCloseCalls(1); MockStatementFactory factory = new MockStatementFactory(); ! factory.setExpectedCreatePreparedStatementCalls(1); factory.setupStatement(statement); --- 68,86 ---- String[] primaryKeys = {"c2", "c1"}; ! ITable table1 = new DefaultTable(new DefaultTableMetaData( ! tableName1, columns, primaryKeys), valueList); ! ITable table2 = new DefaultTable(new DefaultTableMetaData( ! tableName2, columns, primaryKeys), valueList); ! IDataSet dataSet = new DefaultDataSet(table1, table2); // setup mock objects MockBatchStatement statement = new MockBatchStatement(); statement.addExpectedBatchStrings(expected); ! statement.setExpectedExecuteBatchCalls(2); ! statement.setExpectedClearBatchCalls(2); ! statement.setExpectedCloseCalls(2); MockStatementFactory factory = new MockStatementFactory(); ! factory.setExpectedCreatePreparedStatementCalls(2); factory.setupStatement(statement); |
From: <mla...@us...> - 2003-04-01 21:15:45
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv339/src/java/org/dbunit/dataset Modified Files: DefaultDataSet.java Log Message: Added new constructors. Index: DefaultDataSet.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/DefaultDataSet.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** DefaultDataSet.java 11 Mar 2003 12:56:21 -0000 1.9 --- DefaultDataSet.java 1 Apr 2003 21:15:37 -0000 1.10 *************** *** 36,39 **** --- 36,43 ---- private final List _tableList = new ArrayList(); + public DefaultDataSet() + { + } + public DefaultDataSet(ITable table) { *************** *** 47,50 **** --- 51,60 ---- addTable(tables[i]); } + } + + public DefaultDataSet(ITable table1, ITable table2) + { + addTable(table1); + addTable(table2); } |
From: <mla...@us...> - 2003-04-01 02:01:48
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/operation In directory sc8-pr-cvs1:/tmp/cvs-serv26909/dbunit/src/java/org/dbunit/operation Modified Files: AbstractBatchOperation.java DeleteOperation.java Log Message: Fixed bug in DELETE operation where table were not deleted in reverse order as expected. Index: AbstractBatchOperation.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/operation/AbstractBatchOperation.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** AbstractBatchOperation.java 3 Aug 2002 02:26:41 -0000 1.15 --- AbstractBatchOperation.java 1 Apr 2003 02:01:42 -0000 1.16 *************** *** 78,87 **** /** ! * Returns list of table names this operation is applied to. This method * allow subclass to do filtering. */ ! protected String[] getTableNames(IDataSet dataSet) throws DatabaseUnitException { ! return dataSet.getTableNames(); } --- 78,87 ---- /** ! * Returns list of tables this operation is applied to. This method * allow subclass to do filtering. */ ! protected ITable[] getTables(IDataSet dataSet) throws DatabaseUnitException { ! return dataSet.getTables(); } *************** *** 96,101 **** { IStatementFactory factory = connection.getStatementFactory(); ! ITable[] tables = dataSet.getTables(); ! // String[] tableNames = getTableNames(dataSet); // for each table --- 96,100 ---- { IStatementFactory factory = connection.getStatementFactory(); ! ITable[] tables = getTables(dataSet); // for each table Index: DeleteOperation.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/operation/DeleteOperation.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** DeleteOperation.java 4 Aug 2002 01:07:13 -0000 1.11 --- DeleteOperation.java 1 Apr 2003 02:01:43 -0000 1.12 *************** *** 44,50 **** // AbstractBatchOperation class ! protected String[] getTableNames(IDataSet dataSet) throws DatabaseUnitException { ! return DataSetUtils.getReverseTableNames(dataSet); } --- 44,56 ---- // AbstractBatchOperation class ! protected ITable[] getTables(IDataSet dataSet) throws DatabaseUnitException { ! ITable[] tables = dataSet.getTables(); ! ITable[] reverseTables = new ITable[tables.length]; ! for (int i = 0; i < tables.length; i++) ! { ! reverseTables[tables.length - 1 - i] = tables[i]; ! } ! return reverseTables; } |
From: <mla...@us...> - 2003-03-31 19:48:46
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/statement In directory sc8-pr-cvs1:/tmp/cvs-serv29980/src/java/org/dbunit/database/statement Modified Files: SimplePreparedStatement.java PreparedBatchStatement.java Log Message: Fixed bug 712329. This should also resolve the NullPointerException bug with the Oracle driver reported in the mailing list (need to be confirmed). http://sourceforge.net/mailarchive/forum.php?thread_id=1864019&forum_id=8154 Index: SimplePreparedStatement.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/statement/SimplePreparedStatement.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SimplePreparedStatement.java 27 Mar 2003 22:34:55 -0000 1.8 --- SimplePreparedStatement.java 31 Mar 2003 19:48:38 -0000 1.9 *************** *** 52,55 **** --- 52,63 ---- throws TypeCastException, SQLException { + // Special NULL handling + if (value == null) + { + _statement.setNull(++_index, dataType.getSqlType()); + return; + } + + // Special BLOB handling if (dataType == DataType.CLOB) { *************** *** 59,62 **** --- 67,71 ---- } + // Special CLOB handling if (dataType == DataType.BLOB) { Index: PreparedBatchStatement.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/statement/PreparedBatchStatement.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PreparedBatchStatement.java 13 Jun 2002 17:24:56 -0000 1.8 --- PreparedBatchStatement.java 31 Mar 2003 19:48:40 -0000 1.9 *************** *** 50,53 **** --- 50,61 ---- throws TypeCastException, SQLException { + // Special NULL handling + if (value == null) + { + _statement.setNull(++_index, dataType.getSqlType()); + return; + } + + // Special BLOB handling if (dataType == DataType.CLOB) { *************** *** 57,60 **** --- 65,69 ---- } + // Special CLOB handling if (dataType == DataType.BLOB) { |
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype In directory sc8-pr-cvs1:/tmp/cvs-serv29124/dbunit/src/java/org/dbunit/dataset/datatype Modified Files: AbstractDataType.java BooleanDataType.java BytesDataType.java DataType.java UnknownDataType.java Log Message: New DataType.compare(Object, Object) method. This method will be used in Assertion.assertEquals() to compare values according their data type instead of their string representation. Index: AbstractDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/AbstractDataType.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AbstractDataType.java 13 Jun 2002 17:24:56 -0000 1.5 --- AbstractDataType.java 31 Mar 2003 13:21:59 -0000 1.6 *************** *** 46,49 **** --- 46,79 ---- // DataType class + public int compare(Object o1, Object o2) throws TypeCastException + { + try + { + Comparable value1 = (Comparable)typeCast(o1); + Comparable value2 = (Comparable)typeCast(o2); + + if (value1 == null && value2 == null) + { + return 0; + } + + if (value1 == null && value2 != null) + { + return -1; + } + + if (value1 != null && value2 == null) + { + return 1; + } + + return value1.compareTo(value2); + } + catch (ClassCastException e) + { + throw new TypeCastException(e); + } + } + public int getSqlType() { Index: BooleanDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/BooleanDataType.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** BooleanDataType.java 13 Jun 2002 17:24:56 -0000 1.9 --- BooleanDataType.java 31 Mar 2003 13:21:59 -0000 1.10 *************** *** 75,78 **** --- 75,111 ---- throw new TypeCastException(value.toString()); } + + public int compare(Object o1, Object o2) throws TypeCastException + { + Boolean value1 = (Boolean)typeCast(o1); + Boolean value2 = (Boolean)typeCast(o2); + + if (value1 == null && value2 == null) + { + return 0; + } + + if (value1 == null && value2 != null) + { + return -1; + } + + if (value1 != null && value2 == null) + { + return 1; + } + + if (value1.equals(value2)) + { + return 0; + } + + if (value1.equals(Boolean.FALSE)) + { + return -1; + } + + return 1; + } } Index: BytesDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/BytesDataType.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** BytesDataType.java 13 Jun 2002 17:24:56 -0000 1.8 --- BytesDataType.java 31 Mar 2003 13:22:00 -0000 1.9 *************** *** 75,78 **** --- 75,146 ---- throw new TypeCastException(value.toString()); } + + public int compare(Object o1, Object o2) throws TypeCastException + { + try + { + byte[] value1 = (byte[])typeCast(o1); + byte[] value2 = (byte[])typeCast(o2); + + if (value1 == null && value2 == null) + { + return 0; + } + + if (value1 == null && value2 != null) + { + return -1; + } + + if (value1 != null && value2 == null) + { + return 1; + } + + return compare(value1, value2); + } + catch (ClassCastException e) + { + throw new TypeCastException(e); + } + } + + public int compare(byte[] v1, byte[] v2) throws TypeCastException + { + int len1 = v1.length; + int len2 = v2.length; + int n = Math.min(len1, len2); + int i = 0; + int j = 0; + + if (i == j) + { + int k = i; + int lim = n + i; + while (k < lim) + { + byte c1 = v1[k]; + byte c2 = v2[k]; + if (c1 != c2) + { + return c1 - c2; + } + k++; + } + } + else + { + while (n-- != 0) + { + byte c1 = v1[i++]; + byte c2 = v2[j++]; + if (c1 != c2) + { + return c1 - c2; + } + } + } + return len1 - len2; + } } Index: DataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/DataType.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** DataType.java 14 Feb 2003 05:12:29 -0000 1.16 --- DataType.java 31 Mar 2003 13:22:00 -0000 1.17 *************** *** 90,93 **** --- 90,104 ---- /** + * Returns a negative integer, zero, or a positive integer as the first + * argument is less than, equal to, or greater than the second. + * <p> + * The two values are typecast to this DataType before being compared. + * + * @throws TypeCastException if the arguments' types prevent them from + * being compared by this Comparator. + */ + public abstract int compare(Object o1, Object o2) throws TypeCastException; + + /** * Returns the coresponding {@link java.sql.Types}. */ Index: UnknownDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/UnknownDataType.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** UnknownDataType.java 14 Feb 2003 05:12:29 -0000 1.1 --- UnknownDataType.java 31 Mar 2003 13:22:00 -0000 1.2 *************** *** 42,45 **** --- 42,50 ---- return value; } + + public int compare(Object o1, Object o2) throws TypeCastException + { + return super.compare(asString(o1), asString(o2)); + } } |
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/datatype In directory sc8-pr-cvs1:/tmp/cvs-serv29124/dbunit/src/test/org/dbunit/dataset/datatype Modified Files: AbstractDataTypeTest.java BooleanDataTypeTest.java BytesDataTypeTest.java DateDataTypeTest.java DoubleDataTypeTest.java FloatDataTypeTest.java IntegerDataTypeTest.java NumberDataTypeTest.java LongDataTypeTest.java StringDataTypeTest.java TimeDataTypeTest.java TimestampDataTypeTest.java Log Message: New DataType.compare(Object, Object) method. This method will be used in Assertion.assertEquals() to compare values according their data type instead of their string representation. Index: AbstractDataTypeTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/datatype/AbstractDataTypeTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AbstractDataTypeTest.java 13 Jun 2002 17:25:00 -0000 1.7 --- AbstractDataTypeTest.java 31 Mar 2003 13:22:04 -0000 1.8 *************** *** 45,49 **** public abstract void testTypeCast() throws Exception; ! public abstract void testInvalidTypeCast() throws Exception; public abstract void testSqlType() throws Exception; --- 45,49 ---- public abstract void testTypeCast() throws Exception; ! public abstract void testTypeCastInvalid() throws Exception; public abstract void testSqlType() throws Exception; *************** *** 52,55 **** --- 52,74 ---- public abstract void testAsString() throws Exception; + + // public abstract void testCompareEquals() throws Exception + // public abstract void testCompareDifferent() throws Exception; + // public abstract void testCompareInvalid() throws Exception; + + public void testCompareEquals() throws Exception + { + throw new UnsupportedOperationException("Not implemented yet!"); + } + + public void testCompareDifferent() throws Exception + { + throw new UnsupportedOperationException("Not implemented yet!"); + } + + public void testCompareInvalid() throws Exception + { + throw new UnsupportedOperationException("Not implemented yet!"); + } } Index: BooleanDataTypeTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/datatype/BooleanDataTypeTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** BooleanDataTypeTest.java 13 Jun 2002 17:25:00 -0000 1.7 --- BooleanDataTypeTest.java 31 Mar 2003 13:22:04 -0000 1.8 *************** *** 101,105 **** } ! public void testInvalidTypeCast() throws Exception { Object[] values = {"bla"}; --- 101,105 ---- } ! public void testTypeCastInvalid() throws Exception { Object[] values = {"bla"}; *************** *** 115,118 **** --- 115,205 ---- { } + } + } + + public void testCompareEquals() throws Exception + { + Object[] values1 = { + null, + "1", + "0", + Boolean.TRUE, + Boolean.FALSE, + }; + Object[] values2 = { + null, + Boolean.TRUE, + Boolean.FALSE, + "true", + "false", + }; + + assertEquals("values count", values1.length, values2.length); + + for (int i = 0; i < values1.length; i++) + { + assertEquals("compare1 " + i, + 0, THIS_TYPE.compare(values1[i], values2[i])); + assertEquals("compare2 " + i, + 0, THIS_TYPE.compare(values2[i], values1[i])); + } + } + + public void testCompareInvalid() throws Exception + { + Object[] values1 = { + "bla", + Boolean.FALSE, + }; + Object[] values2 = { + Boolean.TRUE, + "bla", + }; + + assertEquals("values count", values1.length, values2.length); + + for (int i = 0; i < values1.length; i++) + { + try + { + THIS_TYPE.compare(values1[i], values2[i]); + fail("Should have throw TypeCastException"); + } + catch (TypeCastException e) + { + + } + + try + { + THIS_TYPE.compare(values2[i], values1[i]); + fail("Should have throw TypeCastException"); + } + catch (TypeCastException e) + { + + } + } + } + + public void testCompareDifferent() throws Exception + { + Object[] less = { + null, + null, + Boolean.FALSE, + }; + Object[] greater = { + Boolean.TRUE, + Boolean.FALSE, + Boolean.TRUE, + }; + + assertEquals("values count", less.length, greater.length); + + for (int i = 0; i < less.length; i++) + { + assertTrue("less " + i, THIS_TYPE.compare(less[i], greater[i]) < 0); + assertTrue("greater " + i, THIS_TYPE.compare(greater[i], less[i]) > 0); } } Index: BytesDataTypeTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/datatype/BytesDataTypeTest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** BytesDataTypeTest.java 13 Jun 2002 17:25:00 -0000 1.5 --- BytesDataTypeTest.java 31 Mar 2003 13:22:04 -0000 1.6 *************** *** 99,105 **** } ! public void testInvalidTypeCast() throws Exception { ! Object[] values = {new Object(), new Integer(1234)}; for (int i = 0; i < TYPES.length; i++) --- 99,108 ---- } ! public void testTypeCastInvalid() throws Exception { ! Object[] values = { ! new Object(), ! new Integer(1234) ! }; for (int i = 0; i < TYPES.length; i++) *************** *** 115,118 **** --- 118,212 ---- { } + } + } + } + + public void testCompareEquals() throws Exception + { + Object[] values1 = { + null, + "", + "YWJjZA==", + new byte[]{0, 1, 2, 3, 4, 5}, + }; + + byte[][] values2 = { + null, + new byte[0], + new byte[]{'a', 'b', 'c', 'd'}, + new byte[]{0, 1, 2, 3, 4, 5}, + }; + + assertEquals("values count", values1.length, values2.length); + + for (int i = 0; i < TYPES.length; i++) + { + for (int j = 0; j < values1.length; j++) + { + assertEquals("compare1 " + j, 0, TYPES[i].compare(values1[j], values2[j])); + assertEquals("compare2 " + j, 0, TYPES[i].compare(values2[j], values1[j])); + } + } + } + + public void testCompareInvalid() throws Exception + { + Object[] values1 = { + new Object(), + new java.util.Date() + }; + Object[] values2 = { + null, + null + }; + + assertEquals("values count", values1.length, values2.length); + + for (int i = 0; i < TYPES.length; i++) + { + for (int j = 0; j < values1.length; j++) + { + try + { + TYPES[i].compare(values1[j], values2[j]); + fail("Should throw TypeCastException"); + } + catch (TypeCastException e) + { + } + + try + { + TYPES[i].compare(values2[j], values1[j]); + fail("Should throw TypeCastException"); + } + catch (TypeCastException e) + { + } + } + } + } + + public void testCompareDifferent() throws Exception + { + Object[] less = { + null, + new byte[]{'a', 'a', 'c', 'd'}, + new byte[]{0, 1, 2, 3, 4, 5}, + }; + Object[] greater = { + new byte[0], + new byte[]{'a', 'b', 'c', 'd'}, + new byte[]{0, 1, 2, 3, 4, 5, 6}, + }; + + assertEquals("values count", less.length, greater.length); + + for (int i = 0; i < TYPES.length; i++) + { + for (int j = 0; j < less.length; j++) + { + assertTrue("less " + j, TYPES[i].compare(less[j], greater[j]) < 0); + assertTrue("greater " + j, TYPES[i].compare(greater[j], less[j]) > 0); } } Index: DateDataTypeTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/datatype/DateDataTypeTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** DateDataTypeTest.java 13 Jun 2002 17:25:00 -0000 1.7 --- DateDataTypeTest.java 31 Mar 2003 13:22:05 -0000 1.8 *************** *** 91,95 **** } ! public void testInvalidTypeCast() throws Exception { Object[] values = { --- 91,95 ---- } ! public void testTypeCastInvalid() throws Exception { Object[] values = { *************** *** 112,115 **** --- 112,207 ---- } } + public void testCompareEquals() throws Exception + { + Object[] values1 = { + null, + new java.sql.Date(1234), + new Time(1234), + new Timestamp(1234), + new java.sql.Date(1234).toString(), + new java.util.Date(1234), + "2003-01-30" + }; + + Object[] values2 = { + null, + new java.sql.Date(1234), + new java.sql.Date(new Time(1234).getTime()), + new java.sql.Date(new Timestamp(1234).getTime()), + java.sql.Date.valueOf(new java.sql.Date(1234).toString()), + new java.sql.Date(1234), + java.sql.Date.valueOf("2003-01-30"), + }; + + assertEquals("values count", values1.length, values2.length); + + for (int i = 0; i < values1.length; i++) + { + assertEquals("compare1 " + i, 0, THIS_TYPE.compare(values1[i], values2[i])); + assertEquals("compare2 " + i, 0, THIS_TYPE.compare(values2[i], values1[i])); + } + } + + public void testCompareInvalid() throws Exception + { + Object[] values1 = { + new Integer(1234), + new Object(), + "bla", + "2000.05.05", + }; + Object[] values2 = { + null, + null, + null, + null, + }; + + assertEquals("values count", values1.length, values2.length); + + for (int i = 0; i < values1.length; i++) + { + try + { + THIS_TYPE.compare(values1[i], values2[i]); + fail("Should throw TypeCastException - " + i); + } + catch (TypeCastException e) + { + } + + try + { + THIS_TYPE.compare(values1[i], values2[i]); + fail("Should throw TypeCastException - " + i); + } + catch (TypeCastException e) + { + } + } + } + + public void testCompareDifferent() throws Exception + { + Object[] less = { + null, + new java.sql.Date(0), + "1974-23-06" + }; + + Object[] greater = { + new java.sql.Date(1234), + new java.sql.Date(System.currentTimeMillis()), + java.sql.Date.valueOf("2003-01-30"), + }; + + assertEquals("values count", less.length, greater.length); + + for (int i = 0; i < less.length; i++) + { + assertTrue("less " + i, THIS_TYPE.compare(less[i], greater[i]) < 0); + assertTrue("greater " + i, THIS_TYPE.compare(greater[i], less[i]) > 0); + } + } public void testSqlType() throws Exception *************** *** 120,126 **** } - /** - * - */ public void testForObject() throws Exception { --- 212,215 ---- Index: DoubleDataTypeTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/datatype/DoubleDataTypeTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** DoubleDataTypeTest.java 13 Jun 2002 17:25:00 -0000 1.7 --- DoubleDataTypeTest.java 31 Mar 2003 13:22:05 -0000 1.8 *************** *** 106,115 **** } ! /** ! * ! */ ! public void testInvalidTypeCast() throws Exception { ! Object[] values = {new Object(), "bla", new java.util.Date()}; for (int i = 0; i < TYPES.length; i++) --- 106,115 ---- } ! public void testTypeCastInvalid() throws Exception { ! Object[] values = { ! new Object(), ! "bla", ! new java.util.Date()}; for (int i = 0; i < TYPES.length; i++) *************** *** 125,128 **** --- 125,234 ---- { } + } + } + } + + public void testCompareEquals() throws Exception + { + Object[] values1 = { + null, + "5.555", + new Float(Float.MAX_VALUE), + new Double(Double.MIN_VALUE), + "-7500", + "2.34E23", + new Double(0.666), + new Double(5.49879), + "-99.9", + new BigDecimal(1234), + }; + + Object[] values2 = { + null, + new Double(5.555), + new Double(Float.MAX_VALUE), + new Double(Double.MIN_VALUE), + new Double(-7500), + Double.valueOf("2.34E23"), + new Double(0.666), + new Double(5.49879), + new Double(-99.9), + new Double(1234), + }; + + assertEquals("values count", values1.length, values2.length); + + for (int i = 0; i < TYPES.length; i++) + { + for (int j = 0; j < values1.length; j++) + { + assertEquals("compare1 " + j, 0, TYPES[i].compare(values1[j], values2[j])); + assertEquals("compare2 " + j, 0, TYPES[i].compare(values2[j], values1[j])); + } + } + } + + public void testCompareInvalid() throws Exception + { + Object[] values1 = { + new Object(), + "bla", + new java.util.Date() + }; + Object[] values2 = { + null, + null, + null + }; + + assertEquals("values count", values1.length, values2.length); + + for (int i = 0; i < TYPES.length; i++) + { + for (int j = 0; j < values1.length; j++) + { + try + { + TYPES[i].compare(values1[j], values2[j]); + fail("Should throw TypeCastException"); + } + catch (TypeCastException e) + { + } + + try + { + TYPES[i].compare(values2[j], values1[j]); + fail("Should throw TypeCastException"); + } + catch (TypeCastException e) + { + } + } + } + } + + public void testCompareDifferent() throws Exception + { + Object[] less = { + null, + "-7500", + new Double(Float.MIN_VALUE), + }; + + Object[] greater = { + "0", + "5.555", + new Float(Float.MAX_VALUE), + }; + + assertEquals("values count", less.length, greater.length); + + for (int i = 0; i < TYPES.length; i++) + { + for (int j = 0; j < less.length; j++) + { + assertTrue("less " + j, TYPES[i].compare(less[j], greater[j]) < 0); + assertTrue("greater " + j, TYPES[i].compare(greater[j], less[j]) > 0); } } Index: FloatDataTypeTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/datatype/FloatDataTypeTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** FloatDataTypeTest.java 13 Jun 2002 17:25:00 -0000 1.7 --- FloatDataTypeTest.java 31 Mar 2003 13:22:06 -0000 1.8 *************** *** 39,45 **** } - /** - * - */ public void testToString() throws Exception { --- 39,42 ---- *************** *** 47,53 **** } - /** - * - */ public void testGetTypeClass() throws Exception { --- 44,47 ---- *************** *** 55,61 **** } - /** - * - */ public void testIsNumber() throws Exception { --- 49,52 ---- *************** *** 63,69 **** } - /** - * - */ public void testTypeCast() throws Exception { --- 54,57 ---- *************** *** 103,110 **** } ! /** ! * ! */ ! public void testInvalidTypeCast() throws Exception { Object[] values = {new Object(), "bla", new java.util.Date()}; --- 91,95 ---- } ! public void testTypeCastInvalid() throws Exception { Object[] values = {new Object(), "bla", new java.util.Date()}; *************** *** 123,126 **** --- 108,208 ---- } + public void testCompareEquals() throws Exception + { + Object[] values1 = { + null, + "5.555", + new Double(Float.MAX_VALUE), + new Double(Float.MIN_VALUE), + "-7500", + "2.34E3", + new Double(0.666), + new Double(5.49879), + "-99.9", + new BigDecimal(1234), + }; + + Float[] values2 = { + null, + new Float(5.555), + new Float(Float.MAX_VALUE), + new Float(Float.MIN_VALUE), + new Float(-7500), + Float.valueOf("2.34E3"), + new Float(0.666), + new Float(5.49879), + new Float(-99.9), + new Float(1234), + }; + + assertEquals("values count", values1.length, values2.length); + + for (int i = 0; i < values1.length; i++) + { + assertEquals("compare1 " + i, 0, THIS_TYPE.compare(values1[i], values2[i])); + assertEquals("compare2 " + i, 0, THIS_TYPE.compare(values2[i], values1[i])); + } + } + + public void testCompareInvalid() throws Exception + { + Object[] values1 = { + new Object(), + "bla", + new java.util.Date() + }; + Object[] values2 = { + null, + null, + null + }; + + assertEquals("values count", values1.length, values2.length); + + for (int i = 0; i < values1.length; i++) + { + try + { + THIS_TYPE.compare(values1[i], values2[i]); + fail("Should throw TypeCastException"); + } + catch (TypeCastException e) + { + } + + try + { + THIS_TYPE.compare(values2[i], values1[i]); + fail("Should throw TypeCastException"); + } + catch (TypeCastException e) + { + } + } + } + + public void testCompareDifferent() throws Exception + { + Object[] less = { + null, + "-7500", + new Double(Float.MIN_VALUE), + }; + + Object[] greater = { + "0", + "5.555", + new Float(Float.MAX_VALUE), + }; + + assertEquals("values count", less.length, greater.length); + + for (int i = 0; i < less.length; i++) + { + assertTrue("less " + i, THIS_TYPE.compare(less[i], greater[i]) < 0); + assertTrue("greater " + i, THIS_TYPE.compare(greater[i], less[i]) > 0); + } + } + public void testSqlType() throws Exception { *************** *** 130,136 **** } - /** - * - */ public void testForObject() throws Exception { --- 212,215 ---- Index: IntegerDataTypeTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/datatype/IntegerDataTypeTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** IntegerDataTypeTest.java 13 Jun 2002 17:25:00 -0000 1.7 --- IntegerDataTypeTest.java 31 Mar 2003 13:22:06 -0000 1.8 *************** *** 124,130 **** } ! public void testInvalidTypeCast() throws Exception { ! Object[] values = {new Object(), "bla", new java.util.Date()}; for (int i = 0; i < TYPES.length; i++) --- 124,134 ---- } ! public void testTypeCastInvalid() throws Exception { ! Object[] values = { ! new Object(), ! "bla", ! new java.util.Date() ! }; for (int i = 0; i < TYPES.length; i++) *************** *** 140,143 **** --- 144,259 ---- { } + } + } + } + + public void testCompareEquals() throws Exception + { + Object[] values1 = { + null, + "5", + new Long(Integer.MAX_VALUE - 1), + new Double(Integer.MIN_VALUE + 1), + "-7500", + new Long(Integer.MAX_VALUE), + new Double(Integer.MIN_VALUE), + new Float(0.666), + new Double(0.666), + new Double(5.49), + "-99.9", + new Double(1.5E2), + new BigDecimal(1234), + }; + + Object[] values2 = { + null, + new Integer(5), + new Integer(Integer.MAX_VALUE - 1), + new Integer(Integer.MIN_VALUE + 1), + new Integer(-7500), + new Integer(Integer.MAX_VALUE), + new Integer(Integer.MIN_VALUE), + new Integer(0), + new Integer(0), + new Integer(5), + new Integer(-99), + new Integer(150), + new Integer(1234), + }; + + assertEquals("values count", values1.length, values2.length); + + for (int i = 0; i < TYPES.length; i++) + { + for (int j = 0; j < values1.length; j++) + { + assertEquals("compare1 " + j, 0, TYPES[i].compare(values1[j], values2[j])); + assertEquals("compare2 " + j, 0, TYPES[i].compare(values2[j], values1[j])); + } + } + } + + public void testCompareInvalid() throws Exception + { + Object[] values1 = { + new Object(), + "bla", + new java.util.Date() + }; + Object[] values2 = { + null, + null, + null + }; + + assertEquals("values count", values1.length, values2.length); + + for (int i = 0; i < TYPES.length; i++) + { + for (int j = 0; j < values1.length; j++) + { + try + { + TYPES[i].compare(values1[j], values2[j]); + fail("Should throw TypeCastException"); + } + catch (TypeCastException e) + { + } + + try + { + TYPES[i].compare(values2[j], values1[j]); + fail("Should throw TypeCastException"); + } + catch (TypeCastException e) + { + } + } + } + } + + public void testCompareDifferent() throws Exception + { + Object[] less = { + null, + "-7500", + new Double(Float.MIN_VALUE), + }; + + Object[] greater = { + "0", + "5.555", + new Float(Float.MAX_VALUE), + }; + + assertEquals("values count", less.length, greater.length); + + for (int i = 0; i < TYPES.length; i++) + { + for (int j = 0; j < less.length; j++) + { + assertTrue("less " + j, TYPES[i].compare(less[j], greater[j]) < 0); + assertTrue("greater " + j, TYPES[i].compare(greater[j], less[j]) > 0); } } Index: NumberDataTypeTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/datatype/NumberDataTypeTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** NumberDataTypeTest.java 17 Mar 2003 00:51:24 -0000 1.8 --- NumberDataTypeTest.java 31 Mar 2003 13:22:06 -0000 1.9 *************** *** 23,26 **** --- 23,27 ---- import java.math.BigDecimal; + import java.math.BigInteger; import java.sql.Types; *************** *** 97,104 **** } ! /** ! * ! */ ! public void testInvalidTypeCast() throws Exception { Object[] values = {new Object(), "bla"}; --- 98,102 ---- } ! public void testTypeCastInvalid() throws Exception { Object[] values = {new Object(), "bla"}; *************** *** 116,119 **** --- 114,218 ---- { } + } + } + } + + public void testCompareEquals() throws Exception + { + Object[] values1 = { + null, + new BigDecimal(1234), + "1234", + "12.34", + Boolean.TRUE, + Boolean.FALSE, + new BigDecimal(123.4), + }; + Object[] values2 = { + null, + new BigDecimal(1234), + new BigDecimal(1234), + new BigDecimal("12.34"), + new BigDecimal("1"), + new BigDecimal("0"), + new BigDecimal(123.4000), + }; + + assertEquals("values count", values1.length, values2.length); + + for (int i = 0; i < TYPES.length; i++) + { + for (int j = 0; j < values1.length; j++) + { + assertEquals("compare1 " + j, 0, TYPES[i].compare(values1[j], values2[j])); + assertEquals("compare2 " + j, 0, TYPES[i].compare(values2[j], values1[j])); + } + } + } + + public void testCompareInvalid() throws Exception + { + Object[] values1 = { + new Object(), + "bla", + new java.util.Date() + }; + Object[] values2 = { + null, + null, + null + }; + + assertEquals("values count", values1.length, values2.length); + + for (int i = 0; i < TYPES.length; i++) + { + for (int j = 0; j < values1.length; j++) + { + try + { + TYPES[i].compare(values1[j], values2[j]); + fail("Should throw TypeCastException"); + } + catch (TypeCastException e) + { + } + + try + { + TYPES[i].compare(values2[j], values1[j]); + fail("Should throw TypeCastException"); + } + catch (TypeCastException e) + { + } + } + } + } + + public void testCompareDifferent() throws Exception + { + Object[] less = { + null, + "-7500", + new BigDecimal("-0.01"), + new BigInteger("1234"), + }; + + Object[] greater = { + "0", + "5.555", + new BigDecimal("0.01"), + new BigDecimal("1234.5"), + }; + + assertEquals("values count", less.length, greater.length); + + for (int i = 0; i < TYPES.length; i++) + { + for (int j = 0; j < less.length; j++) + { + assertTrue("less " + j, TYPES[i].compare(less[j], greater[j]) < 0); + assertTrue("greater " + j, TYPES[i].compare(greater[j], less[j]) > 0); } } Index: LongDataTypeTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/datatype/LongDataTypeTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** LongDataTypeTest.java 13 Jun 2002 17:25:00 -0000 1.7 --- LongDataTypeTest.java 31 Mar 2003 13:22:06 -0000 1.8 *************** *** 63,69 **** } - /** - * - */ public void testTypeCast() throws Exception { --- 63,66 ---- *************** *** 111,118 **** } ! /** ! * ! */ ! public void testInvalidTypeCast() throws Exception { Object[] values = {new Object(), "bla", new java.util.Date()}; --- 108,112 ---- } ! public void testTypeCastInvalid() throws Exception { Object[] values = {new Object(), "bla", new java.util.Date()}; *************** *** 131,134 **** --- 125,233 ---- } + public void testCompareEquals() throws Exception + { + Object[] values1 = { + null, + "5", + new Long(1234), + new Float(Long.MAX_VALUE), + new Float(Long.MIN_VALUE), + "-7500", + new Double(Long.MAX_VALUE), + new Double(Long.MIN_VALUE), + new Float(0.666), + new Double(0.666), + new Double(5.49), + "-99.9", + new Double(1.5E6), + new BigDecimal(1234), + }; + + Object[] values2 = { + null, + new Long(5), + new Long(1234), + new Long(Long.MAX_VALUE), + new Long(Long.MIN_VALUE), + new Long(-7500), + new Long(Long.MAX_VALUE), + new Long(Long.MIN_VALUE), + new Long(0), + new Long(0), + new Long(5), + new Long(-99), + new Long(1500000), + new Long(1234), + }; + + assertEquals("values count", values1.length, values2.length); + + for (int i = 0; i < values1.length; i++) + { + assertEquals("compare1 " + i, 0, THIS_TYPE.compare(values1[i], values2[i])); + assertEquals("compare2 " + i, 0, THIS_TYPE.compare(values2[i], values1[i])); + } + } + + public void testCompareInvalid() throws Exception + { + Object[] values1 = { + new Object(), + "bla", + new java.util.Date() + }; + Object[] values2 = { + null, + null, + null + }; + + assertEquals("values count", values1.length, values2.length); + + for (int i = 0; i < values1.length; i++) + { + try + { + THIS_TYPE.compare(values1[i], values2[i]); + fail("Should throw TypeCastException"); + } + catch (TypeCastException e) + { + } + + try + { + THIS_TYPE.compare(values2[i], values1[i]); + fail("Should throw TypeCastException"); + } + catch (TypeCastException e) + { + } + } + } + + public void testCompareDifferent() throws Exception + { + Object[] less = { + null, + null, + "-7500", + }; + + Object[] greater = { + "0", + new Long(-5), + new Long(5), + }; + + assertEquals("values count", less.length, greater.length); + + for (int i = 0; i < less.length; i++) + { + assertTrue("less " + i, THIS_TYPE.compare(less[i], greater[i]) < 0); + assertTrue("greater " + i, THIS_TYPE.compare(greater[i], less[i]) > 0); + } + } + public void testSqlType() throws Exception { *************** *** 138,144 **** } - /** - * - */ public void testForObject() throws Exception { --- 237,240 ---- Index: StringDataTypeTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/datatype/StringDataTypeTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** StringDataTypeTest.java 13 Jun 2002 17:25:00 -0000 1.7 --- StringDataTypeTest.java 31 Mar 2003 13:22:06 -0000 1.8 *************** *** 23,26 **** --- 23,28 ---- import java.sql.Types; + import java.math.BigDecimal; + import java.math.BigInteger; /** *************** *** 70,76 **** } - /** - * - */ public void testTypeCast() throws Exception { --- 72,75 ---- *************** *** 112,118 **** } ! public void testInvalidTypeCast() throws Exception { ! Object[] values = {new Object()}; for (int i = 0; i < TYPES.length; i++) --- 111,119 ---- } ! public void testTypeCastInvalid() throws Exception { ! Object[] values = { ! new Object() ! }; for (int i = 0; i < TYPES.length; i++) *************** *** 128,131 **** --- 129,235 ---- { } + } + } + } + + public void testCompareEquals() throws Exception + { + Object[] values1 = { + null, + "bla", + new java.sql.Date(1234), + new java.sql.Time(1234), + new java.sql.Timestamp(1234), + Boolean.TRUE, + new Integer(1234), + new Long(1234), + new Double(12.34), + new byte[]{'a', 'b', 'c', 'd'}, + }; + String[] values2 = { + null, + "bla", + new java.sql.Date(1234).toString(), + new java.sql.Time(1234).toString(), + new java.sql.Timestamp(1234).toString(), + "true", + "1234", + "1234", + "12.34", + "YWJjZA==", + }; + + assertEquals("values count", values1.length, values2.length); + + for (int i = 0; i < TYPES.length; i++) + { + for (int j = 0; j < values1.length; j++) + { + assertEquals("compare1 " + j, 0, TYPES[i].compare(values1[j], values2[j])); + assertEquals("compare2 " + j, 0, TYPES[i].compare(values2[j], values1[j])); + } + } + } + + public void testCompareInvalid() throws Exception + { + Object[] values1 = { + new Object(), + }; + Object[] values2 = { + null, + }; + + assertEquals("values count", values1.length, values2.length); + + for (int i = 0; i < TYPES.length; i++) + { + for (int j = 0; j < values1.length; j++) + { + try + { + TYPES[i].compare(values1[j], values2[j]); + fail("Should throw TypeCastException"); + } + catch (TypeCastException e) + { + } + + try + { + TYPES[i].compare(values2[j], values1[j]); + fail("Should throw TypeCastException"); + } + catch (TypeCastException e) + { + } + } + } + } + + public void testCompareDifferent() throws Exception + { + Object[] less = { + null, + "", + "abcd", + "123", + }; + + Object[] greater = { + "bla", + "bla", + "efgh", + "1234", + }; + + assertEquals("values count", less.length, greater.length); + + for (int i = 0; i < TYPES.length; i++) + { + for (int j = 0; j < less.length; j++) + { + assertTrue("less " + j, TYPES[i].compare(less[j], greater[j]) < 0); + assertTrue("greater " + j, TYPES[i].compare(greater[j], less[j]) > 0); } } Index: TimeDataTypeTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/datatype/TimeDataTypeTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TimeDataTypeTest.java 13 Jun 2002 17:25:00 -0000 1.7 --- TimeDataTypeTest.java 31 Mar 2003 13:22:06 -0000 1.8 *************** *** 38,44 **** } - /** - * - */ public void testToString() throws Exception { --- 38,41 ---- *************** *** 46,52 **** } - /** - * - */ public void testGetTypeClass() throws Exception { --- 43,46 ---- *************** *** 54,60 **** } - /** - * - */ public void testIsNumber() throws Exception { --- 48,51 ---- *************** *** 62,68 **** } - /** - * - */ public void testTypeCast() throws Exception { --- 53,56 ---- *************** *** 94,101 **** } ! /** ! * ! */ ! public void testInvalidTypeCast() throws Exception { Object[] values = { --- 82,86 ---- } ! public void testTypeCastInvalid() throws Exception { Object[] values = { *************** *** 116,119 **** --- 101,199 ---- { } + } + } + + public void testCompareEquals() throws Exception + { + Object[] values1 = { + null, + new Time(1234), + new java.sql.Date(1234), + new Timestamp(1234), + new Time(1234).toString(), + new java.util.Date(1234), + "00:01:02", + }; + + Object[] values2 = { + null, + new Time(1234), + new Time(new java.sql.Date(1234).getTime()), + new Time(new Timestamp(1234).getTime()), + Time.valueOf(new Time(1234).toString()), + new Time(1234), + new Time(0, 1, 2), + }; + + assertEquals("values count", values1.length, values2.length); + + for (int i = 0; i < values1.length; i++) + { + assertEquals("compare1 " + i, 0, THIS_TYPE.compare(values1[i], values2[i])); + assertEquals("compare2 " + i, 0, THIS_TYPE.compare(values2[i], values1[i])); + } + } + + public void testCompareInvalid() throws Exception + { + Object[] values1 = { + new Integer(1234), + new Object(), + "bla", + "2000.05.05", + }; + Object[] values2 = { + null, + null, + null, + null, + }; + + assertEquals("values count", values1.length, values2.length); + + for (int i = 0; i < values1.length; i++) + { + try + { + THIS_TYPE.compare(values1[i], values2[i]); + fail("Should throw TypeCastException - " + i); + } + catch (TypeCastException e) + { + } + + try + { + THIS_TYPE.compare(values1[i], values2[i]); + fail("Should throw TypeCastException - " + i); + } + catch (TypeCastException e) + { + } + } + } + + public void testCompareDifferent() throws Exception + { + Object[] less = { + null, + new java.sql.Time(0), + "08:00:00", + "08:00:00", + }; + + Object[] greater = { + new java.sql.Time(1234), + new java.sql.Time(System.currentTimeMillis()), + "20:00:00", + "08:00:01", + }; + + assertEquals("values count", less.length, greater.length); + + for (int i = 0; i < less.length; i++) + { + assertTrue("less " + i, THIS_TYPE.compare(less[i], greater[i]) < 0); + assertTrue("greater " + i, THIS_TYPE.compare(greater[i], less[i]) > 0); } } Index: TimestampDataTypeTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/datatype/TimestampDataTypeTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TimestampDataTypeTest.java 13 Jun 2002 17:25:00 -0000 1.7 --- TimestampDataTypeTest.java 31 Mar 2003 13:22:07 -0000 1.8 *************** *** 54,60 **** } - /** - * - */ public void testIsNumber() throws Exception { --- 54,57 ---- *************** *** 62,68 **** } - /** - * - */ public void testTypeCast() throws Exception { --- 59,62 ---- *************** *** 94,101 **** } ! /** ! * ! */ ! public void testInvalidTypeCast() throws Exception { Object[] values = { --- 88,92 ---- } ! public void testTypeCastInvalid() throws Exception { Object[] values = { *************** *** 119,122 **** --- 110,206 ---- } + public void testCompareEquals() throws Exception + { + Object[] values1 = { + null, + new Timestamp(1234), + new Date(1234), + new Time(1234), + new Timestamp(1234).toString(), + new java.util.Date(1234), + "1970-01-01 00:00:00.0", + }; + + Timestamp[] values2 = { + null, + new Timestamp(1234), + new Timestamp(new Date(1234).getTime()), + new Timestamp(new Time(1234).getTime()), + Timestamp.valueOf(new Timestamp(1234).toString()), + new Timestamp(1234), + Timestamp.valueOf("1970-01-01 00:00:00.0"), + }; + + assertEquals("values count", values1.length, values2.length); + + for (int i = 0; i < values1.length; i++) + { + assertEquals("compare1 " + i, 0, THIS_TYPE.compare(values1[i], values2[i])); + assertEquals("compare2 " + i, 0, THIS_TYPE.compare(values2[i], values1[i])); + } + } + + public void testCompareInvalid() throws Exception + { + Object[] values1 = { + new Integer(1234), + new Object(), + "bla", + "2000.05.05", + }; + Object[] values2 = { + null, + null, + null, + null, + }; + + assertEquals("values count", values1.length, values2.length); + + for (int i = 0; i < values1.length; i++) + { + try + { + THIS_TYPE.compare(values1[i], values2[i]); + fail("Should throw TypeCastException - " + i); + } + catch (TypeCastException e) + { + } + + try + { + THIS_TYPE.compare(values1[i], values2[i]); + fail("Should throw TypeCastException - " + i); + } + catch (TypeCastException e) + { + } + } + } + + public void testCompareDifferent() throws Exception + { + Object[] less = { + null, + new java.sql.Date(0), + "1974-23-06 23:40:00.0" + }; + + Object[] greater = { + new java.sql.Date(1234), + new java.sql.Date(System.currentTimeMillis()), + Timestamp.valueOf("2003-01-30 11:42:00.0"), + }; + + assertEquals("values count", less.length, greater.length); + + for (int i = 0; i < less.length; i++) + { + assertTrue("less " + i, THIS_TYPE.compare(less[i], greater[i]) < 0); + assertTrue("greater " + i, THIS_TYPE.compare(greater[i], less[i]) > 0); + } + } + public void testSqlType() throws Exception { *************** *** 126,132 **** } - /** - * - */ public void testForObject() throws Exception { --- 210,213 ---- |
From: <mla...@us...> - 2003-03-27 22:35:02
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/operation In directory sc8-pr-cvs1:/tmp/cvs-serv10379/src/java/org/dbunit/operation Modified Files: RefreshOperation.java Log Message: Fixed REFRESH operation with Oracle. Index: RefreshOperation.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/operation/RefreshOperation.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** RefreshOperation.java 5 Mar 2003 02:54:17 -0000 1.22 --- RefreshOperation.java 27 Mar 2003 22:34:55 -0000 1.23 *************** *** 25,30 **** import org.dbunit.DatabaseUnitException; import org.dbunit.database.IDatabaseConnection; ! import org.dbunit.database.statement.IPreparedBatchStatement; ! import org.dbunit.database.statement.IStatementFactory; import org.dbunit.dataset.*; import org.dbunit.dataset.datatype.DataType; --- 25,29 ---- import org.dbunit.DatabaseUnitException; import org.dbunit.database.IDatabaseConnection; ! import org.dbunit.database.statement.*; import org.dbunit.dataset.*; import org.dbunit.dataset.datatype.DataType; *************** *** 58,62 **** throws DatabaseUnitException, SQLException { - IStatementFactory factory = connection.getStatementFactory(); String schema = connection.getSchema(); --- 57,60 ---- *************** *** 75,81 **** connection, table.getTableMetaData()); RowOperation updateRowOperation = createUpdateOperation(connection, ! factory, schema, metaData); RowOperation insertRowOperation = new InsertRowOperation(connection, ! factory, schema, metaData); // refresh all rows --- 73,79 ---- connection, table.getTableMetaData()); RowOperation updateRowOperation = createUpdateOperation(connection, ! schema, metaData); RowOperation insertRowOperation = new InsertRowOperation(connection, ! schema, metaData); // refresh all rows *************** *** 96,100 **** private RowOperation createUpdateOperation(IDatabaseConnection connection, ! IStatementFactory factory, String schema, ITableMetaData metaData) throws DataSetException, SQLException { --- 94,98 ---- private RowOperation createUpdateOperation(IDatabaseConnection connection, ! String schema, ITableMetaData metaData) throws DataSetException, SQLException { *************** *** 102,110 **** if (metaData.getColumns().length > metaData.getPrimaryKeys().length) { ! return new UpdateRowOperation(connection, factory, schema, metaData); } // otherwise, operation only verify if row exist ! return new RowExistOperation(connection, factory, schema, metaData); } --- 100,108 ---- if (metaData.getColumns().length > metaData.getPrimaryKeys().length) { ! return new UpdateRowOperation(connection, schema, metaData); } // otherwise, operation only verify if row exist ! return new RowExistOperation(connection, schema, metaData); } *************** *** 151,155 **** { public InsertRowOperation(IDatabaseConnection connection, ! IStatementFactory factory, String schema, ITableMetaData metaData) throws DataSetException, SQLException { --- 149,153 ---- { public InsertRowOperation(IDatabaseConnection connection, ! String schema, ITableMetaData metaData) throws DataSetException, SQLException { *************** *** 157,162 **** OperationData insertData = _insertOperation.getOperationData(schema, metaData); ! _statement = factory.createPreparedBatchStatement( ! insertData.getSql(), connection); _columns = insertData.getColumns(); } --- 155,160 ---- OperationData insertData = _insertOperation.getOperationData(schema, metaData); ! _statement = new SimplePreparedStatement(insertData.getSql(), ! connection.getConnection()); _columns = insertData.getColumns(); } *************** *** 171,175 **** public UpdateRowOperation(IDatabaseConnection connection, ! IStatementFactory factory, String schema, ITableMetaData metaData) throws DataSetException, SQLException { --- 169,173 ---- public UpdateRowOperation(IDatabaseConnection connection, ! String schema, ITableMetaData metaData) throws DataSetException, SQLException { *************** *** 177,182 **** OperationData updateData = _updateOperation.getOperationData(schema, metaData); ! _statement = factory.createPreparedBatchStatement( ! updateData.getSql(), connection); _columns = updateData.getColumns(); } --- 175,180 ---- OperationData updateData = _updateOperation.getOperationData(schema, metaData); ! _statement = new SimplePreparedStatement(updateData.getSql(), ! connection.getConnection()); _columns = updateData.getColumns(); } *************** *** 191,195 **** public RowExistOperation(IDatabaseConnection connection, ! IStatementFactory factory, String schema, ITableMetaData metaData) throws DataSetException, SQLException { --- 189,193 ---- public RowExistOperation(IDatabaseConnection connection, ! String schema, ITableMetaData metaData) throws DataSetException, SQLException { |
From: <mla...@us...> - 2003-03-27 22:34:59
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/statement In directory sc8-pr-cvs1:/tmp/cvs-serv10379/src/java/org/dbunit/database/statement Modified Files: SimplePreparedStatement.java Log Message: Fixed REFRESH operation with Oracle. Index: SimplePreparedStatement.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/statement/SimplePreparedStatement.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SimplePreparedStatement.java 13 Jun 2002 17:24:56 -0000 1.7 --- SimplePreparedStatement.java 27 Mar 2003 22:34:55 -0000 1.8 *************** *** 38,42 **** private int _result; ! SimplePreparedStatement(String sql, Connection connection) throws SQLException { --- 38,42 ---- private int _result; ! public SimplePreparedStatement(String sql, Connection connection) throws SQLException { *************** *** 52,55 **** --- 52,69 ---- throws TypeCastException, SQLException { + if (dataType == DataType.CLOB) + { + _statement.setObject(++_index, dataType.typeCast(value), + DataType.LONGVARCHAR.getSqlType()); + return; + } + + if (dataType == DataType.BLOB) + { + _statement.setObject(++_index, dataType.typeCast(value), + DataType.LONGVARBINARY.getSqlType()); + return; + } + _statement.setObject(++_index, dataType.typeCast(value), dataType.getSqlType()); } |
From: <mla...@us...> - 2003-03-27 22:23:26
|
Update of /cvsroot/dbunit/dbunit/src/xml In directory sc8-pr-cvs1:/tmp/cvs-serv6199/src/xml Added Files: dataSetDuplicateTest.xls dataSetTest.xls tableTest.xls Log Message: Added excel documents with binary flag this time... |
From: <mla...@us...> - 2003-03-27 22:20:34
|
Update of /cvsroot/dbunit/dbunit/src/xml In directory sc8-pr-cvs1:/tmp/cvs-serv5192/src/xml Removed Files: tableTest.xls dataSetTest.xls dataSetDuplicateTest.xls Log Message: Remove corrupted excel document. They were not imported with the binary flag. --- tableTest.xls DELETED --- --- dataSetTest.xls DELETED --- --- dataSetDuplicateTest.xls DELETED --- |
From: <mla...@us...> - 2003-03-25 12:34:54
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/ant In directory sc8-pr-cvs1:/tmp/cvs-serv14615/dbunit/src/java/org/dbunit/ant Modified Files: DbUnitTask.java Log Message: DbUnitTask * Fixed "supportBatchStatement" attribute flag. * Optimization: reuse the same DatabaseOperation for every steps. Index: DbUnitTask.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/ant/DbUnitTask.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DbUnitTask.java 1 Mar 2003 06:51:17 -0000 1.5 --- DbUnitTask.java 25 Mar 2003 12:34:48 -0000 1.6 *************** *** 94,98 **** * Flag for using botched statements. */ ! private boolean supportBatchStatement = false; /** --- 94,98 ---- * Flag for using botched statements. */ ! private boolean supportBatchStatement = true; /** *************** *** 246,256 **** throw new BuildException("Must declare at least one step in a <dbunit> task!"); } if (useQualifiedTableNames) { System.setProperty("dbunit.qualified.table.names", "true"); } ! if (supportBatchStatement) { ! System.setProperty("dbunit.database.supportBatchStatement", "true"); } --- 246,257 ---- throw new BuildException("Must declare at least one step in a <dbunit> task!"); } + if (useQualifiedTableNames) { System.setProperty("dbunit.qualified.table.names", "true"); } ! if (!supportBatchStatement) { ! System.setProperty("dbunit.database.supportBatchStatement", "false"); } *************** *** 305,313 **** conn.setAutoCommit(true); Iterator stepIter = steps.listIterator(); while (stepIter.hasNext()) { DbUnitTaskStep step = (DbUnitTaskStep)stepIter.next(); - IDatabaseConnection connection = new DatabaseConnection(conn, schema); log(step.getLogMessage(), Project.MSG_INFO); step.execute(connection); --- 306,314 ---- conn.setAutoCommit(true); + IDatabaseConnection connection = new DatabaseConnection(conn, schema); Iterator stepIter = steps.listIterator(); while (stepIter.hasNext()) { DbUnitTaskStep step = (DbUnitTaskStep)stepIter.next(); log(step.getLogMessage(), Project.MSG_INFO); step.execute(connection); |
From: <mla...@us...> - 2003-03-23 21:53:44
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/excel In directory sc8-pr-cvs1:/tmp/cvs-serv22103/dbunit/src/java/org/dbunit/dataset/excel Modified Files: XlsTable.java XlsDataSet.java Log Message: Added some javadoc... Index: XlsTable.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/excel/XlsTable.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** XlsTable.java 21 Mar 2003 03:14:50 -0000 1.1 --- XlsTable.java 23 Mar 2003 21:53:39 -0000 1.2 *************** *** 39,43 **** * @version $Revision$ */ ! public class XlsTable extends AbstractTable { private final ITableMetaData _metaData; --- 39,43 ---- * @version $Revision$ */ ! class XlsTable extends AbstractTable { private final ITableMetaData _metaData; Index: XlsDataSet.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/excel/XlsDataSet.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** XlsDataSet.java 21 Mar 2003 03:14:50 -0000 1.1 --- XlsDataSet.java 23 Mar 2003 21:53:39 -0000 1.2 *************** *** 31,34 **** --- 31,38 ---- /** + * This dataset implementation can read and write MS Excel documents. Each + * sheet represents a table. The first row of a sheet defines the columns names + * and remaining rows contains the data. + * * @author Manuel Laflamme * @since Feb 21, 2003 *************** *** 39,42 **** --- 43,49 ---- private final ITable[] _tables; + /** + * Creates a new XlsDataSet object that loads the specified Excel document. + */ public XlsDataSet(File file) throws IOException, DataSetException { *************** *** 44,47 **** --- 51,57 ---- } + /** + * Creates a new XlsDataSet object that loads the specified Excel document. + */ public XlsDataSet(InputStream in) throws IOException, DataSetException { *************** *** 56,61 **** /** ! * Write the specified dataset to the specified output stream as a xls ! * document. */ public static void write(IDataSet dataSet, OutputStream out) --- 66,70 ---- /** ! * Write the specified dataset to the specified Excel document. */ public static void write(IDataSet dataSet, OutputStream out) |
From: <mla...@us...> - 2003-03-23 04:31:58
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv14589/dbunit/src/test/org/dbunit/dataset Modified Files: ReplacementTableTest.java Log Message: Optimization of delimited substring replacement. Index: ReplacementTableTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/ReplacementTableTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ReplacementTableTest.java 20 Mar 2003 13:01:46 -0000 1.3 --- ReplacementTableTest.java 23 Mar 2003 04:31:55 -0000 1.4 *************** *** 192,197 **** new Column("BAD_DELIMITED_SUBSTRING2", DataType.CHAR), new Column("BAD_DELIMITED_SUBSTRING3", DataType.CHAR), ! new Column("BAD_DELIMITED_SUBSTRING4", DataType.CHAR), new Column("BAD_DELIMITED_SUBSTRING5", DataType.CHAR), }; --- 192,200 ---- new Column("BAD_DELIMITED_SUBSTRING2", DataType.CHAR), new Column("BAD_DELIMITED_SUBSTRING3", DataType.CHAR), ! // new Column("BAD_DELIMITED_SUBSTRING4", DataType.CHAR), new Column("BAD_DELIMITED_SUBSTRING5", DataType.CHAR), + new Column("BAD_DELIMITED_SUBSTRING6", DataType.CHAR), + new Column("BAD_SUBSTRING1", DataType.CHAR), + new Column("BAD_SUBSTRING2", DataType.CHAR), }; *************** *** 214,219 **** "_$substring}_", "_substring}_", ! "${substring${substring} ${substring}", ! "${substringsubstring} ${substring}", }; --- 217,225 ---- "_$substring}_", "_substring}_", ! "}", ! "${", ! // "${substring${substring} ${substring}", - Should we support this??? ! "${substringsubstring}${}${}${substring}${}_", ! "${}", }; *************** *** 243,248 **** "_$substring}_", "_substring}_", ! "${substringreplacement replacement", ! "${substringsubstring} replacement", }; --- 249,343 ---- "_$substring}_", "_substring}_", ! "}", ! "${", ! // "${substringreplacement replacement", ! "${substringsubstring}${}${}replacement${}_", ! "${}", ! }; ! ! List expectedRowList = new ArrayList(); ! expectedRowList.add(expectedRow); ! ITable expectedTable = new DefaultTable(tableName, columns, expectedRowList); ! ! Assertion.assertEquals(expectedTable, actualTable); ! } ! ! public void testDelimitedSubstringReplacementWithIdenticalDelimiters() throws Exception ! { ! String tableName = "TABLE_NAME"; ! ! Column[] columns = new Column[] { ! new Column("ONLY_SUBSTRING", DataType.CHAR), ! new Column("START_SUBSTRING", DataType.CHAR), ! new Column("MIDDLE_SUBSTRING", DataType.CHAR), ! new Column("END_SUBSTRING", DataType.CHAR), ! new Column("MULTIPLE_SUBSTRING", DataType.CHAR), ! new Column("NO_SUBSTRING", DataType.CHAR), ! new Column("NOT_A_STRING", DataType.NUMERIC), ! new Column("NULL_VALUE", DataType.CHAR), ! new Column("ONLY_NONDELIMITED_SUBSTRING", DataType.CHAR), ! new Column("START_NONDELIMITED_SUBSTRING", DataType.CHAR), ! new Column("MIDDLE_NONDELIMITED_SUBSTRING", DataType.CHAR), ! new Column("END_NONDELIMITED_SUBSTRING", DataType.CHAR), ! new Column("MULTIPLE_NONDELIMITED_SUBSTRING", DataType.CHAR), ! new Column("BAD_DELIMITED_SUBSTRING1", DataType.CHAR), ! new Column("BAD_DELIMITED_SUBSTRING2", DataType.CHAR), ! // new Column("BAD_DELIMITED_SUBSTRING4", DataType.CHAR), ! new Column("BAD_DELIMITED_SUBSTRING5", DataType.CHAR), ! new Column("BAD_SUBSTRING1", DataType.CHAR), ! new Column("BAD_SUBSTRING2", DataType.CHAR), ! }; ! ! // Setup actual table ! Object[] actualRow = new Object[] { ! "!substring!", ! "!substring!_", ! "_!substring!_", ! "_!substring!", ! "!substring!!substring! !substring!", ! "this is a string", ! new Long(0), ! null, ! "substring", ! "substring_", ! "_substring_", ! "_substring", ! "substringsubstring substring", ! "_!substring_", ! "_substring!_", ! "!", ! // "!substring!substring! !substring!", - Should we support this??? ! "!substringsubstring!!!!!!substring!!!_", ! "!!", ! }; ! ! List actualRowList = new ArrayList(); ! actualRowList.add(actualRow); ! ITable originalTable = new DefaultTable(tableName, columns, actualRowList); ! ReplacementTable actualTable = new ReplacementTable(originalTable); ! actualTable.addReplacementSubstring("substring", "replacement"); ! actualTable.setSubstringDelimiters("!", "!"); ! ! // Setup expected table ! Object[] expectedRow = new Object[] { ! "replacement", ! "replacement_", ! "_replacement_", ! "_replacement", ! "replacementreplacement replacement", ! "this is a string", ! new Long(0), ! null, ! "substring", ! "substring_", ! "_substring_", ! "_substring", ! "substringsubstring substring", ! "_!substring_", ! "_substring!_", ! "!", ! // "!substringreplacement replacement", ! "!substringsubstring!!!!!replacement!!_", ! "!!", }; |
From: <mla...@us...> - 2003-03-23 04:31:58
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv14589/dbunit/src/java/org/dbunit/dataset Modified Files: ReplacementDataSet.java ReplacementTable.java Log Message: Optimization of delimited substring replacement. Index: ReplacementDataSet.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/ReplacementDataSet.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ReplacementDataSet.java 22 Mar 2003 17:28:00 -0000 1.3 --- ReplacementDataSet.java 23 Mar 2003 04:31:55 -0000 1.4 *************** *** 39,44 **** private final Map _objectMap; private final Map _substringMap; ! private String _startDelimiter; ! private String _endDelimiter; --- 39,44 ---- private final Map _objectMap; private final Map _substringMap; ! private String _startDelim; ! private String _endDelim; *************** *** 107,112 **** } ! _startDelimiter = startDelimiter; ! _endDelimiter = endDelimiter; } --- 107,112 ---- } ! _startDelim = startDelimiter; ! _endDelim = endDelimiter; } *************** *** 114,118 **** { return new ReplacementTable(table, _objectMap, _substringMap, ! _startDelimiter, _endDelimiter); } --- 114,118 ---- { return new ReplacementTable(table, _objectMap, _substringMap, ! _startDelim, _endDelim); } Index: ReplacementTable.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/ReplacementTable.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ReplacementTable.java 20 Mar 2003 13:01:46 -0000 1.3 --- ReplacementTable.java 23 Mar 2003 04:31:55 -0000 1.4 *************** *** 38,43 **** private final Map _objectMap; private final Map _substringMap; ! private String _startDelimiter; ! private String _endDelimiter; /** --- 38,43 ---- private final Map _objectMap; private final Map _substringMap; ! private String _startDelim; ! private String _endDelim; /** *************** *** 57,62 **** _objectMap = objectMap; _substringMap = substringMap; ! _startDelimiter = startDelimiter; ! _endDelimiter = endDelimiter; } --- 57,62 ---- _objectMap = objectMap; _substringMap = substringMap; ! _startDelim = startDelimiter; ! _endDelim = endDelimiter; } *************** *** 99,104 **** } ! _startDelimiter = startDelimiter; ! _endDelimiter = endDelimiter; } --- 99,104 ---- } ! _startDelim = startDelimiter; ! _endDelim = endDelimiter; } *************** *** 140,178 **** } - /** - * This implementation is very inefficient and will be replaced soon by a - * optimized version. At least the functionality exists for now! - Manuel - */ private String replaceDelimitedSubstrings(String value) { StringBuffer buffer = null; ! for (Iterator it = _substringMap.entrySet().iterator(); it.hasNext();) { ! Map.Entry entry = (Map.Entry)it.next(); ! String original = _startDelimiter + entry.getKey() + _endDelimiter; ! String replacement = (String)entry.getValue(); ! ! int startIndex = 0; ! int lastEndIndex = 0; ! for(;;) { ! startIndex = value.indexOf(original, lastEndIndex); ! if (startIndex == -1) { ! if (buffer != null) { ! buffer.append(value.substring(lastEndIndex)); } ! break; } ! if (buffer == null) { ! buffer = new StringBuffer(); } ! buffer.append(value.substring(lastEndIndex, startIndex)); ! buffer.append(replacement); ! lastEndIndex = startIndex + original.length(); } } --- 140,188 ---- } private String replaceDelimitedSubstrings(String value) { StringBuffer buffer = null; ! int startIndex = 0; ! int endIndex = 0; ! int lastEndIndex = 0; ! for(;;) { ! startIndex = value.indexOf(_startDelim, lastEndIndex); ! if (startIndex != -1) { ! endIndex = value.indexOf(_endDelim, startIndex + _startDelim.length()); ! if (endIndex != -1) { ! if (buffer == null) { ! buffer = new StringBuffer(); } ! ! String substring = value.substring( ! startIndex + _startDelim.length(), endIndex); ! if (_substringMap.containsKey(substring)) ! { ! buffer.append(value.substring(lastEndIndex, startIndex)); ! buffer.append(_substringMap.get(substring)); ! } ! else ! { ! buffer.append(value.substring( ! lastEndIndex, endIndex + _endDelim.length())); ! } ! ! lastEndIndex = endIndex + _endDelim.length(); } + } ! // No more delimited substring ! if (startIndex == -1 || endIndex == -1) ! { ! if (buffer != null) { ! buffer.append(value.substring(lastEndIndex)); } ! break; } } *************** *** 211,215 **** // Substring replacement ! if (_startDelimiter != null && _endDelimiter != null) { return replaceDelimitedSubstrings((String)value); --- 221,225 ---- // Substring replacement ! if (_startDelim != null && _endDelim != null) { return replaceDelimitedSubstrings((String)value); |
From: <mla...@us...> - 2003-03-22 17:39:08
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv15799/dbunit/src/java/org/dbunit/dataset Modified Files: ReplacementDataSet.java Log Message: New constructor that allows passing object and substring mapping. Index: ReplacementDataSet.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/ReplacementDataSet.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ReplacementDataSet.java 20 Mar 2003 13:01:46 -0000 1.2 --- ReplacementDataSet.java 22 Mar 2003 17:28:00 -0000 1.3 *************** *** 56,59 **** --- 56,73 ---- /** + * Create a new ReplacementDataSet object that decorates the specified dataset. + * + * @param dataSet the decorated dataset + * @param objectMap the replacement objects mapping + * @param substringMap the replacement substrings mapping + */ + public ReplacementDataSet(IDataSet dataSet, Map objectMap, Map substringMap) + { + _dataSet = dataSet; + _objectMap = objectMap == null ? new HashMap() : objectMap; + _substringMap = substringMap == null ? new HashMap() : substringMap; + } + + /** * Add a new Object replacement mapping. * |
From: <mla...@us...> - 2003-03-21 03:14:53
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv19672/dbunit/src/test/org/dbunit/dataset Modified Files: AllTests.java Log Message: New dataset implementation that read/write MS Excel files. Each sheet represents a table. The first row of a sheet defines the columns names and remaining rows contains the data. Requires Jakarta POI 1.8.0 or later. Index: AllTests.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/AllTests.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** AllTests.java 18 Mar 2003 03:29:46 -0000 1.14 --- AllTests.java 21 Mar 2003 03:14:50 -0000 1.15 *************** *** 38,42 **** TestSuite suite = new TestSuite(); suite.addTest(org.dbunit.dataset.datatype.AllTests.suite()); ! // suite.addTest(org.dbunit.dataset.excel.AllTests.suite()); suite.addTest(org.dbunit.dataset.filter.AllTests.suite()); suite.addTest(org.dbunit.dataset.xml.AllTests.suite()); --- 38,42 ---- TestSuite suite = new TestSuite(); suite.addTest(org.dbunit.dataset.datatype.AllTests.suite()); ! suite.addTest(org.dbunit.dataset.excel.AllTests.suite()); suite.addTest(org.dbunit.dataset.filter.AllTests.suite()); suite.addTest(org.dbunit.dataset.xml.AllTests.suite()); |
From: <mla...@us...> - 2003-03-21 03:14:53
|
Update of /cvsroot/dbunit/dbunit/lib In directory sc8-pr-cvs1:/tmp/cvs-serv19672/dbunit/lib Added Files: jakarta-poi.jar Log Message: New dataset implementation that read/write MS Excel files. Each sheet represents a table. The first row of a sheet defines the columns names and remaining rows contains the data. Requires Jakarta POI 1.8.0 or later. --- NEW FILE: jakarta-poi.jar --- (This appears to be a binary file; contents omitted.) |
From: <mla...@us...> - 2003-03-21 03:14:53
|
Update of /cvsroot/dbunit/./dbunit/src/test/org/dbunit/dataset/excel In directory sc8-pr-cvs1:/tmp/cvs-serv19672/dbunit/src/test/org/dbunit/dataset/excel Added Files: XlsTableWriteTest.java XlsTableTest.java XlsDataSetTest.java AllTests.java Log Message: New dataset implementation that read/write MS Excel files. Each sheet represents a table. The first row of a sheet defines the columns names and remaining rows contains the data. Requires Jakarta POI 1.8.0 or later. --- NEW FILE: XlsTableWriteTest.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.excel; import org.dbunit.dataset.*; import org.dbunit.dataset.xml.FlatXmlDataSet; import org.dbunit.dataset.xml.XmlTableTest; import org.dbunit.dataset.xml.FlatXmlTableTest; import org.dbunit.Assertion; import java.io.*; /** * @author Manuel Laflamme * @since Feb 22, 2003 * @version $Revision: 1.1 $ */ public class XlsTableWriteTest extends XlsTableTest { public XlsTableWriteTest(String s) { super(s); } protected IDataSet createDataSet() throws Exception { File tempFile = File.createTempFile("tableWriteTest", ".xls"); // System.out.println(tempFile.getAbsoluteFile()); OutputStream out = new FileOutputStream(tempFile); try { // write source dataset in temp file try { XlsDataSet.write(super.createDataSet(), out); } finally { out.close(); } // load new dataset from temp file InputStream in = new FileInputStream(tempFile); try { return new XlsDataSet(in); } finally { in.close(); } } finally { tempFile.delete(); } } public void testGetValue() throws Exception { super.testGetValue(); } public void testWriteMultipleTable() throws Exception { int tableCount = 5; ITable sourceTable = super.createTable(); ITable[] tables = new ITable[tableCount]; for (int i = 0; i < tables.length; i++) { ITableMetaData metaData = new DefaultTableMetaData("table" + i, sourceTable.getTableMetaData().getColumns()); tables[i] = new CompositeTable(metaData, sourceTable); } IDataSet dataSet = new DefaultDataSet(tables); File tempFile = File.createTempFile("tableWriteTest", ".xls"); OutputStream out = new FileOutputStream(tempFile); try { // write DefaultTable in temp file try { XlsDataSet.write(dataSet, out); } finally { out.close(); } // load new dataset from temp file FileInputStream in = new FileInputStream(tempFile); try { XlsDataSet dataSet2 = new XlsDataSet(in); // verify each table for (int i = 0; i < tables.length; i++) { ITable table = tables[i]; Assertion.assertEquals(table, dataSet2.getTable(dataSet2.getTableNames()[i])); } } finally { in.close(); } } finally { tempFile.delete(); } } } --- NEW FILE: XlsTableTest.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.excel; import org.dbunit.dataset.AbstractTableTest; import org.dbunit.dataset.ITable; import org.dbunit.dataset.Column; import org.dbunit.dataset.IDataSet; import java.io.File; /** * @author Manuel Laflamme * @since Feb 21, 2003 * @version $Revision: 1.1 $ */ public class XlsTableTest extends AbstractTableTest { public XlsTableTest(String s) { super(s); } protected ITable createTable() throws Exception { return createDataSet().getTable("TEST_TABLE"); } protected IDataSet createDataSet() throws Exception { return new XlsDataSet(new File("src/xml/tableTest.xls")); } public void testGetMissingValue() throws Exception { int row = 0; Object[] expected = {"row 0 col 0", null, "row 0 col 2"}; ITable table = createDataSet().getTable("MISSING_VALUES"); Column[] columns = table.getTableMetaData().getColumns(); assertEquals("column count", expected.length, columns.length); assertEquals("row count", 1, table.getRowCount()); for (int i = 0; i < columns.length; i++) { assertEquals("value " + i, expected[i], table.getValue(row, columns[i].getColumnName())); } } } --- NEW FILE: XlsDataSetTest.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.excel; import org.dbunit.Assertion; import org.dbunit.dataset.AbstractDataSetTest; import org.dbunit.dataset.IDataSet; import org.dbunit.dataset.ITable; import java.io.*; /** * @author Manuel Laflamme * @since Feb 22, 2003 * @version $Revision: 1.1 $ */ public class XlsDataSetTest extends AbstractDataSetTest { public XlsDataSetTest(String s) { super(s); } protected IDataSet createDataSet() throws Exception { return new XlsDataSet(new File("src/xml/dataSetTest.xls")); } protected IDataSet createDuplicateDataSet() throws Exception { return new XlsDataSet( new File("src/xml/dataSetDuplicateTest.xls")); } public void testWrite() throws Exception { IDataSet expectedDataSet = createDataSet(); File tempFile = File.createTempFile("xlsDataSetTest", ".xls"); try { OutputStream out = new FileOutputStream(tempFile); // write dataset in temp file try { XlsDataSet.write(expectedDataSet, out); } finally { out.close(); } // load new dataset from temp file InputStream in = new FileInputStream(tempFile); try { IDataSet actualDataSet = new XlsDataSet(in); // verify table count assertEquals("table count", expectedDataSet.getTableNames().length, actualDataSet.getTableNames().length); // verify each table ITable[] expected = expectedDataSet.getTables(); ITable[] actual = actualDataSet.getTables(); assertEquals("table count", expected.length, actual.length); for (int i = 0; i < expected.length; i++) { String expectedName = expected[i].getTableMetaData().getTableName(); String actualName = actual[i].getTableMetaData().getTableName(); assertEquals("table name", expectedName, actualName); assertTrue("not same instance", expected[i] != actual[i]); Assertion.assertEquals(expected[i], actual[i]); } } finally { in.close(); } } finally { tempFile.delete(); } } public void testDuplicateWrite() throws Exception { IDataSet expectedDataSet = createDuplicateDataSet(); File tempFile = File.createTempFile("xlsDataSetDuplicateTest", ".xls"); try { OutputStream out = new FileOutputStream(tempFile); // write dataset in temp file try { XlsDataSet.write(expectedDataSet, out); } finally { out.close(); } // load new dataset from temp file InputStream in = new FileInputStream(tempFile); try { IDataSet actualDataSet = new XlsDataSet(in); // verify table count assertEquals("table count", expectedDataSet.getTableNames().length, actualDataSet.getTableNames().length); // verify each table ITable[] expected = expectedDataSet.getTables(); ITable[] actual = actualDataSet.getTables(); assertEquals("table count", expected.length, actual.length); for (int i = 0; i < expected.length; i++) { String expectedName = expected[i].getTableMetaData().getTableName(); String actualName = actual[i].getTableMetaData().getTableName(); assertEquals("table name", expectedName, actualName); assertTrue("not same instance", expected[i] != actual[i]); Assertion.assertEquals(expected[i], actual[i]); } } finally { in.close(); } } finally { tempFile.delete(); } } } --- NEW FILE: AllTests.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.excel; import junit.framework.Test; import junit.framework.TestSuite; /** * @author Manuel Laflamme * @since Mar 8, 2003 * @version $Revision: 1.1 $ */ public class AllTests { public static Test suite() { TestSuite suite = new TestSuite(); suite.addTest(new TestSuite(XlsDataSetTest.class)); suite.addTest(new TestSuite(XlsTableTest.class)); suite.addTest(new TestSuite(XlsTableWriteTest.class)); return suite; } } |
From: <mla...@us...> - 2003-03-21 03:14:53
|
Update of /cvsroot/dbunit/./dbunit/src/java/org/dbunit/dataset/excel In directory sc8-pr-cvs1:/tmp/cvs-serv19672/dbunit/src/java/org/dbunit/dataset/excel Added Files: XlsDataSet.java XlsTable.java Log Message: New dataset implementation that read/write MS Excel files. Each sheet represents a table. The first row of a sheet defines the columns names and remaining rows contains the data. Requires Jakarta POI 1.8.0 or later. --- NEW FILE: XlsDataSet.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.excel; import org.dbunit.dataset.*; import org.dbunit.dataset.datatype.DataType; import electric.xml.Document; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import java.io.*; /** * @author Manuel Laflamme * @since Feb 21, 2003 * @version $Revision: 1.1 $ */ public class XlsDataSet extends AbstractDataSet { private final ITable[] _tables; public XlsDataSet(File file) throws IOException, DataSetException { this(new FileInputStream(file)); } public XlsDataSet(InputStream in) throws IOException, DataSetException { HSSFWorkbook workbook = new HSSFWorkbook(in); _tables = new ITable[workbook.getNumberOfSheets()]; for (int i = 0; i < _tables.length; i++) { _tables[i] = new XlsTable(workbook.getSheetName(i), workbook.getSheetAt(i)); } } /** * Write the specified dataset to the specified output stream as a xls * document. */ public static void write(IDataSet dataSet, OutputStream out) throws IOException, DataSetException { HSSFWorkbook workbook = new HSSFWorkbook(); ITable[] tables = dataSet.getTables(); for (int i = 0; i < tables.length; i++) { // create the table i.e. sheet ITable table = tables[i]; ITableMetaData metaData = table.getTableMetaData(); HSSFSheet sheet = workbook.createSheet(metaData.getTableName()); // write table metadata i.e. first row in sheet workbook.setSheetName(i, metaData.getTableName()); HSSFRow headerRow = sheet.createRow(0); Column[] columns = metaData.getColumns(); for (int j = 0; j < columns.length; j++) { Column column = columns[j]; HSSFCell cell = headerRow.createCell((short)j); cell.setCellValue(column.getColumnName()); } // write table data for (int j = 0; j < table.getRowCount(); j++) { HSSFRow row = sheet.createRow(j + 1); for (int k = 0; k < columns.length; k++) { Column column = columns[k]; Object value = table.getValue(j, column.getColumnName()); if (value != null) { HSSFCell cell = row.createCell((short)k); cell.setCellValue(DataType.asString(value)); } } } } // write xls document workbook.write(out); out.flush(); } //////////////////////////////////////////////////////////////////////////// // IDataSet interface public ITable[] getTables() throws DataSetException { return cloneTables(_tables); } } --- NEW FILE: XlsTable.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.excel; import org.dbunit.dataset.*; import org.dbunit.dataset.datatype.DataType; import org.dbunit.dataset.datatype.DataTypeException; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFDateUtil; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import java.math.BigDecimal; import java.util.List; import java.util.ArrayList; /** * @author Manuel Laflamme * @since Feb 21, 2003 * @version $Revision: 1.1 $ */ public class XlsTable extends AbstractTable { private final ITableMetaData _metaData; private final HSSFSheet _sheet; public XlsTable(String sheetName, HSSFSheet sheet) throws DataSetException { int rowCount = sheet.getLastRowNum(); if (rowCount > 0) { _metaData = createMetaData(sheetName, sheet.getRow(0)); } else { _metaData = new DefaultTableMetaData(sheetName, new Column[0]); } _sheet = sheet; } static ITableMetaData createMetaData(String tableName, HSSFRow sampleRow) { List columnList = new ArrayList(); for (int i = 0; ; i++) { HSSFCell cell = sampleRow.getCell((short)i); if (cell == null) { break; } Column column = new Column(cell.getStringCellValue(), DataType.UNKNOWN); columnList.add(column); } Column[] columns = (Column[])columnList.toArray(new Column[0]); return new DefaultTableMetaData(tableName, columns); } //////////////////////////////////////////////////////////////////////////// // ITable interface public int getRowCount() { return _sheet.getLastRowNum(); } public ITableMetaData getTableMetaData() { return _metaData; } public Object getValue(int row, String column) throws DataSetException { assertValidRowIndex(row); int columnIndex = getColumnIndex(column); HSSFCell cell = _sheet.getRow(row + 1).getCell((short)columnIndex); if (cell == null) { return null; } int type = cell.getCellType(); switch (type) { case HSSFCell.CELL_TYPE_NUMERIC: if (HSSFDateUtil.isCellDateFormatted(cell)) { return cell.getDateCellValue(); } return new BigDecimal(cell.getNumericCellValue()); case HSSFCell.CELL_TYPE_STRING: return cell.getStringCellValue(); 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); } } } |
From: <mla...@us...> - 2003-03-21 03:14:52
|
Update of /cvsroot/dbunit/./dbunit/src/xml In directory sc8-pr-cvs1:/tmp/cvs-serv19672/dbunit/src/xml Added Files: dataSetDuplicateTest.xls tableTest.xls dataSetTest.xls Log Message: New dataset implementation that read/write MS Excel files. Each sheet represents a table. The first row of a sheet defines the columns names and remaining rows contains the data. Requires Jakarta POI 1.8.0 or later. --- NEW FILE: dataSetDuplicateTest.xls --- (This appears to be a binary file; contents omitted.) --- NEW FILE: tableTest.xls --- (This appears to be a binary file; contents omitted.) --- NEW FILE: dataSetTest.xls --- (This appears to be a binary file; contents omitted.) |
From: <mla...@us...> - 2003-03-20 13:01:49
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv31903/dbunit/src/test/org/dbunit/dataset Modified Files: ReplacementTableTest.java Log Message: Added substring delimiters support. This implementation is very inefficient and will be replaced soon by an optimized version. At least the functionality exists for now! Index: ReplacementTableTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/ReplacementTableTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ReplacementTableTest.java 19 Mar 2003 01:57:38 -0000 1.2 --- ReplacementTableTest.java 20 Mar 2003 13:01:46 -0000 1.3 *************** *** 171,174 **** --- 171,257 ---- } + public void testDelimitedSubstringReplacement() throws Exception + { + String tableName = "TABLE_NAME"; + + Column[] columns = new Column[] { + new Column("ONLY_SUBSTRING", DataType.CHAR), + new Column("START_SUBSTRING", DataType.CHAR), + new Column("MIDDLE_SUBSTRING", DataType.CHAR), + new Column("END_SUBSTRING", DataType.CHAR), + new Column("MULTIPLE_SUBSTRING", DataType.CHAR), + new Column("NO_SUBSTRING", DataType.CHAR), + new Column("NOT_A_STRING", DataType.NUMERIC), + new Column("NULL_VALUE", DataType.CHAR), + new Column("ONLY_NONDELIMITED_SUBSTRING", DataType.CHAR), + new Column("START_NONDELIMITED_SUBSTRING", DataType.CHAR), + new Column("MIDDLE_NONDELIMITED_SUBSTRING", DataType.CHAR), + new Column("END_NONDELIMITED_SUBSTRING", DataType.CHAR), + new Column("MULTIPLE_NONDELIMITED_SUBSTRING", DataType.CHAR), + new Column("BAD_DELIMITED_SUBSTRING1", DataType.CHAR), + new Column("BAD_DELIMITED_SUBSTRING2", DataType.CHAR), + new Column("BAD_DELIMITED_SUBSTRING3", DataType.CHAR), + new Column("BAD_DELIMITED_SUBSTRING4", DataType.CHAR), + new Column("BAD_DELIMITED_SUBSTRING5", DataType.CHAR), + }; + + // Setup actual table + Object[] actualRow = new Object[] { + "${substring}", + "${substring}_", + "_${substring}_", + "_${substring}", + "${substring}${substring} ${substring}", + "this is a string", + new Long(0), + null, + "substring", + "substring_", + "_substring_", + "_substring", + "substringsubstring substring", + "_${substring_", + "_$substring}_", + "_substring}_", + "${substring${substring} ${substring}", + "${substringsubstring} ${substring}", + }; + + List actualRowList = new ArrayList(); + actualRowList.add(actualRow); + ITable originalTable = new DefaultTable(tableName, columns, actualRowList); + ReplacementTable actualTable = new ReplacementTable(originalTable); + actualTable.addReplacementSubstring("substring", "replacement"); + actualTable.setSubstringDelimiters("${", "}"); + + // Setup expected table + Object[] expectedRow = new Object[] { + "replacement", + "replacement_", + "_replacement_", + "_replacement", + "replacementreplacement replacement", + "this is a string", + new Long(0), + null, + "substring", + "substring_", + "_substring_", + "_substring", + "substringsubstring substring", + "_${substring_", + "_$substring}_", + "_substring}_", + "${substringreplacement replacement", + "${substringsubstring} replacement", + }; + + List expectedRowList = new ArrayList(); + expectedRowList.add(expectedRow); + ITable expectedTable = new DefaultTable(tableName, columns, expectedRowList); + + Assertion.assertEquals(expectedTable, actualTable); + } + public void testAddNullReplacementSubstring() throws Exception { |
From: <mla...@us...> - 2003-03-20 13:01:49
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv31903/dbunit/src/java/org/dbunit/dataset Modified Files: ReplacementDataSet.java ReplacementTable.java Log Message: Added substring delimiters support. This implementation is very inefficient and will be replaced soon by an optimized version. At least the functionality exists for now! Index: ReplacementDataSet.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/ReplacementDataSet.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ReplacementDataSet.java 18 Mar 2003 03:29:47 -0000 1.1 --- ReplacementDataSet.java 20 Mar 2003 13:01:46 -0000 1.2 *************** *** 22,28 **** import java.util.ArrayList; import java.util.List; import java.util.Map; - import java.util.HashMap; /** --- 22,28 ---- import java.util.ArrayList; + import java.util.HashMap; import java.util.List; import java.util.Map; /** *************** *** 39,42 **** --- 39,45 ---- private final Map _objectMap; private final Map _substringMap; + private String _startDelimiter; + private String _endDelimiter; + /** *************** *** 80,83 **** --- 83,106 ---- } + /** + * Sets substring delimiters. + */ + public void setSubstringDelimiters(String startDelimiter, String endDelimiter) + { + if (startDelimiter == null || endDelimiter == null) + { + throw new NullPointerException(); + } + + _startDelimiter = startDelimiter; + _endDelimiter = endDelimiter; + } + + private ReplacementTable createReplacementTable(ITable table) + { + return new ReplacementTable(table, _objectMap, _substringMap, + _startDelimiter, _endDelimiter); + } + //////////////////////////////////////////////////////////////////////////// // IDataSet interface *************** *** 96,101 **** public ITable getTable(String tableName) throws DataSetException { ! return new ReplacementTable(_dataSet.getTable(tableName), _objectMap, ! _substringMap); } --- 119,123 ---- public ITable getTable(String tableName) throws DataSetException { ! return createReplacementTable(_dataSet.getTable(tableName)); } *************** *** 107,114 **** { ITable table = tables[i]; ! tableList.add(new ReplacementTable(table, _objectMap, _substringMap)); } return (ITable[])tableList.toArray(new ITable[0]); } - } --- 129,135 ---- { ITable table = tables[i]; ! tableList.add(createReplacementTable(table)); } return (ITable[])tableList.toArray(new ITable[0]); } } Index: ReplacementTable.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/ReplacementTable.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ReplacementTable.java 18 Mar 2003 12:49:37 -0000 1.2 --- ReplacementTable.java 20 Mar 2003 13:01:46 -0000 1.3 *************** *** 21,28 **** package org.dbunit.dataset; - import java.math.BigDecimal; - import java.util.Map; import java.util.HashMap; import java.util.Iterator; /** --- 21,27 ---- package org.dbunit.dataset; import java.util.HashMap; import java.util.Iterator; + import java.util.Map; /** *************** *** 39,42 **** --- 38,43 ---- private final Map _objectMap; private final Map _substringMap; + private String _startDelimiter; + private String _endDelimiter; /** *************** *** 47,58 **** public ReplacementTable(ITable table) { ! this(table, new HashMap(), new HashMap()); } ! ReplacementTable(ITable table, Map objectMap, Map substringMap) { _table = table; _objectMap = objectMap; _substringMap = substringMap; } --- 48,62 ---- public ReplacementTable(ITable table) { ! this(table, new HashMap(), new HashMap(), null, null); } ! public ReplacementTable(ITable table, Map objectMap, Map substringMap, ! String startDelimiter, String endDelimiter) { _table = table; _objectMap = objectMap; _substringMap = substringMap; + _startDelimiter = startDelimiter; + _endDelimiter = endDelimiter; } *************** *** 85,136 **** } ! //////////////////////////////////////////////////////////////////////// ! // ITable interface ! ! public ITableMetaData getTableMetaData() { ! return _table.getTableMetaData(); ! } ! public int getRowCount() ! { ! return _table.getRowCount(); } ! public Object getValue(int row, String column) throws DataSetException { ! Object objectValue = _table.getValue(row, column); ! // Object replacement ! if (_objectMap.containsKey(objectValue)) { ! return _objectMap.get(objectValue); ! } ! // Stop here if substring replacement not applicable ! if (_substringMap.size() == 0 || !(objectValue instanceof String)) ! { ! return objectValue; } ! // Substring replacement ! String stringValue = (String)objectValue; for (Iterator it = _substringMap.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry)it.next(); ! String original = (String)entry.getKey(); String replacement = (String)entry.getValue(); int startIndex = 0; int lastEndIndex = 0; - StringBuffer buffer = null; for(;;) { ! startIndex = stringValue.indexOf(original, lastEndIndex); if (startIndex == -1) { if (buffer != null) { ! buffer.append(stringValue.substring(lastEndIndex)); } break; --- 89,167 ---- } ! /** ! * Sets substring delimiters. ! */ ! public void setSubstringDelimiters(String startDelimiter, String endDelimiter) { ! if (startDelimiter == null || endDelimiter == null) ! { ! throw new NullPointerException(); ! } ! _startDelimiter = startDelimiter; ! _endDelimiter = endDelimiter; } ! private String replaceSubstrings(String value) { ! StringBuffer buffer = null; ! for (Iterator it = _substringMap.entrySet().iterator(); it.hasNext();) { ! Map.Entry entry = (Map.Entry)it.next(); ! String original = (String)entry.getKey(); ! String replacement = (String)entry.getValue(); ! int startIndex = 0; ! int lastEndIndex = 0; ! for(;;) ! { ! startIndex = value.indexOf(original, lastEndIndex); ! if (startIndex == -1) ! { ! if (buffer != null) ! { ! buffer.append(value.substring(lastEndIndex)); ! } ! break; ! } ! ! if (buffer == null) ! { ! buffer = new StringBuffer(); ! } ! buffer.append(value.substring(lastEndIndex, startIndex)); ! buffer.append(replacement); ! lastEndIndex = startIndex + original.length(); ! } } ! return buffer == null ? value : buffer.toString(); ! } ! ! /** ! * This implementation is very inefficient and will be replaced soon by a ! * optimized version. At least the functionality exists for now! - Manuel ! */ ! private String replaceDelimitedSubstrings(String value) ! { ! StringBuffer buffer = null; ! for (Iterator it = _substringMap.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry)it.next(); ! String original = _startDelimiter + entry.getKey() + _endDelimiter; String replacement = (String)entry.getValue(); int startIndex = 0; int lastEndIndex = 0; for(;;) { ! startIndex = value.indexOf(original, lastEndIndex); if (startIndex == -1) { if (buffer != null) { ! buffer.append(value.substring(lastEndIndex)); } break; *************** *** 141,156 **** buffer = new StringBuffer(); } ! buffer.append(stringValue.substring(lastEndIndex, startIndex)); buffer.append(replacement); lastEndIndex = startIndex + original.length(); } ! if (buffer != null) ! { ! return buffer.toString(); ! } } ! return objectValue; } } --- 172,219 ---- buffer = new StringBuffer(); } ! buffer.append(value.substring(lastEndIndex, startIndex)); buffer.append(replacement); lastEndIndex = startIndex + original.length(); } + } ! return buffer == null ? value : buffer.toString(); ! } ! ! //////////////////////////////////////////////////////////////////////// ! // ITable interface ! ! public ITableMetaData getTableMetaData() ! { ! return _table.getTableMetaData(); ! } ! ! public int getRowCount() ! { ! return _table.getRowCount(); ! } ! ! public Object getValue(int row, String column) throws DataSetException ! { ! Object value = _table.getValue(row, column); ! ! // Object replacement ! if (_objectMap.containsKey(value)) ! { ! return _objectMap.get(value); } ! // Stop here if substring replacement not applicable ! if (_substringMap.size() == 0 || !(value instanceof String)) ! { ! return value; ! } ! ! // Substring replacement ! if (_startDelimiter != null && _endDelimiter != null) ! { ! return replaceDelimitedSubstrings((String)value); ! } ! return replaceSubstrings((String)value); } } |
From: <mla...@us...> - 2003-03-20 04:09:10
|
Update of /cvsroot/dbunit/dbunit In directory sc8-pr-cvs1:/tmp/cvs-serv1432/dbunit Modified Files: todo.txt Log Message: Updated todo list. Index: todo.txt =================================================================== RCS file: /cvsroot/dbunit/dbunit/todo.txt,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** todo.txt 20 Mar 2003 03:07:27 -0000 1.9 --- todo.txt 20 Mar 2003 04:09:07 -0000 1.10 *************** *** 1,7 **** Documentation: ! * Convert existing website documentation to Jakarta-site2 XML format and generate HTML using Anakia. Maven and Cocoon are possible alternative. Actually the website is edited with Dreamweaver. * Improve Javadoc. Many classes have no or very little javadoc documentation. * Document DbUnit dependency (library + version + license). --- 1,10 ---- Documentation: ! * Convert existing website documentation to Jakarta-site2 XML format and ! generate HTML using Anakia. Maven and Cocoon are possible alternative. ! Actually the website is edited with Dreamweaver. * Improve Javadoc. Many classes have no or very little javadoc documentation. + http://sourceforge.net/tracker/index.php?func=detail&aid=589218&group_id=47439&atid=449494 * Document DbUnit dependency (library + version + license). *************** *** 12,21 **** * Alternate DTD export method using choice (OR) instead sequence (AND). ! * Replace system properties with a DatabaseConfig class pushed to the DatabaseConnection. This is possible to replace all system properties with this class because they are all related to database connection. ! * DisableConstrainsOperation??? The way to disable/enable database constraints is vendor specific so this is impossible to implement on all RDMS platform. Big question, is the performance acceptable??? http://sourceforge.net/mailarchive/message.php?msg_id=4148317 ! * Determine the table sequence in DatabaseDataSet according exported/imported keys using information from DatabaseMetaData. Make it configurable because of performance cost. Make it a subclass of SequenceTableFilter??? --- --- 15,44 ---- * Alternate DTD export method using choice (OR) instead sequence (AND). + http://sourceforge.net/mailarchive/message.php?msg_id=4127649 + http://sourceforge.net/mailarchive/message.php?msg_id=4148318 ! * Replace system properties with a DatabaseConfig class pushed to the ! DatabaseConnection. This is possible to replace all system properties with ! this class because they are all related to database connection. ! * Make TABLE_TYPE configurable in DatabaseDataSet. ! http://sourceforge.net/mailarchive/message.php?msg_id=4179160 ! * Add configuration to limits the number of rows fetched from the database ! http://sourceforge.net/tracker/index.php?func=detail&aid=561202&group_id=47439&atid=449491 ! ! * DisableConstrainsOperation??? The way to disable/enable database constraints ! is vendor specific so this is impossible to implement on all RDMS platform. ! Big question, is the performance acceptable??? ! http://sourceforge.net/mailarchive/message.php?msg_id=4148317 ! ! * Determine the table sequence in DatabaseDataSet according exported/imported ! keys using information from DatabaseMetaData. Make it configurable because of ! performance cost. Make it a subclass of SequenceTableFilter??? ! http://sourceforge.net/mailarchive/message.php?msg_id=4156221 ! http://sourceforge.net/mailarchive/message.php?msg_id=4159237 ! ! * Validate XML against its DTD. This can greatly degrade XML loading performance. ! http://sourceforge.net/tracker/index.php?func=detail&aid=677408&group_id=47439&atid=449494 --- *************** *** 25,29 **** * Profile and improve DbUnit performance. ! * Improve performance/memory usage of XML datasets implementation (using SAX???). --- --- 48,54 ---- * Profile and improve DbUnit performance. ! * Improve performance/memory usage of XML datasets implementation. Use SAX??? ! Is it necessary??? I have some doubt since unit testing should use fairly ! small datasets. --- *************** *** 31,35 **** Environment: ! * Perform some cleanup in the DbUnit test suite (http://sourceforge.net/mailarchive/message.php?msg_id=3866272). ! ! --- 56,59 ---- Environment: ! * Perform some cleanup in the DbUnit test suite. ! http://sourceforge.net/mailarchive/message.php?msg_id=3866272 |