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-06 21:52:12
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/xml
In directory sc8-pr-cvs1:/tmp/cvs-serv24188/dbunit/src/test/org/dbunit/dataset/xml
Modified Files:
Tag: branch-iterator
FlatDtdDataSetTest.java
Log Message:
Added tests for dataset iterator() and reverseIterator() methods.
Index: FlatDtdDataSetTest.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/xml/FlatDtdDataSetTest.java,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -C2 -d -r1.8 -r1.8.2.1
*** FlatDtdDataSetTest.java 13 Mar 2003 02:24:12 -0000 1.8
--- FlatDtdDataSetTest.java 6 Apr 2003 21:52:09 -0000 1.8.2.1
***************
*** 92,96 ****
IDatabaseConnection connection =
DatabaseEnvironment.getInstance().getConnection();
! IDataSet dataSet = removeExtraTestTables(connection.createDataSet());
File tempFile = File.createTempFile("flatXmlDocType", ".dtd");
--- 92,96 ----
IDatabaseConnection connection =
DatabaseEnvironment.getInstance().getConnection();
! IDataSet dataSet = connection.createDataSet();
File tempFile = File.createTempFile("flatXmlDocType", ".dtd");
|
|
From: <mla...@us...> - 2003-04-06 21:52:12
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/database
In directory sc8-pr-cvs1:/tmp/cvs-serv24188/dbunit/src/test/org/dbunit/database
Modified Files:
Tag: branch-iterator
DatabaseDataSetTest.java
Log Message:
Added tests for dataset iterator() and reverseIterator() methods.
Index: DatabaseDataSetTest.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/database/DatabaseDataSetTest.java,v
retrieving revision 1.19
retrieving revision 1.19.4.1
diff -C2 -d -r1.19 -r1.19.4.1
*** DatabaseDataSetTest.java 13 Feb 2003 04:32:42 -0000 1.19
--- DatabaseDataSetTest.java 6 Apr 2003 21:52:08 -0000 1.19.4.1
***************
*** 23,34 ****
package org.dbunit.database;
- import org.dbunit.*;
import org.dbunit.DatabaseEnvironment;
! import org.dbunit.dataset.*;
import org.dbunit.dataset.datatype.DataType;
import java.util.Arrays;
import java.util.Comparator;
- import java.lang.reflect.Array;
/**
--- 23,39 ----
package org.dbunit.database;
import org.dbunit.DatabaseEnvironment;
! import org.dbunit.MSSQLServerEnvironment;
! import org.dbunit.dataset.AbstractDataSetTest;
! import org.dbunit.dataset.Column;
! import org.dbunit.dataset.DataSetUtils;
! import org.dbunit.dataset.DefaultTableMetaData;
! import org.dbunit.dataset.IDataSet;
! import org.dbunit.dataset.ITable;
! import org.dbunit.dataset.ITableMetaData;
import org.dbunit.dataset.datatype.DataType;
import java.util.Arrays;
import java.util.Comparator;
/**
***************
*** 72,101 ****
}
! protected IDataSet createDuplicateDataSet() throws Exception
! {
! throw new UnsupportedOperationException();
! }
!
! protected void sort(Object[] array)
{
! if (ITable[].class.isInstance(array))
! {
! Arrays.sort(array, new TableComparator());
! }
! else
! {
! Arrays.sort(array);
! }
}
! private class TableComparator implements Comparator
{
! public int compare(Object o1, Object o2)
! {
! String name1 = ((ITable)o1).getTableMetaData().getTableName();
! String name2 = ((ITable)o2).getTableMetaData().getTableName();
!
! return name1.compareTo(name2);
! }
}
--- 77,88 ----
}
! protected String[] getExpectedNames() throws Exception
{
! return _connection.createDataSet().getTableNames();
}
! protected IDataSet createDuplicateDataSet() throws Exception
{
! throw new UnsupportedOperationException();
}
***************
*** 164,168 ****
if (!(DatabaseEnvironment.getInstance() instanceof MSSQLServerEnvironment)){
String[] expectedNames = getExpectedNames();
! sort(expectedNames);
try
--- 151,155 ----
if (!(DatabaseEnvironment.getInstance() instanceof MSSQLServerEnvironment)){
String[] expectedNames = getExpectedNames();
! // sort(expectedNames);
try
***************
*** 173,179 ****
_connection.getConnection(), _connection.getSchema());
! IDataSet dataSet = removeExtraTestTables(connection.createDataSet());
String[] actualNames = dataSet.getTableNames();
! sort(actualNames);
assertEquals("name count", expectedNames.length, actualNames.length);
--- 160,166 ----
_connection.getConnection(), _connection.getSchema());
! IDataSet dataSet = connection.createDataSet();
String[] actualNames = dataSet.getTableNames();
! // sort(actualNames);
assertEquals("name count", expectedNames.length, actualNames.length);
|
|
From: <mla...@us...> - 2003-04-06 20:38:27
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset
In directory sc8-pr-cvs1:/tmp/cvs-serv21331/dbunit/src/test/org/dbunit/dataset
Modified Files:
Tag: branch-iterator
AllTests.java
Log Message:
Refactored test class that require same set of table names.
Index: AllTests.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/AllTests.java,v
retrieving revision 1.16
retrieving revision 1.16.2.1
diff -C2 -d -r1.16 -r1.16.2.1
*** AllTests.java 5 Apr 2003 14:34:26 -0000 1.16
--- AllTests.java 6 Apr 2003 20:38:24 -0000 1.16.2.1
***************
*** 48,51 ****
--- 48,52 ----
suite.addTest(new TestSuite(DataSetUtilsTest.class));
suite.addTest(new TestSuite(DefaultDataSetTest.class));
+ suite.addTest(new TestSuite(DefaultTableIteratorTest.class));
suite.addTest(new TestSuite(DefaultTableMetaDataTest.class));
suite.addTest(new TestSuite(DefaultTableTest.class));
|
|
From: <mla...@us...> - 2003-04-06 20:34:45
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/filter
In directory sc8-pr-cvs1:/tmp/cvs-serv19783/dbunit/src/test/org/dbunit/dataset/filter
Modified Files:
Tag: branch-iterator
AbstractTableFilterTest.java
Log Message:
Refactored test class that require same set of table names.
Index: AbstractTableFilterTest.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/filter/AbstractTableFilterTest.java,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -C2 -d -r1.2 -r1.2.2.1
*** AbstractTableFilterTest.java 19 Mar 2003 01:56:18 -0000 1.2
--- AbstractTableFilterTest.java 6 Apr 2003 20:34:43 -0000 1.2.2.1
***************
*** 21,32 ****
package org.dbunit.dataset.filter;
! import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.CompositeDataSet;
import org.dbunit.dataset.DefaultDataSet;
import org.dbunit.dataset.DefaultTable;
import org.dbunit.dataset.xml.XmlDataSet;
- import junit.framework.TestCase;
-
import java.io.FileReader;
--- 21,31 ----
package org.dbunit.dataset.filter;
! import org.dbunit.dataset.AbstractTest;
import org.dbunit.dataset.CompositeDataSet;
import org.dbunit.dataset.DefaultDataSet;
import org.dbunit.dataset.DefaultTable;
+ import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.xml.XmlDataSet;
import java.io.FileReader;
***************
*** 36,87 ****
* @version $Revision$
*/
! public abstract class AbstractTableFilterTest extends TestCase
{
- private static final String[] TABLE_NAMES = {
- "TEST_TABLE",
- "SECOND_TABLE",
- "EMPTY_TABLE",
- "PK_TABLE",
- "ONLY_PK_TABLE",
- "EMPTY_MULTITYPE_TABLE",
- };
-
- private static final String[] DUPLICATE_TABLE_NAMES = {
- "DUPLICATE_TABLE",
- "EMPTY_TABLE",
- "DUPLICATE_TABLE",
- };
-
- private static final String EXTRA_TABLE_NAME = "EXTRA_TABLE";
public AbstractTableFilterTest(String s)
{
super(s);
- }
-
- protected String[] getExpectedNames() throws Exception
- {
- return (String[])TABLE_NAMES.clone();
- }
-
- protected String[] getExpectedLowerNames() throws Exception
- {
- String[] names = (String[])TABLE_NAMES.clone();
- for (int i = 0; i < names.length; i++)
- {
- names[i] = names[i].toLowerCase();
- }
-
- return names;
- }
-
- protected String[] getExpectedDuplicateNames()
- {
- return (String[])DUPLICATE_TABLE_NAMES.clone();
- }
-
- public String getExtraTableName()
- {
- return EXTRA_TABLE_NAME;
}
--- 35,45 ----
* @version $Revision$
*/
! public abstract class AbstractTableFilterTest
! extends AbstractTest
{
public AbstractTableFilterTest(String s)
{
super(s);
}
|
|
From: <mla...@us...> - 2003-04-06 20:34:45
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset
In directory sc8-pr-cvs1:/tmp/cvs-serv19783/dbunit/src/test/org/dbunit/dataset
Modified Files:
Tag: branch-iterator
AbstractDataSetTest.java
Added Files:
Tag: branch-iterator
AbstractTest.java DefaultTableIteratorTest.java
Log Message:
Refactored test class that require same set of table names.
--- NEW FILE: AbstractTest.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;
import junit.framework.TestCase;
/**
* @author Manuel Laflamme
* @since Apr 6, 2003
* @version $Revision: 1.1.2.1 $
*/
public class AbstractTest extends TestCase
{
private static final String[] TABLE_NAMES = {
"TEST_TABLE",
"SECOND_TABLE",
"EMPTY_TABLE",
"PK_TABLE",
"ONLY_PK_TABLE",
"EMPTY_MULTITYPE_TABLE",
};
private static final String[] DUPLICATE_TABLE_NAMES = {
"DUPLICATE_TABLE",
"EMPTY_TABLE",
"DUPLICATE_TABLE",
};
private static final String EXTRA_TABLE_NAME = "EXTRA_TABLE";
public AbstractTest(String s)
{
super(s);
}
protected String[] getExpectedNames() throws Exception
{
return (String[])AbstractTest.TABLE_NAMES.clone();
}
protected String[] getExpectedLowerNames() throws Exception
{
String[] names = (String[])AbstractTest.TABLE_NAMES.clone();
for (int i = 0; i < names.length; i++)
{
names[i] = names[i].toLowerCase();
}
return names;
}
protected String[] getExpectedDuplicateNames()
{
return (String[])AbstractTest.DUPLICATE_TABLE_NAMES.clone();
}
protected String getDuplicateTableName()
{
return "DUPLICATE_TABLE";
}
public String getExtraTableName()
{
return AbstractTest.EXTRA_TABLE_NAME;
}
}
--- NEW FILE: DefaultTableIteratorTest.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;
import java.util.ArrayList;
import java.util.List;
/**
* @author Manuel Laflamme
* @since Apr 6, 2003
* @version $Revision: 1.1.2.1 $
*/
public class DefaultTableIteratorTest extends AbstractTest
{
public DefaultTableIteratorTest(String s)
{
super(s);
}
protected ITableIterator getIterator() throws Exception
{
List tableList = new ArrayList();
String[] names = getExpectedNames();
for (int i = 0; i < names.length; i++)
{
String name = names[i];
tableList.add(new DefaultTable(name));
}
ITable[] tables = (ITable[])tableList.toArray(new ITable[0]);
return new DefaultTableIterator(tables);
}
protected ITableIterator getEmptyIterator()
{
return new DefaultTableIterator(new ITable[0]);
}
public void testNext() throws Exception
{
int count = 0;
String[] names = getExpectedNames();
ITableIterator iterator = getIterator();
while(iterator.next())
{
count++;
}
assertEquals("count", names.length, count);
}
public void testNextAndEmpty() throws Exception
{
int count = 0;
ITableIterator iterator = getEmptyIterator();
while(iterator.next())
{
count++;
}
assertEquals("count", 0, count);
}
public void testGetTableMetaData() throws Exception
{
int i = 0;
String[] names = getExpectedNames();
ITableIterator iterator = getIterator();
while(iterator.next())
{
assertEquals("name " + i, names[i],
iterator.getTableMetaData().getTableName());
i++;
}
assertEquals("count", names.length, i);
}
public void testGetTableMetaDataBeforeNext() throws Exception
{
ITableIterator iterator = getIterator();
try
{
iterator.getTableMetaData();
fail("Should have throw a ???Exception");
}
catch (IndexOutOfBoundsException e)
{
}
int i = 0;
String[] names = getExpectedNames();
while(iterator.next())
{
assertEquals("name " + i, names[i],
iterator.getTableMetaData().getTableName());
i++;
}
assertEquals("count", names.length, i);
}
public void testGetTableMetaDataAfterLastNext() throws Exception
{
int count = 0;
String[] names = getExpectedNames();
ITableIterator iterator = getIterator();
while(iterator.next())
{
count++;
}
assertEquals("count", names.length, count);
try
{
iterator.getTableMetaData();
fail("Should have throw a ???Exception");
}
catch (IndexOutOfBoundsException e)
{
}
}
public void testGetTable() throws Exception
{
int i = 0;
String[] names = getExpectedNames();
ITableIterator iterator = getIterator();
while(iterator.next())
{
assertEquals("name " + i, names[i],
iterator.getTable().getTableMetaData().getTableName());
i++;
}
assertEquals("count", names.length, i);
}
}
Index: AbstractDataSetTest.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/AbstractDataSetTest.java,v
retrieving revision 1.19
retrieving revision 1.19.4.1
diff -C2 -d -r1.19 -r1.19.4.1
*** AbstractDataSetTest.java 16 Feb 2003 06:01:00 -0000 1.19
--- AbstractDataSetTest.java 6 Apr 2003 20:34:42 -0000 1.19.4.1
***************
*** 25,31 ****
import org.dbunit.database.AmbiguousTableNameException;
! import java.util.*;
!
! import junit.framework.TestCase;
/**
--- 25,31 ----
import org.dbunit.database.AmbiguousTableNameException;
! import java.util.ArrayList;
! import java.util.Arrays;
! import java.util.List;
/**
***************
*** 33,53 ****
* @version $Revision$
*/
! public abstract class AbstractDataSetTest extends TestCase
{
- private static final String[] TABLE_NAMES = {
- "TEST_TABLE",
- "SECOND_TABLE",
- "EMPTY_TABLE",
- "PK_TABLE",
- "ONLY_PK_TABLE",
- "EMPTY_MULTITYPE_TABLE",
- };
-
- private static final String[] DUPLICATE_TABLE_NAMES = {
- "DUPLICATE_TABLE",
- "EMPTY_TABLE",
- "DUPLICATE_TABLE",
- };
-
public AbstractDataSetTest(String s)
{
--- 33,38 ----
* @version $Revision$
*/
! public abstract class AbstractDataSetTest extends AbstractTest
{
public AbstractDataSetTest(String s)
{
***************
*** 55,79 ****
}
- protected String[] getExpectedNames() throws Exception
- {
- return (String[])TABLE_NAMES.clone();
- }
-
- protected String[] getExpectedLowerNames() throws Exception
- {
- String[] names = (String[])TABLE_NAMES.clone();
- for (int i = 0; i < names.length; i++)
- {
- names[i] = names[i].toLowerCase();
- }
-
- return names;
- }
-
- protected String[] getExpectedDuplicateNames()
- {
- return (String[])DUPLICATE_TABLE_NAMES.clone();
- }
-
protected int[] getExpectedDuplicateRows()
{
--- 40,43 ----
***************
*** 81,94 ****
}
- protected String getDuplicateTableName()
- {
- return "DUPLICATE_TABLE";
- }
-
/**
* This method exclude BLOB_TABLE and CLOB_TABLE from the specified dataset
* because BLOB and CLOB are not supported by all database vendor. It also excludes
* tables with Identity columns (MSSQL) becasuse they are specific to MSSQL.
! * @todo Should be refactored into thee various DatabaseEnvironments!
*/
public static IDataSet removeExtraTestTables(IDataSet dataSet) throws Exception
--- 45,53 ----
}
/**
* This method exclude BLOB_TABLE and CLOB_TABLE from the specified dataset
* because BLOB and CLOB are not supported by all database vendor. It also excludes
* tables with Identity columns (MSSQL) becasuse they are specific to MSSQL.
! * TODO : should be refactored into thee various DatabaseEnvironments!
*/
public static IDataSet removeExtraTestTables(IDataSet dataSet) throws Exception
|
|
From: <mla...@us...> - 2003-04-06 17:27:21
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset
In directory sc8-pr-cvs1:/tmp/cvs-serv4558/dbunit/src/java/org/dbunit/dataset
Added Files:
Tag: branch-iterator
DefaultTableIterator.java ITableIterator.java
Log Message:
Added in branch.
--- NEW FILE: DefaultTableIterator.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;
/**
* @author Manuel Laflamme
* @since Apr 5, 2003
* @version $Revision: 1.2.2.1 $
*/
public class DefaultTableIterator implements ITableIterator
{
private final ITable[] _tables;
private int _index = -1;
public DefaultTableIterator(ITable[] tables)
{
_tables = tables;
}
public DefaultTableIterator(ITable[] tables, boolean reversed)
{
if (reversed)
{
ITable[] reverseTables = new ITable[tables.length];
for (int i = 0; i < tables.length; i++)
{
reverseTables[tables.length - 1 - i] = tables[i];
}
tables = reverseTables;
}
_tables = tables;
}
////////////////////////////////////////////////////////////////////////////
// ITableIterator interface
public boolean next() throws DataSetException
{
_index++;
return _index < _tables.length;
}
public ITableMetaData getTableMetaData() throws DataSetException
{
return getTable().getTableMetaData();
}
public ITable getTable() throws DataSetException
{
return _tables[_index];
}
}
--- NEW FILE: ITableIterator.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;
/**
* @author Manuel Laflamme
* @since Apr 5, 2003
* @version $Revision: 1.2.2.1 $
*/
public interface ITableIterator
{
/**
* Position this iterator to the next table. The iterator is initially
* positioned before the first table; the first call to the method next
* makes the first table the current table; the second call makes the
* second table the current table, and so on.
*
* @return <code>true</code> if the new current table is valid;
* <code>false</code> if there are no more table
*/
public boolean next() throws DataSetException;
/**
* Returns the metadata of the current table.
*/
public ITableMetaData getTableMetaData() throws DataSetException;
/**
* Returns the current table.
*/
public ITable getTable() throws DataSetException;
}
|
|
From: <mla...@us...> - 2003-04-06 17:24:36
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv3411/dbunit/src/java/org/dbunit/dataset Removed Files: DefaultTableIterator.java ITableIterator.java Log Message: Removed files that should have been added in "branch-iterator" instead of Main trunk. --- DefaultTableIterator.java DELETED --- --- ITableIterator.java DELETED --- |
Update of /cvsroot/dbunit/./dbunit/src/java/org/dbunit/dataset
In directory sc8-pr-cvs1:/tmp/cvs-serv10340/dbunit/src/java/org/dbunit/dataset
Modified Files:
Tag: branch-iterator
ReplacementDataSet.java SortedDataSet.java
FilteredDataSet.java CompositeDataSet.java
AbstractDataSet.java LowerCaseDataSet.java IDataSet.java
DefaultDataSet.java CaseInsensitiveDataSet.java
Added Files:
DefaultTableIterator.java ITableIterator.java
Log Message:
Added iterator() and reverseIterator() to IDataSet interface.
--- NEW FILE: DefaultTableIterator.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;
/**
* @author Manuel Laflamme
* @since Apr 5, 2003
* @version $Revision: 1.1 $
*/
public class DefaultTableIterator implements ITableIterator
{
private final ITable[] _tables;
private int _index = -1;
public DefaultTableIterator(ITable[] tables)
{
_tables = tables;
}
public DefaultTableIterator(ITable[] tables, boolean reversed)
{
if (reversed)
{
ITable[] reverseTables = new ITable[tables.length];
for (int i = 0; i < tables.length; i++)
{
reverseTables[tables.length - 1 - i] = tables[i];
}
tables = reverseTables;
}
_tables = tables;
}
////////////////////////////////////////////////////////////////////////////
// ITableIterator interface
public boolean next() throws DataSetException
{
_index++;
return _index < _tables.length;
}
public ITableMetaData getTableMetaData() throws DataSetException
{
return getTable().getTableMetaData();
}
public ITable getTable() throws DataSetException
{
return _tables[_index];
}
}
--- NEW FILE: ITableIterator.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;
/**
* @author Manuel Laflamme
* @since Apr 5, 2003
* @version $Revision: 1.1 $
*/
public interface ITableIterator
{
/**
* Position this iterator to the next table. The iterator is initially
* positioned before the first table; the first call to the method next
* makes the first table the current table; the second call makes the
* second table the current table, and so on.
*
* @return <code>true</code> if the new current table is valid;
* <code>false</code> if there are no more table
*/
public boolean next() throws DataSetException;
/**
* Returns the metadata of the current table.
*/
public ITableMetaData getTableMetaData() throws DataSetException;
/**
* Returns the current table.
*/
public ITable getTable() throws DataSetException;
}
Index: ReplacementDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/./dbunit/src/java/org/dbunit/dataset/ReplacementDataSet.java,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -C2 -d -r1.4 -r1.4.2.1
*** ReplacementDataSet.java 23 Mar 2003 04:31:55 -0000 1.4
--- ReplacementDataSet.java 6 Apr 2003 13:56:28 -0000 1.4.2.1
***************
*** 147,149 ****
--- 147,160 ----
return (ITable[])tableList.toArray(new ITable[0]);
}
+
+ public ITableIterator iterator() throws DataSetException
+ {
+ return new DefaultTableIterator(getTables(), false);
+ }
+
+ public ITableIterator reverseIterator() throws DataSetException
+ {
+ return new DefaultTableIterator(getTables(), true);
+ }
+
}
Index: SortedDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/./dbunit/src/java/org/dbunit/dataset/SortedDataSet.java,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -C2 -d -r1.1 -r1.1.4.1
*** SortedDataSet.java 20 Feb 2003 03:55:17 -0000 1.1
--- SortedDataSet.java 6 Apr 2003 13:56:29 -0000 1.1.4.1
***************
*** 44,52 ****
////////////////////////////////////////////////////////////////////////////
! // IDataSet interface
! public ITable[] getTables() throws DataSetException
{
! return cloneTables(_tables);
}
}
--- 44,53 ----
////////////////////////////////////////////////////////////////////////////
! // AbstractDataSet class
! protected ITableIterator createIterator(boolean reversed)
! throws DataSetException
{
! return new DefaultTableIterator(_tables, reversed);
}
}
Index: FilteredDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/./dbunit/src/java/org/dbunit/dataset/FilteredDataSet.java,v
retrieving revision 1.12
retrieving revision 1.12.2.1
diff -C2 -d -r1.12 -r1.12.2.1
*** FilteredDataSet.java 11 Mar 2003 13:26:03 -0000 1.12
--- FilteredDataSet.java 6 Apr 2003 13:56:29 -0000 1.12.2.1
***************
*** 102,105 ****
--- 102,115 ----
}
+ public ITableIterator iterator() throws DataSetException
+ {
+ return new DefaultTableIterator(getTables());
+ }
+
+ public ITableIterator reverseIterator() throws DataSetException
+ {
+ return new DefaultTableIterator(getTables(), true);
+ }
+
}
Index: CompositeDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/./dbunit/src/java/org/dbunit/dataset/CompositeDataSet.java,v
retrieving revision 1.11
retrieving revision 1.11.4.1
diff -C2 -d -r1.11 -r1.11.4.1
*** CompositeDataSet.java 15 Feb 2003 05:42:42 -0000 1.11
--- CompositeDataSet.java 6 Apr 2003 13:56:29 -0000 1.11.4.1
***************
*** 109,113 ****
}
! private ITable[] combineTables(ITable[] tables) throws DataSetException
{
List tableList = new ArrayList();
--- 109,113 ----
}
! private ITable[] combineTables(ITable[] tables) //throws DataSetException
{
List tableList = new ArrayList();
***************
*** 152,160 ****
////////////////////////////////////////////////////////////////////////////
! // IDataSet interface
! public ITable[] getTables() throws DataSetException
{
! return cloneTables(_tables);
}
}
--- 152,161 ----
////////////////////////////////////////////////////////////////////////////
! // AbstractDataSet class
! protected ITableIterator createIterator(boolean reversed)
! throws DataSetException
{
! return new DefaultTableIterator(_tables, reversed);
}
}
Index: AbstractDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/./dbunit/src/java/org/dbunit/dataset/AbstractDataSet.java,v
retrieving revision 1.9
retrieving revision 1.9.4.1
diff -C2 -d -r1.9 -r1.9.4.1
*** AbstractDataSet.java 13 Feb 2003 04:32:42 -0000 1.9
--- AbstractDataSet.java 6 Apr 2003 13:56:29 -0000 1.9.4.1
***************
*** 26,29 ****
--- 26,31 ----
import java.util.Arrays;
+ import java.util.List;
+ import java.util.ArrayList;
/**
***************
*** 47,50 ****
--- 49,55 ----
}
+ protected abstract ITableIterator createIterator(boolean reversed)
+ throws DataSetException;
+
////////////////////////////////////////////////////////////////////////////
// IDataSet interface
***************
*** 52,63 ****
public String[] getTableNames() throws DataSetException
{
! ITable[] tables = getTables();
! String[] tableNames = new String[tables.length];
! for (int i = 0; i < tables.length; i++)
{
! ITable table = tables[i];
! tableNames[i] = table.getTableMetaData().getTableName();
}
! return tableNames;
}
--- 57,67 ----
public String[] getTableNames() throws DataSetException
{
! List tableNameList = new ArrayList();
! ITableIterator iterator = createIterator(false);
! while (iterator.next())
{
! tableNameList.add(iterator.getTableMetaData().getTableName());
}
! return (String[])tableNameList.toArray(new String[0]);
}
***************
*** 70,77 ****
{
ITable found = null;
! ITable[] tables = getTables();
! for (int i = 0; i < tables.length; i++)
{
! ITable table = tables[i];
if (tableName.equalsIgnoreCase(table.getTableMetaData().getTableName()))
{
--- 74,81 ----
{
ITable found = null;
! ITableIterator iterator = createIterator(false);
! while (iterator.next())
{
! ITable table = iterator.getTable();
if (tableName.equalsIgnoreCase(table.getTableMetaData().getTableName()))
{
***************
*** 91,94 ****
--- 95,119 ----
throw new NoSuchTableException(tableName);
+ }
+
+ public ITable[] getTables() throws DataSetException
+ {
+ List tableList = new ArrayList();
+ ITableIterator iterator = createIterator(false);
+ while (iterator.next())
+ {
+ tableList.add(iterator.getTable());
+ }
+ return (ITable[])tableList.toArray(new ITable[0]);
+ }
+
+ public ITableIterator iterator() throws DataSetException
+ {
+ return createIterator(false);
+ }
+
+ public ITableIterator reverseIterator() throws DataSetException
+ {
+ return createIterator(true);
}
Index: LowerCaseDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/./dbunit/src/java/org/dbunit/dataset/LowerCaseDataSet.java,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -C2 -d -r1.1 -r1.1.4.1
*** LowerCaseDataSet.java 15 Feb 2003 05:42:42 -0000 1.1
--- LowerCaseDataSet.java 6 Apr 2003 13:56:29 -0000 1.1.4.1
***************
*** 63,71 ****
////////////////////////////////////////////////////////////////////////////
! // IDataSet interface
! public ITable[] getTables() throws DataSetException
{
! return cloneTables(_tables);
}
}
--- 63,72 ----
////////////////////////////////////////////////////////////////////////////
! // AbstractDataSet class
! protected ITableIterator createIterator(boolean reversed)
! throws DataSetException
{
! return new DefaultTableIterator(_tables, reversed);
}
}
Index: IDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/./dbunit/src/java/org/dbunit/dataset/IDataSet.java,v
retrieving revision 1.11
retrieving revision 1.11.2.1
diff -C2 -d -r1.11 -r1.11.2.1
*** IDataSet.java 11 Mar 2003 13:03:21 -0000 1.11
--- IDataSet.java 6 Apr 2003 13:56:29 -0000 1.11.2.1
***************
*** 68,71 ****
--- 68,74 ----
*/
public ITable[] getTables() throws DataSetException;
+
+ public ITableIterator iterator() throws DataSetException;
+ public ITableIterator reverseIterator() throws DataSetException;
}
Index: DefaultDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/./dbunit/src/java/org/dbunit/dataset/DefaultDataSet.java,v
retrieving revision 1.10
retrieving revision 1.10.2.1
diff -C2 -d -r1.10 -r1.10.2.1
*** DefaultDataSet.java 1 Apr 2003 21:15:37 -0000 1.10
--- DefaultDataSet.java 6 Apr 2003 13:56:29 -0000 1.10.2.1
***************
*** 23,29 ****
package org.dbunit.dataset;
- import java.util.List;
import java.util.ArrayList;
! import java.util.Arrays;
--- 23,28 ----
package org.dbunit.dataset;
import java.util.ArrayList;
! import java.util.List;
***************
*** 68,76 ****
////////////////////////////////////////////////////////////////////////////
! // IDataSet interface
! public ITable[] getTables() throws DataSetException
{
! return (ITable[])_tableList.toArray(new ITable[0]);
}
}
--- 67,77 ----
////////////////////////////////////////////////////////////////////////////
! // AbstractDataSet class
! protected ITableIterator createIterator(boolean reversed)
! throws DataSetException
{
! ITable[] tables = (ITable[])_tableList.toArray(new ITable[0]);
! return new DefaultTableIterator(tables, reversed);
}
}
Index: CaseInsensitiveDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/./dbunit/src/java/org/dbunit/dataset/CaseInsensitiveDataSet.java,v
retrieving revision 1.6
retrieving revision 1.6.4.1
diff -C2 -d -r1.6 -r1.6.4.1
*** CaseInsensitiveDataSet.java 26 Feb 2003 22:52:47 -0000 1.6
--- CaseInsensitiveDataSet.java 6 Apr 2003 13:56:29 -0000 1.6.4.1
***************
*** 79,82 ****
--- 79,93 ----
return _dataSet.getTables();
}
+
+ public ITableIterator iterator() throws DataSetException
+ {
+ return new DefaultTableIterator(getTables());
+ }
+
+ public ITableIterator reverseIterator() throws DataSetException
+ {
+ return new DefaultTableIterator(getTables(), true);
+ }
+
}
|
|
From: <mla...@us...> - 2003-04-06 13:57:03
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml
In directory sc8-pr-cvs1:/tmp/cvs-serv10340/dbunit/src/java/org/dbunit/dataset/xml
Modified Files:
Tag: branch-iterator
FlatXmlDataSet.java XmlDataSet.java FlatDtdDataSet.java
Log Message:
Added iterator() and reverseIterator() to IDataSet interface.
Index: FlatXmlDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/FlatXmlDataSet.java,v
retrieving revision 1.20
retrieving revision 1.20.2.1
diff -C2 -d -r1.20 -r1.20.2.1
*** FlatXmlDataSet.java 11 Mar 2003 13:00:07 -0000 1.20
--- FlatXmlDataSet.java 6 Apr 2003 13:56:28 -0000 1.20.2.1
***************
*** 423,433 ****
////////////////////////////////////////////////////////////////////////////
! // IDataSet interface
! public ITable[] getTables() throws DataSetException
{
! return cloneTables(_tables);
}
-
}
--- 423,433 ----
////////////////////////////////////////////////////////////////////////////
! // AbstractDataSet class
! protected ITableIterator createIterator(boolean reversed)
! throws DataSetException
{
! return new DefaultTableIterator(_tables, reversed);
}
}
Index: XmlDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/XmlDataSet.java,v
retrieving revision 1.15
retrieving revision 1.15.2.1
diff -C2 -d -r1.15 -r1.15.2.1
*** XmlDataSet.java 11 Mar 2003 13:00:07 -0000 1.15
--- XmlDataSet.java 6 Apr 2003 13:56:28 -0000 1.15.2.1
***************
*** 215,225 ****
////////////////////////////////////////////////////////////////////////////
! // IDataSet interface
! public ITable[] getTables() throws DataSetException
{
! return cloneTables(_tables);
}
-
}
--- 215,225 ----
////////////////////////////////////////////////////////////////////////////
! // AbstractDataSet class
! protected ITableIterator createIterator(boolean reversed)
! throws DataSetException
{
! return new DefaultTableIterator(_tables, reversed);
}
}
Index: FlatDtdDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/FlatDtdDataSet.java,v
retrieving revision 1.6
retrieving revision 1.6.4.1
diff -C2 -d -r1.6 -r1.6.4.1
*** FlatDtdDataSet.java 1 Mar 2003 06:51:17 -0000 1.6
--- FlatDtdDataSet.java 6 Apr 2003 13:56:28 -0000 1.6.4.1
***************
*** 13,22 ****
import org.dbunit.dataset.*;
import org.dbunit.dataset.datatype.DataType;
- import org.dbunit.database.AmbiguousTableNameException;
! import java.io.*;
! import java.util.*;
! import com.wutka.dtd.*;
/**
--- 13,40 ----
import org.dbunit.dataset.*;
import org.dbunit.dataset.datatype.DataType;
! import com.wutka.dtd.DTD;
! import com.wutka.dtd.DTDAttlist;
! import com.wutka.dtd.DTDAttribute;
! import com.wutka.dtd.DTDContainer;
! import com.wutka.dtd.DTDDecl;
! import com.wutka.dtd.DTDItem;
! import com.wutka.dtd.DTDName;
! import com.wutka.dtd.DTDParser;
! import java.io.IOException;
! import java.io.InputStream;
! import java.io.InputStreamReader;
! import java.io.OutputStream;
! import java.io.OutputStreamWriter;
! import java.io.PrintWriter;
! import java.io.Reader;
! import java.io.Writer;
! import java.util.ArrayList;
! import java.util.Arrays;
! import java.util.HashMap;
! import java.util.List;
! import java.util.Map;
! import java.util.Vector;
/**
***************
*** 150,183 ****
////////////////////////////////////////////////////////////////////////////
! // IDataSet interface
!
! public String[] getTableNames() throws DataSetException
! {
! return (String[])_tableNames.toArray(new String[0]);
! }
!
! // public ITableMetaData getTableMetaData(String tableName)
! // throws DataSetException
! // {
! // return getTable(tableName).getTableMetaData();
! // }
! //
! // public ITable getTable(String tableName) throws DataSetException
! // {
! // if (_tableNames.indexOf(tableName) != _tableNames.lastIndexOf(tableName))
! // {
! // throw new AmbiguousTableNameException(tableName);
! // }
! //
! // ITable table = (ITable)_tableMap.get(tableName);
! // if (table == null)
! // {
! // throw new NoSuchTableException(tableName);
! // }
! //
! // return table;
! // }
! public ITable[] getTables() throws DataSetException
{
String[] names = (String[])_tableNames.toArray(new String[0]);
--- 168,175 ----
////////////////////////////////////////////////////////////////////////////
! // AbstractDataSet class
! protected ITableIterator createIterator(boolean reversed)
! throws DataSetException
{
String[] names = (String[])_tableNames.toArray(new String[0]);
***************
*** 195,202 ****
}
! return tables;
}
}
--- 187,202 ----
}
! return new DefaultTableIterator(tables, reversed);
}
+ ////////////////////////////////////////////////////////////////////////////
+ // IDataSet interface
+
+ public String[] getTableNames() throws DataSetException
+ {
+ return (String[])_tableNames.toArray(new String[0]);
+ }
}
+
|
|
From: <mla...@us...> - 2003-04-06 13:56:36
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/excel
In directory sc8-pr-cvs1:/tmp/cvs-serv10340/dbunit/src/java/org/dbunit/dataset/excel
Modified Files:
Tag: branch-iterator
XlsDataSet.java
Log Message:
Added iterator() and reverseIterator() to IDataSet interface.
Index: XlsDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/excel/XlsDataSet.java,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -C2 -d -r1.2 -r1.2.2.1
*** XlsDataSet.java 23 Mar 2003 21:53:39 -0000 1.2
--- XlsDataSet.java 6 Apr 2003 13:56:32 -0000 1.2.2.1
***************
*** 19,26 ****
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;
--- 19,32 ----
package org.dbunit.dataset.excel;
! import org.dbunit.dataset.AbstractDataSet;
! import org.dbunit.dataset.Column;
! import org.dbunit.dataset.DataSetException;
! import org.dbunit.dataset.IDataSet;
! import org.dbunit.dataset.ITable;
! import org.dbunit.dataset.ITableMetaData;
! import org.dbunit.dataset.ITableIterator;
! import org.dbunit.dataset.DefaultTableIterator;
import org.dbunit.dataset.datatype.DataType;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
***************
*** 28,32 ****
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
! import java.io.*;
/**
--- 34,42 ----
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
! import java.io.File;
! import java.io.FileInputStream;
! import java.io.IOException;
! import java.io.InputStream;
! import java.io.OutputStream;
/**
***************
*** 117,125 ****
////////////////////////////////////////////////////////////////////////////
! // IDataSet interface
! public ITable[] getTables() throws DataSetException
{
! return cloneTables(_tables);
}
}
--- 127,136 ----
////////////////////////////////////////////////////////////////////////////
! // AbstractDataSet class
! protected ITableIterator createIterator(boolean reversed)
! throws DataSetException
{
! return new DefaultTableIterator(_tables, reversed);
}
}
|
|
From: <mla...@us...> - 2003-04-06 13:56:36
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/database
In directory sc8-pr-cvs1:/tmp/cvs-serv10340/dbunit/src/java/org/dbunit/database
Modified Files:
Tag: branch-iterator
QueryDataSet.java DatabaseDataSet.java
Log Message:
Added iterator() and reverseIterator() to IDataSet interface.
Index: QueryDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/QueryDataSet.java,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -C2 -d -r1.2 -r1.2.4.1
*** QueryDataSet.java 16 Feb 2003 06:27:27 -0000 1.2
--- QueryDataSet.java 6 Apr 2003 13:56:30 -0000 1.2.4.1
***************
*** 29,32 ****
--- 29,34 ----
import org.dbunit.dataset.DataSetException;
import org.dbunit.dataset.ITable;
+ import org.dbunit.dataset.ITableIterator;
+ import org.dbunit.dataset.DefaultTableIterator;
/**
***************
*** 66,96 ****
////////////////////////////////////////////////////////////////////////////
! // IDataSet interface
!
! /**
! * Gets the tableNames attribute of the QueryDataSet object
! *
! * @return An array of all the table names
! * @exception org.dbunit.dataset.DataSetException Thrown if there is an issue.
! */
! public String[] getTableNames() throws DataSetException
! {
! List names = new ArrayList();
! for (Iterator it = _tables.iterator(); it.hasNext();)
! {
! TableEntry entry = (TableEntry)it.next();
! names.add(entry.getTableName());
! }
!
! return (String[])names.toArray(new String[0]);
! }
! /**
! * Gets the tables attribute of the QueryDataSet object
! *
! * @return The tables value
! * @exception org.dbunit.dataset.DataSetException Thrown if there is an issue.
! */
! public ITable[] getTables() throws DataSetException
{
try
--- 68,74 ----
////////////////////////////////////////////////////////////////////////////
! // AbstractDataSet class
! protected ITableIterator createIterator(boolean reversed) throws DataSetException
{
try
***************
*** 111,115 ****
}
! return (ITable[])tableList.toArray(new ITable[0]);
}
catch (SQLException e)
--- 89,94 ----
}
! ITable[] tables = (ITable[])tableList.toArray(new ITable[0]);
! return new DefaultTableIterator(tables, reversed);
}
catch (SQLException e)
***************
*** 117,120 ****
--- 96,114 ----
throw new DataSetException(e);
}
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // IDataSet interface
+
+ public String[] getTableNames() throws DataSetException
+ {
+ List names = new ArrayList();
+ for (Iterator it = _tables.iterator(); it.hasNext();)
+ {
+ TableEntry entry = (TableEntry)it.next();
+ names.add(entry.getTableName());
+ }
+
+ return (String[])names.toArray(new String[0]);
}
Index: DatabaseDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/DatabaseDataSet.java,v
retrieving revision 1.19
retrieving revision 1.19.4.1
diff -C2 -d -r1.19 -r1.19.4.1
*** DatabaseDataSet.java 14 Feb 2003 17:22:22 -0000 1.19
--- DatabaseDataSet.java 6 Apr 2003 13:56:32 -0000 1.19.4.1
***************
*** 239,242 ****
--- 239,253 ----
return (ITable[])tableList.toArray(new ITable[0]);
}
+
+ public ITableIterator iterator() throws DataSetException
+ {
+ return new DefaultTableIterator(getTables());
+ }
+
+ public ITableIterator reverseIterator() throws DataSetException
+ {
+ return new DefaultTableIterator(getTables(), true);
+ }
+
}
|
|
From: <mla...@us...> - 2003-04-06 00:50:40
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/database
In directory sc8-pr-cvs1:/tmp/cvs-serv23123/dbunit/src/java/org/dbunit/database
Added Files:
CyclicTablesDependencyException.java
DatabaseSequenceFilter.java
Log Message:
New sequence filter that order database tables according their dependency. To be used as a FilteredDataSet filtering strategy.
WARNING: this code is very experimental and has not been tested yet!
--- NEW FILE: CyclicTablesDependencyException.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.database;
import org.dbunit.dataset.DataSetException;
/**
* @author Manuel Laflamme
* @since Mar 23, 2003
* @version $Revision: 1.1 $
*/
public class CyclicTablesDependencyException extends DataSetException
{
public CyclicTablesDependencyException(String tableName1, String tableName2)
{
super(tableName1 + ", " + tableName2);
}
}
--- NEW FILE: DatabaseSequenceFilter.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.database;
import org.dbunit.dataset.DataSetException;
import org.dbunit.dataset.filter.SequenceTableFilter;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/**
* This filter orders tables using dependency information provided by
* {@link java.sql.DatabaseMetaData#getExportedKeys}.
*
* @author Manuel Laflamme
* @since Mar 23, 2003
* @version $Revision: 1.1 $
*/
public class DatabaseSequenceFilter extends SequenceTableFilter
{
/**
* Create a DatabaseSequenceFilter that only exposes specified table names.
*/
public DatabaseSequenceFilter(IDatabaseConnection connection,
String[] tableNames) throws DataSetException, SQLException
{
super(sortTableNames(connection, tableNames));
}
/**
* Create a DatabaseSequenceFilter that exposes all the database tables.
*/
public DatabaseSequenceFilter(IDatabaseConnection connection)
throws DataSetException, SQLException
{
this(connection, connection.createDataSet().getTableNames());
}
private static String[] sortTableNames(IDatabaseConnection connection,
String[] tableNames) throws DataSetException, SQLException
{
Arrays.sort((String[])tableNames.clone(),
new TableSequenceComparator(connection));
return tableNames;
}
private static class TableSequenceComparator implements Comparator
{
IDatabaseConnection _connection;
Map _dependentMap = new HashMap();
public TableSequenceComparator(IDatabaseConnection connection)
{
_connection = connection;
}
public int compare(Object o1, Object o2)
{
String tableName1 = (String)o1;
String tableName2 = (String)o2;
try
{
if (getDependentTableNames(tableName1).contains(tableName2))
{
if (getDependentTableNames(tableName2).contains(tableName1))
{
throw new CyclicTablesDependencyException(tableName1, tableName2);
}
return -1;
}
}
catch (SQLException e)
{
}
catch (CyclicTablesDependencyException e)
{
}
return tableName1.compareTo(tableName2);
}
private Set getDependentTableNames(String tableName)
throws SQLException
{
if (_dependentMap.containsKey(tableName))
{
return (Set)_dependentMap.get(tableName);
}
DatabaseMetaData metaData = _connection.getConnection().getMetaData();
String schema = _connection.getSchema();
ResultSet resultSet = metaData.getExportedKeys(null, schema, tableName);
try
{
Set foreignTableSet = new HashSet();
while (resultSet.next())
{
// TODO : add support for qualified table names
// String foreignSchemaName = resultSet.getString(6);
String foreignTableName = resultSet.getString(7);
foreignTableSet.add(foreignTableName);
}
_dependentMap.put(tableName, foreignTableSet);
return foreignTableSet;
}
finally
{
resultSet.close();
}
}
}
}
|
|
From: <mla...@us...> - 2003-04-05 19:25:52
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset
In directory sc8-pr-cvs1:/tmp/cvs-serv15777/dbunit/src/test/org/dbunit/dataset
Modified Files:
ReplacementTableTest.java
Log Message:
Fixed usage of wrong dataset implementation.
Index: ReplacementTableTest.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/ReplacementTableTest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ReplacementTableTest.java 23 Mar 2003 04:31:55 -0000 1.4
--- ReplacementTableTest.java 5 Apr 2003 19:25:48 -0000 1.5
***************
*** 51,55 ****
private IDataSet createDataSet() throws Exception
{
! return new BooleanDataSet(
new FlatXmlDataSet(new File("src/xml/flatXmlTableTest.xml")));
}
--- 51,55 ----
private IDataSet createDataSet() throws Exception
{
! return new ReplacementDataSet(
new FlatXmlDataSet(new File("src/xml/flatXmlTableTest.xml")));
}
|
|
From: <mla...@us...> - 2003-04-05 14:34:32
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset
In directory sc8-pr-cvs1:/tmp/cvs-serv30922/dbunit/src/test/org/dbunit/dataset
Modified Files:
AllTests.java
Removed Files:
BooleanDataSetTest.java BooleanTableTest.java
Log Message:
Removed BooleanDataSet/BooleanTable now obsoleted by ReplacementDataSet/ReplacementTable.
Index: AllTests.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/AllTests.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** AllTests.java 21 Mar 2003 03:14:50 -0000 1.15
--- AllTests.java 5 Apr 2003 14:34:26 -0000 1.16
***************
*** 41,46 ****
suite.addTest(org.dbunit.dataset.filter.AllTests.suite());
suite.addTest(org.dbunit.dataset.xml.AllTests.suite());
- suite.addTest(new TestSuite(BooleanDataSetTest.class));
- suite.addTest(new TestSuite(BooleanTableTest.class));
suite.addTest(new TestSuite(CaseInsensitiveDataSetTest.class));
suite.addTest(new TestSuite(CaseInsensitiveTableTest.class));
--- 41,44 ----
--- BooleanDataSetTest.java DELETED ---
--- BooleanTableTest.java DELETED ---
|
|
From: <mla...@us...> - 2003-04-05 14:34:32
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv30922/dbunit/src/java/org/dbunit/dataset Removed Files: BooleanDataSet.java BooleanTable.java Log Message: Removed BooleanDataSet/BooleanTable now obsoleted by ReplacementDataSet/ReplacementTable. --- BooleanDataSet.java DELETED --- --- BooleanTable.java DELETED --- |
|
From: <mla...@us...> - 2003-04-05 03:01:33
|
Update of /cvsroot/dbunit/dbunit/docs
In directory sc8-pr-cvs1:/tmp/cvs-serv3280/dbunit/docs
Modified Files:
index.html changes.html download.html resources.html
Log Message:
Merged from release-1-5-1
Index: index.html
===================================================================
RCS file: /cvsroot/dbunit/dbunit/docs/index.html,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** index.html 2 Mar 2003 05:04:36 -0000 1.28
--- index.html 5 Apr 2003 03:01:28 -0000 1.29
***************
*** 59,62 ****
--- 59,63 ----
</a>
<ul>
+ <li>2003-04-04 - Version 1.5.1 released. See <a href="changes.html#1.5.1">changes</a>.</li>
<li>2003-03-01 - Version 1.5 released. See <a href="changes.html#1.5">changes</a>.</li>
<li>2002-11-07 - Eric Pugh joined the DbUnit developement team.</li>
Index: changes.html
===================================================================
RCS file: /cvsroot/dbunit/dbunit/docs/changes.html,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** changes.html 26 Feb 2003 22:52:46 -0000 1.27
--- changes.html 5 Apr 2003 03:01:29 -0000 1.28
***************
*** 6,10 ****
<link href="stylesheet.css" rel="stylesheet" type="text/css">
<!-- #BeginEditable "doctitle" -->
! <title>The Dbunit Framework - News & Changes History</title>
<!-- #EndEditable -->
</head>
--- 6,10 ----
<link href="stylesheet.css" rel="stylesheet" type="text/css">
<!-- #BeginEditable "doctitle" -->
! <title>The Dbunit Framework - History of Changes</title>
<!-- #EndEditable -->
</head>
***************
*** 43,48 ****
src="images/silphid.gif" border=0></a></div>
</td>
! <td class="body" valign="top"> <!-- #BeginEditable "body" --> <a name="1.5">
! <h2>Changes in version 1.5 from 1.4</h2>
</a>
<ul>
--- 43,72 ----
src="images/silphid.gif" border=0></a></div>
</td>
! <td class="body" valign="top"> <!-- #BeginEditable "body" -->
! <h2>History of Changes</h2>
! <a name="1.5.1">
! <h3>Version 1.5.1 (Apr 4, 2003)</h3>
! </a>
! <ul>
! <li>Multiple bugfixes:</li>
! <ul>
! <li>Fixed DELETE operation that was not deleting tables in reverse order
! as expected.</li>
! <li><a href="http://sourceforge.net/tracker/index.php?func=detail&aid=712329&group_id=47439&atid=449491">712329</a>
! - setObject fails on BEA JDriver for MS-SQL.</li>
! <!--
! <li> Fixed NullPointerException with some version of the Oracle driver
! when batched statement is enabled. </li>
! -->
! <li> Fixed DbUnitTask "supportBatchStatement" flag. </li>
! </ul>
! <li>Optimizations: </li>
! <ul>
! <li>DbUnitTask DTD export. </li>
! <li>REFRESH operation.</li>
! </ul>
! </ul>
! <a name="1.5">
! <h3>Version 1.5 (Mar 1, 2003)</h3>
</a>
<ul>
***************
*** 65,77 ****
decorator classes.</li>
</ul>
- <li>Ant Task:</li>
<ul>
<li><a href="http://sourceforge.net/tracker/index.php?func=detail&aid=645691&group_id=47439&atid=449491">645691</a>
- Added the <a class=code><classpath></a> nested element in
! <a class=code> <dbunit></a> ant task; used to load the JDBC
! classes.</li>
! <li>Added <a class=code><query></a> nested element in <a class=code><export></a>.
! Allows exporting the result of a SELECT as a table of a dataset. See
! <a href="anttask.html">ant task documentation</a>.</li>
</ul>
<li>New <a href="http://webtest.canoo.com/">Canoo Webtest</a> integration
--- 89,99 ----
decorator classes.</li>
</ul>
<ul>
<li><a href="http://sourceforge.net/tracker/index.php?func=detail&aid=645691&group_id=47439&atid=449491">645691</a>
- Added the <a class=code><classpath></a> nested element in
! <a class=code> DbUnitTask</a> ant task; used to load the JDBC classes.</li>
! <li>Added <a class=code><query></a> nested element in <a class=code>DbUnitTask
! <export></a>. Allows exporting the result of a SELECT as a table
! of a dataset. See <a href="anttask.html">ant task documentation</a>.</li>
</ul>
<li>New <a href="http://webtest.canoo.com/">Canoo Webtest</a> integration
***************
*** 82,86 ****
</ul>
<a name="1.4">
! <h2>Changes in version 1.4 from 1.3</h2>
</a>
<ul>
--- 104,108 ----
</ul>
<a name="1.4">
! <h3>Version 1.4 (Jul 17, 2002)</h3>
</a>
<ul>
***************
*** 102,107 ****
<li><a href="http://sourceforge.net/tracker/index.php?func=detail&aid=554249&group_id=47439&atid=449494">554249</a>
- None column values.</li>
! <li><strong><em>Ant Task</em></strong> contributed by Timothy Ruppert
! and Ben Cox.</li>
<li>Support for BLOB and CLOB data types.</li>
</ul>
--- 124,129 ----
<li><a href="http://sourceforge.net/tracker/index.php?func=detail&aid=554249&group_id=47439&atid=449494">554249</a>
- None column values.</li>
! <li><strong><em>DbUnitTask</em></strong> for Ant contributed by Timothy
! Ruppert and Ben Cox.</li>
<li>Support for BLOB and CLOB data types.</li>
</ul>
***************
*** 122,126 ****
</ul>
<a name="1.3">
! <h2>Changes in version 1.3 from 1.2.4</h2>
</a>
<ul>
--- 144,148 ----
</ul>
<a name="1.3">
! <h3>Version 1.3 (Apr 4, 2002)</h3>
</a>
<ul>
***************
*** 137,145 ****
- Problem with single quotes.</li>
<li><a href="http://sourceforge.net/tracker/index.php?func=detail&aid=534810&group_id=47439&atid=449491">534810</a>
! - Problem when primary key included all columns</li>
</ul>
</ul>
<a name="1.2.4">
! <h2>Changes in version 1.2.4 from 1.2</h2>
</a>
<ul>
--- 159,167 ----
- Problem with single quotes.</li>
<li><a href="http://sourceforge.net/tracker/index.php?func=detail&aid=534810&group_id=47439&atid=449491">534810</a>
! - Problem when primary key include all columns</li>
</ul>
</ul>
<a name="1.2.4">
! <h3>Version 1.2.4 (Mar 19, 2003)</h3>
</a>
<ul>
***************
*** 155,159 ****
</ul>
<a name="1.2">
! <h2>Changes in version 1.2 from 1.1</h2>
</a>
<ul>
--- 177,181 ----
</ul>
<a name="1.2">
! <h3>Version 1.2 (Mar 15, 2002)</h3>
</a>
<ul>
***************
*** 166,170 ****
</ul>
<a name="1.1">
! <h2>Changes in version 1.1 from 1.0</h2>
</a>
<ul>
--- 188,192 ----
</ul>
<a name="1.1">
! <h3>Version 1.1 (Mar 10, 2002)</h3>
</a>
<ul>
***************
*** 191,194 ****
--- 213,222 ----
- Cannot export tables (jdbc-odbc with MS-SQL 7).</li>
</ul>
+ </ul>
+ <a name="1.0">
+ <h3>Version 1.0 (Feb 27, 2002)</h3>
+ </a>
+ <ul>
+ <li>Initial public release.</li>
</ul>
<!-- #EndEditable -->
Index: download.html
===================================================================
RCS file: /cvsroot/dbunit/dbunit/docs/download.html,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** download.html 1 Mar 2003 17:29:51 -0000 1.22
--- download.html 5 Apr 2003 03:01:29 -0000 1.23
***************
*** 45,53 ****
<td class="body" valign="top"> <!-- #BeginEditable "body" -->
<h2>Download</h2>
! <p>The current Dbunit release is version 1.5. The distribution archive contains
! the compiled classes, the java code and the java API documentation.</p>
! <p><a href="http://sourceforge.net/project/showfiles.php?group_id=47439&release_id=142893">Download
! version 1.5</a></p>
! <p>If your are not reading this page online, please visit the <a href="http://www.dbunit.org">online
version</a> of this site since a more recent version of Dbunit might be
available.</p>
--- 45,53 ----
<td class="body" valign="top"> <!-- #BeginEditable "body" -->
<h2>Download</h2>
! <p>The current Dbunit release is version 1.5.1. The distribution archive
! contains the compiled classes, the java code and the java API documentation.</p>
! <p><a href="http://sourceforge.net/project/showfiles.php?group_id=47439&release_id=150554">Download
! version 1.5.1</a></p>
! <p>If your are not reading this page online, please visit the <a href="http://www.dbunit.org/">online
version</a> of this site since a more recent version of Dbunit might be
available.</p>
Index: resources.html
===================================================================
RCS file: /cvsroot/dbunit/dbunit/docs/resources.html,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** resources.html 24 Feb 2003 01:40:18 -0000 1.15
--- resources.html 5 Apr 2003 03:01:29 -0000 1.16
***************
*** 45,49 ****
<td class="body" valign="top"> <!-- #BeginEditable "body" -->
<h2>Project Ressources</h2>
! <p><a href="https://sourceforge.net/projects/dbunit/">Project summary</a></p>
<p><a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/dbunit/">Browse
CVS repository</a></p>
--- 45,49 ----
<td class="body" valign="top"> <!-- #BeginEditable "body" -->
<h2>Project Ressources</h2>
! <p><a href="http://sourceforge.net/projects/dbunit/">Project summary</a></p>
<p><a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/dbunit/">Browse
CVS repository</a></p>
|
|
From: <mla...@us...> - 2003-04-05 03:01:33
|
Update of /cvsroot/dbunit/dbunit In directory sc8-pr-cvs1:/tmp/cvs-serv3280/dbunit Modified Files: build.properties Log Message: Merged from release-1-5-1 Index: build.properties =================================================================== RCS file: /cvsroot/dbunit/dbunit/build.properties,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** build.properties 26 Feb 2003 22:52:48 -0000 1.8 --- build.properties 5 Apr 2003 03:01:29 -0000 1.9 *************** *** 1,3 **** ! version = 1.5 --- 1,3 ---- ! version = 1.5.1 |
|
From: <mla...@us...> - 2003-04-05 02:27:23
|
Update of /cvsroot/dbunit/dbunit/docs
In directory sc8-pr-cvs1:/tmp/cvs-serv24765/dbunit/docs
Modified Files:
Tag: branch-1-5
changes.html index.html
Log Message:
Release 1.5.1
Index: changes.html
===================================================================
RCS file: /cvsroot/dbunit/dbunit/docs/changes.html,v
retrieving revision 1.27.2.2
retrieving revision 1.27.2.3
diff -C2 -d -r1.27.2.2 -r1.27.2.3
*** changes.html 4 Apr 2003 13:14:29 -0000 1.27.2.2
--- changes.html 5 Apr 2003 02:27:17 -0000 1.27.2.3
***************
*** 46,50 ****
<h2>History of Changes</h2>
<a name="1.5.1">
! <h3>Version 1.5.1 (Apr ??, 2003)</h3>
</a>
<ul>
--- 46,50 ----
<h2>History of Changes</h2>
<a name="1.5.1">
! <h3>Version 1.5.1 (Apr 4, 2003)</h3>
</a>
<ul>
***************
*** 55,60 ****
--- 55,62 ----
<li><a href="http://sourceforge.net/tracker/index.php?func=detail&aid=712329&group_id=47439&atid=449491">712329</a>
- setObject fails on BEA JDriver for MS-SQL.</li>
+ <!--
<li> Fixed NullPointerException with some version of the Oracle driver
when batched statement is enabled. </li>
+ -->
<li> Fixed DbUnitTask "supportBatchStatement" flag. </li>
</ul>
***************
*** 122,127 ****
<li><a href="http://sourceforge.net/tracker/index.php?func=detail&aid=554249&group_id=47439&atid=449494">554249</a>
- None column values.</li>
! <li><strong><em>DbUnitTask</em></strong> contributed by Timothy Ruppert
! and Ben Cox.</li>
<li>Support for BLOB and CLOB data types.</li>
</ul>
--- 124,129 ----
<li><a href="http://sourceforge.net/tracker/index.php?func=detail&aid=554249&group_id=47439&atid=449494">554249</a>
- None column values.</li>
! <li><strong><em>DbUnitTask</em></strong> for Ant contributed by Timothy
! Ruppert and Ben Cox.</li>
<li>Support for BLOB and CLOB data types.</li>
</ul>
Index: index.html
===================================================================
RCS file: /cvsroot/dbunit/dbunit/docs/index.html,v
retrieving revision 1.28.2.1
retrieving revision 1.28.2.2
diff -C2 -d -r1.28.2.1 -r1.28.2.2
*** index.html 3 Apr 2003 01:50:40 -0000 1.28.2.1
--- index.html 5 Apr 2003 02:27:17 -0000 1.28.2.2
***************
*** 59,63 ****
</a>
<ul>
! <li>2003-04-?? - Version 1.5.1 released. See <a href="changes.html#1.5.1">changes</a>.</li>
<li>2003-03-01 - Version 1.5 released. See <a href="changes.html#1.5">changes</a>.</li>
<li>2002-11-07 - Eric Pugh joined the DbUnit developement team.</li>
--- 59,63 ----
</a>
<ul>
! <li>2003-04-04 - Version 1.5.1 released. See <a href="changes.html#1.5.1">changes</a>.</li>
<li>2003-03-01 - Version 1.5 released. See <a href="changes.html#1.5">changes</a>.</li>
<li>2002-11-07 - Eric Pugh joined the DbUnit developement team.</li>
|
|
From: <mla...@us...> - 2003-04-04 13:15:09
|
Update of /cvsroot/dbunit/dbunit
In directory sc8-pr-cvs1:/tmp/cvs-serv15773/dbunit
Modified Files:
Tag: branch-1-5
build.properties
Log Message:
Updates for release 1.5.1.
Index: build.properties
===================================================================
RCS file: /cvsroot/dbunit/dbunit/build.properties,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -C2 -d -r1.8 -r1.8.2.1
*** build.properties 26 Feb 2003 22:52:48 -0000 1.8
--- build.properties 4 Apr 2003 13:14:26 -0000 1.8.2.1
***************
*** 1,3 ****
! version = 1.5
--- 1,3 ----
! version = 1.5.1
|
|
From: <mla...@us...> - 2003-04-04 13:14:41
|
Update of /cvsroot/dbunit/dbunit/docs
In directory sc8-pr-cvs1:/tmp/cvs-serv15773/dbunit/docs
Modified Files:
Tag: branch-1-5
changes.html download.html resources.html
Log Message:
Updates for release 1.5.1.
Index: changes.html
===================================================================
RCS file: /cvsroot/dbunit/dbunit/docs/changes.html,v
retrieving revision 1.27.2.1
retrieving revision 1.27.2.2
diff -C2 -d -r1.27.2.1 -r1.27.2.2
*** changes.html 3 Apr 2003 01:50:40 -0000 1.27.2.1
--- changes.html 4 Apr 2003 13:14:29 -0000 1.27.2.2
***************
*** 87,99 ****
decorator classes.</li>
</ul>
- <li>Ant Task:</li>
<ul>
<li><a href="http://sourceforge.net/tracker/index.php?func=detail&aid=645691&group_id=47439&atid=449491">645691</a>
- Added the <a class=code><classpath></a> nested element in
! <a class=code> <dbunit></a> ant task; used to load the JDBC
! classes.</li>
! <li>Added <a class=code><query></a> nested element in <a class=code><export></a>.
! Allows exporting the result of a SELECT as a table of a dataset. See
! <a href="anttask.html">ant task documentation</a>.</li>
</ul>
<li>New <a href="http://webtest.canoo.com/">Canoo Webtest</a> integration
--- 87,97 ----
decorator classes.</li>
</ul>
<ul>
<li><a href="http://sourceforge.net/tracker/index.php?func=detail&aid=645691&group_id=47439&atid=449491">645691</a>
- Added the <a class=code><classpath></a> nested element in
! <a class=code> DbUnitTask</a> ant task; used to load the JDBC classes.</li>
! <li>Added <a class=code><query></a> nested element in <a class=code>DbUnitTask
! <export></a>. Allows exporting the result of a SELECT as a table
! of a dataset. See <a href="anttask.html">ant task documentation</a>.</li>
</ul>
<li>New <a href="http://webtest.canoo.com/">Canoo Webtest</a> integration
***************
*** 124,128 ****
<li><a href="http://sourceforge.net/tracker/index.php?func=detail&aid=554249&group_id=47439&atid=449494">554249</a>
- None column values.</li>
! <li><strong><em>Ant Task</em></strong> contributed by Timothy Ruppert
and Ben Cox.</li>
<li>Support for BLOB and CLOB data types.</li>
--- 122,126 ----
<li><a href="http://sourceforge.net/tracker/index.php?func=detail&aid=554249&group_id=47439&atid=449494">554249</a>
- None column values.</li>
! <li><strong><em>DbUnitTask</em></strong> contributed by Timothy Ruppert
and Ben Cox.</li>
<li>Support for BLOB and CLOB data types.</li>
***************
*** 159,163 ****
- Problem with single quotes.</li>
<li><a href="http://sourceforge.net/tracker/index.php?func=detail&aid=534810&group_id=47439&atid=449491">534810</a>
! - Problem when primary key included all columns</li>
</ul>
</ul>
--- 157,161 ----
- Problem with single quotes.</li>
<li><a href="http://sourceforge.net/tracker/index.php?func=detail&aid=534810&group_id=47439&atid=449491">534810</a>
! - Problem when primary key include all columns</li>
</ul>
</ul>
Index: download.html
===================================================================
RCS file: /cvsroot/dbunit/dbunit/docs/download.html,v
retrieving revision 1.22
retrieving revision 1.22.2.1
diff -C2 -d -r1.22 -r1.22.2.1
*** download.html 1 Mar 2003 17:29:51 -0000 1.22
--- download.html 4 Apr 2003 13:14:31 -0000 1.22.2.1
***************
*** 45,53 ****
<td class="body" valign="top"> <!-- #BeginEditable "body" -->
<h2>Download</h2>
! <p>The current Dbunit release is version 1.5. The distribution archive contains
! the compiled classes, the java code and the java API documentation.</p>
! <p><a href="http://sourceforge.net/project/showfiles.php?group_id=47439&release_id=142893">Download
! version 1.5</a></p>
! <p>If your are not reading this page online, please visit the <a href="http://www.dbunit.org">online
version</a> of this site since a more recent version of Dbunit might be
available.</p>
--- 45,53 ----
<td class="body" valign="top"> <!-- #BeginEditable "body" -->
<h2>Download</h2>
! <p>The current Dbunit release is version 1.5.1. The distribution archive
! contains the compiled classes, the java code and the java API documentation.</p>
! <p><a href="http://sourceforge.net/project/showfiles.php?group_id=47439&release_id=150554">Download
! version 1.5.1</a></p>
! <p>If your are not reading this page online, please visit the <a href="http://www.dbunit.org/">online
version</a> of this site since a more recent version of Dbunit might be
available.</p>
Index: resources.html
===================================================================
RCS file: /cvsroot/dbunit/dbunit/docs/resources.html,v
retrieving revision 1.15
retrieving revision 1.15.2.1
diff -C2 -d -r1.15 -r1.15.2.1
*** resources.html 24 Feb 2003 01:40:18 -0000 1.15
--- resources.html 4 Apr 2003 13:14:33 -0000 1.15.2.1
***************
*** 45,49 ****
<td class="body" valign="top"> <!-- #BeginEditable "body" -->
<h2>Project Ressources</h2>
! <p><a href="https://sourceforge.net/projects/dbunit/">Project summary</a></p>
<p><a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/dbunit/">Browse
CVS repository</a></p>
--- 45,49 ----
<td class="body" valign="top"> <!-- #BeginEditable "body" -->
<h2>Project Ressources</h2>
! <p><a href="http://sourceforge.net/projects/dbunit/">Project summary</a></p>
<p><a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/dbunit/">Browse
CVS repository</a></p>
|
|
From: <mla...@us...> - 2003-04-03 01:50:44
|
Update of /cvsroot/dbunit/dbunit/docs
In directory sc8-pr-cvs1:/tmp/cvs-serv14046/dbunit/docs
Modified Files:
Tag: branch-1-5
index.html changes.html
Log Message:
Updated html documentation for release 1.5.1.
Index: index.html
===================================================================
RCS file: /cvsroot/dbunit/dbunit/docs/index.html,v
retrieving revision 1.28
retrieving revision 1.28.2.1
diff -C2 -d -r1.28 -r1.28.2.1
*** index.html 2 Mar 2003 05:04:36 -0000 1.28
--- index.html 3 Apr 2003 01:50:40 -0000 1.28.2.1
***************
*** 59,62 ****
--- 59,63 ----
</a>
<ul>
+ <li>2003-04-?? - Version 1.5.1 released. See <a href="changes.html#1.5.1">changes</a>.</li>
<li>2003-03-01 - Version 1.5 released. See <a href="changes.html#1.5">changes</a>.</li>
<li>2002-11-07 - Eric Pugh joined the DbUnit developement team.</li>
Index: changes.html
===================================================================
RCS file: /cvsroot/dbunit/dbunit/docs/changes.html,v
retrieving revision 1.27
retrieving revision 1.27.2.1
diff -C2 -d -r1.27 -r1.27.2.1
*** changes.html 26 Feb 2003 22:52:46 -0000 1.27
--- changes.html 3 Apr 2003 01:50:40 -0000 1.27.2.1
***************
*** 6,10 ****
<link href="stylesheet.css" rel="stylesheet" type="text/css">
<!-- #BeginEditable "doctitle" -->
! <title>The Dbunit Framework - News & Changes History</title>
<!-- #EndEditable -->
</head>
--- 6,10 ----
<link href="stylesheet.css" rel="stylesheet" type="text/css">
<!-- #BeginEditable "doctitle" -->
! <title>The Dbunit Framework - History of Changes</title>
<!-- #EndEditable -->
</head>
***************
*** 43,48 ****
src="images/silphid.gif" border=0></a></div>
</td>
! <td class="body" valign="top"> <!-- #BeginEditable "body" --> <a name="1.5">
! <h2>Changes in version 1.5 from 1.4</h2>
</a>
<ul>
--- 43,70 ----
src="images/silphid.gif" border=0></a></div>
</td>
! <td class="body" valign="top"> <!-- #BeginEditable "body" -->
! <h2>History of Changes</h2>
! <a name="1.5.1">
! <h3>Version 1.5.1 (Apr ??, 2003)</h3>
! </a>
! <ul>
! <li>Multiple bugfixes:</li>
! <ul>
! <li>Fixed DELETE operation that was not deleting tables in reverse order
! as expected.</li>
! <li><a href="http://sourceforge.net/tracker/index.php?func=detail&aid=712329&group_id=47439&atid=449491">712329</a>
! - setObject fails on BEA JDriver for MS-SQL.</li>
! <li> Fixed NullPointerException with some version of the Oracle driver
! when batched statement is enabled. </li>
! <li> Fixed DbUnitTask "supportBatchStatement" flag. </li>
! </ul>
! <li>Optimizations: </li>
! <ul>
! <li>DbUnitTask DTD export. </li>
! <li>REFRESH operation.</li>
! </ul>
! </ul>
! <a name="1.5">
! <h3>Version 1.5 (Mar 1, 2003)</h3>
</a>
<ul>
***************
*** 82,86 ****
</ul>
<a name="1.4">
! <h2>Changes in version 1.4 from 1.3</h2>
</a>
<ul>
--- 104,108 ----
</ul>
<a name="1.4">
! <h3>Version 1.4 (Jul 17, 2002)</h3>
</a>
<ul>
***************
*** 122,126 ****
</ul>
<a name="1.3">
! <h2>Changes in version 1.3 from 1.2.4</h2>
</a>
<ul>
--- 144,148 ----
</ul>
<a name="1.3">
! <h3>Version 1.3 (Apr 4, 2002)</h3>
</a>
<ul>
***************
*** 141,145 ****
</ul>
<a name="1.2.4">
! <h2>Changes in version 1.2.4 from 1.2</h2>
</a>
<ul>
--- 163,167 ----
</ul>
<a name="1.2.4">
! <h3>Version 1.2.4 (Mar 19, 2003)</h3>
</a>
<ul>
***************
*** 155,159 ****
</ul>
<a name="1.2">
! <h2>Changes in version 1.2 from 1.1</h2>
</a>
<ul>
--- 177,181 ----
</ul>
<a name="1.2">
! <h3>Version 1.2 (Mar 15, 2002)</h3>
</a>
<ul>
***************
*** 166,170 ****
</ul>
<a name="1.1">
! <h2>Changes in version 1.1 from 1.0</h2>
</a>
<ul>
--- 188,192 ----
</ul>
<a name="1.1">
! <h3>Version 1.1 (Mar 10, 2002)</h3>
</a>
<ul>
***************
*** 191,194 ****
--- 213,222 ----
- Cannot export tables (jdbc-odbc with MS-SQL 7).</li>
</ul>
+ </ul>
+ <a name="1.0">
+ <h3>Version 1.0 (Feb 27, 2002)</h3>
+ </a>
+ <ul>
+ <li>Initial public release.</li>
</ul>
<!-- #EndEditable -->
|
|
From: <mla...@us...> - 2003-04-03 00:57:12
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/operation
In directory sc8-pr-cvs1:/tmp/cvs-serv27244/dbunit/src/java/org/dbunit/operation
Modified Files:
Tag: branch-1-5
AbstractBatchOperation.java
Log Message:
Oups! Forgot to merge this file from the Main trunk. Now this is done!
Index: AbstractBatchOperation.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/operation/AbstractBatchOperation.java,v
retrieving revision 1.15
retrieving revision 1.15.2.1
diff -C2 -d -r1.15 -r1.15.2.1
*** AbstractBatchOperation.java 3 Aug 2002 02:26:41 -0000 1.15
--- AbstractBatchOperation.java 3 Apr 2003 00:57:09 -0000 1.15.2.1
***************
*** 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
|
|
From: <mla...@us...> - 2003-04-02 13:52:03
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/statement
In directory sc8-pr-cvs1:/tmp/cvs-serv27756/dbunit/src/java/org/dbunit/database/statement
Modified Files:
Tag: branch-1-5
PreparedBatchStatement.java SimplePreparedStatement.java
Log Message:
Merge of bug fixes and minor optimizations, from Main trunk to
branch-1-5, to include in release 1.5.1
Index: PreparedBatchStatement.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/statement/PreparedBatchStatement.java,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -C2 -d -r1.8 -r1.8.2.1
*** PreparedBatchStatement.java 13 Jun 2002 17:24:56 -0000 1.8
--- PreparedBatchStatement.java 2 Apr 2003 13:51:53 -0000 1.8.2.1
***************
*** 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)
{
Index: SimplePreparedStatement.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/statement/SimplePreparedStatement.java,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -C2 -d -r1.7 -r1.7.2.1
*** SimplePreparedStatement.java 13 Jun 2002 17:24:56 -0000 1.7
--- SimplePreparedStatement.java 2 Apr 2003 13:51:53 -0000 1.7.2.1
***************
*** 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,78 ----
throws TypeCastException, SQLException
{
+ // Special NULL handling
+ if (value == null)
+ {
+ _statement.setNull(++_index, dataType.getSqlType());
+ return;
+ }
+
+ // Special BLOB handling
+ if (dataType == DataType.CLOB)
+ {
+ _statement.setObject(++_index, dataType.typeCast(value),
+ DataType.LONGVARCHAR.getSqlType());
+ return;
+ }
+
+ // Special CLOB handling
+ if (dataType == DataType.BLOB)
+ {
+ _statement.setObject(++_index, dataType.typeCast(value),
+ DataType.LONGVARBINARY.getSqlType());
+ return;
+ }
+
_statement.setObject(++_index, dataType.typeCast(value), dataType.getSqlType());
}
|
|
From: <mla...@us...> - 2003-04-02 13:52:01
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/operation
In directory sc8-pr-cvs1:/tmp/cvs-serv27756/dbunit/src/java/org/dbunit/operation
Modified Files:
Tag: branch-1-5
DeleteOperation.java RefreshOperation.java
Log Message:
Merge of bug fixes and minor optimizations, from Main trunk to
branch-1-5, to include in release 1.5.1
Index: DeleteOperation.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/operation/DeleteOperation.java,v
retrieving revision 1.11
retrieving revision 1.11.2.1
diff -C2 -d -r1.11 -r1.11.2.1
*** DeleteOperation.java 4 Aug 2002 01:07:13 -0000 1.11
--- DeleteOperation.java 2 Apr 2003 13:51:53 -0000 1.11.2.1
***************
*** 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;
}
Index: RefreshOperation.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/operation/RefreshOperation.java,v
retrieving revision 1.21
retrieving revision 1.21.2.1
diff -C2 -d -r1.21 -r1.21.2.1
*** RefreshOperation.java 14 Feb 2003 17:22:21 -0000 1.21
--- RefreshOperation.java 2 Apr 2003 13:51:53 -0000 1.21.2.1
***************
*** 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;
***************
*** 52,191 ****
}
! private boolean rowExist(PreparedStatement statement,
! Column[] columns, ITable table, int row)
! throws DataSetException, SQLException
{
! for (int i = 0; i < columns.length; i++)
! {
! Object value = table.getValue(row, columns[i].getColumnName());
! DataType dataType = columns[i].getDataType();
! statement.setObject(i + 1, dataType.typeCast(value),
! dataType.getSqlType());
! }
! ResultSet resultSet = statement.executeQuery();
! try
! {
! resultSet.next();
! return resultSet.getInt(1) > 0;
! }
! finally
{
! resultSet.close();
}
}
! public OperationData getSelectCountData(String schemaName,
! ITableMetaData metaData) throws DataSetException
{
! Column[] primaryKeys = metaData.getPrimaryKeys();
!
! // cannot construct where clause if no primary key
! if (primaryKeys.length == 0)
{
! throw new NoPrimaryKeyException(metaData.getTableName());
}
! // select count
! StringBuffer sqlBuffer = new StringBuffer(128);
! sqlBuffer.append("select COUNT(*) from ");
! sqlBuffer.append(DataSetUtils.getQualifiedName(schemaName,
! metaData.getTableName(), true));
! // where
! sqlBuffer.append(" where ");
! for (int i = 0; i < primaryKeys.length; i++)
! {
! Column column = primaryKeys[i];
! if (i > 0)
{
! sqlBuffer.append(" and ");
}
! sqlBuffer.append(column.getColumnName());
! sqlBuffer.append(" = ?");
}
! return new OperationData(sqlBuffer.toString(), primaryKeys);
}
! private int executeRowOperation(IPreparedBatchStatement statement,
! Column[] columns, ITable table, int row)
! throws DataSetException, SQLException
{
! for (int i = 0; i < columns.length; i++)
{
! Object value = table.getValue(row, columns[i].getColumnName());
! statement.addValue(value, columns[i].getDataType());
}
- statement.addBatch();
- int result = statement.executeBatch();
- statement.clearBatch();
-
- return result;
}
! ////////////////////////////////////////////////////////////////////////////
! // DatabaseOperation class
!
! public void execute(IDatabaseConnection connection, IDataSet dataSet)
! throws DatabaseUnitException, SQLException
{
! IStatementFactory factory = connection.getStatementFactory();
! String schema = connection.getSchema();
! // for each table
! ITable[] tables = dataSet.getTables();
! for (int i = 0; i < tables.length; i++)
{
! // do not process empty table
! ITable table = tables[i];
! if (table.getRowCount() == 0)
! {
! continue;
! }
! ITableMetaData metaData = AbstractBatchOperation.getOperationMetaData(
! connection, table.getTableMetaData());
// setup select count statement
OperationData countData = getSelectCountData(schema, metaData);
! PreparedStatement countStatement =
! connection.getConnection().prepareStatement(countData.getSql());
! // setup insert statement
! OperationData insertData = _insertOperation.getOperationData(schema, metaData);
! IPreparedBatchStatement insertStatement =
! factory.createPreparedBatchStatement(insertData.getSql(), connection);
! // setup update statement
! OperationData updateData = _updateOperation.getOperationData(schema, metaData);
! IPreparedBatchStatement updateStatement =
! factory.createPreparedBatchStatement(updateData.getSql(), connection);
! // refresh each table's row
! for (int j = 0; j < table.getRowCount(); j++)
{
! // verify if row exist
! if (rowExist(countStatement, countData.getColumns(), table, j))
! {
! // update only if columns are not all primary keys
! if (metaData.getColumns().length > metaData.getPrimaryKeys().length)
! {
! // update row
! executeRowOperation(updateStatement, updateData.getColumns(),
! table, j);
! }
! }
! else
{
! // insert row
! executeRowOperation(insertStatement, insertData.getColumns(),
! table, j);
}
}
}
}
}
--- 51,272 ----
}
! ////////////////////////////////////////////////////////////////////////////
! // DatabaseOperation class
!
! public void execute(IDatabaseConnection connection, IDataSet dataSet)
! throws DatabaseUnitException, SQLException
{
! String schema = connection.getSchema();
! // for each table
! ITable[] tables = dataSet.getTables();
! for (int i = 0; i < tables.length; i++)
{
! // do not process empty table
! ITable table = tables[i];
! if (table.getRowCount() == 0)
! {
! continue;
! }
!
! ITableMetaData metaData = AbstractBatchOperation.getOperationMetaData(
! connection, table.getTableMetaData());
! RowOperation updateRowOperation = createUpdateOperation(connection,
! schema, metaData);
! RowOperation insertRowOperation = new InsertRowOperation(connection,
! schema, metaData);
!
! // refresh all rows
! for (int j = 0; j < table.getRowCount(); j++)
! {
! if (!updateRowOperation.execute(table, j))
! {
! insertRowOperation.execute(table, j);
! }
! }
!
! // cleanup
! updateRowOperation.close();
! insertRowOperation.close();
}
+
}
! private RowOperation createUpdateOperation(IDatabaseConnection connection,
! String schema, ITableMetaData metaData)
! throws DataSetException, SQLException
{
! // update only if columns are not all primary keys
! 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);
! }
! /**
! * This class represents a operation executable on a single table row.
! */
! class RowOperation
! {
! protected IPreparedBatchStatement _statement;
! protected Column[] _columns;
! /**
! * Execute this operation on the sepcfied table row.
! * @return <code>true</code> if operation have been executed on the row.
! */
! public boolean execute(ITable table, int row)
! throws DataSetException, SQLException
! {
! for (int i = 0; i < _columns.length; i++)
{
! Object value = table.getValue(row, _columns[i].getColumnName());
! _statement.addValue(value, _columns[i].getDataType());
}
! _statement.addBatch();
! int result = _statement.executeBatch();
! _statement.clearBatch();
!
! return result == 1;
}
! /**
! * Cleanup this operation state.
! */
! public void close() throws SQLException
! {
! _statement.close();
! }
}
! /**
! * Insert row operation.
! */
! private class InsertRowOperation extends RowOperation
{
! public InsertRowOperation(IDatabaseConnection connection,
! String schema, ITableMetaData metaData)
! throws DataSetException, SQLException
{
! // setup insert statement
! OperationData insertData = _insertOperation.getOperationData(schema,
! metaData);
! _statement = new SimplePreparedStatement(insertData.getSql(),
! connection.getConnection());
! _columns = insertData.getColumns();
}
}
! /**
! * Update row operation.
! */
! private class UpdateRowOperation extends RowOperation
{
! PreparedStatement _countStatement;
! public UpdateRowOperation(IDatabaseConnection connection,
! String schema, ITableMetaData metaData)
! throws DataSetException, SQLException
{
! // setup update statement
! OperationData updateData = _updateOperation.getOperationData(schema,
! metaData);
! _statement = new SimplePreparedStatement(updateData.getSql(),
! connection.getConnection());
! _columns = updateData.getColumns();
! }
! }
! /**
! * This operation verify if a row exists in the database.
! */
! private class RowExistOperation extends RowOperation
! {
! PreparedStatement _countStatement;
+ public RowExistOperation(IDatabaseConnection connection,
+ String schema, ITableMetaData metaData)
+ throws DataSetException, SQLException
+ {
// setup select count statement
OperationData countData = getSelectCountData(schema, metaData);
! _countStatement = connection.getConnection().prepareStatement(
! countData.getSql());
! _columns = countData.getColumns();
! }
! private OperationData getSelectCountData(String schemaName,
! ITableMetaData metaData) throws DataSetException
! {
! Column[] primaryKeys = metaData.getPrimaryKeys();
! // cannot construct where clause if no primary key
! if (primaryKeys.length == 0)
! {
! throw new NoPrimaryKeyException(metaData.getTableName());
! }
! // select count
! StringBuffer sqlBuffer = new StringBuffer(128);
! sqlBuffer.append("select COUNT(*) from ");
! sqlBuffer.append(DataSetUtils.getQualifiedName(schemaName,
! metaData.getTableName(), true));
!
! // where
! sqlBuffer.append(" where ");
! for (int i = 0; i < primaryKeys.length; i++)
{
! Column column = primaryKeys[i];
!
! if (i > 0)
{
! sqlBuffer.append(" and ");
}
+ sqlBuffer.append(column.getColumnName());
+ sqlBuffer.append(" = ?");
}
+
+ return new OperationData(sqlBuffer.toString(), primaryKeys);
}
+ ////////////////////////////////////////////////////////////////////////
+ // RowOperation class
+
+ /**
+ * Verify if the specified table row exists in the database.
+ * @return <code>true</code> if row exists.
+ */
+ public boolean execute(ITable table, int row)
+ throws DataSetException, SQLException
+ {
+ for (int i = 0; i < _columns.length; i++)
+ {
+ Object value = table.getValue(row, _columns[i].getColumnName());
+ DataType dataType = _columns[i].getDataType();
+ _countStatement.setObject(i + 1, dataType.typeCast(value),
+ dataType.getSqlType());
+ }
+
+ ResultSet resultSet = _countStatement.executeQuery();
+ try
+ {
+ resultSet.next();
+ return resultSet.getInt(1) > 0;
+ }
+ finally
+ {
+ resultSet.close();
+ }
+ }
+
+ public void close() throws SQLException
+ {
+ _countStatement.close();
+ }
}
+
}
|
|
From: <mla...@us...> - 2003-04-02 13:51:59
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/ant
In directory sc8-pr-cvs1:/tmp/cvs-serv27756/dbunit/src/java/org/dbunit/ant
Modified Files:
Tag: branch-1-5
DbUnitTask.java Export.java
Log Message:
Merge of bug fixes and minor optimizations, from Main trunk to
branch-1-5, to include in release 1.5.1
Index: DbUnitTask.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/ant/DbUnitTask.java,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -C2 -d -r1.5 -r1.5.2.1
*** DbUnitTask.java 1 Mar 2003 06:51:17 -0000 1.5
--- DbUnitTask.java 2 Apr 2003 13:51:52 -0000 1.5.2.1
***************
*** 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);
Index: Export.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/ant/Export.java,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -C2 -d -r1.7 -r1.7.2.1
*** Export.java 15 Feb 2003 18:57:47 -0000 1.7
--- Export.java 2 Apr 2003 13:51:52 -0000 1.7.2.1
***************
*** 30,38 ****
import org.dbunit.dataset.xml.XmlDataSet;
! import java.io.*;
import java.sql.SQLException;
import java.util.ArrayList;
- import java.util.List;
import java.util.Iterator;
/**
--- 30,41 ----
import org.dbunit.dataset.xml.XmlDataSet;
! import java.io.File;
! import java.io.FileWriter;
! import java.io.IOException;
! import java.io.Writer;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Iterator;
+ import java.util.List;
/**
***************
*** 50,56 ****
private File _dest;
! private String _format = "flat";
private List _tables = new ArrayList();
! // private List queries = new ArrayList();
public Export()
--- 53,61 ----
private File _dest;
! private static final String FORMAT_FLAT = "flat";
! private String _format = FORMAT_FLAT;
private List _tables = new ArrayList();
! private static final String FORMAT_XML = "xml";
! private static final String FORMAT_DTD = "dtd";
public Export()
***************
*** 85,91 ****
public void setFormat(String format)
{
! if (format.equalsIgnoreCase("flat")
! || format.equalsIgnoreCase("xml")
! || format.equalsIgnoreCase("dtd"))
{
_format = format;
--- 90,96 ----
public void setFormat(String format)
{
! if (format.equalsIgnoreCase(FORMAT_FLAT)
! || format.equalsIgnoreCase(FORMAT_XML)
! || format.equalsIgnoreCase(FORMAT_DTD))
{
_format = format;
***************
*** 147,159 ****
try
{
! if (_format.equalsIgnoreCase("flat"))
{
FlatXmlDataSet.write(dataset, out);
}
! else if (_format.equalsIgnoreCase("xml"))
{
XmlDataSet.write(dataset, out);
}
! else if (_format.equalsIgnoreCase("dtd"))
{
FlatDtdDataSet.write(dataset, out);
--- 152,164 ----
try
{
! if (_format.equalsIgnoreCase(FORMAT_FLAT))
{
FlatXmlDataSet.write(dataset, out);
}
! else if (_format.equalsIgnoreCase(FORMAT_XML))
{
XmlDataSet.write(dataset, out);
}
! else if (_format.equalsIgnoreCase(FORMAT_DTD))
{
FlatDtdDataSet.write(dataset, out);
***************
*** 179,183 ****
throws DataSetException, SQLException
{
! return connection.createDataSet().getTable(table.getName());
}
--- 184,199 ----
throws DataSetException, SQLException
{
! IDataSet databaseDataSet = connection.createDataSet();
!
! // Optimization: do not fetch table data since DTD export only use
! // table metadata.
! if (_format.equalsIgnoreCase(FORMAT_DTD))
! {
! ITableMetaData metaData =
! databaseDataSet.getTableMetaData(table.getName());
! return new DefaultTable(metaData, new ArrayList());
! }
!
! return databaseDataSet.getTable(table.getName());
}
***************
*** 186,200 ****
{
return connection.createQueryTable(query.getName(), query.getSql());
- }
-
- private String[] getTableArray()
- {
- String[] result = new String[_tables.size()];
- for (int i = 0; i < _tables.size(); i++)
- {
- Table table = (Table)_tables.get(i);
- result[i] = table.getName();
- }
- return result;
}
--- 202,205 ----
|