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-13 17:46:13
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit
In directory sc8-pr-cvs1:/tmp/cvs-serv27639/src/test/org/dbunit
Modified Files:
TestFeature.java
Log Message:
New TRUNCATE_TABLE operation..
Index: TestFeature.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/TestFeature.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** TestFeature.java 13 Apr 2003 02:40:10 -0000 1.1
--- TestFeature.java 13 Apr 2003 17:46:10 -0000 1.2
***************
*** 33,36 ****
--- 33,37 ----
public static final TestFeature SCOLLABLE_RESULTSET = new TestFeature("SCOLLABLE_RESULTSET");
public static final TestFeature INSERT_IDENTITY = new TestFeature("INSERT_IDENTITY");
+ public static final TestFeature TRUNCATE_TABLE = new TestFeature("TRUNCATE_TABLE");;
private final String _name;
|
|
From: <mla...@us...> - 2003-04-13 17:46:13
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/operation
In directory sc8-pr-cvs1:/tmp/cvs-serv27639/src/java/org/dbunit/operation
Modified Files:
DatabaseOperation.java DeleteAllOperation.java
Added Files:
TruncateTableOperation.java
Log Message:
New TRUNCATE_TABLE operation..
--- NEW FILE: TruncateTableOperation.java ---
/*
* CompositeOperation.java Feb 18, 2002
*
* 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.operation;
import org.dbunit.DatabaseUnitException;
import org.dbunit.database.IDatabaseConnection;
import org.dbunit.dataset.IDataSet;
import java.sql.SQLException;
/**
* Truncate tables present in the specified dataset. If the dataset does not
* contains a particular table, but that table exists in the database,
* the database table is not affected. Table are truncated in
* reverse sequence.
* <p>
* This operation has the same effect of as {@link DeleteAllOperation}.
* TruncateTableOperation is faster, and it is non-logged, meaning it cannot be
* rollback. DeleteAllOperation is more portable because not all database vendor
* support TRUNCATE_TABLE TABLE statement.
*
* @author Manuel Laflamme
* @since Apr 10, 2003
* @version $Revision: 1.1 $
* @see DeleteAllOperation
*/
public class TruncateTableOperation extends DeleteAllOperation
{
static final String SUPPORT_BATCH_STATEMENT = "dbunit.database.supportBatchStatement";
TruncateTableOperation()
{
}
////////////////////////////////////////////////////////////////////////////
// DeleteAllOperation class
protected String getDeleteAllCommand()
{
return "truncate table ";
}
////////////////////////////////////////////////////////////////////////////
// DatabaseOperation class
public void execute(IDatabaseConnection connection, IDataSet dataSet)
throws DatabaseUnitException, SQLException
{
// Patch to make it work with MS SQL Server
String oldValue = System.getProperty(SUPPORT_BATCH_STATEMENT, "true");
try
{
System.setProperty(SUPPORT_BATCH_STATEMENT, "false");
super.execute(connection, dataSet);
}
finally
{
System.setProperty(SUPPORT_BATCH_STATEMENT, oldValue);
}
}
}
Index: DatabaseOperation.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/operation/DatabaseOperation.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** DatabaseOperation.java 13 Jun 2002 17:24:57 -0000 1.9
--- DatabaseOperation.java 13 Apr 2003 17:46:10 -0000 1.10
***************
*** 37,41 ****
public abstract class DatabaseOperation
{
! public static final DatabaseOperation NONE = new DummyAction();
public static final DatabaseOperation UPDATE = new UpdateOperation();
public static final DatabaseOperation INSERT = new InsertOperation();
--- 37,41 ----
public abstract class DatabaseOperation
{
! public static final DatabaseOperation NONE = new DummyOperation();
public static final DatabaseOperation UPDATE = new UpdateOperation();
public static final DatabaseOperation INSERT = new InsertOperation();
***************
*** 43,46 ****
--- 43,47 ----
public static final DatabaseOperation DELETE = new DeleteOperation();
public static final DatabaseOperation DELETE_ALL = new DeleteAllOperation();
+ public static final DatabaseOperation TRUNCATE_TABLE = new TruncateTableOperation();
public static final DatabaseOperation CLEAN_INSERT = new CompositeOperation(
DELETE_ALL, INSERT);
***************
*** 56,60 ****
IDataSet dataSet) throws DatabaseUnitException, SQLException;
! private static class DummyAction extends DatabaseOperation
{
public void execute(IDatabaseConnection connection, IDataSet dataSet)
--- 57,61 ----
IDataSet dataSet) throws DatabaseUnitException, SQLException;
! private static class DummyOperation extends DatabaseOperation
{
public void execute(IDatabaseConnection connection, IDataSet dataSet)
Index: DeleteAllOperation.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/operation/DeleteAllOperation.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** DeleteAllOperation.java 9 Apr 2003 22:52:11 -0000 1.14
--- DeleteAllOperation.java 13 Apr 2003 17:46:10 -0000 1.15
***************
*** 1,5 ****
/*
- * CompositeOperation.java Feb 18, 2002
- *
* The DbUnit Database Testing Framework
* Copyright (C)2002, Manuel Laflamme
--- 1,3 ----
***************
*** 32,42 ****
/**
! * Deletes entire database table contents for each table contained in dataset.
! * In other words, if a dataset does not contain a particular table, but that
! * table exists in the database, the contents of that table is not deleted.
! * Deletes are performed on table in reverse sequence.
*
* @author Manuel Laflamme
* @version $Revision$
*/
public class DeleteAllOperation extends DatabaseOperation
--- 30,47 ----
/**
! * Deletes all rows of tables present in the specified dataset. If the dataset
! * does not contains a particular table, but that table exists in the database,
! * the database table is not affected. Table are truncated in
! * reverse sequence.
! * <p>
! * This operation has the same effect of as {@link TruncateTableOperation}.
! * TruncateTableOperation is faster, and it is non-logged, meaning it cannot be
! * rollback. DeleteAllOperation is more portable because not all database vendor
! * support TRUNCATE_TABLE TABLE statement.
*
* @author Manuel Laflamme
+ * @since Feb 18, 2002
* @version $Revision$
+ * @see TruncateTableOperation
*/
public class DeleteAllOperation extends DatabaseOperation
***************
*** 46,49 ****
--- 51,59 ----
}
+ protected String getDeleteAllCommand()
+ {
+ return "delete from ";
+ }
+
////////////////////////////////////////////////////////////////////////////
// DatabaseOperation class
***************
*** 70,74 ****
StringBuffer sqlBuffer = new StringBuffer(128);
! sqlBuffer.append("delete from ");
sqlBuffer.append(DataSetUtils.getQualifiedName(
connection.getSchema(), tableName, true));
--- 80,84 ----
StringBuffer sqlBuffer = new StringBuffer(128);
! sqlBuffer.append(getDeleteAllCommand());
sqlBuffer.append(DataSetUtils.getQualifiedName(
connection.getSchema(), tableName, true));
|
|
From: <mla...@us...> - 2003-04-13 16:50:03
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/operation
In directory sc8-pr-cvs1:/tmp/cvs-serv1781/src/test/org/dbunit/operation
Modified Files:
InsertOperationTest.java RefreshOperationTest.java
UpdateOperationTest.java
Log Message:
Modified INSERT, UPDATE, REFRESH and INSERT_IDENTITY operations to
support buffered dataset. Not supported by other operations.
Index: InsertOperationTest.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/operation/InsertOperationTest.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** InsertOperationTest.java 13 Apr 2003 02:40:12 -0000 1.19
--- InsertOperationTest.java 13 Apr 2003 16:49:59 -0000 1.20
***************
*** 38,41 ****
--- 38,42 ----
import org.dbunit.dataset.ITable;
import org.dbunit.dataset.LowerCaseDataSet;
+ import org.dbunit.dataset.ForwardOnlyDataSet;
import org.dbunit.dataset.datatype.DataType;
import org.dbunit.dataset.xml.FlatXmlDataSet;
***************
*** 347,350 ****
--- 348,359 ----
}
+ public void testExecuteForwardOnly() throws Exception
+ {
+ Reader in = new FileReader("src/xml/insertOperationTest.xml");
+ IDataSet dataSet = new XmlDataSet(in);
+
+ testExecute(new ForwardOnlyDataSet(dataSet));
+ }
+
private void testExecute(IDataSet dataSet) throws Exception, SQLException
{
***************
*** 373,377 ****
if (name.startsWith("EMPTY"))
{
! Assertion.assertEquals(dataSet.getTable(name), table);
}
}
--- 382,393 ----
if (name.startsWith("EMPTY"))
{
! if (dataSet instanceof ForwardOnlyDataSet)
! {
! assertTrue(name, table.getRowCount() > 0);
! }
! else
! {
! Assertion.assertEquals(dataSet.getTable(name), table);
! }
}
}
Index: RefreshOperationTest.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/operation/RefreshOperationTest.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** RefreshOperationTest.java 10 Apr 2003 02:52:07 -0000 1.13
--- RefreshOperationTest.java 13 Apr 2003 16:49:59 -0000 1.14
***************
*** 35,38 ****
--- 35,39 ----
import org.dbunit.dataset.LowerCaseDataSet;
import org.dbunit.dataset.NoPrimaryKeyException;
+ import org.dbunit.dataset.ForwardOnlyDataSet;
import org.dbunit.dataset.datatype.DataType;
import org.dbunit.dataset.xml.FlatXmlDataSet;
***************
*** 67,70 ****
--- 68,79 ----
testExecute(new LowerCaseDataSet(dataSet));
+ }
+
+ public void testExecuteForwardOnly() throws Exception
+ {
+ Reader reader = new FileReader("src/xml/refreshOperationTest.xml");
+ IDataSet dataSet = new FlatXmlDataSet(reader);
+
+ testExecute(new ForwardOnlyDataSet(dataSet));
}
Index: UpdateOperationTest.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/operation/UpdateOperationTest.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** UpdateOperationTest.java 13 Apr 2003 02:40:12 -0000 1.19
--- UpdateOperationTest.java 13 Apr 2003 16:49:59 -0000 1.20
***************
*** 30,42 ****
import org.dbunit.database.statement.MockBatchStatement;
import org.dbunit.database.statement.MockStatementFactory;
! import org.dbunit.dataset.Column;
! import org.dbunit.dataset.CompositeDataSet;
! import org.dbunit.dataset.DefaultDataSet;
! import org.dbunit.dataset.DefaultTable;
! import org.dbunit.dataset.DefaultTableMetaData;
! import org.dbunit.dataset.IDataSet;
! import org.dbunit.dataset.ITable;
! import org.dbunit.dataset.LowerCaseDataSet;
! import org.dbunit.dataset.NoPrimaryKeyException;
import org.dbunit.dataset.datatype.DataType;
import org.dbunit.dataset.xml.FlatXmlDataSet;
--- 30,34 ----
import org.dbunit.database.statement.MockBatchStatement;
import org.dbunit.database.statement.MockStatementFactory;
! import org.dbunit.dataset.*;
import org.dbunit.dataset.datatype.DataType;
import org.dbunit.dataset.xml.FlatXmlDataSet;
***************
*** 346,349 ****
--- 338,350 ----
testExecute(new LowerCaseDataSet(dataSet));
+ }
+
+ public void testExecuteForwardOnly() throws Exception
+ {
+ Reader in = new FileReader(
+ new File("src/xml/updateOperationTest.xml"));
+ IDataSet dataSet = new XmlDataSet(in);
+
+ testExecute(new ForwardOnlyDataSet(dataSet));
}
|
|
From: <mla...@us...> - 2003-04-13 16:50:02
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/operation/mssqlserver
In directory sc8-pr-cvs1:/tmp/cvs-serv1781/src/test/org/dbunit/operation/mssqlserver
Modified Files:
InsertIdentityOperationTest.java
Log Message:
Modified INSERT, UPDATE, REFRESH and INSERT_IDENTITY operations to
support buffered dataset. Not supported by other operations.
Index: InsertIdentityOperationTest.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/operation/mssqlserver/InsertIdentityOperationTest.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** InsertIdentityOperationTest.java 13 Apr 2003 02:40:12 -0000 1.6
--- InsertIdentityOperationTest.java 13 Apr 2003 16:49:59 -0000 1.7
***************
*** 28,31 ****
--- 28,33 ----
import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.ITable;
+ import org.dbunit.dataset.LowerCaseDataSet;
+ import org.dbunit.dataset.ForwardOnlyDataSet;
import org.dbunit.dataset.xml.FlatXmlDataSet;
import org.dbunit.dataset.xml.XmlDataSet;
***************
*** 46,121 ****
}
- // public static Test suite()
- // {
- // return new InsertIdentityOperationTest("testInsertBlob");
- // }
-
-
-
public void testExecuteXML() throws Exception
{
- // System.out.println("mssql");
Reader in = new FileReader("src/xml/insertIdentityOperationTest.xml");
! IDataSet xmlDataSet = new XmlDataSet(in);
!
! ITable[] tablesBefore = DataSetUtils.getTables(_connection.createDataSet());
! InsertIdentityOperation.CLEAN_INSERT.execute(_connection, xmlDataSet);
! ITable[] tablesAfter = DataSetUtils.getTables(_connection.createDataSet());
! assertEquals("table count", tablesBefore.length, tablesAfter.length);
! for (int i = 0; i < tablesBefore.length; i++)
! {
! ITable table = tablesBefore[i];
! String name = table.getTableMetaData().getTableName();
! if (name.startsWith("IDENTITY"))
! {
! assertTrue("Should have either 0 or 6", table.getRowCount() == 0 | table.getRowCount() == 6);
! }
! }
! for (int i = 0; i < tablesAfter.length; i++)
! {
! ITable table = tablesAfter[i];
! String name = table.getTableMetaData().getTableName();
! if (name.startsWith("IDENTITY"))
! {
! Assertion.assertEquals(xmlDataSet.getTable(name), table);
! }
! }
}
! public void testExecuteFlatXML() throws Exception
{
Reader in = new FileReader("src/xml/insertIdentityOperationTestFlat.xml");
! IDataSet xmlDataSet = new FlatXmlDataSet(in);
ITable[] tablesBefore = DataSetUtils.getTables(_connection.createDataSet());
! InsertIdentityOperation.CLEAN_INSERT.execute(_connection, xmlDataSet);
ITable[] tablesAfter = DataSetUtils.getTables(_connection.createDataSet());
assertEquals("table count", tablesBefore.length, tablesAfter.length);
- for (int i = 0; i < tablesBefore.length; i++)
- {
- ITable table = tablesBefore[i];
- String name = table.getTableMetaData().getTableName();
if (name.startsWith("IDENTITY"))
{
!
! assertTrue("Should have either 0 or 6", table.getRowCount() == 0 | table.getRowCount() == 6);
}
! }
!
! for (int i = 0; i < tablesAfter.length; i++)
! {
! ITable table = tablesAfter[i];
! String name = table.getTableMetaData().getTableName();
! if (name.startsWith("IDENTITY"))
{
! Assertion.assertEquals(xmlDataSet.getTable(name), table);
}
}
--- 48,115 ----
}
public void testExecuteXML() throws Exception
{
Reader in = new FileReader("src/xml/insertIdentityOperationTest.xml");
! IDataSet dataSet = new XmlDataSet(in);
! testExecute(dataSet);
! }
+ public void testExecuteFlatXML() throws Exception
+ {
+ Reader in = new FileReader("src/xml/insertIdentityOperationTestFlat.xml");
+ IDataSet dataSet = new FlatXmlDataSet(in);
! testExecute(dataSet);
! }
! public void testExecuteLowerCase() throws Exception
! {
! Reader in = new FileReader("src/xml/insertIdentityOperationTestFlat.xml");
! IDataSet dataSet = new LowerCaseDataSet(new FlatXmlDataSet(in));
! testExecute(dataSet);
}
! public void testExecuteForwardOnly() throws Exception
{
Reader in = new FileReader("src/xml/insertIdentityOperationTestFlat.xml");
! IDataSet dataSet = new ForwardOnlyDataSet(new FlatXmlDataSet(in));
+ testExecute(dataSet);
+ }
+
+ private void testExecute(IDataSet dataSet) throws Exception
+ {
ITable[] tablesBefore = DataSetUtils.getTables(_connection.createDataSet());
! // InsertIdentityOperation.CLEAN_INSERT.execute(_connection, dataSet);
! InsertIdentityOperation.INSERT.execute(_connection, dataSet);
ITable[] tablesAfter = DataSetUtils.getTables(_connection.createDataSet());
assertEquals("table count", tablesBefore.length, tablesAfter.length);
+ // Verify tables after
+ for (int i = 0; i < tablesAfter.length; i++)
+ {
+ ITable tableBefore = tablesBefore[i];
+ ITable tableAfter = tablesAfter[i];
+ String name = tableAfter.getTableMetaData().getTableName();
if (name.startsWith("IDENTITY"))
{
! assertEquals("row count before: " + name, 0, tableBefore.getRowCount());
! if (dataSet instanceof ForwardOnlyDataSet)
! {
! assertTrue(name, tableAfter.getRowCount() > 0);
! }
! else
! {
! Assertion.assertEquals(dataSet.getTable(name), tableAfter);
! }
}
! else
{
! // Other tables should have not been affected
! Assertion.assertEquals(tableBefore, tableAfter);
}
}
***************
*** 135,159 ****
ITable[] tablesAfter = DataSetUtils.getTables(_connection.createDataSet());
! assertEquals("table count", tablesBefore.length, tablesAfter.length);
! for (int i = 0; i < tablesBefore.length; i++)
{
! ITable table = tablesBefore[i];
! String name = table.getTableMetaData().getTableName();
!
if (name.equals("TEST_IDENTITY_NOT_PK"))
{
!
! assertTrue("Should have either 0 or 6", table.getRowCount() == 0 | table.getRowCount() == 6);
}
! }
!
! for (int i = 0; i < tablesAfter.length; i++)
! {
! ITable table = tablesAfter[i];
! String name = table.getTableMetaData().getTableName();
! if (name.equals("TEST_IDENTITY_NOT_PK"))
{
! Assertion.assertEquals(xmlDataSet.getTable(name), table);
}
}
--- 129,148 ----
ITable[] tablesAfter = DataSetUtils.getTables(_connection.createDataSet());
! // Verify tables after
! for (int i = 0; i < tablesAfter.length; i++)
{
! ITable tableBefore = tablesBefore[i];
! ITable tableAfter = tablesAfter[i];
+ String name = tableAfter.getTableMetaData().getTableName();
if (name.equals("TEST_IDENTITY_NOT_PK"))
{
! assertEquals("row count before: " + name, 0, tableBefore.getRowCount());
! Assertion.assertEquals(xmlDataSet.getTable(name), tableAfter);
}
! else
{
! // Other tables should have not been affected
! Assertion.assertEquals(tableBefore, tableAfter);
}
}
|
|
From: <mla...@us...> - 2003-04-13 16:50:02
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset
In directory sc8-pr-cvs1:/tmp/cvs-serv1781/src/test/org/dbunit/dataset
Modified Files:
ForwardOnlyTableTest.java
Log Message:
Modified INSERT, UPDATE, REFRESH and INSERT_IDENTITY operations to
support buffered dataset. Not supported by other operations.
Index: ForwardOnlyTableTest.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/ForwardOnlyTableTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ForwardOnlyTableTest.java 13 Apr 2003 02:40:11 -0000 1.1
--- ForwardOnlyTableTest.java 13 Apr 2003 16:49:58 -0000 1.2
***************
*** 98,100 ****
--- 98,117 ----
}
}
+
+ public void testGetValueOnEmptyTable() throws Exception
+ {
+ MockTableMetaData metaData =
+ new MockTableMetaData("TABLE", new String[] {"C1"});
+ ITable table = new ForwardOnlyTable(new DefaultTable(metaData));
+ try
+ {
+ table.getValue(0, "C1");
+ fail("Should have throw RowOutOfBoundsException");
+ }
+ catch (RowOutOfBoundsException e)
+ {
+
+ }
+ }
+
}
|
|
From: <mla...@us...> - 2003-04-13 16:50:02
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/operation
In directory sc8-pr-cvs1:/tmp/cvs-serv1781/src/java/org/dbunit/operation
Modified Files:
AbstractBatchOperation.java RefreshOperation.java
Log Message:
Modified INSERT, UPDATE, REFRESH and INSERT_IDENTITY operations to
support buffered dataset. Not supported by other operations.
Index: AbstractBatchOperation.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/operation/AbstractBatchOperation.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** AbstractBatchOperation.java 9 Apr 2003 22:52:11 -0000 1.17
--- AbstractBatchOperation.java 13 Apr 2003 16:49:58 -0000 1.18
***************
*** 77,80 ****
--- 77,103 ----
}
+ static boolean isEmpty(ITable table) throws DataSetException
+ {
+ Column[] columns = table.getTableMetaData().getColumns();
+
+ // No columns = empty
+ if (columns.length == 0)
+ {
+ return true;
+ }
+
+ // Try to fetch first table value
+ try
+ {
+ table.getValue(0, columns[0].getColumnName());
+ return false;
+ }
+ catch (RowOutOfBoundsException e)
+ {
+ // Not able to access first row thus empty
+ return true;
+ }
+ }
+
/**
* Returns list of tables this operation is applied to. This method
***************
*** 99,108 ****
// for each table
ITableIterator iterator = iterator(dataSet);
! while(iterator.next())
{
ITable table = iterator.getTable();
! // do not process empty table
! if (table.getRowCount() == 0)
{
continue;
--- 122,131 ----
// for each table
ITableIterator iterator = iterator(dataSet);
! while (iterator.next())
{
ITable table = iterator.getTable();
! // Do not process empty table
! if (isEmpty(table))
{
continue;
***************
*** 121,138 ****
Column[] columns = operationData.getColumns();
! // for each row
! int rowCount = table.getRowCount();
! for (int i = 0; i < rowCount; i++)
! {
! int row = _reverseRowOrder ? (rowCount - 1 - i) : i;
! // for each column
! for (int j = 0; j < columns.length; j++)
{
! Column column = columns[j];
! statement.addValue(table.getValue(row,
! column.getColumnName()), column.getDataType());
}
! statement.addBatch();
}
--- 144,170 ----
Column[] columns = operationData.getColumns();
! // For each row
! int start = _reverseRowOrder ? table.getRowCount() - 1 : 0;
! int increment = _reverseRowOrder ? -1 : 1;
! try
! {
! for (int i = start; ; i = i + increment)
{
! int row = i;
!
! // for each column
! for (int j = 0; j < columns.length; j++)
! {
! Column column = columns[j];
! statement.addValue(table.getValue(row,
! column.getColumnName()), column.getDataType());
! }
! statement.addBatch();
}
! }
! catch (RowOutOfBoundsException e)
! {
! // end of table
}
Index: RefreshOperation.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/operation/RefreshOperation.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** RefreshOperation.java 9 Apr 2003 22:52:12 -0000 1.24
--- RefreshOperation.java 13 Apr 2003 16:49:58 -0000 1.25
***************
*** 51,54 ****
--- 51,66 ----
}
+ private boolean isEmpty(ITable table) throws DataSetException
+ {
+ return AbstractBatchOperation.isEmpty(table);
+ }
+
+ private ITableMetaData getOperationMetaData(IDatabaseConnection connection,
+ ITableMetaData metaData) throws DatabaseUnitException, SQLException
+ {
+ return AbstractBatchOperation.getOperationMetaData(
+ connection, metaData);
+ }
+
////////////////////////////////////////////////////////////////////////////
// DatabaseOperation class
***************
*** 61,76 ****
// for each table
ITableIterator iterator = dataSet.iterator();
! while(iterator.next())
{
ITable table = iterator.getTable();
! // do not process empty table
! if (table.getRowCount() == 0)
{
continue;
}
! ITableMetaData metaData = AbstractBatchOperation.getOperationMetaData(
! connection, table.getTableMetaData());
RowOperation updateRowOperation = createUpdateOperation(connection,
schema, metaData);
--- 73,88 ----
// for each table
ITableIterator iterator = dataSet.iterator();
! while (iterator.next())
{
ITable table = iterator.getTable();
! // Do not process empty table
! if (isEmpty(table))
{
continue;
}
! ITableMetaData metaData = getOperationMetaData(connection,
! table.getTableMetaData());
RowOperation updateRowOperation = createUpdateOperation(connection,
schema, metaData);
***************
*** 78,93 ****
schema, metaData);
! // refresh all rows
! for (int i = 0; i < table.getRowCount(); i++)
{
! if (!updateRowOperation.execute(table, i))
{
! insertRowOperation.execute(table, i);
}
}
!
! // cleanup
! updateRowOperation.close();
! insertRowOperation.close();
}
--- 90,114 ----
schema, metaData);
! try
{
! // refresh all rows
! for (int i = 0; ; i++)
{
! if (!updateRowOperation.execute(table, i))
! {
! insertRowOperation.execute(table, i);
! }
}
}
! catch (RowOutOfBoundsException e)
! {
! // end of table
! }
! finally
! {
! // cleanup
! updateRowOperation.close();
! insertRowOperation.close();
! }
}
|
|
From: <mla...@us...> - 2003-04-13 05:14:46
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/database
In directory sc8-pr-cvs1:/tmp/cvs-serv5806/src/test/org/dbunit/database
Modified Files:
ForwardOnlyResultSetTableTest.java
Log Message:
Proactively close ForwardOnlyResultSet table when last row is reached.
Index: ForwardOnlyResultSetTableTest.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/database/ForwardOnlyResultSetTableTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ForwardOnlyResultSetTableTest.java 13 Apr 2003 02:40:11 -0000 1.1
--- ForwardOnlyResultSetTableTest.java 13 Apr 2003 05:14:44 -0000 1.2
***************
*** 21,29 ****
package org.dbunit.database;
import org.dbunit.dataset.ForwardOnlyTableTest;
import org.dbunit.dataset.ITable;
! import org.dbunit.DatabaseEnvironment;
import org.dbunit.operation.DatabaseOperation;
/**
* @author Manuel Laflamme
--- 21,34 ----
package org.dbunit.database;
+ import org.dbunit.DatabaseEnvironment;
import org.dbunit.dataset.ForwardOnlyTableTest;
import org.dbunit.dataset.ITable;
! import org.dbunit.dataset.MockTableMetaData;
! import org.dbunit.dataset.RowOutOfBoundsException;
! import org.dbunit.dataset.Column;
import org.dbunit.operation.DatabaseOperation;
+ import com.mockobjects.sql.MockMultiRowResultSet;
+
/**
* @author Manuel Laflamme
***************
*** 53,55 ****
--- 58,110 ----
// Do not test this!
}
+
+ public void testGetValueOnLastRowIsClosingResultSet() throws Exception
+ {
+ String tableName = "TABLE";
+ String[] columnNames = {"C0"};
+ // String[] columnNames = {"C0", "C1", "C2"};
+ Object[][] expectedValues = new Object[][]{
+ new Object[]{"1", "2", "3"},
+ new Object[]{"4", "5", "6"},
+ new Object[]{"7", "8", "9"},
+ };
+
+ // Setup resultset
+ MockMultiRowResultSet resultSet = new MockMultiRowResultSet();
+ resultSet.setExpectedCloseCalls(1);
+ resultSet.setupColumnNames(columnNames);
+ resultSet.setupRows(expectedValues);
+
+ // Create table
+ MockTableMetaData metaData = new MockTableMetaData(tableName, columnNames);
+ ForwardOnlyResultSetTable table =
+ new ForwardOnlyResultSetTable(metaData, resultSet);
+
+ // Excercise getValue()
+ try
+ {
+ Column[] columns = table.getTableMetaData().getColumns();
+
+ for (int i = 0; ; i++)
+ {
+ for (int j = 0; j < columns.length; j++)
+ {
+ String columnName = columns[j].getColumnName();
+ Object actualValue = table.getValue(i, columnName);
+ Object expectedValue = expectedValues[i][j];
+ assertEquals("row=" + i + ", col=" + columnName,
+ expectedValue, actualValue);
+
+ }
+ }
+ }
+ catch(RowOutOfBoundsException e)
+ {
+ // end of table
+ }
+
+ // Verify that ResultSet have been closed
+ resultSet.verify();
+ }
+
}
|
|
From: <mla...@us...> - 2003-04-13 05:14:46
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/database
In directory sc8-pr-cvs1:/tmp/cvs-serv5806/src/java/org/dbunit/database
Modified Files:
ForwardOnlyResultSetTable.java
Log Message:
Proactively close ForwardOnlyResultSet table when last row is reached.
Index: ForwardOnlyResultSetTable.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/ForwardOnlyResultSetTable.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ForwardOnlyResultSetTable.java 13 Apr 2003 02:40:09 -0000 1.1
--- ForwardOnlyResultSetTable.java 13 Apr 2003 05:14:43 -0000 1.2
***************
*** 82,85 ****
--- 82,87 ----
if (_eot || row > _lastRow)
{
+ // Proactively close the resultset
+ close();
throw new RowOutOfBoundsException(row + " > " + _lastRow);
}
|
|
From: <mla...@us...> - 2003-04-13 05:13:55
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset
In directory sc8-pr-cvs1:/tmp/cvs-serv5614/src/test/org/dbunit/dataset
Added Files:
MockDataSet.java MockTableMetaData.java
Log Message:
Moved MockDataSet from 'database' to 'dataset' package.
--- NEW FILE: MockDataSet.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 org.dbunit.dataset.DefaultDataSet;
import org.dbunit.dataset.ITableIterator;
import org.dbunit.dataset.AbstractDataSet;
import org.dbunit.dataset.ITable;
import org.dbunit.dataset.DataSetException;
import org.dbunit.dataset.DefaultTableIterator;
import org.dbunit.dataset.DefaultTable;
import com.mockobjects.Verifiable;
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
/**
* @author Manuel Laflamme
* @since Apr 12, 2003
* @version $Revision: 1.1 $
*/
public class MockDataSet extends AbstractDataSet implements Verifiable
{
private final List _tableList = new ArrayList();
public void addTable(ITable table)
{
_tableList.add(table);
}
public void addEmptyTable(String tableName)
{
_tableList.add(new DefaultTable(tableName));
}
////////////////////////////////////////////////////////////////////////////
// AbstractDataSet class
protected ITableIterator createIterator(boolean reversed)
throws DataSetException
{
ITable[] tables = (ITable[])_tableList.toArray(new ITable[0]);
return new DefaultTableIterator(tables, reversed);
}
///////////////////////////////////////////////////////////////////////////
// Verifiable interface
public void verify()
{
for (Iterator it = _tableList.iterator(); it.hasNext();)
{
ITable table = (ITable)it.next();
if (table instanceof Verifiable)
{
((Verifiable)table).verify();
}
}
}
}
--- NEW FILE: MockTableMetaData.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 org.dbunit.dataset.datatype.DataType;
/**
* @author Manuel Laflamme
* @since Apr 12, 2003
* @version $Revision: 1.1 $
*/
public class MockTableMetaData extends AbstractTableMetaData
{
private String _tableName;
private Column[] _columns = new Column[0];
private String[] _keyNames = new String[0];
public MockTableMetaData()
{
}
public MockTableMetaData(String tableName, String[] columnNames)
{
_tableName = tableName;
setupColumns(columnNames);
}
public void setTableName(String tableName)
{
_tableName = tableName;
}
public void setupColumns(Column[] columns)
{
_columns = columns;
}
public void setupColumns(String[] columnNames)
{
Column[] columns = new Column[columnNames.length];
for (int i = 0; i < columnNames.length; i++)
{
String columnName = columnNames[i];
columns[i] = new Column(columnName, DataType.UNKNOWN);
}
_columns = columns;
}
public void setupPrimaryKeys(String[] keyNames)
{
_keyNames = keyNames;
}
////////////////////////////////////////////////////////////////////////////
// ITableMetaData interface
public String getTableName()
{
return _tableName;
}
public Column[] getColumns() throws DataSetException
{
return _columns;
}
public Column[] getPrimaryKeys() throws DataSetException
{
return getPrimaryKeys(_columns, _keyNames);
}
}
|
|
From: <mla...@us...> - 2003-04-13 05:13:55
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/database In directory sc8-pr-cvs1:/tmp/cvs-serv5614/src/test/org/dbunit/database Modified Files: DatabaseTableIteratorTest.java Removed Files: MockDataSet.java Log Message: Moved MockDataSet from 'database' to 'dataset' package. Index: DatabaseTableIteratorTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/database/DatabaseTableIteratorTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DatabaseTableIteratorTest.java 13 Apr 2003 03:38:01 -0000 1.2 --- DatabaseTableIteratorTest.java 13 Apr 2003 05:13:52 -0000 1.3 *************** *** 24,27 **** --- 24,28 ---- import org.dbunit.dataset.ITable; import org.dbunit.dataset.ITableIterator; + import org.dbunit.dataset.MockDataSet; /** --- MockDataSet.java DELETED --- |
|
From: <mla...@us...> - 2003-04-13 05:13:55
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/filter In directory sc8-pr-cvs1:/tmp/cvs-serv5614/src/test/org/dbunit/dataset/filter Modified Files: SequenceTableIteratorTest.java Log Message: Moved MockDataSet from 'database' to 'dataset' package. Index: SequenceTableIteratorTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/filter/SequenceTableIteratorTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SequenceTableIteratorTest.java 13 Apr 2003 03:38:02 -0000 1.3 --- SequenceTableIteratorTest.java 13 Apr 2003 05:13:52 -0000 1.4 *************** *** 24,28 **** import org.dbunit.database.DatabaseDataSet; import org.dbunit.database.IDatabaseConnection; ! import org.dbunit.database.MockDataSet; import org.dbunit.database.MockResultSetTable; import org.dbunit.database.DatabaseTableIterator; --- 24,28 ---- import org.dbunit.database.DatabaseDataSet; import org.dbunit.database.IDatabaseConnection; ! import org.dbunit.dataset.MockDataSet; import org.dbunit.database.MockResultSetTable; import org.dbunit.database.DatabaseTableIterator; |
|
From: <mla...@us...> - 2003-04-13 03:38:05
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/filter
In directory sc8-pr-cvs1:/tmp/cvs-serv16222/src/test/org/dbunit/dataset/filter
Modified Files:
SequenceTableIteratorTest.java
Log Message:
Added back the DatabaseTableIterator class. This iterator close the previous ResultSet table on each next() call.
Index: SequenceTableIteratorTest.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/filter/SequenceTableIteratorTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SequenceTableIteratorTest.java 9 Apr 2003 22:52:16 -0000 1.2
--- SequenceTableIteratorTest.java 13 Apr 2003 03:38:02 -0000 1.3
***************
*** 21,30 ****
package org.dbunit.dataset.filter;
- import org.dbunit.dataset.AbstractTableIteratorTest;
- import org.dbunit.dataset.ITableIterator;
- import org.dbunit.dataset.filter.SequenceTableIterator;
import org.dbunit.DatabaseEnvironment;
- import org.dbunit.database.IDatabaseConnection;
import org.dbunit.database.DatabaseDataSet;
/**
--- 21,32 ----
package org.dbunit.dataset.filter;
import org.dbunit.DatabaseEnvironment;
import org.dbunit.database.DatabaseDataSet;
+ import org.dbunit.database.IDatabaseConnection;
+ import org.dbunit.database.MockDataSet;
+ import org.dbunit.database.MockResultSetTable;
+ import org.dbunit.database.DatabaseTableIterator;
+ import org.dbunit.dataset.AbstractTableIteratorTest;
+ import org.dbunit.dataset.ITableIterator;
/**
***************
*** 35,40 ****
public class SequenceTableIteratorTest extends AbstractTableIteratorTest
{
- protected IDatabaseConnection _connection;
-
public SequenceTableIteratorTest(String s)
{
--- 37,40 ----
***************
*** 42,76 ****
}
- ////////////////////////////////////////////////////////////////////////////
- // TestCase class
-
- protected void setUp() throws Exception
- {
- super.setUp();
-
- _connection = DatabaseEnvironment.getInstance().getConnection();
- }
-
- protected void tearDown() throws Exception
- {
- super.tearDown();
-
- _connection = null;
- }
-
- protected String[] getExpectedNames() throws Exception
- {
- return _connection.createDataSet().getTableNames();
- }
-
protected ITableIterator getIterator() throws Exception
{
! return _connection.createDataSet().iterator();
}
protected ITableIterator getEmptyIterator() throws Exception
{
! return new SequenceTableIterator(new String[0],
! (DatabaseDataSet)_connection.createDataSet());
}
}
--- 42,61 ----
}
protected ITableIterator getIterator() throws Exception
{
! String[] expectedNames = getExpectedNames();
! MockDataSet dataSet = new MockDataSet();
! for (int i = 0; i < expectedNames.length; i++)
! {
! String tableName = expectedNames[i];
! dataSet.addEmptyTable(tableName);
! }
!
! return new SequenceTableIterator(expectedNames, dataSet);
}
protected ITableIterator getEmptyIterator() throws Exception
{
! return new SequenceTableIterator(new String[0], new MockDataSet());
}
}
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/database
In directory sc8-pr-cvs1:/tmp/cvs-serv16222/src/test/org/dbunit/database
Modified Files:
AllTests.java
Added Files:
DatabaseTableIteratorTest.java MockDataSet.java
MockResultSetTable.java
Log Message:
Added back the DatabaseTableIterator class. This iterator close the previous ResultSet table on each next() call.
--- NEW FILE: MockDataSet.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.DefaultDataSet;
import org.dbunit.dataset.ITableIterator;
import org.dbunit.dataset.AbstractDataSet;
import org.dbunit.dataset.ITable;
import org.dbunit.dataset.DataSetException;
import org.dbunit.dataset.DefaultTableIterator;
import org.dbunit.dataset.DefaultTable;
import com.mockobjects.Verifiable;
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
/**
* @author Manuel Laflamme
* @since Apr 12, 2003
* @version $Revision: 1.1 $
*/
public class MockDataSet extends AbstractDataSet implements Verifiable
{
private final List _tableList = new ArrayList();
public void addTable(ITable table)
{
_tableList.add(table);
}
public void addEmptyTable(String tableName)
{
_tableList.add(new DefaultTable(tableName));
}
////////////////////////////////////////////////////////////////////////////
// AbstractDataSet class
protected ITableIterator createIterator(boolean reversed)
throws DataSetException
{
ITable[] tables = (ITable[])_tableList.toArray(new ITable[0]);
return new DefaultTableIterator(tables, reversed);
}
///////////////////////////////////////////////////////////////////////////
// Verifiable interface
public void verify()
{
for (Iterator it = _tableList.iterator(); it.hasNext();)
{
ITable table = (ITable)it.next();
if (table instanceof Verifiable)
{
((Verifiable)table).verify();
}
}
}
}
--- NEW FILE: MockResultSetTable.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.ITableMetaData;
import org.dbunit.dataset.DefaultTableMetaData;
import org.dbunit.dataset.Column;
import com.mockobjects.ExpectationCounter;
import com.mockobjects.Verifiable;
/**
* @author Manuel Laflamme
* @since Apr 12, 2003
* @version $Revision: 1.1 $
*/
public class MockResultSetTable implements IResultSetTable, Verifiable
{
private final ExpectationCounter _closeCalls =
new ExpectationCounter("MockResultSetTable.close");
private ITableMetaData _metaData;
public void setupTableMetaData(String tableName)
{
_metaData = new DefaultTableMetaData(tableName, new Column[0]);
}
public void setExpectedCloseCalls(int callsCount)
{
_closeCalls.setExpected(callsCount);
}
///////////////////////////////////////////////////////////////////////////
// Verifiable interface
public void verify()
{
_closeCalls.verify();
}
////////////////////////////////////////////////////////////////////////////
// IResultSetTable interface
public Object getValue(int row, String column) throws DataSetException
{
return null;
}
public int getRowCount()
{
return 0;
}
public ITableMetaData getTableMetaData()
{
return _metaData;
}
public void close() throws DataSetException
{
_closeCalls.inc();
}
}
Index: AllTests.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/database/AllTests.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** AllTests.java 13 Apr 2003 02:40:11 -0000 1.11
--- AllTests.java 13 Apr 2003 03:38:01 -0000 1.12
***************
*** 42,45 ****
--- 42,46 ----
suite.addTest(new TestSuite(DatabaseConnectionTest.class));
suite.addTest(new TestSuite(DatabaseDataSetTest.class));
+ suite.addTest(new TestSuite(DatabaseTableIteratorTest.class));
suite.addTest(new TestSuite(DatabaseTableMetaDataTest.class));
suite.addTest(new TestSuite(ForwardOnlyResultSetTableTest.class));
|
|
From: <mla...@us...> - 2003-04-13 03:38:04
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/database
In directory sc8-pr-cvs1:/tmp/cvs-serv16222/src/java/org/dbunit/database
Modified Files:
DatabaseDataSet.java
Added Files:
DatabaseTableIterator.java
Log Message:
Added back the DatabaseTableIterator class. This iterator close the previous ResultSet table on each next() call.
Index: DatabaseDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/DatabaseDataSet.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** DatabaseDataSet.java 9 Apr 2003 22:52:08 -0000 1.20
--- DatabaseDataSet.java 13 Apr 2003 03:38:01 -0000 1.21
***************
*** 164,168 ****
}
! return new SequenceTableIterator(names, this);
}
--- 164,168 ----
}
! return new DatabaseTableIterator(names, this);
}
|
|
From: <mla...@us...> - 2003-04-13 02:50:02
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit
In directory sc8-pr-cvs1:/tmp/cvs-serv4142/src/test/org/dbunit
Modified Files:
OracleEnvironment.java
Log Message:
Oups! Removed extra 'f' character!
Index: OracleEnvironment.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/OracleEnvironment.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** OracleEnvironment.java 13 Apr 2003 02:40:10 -0000 1.3
--- OracleEnvironment.java 13 Apr 2003 02:49:58 -0000 1.4
***************
*** 40,44 ****
ITable[] extraTables = {
new DefaultTable("CLOB_TABLE"),
! new DefaultTable("BLOB_TABLE"),f
};
--- 40,44 ----
ITable[] extraTables = {
new DefaultTable("CLOB_TABLE"),
! new DefaultTable("BLOB_TABLE"),
};
|
|
From: <mla...@us...> - 2003-04-13 02:43:26
|
Update of /cvsroot/dbunit/dbunit
In directory sc8-pr-cvs1:/tmp/cvs-serv2745/dbunit
Modified Files:
dbunit.ipr profile.properties
Log Message:
* Test suite cleanup. Added new "unsupportedFeatures" property in
profile.properties file. Used to exclude tests of unsupported database
features. No more instanceof in tests.
* New ForwardOnlyResultSetTable class. Renamed ResultSetTable to
ScrollableResultSetTable. Another step toward support of very large
datasets; remains to implement buffered XML datasets.
* New ForwardOnlyDataSet and ForwardOnlyTable classes. Will be used
in test suite only to ensure that insert and export works with buffered
dataset/table implementations.
Index: dbunit.ipr
===================================================================
RCS file: /cvsroot/dbunit/dbunit/dbunit.ipr,v
retrieving revision 1.54
retrieving revision 1.55
diff -C2 -d -r1.54 -r1.55
*** dbunit.ipr 13 Mar 2003 02:24:12 -0000 1.54
--- dbunit.ipr 13 Apr 2003 02:43:23 -0000 1.55
***************
*** 13,17 ****
<root type="simple" url="file://$PROJECT_DIR$/src/java" />
<root type="simple" url="file://$PROJECT_DIR$/src/test" />
! <root type="simple" url="file://C:/projects/jakarta-poi-1.8.0/src/java" />
</root>
</sourcePath>
--- 13,19 ----
<root type="simple" url="file://$PROJECT_DIR$/src/java" />
<root type="simple" url="file://$PROJECT_DIR$/src/test" />
! <root type="simple" url="file://$PROJECT_DIR$/../../mockobjects-0.07-src/core" />
! <root type="simple" url="file://$PROJECT_DIR$/../../mockobjects-0.07-src/jdk/1.3" />
! <root type="simple" url="file://$PROJECT_DIR$/../../jakarta-poi-1.8.0/src/java" />
</root>
</sourcePath>
***************
*** 24,34 ****
<root type="simple" url="jar://$PROJECT_DIR$/lib/junit.jar!/" />
<root type="simple" url="jar://$PROJECT_DIR$/lib/j2ee.jar!/" />
- <root type="simple" url="jar://$PROJECT_DIR$/lib/mockobjects.jar!/" />
- <root type="simple" url="jar://$PROJECT_DIR$/lib/oracle-jdbc.jar!/" />
<root type="simple" url="jar://$PROJECT_DIR$/lib/ant.jar!/" />
<root type="simple" url="jar://$PROJECT_DIR$/lib/crimson.jar!/" />
<root type="simple" url="jar://$PROJECT_DIR$/lib/jaxp.jar!/" />
<root type="simple" url="jar://$PROJECT_DIR$/lib/hsqldb.jar!/" />
! <root type="simple" url="jar://$PROJECT_DIR$/lib/jakarta-poi.jar!/" />
</root>
</classPath>
--- 26,40 ----
<root type="simple" url="jar://$PROJECT_DIR$/lib/junit.jar!/" />
<root type="simple" url="jar://$PROJECT_DIR$/lib/j2ee.jar!/" />
<root type="simple" url="jar://$PROJECT_DIR$/lib/ant.jar!/" />
<root type="simple" url="jar://$PROJECT_DIR$/lib/crimson.jar!/" />
<root type="simple" url="jar://$PROJECT_DIR$/lib/jaxp.jar!/" />
<root type="simple" url="jar://$PROJECT_DIR$/lib/hsqldb.jar!/" />
! <root type="simple" url="jar://$PROJECT_DIR$/lib/mysql-connector-java-3.0.6-stable-bin.jar!/" />
! <root type="simple" url="jar://$PROJECT_DIR$/lib/mockobjects-0.07-core.jar!/" />
! <root type="simple" url="jar://$PROJECT_DIR$/lib/mockobjects-0.07-jdk1.3.jar!/" />
! <root type="simple" url="jar://$PROJECT_DIR$/lib/jakarta-poi-1.8.0-dev-20020919.jar!/" />
! <root type="simple" url="jar://$PROJECT_DIR$/lib/msbase.jar!/" />
! <root type="simple" url="jar://$PROJECT_DIR$/lib/mssqlserver.jar!/" />
! <root type="simple" url="jar://$PROJECT_DIR$/lib/msutil.jar!/" />
</root>
</classPath>
***************
*** 132,137 ****
</component>
<component name="CodeStyleManager">
! <option name="USE_DEFAULT_CODE_STYLE_SCHEME" value="true" />
! <option name="CODE_STYLE_SCHEME" value="" />
</component>
<component name="ExportToHTMLSettings">
--- 138,143 ----
</component>
<component name="CodeStyleManager">
! <option name="USE_DEFAULT_CODE_STYLE_SCHEME" value="false" />
! <option name="CODE_STYLE_SCHEME" value="dbunit" />
</component>
<component name="ExportToHTMLSettings">
Index: profile.properties
===================================================================
RCS file: /cvsroot/dbunit/dbunit/profile.properties,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** profile.properties 9 Apr 2003 22:52:07 -0000 1.23
--- profile.properties 13 Apr 2003 02:43:23 -0000 1.24
***************
*** 3,10 ****
##
! dbunit.profile = hypersonic
#dbunit.profile = oracle
#dbunit.profile = mysql
! #dbunit.profile = mssql
# dbunit.profile.{profileName}.driverClass = com.acme.driver
--- 3,10 ----
##
! #dbunit.profile = hypersonic
#dbunit.profile = oracle
#dbunit.profile = mysql
! dbunit.profile = mssql
# dbunit.profile.{profileName}.driverClass = com.acme.driver
***************
*** 13,16 ****
--- 13,17 ----
# dbunit.profile.{profileName}.user =
# dbunit.profile.{profileName}.password =
+ # dbunit.profile.{profileName}.unsupportedFeatures = BLOB,CLOB,TRANSACTION,SCOLLABLE_RESULTSET,INSERT_INDENTITY
dbunit.profile.hypersonic.driverClass = org.hsqldb.jdbcDriver
***************
*** 19,22 ****
--- 20,24 ----
dbunit.profile.hypersonic.user = sa
dbunit.profile.hypersonic.password =
+ dbunit.profile.hypersonic.unsupportedFeatures = BLOB,CLOB,SCOLLABLE_RESULTSET,INSERT_IDENTITY
dbunit.profile.oracle.driverClass = oracle.jdbc.driver.OracleDriver
***************
*** 25,28 ****
--- 27,31 ----
dbunit.profile.oracle.user = dbunit
dbunit.profile.oracle.password = dbunit
+ dbunit.profile.oracle.unsupportedFeatures = INSERT_INDENTITY
dbunit.profile.mysql.driverClass = com.mysql.jdbc.Driver
***************
*** 31,40 ****
dbunit.profile.mysql.user = dbunit
dbunit.profile.mysql.password = dbunit
dbunit.profile.mssql.driverClass = com.microsoft.jdbc.sqlserver.SQLServerDriver
! dbunit.profile.mssql.connectionUrl = jdbc:microsoft:sqlserver://trujillo:1433;DatabaseName=dbunit;SelectMethod=cursor
dbunit.profile.mssql.schema = dbo
dbunit.profile.mssql.user = dbunit
dbunit.profile.mssql.password = dbunit
## Needed for ant testing until profile.properties is merged
--- 34,46 ----
dbunit.profile.mysql.user = dbunit
dbunit.profile.mysql.password = dbunit
+ dbunit.profile.mysql.unsupportedFeatures = BLOB,CLOB,TRANSACTION,INSERT_IDENTITY
dbunit.profile.mssql.driverClass = com.microsoft.jdbc.sqlserver.SQLServerDriver
! #dbunit.profile.mssql.connectionUrl = jdbc:microsoft:sqlserver://trujillo:1433;DatabaseName=dbunit;SelectMethod=cursor
! dbunit.profile.mssql.connectionUrl = jdbc:microsoft:sqlserver://localhost\\dbunit:1433;DatabaseName=dbunit;SelectMethod=cursor
dbunit.profile.mssql.schema = dbo
dbunit.profile.mssql.user = dbunit
dbunit.profile.mssql.password = dbunit
+ dbunit.profile.mssql.unsupportedFeatures = BLOB,CLOB,SCOLLABLE_RESULTSET
## Needed for ant testing until profile.properties is merged
***************
*** 51,60 ****
#dbunit.profile.password = ${dbunit.profile.mysql.password}
! #dbunit.profile.driverClass = ${dbunit.profile.mssql.driverClass}
! #dbunit.profile.connectionUrl = ${dbunit.profile.mssql.connectionUrl}
! ##dbunit.profile.schema = ${dbunit.profile.mssql.schema}
! #dbunit.profile.user = ${dbunit.profile.mssql.user}
! #dbunit.profile.password = ${dbunit.profile.mssql.password}
!
!
!
--- 57,63 ----
#dbunit.profile.password = ${dbunit.profile.mysql.password}
! dbunit.profile.driverClass = ${dbunit.profile.mssql.driverClass}
! dbunit.profile.connectionUrl = ${dbunit.profile.mssql.connectionUrl}
! #dbunit.profile.schema = ${dbunit.profile.mssql.schema}
! dbunit.profile.user = ${dbunit.profile.mssql.user}
! dbunit.profile.password = ${dbunit.profile.mssql.password}
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv1956/dbunit/src/java/org/dbunit/dataset Modified Files: AbstractTable.java DefaultTable.java Added Files: CachedTable.java ForwardOnlyDataSet.java ForwardOnlyTable.java Log Message: * Test suite cleanup. Added new "unsupportedFeatures" property in profile.properties file. Used to exclude tests of unsupported database features. No more instanceof in tests. * New ForwardOnlyResultSetTable class. Renamed ResultSetTable to ScrollableResultSetTable. Another step toward support of very large datasets; remains to implement buffered XML datasets. * New ForwardOnlyDataSet and ForwardOnlyTable classes. Will be used in test suite only to ensure that insert and export works with buffered dataset/table implementations. --- NEW FILE: CachedTable.java --- package org.dbunit.dataset; import java.util.List; import java.util.ArrayList; /** * * <p> Copyright (c) 2002 OZ.COM. All Rights Reserved. </p> * @author manuel.laflamme$ * @since Apr 10, 2003$ */ public class CachedTable extends DefaultTable { public CachedTable(ITable table) throws DataSetException { super(table.getTableMetaData(), createRowList(table)); } protected CachedTable(ITableMetaData metaData) { super(metaData); } protected static List createRowList(ITable table) throws DataSetException { List rowList = new ArrayList(); try { Column[] columns = table.getTableMetaData().getColumns(); for (int i = 0; ; i++) { Object[] rowValues = new Object[columns.length]; for (int j = 0; j < columns.length; j++) { Column column = columns[j]; rowValues[j] = table.getValue(i, column.getColumnName()); } rowList.add(rowValues); } } catch(RowOutOfBoundsException e) { // end of table } return rowList; } } --- NEW FILE: ForwardOnlyDataSet.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 9, 2003 * @version $Revision: 1.1 $ */ public class ForwardOnlyDataSet extends AbstractDataSet { private final IDataSet _dataSet; private int _iteratorCount; public ForwardOnlyDataSet(IDataSet dataSet) { _dataSet = dataSet; } //////////////////////////////////////////////////////////////////////////// // AbstractDataSet class protected ITableIterator createIterator(boolean reversed) throws DataSetException { if (reversed) { throw new UnsupportedOperationException( "Reverse iterator not supported!"); } if (_iteratorCount > 0) { throw new UnsupportedOperationException( "Only one iterator allowed!"); } return new ForwardOnlyIterator(_dataSet.iterator()); } //////////////////////////////////////////////////////////////////////////// // IDataSet interface public String[] getTableNames() throws DataSetException { throw new UnsupportedOperationException(); } public ITableMetaData getTableMetaData(String tableName) throws DataSetException { throw new UnsupportedOperationException(); } public ITable getTable(String tableName) throws DataSetException { throw new UnsupportedOperationException(); } //////////////////////////////////////////////////////////////////////////// // ForwardOnlyIterator class private class ForwardOnlyIterator implements ITableIterator { private final ITableIterator _iterator; public ForwardOnlyIterator(ITableIterator iterator) { _iterator = iterator; _iteratorCount++; } //////////////////////////////////////////////////////////////////////////// // ITableIterator interface public boolean next() throws DataSetException { return _iterator.next(); } public ITableMetaData getTableMetaData() throws DataSetException { return _iterator.getTableMetaData(); } public ITable getTable() throws DataSetException { return new ForwardOnlyTable(_iterator.getTable()); } } } --- NEW FILE: ForwardOnlyTable.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 9, 2003 * @version $Revision: 1.1 $ */ public class ForwardOnlyTable implements ITable { private final ITable _table; private int _lastRow = -1; public ForwardOnlyTable(ITable table) { _table = table; } //////////////////////////////////////////////////////////////////////////// // ITable interface public ITableMetaData getTableMetaData() { return _table.getTableMetaData(); } public int getRowCount() { throw new UnsupportedOperationException(); } public Object getValue(int row, String column) throws DataSetException { if (row < _lastRow) { throw new UnsupportedOperationException("Cannot go backward!"); } _lastRow = row; return _table.getValue(row, column); } } Index: AbstractTable.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/AbstractTable.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** AbstractTable.java 15 Feb 2003 05:42:42 -0000 1.11 --- AbstractTable.java 13 Apr 2003 02:40:10 -0000 1.12 *************** *** 32,35 **** --- 32,41 ---- protected void assertValidRowIndex(int row) throws DataSetException { + assertValidRowIndex(row, getRowCount()); + } + + protected void assertValidRowIndex(int row, int rowCount) + throws DataSetException + { if (row < 0) { *************** *** 37,43 **** } ! if (row >= getRowCount()) { ! throw new RowOutOfBoundsException(row + " > " + getRowCount()); } } --- 43,49 ---- } ! if (row >= rowCount) { ! throw new RowOutOfBoundsException(row + " > " + rowCount); } } Index: DefaultTable.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/DefaultTable.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** DefaultTable.java 13 Jun 2002 17:24:56 -0000 1.6 --- DefaultTable.java 13 Apr 2003 02:40:10 -0000 1.7 *************** *** 25,28 **** --- 25,29 ---- import java.util.Arrays; import java.util.List; + import java.util.ArrayList; /** *************** *** 33,42 **** { private final ITableMetaData _metaData; ! private final List _list; public DefaultTable(ITableMetaData metaData, List list) { _metaData = metaData; ! _list = list; } --- 34,43 ---- { private final ITableMetaData _metaData; ! protected final List _rowList; public DefaultTable(ITableMetaData metaData, List list) { _metaData = metaData; ! _rowList = list; } *************** *** 47,51 **** { _metaData = new DefaultTableMetaData(tableName, new Column[0]); ! _list = Arrays.asList(new Object[0]); } --- 48,52 ---- { _metaData = new DefaultTableMetaData(tableName, new Column[0]); ! _rowList = Arrays.asList(new Object[0]); } *************** *** 53,57 **** { _metaData = new DefaultTableMetaData(tableName, columns); ! _list = list; } --- 54,64 ---- { _metaData = new DefaultTableMetaData(tableName, columns); ! _rowList = list; ! } ! ! protected DefaultTable(ITableMetaData metaData) ! { ! _metaData = metaData; ! _rowList = new ArrayList(); } *************** *** 66,70 **** public int getRowCount() { ! return _list.size(); } --- 73,77 ---- public int getRowCount() { ! return _rowList.size(); } *************** *** 73,77 **** assertValidRowIndex(row); ! Object[] rowValues = (Object[])_list.get(row); return rowValues[getColumnIndex(column)]; } --- 80,84 ---- assertValidRowIndex(row); ! Object[] rowValues = (Object[])_rowList.get(row); return rowValues[getColumnIndex(column)]; } |
|
From: <mla...@us...> - 2003-04-13 02:40:43
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/database
In directory sc8-pr-cvs1:/tmp/cvs-serv1956/dbunit/src/java/org/dbunit/database
Modified Files:
AbstractDatabaseConnection.java CachedResultSetTable.java
Added Files:
AbstractResultSetTable.java ForwardOnlyResultSetTable.java
IResultSetTable.java ScrollableResultSetTable.java
Removed Files:
ResultSetTable.java
Log Message:
* Test suite cleanup. Added new "unsupportedFeatures" property in
profile.properties file. Used to exclude tests of unsupported database
features. No more instanceof in tests.
* New ForwardOnlyResultSetTable class. Renamed ResultSetTable to
ScrollableResultSetTable. Another step toward support of very large
datasets; remains to implement buffered XML datasets.
* New ForwardOnlyDataSet and ForwardOnlyTable classes. Will be used
in test suite only to ensure that insert and export works with buffered
dataset/table implementations.
--- NEW FILE: AbstractResultSetTable.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.AbstractTable;
import org.dbunit.dataset.ITableMetaData;
import org.dbunit.dataset.DataSetException;
import org.dbunit.dataset.Column;
import org.dbunit.dataset.DefaultTableMetaData;
import org.dbunit.dataset.datatype.DataType;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.ResultSetMetaData;
import java.sql.Statement;
import java.sql.Connection;
/**
* @author Manuel Laflamme
* @since Apr 10, 2003
* @version $Revision: 1.1 $
*/
public abstract class AbstractResultSetTable extends AbstractTable
implements IResultSetTable
{
protected ITableMetaData _metaData;
private Statement _statement;
protected ResultSet _resultSet;
public AbstractResultSetTable(ITableMetaData metaData, ResultSet resultSet)
throws SQLException, DataSetException
{
_metaData = metaData;
_resultSet = resultSet;
}
public AbstractResultSetTable(String tableName, String selectStatement,
IDatabaseConnection connection) throws DataSetException, SQLException
{
Connection jdbcConnection = connection.getConnection();
_statement = jdbcConnection.createStatement();
// _statement.setFetchDirection(ResultSet.FETCH_FORWARD);
try
{
_resultSet = _statement.executeQuery(selectStatement);
_metaData = createTableMetaData(tableName, _resultSet);
}
catch (SQLException e)
{
_statement.close();
_statement = null;
throw e;
}
}
public AbstractResultSetTable(ITableMetaData metaData,
IDatabaseConnection connection) throws DataSetException, SQLException
{
Connection jdbcConnection = connection.getConnection();
_statement = jdbcConnection.createStatement();
// _statement.setFetchDirection(ResultSet.FETCH_FORWARD);
try
{
String schema = connection.getSchema();
String selectStatement = getSelectStatement(schema, metaData);
_resultSet = _statement.executeQuery(selectStatement);
_metaData = metaData;
}
catch (SQLException e)
{
_statement.close();
_statement = null;
throw e;
}
}
static String getSelectStatement(String schema, ITableMetaData metaData)
throws DataSetException
{
return DatabaseDataSet.getSelectStatement(schema, metaData);
}
static ITableMetaData createTableMetaData(String name,
ResultSet resultSet) throws DataSetException, SQLException
{
ResultSetMetaData metaData = resultSet.getMetaData();
Column[] columns = new Column[metaData.getColumnCount()];
for (int i = 0; i < columns.length; i++)
{
columns[i] = new Column(
metaData.getColumnName(i + 1),
DataType.forSqlType(metaData.getColumnType(i + 1)),
metaData.getColumnTypeName(i + 1),
Column.nullableValue(metaData.isNullable(i + 1)));
}
return new DefaultTableMetaData(name, columns);
}
////////////////////////////////////////////////////////////////////////////
// ITable interface
public ITableMetaData getTableMetaData()
{
return _metaData;
}
////////////////////////////////////////////////////////////////////////////
// IResultSetTable interface
public void close() throws DataSetException
{
try
{
if (_statement != null)
{
_statement.close();
_statement = null;
}
if (_resultSet != null)
{
_resultSet.close();
_resultSet = null;
}
}
catch (SQLException e)
{
throw new DataSetException(e);
}
}
}
--- NEW FILE: ForwardOnlyResultSetTable.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.ITableMetaData;
import org.dbunit.dataset.DataSetException;
import org.dbunit.dataset.RowOutOfBoundsException;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* @author Manuel Laflamme
* @since Apr 10, 2003
* @version $Revision: 1.1 $
*/
public class ForwardOnlyResultSetTable extends AbstractResultSetTable
{
private int _lastRow = -1;
private boolean _eot = false; // End of table flag
public ForwardOnlyResultSetTable(ITableMetaData metaData,
ResultSet resultSet) throws SQLException, DataSetException
{
super(metaData, resultSet);
}
public ForwardOnlyResultSetTable(String tableName, String selectStatement,
IDatabaseConnection connection) throws DataSetException, SQLException
{
super(tableName, selectStatement, connection);
}
public ForwardOnlyResultSetTable(ITableMetaData metaData,
IDatabaseConnection connection) throws DataSetException, SQLException
{
super(metaData, connection);
}
////////////////////////////////////////////////////////////////////////////
// ITable interface
public int getRowCount()
{
throw new UnsupportedOperationException();
}
public Object getValue(int row, String column) throws DataSetException
{
try
{
// Move cursor forward up to specified row
while (!_eot && row > _lastRow)
{
_eot = !_resultSet.next();
_lastRow++;
}
if (row < _lastRow)
{
throw new UnsupportedOperationException("Cannot go backward!");
}
if (_eot || row > _lastRow)
{
throw new RowOutOfBoundsException(row + " > " + _lastRow);
}
return _resultSet.getObject(getColumnIndex(column) + 1);
}
catch (SQLException e)
{
throw new DataSetException(e);
}
}
}
--- NEW FILE: IResultSetTable.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.ITable;
import org.dbunit.dataset.DataSetException;
import java.sql.SQLException;
/**
* @author Manuel Laflamme
* @since Apr 10, 2003
* @version $Revision: 1.1 $
*/
public interface IResultSetTable extends ITable
{
public void close() throws DataSetException;
}
--- NEW FILE: ScrollableResultSetTable.java ---
/*
* XmlTable.java Feb 17, 2002
*
* 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.ITableMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* @author Manuel Laflamme
* @version $Revision: 1.1 $
*/
public class ScrollableResultSetTable extends AbstractResultSetTable
{
private final int _rowCount;
public ScrollableResultSetTable(ITableMetaData metaData, ResultSet resultSet)
throws SQLException, DataSetException
{
super(metaData, resultSet);
try
{
if (_resultSet.getType() == ResultSet.TYPE_FORWARD_ONLY)
{
throw new SQLException("Forward only ResultSet not supported");
}
_resultSet.last();
_rowCount = _resultSet.getRow();
}
catch (SQLException e)
{
close();
throw e;
}
}
public ScrollableResultSetTable(String tableName, String selectStatement,
IDatabaseConnection connection) throws DataSetException, SQLException
{
super(tableName, selectStatement, connection);
try
{
if (_resultSet.getType() == ResultSet.TYPE_FORWARD_ONLY)
{
throw new SQLException("Forward only ResultSet not supported");
}
_resultSet.last();
_rowCount = _resultSet.getRow();
}
catch (SQLException e)
{
close();
throw e;
}
}
public ScrollableResultSetTable(ITableMetaData metaData,
IDatabaseConnection connection) throws DataSetException, SQLException
{
super(metaData, connection);
try
{
if (_resultSet.getType() == ResultSet.TYPE_FORWARD_ONLY)
{
throw new SQLException("Forward only ResultSet not supported");
}
_resultSet.last();
_rowCount = _resultSet.getRow();
}
catch (SQLException e)
{
close();
throw e;
}
}
////////////////////////////////////////////////////////////////////////////
// ITable interface
public int getRowCount()
{
return _rowCount;
}
public Object getValue(int row, String column) throws DataSetException
{
assertValidRowIndex(row);
try
{
_resultSet.absolute(row + 1);
return _resultSet.getObject(getColumnIndex(column) + 1);
}
catch (SQLException e)
{
throw new DataSetException(e);
}
}
}
Index: AbstractDatabaseConnection.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/AbstractDatabaseConnection.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** AbstractDatabaseConnection.java 4 Jul 2002 21:33:43 -0000 1.13
--- AbstractDatabaseConnection.java 13 Apr 2003 02:40:09 -0000 1.14
***************
*** 111,115 ****
try
{
! ITableMetaData metaData = ResultSetTable.createTableMetaData(
resultName, resultSet);
return new CachedResultSetTable(metaData, resultSet);
--- 111,115 ----
try
{
! ITableMetaData metaData = ScrollableResultSetTable.createTableMetaData(
resultName, resultSet);
return new CachedResultSetTable(metaData, resultSet);
Index: CachedResultSetTable.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/CachedResultSetTable.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** CachedResultSetTable.java 13 Jun 2002 17:24:56 -0000 1.7
--- CachedResultSetTable.java 13 Apr 2003 02:40:09 -0000 1.8
***************
*** 23,32 ****
package org.dbunit.database;
! import org.dbunit.dataset.*;
import java.sql.ResultSet;
import java.sql.SQLException;
- import java.util.ArrayList;
- import java.util.List;
/**
--- 23,32 ----
package org.dbunit.database;
! import org.dbunit.dataset.CachedTable;
! import org.dbunit.dataset.DataSetException;
! import org.dbunit.dataset.ITableMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
***************
*** 34,64 ****
* @version $Revision$
*/
! public class CachedResultSetTable extends DefaultTable
{
public CachedResultSetTable(ITableMetaData metaData, ResultSet resultSet)
throws SQLException, DataSetException
{
! super(metaData, createList(metaData, resultSet));
}
! private static List createList(ITableMetaData metaData, ResultSet resultSet)
! throws SQLException, DataSetException
{
! List list = new ArrayList();
! Column[] columns = metaData.getColumns();
! while (resultSet.next())
{
! Object[] row = new Object[columns.length];
! for (int i = 0; i < columns.length; i++)
! {
! Object value = resultSet.getObject(columns[i].getColumnName());
! row[i] = value;
! }
!
! list.add(row);
}
- return list;
}
}
--- 34,65 ----
* @version $Revision$
*/
! public class CachedResultSetTable extends CachedTable implements IResultSetTable
{
public CachedResultSetTable(ITableMetaData metaData, ResultSet resultSet)
throws SQLException, DataSetException
{
! this(new ForwardOnlyResultSetTable(metaData, resultSet));
}
! public CachedResultSetTable(IResultSetTable table) throws DataSetException, SQLException
{
! super(table.getTableMetaData());
! try
{
! _rowList.addAll(createRowList(table));
! }
! finally
! {
! table.close();
}
}
+ ////////////////////////////////////////////////////////////////////////////
+ // IResultSetTable interface
+
+ public void close() throws DataSetException
+ {
+ // nothing to do, already closed
+ }
}
--- ResultSetTable.java DELETED ---
|
|
From: <mla...@us...> - 2003-04-13 02:40:15
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/operation/mssqlserver
In directory sc8-pr-cvs1:/tmp/cvs-serv1956/dbunit/src/test/org/dbunit/operation/mssqlserver
Modified Files:
InsertIdentityOperationTest.java
Added Files:
AllTests.java
Log Message:
* Test suite cleanup. Added new "unsupportedFeatures" property in
profile.properties file. Used to exclude tests of unsupported database
features. No more instanceof in tests.
* New ForwardOnlyResultSetTable class. Renamed ResultSetTable to
ScrollableResultSetTable. Another step toward support of very large
datasets; remains to implement buffered XML datasets.
* New ForwardOnlyDataSet and ForwardOnlyTable classes. Will be used
in test suite only to ensure that insert and export works with buffered
dataset/table implementations.
--- NEW FILE: AllTests.java ---
/*
*
* The DbUnit Database Testing Framework
* Copyright (C)2002, Manuel Laflamme
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package org.dbunit.operation.mssqlserver;
import org.dbunit.DatabaseEnvironment;
import org.dbunit.TestFeature;
import junit.framework.Test;
import junit.framework.TestSuite;
/**
* @author Manuel Laflamme
* @since Apr 11, 2003
* @version $Revision: 1.1 $
*/
public class AllTests
{
public static Test suite() throws Exception
{
TestSuite suite = new TestSuite();
DatabaseEnvironment environment = DatabaseEnvironment.getInstance();
if (environment.support(TestFeature.INSERT_IDENTITY))
{
suite.addTest(new TestSuite(InsertIdentityOperationTest.class));
}
return suite;
}
}
Index: InsertIdentityOperationTest.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/operation/mssqlserver/InsertIdentityOperationTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** InsertIdentityOperationTest.java 18 Feb 2003 21:49:37 -0000 1.5
--- InsertIdentityOperationTest.java 13 Apr 2003 02:40:12 -0000 1.6
***************
*** 23,39 ****
package org.dbunit.operation.mssqlserver;
! import org.dbunit.operation.*;
! import org.dbunit.*;
! import org.dbunit.database.MockDatabaseConnection;
! import org.dbunit.database.statement.MockBatchStatement;
! import org.dbunit.database.statement.MockStatementFactory;
! import org.dbunit.dataset.*;
! import org.dbunit.dataset.datatype.DataType;
import org.dbunit.dataset.xml.FlatXmlDataSet;
import org.dbunit.dataset.xml.XmlDataSet;
! import java.io.*;
! import java.util.ArrayList;
! import java.util.List;
/**
--- 23,36 ----
package org.dbunit.operation.mssqlserver;
! import org.dbunit.AbstractDatabaseTest;
! import org.dbunit.Assertion;
! import org.dbunit.dataset.DataSetUtils;
! import org.dbunit.dataset.IDataSet;
! import org.dbunit.dataset.ITable;
import org.dbunit.dataset.xml.FlatXmlDataSet;
import org.dbunit.dataset.xml.XmlDataSet;
! import java.io.FileReader;
! import java.io.Reader;
/**
***************
*** 58,132 ****
public void testExecuteXML() throws Exception
{
! if (DatabaseEnvironment.getInstance() instanceof MSSQLServerEnvironment){
! System.out.println("mssql");
! Reader in = new FileReader("src/xml/insertIdentityOperationTest.xml");
! IDataSet xmlDataSet = new XmlDataSet(in);
! ITable[] tablesBefore = DataSetUtils.getTables(_connection.createDataSet());
! InsertIdentityOperation.CLEAN_INSERT.execute(_connection, xmlDataSet);
! ITable[] tablesAfter = DataSetUtils.getTables(_connection.createDataSet());
! assertEquals("table count", tablesBefore.length, tablesAfter.length);
! for (int i = 0; i < tablesBefore.length; i++)
! {
! ITable table = tablesBefore[i];
! String name = table.getTableMetaData().getTableName();
! if (name.startsWith("IDENTITY"))
! {
! assertTrue("Should have either 0 or 6", table.getRowCount()==0 | table.getRowCount()==6);
! }
}
! for (int i = 0; i < tablesAfter.length; i++)
{
! ITable table = tablesAfter[i];
! String name = table.getTableMetaData().getTableName();
! if (name.startsWith("IDENTITY"))
! {
! Assertion.assertEquals(xmlDataSet.getTable(name), table);
! }
}
}
-
}
public void testExecuteFlatXML() throws Exception
{
! if (DatabaseEnvironment.getInstance() instanceof MSSQLServerEnvironment){
! Reader in = new FileReader("src/xml/insertIdentityOperationTestFlat.xml");
! IDataSet xmlDataSet = new FlatXmlDataSet(in);
! ITable[] tablesBefore = DataSetUtils.getTables(_connection.createDataSet());
! InsertIdentityOperation.CLEAN_INSERT.execute(_connection, xmlDataSet);
! ITable[] tablesAfter = DataSetUtils.getTables(_connection.createDataSet());
! assertEquals("table count", tablesBefore.length, tablesAfter.length);
! for (int i = 0; i < tablesBefore.length; i++)
! {
! ITable table = tablesBefore[i];
! String name = table.getTableMetaData().getTableName();
! if (name.startsWith("IDENTITY"))
! {
! assertTrue("Should have either 0 or 6", table.getRowCount()==0 | table.getRowCount()==6);
! }
}
! for (int i = 0; i < tablesAfter.length; i++)
{
! ITable table = tablesAfter[i];
! String name = table.getTableMetaData().getTableName();
! if (name.startsWith("IDENTITY"))
! {
! Assertion.assertEquals(xmlDataSet.getTable(name), table);
! }
}
}
-
}
--- 55,123 ----
public void testExecuteXML() throws Exception
{
! // System.out.println("mssql");
! Reader in = new FileReader("src/xml/insertIdentityOperationTest.xml");
! IDataSet xmlDataSet = new XmlDataSet(in);
! ITable[] tablesBefore = DataSetUtils.getTables(_connection.createDataSet());
! InsertIdentityOperation.CLEAN_INSERT.execute(_connection, xmlDataSet);
! ITable[] tablesAfter = DataSetUtils.getTables(_connection.createDataSet());
! assertEquals("table count", tablesBefore.length, tablesAfter.length);
! for (int i = 0; i < tablesBefore.length; i++)
! {
! ITable table = tablesBefore[i];
! String name = table.getTableMetaData().getTableName();
! if (name.startsWith("IDENTITY"))
! {
! assertTrue("Should have either 0 or 6", table.getRowCount() == 0 | table.getRowCount() == 6);
}
+ }
! for (int i = 0; i < tablesAfter.length; i++)
! {
! ITable table = tablesAfter[i];
! String name = table.getTableMetaData().getTableName();
! if (name.startsWith("IDENTITY"))
{
! Assertion.assertEquals(xmlDataSet.getTable(name), table);
}
}
}
public void testExecuteFlatXML() throws Exception
{
! Reader in = new FileReader("src/xml/insertIdentityOperationTestFlat.xml");
! IDataSet xmlDataSet = new FlatXmlDataSet(in);
! ITable[] tablesBefore = DataSetUtils.getTables(_connection.createDataSet());
! InsertIdentityOperation.CLEAN_INSERT.execute(_connection, xmlDataSet);
! ITable[] tablesAfter = DataSetUtils.getTables(_connection.createDataSet());
! assertEquals("table count", tablesBefore.length, tablesAfter.length);
! for (int i = 0; i < tablesBefore.length; i++)
! {
! ITable table = tablesBefore[i];
! String name = table.getTableMetaData().getTableName();
! if (name.startsWith("IDENTITY"))
! {
! assertTrue("Should have either 0 or 6", table.getRowCount() == 0 | table.getRowCount() == 6);
}
+ }
! for (int i = 0; i < tablesAfter.length; i++)
! {
! ITable table = tablesAfter[i];
! String name = table.getTableMetaData().getTableName();
! if (name.startsWith("IDENTITY"))
{
! Assertion.assertEquals(xmlDataSet.getTable(name), table);
}
}
}
***************
*** 135,173 ****
Thanks to Gaetano Di Gregorio for finding the bug.
*/
! public void testIdentityInsertNoPK() throws Exception
{
! if (DatabaseEnvironment.getInstance() instanceof MSSQLServerEnvironment){
! Reader in = new FileReader("src/xml/insertIdentityOperationTestNoPK.xml");
! IDataSet xmlDataSet = new FlatXmlDataSet(in);
! ITable[] tablesBefore = DataSetUtils.getTables(_connection.createDataSet());
! InsertIdentityOperation.CLEAN_INSERT.execute(_connection, xmlDataSet);
! ITable[] tablesAfter = DataSetUtils.getTables(_connection.createDataSet());
! assertEquals("table count", tablesBefore.length, tablesAfter.length);
! for (int i = 0; i < tablesBefore.length; i++)
! {
! ITable table = tablesBefore[i];
! String name = table.getTableMetaData().getTableName();
! if (name.equals("TEST_IDENTITY_NOT_PK"))
! {
! assertTrue("Should have either 0 or 6", table.getRowCount()==0 | table.getRowCount()==6);
! }
}
! for (int i = 0; i < tablesAfter.length; i++)
{
! ITable table = tablesAfter[i];
! String name = table.getTableMetaData().getTableName();
! if (name.equals("TEST_IDENTITY_NOT_PK"))
! {
! Assertion.assertEquals(xmlDataSet.getTable(name), table);
! }
}
}
-
}
}
--- 126,161 ----
Thanks to Gaetano Di Gregorio for finding the bug.
*/
! public void testIdentityInsertNoPK() throws Exception
{
! Reader in = new FileReader("src/xml/insertIdentityOperationTestNoPK.xml");
! IDataSet xmlDataSet = new FlatXmlDataSet(in);
! ITable[] tablesBefore = DataSetUtils.getTables(_connection.createDataSet());
! InsertIdentityOperation.CLEAN_INSERT.execute(_connection, xmlDataSet);
! ITable[] tablesAfter = DataSetUtils.getTables(_connection.createDataSet());
! assertEquals("table count", tablesBefore.length, tablesAfter.length);
! for (int i = 0; i < tablesBefore.length; i++)
! {
! ITable table = tablesBefore[i];
! String name = table.getTableMetaData().getTableName();
! if (name.equals("TEST_IDENTITY_NOT_PK"))
! {
! assertTrue("Should have either 0 or 6", table.getRowCount() == 0 | table.getRowCount() == 6);
}
+ }
! for (int i = 0; i < tablesAfter.length; i++)
! {
! ITable table = tablesAfter[i];
! String name = table.getTableMetaData().getTableName();
! if (name.equals("TEST_IDENTITY_NOT_PK"))
{
! Assertion.assertEquals(xmlDataSet.getTable(name), table);
}
}
}
}
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/operation
In directory sc8-pr-cvs1:/tmp/cvs-serv1956/dbunit/src/test/org/dbunit/operation
Modified Files:
AbstractBatchOperationTest.java AllTests.java
InsertOperationTest.java UpdateOperationTest.java
Log Message:
* Test suite cleanup. Added new "unsupportedFeatures" property in
profile.properties file. Used to exclude tests of unsupported database
features. No more instanceof in tests.
* New ForwardOnlyResultSetTable class. Renamed ResultSetTable to
ScrollableResultSetTable. Another step toward support of very large
datasets; remains to implement buffered XML datasets.
* New ForwardOnlyDataSet and ForwardOnlyTable classes. Will be used
in test suite only to ensure that insert and export works with buffered
dataset/table implementations.
Index: AbstractBatchOperationTest.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/operation/AbstractBatchOperationTest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** AbstractBatchOperationTest.java 14 Feb 2003 03:22:01 -0000 1.4
--- AbstractBatchOperationTest.java 13 Apr 2003 02:40:12 -0000 1.5
***************
*** 24,34 ****
import org.dbunit.AbstractDatabaseTest;
! import org.dbunit.dataset.*;
import org.dbunit.dataset.xml.XmlDataSet;
- import java.io.FileInputStream;
- import java.io.InputStream;
- import java.io.Reader;
import java.io.FileReader;
/**
--- 24,37 ----
import org.dbunit.AbstractDatabaseTest;
! import org.dbunit.dataset.Column;
! import org.dbunit.dataset.DataSetUtils;
! import org.dbunit.dataset.IDataSet;
! import org.dbunit.dataset.ITable;
! import org.dbunit.dataset.ITableMetaData;
! import org.dbunit.dataset.NoSuchColumnException;
import org.dbunit.dataset.xml.XmlDataSet;
import java.io.FileReader;
+ import java.io.Reader;
/**
***************
*** 104,108 ****
try
{
! AbstractBatchOperation.getOperationMetaData(_connection, xmlTable.getTableMetaData());
fail("Should throw a NoSuchColumnException");
}
--- 107,112 ----
try
{
! AbstractBatchOperation.getOperationMetaData(_connection,
! xmlTable.getTableMetaData());
fail("Should throw a NoSuchColumnException");
}
Index: AllTests.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/operation/AllTests.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** AllTests.java 13 Dec 2002 21:46:08 -0000 1.7
--- AllTests.java 13 Apr 2003 02:40:12 -0000 1.8
***************
*** 23,28 ****
package org.dbunit.operation;
! import org.dbunit.*;
! import org.dbunit.operation.mssqlserver.*;
import junit.framework.Test;
import junit.framework.TestSuite;
--- 23,29 ----
package org.dbunit.operation;
! import org.dbunit.DatabaseEnvironment;
! import org.dbunit.TestFeature;
!
import junit.framework.Test;
import junit.framework.TestSuite;
***************
*** 37,40 ****
--- 38,43 ----
{
TestSuite suite = new TestSuite();
+
+ suite.addTest(org.dbunit.operation.mssqlserver.AllTests.suite());
suite.addTest(new TestSuite(AbstractBatchOperationTest.class));
suite.addTest(new TestSuite(CloseConnectionOperationTest.class));
***************
*** 44,52 ****
suite.addTest(new TestSuite(InsertOperationTest.class));
suite.addTest(new TestSuite(RefreshOperationTest.class));
suite.addTest(new TestSuite(TransactionOperationTest.class));
- suite.addTest(new TestSuite(UpdateOperationTest.class));
- if (DatabaseEnvironment.getInstance() instanceof MSSQLServerEnvironment){
- suite.addTest(new TestSuite(InsertIdentityOperationTest.class));
}
return suite;
--- 47,58 ----
suite.addTest(new TestSuite(InsertOperationTest.class));
suite.addTest(new TestSuite(RefreshOperationTest.class));
+
+ DatabaseEnvironment environment = DatabaseEnvironment.getInstance();
+ if (environment.support(TestFeature.TRANSACTION))
+ {
suite.addTest(new TestSuite(TransactionOperationTest.class));
}
+
+ suite.addTest(new TestSuite(UpdateOperationTest.class));
return suite;
Index: InsertOperationTest.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/operation/InsertOperationTest.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** InsertOperationTest.java 15 Feb 2003 05:42:42 -0000 1.18
--- InsertOperationTest.java 13 Apr 2003 02:40:12 -0000 1.19
***************
*** 23,39 ****
package org.dbunit.operation;
! import org.dbunit.*;
import org.dbunit.database.MockDatabaseConnection;
import org.dbunit.database.statement.MockBatchStatement;
import org.dbunit.database.statement.MockStatementFactory;
! import org.dbunit.dataset.*;
import org.dbunit.dataset.datatype.DataType;
import org.dbunit.dataset.xml.FlatXmlDataSet;
import org.dbunit.dataset.xml.XmlDataSet;
! import java.io.*;
import java.util.ArrayList;
import java.util.List;
- import java.sql.SQLException;
/**
--- 23,51 ----
package org.dbunit.operation;
! import org.dbunit.AbstractDatabaseTest;
! import org.dbunit.Assertion;
! import org.dbunit.DatabaseEnvironment;
! import org.dbunit.TestFeature;
import org.dbunit.database.MockDatabaseConnection;
import org.dbunit.database.statement.MockBatchStatement;
import org.dbunit.database.statement.MockStatementFactory;
! import org.dbunit.dataset.Column;
! import org.dbunit.dataset.DataSetUtils;
! import org.dbunit.dataset.DefaultDataSet;
! import org.dbunit.dataset.DefaultTable;
! import org.dbunit.dataset.DefaultTableMetaData;
! import org.dbunit.dataset.IDataSet;
! import org.dbunit.dataset.ITable;
! import org.dbunit.dataset.LowerCaseDataSet;
import org.dbunit.dataset.datatype.DataType;
import org.dbunit.dataset.xml.FlatXmlDataSet;
import org.dbunit.dataset.xml.XmlDataSet;
! import java.io.File;
! import java.io.FileReader;
! import java.io.Reader;
! import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
***************
*** 169,173 ****
};
DefaultTable table = new DefaultTable(tableName, columns, valueList);
! IDataSet dataSet = new DefaultDataSet(new ITable[] {table, table});
// setup mock objects
--- 181,185 ----
};
DefaultTable table = new DefaultTable(tableName, columns, valueList);
! IDataSet dataSet = new DefaultDataSet(new ITable[]{table, table});
// setup mock objects
***************
*** 221,229 ****
public void testInsertClob() throws Exception
{
- String tableName = "CLOB_TABLE";
-
// execute this test only if the target database support CLOB
! if (DatabaseEnvironment.getInstance() instanceof OracleEnvironment)
{
Reader in = new FileReader(new File("src/xml/clobInsertTest.xml"));
IDataSet xmlDataSet = new FlatXmlDataSet(in);
--- 233,242 ----
public void testInsertClob() throws Exception
{
// execute this test only if the target database support CLOB
! DatabaseEnvironment environment = DatabaseEnvironment.getInstance();
! if (environment.support(TestFeature.CLOB))
{
+ String tableName = "CLOB_TABLE";
+
Reader in = new FileReader(new File("src/xml/clobInsertTest.xml"));
IDataSet xmlDataSet = new FlatXmlDataSet(in);
***************
*** 241,249 ****
public void testInsertBlob() throws Exception
{
- String tableName = "BLOB_TABLE";
-
// execute this test only if the target database support BLOB
! if (DatabaseEnvironment.getInstance() instanceof OracleEnvironment)
{
Reader in = new FileReader(new File("src/xml/blobInsertTest.xml"));
IDataSet xmlDataSet = new FlatXmlDataSet(in);
--- 254,263 ----
public void testInsertBlob() throws Exception
{
// execute this test only if the target database support BLOB
! DatabaseEnvironment environment = DatabaseEnvironment.getInstance();
! if (environment.support(TestFeature.BLOB))
{
+ String tableName = "BLOB_TABLE";
+
Reader in = new FileReader(new File("src/xml/blobInsertTest.xml"));
IDataSet xmlDataSet = new FlatXmlDataSet(in);
***************
*** 308,321 ****
{
String columnName = columns[k].getColumnName();
! DataType columnDataType = columns[k].getDataType();
!
!
! if (DatabaseEnvironment.getInstance() instanceof MSSQLServerEnvironment && columnDataType.equals(DataType.BINARY)){
! assertTrue(tableName + "." + columnName,databaseTable.getValue(j, columnName)!= null);
! }
! else {
! assertEquals(tableName + "." + columnName,
null, databaseTable.getValue(j, columnName));
- }
}
}
--- 322,327 ----
{
String columnName = columns[k].getColumnName();
! assertEquals(tableName + "." + columnName,
null, databaseTable.getValue(j, columnName));
}
}
***************
*** 327,350 ****
public void testExecute() throws Exception
{
! // this won't work because of the timestamp column.
! if (!(DatabaseEnvironment.getInstance() instanceof MSSQLServerEnvironment))
! {
! Reader in = new FileReader("src/xml/insertOperationTest.xml");
! IDataSet dataSet = new XmlDataSet(in);
! testExecute(dataSet);
! }
}
public void testExecuteCaseInsensitive() throws Exception
{
! // this won't work because of the timestamp column.
! if (!(DatabaseEnvironment.getInstance() instanceof MSSQLServerEnvironment))
! {
! Reader in = new FileReader("src/xml/insertOperationTest.xml");
! IDataSet dataSet = new XmlDataSet(in);
! testExecute(new LowerCaseDataSet(dataSet));
! }
}
--- 333,348 ----
public void testExecute() throws Exception
{
! Reader in = new FileReader("src/xml/insertOperationTest.xml");
! IDataSet dataSet = new XmlDataSet(in);
! testExecute(dataSet);
}
public void testExecuteCaseInsensitive() throws Exception
{
! Reader in = new FileReader("src/xml/insertOperationTest.xml");
! IDataSet dataSet = new XmlDataSet(in);
! testExecute(new LowerCaseDataSet(dataSet));
}
Index: UpdateOperationTest.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/operation/UpdateOperationTest.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** UpdateOperationTest.java 10 Apr 2003 02:52:07 -0000 1.18
--- UpdateOperationTest.java 13 Apr 2003 02:40:12 -0000 1.19
***************
*** 23,41 ****
package org.dbunit.operation;
! import org.dbunit.*;
import org.dbunit.database.MockDatabaseConnection;
import org.dbunit.database.statement.MockBatchStatement;
import org.dbunit.database.statement.MockStatementFactory;
! import org.dbunit.dataset.*;
import org.dbunit.dataset.datatype.DataType;
import org.dbunit.dataset.xml.FlatXmlDataSet;
import org.dbunit.dataset.xml.XmlDataSet;
! import java.io.*;
import java.util.ArrayList;
import java.util.List;
- import junit.framework.Test;
-
/**
* @author Manuel Laflamme
--- 23,52 ----
package org.dbunit.operation;
! import org.dbunit.AbstractDatabaseTest;
! import org.dbunit.Assertion;
! import org.dbunit.DatabaseEnvironment;
! import org.dbunit.TestFeature;
import org.dbunit.database.MockDatabaseConnection;
import org.dbunit.database.statement.MockBatchStatement;
import org.dbunit.database.statement.MockStatementFactory;
! import org.dbunit.dataset.Column;
! import org.dbunit.dataset.CompositeDataSet;
! import org.dbunit.dataset.DefaultDataSet;
! import org.dbunit.dataset.DefaultTable;
! import org.dbunit.dataset.DefaultTableMetaData;
! import org.dbunit.dataset.IDataSet;
! import org.dbunit.dataset.ITable;
! import org.dbunit.dataset.LowerCaseDataSet;
! import org.dbunit.dataset.NoPrimaryKeyException;
import org.dbunit.dataset.datatype.DataType;
import org.dbunit.dataset.xml.FlatXmlDataSet;
import org.dbunit.dataset.xml.XmlDataSet;
! import java.io.File;
! import java.io.FileReader;
! import java.io.Reader;
import java.util.ArrayList;
import java.util.List;
/**
* @author Manuel Laflamme
***************
*** 54,67 ****
protected IDataSet getDataSet() throws Exception
{
! if (DatabaseEnvironment.getInstance() instanceof OracleEnvironment)
{
! return new CompositeDataSet(new IDataSet[]{
! new FlatXmlDataSet(new File("src/xml/clobInsertTest.xml")),
! new FlatXmlDataSet(new File("src/xml/blobInsertTest.xml")),
! super.getDataSet(),
! });
}
! return super.getDataSet();
}
--- 65,86 ----
protected IDataSet getDataSet() throws Exception
{
! IDataSet dataSet = super.getDataSet();
!
! DatabaseEnvironment environment = DatabaseEnvironment.getInstance();
! if (environment.support(TestFeature.BLOB))
{
! dataSet = new CompositeDataSet(
! new FlatXmlDataSet(new File("src/xml/blobInsertTest.xml")),
! dataSet);
}
! if (environment.support(TestFeature.CLOB))
! {
! dataSet = new CompositeDataSet(
! new FlatXmlDataSet(new File("src/xml/clobInsertTest.xml")),
! dataSet);
! }
!
! return dataSet;
}
***************
*** 248,256 ****
public void testUpdateClob() throws Exception
{
- String tableName = "CLOB_TABLE";
-
// execute this test only if the target database support CLOB
! if (DatabaseEnvironment.getInstance() instanceof OracleEnvironment)
{
{
IDataSet beforeDataSet = new FlatXmlDataSet(
--- 267,276 ----
public void testUpdateClob() throws Exception
{
// execute this test only if the target database support CLOB
! DatabaseEnvironment environment = DatabaseEnvironment.getInstance();
! if (environment.support(TestFeature.CLOB))
{
+ String tableName = "CLOB_TABLE";
+
{
IDataSet beforeDataSet = new FlatXmlDataSet(
***************
*** 276,284 ****
public void testUpdateBlob() throws Exception
{
! String tableName = "BLOB_TABLE";
!
! // execute this test only if the target database support CLOB
! if (DatabaseEnvironment.getInstance() instanceof OracleEnvironment)
{
{
IDataSet beforeDataSet = new FlatXmlDataSet(
--- 296,305 ----
public void testUpdateBlob() throws Exception
{
! // execute this test only if the target database support BLOB
! DatabaseEnvironment environment = DatabaseEnvironment.getInstance();
! if (environment.support(TestFeature.BLOB))
{
+ String tableName = "BLOB_TABLE";
+
{
IDataSet beforeDataSet = new FlatXmlDataSet(
|
|
From: <mla...@us...> - 2003-04-13 02:40:14
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/xml
In directory sc8-pr-cvs1:/tmp/cvs-serv1956/dbunit/src/test/org/dbunit/dataset/xml
Modified Files:
AllTests.java
Log Message:
* Test suite cleanup. Added new "unsupportedFeatures" property in
profile.properties file. Used to exclude tests of unsupported database
features. No more instanceof in tests.
* New ForwardOnlyResultSetTable class. Renamed ResultSetTable to
ScrollableResultSetTable. Another step toward support of very large
datasets; remains to implement buffered XML datasets.
* New ForwardOnlyDataSet and ForwardOnlyTable classes. Will be used
in test suite only to ensure that insert and export works with buffered
dataset/table implementations.
Index: AllTests.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/xml/AllTests.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** AllTests.java 13 Jun 2002 17:25:00 -0000 1.5
--- AllTests.java 13 Apr 2003 02:40:11 -0000 1.6
***************
*** 35,40 ****
{
TestSuite suite = new TestSuite();
- suite.addTest(new TestSuite(FlatXmlDataSetTest.class));
suite.addTest(new TestSuite(FlatDtdDataSetTest.class));
suite.addTest(new TestSuite(FlatXmlTableTest.class));
suite.addTest(new TestSuite(FlatXmlTableWriteTest.class));
--- 35,40 ----
{
TestSuite suite = new TestSuite();
suite.addTest(new TestSuite(FlatDtdDataSetTest.class));
+ suite.addTest(new TestSuite(FlatXmlDataSetTest.class));
suite.addTest(new TestSuite(FlatXmlTableTest.class));
suite.addTest(new TestSuite(FlatXmlTableWriteTest.class));
|
|
From: <mla...@us...> - 2003-04-13 02:40:14
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset
In directory sc8-pr-cvs1:/tmp/cvs-serv1956/dbunit/src/test/org/dbunit/dataset
Modified Files:
AbstractDataSetTest.java AbstractTest.java AllTests.java
DefaultDataSetTest.java FilteredDataSetTest.java
Added Files:
ForwardOnlyDataSetTest.java ForwardOnlyTableTest.java
Log Message:
* Test suite cleanup. Added new "unsupportedFeatures" property in
profile.properties file. Used to exclude tests of unsupported database
features. No more instanceof in tests.
* New ForwardOnlyResultSetTable class. Renamed ResultSetTable to
ScrollableResultSetTable. Another step toward support of very large
datasets; remains to implement buffered XML datasets.
* New ForwardOnlyDataSet and ForwardOnlyTable classes. Will be used
in test suite only to ensure that insert and export works with buffered
dataset/table implementations.
--- NEW FILE: ForwardOnlyDataSetTest.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 11, 2003
* @version $Revision: 1.1 $
*/
public class ForwardOnlyDataSetTest extends DefaultDataSetTest
{
public ForwardOnlyDataSetTest(String s)
{
super(s);
}
protected IDataSet createDataSet() throws Exception
{
return new ForwardOnlyDataSet(super.createDataSet());
}
protected IDataSet createDuplicateDataSet() throws Exception
{
return new ForwardOnlyDataSet(super.createDuplicateDataSet());
}
public void testGetTableNames() throws Exception
{
try
{
createDataSet().getTableNames();
fail("Should have throw UnsupportedOperationException");
}
catch (UnsupportedOperationException e)
{
}
}
public void testGetTable() throws Exception
{
String[] tableNames = getExpectedNames();
try
{
createDataSet().getTable(tableNames[0]);
fail("Should have throw UnsupportedOperationException");
}
catch (UnsupportedOperationException e)
{
}
}
public void testGetTableMetaData() throws Exception
{
String[] tableNames = getExpectedNames();
try
{
createDataSet().getTableMetaData(tableNames[0]);
fail("Should have throw UnsupportedOperationException");
}
catch (UnsupportedOperationException e)
{
}
}
public void testReverseIterator() throws Exception
{
try
{
createDataSet().reverseIterator();
fail("Should have throw UnsupportedOperationException");
}
catch (UnsupportedOperationException e)
{
}
}
public void testGetTableNamesDefensiveCopy() throws Exception
{
// Cannot test! Unsupported feature.
}
public void testGetUnknownTable() throws Exception
{
// Cannot test! Unsupported feature.
}
public void testGetUnknownTableMetaData() throws Exception
{
// Cannot test! Unsupported feature.
}
public void testGetTablesDefensiveCopy() throws Exception
{
// Cannot test! Unsupported feature.
}
public void testGetDuplicateTables() throws Exception
{
// Cannot test! Unsupported feature.
}
public void testGetDuplicateTableNames() throws Exception
{
// Cannot test! Unsupported feature.
}
public void testGetDuplicateTable() throws Exception
{
// Cannot test! Unsupported feature.
}
public void testGetDuplicateTableMetaData() throws Exception
{
// Cannot test! Unsupported feature.
}
public void testGetCaseInsensitiveTable() throws Exception
{
// Cannot test! Unsupported feature.
}
public void testGetCaseInsensitiveTableMetaData() throws Exception
{
// Cannot test! Unsupported feature.
}
public void testGetCaseInsensitiveDuplicateTable() throws Exception
{
// Cannot test! Unsupported feature.
}
public void testGetCaseInsensitiveDuplicateTableMetaData() throws Exception
{
// Cannot test! Unsupported feature.
}
public void testReverseIteratorAndDuplicateTable() throws Exception
{
// Cannot test! Unsupported feature.
}
}
--- NEW FILE: ForwardOnlyTableTest.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 11, 2003
* @version $Revision: 1.1 $
*/
public class ForwardOnlyTableTest extends DefaultTableTest
{
public ForwardOnlyTableTest(String s)
{
super(s);
}
protected ITable createTable() throws Exception
{
return new ForwardOnlyTable(super.createTable());
}
public void testGetRowCount() throws Exception
{
try
{
createTable().getRowCount();
fail("Should have throw UnsupportedOperationException");
}
catch (UnsupportedOperationException e)
{
}
}
public void testGetValueRowBounds() throws Exception
{
int[] rows = new int[]{ROW_COUNT, ROW_COUNT + 1};
ITable table = createTable();
String columnName = table.getTableMetaData().getColumns()[0].getColumnName();
for (int i = 0; i < rows.length; i++)
{
try
{
table.getValue(rows[i], columnName);
fail("Should throw a RowOutOfBoundsException!");
}
catch (RowOutOfBoundsException e)
{
}
}
}
public void testGetValueIterateBackward() throws Exception
{
ITable table = createTable();
for (int i = 0; i < ROW_COUNT; i++)
{
for (int j = 0; j < COLUMN_COUNT; j++)
{
String columnName = "COLUMN" + j;
String expected = "row " + i + " col " + j;
Object value = table.getValue(i, columnName);
assertEquals("value", expected, value);
}
// Try access values from previous row
for (int j = 0; j < COLUMN_COUNT; j++)
{
String columnName = "COLUMN" + j;
try
{
table.getValue(i - 1, columnName);
}
catch (UnsupportedOperationException e)
{
}
}
}
}
}
Index: AbstractDataSetTest.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/AbstractDataSetTest.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** AbstractDataSetTest.java 9 Apr 2003 22:52:13 -0000 1.20
--- AbstractDataSetTest.java 13 Apr 2003 02:40:11 -0000 1.21
***************
*** 135,145 ****
{
String[] expected = getExpectedNames();
- // sort(expected);
IDataSet dataSet = createDataSet();
- // String[] names = dataSet.getTableNames();
- // sort(names);
- // assertEquals("table count",
- // expected.length, dataSet.getTableNames().length);
for (int i = 0; i < expected.length; i++)
{
--- 135,140 ----
***************
*** 351,354 ****
--- 346,368 ----
}
+ public void testIteratorAndDuplicateTable() throws Exception
+ {
+ String[] expectedNames = getExpectedDuplicateNames();
+ // int[] expectedRows = getExpectedDuplicateRows();
+
+ int i = 0;
+ ITableIterator iterator = createDuplicateDataSet().iterator();
+ while(iterator.next())
+ {
+ ITable table = iterator.getTable();
+ String name = table.getTableMetaData().getTableName();
+ assertEqualsTableName("name " + i, expectedNames[i], name);
+ // assertEquals("row count", expectedRows[i], table.getRowCount());
+ i++;
+ }
+
+ assertEquals("table count", expectedNames.length, i);
+ }
+
public void testReverseIterator() throws Exception
{
***************
*** 369,373 ****
--- 383,406 ----
}
+ public void testReverseIteratorAndDuplicateTable() throws Exception
+ {
+ String[] expectedNames = getExpectedDuplicateNames();
+ int[] expectedRows = getExpectedDuplicateRows();
+ int i = expectedRows.length - 1;
+ int count = 0;
+ ITableIterator iterator = createDuplicateDataSet().reverseIterator();
+ while(iterator.next())
+ {
+ ITable table = iterator.getTable();
+ String name = table.getTableMetaData().getTableName();
+ assertEqualsTableName("name " + i, expectedNames[i], name);
+ assertEquals("row count", expectedRows[i], table.getRowCount());
+ i--;
+ count++;
+ }
+
+ assertEquals("table count", expectedNames.length, count);
+ }
}
Index: AbstractTest.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/AbstractTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** AbstractTest.java 9 Apr 2003 22:52:14 -0000 1.2
--- AbstractTest.java 13 Apr 2003 02:40:11 -0000 1.3
***************
*** 97,101 ****
List actualList = Arrays.asList(actual);
! if (!expectedList.containsAll(actualList))
{
fail(message + " expected contains:<" + expectedList + "> but was:<"
--- 97,101 ----
List actualList = Arrays.asList(actual);
! if (!actualList.containsAll(expectedList))
{
fail(message + " expected contains:<" + expectedList + "> but was:<"
Index: AllTests.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/AllTests.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** AllTests.java 9 Apr 2003 22:52:14 -0000 1.17
--- AllTests.java 13 Apr 2003 02:40:11 -0000 1.18
***************
*** 23,28 ****
package org.dbunit.dataset;
- import org.dbunit.database.QueryDataSetTest;
-
import junit.framework.Test;
import junit.framework.TestSuite;
--- 23,26 ----
***************
*** 53,56 ****
--- 51,56 ----
suite.addTest(new TestSuite(DefaultTableTest.class));
suite.addTest(new TestSuite(FilteredDataSetTest.class));
+ suite.addTest(new TestSuite(ForwardOnlyDataSetTest.class));
+ suite.addTest(new TestSuite(ForwardOnlyTableTest.class));
suite.addTest(new TestSuite(LowerCaseDataSetTest.class));
suite.addTest(new TestSuite(LowerCaseTableMetaDataTest.class));
Index: DefaultDataSetTest.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/DefaultDataSetTest.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** DefaultDataSetTest.java 14 Feb 2003 03:22:00 -0000 1.7
--- DefaultDataSetTest.java 13 Apr 2003 02:40:11 -0000 1.8
***************
*** 25,29 ****
import org.dbunit.dataset.xml.XmlDataSet;
- import java.io.FileInputStream;
import java.io.FileReader;
--- 25,28 ----
Index: FilteredDataSetTest.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/FilteredDataSetTest.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** FilteredDataSetTest.java 11 Mar 2003 13:26:02 -0000 1.10
--- FilteredDataSetTest.java 13 Apr 2003 02:40:11 -0000 1.11
***************
*** 23,31 ****
package org.dbunit.dataset;
- import org.dbunit.dataset.xml.XmlDataSet;
- import org.dbunit.dataset.xml.FlatXmlDataSet;
import org.dbunit.database.AmbiguousTableNameException;
- import java.io.FileInputStream;
import java.io.FileReader;
--- 23,29 ----
package org.dbunit.dataset;
import org.dbunit.database.AmbiguousTableNameException;
+ import org.dbunit.dataset.xml.XmlDataSet;
import java.io.FileReader;
***************
*** 164,167 ****
--- 162,191 ----
{
dataSet.getTables();
+ fail("Should throw AmbiguousTableNameException");
+ }
+ catch (AmbiguousTableNameException e)
+ {
+ }
+ }
+
+ public void testReverseIteratorAndDuplicateTable() throws Exception
+ {
+ IDataSet dataSet = createDuplicateDataSet();
+ try
+ {
+ dataSet.iterator();
+ fail("Should throw AmbiguousTableNameException");
+ }
+ catch (AmbiguousTableNameException e)
+ {
+ }
+ }
+
+ public void testIteratorAndDuplicateTable() throws Exception
+ {
+ IDataSet dataSet = createDuplicateDataSet();
+ try
+ {
+ dataSet.reverseIterator();
fail("Should throw AmbiguousTableNameException");
}
|
|
From: <mla...@us...> - 2003-04-13 02:40:14
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/database
In directory sc8-pr-cvs1:/tmp/cvs-serv1956/dbunit/src/test/org/dbunit/database
Modified Files:
AllTests.java DatabaseDataSetTest.java
DatabaseTableMetaDataTest.java QueryDataSetTest.java
Added Files:
CachedResultSetTableTest.java
ForwardOnlyResultSetTableTest.java
ScrollableResultSetTableTest.java
Removed Files:
ResultsetTableTest.java
Log Message:
* Test suite cleanup. Added new "unsupportedFeatures" property in
profile.properties file. Used to exclude tests of unsupported database
features. No more instanceof in tests.
* New ForwardOnlyResultSetTable class. Renamed ResultSetTable to
ScrollableResultSetTable. Another step toward support of very large
datasets; remains to implement buffered XML datasets.
* New ForwardOnlyDataSet and ForwardOnlyTable classes. Will be used
in test suite only to ensure that insert and export works with buffered
dataset/table implementations.
--- NEW FILE: CachedResultSetTableTest.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.DatabaseEnvironment;
import org.dbunit.dataset.AbstractTableTest;
import org.dbunit.dataset.ITable;
import org.dbunit.operation.DatabaseOperation;
/**
* @author Manuel Laflamme
* @since Apr 11, 2003
* @version $Revision: 1.1 $
*/
public class CachedResultSetTableTest extends AbstractTableTest
{
public CachedResultSetTableTest(String s)
{
super(s);
}
protected ITable createTable() throws Exception
{
DatabaseEnvironment env = DatabaseEnvironment.getInstance();
IDatabaseConnection connection = env.getConnection();
DatabaseOperation.CLEAN_INSERT.execute(connection, env.getInitDataSet());
String selectStatement = "select * from test_table order by COLUMN0";
return new CachedResultSetTable(
new ForwardOnlyResultSetTable("TEST_TABLE", selectStatement, connection));
}
public void testGetMissingValue() throws Exception
{
// Do not test this!
}
}
--- NEW FILE: ForwardOnlyResultSetTableTest.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.ForwardOnlyTableTest;
import org.dbunit.dataset.ITable;
import org.dbunit.DatabaseEnvironment;
import org.dbunit.operation.DatabaseOperation;
/**
* @author Manuel Laflamme
* @since Apr 11, 2003
* @version $Revision: 1.1 $
*/
public class ForwardOnlyResultSetTableTest extends ForwardOnlyTableTest
{
public ForwardOnlyResultSetTableTest(String s)
{
super(s);
}
protected ITable createTable() throws Exception
{
DatabaseEnvironment env = DatabaseEnvironment.getInstance();
IDatabaseConnection connection = env.getConnection();
DatabaseOperation.CLEAN_INSERT.execute(connection, env.getInitDataSet());
String selectStatement = "select * from test_table order by COLUMN0";
return new ForwardOnlyResultSetTable("TEST_TABLE", selectStatement, connection);
}
public void testGetMissingValue() throws Exception
{
// Do not test this!
}
}
--- NEW FILE: ScrollableResultSetTableTest.java ---
/*
* ScrollableResultSetTableTest.java Feb 19, 2002
*
* 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.DatabaseEnvironment;
import org.dbunit.operation.DatabaseOperation;
import org.dbunit.dataset.AbstractTableTest;
import org.dbunit.dataset.ITable;
/**
* @author Manuel Laflamme
* @version $Revision: 1.1 $
*/
public class ScrollableResultSetTableTest extends AbstractTableTest
{
public ScrollableResultSetTableTest(String s)
{
super(s);
}
protected ITable createTable() throws Exception
{
DatabaseEnvironment env = DatabaseEnvironment.getInstance();
IDatabaseConnection connection = env.getConnection();
DatabaseOperation.CLEAN_INSERT.execute(connection, env.getInitDataSet());
String selectStatement = "select * from test_table order by COLUMN0";
return new ScrollableResultSetTable("TEST_TABLE", selectStatement, connection);
}
public void testGetMissingValue() throws Exception
{
// Do not test this!
}
}
Index: AllTests.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/database/AllTests.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** AllTests.java 9 Apr 2003 22:52:13 -0000 1.10
--- AllTests.java 13 Apr 2003 02:40:11 -0000 1.11
***************
*** 23,26 ****
--- 23,29 ----
package org.dbunit.database;
+ import org.dbunit.DatabaseEnvironment;
+ import org.dbunit.TestFeature;
+
import junit.framework.Test;
import junit.framework.TestSuite;
***************
*** 32,44 ****
public class AllTests
{
! public static Test suite()
{
TestSuite suite = new TestSuite();
suite.addTest(org.dbunit.database.statement.AllTests.suite());
suite.addTest(new TestSuite(DatabaseConnectionTest.class));
suite.addTest(new TestSuite(DatabaseDataSetTest.class));
suite.addTest(new TestSuite(DatabaseTableMetaDataTest.class));
suite.addTest(new TestSuite(QueryDataSetTest.class));
! suite.addTest(new TestSuite(ResultsetTableTest.class));
return suite;
--- 35,54 ----
public class AllTests
{
! public static Test suite() throws Exception
{
TestSuite suite = new TestSuite();
suite.addTest(org.dbunit.database.statement.AllTests.suite());
+ suite.addTest(new TestSuite(CachedResultSetTableTest.class));
suite.addTest(new TestSuite(DatabaseConnectionTest.class));
suite.addTest(new TestSuite(DatabaseDataSetTest.class));
suite.addTest(new TestSuite(DatabaseTableMetaDataTest.class));
+ suite.addTest(new TestSuite(ForwardOnlyResultSetTableTest.class));
suite.addTest(new TestSuite(QueryDataSetTest.class));
!
! DatabaseEnvironment environment = DatabaseEnvironment.getInstance();
! if (environment.support(TestFeature.SCOLLABLE_RESULTSET))
! {
! suite.addTest(new TestSuite(ScrollableResultSetTableTest.class));
! }
return suite;
Index: DatabaseDataSetTest.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/database/DatabaseDataSetTest.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** DatabaseDataSetTest.java 9 Apr 2003 22:52:13 -0000 1.20
--- DatabaseDataSetTest.java 13 Apr 2003 02:40:11 -0000 1.21
***************
*** 24,28 ****
import org.dbunit.DatabaseEnvironment;
- import org.dbunit.MSSQLServerEnvironment;
import org.dbunit.dataset.AbstractDataSetTest;
import org.dbunit.dataset.Column;
--- 24,27 ----
***************
*** 144,177 ****
public void testGetQualifiedTableNames() throws Exception
{
! // this won't work because of the timestamp column.
! if (!(DatabaseEnvironment.getInstance() instanceof MSSQLServerEnvironment)){
! String[] expectedNames = getExpectedNames();
! // sort(expectedNames);
! try
! {
! System.setProperty(DatabaseDataSet.QUALIFIED_TABLE_NAMES, "true");
! IDatabaseConnection connection = new DatabaseConnection(
! _connection.getConnection(), _connection.getSchema());
! IDataSet dataSet = connection.createDataSet();
! String[] actualNames = dataSet.getTableNames();
// sort(actualNames);
! assertEquals("name count", expectedNames.length, actualNames.length);
! for (int i = 0; i < actualNames.length; i++)
! {
! String expected = DataSetUtils.getQualifiedName(
! _connection.getSchema(), expectedNames[i]);
! String actual = actualNames[i];
! assertEquals("name", expected, actual);
! }
! }
! finally
{
! System.setProperty(DatabaseDataSet.QUALIFIED_TABLE_NAMES, "false");
}
}
}
--- 143,172 ----
public void testGetQualifiedTableNames() throws Exception
{
! String[] expectedNames = getExpectedNames();
! try
! {
! System.setProperty(DatabaseDataSet.QUALIFIED_TABLE_NAMES, "true");
! IDatabaseConnection connection = new DatabaseConnection(
! _connection.getConnection(), _connection.getSchema());
! IDataSet dataSet = connection.createDataSet();
! String[] actualNames = dataSet.getTableNames();
// sort(actualNames);
! assertEquals("name count", expectedNames.length, actualNames.length);
! for (int i = 0; i < actualNames.length; i++)
{
! String expected = DataSetUtils.getQualifiedName(
! _connection.getSchema(), expectedNames[i]);
! String actual = actualNames[i];
! assertEquals("name", expected, actual);
}
}
+ finally
+ {
+ System.setProperty(DatabaseDataSet.QUALIFIED_TABLE_NAMES, "false");
+ }
}
***************
*** 264,267 ****
--- 259,272 ----
public void testGetCaseInsensitiveDuplicateTableMetaData() throws Exception
+ {
+ // Cannot test! Unsupported feature.
+ }
+
+ public void testReverseIteratorAndDuplicateTable() throws Exception
+ {
+ // Cannot test! Unsupported feature.
+ }
+
+ public void testIteratorAndDuplicateTable() throws Exception
{
// Cannot test! Unsupported feature.
Index: DatabaseTableMetaDataTest.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/database/DatabaseTableMetaDataTest.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** DatabaseTableMetaDataTest.java 10 Apr 2003 02:52:06 -0000 1.14
--- DatabaseTableMetaDataTest.java 13 Apr 2003 02:40:11 -0000 1.15
***************
*** 34,61 ****
public class DatabaseTableMetaDataTest extends AbstractDatabaseTest
{
- private static final DataType[] EXPECTED_DATA_TYPES = {
- DataType.VARCHAR,
- DataType.NUMERIC,
- DataType.TIMESTAMP,
- DataType.VARBINARY,
- };
-
- private static final DataType[] EXPECTED_DATA_TYPES_MSSQLSERVER = {
- DataType.VARCHAR,
- DataType.NUMERIC,
- DataType.BINARY,
- DataType.VARBINARY,
- };
-
- protected static DataType[] getExpectedDataTypes() throws Exception
- {
- if (DatabaseEnvironment.getInstance() instanceof MSSQLServerEnvironment){
- return (DataType[])EXPECTED_DATA_TYPES_MSSQLSERVER.clone();
- }
- else {
- return (DataType[])EXPECTED_DATA_TYPES.clone();
- }
- }
-
public DatabaseTableMetaDataTest(String s)
{
--- 34,37 ----
***************
*** 178,182 ****
"VARBINARY_COL",
};
! DataType[] expectedTypes = getExpectedDataTypes();
ITableMetaData metaData = createDataSet().getTableMetaData(tableName);
--- 154,163 ----
"VARBINARY_COL",
};
! DataType[] expectedTypes = {
! DataType.VARCHAR,
! DataType.NUMERIC,
! DataType.TIMESTAMP,
! DataType.VARBINARY,
! };
ITableMetaData metaData = createDataSet().getTableMetaData(tableName);
Index: QueryDataSetTest.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/database/QueryDataSetTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** QueryDataSetTest.java 10 Apr 2003 02:52:07 -0000 1.3
--- QueryDataSetTest.java 13 Apr 2003 02:40:11 -0000 1.4
***************
*** 25,28 ****
--- 25,29 ----
import org.dbunit.DatabaseEnvironment;
import org.dbunit.HypersonicEnvironment;
+ import org.dbunit.TestFeature;
import org.dbunit.dataset.AbstractDataSetTest;
import org.dbunit.dataset.IDataSet;
***************
*** 215,232 ****
assertEquals("", "1", new String(table.getRowCount() + ""));
- }
-
- /* This JUNIT test case only works against Hypersonic! */
- public void testLengthSyntax() throws Exception
- {
- if (DatabaseEnvironment.getInstance() instanceof HypersonicEnvironment)
- {
- ITable table = null;
-
- QueryDataSet ptds = new QueryDataSet(_connection);
- ptds.addTable("ATABLE", "CALL LENGTH('hello world')");
- table = ptds.getTable("ATABLE");
- assertEquals("", "1", new String(table.getRowCount() + ""));
- }
}
--- 216,219 ----
--- ResultsetTableTest.java DELETED ---
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit
In directory sc8-pr-cvs1:/tmp/cvs-serv1956/dbunit/src/test/org/dbunit
Modified Files:
DatabaseEnvironment.java DatabaseProfile.java Main.java
OracleEnvironment.java
Added Files:
TestFeature.java
Removed Files:
MSSQLServerEnvironment.java PrimaryKeySupport.java
Log Message:
* Test suite cleanup. Added new "unsupportedFeatures" property in
profile.properties file. Used to exclude tests of unsupported database
features. No more instanceof in tests.
* New ForwardOnlyResultSetTable class. Renamed ResultSetTable to
ScrollableResultSetTable. Another step toward support of very large
datasets; remains to implement buffered XML datasets.
* New ForwardOnlyDataSet and ForwardOnlyTable classes. Will be used
in test suite only to ensure that insert and export works with buffered
dataset/table implementations.
--- NEW FILE: TestFeature.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;
/**
* @author Manuel Laflamme
* @since Apr 11, 2003
* @version $Revision: 1.1 $
*/
public class TestFeature
{
public static final TestFeature BLOB = new TestFeature("BLOB");
public static final TestFeature CLOB = new TestFeature("CLOB");
public static final TestFeature TRANSACTION = new TestFeature("TRANSACTION");
public static final TestFeature SCOLLABLE_RESULTSET = new TestFeature("SCOLLABLE_RESULTSET");
public static final TestFeature INSERT_IDENTITY = new TestFeature("INSERT_IDENTITY");
private final String _name;
private TestFeature(String name)
{
_name = name;
}
public String toString()
{
return _name;
}
}
Index: DatabaseEnvironment.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/DatabaseEnvironment.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** DatabaseEnvironment.java 16 Feb 2003 06:00:59 -0000 1.13
--- DatabaseEnvironment.java 13 Apr 2003 02:40:10 -0000 1.14
***************
*** 27,31 ****
import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.xml.XmlDataSet;
- import org.dbunit.operation.DatabaseOperation;
import java.io.File;
--- 27,30 ----
***************
*** 61,68 ****
INSTANCE = new OracleEnvironment(profile);
}
- else if (profileName.equals("mssql"))
- {
- INSTANCE = new MSSQLServerEnvironment(profile);
- }
else
{
--- 60,63 ----
***************
*** 77,89 ****
{
_profile = profile;
-
- // String name = profile.getDriverClass();
- // Class.forName(name);
- // Connection connection = DriverManager.getConnection(
- // _profile.getConnectionUrl(), _profile.getUser(),
- // _profile.getPassword());
- // _connection = new DatabaseConnection(connection,
- // _profile.getSchema());
-
File file = new File("src/xml/dataSetTest.xml");
_dataSet = new XmlDataSet(new FileReader(file));
--- 72,75 ----
***************
*** 124,127 ****
--- 110,127 ----
}
+ public boolean support(TestFeature feature)
+ {
+ String[] unsupportedFeatures = _profile.getUnsupportedFeatures();
+ for (int i = 0; i < unsupportedFeatures.length; i++)
+ {
+ String unsupportedFeature = unsupportedFeatures[i];
+ if (feature.toString().equals(unsupportedFeature))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
}
Index: DatabaseProfile.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/DatabaseProfile.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** DatabaseProfile.java 7 Aug 2002 01:32:12 -0000 1.7
--- DatabaseProfile.java 13 Apr 2003 02:40:10 -0000 1.8
***************
*** 24,27 ****
--- 24,30 ----
import java.util.Properties;
+ import java.util.StringTokenizer;
+ import java.util.List;
+ import java.util.ArrayList;
/**
***************
*** 38,41 ****
--- 41,45 ----
private static final String USER = "user";
private static final String PASSWORD = "password";
+ private static final String UNSUPPORTED_FEATURES = "unsupportedFeatures";
private final Properties _properties;
***************
*** 79,82 ****
--- 83,100 ----
{
return _properties.getProperty(getPropertyKey(PASSWORD));
+ }
+
+ public String[] getUnsupportedFeatures()
+ {
+ String property = _properties.getProperty(
+ getPropertyKey(UNSUPPORTED_FEATURES));
+
+ List stringList = new ArrayList();
+ StringTokenizer tokenizer = new StringTokenizer(property, ",");
+ while(tokenizer.hasMoreTokens())
+ {
+ stringList.add(tokenizer.nextToken().trim());
+ }
+ return (String[])stringList.toArray(new String[0]);
}
Index: Main.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/Main.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** Main.java 13 Mar 2003 02:24:12 -0000 1.29
--- Main.java 13 Apr 2003 02:40:10 -0000 1.30
***************
*** 24,31 ****
--- 24,33 ----
import org.dbunit.database.IDatabaseConnection;
+ import org.dbunit.database.DatabaseDataSet;
import org.dbunit.dataset.xml.FlatXmlDataSet;
import org.dbunit.dataset.xml.XmlDataSet;
import org.dbunit.dataset.excel.XlsDataSet;
import org.dbunit.dataset.DataSetException;
+ import org.dbunit.dataset.ITableIterator;
import electric.xml.Document;
***************
*** 43,46 ****
--- 45,57 ----
public static void main(String[] args) throws Exception
{
+ // System.setProperty("dbunit.qualified.table.names", "true");
+
+ IDatabaseConnection connection =
+ DatabaseEnvironment.getInstance().getConnection();
+ ITableIterator iterator = connection.createDataSet().iterator();
+ while(iterator.next())
+ {
+ System.out.println(iterator.getTableMetaData().getTableName());
+ }
// oldMain();
// testWrite();
Index: OracleEnvironment.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/OracleEnvironment.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** OracleEnvironment.java 13 Jun 2002 17:24:59 -0000 1.2
--- OracleEnvironment.java 13 Apr 2003 02:40:10 -0000 1.3
***************
*** 40,44 ****
ITable[] extraTables = {
new DefaultTable("CLOB_TABLE"),
! new DefaultTable("BLOB_TABLE"),
};
--- 40,44 ----
ITable[] extraTables = {
new DefaultTable("CLOB_TABLE"),
! new DefaultTable("BLOB_TABLE"),f
};
--- MSSQLServerEnvironment.java DELETED ---
--- PrimaryKeySupport.java DELETED ---
|
|
From: <mla...@us...> - 2003-04-13 02:07:41
|
Update of /cvsroot/dbunit/dbunit/src/sql In directory sc8-pr-cvs1:/tmp/cvs-serv26988/dbunit/src/sql Modified Files: mssql.sql Log Message: Modified EMPTY_MULTITYPE_TABLE to use DATETIME as data type for column TIMESTAMP_COL. This fix binary issue with TIMESTAMP data type. Index: mssql.sql =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/sql/mssql.sql,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mssql.sql 29 Jan 2003 13:04:57 -0000 1.2 --- mssql.sql 13 Apr 2003 02:07:38 -0000 1.3 *************** *** 1,115 **** ! if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EMPTY_MULTITYPE_TABLE]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) ! drop table [dbo].[EMPTY_MULTITYPE_TABLE] ! GO ! ! if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EMPTY_TABLE]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) ! drop table [dbo].[EMPTY_TABLE] ! GO ! ! if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IDENTITY_TABLE]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) ! drop table [dbo].[IDENTITY_TABLE] ! GO ! ! if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ONLY_PK_TABLE]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) ! drop table [dbo].[ONLY_PK_TABLE] ! GO ! ! if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PK_TABLE]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) ! drop table [dbo].[PK_TABLE] ! GO ! if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SECOND_TABLE]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) ! drop table [dbo].[SECOND_TABLE] ! GO ! if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TEST_TABLE]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) ! drop table [dbo].[TEST_TABLE] ! GO ! if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TEST_IDENTITY_NOT_PK]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) ! drop table [dbo].[TEST_IDENTITY_NOT_PK] ! GO ! CREATE TABLE [dbo].[EMPTY_MULTITYPE_TABLE] ( ! [VARCHAR_COL] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , ! [NUMERIC_COL] [numeric](38, 0) NULL , ! [TIMESTAMP_COL] [timestamp] NULL , ! [VARBINARY_COL] [varbinary] (254) NULL ! ) ON [PRIMARY] ! GO ! CREATE TABLE [dbo].[EMPTY_TABLE] ( ! [COLUMN0] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , ! [COLUMN1] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , ! [COLUMN2] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , ! [COLUMN3] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ! ) ON [PRIMARY] ! GO ! CREATE TABLE [dbo].[IDENTITY_TABLE] ( ! [IDENTITY_TABLE_ID] [int] IDENTITY (1, 1) NOT NULL , ! [COLUMN0] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , ! [COLUMN1] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ! ) ON [PRIMARY] ! GO ! ALTER TABLE dbo.IDENTITY_TABLE ADD CONSTRAINT ! PK_IDENTITY_TABLE PRIMARY KEY CLUSTERED ! ( ! IDENTITY_TABLE_ID ! ) ON [PRIMARY] ! GO ! CREATE TABLE [dbo].[ONLY_PK_TABLE] ( ! [PK0] [numeric](38, 0) NOT NULL ! ) ON [PRIMARY] ! GO ! ALTER TABLE dbo.ONLY_PK_TABLE ADD CONSTRAINT ! PK_ONLY_PK_TABLE PRIMARY KEY CLUSTERED ! ( ! PK0 ! ) ON [PRIMARY] ! GO ! CREATE TABLE [dbo].[PK_TABLE] ( ! [PK0] [numeric](38, 0) NOT NULL , ! [PK1] [numeric](38, 0) NOT NULL , ! [PK2] [numeric](38, 0) NOT NULL , ! [NORMAL0] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , ! [NORMAL1] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ! ) ON [PRIMARY] ! GO ! ALTER TABLE dbo.PK_TABLE ADD CONSTRAINT ! PK_PK_TABLE PRIMARY KEY CLUSTERED ! ( ! PK0, ! PK1, ! PK2 ! ) ON [PRIMARY] ! GO ! CREATE TABLE [dbo].[SECOND_TABLE] ( ! [COLUMN0] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , ! [COLUMN1] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , ! [COLUMN2] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , ! [COLUMN3] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ! ) ON [PRIMARY] ! GO ! CREATE TABLE [dbo].[TEST_TABLE] ( ! [COLUMN0] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , ! [COLUMN1] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , ! [COLUMN2] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , ! [COLUMN3] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ! ) ON [PRIMARY] ! GO ! CREATE TABLE dbo.TEST_IDENTITY_NOT_PK ! ( ! COL01 int NOT NULL IDENTITY (1, 1), ! COL02 varchar(64) NULL ! ) ON [PRIMARY] ! GO --- 1,74 ---- ! ----------------------------------------------------------------------------- ! -- TEST_TABLE ! ----------------------------------------------------------------------------- ! CREATE TABLE TEST_TABLE ! (COLUMN0 VARCHAR(32), ! COLUMN1 VARCHAR(32), ! COLUMN2 VARCHAR(32), ! COLUMN3 VARCHAR(32)); ! ----------------------------------------------------------------------------- ! -- SECOND_TABLE ! ----------------------------------------------------------------------------- ! CREATE TABLE SECOND_TABLE ! (COLUMN0 VARCHAR(32), ! COLUMN1 VARCHAR(32), ! COLUMN2 VARCHAR(32), ! COLUMN3 VARCHAR(32)); ! ----------------------------------------------------------------------------- ! -- EMPTY_TABLE ! ----------------------------------------------------------------------------- ! CREATE TABLE EMPTY_TABLE ! (COLUMN0 VARCHAR(32), ! COLUMN1 VARCHAR(32), ! COLUMN2 VARCHAR(32), ! COLUMN3 VARCHAR(32)); ! ----------------------------------------------------------------------------- ! -- PK_TABLE ! ----------------------------------------------------------------------------- ! CREATE TABLE PK_TABLE ! (PK0 NUMERIC(38, 0) NOT NULL, ! PK1 NUMERIC(38, 0) NOT NULL, ! PK2 NUMERIC(38, 0) NOT NULL, ! NORMAL0 VARCHAR(32), ! NORMAL1 VARCHAR(32), PRIMARY KEY (PK0, PK1, PK2)); ! ----------------------------------------------------------------------------- ! -- ONLY_PK_TABLE ! ----------------------------------------------------------------------------- ! CREATE TABLE ONLY_PK_TABLE ! (PK0 NUMERIC(38, 0) NOT NULL PRIMARY KEY); ! ----------------------------------------------------------------------------- ! -- EMPTY_MULTITYPE_TABLE ! ----------------------------------------------------------------------------- ! CREATE TABLE EMPTY_MULTITYPE_TABLE ! (VARCHAR_COL VARCHAR(32), ! NUMERIC_COL NUMERIC(38, 0), ! TIMESTAMP_COL DATETIME, ! VARBINARY_COL VARBINARY(254)); ! ----------------------------------------------------------------------------- ! -- IDENTITY_TABLE ! ----------------------------------------------------------------------------- ! CREATE TABLE IDENTITY_TABLE ! (IDENTITY_TABLE_ID INT IDENTITY (1, 1) NOT NULL, ! COLUMN0 VARCHAR(32), ! COLUMN1 VARCHAR(32), PRIMARY KEY (IDENTITY_TABLE_ID)); ! ----------------------------------------------------------------------------- ! -- IDENTITY_TABLE ! ----------------------------------------------------------------------------- ! CREATE TABLE TEST_IDENTITY_NOT_PK ! (COL01 INT IDENTITY (1, 1) NOT NULL, ! COL02 VARCHAR(64)); |