|
From: <de...@us...> - 2002-12-13 21:45:38
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset
In directory sc8-pr-cvs1:/tmp/cvs-serv32641
Modified Files:
AbstractDataSetTest.java QueryDataSetTest.java
Log Message:
fixes to support running test cases against MSSQL
Index: AbstractDataSetTest.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/AbstractDataSetTest.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** AbstractDataSetTest.java 4 Aug 2002 01:07:13 -0000 1.14
--- AbstractDataSetTest.java 13 Dec 2002 21:45:34 -0000 1.15
***************
*** 24,27 ****
--- 24,28 ----
import org.dbunit.database.AmbiguousTableNameException;
+ import org.dbunit.*;
import java.util.*;
***************
*** 44,47 ****
--- 45,50 ----
};
+
+
private static final String[] DUPLICATE_TABLE_NAMES = {
"DUPLICATE_TABLE",
***************
*** 55,61 ****
}
! protected static String[] getExpectedNames()
{
return (String[])TABLE_NAMES.clone();
}
--- 58,65 ----
}
! protected static String[] getExpectedNames() throws Exception
{
return (String[])TABLE_NAMES.clone();
+
}
***************
*** 77,81 ****
/**
* This method exclude BLOB_TABLE and CLOB_TABLE from the specified dataset
! * because BLOB and CLOB are not supported by all database vendor
*/
public static IDataSet removeExtraTestTables(IDataSet dataSet) throws Exception
--- 81,86 ----
/**
* This method exclude BLOB_TABLE and CLOB_TABLE from the specified dataset
! * because BLOB and CLOB are not supported by all database vendor.
! * @todo Should be refactored into thee various DatabaseEnvironments!
*/
public static IDataSet removeExtraTestTables(IDataSet dataSet) throws Exception
***************
*** 90,93 ****
--- 95,110 ----
nameList.remove("DBUNIT.BLOB_TABLE");
nameList.remove("DBUNIT.CLOB_TABLE");
+ /*
+ this table shows up on MSSQLServer. It is a user table for storing diagram information
+ that really should be considered a system table.
+ */
+ nameList.remove("DBUNIT.dtproperties");
+ nameList.remove("dtproperties");
+ /*
+ This table is created specifically for testing identity columns on MSSQL server.
+ It should be ignored on other platforms.
+ */
+ nameList.remove("DBUNIT.IDENTITY_TABLE");
+ nameList.remove("IDENTITY_TABLE");
// nameList.remove("ESCAPED TABLE");
names = (String[])nameList.toArray(new String[0]);
***************
*** 207,211 ****
sort(expected);
! IDataSet dataSet = createDataSet();
ITable[] tables = dataSet.getTables();
sort(tables);
--- 224,230 ----
sort(expected);
! IDataSet dataSet = removeExtraTestTables(createDataSet());
! String[] names = dataSet.getTableNames();
! sort(names);
ITable[] tables = dataSet.getTables();
sort(tables);
Index: QueryDataSetTest.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/QueryDataSetTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** QueryDataSetTest.java 11 Dec 2002 15:57:34 -0000 1.1
--- QueryDataSetTest.java 13 Dec 2002 21:45:34 -0000 1.2
***************
*** 24,27 ****
--- 24,28 ----
import org.dbunit.DatabaseEnvironment;
+ import org.dbunit.*;
import org.dbunit.database.*;
***************
*** 249,260 ****
}
public void testLengthSyntax() throws Exception
{
! 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() + ""));
--- 250,264 ----
}
+ /* 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() + ""));
! }
|