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: <jef...@us...> - 2010-05-16 15:56:59
|
Revision: 1185
http://dbunit.svn.sourceforge.net/dbunit/?rev=1185&view=rev
Author: jeffjensen
Date: 2010-05-16 15:56:53 +0000 (Sun, 16 May 2010)
Log Message:
-----------
Add rowCount log message to help troubleshooting.
Modified Paths:
--------------
trunk/dbunit/src/main/java/org/dbunit/database/AbstractDatabaseConnection.java
Modified: trunk/dbunit/src/main/java/org/dbunit/database/AbstractDatabaseConnection.java
===================================================================
--- trunk/dbunit/src/main/java/org/dbunit/database/AbstractDatabaseConnection.java 2010-05-16 01:55:09 UTC (rev 1184)
+++ trunk/dbunit/src/main/java/org/dbunit/database/AbstractDatabaseConnection.java 2010-05-16 15:56:53 UTC (rev 1185)
@@ -88,6 +88,8 @@
IResultSetTableFactory tableFactory = getResultSetTableFactory();
IResultSetTable rsTable = tableFactory.createTable(resultName, sql, this);
+ logger.debug("createQueryTable: rowCount={}", new Integer(rsTable
+ .getRowCount()));
return rsTable;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jef...@us...> - 2010-05-16 01:55:16
|
Revision: 1184
http://dbunit.svn.sourceforge.net/dbunit/?rev=1184&view=rev
Author: jeffjensen
Date: 2010-05-16 01:55:09 +0000 (Sun, 16 May 2010)
Log Message:
-----------
Improve some logging to help troubleshooting.
Modified Paths:
--------------
trunk/dbunit/src/main/java/org/dbunit/assertion/DbUnitAssert.java
Modified: trunk/dbunit/src/main/java/org/dbunit/assertion/DbUnitAssert.java
===================================================================
--- trunk/dbunit/src/main/java/org/dbunit/assertion/DbUnitAssert.java 2010-05-15 20:10:27 UTC (rev 1183)
+++ trunk/dbunit/src/main/java/org/dbunit/assertion/DbUnitAssert.java 2010-05-16 01:55:09 UTC (rev 1184)
@@ -63,20 +63,20 @@
public DbUnitAssert()
{
}
-
+
/**
* Compare one table present in two datasets ignoring specified columns.
*
* @param expectedDataset
- * First dataset.
+ * First dataset.
* @param actualDataset
- * Second dataset.
+ * Second dataset.
* @param tableName
- * Table name of the table to be compared.
+ * Table name of the table to be compared.
* @param ignoreCols
- * Columns to be ignored in comparison.
+ * Columns to be ignored in comparison.
* @throws org.dbunit.DatabaseUnitException
- * If an error occurs.
+ * If an error occurs.
*/
public void assertEqualsIgnoreCols(final IDataSet expectedDataset,
final IDataSet actualDataset, final String tableName,
@@ -84,7 +84,7 @@
{
if (logger.isDebugEnabled())
logger.debug(
- "assertEqualsIgnoreCols(expectedDataset={}, actualDataset={}, tableName={}, ignoreCols={}) - start",
+ "assertEqualsIgnoreCols(expectedDataset={}, actualDataset={}, tableName={}, ignoreCols={}) - start",
new Object[] { expectedDataset, actualDataset, tableName,
Arrays.asList(ignoreCols) });
@@ -96,13 +96,13 @@
* Compare the given tables ignoring specified columns.
*
* @param expectedTable
- * First table.
+ * First table.
* @param actualTable
- * Second table.
+ * Second table.
* @param ignoreCols
- * Columns to be ignored in comparison.
+ * Columns to be ignored in comparison.
* @throws org.dbunit.DatabaseUnitException
- * If an error occurs.
+ * If an error occurs.
*/
public void assertEqualsIgnoreCols(final ITable expectedTable,
final ITable actualTable, final String[] ignoreCols)
@@ -110,10 +110,10 @@
{
if (logger.isDebugEnabled())
logger
- .debug(
- "assertEqualsIgnoreCols(expectedTable={}, actualTable={}, ignoreCols={}) - start",
- new Object[] { expectedTable, actualTable,
- Arrays.asList(ignoreCols) });
+ .debug(
+ "assertEqualsIgnoreCols(expectedTable={}, actualTable={}, ignoreCols={}) - start",
+ new Object[] {expectedTable, actualTable,
+ Arrays.asList(ignoreCols)});
final ITable expectedTableFiltered = DefaultColumnFilter
.excludedColumnsTable(expectedTable, ignoreCols);
@@ -126,19 +126,19 @@
* Compare a table from a dataset with a table generated from an sql query.
*
* @param expectedDataset
- * Dataset to retrieve the first table from.
+ * Dataset to retrieve the first table from.
* @param connection
- * Connection to use for the SQL statement.
+ * Connection to use for the SQL statement.
* @param sqlQuery
* SQL query that will build the data in returned second table rows.
* @param tableName
- * Table name of the table to compare
+ * Table name of the table to compare
* @param ignoreCols
- * Columns to be ignored in comparison.
+ * Columns to be ignored in comparison.
* @throws DatabaseUnitException
- * If an error occurs while performing the comparison.
+ * If an error occurs while performing the comparison.
* @throws java.sql.SQLException
- * If an SQL error occurs.
+ * If an SQL error occurs.
*/
public void assertEqualsByQuery(final IDataSet expectedDataset,
final IDatabaseConnection connection, final String sqlQuery,
@@ -147,7 +147,7 @@
{
if (logger.isDebugEnabled())
logger.debug(
- "assertEqualsByQuery(expectedDataset={}, connection={}, tableName={}, sqlQuery={}, ignoreCols={}) - start",
+ "assertEqualsByQuery(expectedDataset={}, connection={}, tableName={}, sqlQuery={}, ignoreCols={}) - start",
new Object[] { expectedDataset, connection, tableName, sqlQuery,
ignoreCols });
@@ -160,19 +160,19 @@
* Compare a table with a table generated from an sql query.
*
* @param expectedTable
- * Table containing all expected results.
+ * Table containing all expected results.
* @param connection
- * Connection to use for the SQL statement.
+ * Connection to use for the SQL statement.
* @param tableName
- * The name of the table to query from the database
+ * The name of the table to query from the database
* @param sqlQuery
* SQL query that will build the data in returned second table rows.
* @param ignoreCols
- * Columns to be ignored in comparison.
+ * Columns to be ignored in comparison.
* @throws DatabaseUnitException
- * If an error occurs while performing the comparison.
+ * If an error occurs while performing the comparison.
* @throws java.sql.SQLException
- * If an SQL error occurs.
+ * If an SQL error occurs.
*/
public void assertEqualsByQuery(final ITable expectedTable,
final IDatabaseConnection connection, final String tableName,
@@ -181,15 +181,15 @@
{
if (logger.isDebugEnabled())
logger.debug(
- "assertEqualsByQuery(expectedTable={}, connection={}, tableName={}, sqlQuery={}, ignoreCols={}) - start",
+ "assertEqualsByQuery(expectedTable={}, connection={}, tableName={}, sqlQuery={}, ignoreCols={}) - start",
new Object[] { expectedTable, connection, tableName, sqlQuery,
ignoreCols });
ITable expected = DefaultColumnFilter.excludedColumnsTable(expectedTable,
- ignoreCols);
+ ignoreCols);
ITable queriedTable = connection.createQueryTable(tableName, sqlQuery);
ITable actual = DefaultColumnFilter.excludedColumnsTable(queriedTable,
- ignoreCols);
+ ignoreCols);
assertEquals(expected, actual);
}
@@ -216,7 +216,7 @@
{
if (logger.isDebugEnabled())
logger.debug(
- "assertEquals(expectedDataSet={}, actualDataSet={}, failureHandler={}) - start",
+ "assertEquals(expectedDataSet={}, actualDataSet={}, failureHandler={}) - start",
new Object[] { expectedDataSet, actualDataSet, failureHandler });
// do not continue if same instance
@@ -261,9 +261,9 @@
* composing the primary keys.
*
* @param expectedTable
- * Table containing all expected results.
+ * Table containing all expected results.
* @param actualTable
- * Table containing all actual results.
+ * Table containing all actual results.
* @throws DatabaseUnitException
*/
public void assertEquals(ITable expectedTable, ITable actualTable)
@@ -287,22 +287,22 @@
* </pre></code>
*
* @param expectedTable
- * Table containing all expected results.
+ * Table containing all expected results.
* @param actualTable
- * Table containing all actual results.
+ * Table containing all actual results.
* @param additionalColumnInfo
* The columns to be printed out if the assert fails because of a
* data mismatch. Provides some additional column values that may be
* useful to quickly identify the columns for which the mismatch
* occurred (for example a primary key column). Can be
- * <code>null</code>
+ * <code>null</code>
* @throws DatabaseUnitException
*/
public void assertEquals(ITable expectedTable, ITable actualTable,
Column[] additionalColumnInfo) throws DatabaseUnitException
{
logger.debug(
- "assertEquals(expectedTable={}, actualTable={}, additionalColumnInfo={}) - start",
+ "assertEquals(expectedTable={}, actualTable={}, additionalColumnInfo={}) - start",
new Object[] { expectedTable, actualTable, additionalColumnInfo });
FailureHandler failureHandler = null;
@@ -325,9 +325,9 @@
* </pre></code>
*
* @param expectedTable
- * Table containing all expected results.
+ * Table containing all expected results.
* @param actualTable
- * Table containing all actual results.
+ * Table containing all actual results.
* @param failureHandler
* The failure handler used if the assert fails because of a data
* mismatch. Provides some additional information that may be useful
@@ -338,17 +338,18 @@
* @since 2.4
*/
public void assertEquals(ITable expectedTable, ITable actualTable,
- FailureHandler failureHandler) throws DatabaseUnitException
+ FailureHandler failureHandler) throws DatabaseUnitException
{
- logger.debug(
- "assertEquals(expectedTable={}, actualTable={}, failureHandler={}) - start",
- new Object[] { expectedTable, actualTable, failureHandler });
+ logger.trace("assertEquals(expectedTable, actualTable, failureHandler) - start");
+ logger.debug("assertEquals: expectedTable={}", expectedTable);
+ logger.debug("assertEquals: actualTable={}", actualTable);
+ logger.debug("assertEquals: failureHandler={}", failureHandler);
// Do not continue if same instance
if (expectedTable == actualTable) {
logger.debug(
- "The given tables reference the same object. Will return immediately. (Table={})",
- expectedTable);
+ "The given tables reference the same object. Will return immediately. (Table={})",
+ expectedTable);
return;
}
@@ -366,10 +367,15 @@
int actualRowsCount = actualTable.getRowCount();
if (expectedRowsCount != actualRowsCount) {
String msg = "row count (table=" + expectedTableName + ")";
- throw failureHandler.createFailure(msg,
- String.valueOf(expectedRowsCount), String.valueOf(actualRowsCount));
+ Error error =
+ failureHandler.createFailure(msg, String
+ .valueOf(expectedRowsCount), String
+ .valueOf(actualRowsCount));
+ logger.error(error.toString());
+ throw error;
}
- // if both tables are empty, it is not necessary to compare columns, as such
+ // if both tables are empty, it is not necessary to compare columns, as
+ // such
// comparison
// can fail if column metadata is different (which could occurs when
// comparing empty tables)
@@ -383,13 +389,16 @@
Column[] actualColumns = Columns.getSortedColumns(actualMetaData);
// Verify columns
- Columns.ColumnDiff columnDiff = Columns.getColumnDiff(expectedMetaData,
- actualMetaData);
+ Columns.ColumnDiff columnDiff =
+ Columns.getColumnDiff(expectedMetaData, actualMetaData);
if (columnDiff.hasDifference()) {
String message = columnDiff.getMessage();
- throw failureHandler.createFailure(message, Columns
- .getColumnNamesAsString(expectedColumns), Columns
- .getColumnNamesAsString(actualColumns));
+ Error error =
+ failureHandler.createFailure(message, Columns
+ .getColumnNamesAsString(expectedColumns), Columns
+ .getColumnNamesAsString(actualColumns));
+ logger.error(error.toString());
+ throw error;
}
// Get the datatypes to be used for comparing the sorted columns
@@ -417,7 +426,7 @@
{
DefaultFailureHandler failureHandler = new DefaultFailureHandler(additionalColumnInfo);
if (junitFailureFactory != null) {
- failureHandler.setFailureFactory(junitFailureFactory);
+ failureHandler.setFailureFactory(junitFailureFactory);
}
return failureHandler;
}
@@ -442,12 +451,12 @@
/**
* @param expectedTable
- * Table containing all expected results.
+ * Table containing all expected results.
* @param actualTable
- * Table containing all actual results.
+ * Table containing all actual results.
* @param comparisonCols
- * The columns to be compared, also including the correct
- * {@link DataType}s for comparison
+ * The columns to be compared, also including the correct
+ * {@link DataType}s for comparison
* @param failureHandler
* The failure handler used if the assert fails because of a data
* mismatch. Provides some additional information that may be useful
@@ -459,27 +468,28 @@
*/
protected void compareData(ITable expectedTable, ITable actualTable,
ComparisonColumn[] comparisonCols, FailureHandler failureHandler)
- throws DataSetException
+ throws DataSetException
{
- logger.debug("assertEquals(expectedTable={}, actualTable={}, "
- + "comparisonCols={}, failureHandler={}) - start", new Object[] {
- expectedTable, actualTable, comparisonCols, failureHandler });
+ logger.debug("compareData(expectedTable={}, actualTable={}, "
+ + "comparisonCols={}, failureHandler={}) - start",
+ new Object[] {expectedTable, actualTable, comparisonCols,
+ failureHandler});
if (expectedTable == null) {
throw new NullPointerException(
- "The parameter 'expectedTable' must not be null");
+ "The parameter 'expectedTable' must not be null");
}
if (actualTable == null) {
throw new NullPointerException(
- "The parameter 'actualTable' must not be null");
+ "The parameter 'actualTable' must not be null");
}
if (comparisonCols == null) {
throw new NullPointerException(
- "The parameter 'comparisonCols' must not be null");
+ "The parameter 'comparisonCols' must not be null");
}
if (failureHandler == null) {
throw new NullPointerException(
- "The parameter 'failureHandler' must not be null");
+ "The parameter 'failureHandler' must not be null");
}
// iterate over all rows
@@ -495,21 +505,21 @@
Object actualValue = actualTable.getValue(i, columnName);
// Compare the values
- if(skipCompare(columnName, expectedValue, actualValue)){
- if(logger.isTraceEnabled()){
+ if (skipCompare(columnName, expectedValue, actualValue)) {
+ if (logger.isTraceEnabled()) {
logger.trace( "ignoring comparison " + expectedValue + "=" +
actualValue + " on column " + columnName);
}
continue;
}
-
+
if (dataType.compare(expectedValue, actualValue) != 0) {
Difference diff = new Difference(
expectedTable, actualTable,
i, columnName,
expectedValue, actualValue);
-
+
// Handle the difference (throw error immediately or something else)
failureHandler.handle(diff);
}
@@ -539,8 +549,8 @@
* @param expectedColumns
* @param actualColumns
* @param failureHandler
- * The {@link FailureHandler} to be used when no datatype can be
- * determined
+ * The {@link FailureHandler} to be used when no datatype can be
+ * determined
* @return The columns to be used for the assertion, including the correct
* datatype
* @since 2.4
@@ -555,7 +565,7 @@
Column expectedColumn = expectedColumns[j];
Column actualColumn = actualColumns[j];
result[j] = new ComparisonColumn(expectedTableName, expectedColumn,
- actualColumn, failureHandler);
+ actualColumn, failureHandler);
}
return result;
}
@@ -597,7 +607,7 @@
/**
* @param tableName
- * The table name which is only needed for debugging output
+ * The table name which is only needed for debugging output
* @param expectedColumn
* The expected column needed to resolve the {@link DataType} to
* use for the actual comparison
@@ -613,7 +623,7 @@
super();
this.columnName = expectedColumn.getColumnName();
this.dataType = getComparisonDataType(tableName, expectedColumn,
- actualColumn, failureHandler);
+ actualColumn, failureHandler);
}
/**
@@ -632,7 +642,7 @@
/**
* @param tableName
- * The table name which is only needed for debugging output
+ * The table name which is only needed for debugging output
* @param expectedColumn
* @param actualColumn
* @param failureHandler
@@ -646,7 +656,7 @@
FailureHandler failureHandler) {
if (logger.isDebugEnabled())
logger.debug(
- "getComparisonDataType(tableName={}, expectedColumn={}, actualColumn={}, failureHandler={}) - start",
+ "getComparisonDataType(tableName={}, expectedColumn={}, actualColumn={}, failureHandler={}) - start",
new Object[] { tableName, expectedColumn, actualColumn,
failureHandler });
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jef...@us...> - 2010-05-15 20:10:33
|
Revision: 1183
http://dbunit.svn.sourceforge.net/dbunit/?rev=1183&view=rev
Author: jeffjensen
Date: 2010-05-15 20:10:27 +0000 (Sat, 15 May 2010)
Log Message:
-----------
Lower log level of message.
Modified Paths:
--------------
trunk/dbunit/src/main/java/org/dbunit/DefaultPrepAndExpectedTestCase.java
Modified: trunk/dbunit/src/main/java/org/dbunit/DefaultPrepAndExpectedTestCase.java
===================================================================
--- trunk/dbunit/src/main/java/org/dbunit/DefaultPrepAndExpectedTestCase.java 2010-04-28 22:09:42 UTC (rev 1182)
+++ trunk/dbunit/src/main/java/org/dbunit/DefaultPrepAndExpectedTestCase.java 2010-05-15 20:10:27 UTC (rev 1183)
@@ -413,7 +413,7 @@
int count = dataFiles.length;
LOG.debug("makeCompositeDataSet: dataFiles count=" + count);
if (count == 0) {
- LOG.warn("makeCompositeDataSet: Specified zero data files");
+ LOG.info("makeCompositeDataSet: Specified zero data files");
}
List list = new ArrayList();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jef...@us...> - 2010-03-29 20:11:13
|
Revision: 1180
http://dbunit.svn.sourceforge.net/dbunit/?rev=1180&view=rev
Author: jeffjensen
Date: 2010-03-29 20:11:04 +0000 (Mon, 29 Mar 2010)
Log Message:
-----------
Close connection at end of verifyData() (it obtains one, so needs to return it; data source running out of active connections!). Make all methods public vs some protected.
Modified Paths:
--------------
trunk/dbunit/src/main/java/org/dbunit/DefaultPrepAndExpectedTestCase.java
Modified: trunk/dbunit/src/main/java/org/dbunit/DefaultPrepAndExpectedTestCase.java
===================================================================
--- trunk/dbunit/src/main/java/org/dbunit/DefaultPrepAndExpectedTestCase.java 2010-03-25 22:09:07 UTC (rev 1179)
+++ trunk/dbunit/src/main/java/org/dbunit/DefaultPrepAndExpectedTestCase.java 2010-03-29 20:11:04 UTC (rev 1180)
@@ -206,7 +206,7 @@
* {@inheritDoc} This implementation returns the databaseTester set by the
* test.
*/
- protected IDatabaseTester newDatabaseTester() throws Exception {
+ public IDatabaseTester newDatabaseTester() throws Exception {
// questionable, but there is not a "setter" for any parent...
return databaseTester;
}
@@ -214,7 +214,7 @@
/**
* {@inheritDoc} Returns the prep dataset.
*/
- protected IDataSet getDataSet() throws Exception {
+ public IDataSet getDataSet() throws Exception {
return prepDs;
}
@@ -277,7 +277,7 @@
*
* @throws Exception
*/
- protected void setupData() throws Exception {
+ public void setupData() throws Exception {
LOG.debug("setupData: setting prep dataset and inserting rows");
if (databaseTester == null) {
throw new IllegalStateException(
@@ -295,7 +295,7 @@
*
* @throws Exception
*/
- protected void verifyData() throws Exception {
+ public void verifyData() throws Exception {
if (databaseTester == null) {
throw new IllegalStateException(
"databaseTester is null; must configure or set it first");
@@ -303,47 +303,52 @@
IDatabaseConnection connection = databaseTester.getConnection();
- int count = tableDefs.length;
- LOG.info("verifyData: about to verify {} tables", new Integer(count));
- if (count == 0) {
- LOG.warn("No tables to verify;"
- + " no VerifyTableDefinitions specified");
- }
+ try {
+ int count = tableDefs.length;
+ LOG.info("verifyData: about to verify {} tables",
+ new Integer(count));
+ if (count == 0) {
+ LOG.warn("No tables to verify;"
+ + " no VerifyTableDefinitions specified");
+ }
- for (int i = 0; i < count; i++) {
- VerifyTableDefinition td = tableDefs[i];
- String[] excludeColumns = td.getColumnExclusionFilters();
- String[] includeColumns = td.getColumnInclusionFilters();
- String tableName = td.getTableName();
+ for (int i = 0; i < count; i++) {
+ VerifyTableDefinition td = tableDefs[i];
+ String[] excludeColumns = td.getColumnExclusionFilters();
+ String[] includeColumns = td.getColumnInclusionFilters();
+ String tableName = td.getTableName();
- LOG.info("Verifying table '{}'", tableName);
+ LOG.info("Verifying table '{}'", tableName);
- LOG.debug(" Loading its rows from expected dataset");
- ITable expectedTable = null;
- try {
- expectedTable = expectedDs.getTable(tableName);
- } catch (DataSetException e) {
- final String msg =
- "Problem obtaining table '" + tableName
- + "' from expected dataset";
- LOG.error(msg, e);
- throw new DataSetException(msg, e);
- }
+ LOG.debug(" Loading its rows from expected dataset");
+ ITable expectedTable = null;
+ try {
+ expectedTable = expectedDs.getTable(tableName);
+ } catch (DataSetException e) {
+ final String msg =
+ "Problem obtaining table '" + tableName
+ + "' from expected dataset";
+ LOG.error(msg, e);
+ throw new DataSetException(msg, e);
+ }
- LOG.debug(" Loading its rows from actual table");
- ITable actualTable = null;
- try {
- actualTable = connection.createTable(tableName);
- } catch (DataSetException e) {
- final String msg =
- "Problem obtaining table '" + tableName
- + "' from actual dataset";
- LOG.error(msg, e);
- throw new DataSetException(msg, e);
+ LOG.debug(" Loading its rows from actual table");
+ ITable actualTable = null;
+ try {
+ actualTable = connection.createTable(tableName);
+ } catch (DataSetException e) {
+ final String msg =
+ "Problem obtaining table '" + tableName
+ + "' from actual dataset";
+ LOG.error(msg, e);
+ throw new DataSetException(msg, e);
+ }
+
+ verifyData(expectedTable, actualTable, excludeColumns,
+ includeColumns);
}
-
- verifyData(expectedTable, actualTable, excludeColumns,
- includeColumns);
+ } finally {
+ connection.close();
}
}
@@ -365,7 +370,7 @@
* .
* @throws DatabaseUnitException
*/
- protected void verifyData(ITable expectedTable, ITable actualTable,
+ public void verifyData(ITable expectedTable, ITable actualTable,
String[] excludeColumns, String[] includeColumns)
throws DatabaseUnitException {
// Filter out the columns from the expected and actual results
@@ -398,7 +403,7 @@
* @throws DataSetException
* On dbUnit errors.
*/
- protected IDataSet makeCompositeDataSet(String[] dataFiles)
+ public IDataSet makeCompositeDataSet(String[] dataFiles)
throws DataSetException {
if (dataFileLoader == null) {
throw new IllegalStateException(
@@ -436,7 +441,7 @@
* @return The filtered table.
* @throws DataSetException
*/
- protected ITable applyColumnFilters(ITable table, String[] excludeColumns,
+ public ITable applyColumnFilters(ITable table, String[] excludeColumns,
String[] includeColumns) throws DataSetException {
ITable filteredTable = table;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jb...@us...> - 2010-03-21 21:18:11
|
Revision: 1178
http://dbunit.svn.sourceforge.net/dbunit/?rev=1178&view=rev
Author: jbhurst
Date: 2010-03-21 21:18:04 +0000 (Sun, 21 Mar 2010)
Log Message:
-----------
Corrected test to run under Java 6 update 17 (see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6898593)
Modified Paths:
--------------
trunk/dbunit/src/test/java/org/dbunit/dataset/datatype/DateDataTypeTest.java
Modified: trunk/dbunit/src/test/java/org/dbunit/dataset/datatype/DateDataTypeTest.java
===================================================================
--- trunk/dbunit/src/test/java/org/dbunit/dataset/datatype/DateDataTypeTest.java 2010-03-04 23:50:38 UTC (rev 1177)
+++ trunk/dbunit/src/test/java/org/dbunit/dataset/datatype/DateDataTypeTest.java 2010-03-21 21:18:04 UTC (rev 1178)
@@ -204,7 +204,7 @@
Object[] less = {
null,
new java.sql.Date(0),
- "1974-23-06"
+ "1974-06-23"
};
Object[] greater = {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jef...@us...> - 2010-03-04 23:50:44
|
Revision: 1177
http://dbunit.svn.sourceforge.net/dbunit/?rev=1177&view=rev
Author: jeffjensen
Date: 2010-03-04 23:50:38 +0000 (Thu, 04 Mar 2010)
Log Message:
-----------
Automatically run maven-gpg-plugin to sign artifacts during release:perform.
Modified Paths:
--------------
trunk/dbunit/pom.xml
Modified: trunk/dbunit/pom.xml
===================================================================
--- trunk/dbunit/pom.xml 2010-02-21 18:49:40 UTC (rev 1176)
+++ trunk/dbunit/pom.xml 2010-03-04 23:50:38 UTC (rev 1177)
@@ -975,6 +975,32 @@
</dependency>
</dependencies>
</profile>
+ <profile>
+ <id>release-sign-artifacts</id>
+ <activation>
+ <property>
+ <name>performRelease</name>
+ <value>true</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>sign-artifacts</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jef...@us...> - 2010-02-21 18:49:47
|
Revision: 1176
http://dbunit.svn.sourceforge.net/dbunit/?rev=1176&view=rev
Author: jeffjensen
Date: 2010-02-21 18:49:40 +0000 (Sun, 21 Feb 2010)
Log Message:
-----------
Remove use of commons-lang and ToStringBuilder. Add custom toString()s.
Modified Paths:
--------------
trunk/dbunit/pom.xml
trunk/dbunit/src/main/java/org/dbunit/dataset/AbstractTable.java
trunk/dbunit/src/main/java/org/dbunit/dataset/CompositeTable.java
trunk/dbunit/src/main/java/org/dbunit/dataset/SortedTable.java
Modified: trunk/dbunit/pom.xml
===================================================================
--- trunk/dbunit/pom.xml 2010-02-21 17:36:55 UTC (rev 1175)
+++ trunk/dbunit/pom.xml 2010-02-21 18:49:40 UTC (rev 1176)
@@ -271,11 +271,6 @@
<version>3.2.1</version>
</dependency>
<dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.4</version>
- </dependency>
- <dependency>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
<version>1.5.4</version>
Modified: trunk/dbunit/src/main/java/org/dbunit/dataset/AbstractTable.java
===================================================================
--- trunk/dbunit/src/main/java/org/dbunit/dataset/AbstractTable.java 2010-02-21 17:36:55 UTC (rev 1175)
+++ trunk/dbunit/src/main/java/org/dbunit/dataset/AbstractTable.java 2010-02-21 18:49:40 UTC (rev 1176)
@@ -20,7 +20,6 @@
*/
package org.dbunit.dataset;
-import org.apache.commons.lang.builder.ToStringBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -78,11 +77,4 @@
ITableMetaData metaData = getTableMetaData();
return metaData.getColumnIndex(columnName);
}
-
- /**
- * {@inheritDoc}
- */
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
}
Modified: trunk/dbunit/src/main/java/org/dbunit/dataset/CompositeTable.java
===================================================================
--- trunk/dbunit/src/main/java/org/dbunit/dataset/CompositeTable.java 2010-02-21 17:36:55 UTC (rev 1175)
+++ trunk/dbunit/src/main/java/org/dbunit/dataset/CompositeTable.java 2010-02-21 18:49:40 UTC (rev 1176)
@@ -21,6 +21,8 @@
package org.dbunit.dataset;
+import java.util.Arrays;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -29,13 +31,13 @@
* @version $Revision$
* @since Feb 17, 2002
*/
-public class CompositeTable extends AbstractTable
-{
+public class CompositeTable extends AbstractTable {
/**
* Logger for this class
*/
- private static final Logger logger = LoggerFactory.getLogger(CompositeTable.class);
+ private static final Logger logger =
+ LoggerFactory.getLogger(CompositeTable.class);
private final ITableMetaData _metaData;
private final ITable[] _tables;
@@ -44,18 +46,16 @@
* Creates a composite table that combines the specified metadata with the
* specified table.
*/
- public CompositeTable(ITableMetaData metaData, ITable table)
- {
+ public CompositeTable(ITableMetaData metaData, ITable table) {
_metaData = metaData;
- _tables = new ITable[]{table};
+ _tables = new ITable[] {table};
}
/**
* Creates a composite table that combines the specified metadata with the
* specified tables.
*/
- public CompositeTable(ITableMetaData metaData, ITable[] tables)
- {
+ public CompositeTable(ITableMetaData metaData, ITable[] tables) {
_metaData = metaData;
_tables = tables;
}
@@ -64,40 +64,35 @@
* Creates a composite table that combines the specified specified tables.
* The metadata from the first table is used as metadata for the new table.
*/
- public CompositeTable(ITable table1, ITable table2)
- {
+ public CompositeTable(ITable table1, ITable table2) {
_metaData = table1.getTableMetaData();
- _tables = new ITable[]{table1, table2};
+ _tables = new ITable[] {table1, table2};
}
/**
- * Creates a composite dataset that encapsulate the specified table with
- * a new name.
+ * Creates a composite dataset that encapsulate the specified table with a
+ * new name.
*/
- public CompositeTable(String newName, ITable table)
- throws DataSetException
- {
+ public CompositeTable(String newName, ITable table) throws DataSetException {
ITableMetaData metaData = table.getTableMetaData();
- _metaData = new DefaultTableMetaData(newName,
- metaData.getColumns(), metaData.getPrimaryKeys());
- _tables = new ITable[]{table};
+ _metaData =
+ new DefaultTableMetaData(newName, metaData.getColumns(),
+ metaData.getPrimaryKeys());
+ _tables = new ITable[] {table};
}
- ////////////////////////////////////////////////////////////////////////////
+ // //////////////////////////////////////////////////////////////////////////
// ITable interface
- public ITableMetaData getTableMetaData()
- {
+ public ITableMetaData getTableMetaData() {
return _metaData;
}
- public int getRowCount()
- {
+ public int getRowCount() {
logger.debug("getRowCount() - start");
int totalCount = 0;
- for (int i = 0; i < _tables.length; i++)
- {
+ for (int i = 0; i < _tables.length; i++) {
ITable table = _tables[i];
totalCount += table.getRowCount();
}
@@ -105,24 +100,22 @@
return totalCount;
}
- public Object getValue(int row, String columnName) throws DataSetException
- {
- if(logger.isDebugEnabled())
- logger.debug("getValue(row={}, columnName={}) - start", Integer.toString(row), columnName);
+ public Object getValue(int row, String columnName) throws DataSetException {
+ if (logger.isDebugEnabled()) {
+ logger.debug("getValue(row={}, columnName={}) - start", Integer
+ .toString(row), columnName);
+ }
- if (row < 0)
- {
+ if (row < 0) {
throw new RowOutOfBoundsException(row + " < 0 ");
}
int totalCount = 0;
- for (int i = 0; i < _tables.length; i++)
- {
+ for (int i = 0; i < _tables.length; i++) {
ITable table = _tables[i];
int count = table.getRowCount();
- if (totalCount + count > row)
- {
+ if (totalCount + count > row) {
return table.getValue(row - totalCount, columnName);
}
totalCount += count;
@@ -130,4 +123,18 @@
throw new RowOutOfBoundsException(row + " > " + totalCount);
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public String toString() {
+ StringBuilder sb = new StringBuilder(2000);
+
+ sb.append(getClass().getName()).append("[");
+ sb.append("_metaData=[").append(_metaData).append("], ");
+ sb.append("_tables=[").append(Arrays.toString(_tables)).append("]");
+ sb.append("]");
+
+ return sb.toString();
+ }
}
Modified: trunk/dbunit/src/main/java/org/dbunit/dataset/SortedTable.java
===================================================================
--- trunk/dbunit/src/main/java/org/dbunit/dataset/SortedTable.java 2010-02-21 17:36:55 UTC (rev 1175)
+++ trunk/dbunit/src/main/java/org/dbunit/dataset/SortedTable.java 2010-02-21 18:49:40 UTC (rev 1176)
@@ -32,25 +32,27 @@
/**
* This is a ITable decorator that provide a sorted view of the decorated table.
- * This implementation does not keep a separate copy of the decorated table data.
- *
+ * This implementation does not keep a separate copy of the decorated table
+ * data.
+ *
* @author Manuel Laflamme
* @author Last changed by: $Author$
- * @version $Revision$ $Date$
+ * @version $Revision$ $Date: 2009-05-01 02:56:07 -0500 (Fri, 01 May 2009)
+ * $
* @since Feb 19, 2003
*/
-public class SortedTable extends AbstractTable
-{
+public class SortedTable extends AbstractTable {
/**
* Logger for this class
*/
- private static final Logger logger = LoggerFactory.getLogger(SortedTable.class);
+ private static final Logger logger =
+ LoggerFactory.getLogger(SortedTable.class);
private final ITable _table;
private final Column[] _columns;
private Integer[] _indexes;
-
+
/**
* The row comparator which is used for sorting
*/
@@ -58,348 +60,365 @@
/**
* Sort the decorated table by specified columns order.
- * @param table decorated table
- * @param columns columns to be used for sorting
+ *
+ * @param table
+ * decorated table
+ * @param columns
+ * columns to be used for sorting
* @throws DataSetException
*/
- public SortedTable(ITable table, Column[] columns) throws DataSetException
- {
+ public SortedTable(ITable table, Column[] columns) throws DataSetException {
_table = table;
_columns = validateAndResolveColumns(columns);
initialize();
}
- /**
+ /**
* Sort the decorated table by specified columns order.
- * @param table decorated table
- * @param columnNames names of columns to be used for sorting
+ *
+ * @param table
+ * decorated table
+ * @param columnNames
+ * names of columns to be used for sorting
* @throws DataSetException
*/
- public SortedTable(ITable table, String[] columnNames) throws DataSetException
- {
+ public SortedTable(ITable table, String[] columnNames)
+ throws DataSetException {
_table = table;
_columns = validateAndResolveColumns(columnNames);
initialize();
}
/**
- * Sort the decorated table by specified metadata columns order. All
- * metadata columns will be used.
- * @param table The decorated table
- * @param metaData The metadata used to retrieve all columns which in turn are used
- * for sorting the table
+ * Sort the decorated table by specified metadata columns order. All
+ * metadata columns will be used.
+ *
+ * @param table
+ * The decorated table
+ * @param metaData
+ * The metadata used to retrieve all columns which in turn are
+ * used for sorting the table
* @throws DataSetException
*/
- public SortedTable(ITable table, ITableMetaData metaData) throws DataSetException
- {
+ public SortedTable(ITable table, ITableMetaData metaData)
+ throws DataSetException {
this(table, metaData.getColumns());
}
/**
- * Sort the decorated table by its own columns order which is defined by {@link ITable#getTableMetaData()}.
- * All table columns will be used.
- * @param table The decorated table
+ * Sort the decorated table by its own columns order which is defined by
+ * {@link ITable#getTableMetaData()}. All table columns will be used.
+ *
+ * @param table
+ * The decorated table
* @throws DataSetException
*/
- public SortedTable(ITable table) throws DataSetException
- {
+ public SortedTable(ITable table) throws DataSetException {
this(table, table.getTableMetaData());
}
/**
- * Verifies that all given columns really exist in the
- * current table and returns the physical {@link Column} objects from the table.
+ * Verifies that all given columns really exist in the current table and
+ * returns the physical {@link Column} objects from the table.
+ *
* @param columns
* @return
* @throws DataSetException
*/
- private Column[] validateAndResolveColumns(Column[] columns) throws DataSetException
- {
+ private Column[] validateAndResolveColumns(Column[] columns)
+ throws DataSetException {
ITableMetaData tableMetaData = _table.getTableMetaData();
- Column[] resultColumns = Columns.findColumnsByName(columns, tableMetaData);
+ Column[] resultColumns =
+ Columns.findColumnsByName(columns, tableMetaData);
return resultColumns;
- }
+ }
/**
- * Verifies that all given columns really exist in the
- * current table and returns the physical {@link Column} objects from the table.
+ * Verifies that all given columns really exist in the current table and
+ * returns the physical {@link Column} objects from the table.
+ *
* @param columnNames
* @return
* @throws DataSetException
*/
- private Column[] validateAndResolveColumns(String[] columnNames) throws DataSetException
- {
+ private Column[] validateAndResolveColumns(String[] columnNames)
+ throws DataSetException {
ITableMetaData tableMetaData = _table.getTableMetaData();
- Column[] resultColumns = Columns.findColumnsByName(columnNames, tableMetaData);
+ Column[] resultColumns =
+ Columns.findColumnsByName(columnNames, tableMetaData);
return resultColumns;
}
- private void initialize()
- {
+ private void initialize() {
logger.debug("initialize() - start");
-
- // The default comparator is the one that sorts by string - for backwards compatibility
- this.rowComparator = new RowComparatorByString(this._table, this._columns);
- }
- /**
- * @return The columns that are used for sorting the table
- */
- public Column[] getSortColumns()
- {
- return this._columns;
- }
-
- private int getOriginalRowIndex(int row) throws DataSetException
- {
- if(logger.isDebugEnabled())
- logger.debug("getOriginalRowIndex(row={}) - start", Integer.toString(row));
+ // The default comparator is the one that sorts by string - for
+ // backwards compatibility
+ this.rowComparator =
+ new RowComparatorByString(this._table, this._columns);
+ }
- if (_indexes == null)
- {
+ /**
+ * @return The columns that are used for sorting the table
+ */
+ public Column[] getSortColumns() {
+ return this._columns;
+ }
+
+ private int getOriginalRowIndex(int row) throws DataSetException {
+ if (logger.isDebugEnabled()) {
+ logger.debug("getOriginalRowIndex(row={}) - start", Integer
+ .toString(row));
+ }
+
+ if (_indexes == null) {
Integer[] indexes = new Integer[getRowCount()];
- for (int i = 0; i < indexes.length; i++)
- {
+ for (int i = 0; i < indexes.length; i++) {
indexes[i] = new Integer(i);
}
- try
- {
+ try {
Arrays.sort(indexes, rowComparator);
+ } catch (DatabaseUnitRuntimeException e) {
+ throw (DataSetException) e.getCause();
}
- catch (DatabaseUnitRuntimeException e)
- {
- throw (DataSetException)e.getCause();
- }
_indexes = indexes;
}
return _indexes[row].intValue();
}
-
+
/**
- * Whether or not the comparable interface should be used of the compared columns
- * instead of the plain strings
- * Default value is <code>false</code> for backwards compatibility
- * Set whether or not to use the Comparable implementation of the corresponding column
- * DataType for comparing values or not. Default value is <code>false</code>
- * which means that the old string comparison is used.
- * <br>
+ * Whether or not the comparable interface should be used of the compared
+ * columns instead of the plain strings Default value is <code>false</code>
+ * for backwards compatibility Set whether or not to use the Comparable
+ * implementation of the corresponding column DataType for comparing values
+ * or not. Default value is <code>false</code> which means that the old
+ * string comparison is used. <br>
+ *
* @param useComparable
- * @since 2.3.0
+ * @since 2.3.0
*/
- public void setUseComparable(boolean useComparable)
- {
- if(logger.isDebugEnabled())
- logger.debug("setUseComparable(useComparable={}) - start", Boolean.valueOf(useComparable));
-
- if(useComparable)
- {
- setRowComparator(new RowComparator(this._table, this._columns));
- }
- else
- {
- setRowComparator(new RowComparatorByString(this._table, this._columns));
- }
+ public void setUseComparable(boolean useComparable) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("setUseComparable(useComparable={}) - start", Boolean
+ .valueOf(useComparable));
+ }
+
+ if (useComparable) {
+ setRowComparator(new RowComparator(this._table, this._columns));
+ } else {
+ setRowComparator(new RowComparatorByString(this._table,
+ this._columns));
+ }
}
-
/**
* Sets the comparator to be used for sorting the table rows.
- * @param comparator that sorts the table rows
+ *
+ * @param comparator
+ * that sorts the table rows
* @since 2.4.2
*/
- public void setRowComparator(Comparator comparator)
- {
- if(logger.isDebugEnabled())
+ public void setRowComparator(Comparator comparator) {
+ if (logger.isDebugEnabled()) {
logger.debug("setRowComparator(comparator={}) - start", comparator);
-
- if(_indexes != null)
- {
- // TODO this is an ugly design to avoid increasing the number of constructors from 4 to 8. To be discussed how to implement it the best way.
- throw new IllegalStateException("Do not use this method after the table has been used (i.e. #getValue() has been called). " +
- "Please invoke this method immediately after the intialization of this object.");
}
+ if (_indexes != null) {
+ // TODO this is an ugly design to avoid increasing the number of
+ // constructors from 4 to 8. To be discussed how to implement it the
+ // best way.
+ throw new IllegalStateException(
+ "Do not use this method after the table has been used (i.e. #getValue() has been called). "
+ + "Please invoke this method immediately after the intialization of this object.");
+ }
+
this.rowComparator = comparator;
}
- ////////////////////////////////////////////////////////////////////////////
+ // //////////////////////////////////////////////////////////////////////////
// ITable interface
- public ITableMetaData getTableMetaData()
- {
+ public ITableMetaData getTableMetaData() {
logger.debug("getTableMetaData() - start");
return _table.getTableMetaData();
}
- public int getRowCount()
- {
+ public int getRowCount() {
logger.debug("getRowCount() - start");
return _table.getRowCount();
}
- public Object getValue(int row, String columnName) throws DataSetException
- {
- if(logger.isDebugEnabled())
- logger.debug("getValue(row={}, columnName={}) - start", Integer.toString(row), columnName);
+ public Object getValue(int row, String columnName) throws DataSetException {
+ if (logger.isDebugEnabled()) {
+ logger.debug("getValue(row={}, columnName={}) - start", Integer
+ .toString(row), columnName);
+ }
assertValidRowIndex(row);
return _table.getValue(getOriginalRowIndex(row), columnName);
}
- ////////////////////////////////////////////////////////////////////////////
+ // //////////////////////////////////////////////////////////////////////////
// Comparator interface
/**
- * Abstract class for sorting the table rows of a given table in a specific order
+ * Abstract class for sorting the table rows of a given table in a specific
+ * order
*/
- public static abstract class AbstractRowComparator implements Comparator
- {
+ public static abstract class AbstractRowComparator implements Comparator {
/**
* Logger for this class
*/
- private final Logger logger = LoggerFactory.getLogger(AbstractRowComparator.class);
- private ITable _table;
- private Column[] _sortColumns;
+ private final Logger logger =
+ LoggerFactory.getLogger(AbstractRowComparator.class);
+ private final ITable _table;
+ private final Column[] _sortColumns;
- /**
- * @param table The wrapped table to be sorted
- * @param sortColumns The columns to be used for sorting in the given order
- */
- public AbstractRowComparator(ITable table, Column[] sortColumns)
- {
- this._table = table;
- this._sortColumns = sortColumns;
- }
+ /**
+ * @param table
+ * The wrapped table to be sorted
+ * @param sortColumns
+ * The columns to be used for sorting in the given order
+ */
+ public AbstractRowComparator(ITable table, Column[] sortColumns) {
+ this._table = table;
+ this._sortColumns = sortColumns;
+ }
- public int compare(Object o1, Object o2)
- {
+ public int compare(Object o1, Object o2) {
logger.debug("compare(o1={}, o2={}) - start", o1, o2);
- Integer i1 = (Integer)o1;
- Integer i2 = (Integer)o2;
+ Integer i1 = (Integer) o1;
+ Integer i2 = (Integer) o2;
- try
- {
- for (int i = 0; i < _sortColumns.length; i++)
- {
+ try {
+ for (int i = 0; i < _sortColumns.length; i++) {
String columnName = _sortColumns[i].getColumnName();
-
+
Object value1 = _table.getValue(i1.intValue(), columnName);
Object value2 = _table.getValue(i2.intValue(), columnName);
- if (value1 == null && value2 == null)
- {
+ if (value1 == null && value2 == null) {
continue;
}
- if (value1 == null && value2 != null)
- {
+ if (value1 == null && value2 != null) {
return -1;
}
- if (value1 != null && value2 == null)
- {
+ if (value1 != null && value2 == null) {
return 1;
}
// Compare the two values with each other for sorting
int result = compare(_sortColumns[i], value1, value2);
-
- if (result != 0)
- {
+
+ if (result != 0) {
return result;
}
}
- }
- catch (DataSetException e)
- {
+ } catch (DataSetException e) {
throw new DatabaseUnitRuntimeException(e);
}
return 0;
}
- /**
- * @param column The column to be compared
- * @param value1 The first value of the given column
- * @param value2 The second value of the given column
- * @return 0 if both values are considered equal.
- * @throws TypeCastException
- */
- protected abstract int compare(Column column, Object value1, Object value2) throws TypeCastException;
+ /**
+ * @param column
+ * The column to be compared
+ * @param value1
+ * The first value of the given column
+ * @param value2
+ * The second value of the given column
+ * @return 0 if both values are considered equal.
+ * @throws TypeCastException
+ */
+ protected abstract int compare(Column column, Object value1,
+ Object value2) throws TypeCastException;
}
-
-
+
/**
- * Compares the rows with each other in order to sort them in the correct order using the
- * data type and the Comparable implementation the current column has.
+ * Compares the rows with each other in order to sort them in the correct
+ * order using the data type and the Comparable implementation the current
+ * column has.
*/
- protected static class RowComparator extends AbstractRowComparator
- {
+ protected static class RowComparator extends AbstractRowComparator {
/**
* Logger for this class
*/
- private final Logger logger = LoggerFactory.getLogger(RowComparator.class);
+ private final Logger logger =
+ LoggerFactory.getLogger(RowComparator.class);
- public RowComparator(ITable table, Column[] sortColumns)
- {
- super(table, sortColumns);
- }
+ public RowComparator(ITable table, Column[] sortColumns) {
+ super(table, sortColumns);
+ }
- protected int compare(Column column, Object value1, Object value2) throws TypeCastException
- {
- if(logger.isDebugEnabled())
- logger.debug("compare(column={}, value1={}, value2={}) - start",
- new Object[]{column, value1, value2} );
-
- DataType dataType = column.getDataType();
- int result = dataType.compare(value1, value2);
- return result;
- }
-
+ protected int compare(Column column, Object value1, Object value2)
+ throws TypeCastException {
+ if (logger.isDebugEnabled()) {
+ logger.debug(
+ "compare(column={}, value1={}, value2={}) - start",
+ new Object[] {column, value1, value2});
+ }
+
+ DataType dataType = column.getDataType();
+ int result = dataType.compare(value1, value2);
+ return result;
+ }
+
}
-
-
+
/**
- * Compares the rows with each other in order to sort them in the correct order using
- * the string value of both values for the comparison.
+ * Compares the rows with each other in order to sort them in the correct
+ * order using the string value of both values for the comparison.
*/
- protected static class RowComparatorByString extends AbstractRowComparator
- {
+ protected static class RowComparatorByString extends AbstractRowComparator {
/**
* Logger for this class
*/
- private final Logger logger = LoggerFactory.getLogger(RowComparatorByString.class);
+ private final Logger logger =
+ LoggerFactory.getLogger(RowComparatorByString.class);
- public RowComparatorByString(ITable table, Column[] sortColumns)
- {
- super(table, sortColumns);
- }
+ public RowComparatorByString(ITable table, Column[] sortColumns) {
+ super(table, sortColumns);
+ }
- protected int compare(Column column, Object value1, Object value2) throws TypeCastException
- {
- if(logger.isDebugEnabled())
- logger.debug("compare(column={}, value1={}, value2={}) - start",
- new Object[]{column, value1, value2} );
+ protected int compare(Column column, Object value1, Object value2)
+ throws TypeCastException {
+ if (logger.isDebugEnabled()) {
+ logger.debug(
+ "compare(column={}, value1={}, value2={}) - start",
+ new Object[] {column, value1, value2});
+ }
// Default behavior since ever
- String stringValue1 = DataType.asString(value1);
- String stringValue2 = DataType.asString(value2);
- int result = stringValue1.compareTo(stringValue2);
- return result;
- }
+ String stringValue1 = DataType.asString(value1);
+ String stringValue2 = DataType.asString(value2);
+ int result = stringValue1.compareTo(stringValue2);
+ return result;
+ }
}
-
-}
+ /**
+ * {@inheritDoc}
+ */
+ public String toString() {
+ StringBuilder sb = new StringBuilder(2000);
+ sb.append(getClass().getName()).append("[");
+ sb.append("_columns=[").append(Arrays.toString(_columns)).append("], ");
+ sb.append("_indexes=[").append(_indexes).append("], ");
+ sb.append("_table=[").append(_table).append("]");
+ sb.append("]");
-
-
+ return sb.toString();
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jef...@us...> - 2010-02-21 17:37:02
|
Revision: 1175
http://dbunit.svn.sourceforge.net/dbunit/?rev=1175&view=rev
Author: jeffjensen
Date: 2010-02-21 17:36:55 +0000 (Sun, 21 Feb 2010)
Log Message:
-----------
Correct implementation for default toString(). Add class to easily display toString() results.
Modified Paths:
--------------
trunk/dbunit/src/main/java/org/dbunit/dataset/AbstractTable.java
Added Paths:
-----------
trunk/dbunit/src/test/java/org/dbunit/dataset/ToStringViewTest.java
Modified: trunk/dbunit/src/main/java/org/dbunit/dataset/AbstractTable.java
===================================================================
--- trunk/dbunit/src/main/java/org/dbunit/dataset/AbstractTable.java 2010-02-21 06:15:42 UTC (rev 1174)
+++ trunk/dbunit/src/main/java/org/dbunit/dataset/AbstractTable.java 2010-02-21 17:36:55 UTC (rev 1175)
@@ -83,7 +83,6 @@
* {@inheritDoc}
*/
public String toString() {
- ToStringBuilder.reflectionToString(this);
- return super.toString();
+ return ToStringBuilder.reflectionToString(this);
}
}
Added: trunk/dbunit/src/test/java/org/dbunit/dataset/ToStringViewTest.java
===================================================================
--- trunk/dbunit/src/test/java/org/dbunit/dataset/ToStringViewTest.java (rev 0)
+++ trunk/dbunit/src/test/java/org/dbunit/dataset/ToStringViewTest.java 2010-02-21 17:36:55 UTC (rev 1175)
@@ -0,0 +1,77 @@
+package org.dbunit.dataset;
+
+import junit.framework.TestCase;
+
+import org.dbunit.database.CachedResultSetTable;
+import org.dbunit.database.ForwardOnlyResultSetTable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class only logs out the toString() results for review, does not test
+ * anything. Currently only ITables that subclass AbstractTable.
+ *
+ * @author Jeff Jensen jeffjensen AT users.sourceforge.net
+ * @author Last changed by: $Author$
+ * @version $Revision$ $Date$
+ * @since 2.4.8
+ */
+public class ToStringViewTest extends TestCase {
+ private final Logger LOG = LoggerFactory.getLogger(ToStringViewTest.class);
+
+ public void testForwardOnlyResultSetTable() {
+ // TODO existing test is an IT
+ ForwardOnlyResultSetTable table = null;
+ LOG.info("ForwardOnlyResultSetTable.toString()={}", table);
+ }
+
+ public void testScrollableResultSetTable() throws Exception {
+ // TODO existing test is an IT
+ // ScrollableResultSetTableTest test =
+ // new ScrollableResultSetTableTest("the string");
+ ITable table = null; // test.createTable();
+ LOG.info("ScrollableResultSetTable.toString()={}", table);
+ }
+
+ public void testCompositeTable() throws Exception {
+ CompositeTableTest test = new CompositeTableTest("the string");
+ ITable table = test.createTable();
+ LOG.info("CompositeTable.toString()={}", table);
+ }
+
+ public void testDefaultTable() throws Exception {
+ DefaultTableTest test = new DefaultTableTest("the string");
+ ITable table = test.createTable();
+ LOG.info("DefaultTable.toString()={}", table);
+ }
+
+ public void testCachedTable() {
+ // TODO no existing test to use
+ CachedTable table = null;
+ LOG.info("CachedTable.toString()={}", table);
+ }
+
+ public void testCachedResultSetTable() {
+ // TODO existing test is an IT
+ CachedResultSetTable table = null;
+ LOG.info("CachedResultSetTable.toString()={}", table);
+ }
+
+ public void testSortedTable() throws Exception {
+ SortedTableTest test = new SortedTableTest("the string");
+ ITable table = test.createTable();
+ LOG.info("SortedTable.toString()={}", table);
+ }
+
+ public void testStreamingTable() {
+ // StreamingTable is not a public class
+ // StreamingTable table = null;
+ // LOG.info("StreamingTable.toString()={}", table);
+ }
+
+ public void testXlsTable() {
+ // XlsTable is not a public class
+ // XlsTable table = null;
+ // LOG.info("XlsTable.toString()={}", table);
+ }
+}
Property changes on: trunk/dbunit/src/test/java/org/dbunit/dataset/ToStringViewTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jef...@us...> - 2010-02-21 06:15:48
|
Revision: 1174
http://dbunit.svn.sourceforge.net/dbunit/?rev=1174&view=rev
Author: jeffjensen
Date: 2010-02-21 06:15:42 +0000 (Sun, 21 Feb 2010)
Log Message:
-----------
Add reflective toString() method to AbstractTable so all subclasses have detailed output in log statements.
Modified Paths:
--------------
trunk/dbunit/pom.xml
trunk/dbunit/src/changes/changes.xml
trunk/dbunit/src/main/java/org/dbunit/dataset/AbstractTable.java
Modified: trunk/dbunit/pom.xml
===================================================================
--- trunk/dbunit/pom.xml 2010-02-20 19:53:04 UTC (rev 1173)
+++ trunk/dbunit/pom.xml 2010-02-21 06:15:42 UTC (rev 1174)
@@ -271,6 +271,11 @@
<version>3.2.1</version>
</dependency>
<dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.4</version>
+ </dependency>
+ <dependency>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
<version>1.5.4</version>
Modified: trunk/dbunit/src/changes/changes.xml
===================================================================
--- trunk/dbunit/src/changes/changes.xml 2010-02-20 19:53:04 UTC (rev 1173)
+++ trunk/dbunit/src/changes/changes.xml 2010-02-21 06:15:42 UTC (rev 1174)
@@ -17,6 +17,7 @@
<action dev="jbhurst" type="add" issue="2919427" due-to="dbamberghi (Daniele Bamberghi)">OracleDataTypeFactory recognises "SYS.XMLTYPE"</action>
<action dev="jeffjensen" type="add" issue="2938029" due-to="jeffjensen">Add "file loader" utility for various data file types</action>
<action dev="jeffjensen" type="add" due-to="jeffjensen">Add new TestCase that supports prepare and expected datasets: "DefaultPrepAndExpectedTestCase"</action>
+ <action dev="jeffjensen" type="add" due-to="jeffjensen">Add reflective toString() method to AbstractTable so all subclasses have detailed output in log statements.</action>
</release>
<release version="2.4.7" date="Nov 09, 2009" description="Bugfixes and some non breaking refactoring">
<action dev="gommma" type="fix" issue="2685615" due-to="lumpynose">dtd for XmlDataSet</action>
Modified: trunk/dbunit/src/main/java/org/dbunit/dataset/AbstractTable.java
===================================================================
--- trunk/dbunit/src/main/java/org/dbunit/dataset/AbstractTable.java 2010-02-20 19:53:04 UTC (rev 1173)
+++ trunk/dbunit/src/main/java/org/dbunit/dataset/AbstractTable.java 2010-02-21 06:15:42 UTC (rev 1174)
@@ -20,63 +20,70 @@
*/
package org.dbunit.dataset;
+import org.apache.commons.lang.builder.ToStringBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
/**
* @author Manuel Laflamme
* @version $Revision$
* @since Feb 17, 2002
*/
-public abstract class AbstractTable implements ITable
-{
+public abstract class AbstractTable implements ITable {
/**
* Logger for this class
*/
- private static final Logger logger = LoggerFactory.getLogger(AbstractTable.class);
+ private static final Logger logger =
+ LoggerFactory.getLogger(AbstractTable.class);
- protected void assertValidRowIndex(int row) throws DataSetException
- {
- if(logger.isDebugEnabled())
- logger.debug("assertValidRowIndex(row={}) - start", Integer.toString(row));
+ protected void assertValidRowIndex(int row) throws DataSetException {
+ if (logger.isDebugEnabled()) {
+ logger.debug("assertValidRowIndex(row={}) - start", Integer
+ .toString(row));
+ }
assertValidRowIndex(row, getRowCount());
}
protected void assertValidRowIndex(int row, int rowCount)
- throws DataSetException
- {
- if(logger.isDebugEnabled())
- logger.debug("assertValidRowIndex(row={}, rowCount={}) - start",
- Integer.toString(row), Integer.toString(rowCount));
+ throws DataSetException {
+ if (logger.isDebugEnabled()) {
+ logger.debug("assertValidRowIndex(row={}, rowCount={}) - start",
+ Integer.toString(row), Integer.toString(rowCount));
+ }
- if (row < 0)
- {
+ if (row < 0) {
throw new RowOutOfBoundsException(row + " < 0");
}
- if (row >= rowCount)
- {
+ if (row >= rowCount) {
throw new RowOutOfBoundsException(row + " >= " + rowCount);
}
}
- protected void assertValidColumn(String columnName) throws DataSetException
- {
- logger.debug("assertValidColumn(columnName={}) - start", columnName);
+ protected void assertValidColumn(String columnName) throws DataSetException {
+ logger.debug("assertValidColumn(columnName={}) - start", columnName);
ITableMetaData metaData = getTableMetaData();
- // Try to find the column in the metadata - if it cannot be found an exception is thrown
- Columns.getColumnValidated(columnName, metaData.getColumns(), metaData.getTableName());
+ // Try to find the column in the metadata - if it cannot be found an
+ // exception is thrown
+ Columns.getColumnValidated(columnName, metaData.getColumns(), metaData
+ .getTableName());
}
- protected int getColumnIndex(String columnName) throws DataSetException
- {
+ protected int getColumnIndex(String columnName) throws DataSetException {
logger.debug("getColumnIndex(columnName={}) - start", columnName);
ITableMetaData metaData = getTableMetaData();
return metaData.getColumnIndex(columnName);
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public String toString() {
+ ToStringBuilder.reflectionToString(this);
+ return super.toString();
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jef...@us...> - 2010-02-20 19:53:10
|
Revision: 1173
http://dbunit.svn.sourceforge.net/dbunit/?rev=1173&view=rev
Author: jeffjensen
Date: 2010-02-20 19:53:04 +0000 (Sat, 20 Feb 2010)
Log Message:
-----------
Add DefaultPrepAndExpectedTestCase change.
Modified Paths:
--------------
trunk/dbunit/src/changes/changes.xml
Modified: trunk/dbunit/src/changes/changes.xml
===================================================================
--- trunk/dbunit/src/changes/changes.xml 2010-02-20 03:36:43 UTC (rev 1172)
+++ trunk/dbunit/src/changes/changes.xml 2010-02-20 19:53:04 UTC (rev 1173)
@@ -16,6 +16,7 @@
<action dev="jbhurst" type="add" issue="2921131" due-to="vlamp">Add timezone support for timestamp data type</action>
<action dev="jbhurst" type="add" issue="2919427" due-to="dbamberghi (Daniele Bamberghi)">OracleDataTypeFactory recognises "SYS.XMLTYPE"</action>
<action dev="jeffjensen" type="add" issue="2938029" due-to="jeffjensen">Add "file loader" utility for various data file types</action>
+ <action dev="jeffjensen" type="add" due-to="jeffjensen">Add new TestCase that supports prepare and expected datasets: "DefaultPrepAndExpectedTestCase"</action>
</release>
<release version="2.4.7" date="Nov 09, 2009" description="Bugfixes and some non breaking refactoring">
<action dev="gommma" type="fix" issue="2685615" due-to="lumpynose">dtd for XmlDataSet</action>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jef...@us...> - 2010-02-20 03:36:49
|
Revision: 1172
http://dbunit.svn.sourceforge.net/dbunit/?rev=1172&view=rev
Author: jeffjensen
Date: 2010-02-20 03:36:43 +0000 (Sat, 20 Feb 2010)
Log Message:
-----------
Set output encodings to make cross platform. Use default dir for javadoc gen.
Modified Paths:
--------------
trunk/dbunit/pom.xml
Modified: trunk/dbunit/pom.xml
===================================================================
--- trunk/dbunit/pom.xml 2010-02-19 23:04:12 UTC (rev 1171)
+++ trunk/dbunit/pom.xml 2010-02-20 03:36:43 UTC (rev 1172)
@@ -24,6 +24,12 @@
<checkstyle.excludes>org/dbunit/util/concurrent/*.java</checkstyle.excludes>
<logbackVersion>0.9.15</logbackVersion>
<slf4jVersion>1.5.6</slf4jVersion>
+ <project.build.sourceEncoding>
+ UTF-8
+ </project.build.sourceEncoding>
+ <project.reporting.outputEncoding>
+ UTF-8
+ </project.reporting.outputEncoding>
</properties>
<scm>
@@ -615,7 +621,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
- <destDir>apidocs</destDir>
<quiet>true</quiet>
<stylesheet>maven</stylesheet>
<tags>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jef...@us...> - 2010-02-19 23:04:24
|
Revision: 1171
http://dbunit.svn.sourceforge.net/dbunit/?rev=1171&view=rev
Author: jeffjensen
Date: 2010-02-19 23:04:12 +0000 (Fri, 19 Feb 2010)
Log Message:
-----------
Support use case of having null exclude and include columns to mean "ignore", enabling empty include array to mean include no columns.
Modified Paths:
--------------
trunk/dbunit/src/main/java/org/dbunit/DefaultPrepAndExpectedTestCase.java
trunk/dbunit/src/main/java/org/dbunit/VerifyTableDefinition.java
trunk/dbunit/src/test/java/org/dbunit/DefaultPrepAndExpectedTestCaseTest.java
Modified: trunk/dbunit/src/main/java/org/dbunit/DefaultPrepAndExpectedTestCase.java
===================================================================
--- trunk/dbunit/src/main/java/org/dbunit/DefaultPrepAndExpectedTestCase.java 2010-02-18 23:10:41 UTC (rev 1170)
+++ trunk/dbunit/src/main/java/org/dbunit/DefaultPrepAndExpectedTestCase.java 2010-02-19 23:04:12 UTC (rev 1171)
@@ -88,9 +88,9 @@
*
* @Test
* public void testExample() throws Exception {
- * String[] prepDataFiles = {};
- * String[] expectedDataFiles = {};
- * VerifyTableDefinition[] tables = {};
+ * String[] prepDataFiles = {}; // define prep files
+ * String[] expectedDataFiles = {}; // define expected files
+ * VerifyTableDefinition[] tables = {}; // define tables to verify
*
* tc.preTest(tables, prepDataFiles, expectedDataFiles);
*
@@ -112,9 +112,9 @@
* setDatabaseTester(databaseTester);
* setDataFileLoader(dataFileLoader);
*
- * String[] prepDataFiles = {};
- * String[] expectedDataFiles = {};
- * VerifyTableDefinition[] tables = {};
+ * String[] prepDataFiles = {}; //define prep files
+ * String[] expectedDataFiles = {}; // define expected files
+ * VerifyTableDefinition[] tables = {}; //define tables to verify
*
* preTest(tables, prepDataFiles, expectedDataFiles);
*
@@ -363,7 +363,7 @@
* The column names to only include in comparison. See
* {@link org.dbunit.dataset.filter.DefaultColumnFilter#includeColumn(String)}
* .
- * @throws DatabaseUnitException.
+ * @throws DatabaseUnitException
*/
protected void verifyData(ITable expectedTable, ITable actualTable,
String[] excludeColumns, String[] includeColumns)
@@ -429,9 +429,10 @@
* @param table
* The table to apply the filters to.
* @param excludeColumns
- * The exclude filters.
+ * The exclude filters; use null or empty array to mean exclude
+ * none.
* @param includeColumns
- * The include filters.
+ * The include filters; use null to mean include all.
* @return The filtered table.
* @throws DataSetException
*/
@@ -443,33 +444,28 @@
throw new IllegalArgumentException("table is null");
}
- if (excludeColumns == null) {
- throw new IllegalArgumentException("excludeColumns is null");
- }
-
- if (includeColumns == null) {
- throw new IllegalArgumentException("includeColumns is null");
- }
-
- // only apply the inclusion filters if the array is not empty,
- // as dbunit interprets an empty inclusion filter array as one
+ // note: dbunit interprets an empty inclusion filter array as one
// not wanting to compare anything!
- if (includeColumns.length > 0) {
- LOG.debug("applyColumnFilters: including columns={}",
+ if (includeColumns == null) {
+ LOG.debug("applyColumnFilters: including columns=(all)");
+ } else {
+ LOG.debug("applyColumnFilters: including columns='{}'",
new Object[] {includeColumns});
filteredTable =
DefaultColumnFilter.includedColumnsTable(filteredTable,
includeColumns);
+ }
+
+ if (excludeColumns == null || excludeColumns.length == 0) {
+ LOG.debug("applyColumnFilters: excluding columns=(none)");
} else {
- LOG.debug("applyColumnFilters: including columns=(all)");
+ LOG.debug("applyColumnFilters: excluding columns='{}'",
+ new Object[] {excludeColumns});
+ filteredTable =
+ DefaultColumnFilter.excludedColumnsTable(filteredTable,
+ excludeColumns);
}
- LOG.debug("applyColumnFilters: excluding columns={}",
- new Object[] {excludeColumns});
- filteredTable =
- DefaultColumnFilter.excludedColumnsTable(filteredTable,
- excludeColumns);
-
return filteredTable;
}
Modified: trunk/dbunit/src/main/java/org/dbunit/VerifyTableDefinition.java
===================================================================
--- trunk/dbunit/src/main/java/org/dbunit/VerifyTableDefinition.java 2010-02-18 23:10:41 UTC (rev 1170)
+++ trunk/dbunit/src/main/java/org/dbunit/VerifyTableDefinition.java 2010-02-19 23:04:12 UTC (rev 1171)
@@ -44,13 +44,13 @@
* include all columns).
*
* @param table
- * The name of the table.
+ * The name of the table - required.
* @param excludeColumns
* The columns in the table to ignore (filter out) in expected vs
- * actual comparisons.
+ * actual comparisons; null or empty array to exclude no columns.
*/
public VerifyTableDefinition(String table, String[] excludeColumns) {
- this(table, excludeColumns, new String[] {});
+ this(table, excludeColumns, null);
}
/**
@@ -60,10 +60,11 @@
* The name of the table.
* @param excludeColumns
* The columns in the table to ignore (filter out) in expected vs
- * actual comparisons.
+ * actual comparisons; null or empty array to exclude no columns.
* @param includeColumns
* The columns in the table to include in expected vs actual
- * comparisons.
+ * comparisons; null to include all columns, empty array to
+ * include no columns.
*/
public VerifyTableDefinition(String table, String[] excludeColumns,
String[] includeColumns) {
@@ -71,14 +72,6 @@
throw new IllegalArgumentException("table is null.");
}
- if (excludeColumns == null) {
- throw new IllegalArgumentException("excludeColumns is null.");
- }
-
- if (includeColumns == null) {
- throw new IllegalArgumentException("includeColumns is null.");
- }
-
tableName = table;
columnExclusionFilters = excludeColumns;
columnInclusionFilters = includeColumns;
Modified: trunk/dbunit/src/test/java/org/dbunit/DefaultPrepAndExpectedTestCaseTest.java
===================================================================
--- trunk/dbunit/src/test/java/org/dbunit/DefaultPrepAndExpectedTestCaseTest.java 2010-02-18 23:10:41 UTC (rev 1170)
+++ trunk/dbunit/src/test/java/org/dbunit/DefaultPrepAndExpectedTestCaseTest.java 2010-02-19 23:04:12 UTC (rev 1171)
@@ -2,7 +2,10 @@
import junit.framework.TestCase;
+import org.dbunit.dataset.DataSetException;
+import org.dbunit.dataset.DefaultTable;
import org.dbunit.dataset.IDataSet;
+import org.dbunit.dataset.ITable;
import org.dbunit.util.fileloader.DataFileLoader;
import org.dbunit.util.fileloader.FlatXmlDataFileLoader;
@@ -68,7 +71,19 @@
// TODO implement test
}
- public void testApplyColumnFilters() {
- // TODO implement test
+ // TODO implement test - doesn't test anything yet
+ public void testApplyColumnFiltersBothNull() throws DataSetException {
+ final ITable table = new DefaultTable("test_table");
+ final String[] excludeColumns = null;
+ final String[] includeColumns = null;
+ tc.applyColumnFilters(table, excludeColumns, includeColumns);
}
+
+ // TODO implement test - doesn't test anything yet
+ public void testApplyColumnFiltersBothNotNull() throws DataSetException {
+ final ITable table = new DefaultTable("test_table");
+ final String[] excludeColumns = {"COL1"};
+ final String[] includeColumns = {"COL2"};
+ tc.applyColumnFilters(table, excludeColumns, includeColumns);
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jef...@us...> - 2010-02-18 23:10:49
|
Revision: 1170
http://dbunit.svn.sourceforge.net/dbunit/?rev=1170&view=rev
Author: jeffjensen
Date: 2010-02-18 23:10:41 +0000 (Thu, 18 Feb 2010)
Log Message:
-----------
Add logged error message and wrap exception with specific error message easing troubleshooting.
Modified Paths:
--------------
trunk/dbunit/src/main/java/org/dbunit/DefaultPrepAndExpectedTestCase.java
Modified: trunk/dbunit/src/main/java/org/dbunit/DefaultPrepAndExpectedTestCase.java
===================================================================
--- trunk/dbunit/src/main/java/org/dbunit/DefaultPrepAndExpectedTestCase.java 2010-02-13 06:18:06 UTC (rev 1169)
+++ trunk/dbunit/src/main/java/org/dbunit/DefaultPrepAndExpectedTestCase.java 2010-02-18 23:10:41 UTC (rev 1170)
@@ -319,10 +319,28 @@
LOG.info("Verifying table '{}'", tableName);
LOG.debug(" Loading its rows from expected dataset");
- ITable expectedTable = expectedDs.getTable(tableName);
+ ITable expectedTable = null;
+ try {
+ expectedTable = expectedDs.getTable(tableName);
+ } catch (DataSetException e) {
+ final String msg =
+ "Problem obtaining table '" + tableName
+ + "' from expected dataset";
+ LOG.error(msg, e);
+ throw new DataSetException(msg, e);
+ }
LOG.debug(" Loading its rows from actual table");
- ITable actualTable = connection.createTable(tableName);
+ ITable actualTable = null;
+ try {
+ actualTable = connection.createTable(tableName);
+ } catch (DataSetException e) {
+ final String msg =
+ "Problem obtaining table '" + tableName
+ + "' from actual dataset";
+ LOG.error(msg, e);
+ throw new DataSetException(msg, e);
+ }
verifyData(expectedTable, actualTable, excludeColumns,
includeColumns);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jef...@us...> - 2010-02-13 06:18:18
|
Revision: 1169
http://dbunit.svn.sourceforge.net/dbunit/?rev=1169&view=rev
Author: jeffjensen
Date: 2010-02-13 06:18:06 +0000 (Sat, 13 Feb 2010)
Log Message:
-----------
Update docs some more.
Modified Paths:
--------------
trunk/dbunit/src/main/java/org/dbunit/DefaultPrepAndExpectedTestCase.java
Modified: trunk/dbunit/src/main/java/org/dbunit/DefaultPrepAndExpectedTestCase.java
===================================================================
--- trunk/dbunit/src/main/java/org/dbunit/DefaultPrepAndExpectedTestCase.java 2010-02-12 16:47:51 UTC (rev 1168)
+++ trunk/dbunit/src/main/java/org/dbunit/DefaultPrepAndExpectedTestCase.java 2010-02-13 06:18:06 UTC (rev 1169)
@@ -49,21 +49,30 @@
*
* <li>Extend it in a test class.</li>
* <p>
- * Obtain IDatabaseTester and DataFileLoader instances and set them accordingly
- * (possibly dependency injecting them into the test class).
+ * Obtain IDatabaseTester and DataFileLoader instances (possibly dependency
+ * injecting them into the test class) and set them accordingly, probably in a
+ * setup type of method, such as:
*
* <pre>
- * setDatabaseTester(databaseTester);
- * setDataFileLoader(dataFileLoader);
+ * @Before
+ * public void setDbunitTestDependencies() {
+ * setDatabaseTester(databaseTester);
+ * setDataFileLoader(dataFileLoader);
+ * }
* </pre>
*
* </p>
* </ol>
*
* To setup, execute, and clean up tests, call the configureTest(), preTest(),
- * and postTest() methods. Where the test case calls them depends on data needs:
+ * and postTest() methods. Note there is a preTest() convenience method that
+ * takes the same parameters as the configureTest() method; use it instead of
+ * using both configureTest() and preTest().
+ *
+ * Where the test case calls them depends on data needs:
* <ul>
- * <li>For the whole test case, i.e. in setUp() and tearDown().</li>
+ * <li>For the whole test case, i.e. in setUp() and tearDown() or @Before
+ * and @After.</li>
* <li>In each test method.</li>
* <li>Or some combination of both test case setup/teardown and test methods.</li>
* </ul>
@@ -83,14 +92,12 @@
* String[] expectedDataFiles = {};
* VerifyTableDefinition[] tables = {};
*
- * tc.configureTest(tables, prepDataFiles, expectedDataFiles);
- * tc.preTest();
+ * tc.preTest(tables, prepDataFiles, expectedDataFiles);
*
* // execute test
*
* tc.postTest();
* }
- *
* </pre>
*
* <h4>When all test methods share the same prep and/or expected data</h4>
@@ -109,8 +116,9 @@
* String[] expectedDataFiles = {};
* VerifyTableDefinition[] tables = {};
*
- * configureTest(tables, prepDataFiles, expectedDataFiles);
- * preTest();
+ * preTest(tables, prepDataFiles, expectedDataFiles);
+ *
+ * // call this if overriding setUp() and databaseTester & dataFileLoader are already set.
* super.setUp();
* }
*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jef...@us...> - 2010-02-12 16:47:59
|
Revision: 1168
http://dbunit.svn.sourceforge.net/dbunit/?rev=1168&view=rev
Author: jeffjensen
Date: 2010-02-12 16:47:51 +0000 (Fri, 12 Feb 2010)
Log Message:
-----------
Add convenience method for preTest().
Modified Paths:
--------------
trunk/dbunit/src/main/java/org/dbunit/DefaultPrepAndExpectedTestCase.java
trunk/dbunit/src/main/java/org/dbunit/PrepAndExpectedTestCase.java
Modified: trunk/dbunit/src/main/java/org/dbunit/DefaultPrepAndExpectedTestCase.java
===================================================================
--- trunk/dbunit/src/main/java/org/dbunit/DefaultPrepAndExpectedTestCase.java 2010-02-12 15:19:43 UTC (rev 1167)
+++ trunk/dbunit/src/main/java/org/dbunit/DefaultPrepAndExpectedTestCase.java 2010-02-12 16:47:51 UTC (rev 1168)
@@ -232,6 +232,15 @@
/**
* {@inheritDoc}
*/
+ public void preTest(VerifyTableDefinition[] tables, String[] prepDataFiles,
+ String[] expectedDataFiles) throws Exception {
+ configureTest(tables, prepDataFiles, expectedDataFiles);
+ preTest();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public void postTest() throws Exception {
try {
verifyData();
Modified: trunk/dbunit/src/main/java/org/dbunit/PrepAndExpectedTestCase.java
===================================================================
--- trunk/dbunit/src/main/java/org/dbunit/PrepAndExpectedTestCase.java 2010-02-12 15:19:43 UTC (rev 1167)
+++ trunk/dbunit/src/main/java/org/dbunit/PrepAndExpectedTestCase.java 2010-02-12 16:47:51 UTC (rev 1168)
@@ -54,6 +54,20 @@
void preTest() throws Exception;
/**
+ * Convenience method to call configureTest() and preTest().
+ *
+ * @param tables
+ * Table definitions to verify after test execution.
+ * @param prepDataFiles
+ * The prep data files to load as seed data.
+ * @param expectedDataFiles
+ * The expected data files to load as expected data.
+ * @throws Exception
+ */
+ void preTest(VerifyTableDefinition[] tables, String[] prepDataFiles,
+ String[] expectedDataFiles) throws Exception;
+
+ /**
* Execute post-test steps. Call this method after performing the test
* steps.
*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jef...@us...> - 2010-02-12 16:10:15
|
Revision: 1167
http://dbunit.svn.sourceforge.net/dbunit/?rev=1167&view=rev
Author: jeffjensen
Date: 2010-02-12 15:19:43 +0000 (Fri, 12 Feb 2010)
Log Message:
-----------
Add note on setting DatabaseConfig features/properties.
Modified Paths:
--------------
trunk/dbunit/src/main/java/org/dbunit/DefaultPrepAndExpectedTestCase.java
Modified: trunk/dbunit/src/main/java/org/dbunit/DefaultPrepAndExpectedTestCase.java
===================================================================
--- trunk/dbunit/src/main/java/org/dbunit/DefaultPrepAndExpectedTestCase.java 2010-02-12 01:47:28 UTC (rev 1166)
+++ trunk/dbunit/src/main/java/org/dbunit/DefaultPrepAndExpectedTestCase.java 2010-02-12 15:19:43 UTC (rev 1167)
@@ -141,6 +141,9 @@
* <li>To change the setup or teardown operation (e.g. change the teardown to
* org.dbunit.operation.DatabaseOperation.DELETE_ALL), set the setUpOperation or
* tearDownOperation property on the databaseTester.</li>
+ * <li>To set DatabaseConfig features/properties, one way is to extend this
+ * class and override the setUpDatabaseConfig(DatabaseConfig config) method from
+ * DatabaseTestCase.</li>
* </ol>
*
* @see org.dbunit.DefaultPrepAndExpectedTestCaseDiIT
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jb...@us...> - 2010-02-12 01:47:37
|
Revision: 1166
http://dbunit.svn.sourceforge.net/dbunit/?rev=1166&view=rev
Author: jbhurst
Date: 2010-02-12 01:47:28 +0000 (Fri, 12 Feb 2010)
Log Message:
-----------
[2875235] - Moved directories to match Maven default structure.
Removed Paths:
-------------
trunk/dbunit/src/testresources/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jb...@us...> - 2010-02-12 01:45:11
|
Revision: 1165
http://dbunit.svn.sourceforge.net/dbunit/?rev=1165&view=rev
Author: jbhurst
Date: 2010-02-12 01:45:00 +0000 (Fri, 12 Feb 2010)
Log Message:
-----------
Changed default logback logging level to INFO.
Modified Paths:
--------------
trunk/dbunit/src/test/resources/logback-test.xml
Modified: trunk/dbunit/src/test/resources/logback-test.xml
===================================================================
--- trunk/dbunit/src/test/resources/logback-test.xml 2010-02-12 01:42:50 UTC (rev 1164)
+++ trunk/dbunit/src/test/resources/logback-test.xml 2010-02-12 01:45:00 UTC (rev 1165)
@@ -2,7 +2,7 @@
<configuration scan="true">
<contextName>dbunit</contextName>
- <logger name="org.dbunit" level="TRACE" />
+ <logger name="org.dbunit" level="INFO" />
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<!-- NOTE: user must append slash in property -->
@@ -19,7 +19,7 @@
</layout>
</appender>
- <root level="DEBUG">
+ <root level="INFO">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
</root>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jb...@us...> - 2010-02-12 01:43:00
|
Revision: 1164
http://dbunit.svn.sourceforge.net/dbunit/?rev=1164&view=rev
Author: jbhurst
Date: 2010-02-12 01:42:50 +0000 (Fri, 12 Feb 2010)
Log Message:
-----------
[2875235] - Moved directories to match Maven default structure.
Modified Paths:
--------------
trunk/dbunit/pom.xml
trunk/dbunit/src/test/java/org/dbunit/DefaultPrepAndExpectedTestCaseDiIT.java
trunk/dbunit/src/test/java/org/dbunit/DefaultPrepAndExpectedTestCaseExtIT.java
trunk/dbunit/src/test/java/org/dbunit/DefaultPrepAndExpectedTestCaseTest.java
trunk/dbunit/src/test/java/org/dbunit/testutil/TestUtils.java
trunk/dbunit/src/test/java/org/dbunit/util/fileloader/CsvDataFileLoaderTest.java
trunk/dbunit/src/test/java/org/dbunit/util/fileloader/FlatXmlDataFileLoaderTest.java
trunk/dbunit/src/test/java/org/dbunit/util/fileloader/FullXmlDataFileLoaderTest.java
trunk/dbunit/src/test/java/org/dbunit/util/fileloader/XlsDataFileLoaderTest.java
trunk/dbunit/src/test/resources/xml/antTestBuildFile.xml
Added Paths:
-----------
trunk/dbunit/src/main/
trunk/dbunit/src/main/java/
trunk/dbunit/src/main/resources/
trunk/dbunit/src/main/resources/org/
trunk/dbunit/src/main/resources/org/dbunit/
trunk/dbunit/src/main/resources/org/dbunit/dataset/
trunk/dbunit/src/main/resources/org/dbunit/dataset/xml/
trunk/dbunit/src/main/resources/org/dbunit/dataset/xml/dataset.dtd
trunk/dbunit/src/test/java/
trunk/dbunit/src/test/java/org/
trunk/dbunit/src/test/resources/
trunk/dbunit/src/test/resources/csv/
trunk/dbunit/src/test/resources/dtd/
trunk/dbunit/src/test/resources/logback-test.xml
trunk/dbunit/src/test/resources/sql/
trunk/dbunit/src/test/resources/sqlloader/
trunk/dbunit/src/test/resources/xml/
Removed Paths:
-------------
trunk/dbunit/src/csv/
trunk/dbunit/src/dtd/
trunk/dbunit/src/java/
trunk/dbunit/src/main/java/org/dbunit/dataset/xml/dataset.dtd
trunk/dbunit/src/sql/
trunk/dbunit/src/sqlloader/
trunk/dbunit/src/test/org/
trunk/dbunit/src/testresources/logback-test.xml
trunk/dbunit/src/xml/
Modified: trunk/dbunit/pom.xml
===================================================================
--- trunk/dbunit/pom.xml 2010-02-11 23:50:32 UTC (rev 1163)
+++ trunk/dbunit/pom.xml 2010-02-12 01:42:50 UTC (rev 1164)
@@ -342,53 +342,6 @@
<build>
<defaultGoal>install</defaultGoal>
- <sourceDirectory>src/java</sourceDirectory>
- <testSourceDirectory>src/test</testSourceDirectory>
-
- <!--
- TODO: move to M2's expected path and separate java from test (once
- SCM is migrated to SVN...)
- -->
- <resources>
- <resource>
- <directory>.</directory>
- <includes>
- <include>LICENSE.txt</include>
- </includes>
- </resource>
- <resource>
- <directory>src/java</directory>
- <includes>
- <include>**/dataset.dtd</include>
- </includes>
- </resource>
- <resource>
- <directory>src/csv</directory>
- <includes>
- <include>**/cvs-tests.properties</include>
- </includes>
- </resource>
-
- </resources>
- <!--
- TODO: that are some resources on src that should be on test...
-
- <testResources> <testResource> </testResource> </testResources>
- -->
-
- <!-- not ideal yet, but gets these files on test classpath -->
- <testResources>
- <testResource>
- <directory>${project.basedir}/src/xml</directory>
- </testResource>
- <testResource>
- <directory>${project.basedir}/src/csv</directory>
- </testResource>
- <testResource>
- <directory>${project.basedir}/src/testresources</directory>
- </testResource>
- </testResources>
-
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -571,7 +524,7 @@
</goals>
<configuration>
<srcFiles>
- <srcFile>src/sql/${dbunit.profile.ddl}</srcFile>
+ <srcFile>src/test/resources/sql/${dbunit.profile.ddl}</srcFile>
</srcFiles>
<onError>continue</onError>
</configuration>
Deleted: trunk/dbunit/src/main/java/org/dbunit/dataset/xml/dataset.dtd
===================================================================
--- trunk/dbunit/src/java/org/dbunit/dataset/xml/dataset.dtd 2010-02-11 23:50:32 UTC (rev 1163)
+++ trunk/dbunit/src/main/java/org/dbunit/dataset/xml/dataset.dtd 2010-02-12 01:42:50 UTC (rev 1164)
@@ -1,17 +0,0 @@
-<?xml version='1.0' encoding='UTF-8' ?>
-
-<!ELEMENT dataset (table+)>
-
-<!ELEMENT table (column* , row*)>
-
-<!ATTLIST table name CDATA #REQUIRED >
-<!ELEMENT column (#PCDATA)>
-
-<!ELEMENT row (value | null)*>
-
-<!ELEMENT value (#PCDATA)>
-
-<!ELEMENT null EMPTY>
-
-
-
Copied: trunk/dbunit/src/main/resources/org/dbunit/dataset/xml/dataset.dtd (from rev 1163, trunk/dbunit/src/java/org/dbunit/dataset/xml/dataset.dtd)
===================================================================
--- trunk/dbunit/src/main/resources/org/dbunit/dataset/xml/dataset.dtd (rev 0)
+++ trunk/dbunit/src/main/resources/org/dbunit/dataset/xml/dataset.dtd 2010-02-12 01:42:50 UTC (rev 1164)
@@ -0,0 +1,17 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+
+<!ELEMENT dataset (table+)>
+
+<!ELEMENT table (column* , row*)>
+
+<!ATTLIST table name CDATA #REQUIRED >
+<!ELEMENT column (#PCDATA)>
+
+<!ELEMENT row (value | null)*>
+
+<!ELEMENT value (#PCDATA)>
+
+<!ELEMENT null EMPTY>
+
+
+
Modified: trunk/dbunit/src/test/java/org/dbunit/DefaultPrepAndExpectedTestCaseDiIT.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseDiIT.java 2010-02-11 23:50:32 UTC (rev 1163)
+++ trunk/dbunit/src/test/java/org/dbunit/DefaultPrepAndExpectedTestCaseDiIT.java 2010-02-12 01:42:50 UTC (rev 1164)
@@ -21,9 +21,8 @@
private final Logger LOG =
LoggerFactory.getLogger(DefaultPrepAndExpectedTestCaseDiIT.class);
- private static final String PREP_DATA_FILE_NAME = "/flatXmlDataSetTest.xml";
- private static final String EXP_DATA_FILE_NAME =
- "/flatXmlDataSetTestChanged.xml";
+ private static final String PREP_DATA_FILE_NAME = "/xml/flatXmlDataSetTest.xml";
+ private static final String EXP_DATA_FILE_NAME = "/xml/flatXmlDataSetTestChanged.xml";
private static final VerifyTableDefinition TEST_TABLE =
new VerifyTableDefinition("TEST_TABLE", new String[] {});
Modified: trunk/dbunit/src/test/java/org/dbunit/DefaultPrepAndExpectedTestCaseExtIT.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseExtIT.java 2010-02-11 23:50:32 UTC (rev 1163)
+++ trunk/dbunit/src/test/java/org/dbunit/DefaultPrepAndExpectedTestCaseExtIT.java 2010-02-12 01:42:50 UTC (rev 1164)
@@ -18,9 +18,8 @@
*/
public class DefaultPrepAndExpectedTestCaseExtIT extends
DefaultPrepAndExpectedTestCase {
- private static final String PREP_DATA_FILE_NAME = "/flatXmlDataSetTest.xml";
- private static final String EXP_DATA_FILE_NAME =
- "/flatXmlDataSetTestChanged.xml";
+ private static final String PREP_DATA_FILE_NAME = "/xml/flatXmlDataSetTest.xml";
+ private static final String EXP_DATA_FILE_NAME = "/xml/flatXmlDataSetTestChanged.xml";
private static final VerifyTableDefinition TEST_TABLE =
new VerifyTableDefinition("TEST_TABLE", new String[] {});
Modified: trunk/dbunit/src/test/java/org/dbunit/DefaultPrepAndExpectedTestCaseTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseTest.java 2010-02-11 23:50:32 UTC (rev 1163)
+++ trunk/dbunit/src/test/java/org/dbunit/DefaultPrepAndExpectedTestCaseTest.java 2010-02-12 01:42:50 UTC (rev 1164)
@@ -7,8 +7,8 @@
import org.dbunit.util.fileloader.FlatXmlDataFileLoader;
public class DefaultPrepAndExpectedTestCaseTest extends TestCase {
- private static final String PREP_DATA_FILE_NAME = "/flatXmlDataSetTest.xml";
- private static final String EXP_DATA_FILE_NAME = "/flatXmlDataSetTest.xml";
+ private static final String PREP_DATA_FILE_NAME = "/xml/flatXmlDataSetTest.xml";
+ private static final String EXP_DATA_FILE_NAME = "/xml/flatXmlDataSetTest.xml";
private final DataFileLoader dataFileLoader = new FlatXmlDataFileLoader();
// private final IDatabaseTester databaseTester = new
Modified: trunk/dbunit/src/test/java/org/dbunit/testutil/TestUtils.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/testutil/TestUtils.java 2010-02-11 23:50:32 UTC (rev 1163)
+++ trunk/dbunit/src/test/java/org/dbunit/testutil/TestUtils.java 2010-02-12 01:42:50 UTC (rev 1164)
@@ -42,8 +42,7 @@
public static String getFileName(String fileName)
{
-// return "src/resources/" + fileName;
- return "src/" + fileName;
+ return "src/test/resources/" + fileName;
}
public static File getFile(String fileName)
Modified: trunk/dbunit/src/test/java/org/dbunit/util/fileloader/CsvDataFileLoaderTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/util/fileloader/CsvDataFileLoaderTest.java 2010-02-11 23:50:32 UTC (rev 1163)
+++ trunk/dbunit/src/test/java/org/dbunit/util/fileloader/CsvDataFileLoaderTest.java 2010-02-12 01:42:50 UTC (rev 1164)
@@ -46,7 +46,7 @@
* Test can load the specified file.
*/
public void testLoad() throws DataSetException {
- String filename = "/orders/orders_row.csv";
+ String filename = "/csv/orders/orders_row.csv";
IDataSet ds = loader.load(filename);
assertTrue("No tables found in dataset.", ds.getTableNames().length > 0);
// DataSet loading tests verify data accuracy
Modified: trunk/dbunit/src/test/java/org/dbunit/util/fileloader/FlatXmlDataFileLoaderTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/util/fileloader/FlatXmlDataFileLoaderTest.java 2010-02-11 23:50:32 UTC (rev 1163)
+++ trunk/dbunit/src/test/java/org/dbunit/util/fileloader/FlatXmlDataFileLoaderTest.java 2010-02-12 01:42:50 UTC (rev 1164)
@@ -46,7 +46,7 @@
* Test can load the specified file.
*/
public void testLoad() throws DataSetException {
- String filename = "/flatXmlDataSetTest.xml";
+ String filename = "/xml/flatXmlDataSetTest.xml";
IDataSet ds = loader.load(filename);
assertTrue("No tables found in dataset.", ds.getTableNames().length > 0);
// DataSet loading tests verify data accuracy
Modified: trunk/dbunit/src/test/java/org/dbunit/util/fileloader/FullXmlDataFileLoaderTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/util/fileloader/FullXmlDataFileLoaderTest.java 2010-02-11 23:50:32 UTC (rev 1163)
+++ trunk/dbunit/src/test/java/org/dbunit/util/fileloader/FullXmlDataFileLoaderTest.java 2010-02-12 01:42:50 UTC (rev 1164)
@@ -46,7 +46,7 @@
* Test can load the specified file.
*/
public void testLoad() throws DataSetException {
- String filename = "/xmlTableTest.xml";
+ String filename = "/xml/xmlTableTest.xml";
IDataSet ds = loader.load(filename);
assertTrue("No tables found in dataset.", ds.getTableNames().length > 0);
// DataSet loading tests verify data accuracy
Modified: trunk/dbunit/src/test/java/org/dbunit/util/fileloader/XlsDataFileLoaderTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/util/fileloader/XlsDataFileLoaderTest.java 2010-02-11 23:50:32 UTC (rev 1163)
+++ trunk/dbunit/src/test/java/org/dbunit/util/fileloader/XlsDataFileLoaderTest.java 2010-02-12 01:42:50 UTC (rev 1164)
@@ -46,7 +46,7 @@
* Test can load the specified file.
*/
public void testLoad() throws DataSetException {
- String filename = "/dataSetTest.xls";
+ String filename = "/xml/dataSetTest.xls";
IDataSet ds = loader.load(filename);
assertTrue("No tables found in dataset.", ds.getTableNames().length > 0);
// DataSet loading tests verify data accuracy
Copied: trunk/dbunit/src/test/resources/logback-test.xml (from rev 1163, trunk/dbunit/src/testresources/logback-test.xml)
===================================================================
--- trunk/dbunit/src/test/resources/logback-test.xml (rev 0)
+++ trunk/dbunit/src/test/resources/logback-test.xml 2010-02-12 01:42:50 UTC (rev 1164)
@@ -0,0 +1,28 @@
+<!-- logback config file for testing-->
+<configuration scan="true">
+ <contextName>dbunit</contextName>
+
+ <logger name="org.dbunit" level="TRACE" />
+
+ <appender name="FILE" class="ch.qos.logback.core.FileAppender">
+ <!-- NOTE: user must append slash in property -->
+ <file>${logback.file.path:-target/}dbunit-TEST.log</file>
+ <append>false</append>
+ <layout class="ch.qos.logback.classic.PatternLayout">
+ <pattern>%date %contextName [%thread] %-5level %-55logger{55} %mdc: %marker: %msg%n</pattern>
+ </layout>
+ </appender>
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <layout class="ch.qos.logback.classic.PatternLayout">
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36}: %msg%n</pattern>
+ </layout>
+ </appender>
+
+ <root level="DEBUG">
+ <appender-ref ref="STDOUT" />
+ <appender-ref ref="FILE" />
+ </root>
+
+ <jmxConfigurator contextName="dbunit"/>
+</configuration>
Modified: trunk/dbunit/src/test/resources/xml/antTestBuildFile.xml
===================================================================
--- trunk/dbunit/src/xml/antTestBuildFile.xml 2010-02-11 23:50:32 UTC (rev 1163)
+++ trunk/dbunit/src/test/resources/xml/antTestBuildFile.xml 2010-02-12 01:42:50 UTC (rev 1164)
@@ -9,11 +9,11 @@
<property name="dbunit.profile.user" value="unknown"/>
<property name="dbunit.profile.password" value="unknown"/>
- <property name="testDataSet" value="src/xml/flatXmlDataSetTest.xml"/>
- <property name="updateDataSet" value="src/xml/antTestDataSet.xml"/>
+ <property name="testDataSet" value="src/test/resources/xml/flatXmlDataSetTest.xml"/>
+ <property name="updateDataSet" value="src/test/resources/xml/antTestDataSet.xml"/>
<property name="exportDataSet" value="target/xml/antExportDataSet.xml"/>
- <property name="exportDtd" value="src/xml/antExport.dtd"/>
- <property name="exportCsv" value="src/xml/antExportCsv"/>
+ <property name="exportDtd" value="src/test/resources/xml/antExport.dtd"/>
+ <property name="exportCsv" value="src/test/resources/xml/antExportCsv"/>
<taskdef name="dbunit" classname="org.dbunit.ant.DbUnitTask" loaderref="dbunit"/>
<typedef name="queryset" classname="org.dbunit.ant.QuerySet" loaderref="dbunit"/>
Deleted: trunk/dbunit/src/testresources/logback-test.xml
===================================================================
--- trunk/dbunit/src/testresources/logback-test.xml 2010-02-11 23:50:32 UTC (rev 1163)
+++ trunk/dbunit/src/testresources/logback-test.xml 2010-02-12 01:42:50 UTC (rev 1164)
@@ -1,28 +0,0 @@
-<!-- logback config file for testing-->
-<configuration scan="true">
- <contextName>dbunit</contextName>
-
- <logger name="org.dbunit" level="TRACE" />
-
- <appender name="FILE" class="ch.qos.logback.core.FileAppender">
- <!-- NOTE: user must append slash in property -->
- <file>${logback.file.path:-target/}dbunit-TEST.log</file>
- <append>false</append>
- <layout class="ch.qos.logback.classic.PatternLayout">
- <pattern>%date %contextName [%thread] %-5level %-55logger{55} %mdc: %marker: %msg%n</pattern>
- </layout>
- </appender>
-
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <layout class="ch.qos.logback.classic.PatternLayout">
- <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36}: %msg%n</pattern>
- </layout>
- </appender>
-
- <root level="DEBUG">
- <appender-ref ref="STDOUT" />
- <appender-ref ref="FILE" />
- </root>
-
- <jmxConfigurator contextName="dbunit"/>
-</configuration>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jef...@us...> - 2010-02-11 23:50:44
|
Revision: 1163
http://dbunit.svn.sourceforge.net/dbunit/?rev=1163&view=rev
Author: jeffjensen
Date: 2010-02-11 23:50:32 +0000 (Thu, 11 Feb 2010)
Log Message:
-----------
Have DefaultPrepAndExpectedTestCase extend DBTestCase. Add more notes to javadoc. Change ExtIT to better test as an extended test case.
Modified Paths:
--------------
trunk/dbunit/src/java/org/dbunit/DefaultPrepAndExpectedTestCase.java
trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseExtIT.java
Modified: trunk/dbunit/src/java/org/dbunit/DefaultPrepAndExpectedTestCase.java
===================================================================
--- trunk/dbunit/src/java/org/dbunit/DefaultPrepAndExpectedTestCase.java 2010-02-11 23:29:37 UTC (rev 1162)
+++ trunk/dbunit/src/java/org/dbunit/DefaultPrepAndExpectedTestCase.java 2010-02-11 23:50:32 UTC (rev 1163)
@@ -23,8 +23,6 @@
import java.util.ArrayList;
import java.util.List;
-import junit.framework.TestCase;
-
import org.dbunit.database.IDatabaseConnection;
import org.dbunit.dataset.CompositeDataSet;
import org.dbunit.dataset.DataSetException;
@@ -37,7 +35,9 @@
import org.slf4j.LoggerFactory;
/**
- * Test case base class supporting prep data and expected data.
+ * Test case base class supporting prep data and expected data. Prep data is the
+ * data needed for the test to run. Expected data is the data needed to compare
+ * if the test ran successfully.
*
* Use this class in two ways:
* <ol>
@@ -134,10 +134,15 @@
* Put common data in one or more files and pass the needed ones in the correct
* data file array.
*
- * <h4>Additional examples</h4>
+ * <h4>Notes</h4>
+ * <ol>
+ * <li>For additional examples, refer to the ITs (listed in the See Also
+ * section).</li>
+ * <li>To change the setup or teardown operation (e.g. change the teardown to
+ * org.dbunit.operation.DatabaseOperation.DELETE_ALL), set the setUpOperation or
+ * tearDownOperation property on the databaseTester.</li>
+ * </ol>
*
- * For additional examples, refer to the ITs (listed in the See Also section).
- *
* @see org.dbunit.DefaultPrepAndExpectedTestCaseDiIT
* @see org.dbunit.DefaultPrepAndExpectedTestCaseExtIT
*
@@ -146,7 +151,7 @@
* @version $Revision$ $Date$
* @since 2.4.8
*/
-public class DefaultPrepAndExpectedTestCase extends TestCase implements
+public class DefaultPrepAndExpectedTestCase extends DBTestCase implements
PrepAndExpectedTestCase {
private final Logger LOG =
LoggerFactory.getLogger(DefaultPrepAndExpectedTestCase.class);
@@ -187,6 +192,22 @@
}
/**
+ * {@inheritDoc} This implementation returns the databaseTester set by the
+ * test.
+ */
+ protected IDatabaseTester newDatabaseTester() throws Exception {
+ // questionable, but there is not a "setter" for any parent...
+ return databaseTester;
+ }
+
+ /**
+ * {@inheritDoc} Returns the prep dataset.
+ */
+ protected IDataSet getDataSet() throws Exception {
+ return prepDs;
+ }
+
+ /**
* {@inheritDoc}
*/
public void configureTest(VerifyTableDefinition[] tables,
Modified: trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseExtIT.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseExtIT.java 2010-02-11 23:29:37 UTC (rev 1162)
+++ trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseExtIT.java 2010-02-11 23:50:32 UTC (rev 1163)
@@ -37,16 +37,17 @@
private IDatabaseConnection connection;
private IDatabaseTester databaseTester;
- private DefaultPrepAndExpectedTestCase tc;
-
protected void setUp() throws Exception {
dbEnv = DatabaseEnvironment.getInstance();
connection = dbEnv.getConnection();
databaseTester = new DefaultDatabaseTester(connection);
- tc = new DefaultPrepAndExpectedTestCase(dataFileLoader, databaseTester);
+ setDataFileLoader(dataFileLoader);
+ setDatabaseTester(databaseTester);
- super.setUp();
+ // don't call super.setUp() here as prep data is not loaded yet
+ // (getDataSet() is null)
+ // super.setUp();
}
public void testSuccessRun() throws Exception {
@@ -54,8 +55,8 @@
String[] expectedDataFiles = {PREP_DATA_FILE_NAME};
VerifyTableDefinition[] tables = {TEST_TABLE, SECOND_TABLE};
- tc.configureTest(tables, prepDataFiles, expectedDataFiles);
- tc.preTest();
+ configureTest(tables, prepDataFiles, expectedDataFiles);
+ preTest();
// skip modifying data and just verify the insert
@@ -63,9 +64,9 @@
// maybe we need a KeepConnectionOpenOperationListener class?!
connection = dbEnv.getConnection();
databaseTester = new DefaultDatabaseTester(connection);
- tc.setDatabaseTester(databaseTester);
+ setDatabaseTester(databaseTester);
- tc.postTest();
+ postTest();
}
public void testFailRun() throws Exception {
@@ -73,8 +74,8 @@
String[] expectedDataFiles = {EXP_DATA_FILE_NAME};
VerifyTableDefinition[] tables = {TEST_TABLE, SECOND_TABLE};
- tc.configureTest(tables, prepDataFiles, expectedDataFiles);
- tc.preTest();
+ configureTest(tables, prepDataFiles, expectedDataFiles);
+ preTest();
// skip modifying data and just verify the insert
@@ -82,10 +83,10 @@
// maybe we need a KeepConnectionOpenOperationListener class?!
connection = dbEnv.getConnection();
databaseTester = new DefaultDatabaseTester(connection);
- tc.setDatabaseTester(databaseTester);
+ setDatabaseTester(databaseTester);
try {
- tc.postTest();
+ postTest();
fail("Did not catch expected exception:"
+ " junit.framework.ComparisonFailure");
} catch (ComparisonFailure e) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jb...@us...> - 2010-02-11 23:29:44
|
Revision: 1162
http://dbunit.svn.sourceforge.net/dbunit/?rev=1162&view=rev
Author: jbhurst
Date: 2010-02-11 23:29:37 +0000 (Thu, 11 Feb 2010)
Log Message:
-----------
[2875235] - Added TestUtils methods to provide consistent access to test resources, to facilitate moving them into the standard Maven directory structure.
Modified Paths:
--------------
trunk/dbunit/src/test/org/dbunit/AbstractHSQLTestCase.java
trunk/dbunit/src/test/org/dbunit/DatabaseEnvironment.java
trunk/dbunit/src/test/org/dbunit/DerbyEnvironment.java
trunk/dbunit/src/test/org/dbunit/H2Environment.java
trunk/dbunit/src/test/org/dbunit/HypersonicEnvironment.java
trunk/dbunit/src/test/org/dbunit/Main.java
trunk/dbunit/src/test/org/dbunit/ant/DbUnitTaskIT.java
trunk/dbunit/src/test/org/dbunit/assertion/DbUnitAssertIT.java
trunk/dbunit/src/test/org/dbunit/assertion/DiffCollectingFailureHandlerTest.java
trunk/dbunit/src/test/org/dbunit/database/DatabaseSequenceFilterTest.java
trunk/dbunit/src/test/org/dbunit/database/DatabaseTableMetaDataIT.java
trunk/dbunit/src/test/org/dbunit/database/ResultSetTableMetaDataIT.java
trunk/dbunit/src/test/org/dbunit/database/search/AbstractMetaDataBasedSearchCallbackTestCase.java
trunk/dbunit/src/test/org/dbunit/database/search/TablesDependencyHelperTest.java
trunk/dbunit/src/test/org/dbunit/dataset/CaseInsensitiveDataSetTest.java
trunk/dbunit/src/test/org/dbunit/dataset/CaseInsensitiveTableTest.java
trunk/dbunit/src/test/org/dbunit/dataset/CompositeDataSetIterationTest.java
trunk/dbunit/src/test/org/dbunit/dataset/CompositeDataSetTest.java
trunk/dbunit/src/test/org/dbunit/dataset/DataSetProducerAdapterTest.java
trunk/dbunit/src/test/org/dbunit/dataset/DefaultDataSetTest.java
trunk/dbunit/src/test/org/dbunit/dataset/FilteredDataSetTest.java
trunk/dbunit/src/test/org/dbunit/dataset/ReplacementTableTest.java
trunk/dbunit/src/test/org/dbunit/dataset/RowFilterTableTest.java
trunk/dbunit/src/test/org/dbunit/dataset/SortedDataSetTest.java
trunk/dbunit/src/test/org/dbunit/dataset/SortedTableTest.java
trunk/dbunit/src/test/org/dbunit/dataset/csv/CsvDataSetTest.java
trunk/dbunit/src/test/org/dbunit/dataset/csv/CsvDataSetWriterTest.java
trunk/dbunit/src/test/org/dbunit/dataset/csv/CsvParserTest.java
trunk/dbunit/src/test/org/dbunit/dataset/csv/CsvProducerTest.java
trunk/dbunit/src/test/org/dbunit/dataset/csv/CsvURLDataSetTest.java
trunk/dbunit/src/test/org/dbunit/dataset/csv/CsvURLProducerTest.java
trunk/dbunit/src/test/org/dbunit/dataset/excel/XlsDataSetTest.java
trunk/dbunit/src/test/org/dbunit/dataset/excel/XlsTableTest.java
trunk/dbunit/src/test/org/dbunit/dataset/filter/AbstractTableFilterTest.java
trunk/dbunit/src/test/org/dbunit/dataset/sqlloader/SqlLoaderCsvDataSetTest.java
trunk/dbunit/src/test/org/dbunit/dataset/xml/FlatDtdDataSetIT.java
trunk/dbunit/src/test/org/dbunit/dataset/xml/FlatDtdProducerTest.java
trunk/dbunit/src/test/org/dbunit/dataset/xml/FlatXmlDataSetTest.java
trunk/dbunit/src/test/org/dbunit/dataset/xml/FlatXmlProducerTest.java
trunk/dbunit/src/test/org/dbunit/dataset/xml/FlatXmlTableTest.java
trunk/dbunit/src/test/org/dbunit/dataset/xml/XmlDataSetTest.java
trunk/dbunit/src/test/org/dbunit/dataset/xml/XmlProducerTest.java
trunk/dbunit/src/test/org/dbunit/dataset/xml/XmlTableTest.java
trunk/dbunit/src/test/org/dbunit/ext/mssql/InsertIdentityOperationIT.java
trunk/dbunit/src/test/org/dbunit/operation/AbstractBatchOperationIT.java
trunk/dbunit/src/test/org/dbunit/operation/CompositeOperationIT.java
trunk/dbunit/src/test/org/dbunit/operation/DeleteOperationIT.java
trunk/dbunit/src/test/org/dbunit/operation/InsertOperationIT.java
trunk/dbunit/src/test/org/dbunit/operation/RefreshOperationIT.java
trunk/dbunit/src/test/org/dbunit/operation/TransactionOperationIT.java
trunk/dbunit/src/test/org/dbunit/operation/UpdateOperationIT.java
Added Paths:
-----------
trunk/dbunit/src/test/org/dbunit/testutil/TestUtils.java
Modified: trunk/dbunit/src/test/org/dbunit/AbstractHSQLTestCase.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/AbstractHSQLTestCase.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/AbstractHSQLTestCase.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -9,6 +9,7 @@
import org.dbunit.database.DatabaseConnection;
import org.dbunit.database.IDatabaseConnection;
+import org.dbunit.testutil.TestUtils;
import org.dbunit.util.CollectionsHelper;
import org.slf4j.Logger;
@@ -71,8 +72,8 @@
super.setUp();
this.jdbcConnection = HypersonicEnvironment.createJdbcConnection("mem:tempdb");
- HypersonicEnvironment.executeDdlFile(new File(
- "src/sql/" + sqlFile), jdbcConnection);
+ HypersonicEnvironment.executeDdlFile(TestUtils.getFile(
+ "sql/" + sqlFile), jdbcConnection);
this.connection = new DatabaseConnection(jdbcConnection);
}
Modified: trunk/dbunit/src/test/org/dbunit/DatabaseEnvironment.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/DatabaseEnvironment.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/DatabaseEnvironment.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -26,12 +26,12 @@
import java.sql.Connection;
import java.sql.DriverManager;
-import org.apache.commons.io.FilenameUtils;
import org.dbunit.database.DatabaseConfig;
import org.dbunit.database.DatabaseConnection;
import org.dbunit.database.IDatabaseConnection;
import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.xml.XmlDataSet;
+import org.dbunit.testutil.TestUtils;
/**
* @author Manuel Laflamme
@@ -94,7 +94,7 @@
public DatabaseEnvironment(DatabaseProfile profile) throws Exception
{
_profile = profile;
- File file = new File("src/xml/dataSetTest.xml");
+ File file = TestUtils.getFile("xml/dataSetTest.xml");
_dataSet = new XmlDataSet(new FileReader(file));
_databaseTester = new JdbcDatabaseTester( _profile.getDriverClass(),
_profile.getConnectionUrl(), _profile.getUser(), _profile.getPassword(), _profile.getSchema() );
@@ -166,22 +166,6 @@
return true;
}
- public File getFile(String fileName)
- {
- String fullPath = FilenameUtils.getFullPath(fileName);
- String baseName = FilenameUtils.getBaseName(fileName);
- String extension = FilenameUtils.getExtension(fileName);
- File profileFile = new File(fullPath + baseName + "-" + _profile.getActiveProfile() + "." + extension);
- if (profileFile.exists())
- {
- return profileFile;
- }
- else
- {
- return new File(fileName);
- }
- }
-
/**
* Returns the string converted as an identifier according to the metadata rules of the database environment.
* Most databases convert all metadata identifiers to uppercase.
Modified: trunk/dbunit/src/test/org/dbunit/DerbyEnvironment.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/DerbyEnvironment.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/DerbyEnvironment.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -29,6 +29,7 @@
import java.sql.Statement;
import java.util.StringTokenizer;
+import org.dbunit.testutil.TestUtils;
import org.dbunit.util.FileHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -52,7 +53,7 @@
// when the connection is retrieved the first time
FileHelper.deleteDirectory(new File("./target/derby_db"));
- File ddlFile = new File("src/sql/derby.sql");
+ File ddlFile = TestUtils.getFile("sql/derby.sql");
Connection connection = getConnection().getConnection();
executeDdlFile(ddlFile, connection);
Modified: trunk/dbunit/src/test/org/dbunit/H2Environment.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/H2Environment.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/H2Environment.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -22,6 +22,7 @@
package org.dbunit;
import org.dbunit.operation.DatabaseOperation;
+import org.dbunit.testutil.TestUtils;
import java.io.BufferedReader;
import java.io.File;
@@ -44,7 +45,7 @@
super(profile);
// Creates required tables into the hypersonic in-memory database
- File ddlFile = new File("src/sql/h2.sql");
+ File ddlFile = TestUtils.getFile("sql/h2.sql");
Connection connection = getConnection().getConnection();
executeDdlFile(ddlFile, connection);
Modified: trunk/dbunit/src/test/org/dbunit/HypersonicEnvironment.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/HypersonicEnvironment.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/HypersonicEnvironment.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -22,6 +22,7 @@
package org.dbunit;
import org.dbunit.operation.DatabaseOperation;
+import org.dbunit.testutil.TestUtils;
import java.io.BufferedReader;
import java.io.File;
@@ -44,7 +45,7 @@
super(profile);
// Creates required tables into the hypersonic in-memory database
- File ddlFile = new File("src/sql/hypersonic.sql");
+ File ddlFile = TestUtils.getFile("sql/hypersonic.sql");
Connection connection = getConnection().getConnection();
executeDdlFile(ddlFile, connection);
Modified: trunk/dbunit/src/test/org/dbunit/Main.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/Main.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/Main.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -57,8 +57,8 @@
IDatabaseConnection connection =
DatabaseEnvironment.getInstance().getConnection();
-// IDataSet dataSet = new XmlDataSet(new FileReader("src/xml/dataSetTest.xml"));
- InputSource source = new InputSource(new File("src/xml/xmlTableTest.xml").toURL().toString());
+// IDataSet dataSet = new XmlDataSet(TestUtils.getFileReader("xml/dataSetTest.xml"));
+ InputSource source = new InputSource(TestUtils.getFile("xml/xmlTableTest.xml").toURL().toString());
// InputSource source = new InputSource(new File("writerTest.xml").toURL().toString());
FlatXmlProducer flatXmlProducer = new FlatXmlProducer(source);
XmlProducer xmlProducer = new XmlProducer(source);
@@ -176,7 +176,7 @@
// ////////////////////////////////
-// Document document = new Document(new File("src/xml/flatXmlDataSetTest.xml"));
+// Document document = new Document(TestUtils.getFile("xml/flatXmlDataSetTest.xml"));
// DocType docType = document.getDocType();
// System.out.println(docType);
//
@@ -191,7 +191,7 @@
// IDataSet dataSet = new FlatXmlDataSet(
// new FileInputStream("flatXmlDataSetTest.xml"));
// FlatDtdDataSet.write(new FlatXmlDataSet(
-// new FileInputStream("src/xml/flatXmlDataSetTest.xml")),
+// TestUtils.getFileInputStream("xml/flatXmlDataSetTest.xml")),
// new FileOutputStream("src/dtd/flatXmlDataSetTest.dtd"));
}
Modified: trunk/dbunit/src/test/org/dbunit/ant/DbUnitTaskIT.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/ant/DbUnitTaskIT.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/ant/DbUnitTaskIT.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -47,6 +47,7 @@
import org.dbunit.ext.mssql.InsertIdentityOperation;
import org.dbunit.ext.oracle.OracleDataTypeFactory;
import org.dbunit.operation.DatabaseOperation;
+import org.dbunit.testutil.TestUtils;
import org.dbunit.util.FileHelper;
/**
@@ -63,7 +64,7 @@
{
static protected Class classUnderTest = DbUnitTaskIT.class;
- private static final String BUILD_FILE_DIR = "src/xml";
+ private static final String BUILD_FILE_DIR = "xml";
private static final String OUTPUT_DIR = "target/xml";
private File outputDir;
@@ -79,8 +80,8 @@
DatabaseEnvironment.getInstance();
String filePath = BUILD_FILE_DIR + "/antTestBuildFile.xml";
- assertTrue("Buildfile not found", new File(filePath).isFile());
- configureProject(filePath);
+ assertTrue("Buildfile not found", TestUtils.getFile(filePath).isFile());
+ configureProject(TestUtils.getFileName(filePath));
outputDir = new File(getProjectDir(), OUTPUT_DIR);
outputDir.mkdirs();
Modified: trunk/dbunit/src/test/org/dbunit/assertion/DbUnitAssertIT.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/assertion/DbUnitAssertIT.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/assertion/DbUnitAssertIT.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -45,6 +45,7 @@
import org.dbunit.dataset.xml.FlatXmlDataSetBuilder;
import org.dbunit.dataset.xml.XmlDataSet;
import org.dbunit.operation.DatabaseOperation;
+import org.dbunit.testutil.TestUtils;
/**
* @author Manuel Laflamme
@@ -53,7 +54,7 @@
*/
public class DbUnitAssertIT extends TestCase
{
- public static final String FILE_PATH = "src/xml/assertionTest.xml";
+ public static final String FILE_PATH = "xml/assertionTest.xml";
private DbUnitAssert assertion = new DbUnitAssert();
@@ -65,7 +66,7 @@
private IDataSet getDataSet() throws Exception
{
- return new FlatXmlDataSetBuilder().build(new FileReader(FILE_PATH));
+ return new FlatXmlDataSetBuilder().build(TestUtils.getFileReader(FILE_PATH));
}
////////////////////////////////////////////////////////////////////////////
@@ -81,8 +82,8 @@
public void testAssertTablesEmtpyEquals() throws Exception
{
- IDataSet empty1 = new XmlDataSet(new FileReader("src/xml/assertionTest-empty1.xml"));
- IDataSet empty2 = new FlatXmlDataSetBuilder().build(new FileReader("src/xml/assertionTest-empty2.xml"));
+ IDataSet empty1 = new XmlDataSet(TestUtils.getFileReader("xml/assertionTest-empty1.xml"));
+ IDataSet empty2 = new FlatXmlDataSetBuilder().build(TestUtils.getFileReader("xml/assertionTest-empty2.xml"));
assertion.assertEquals(empty1, empty2);
}
Modified: trunk/dbunit/src/test/org/dbunit/assertion/DiffCollectingFailureHandlerTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/assertion/DiffCollectingFailureHandlerTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/assertion/DiffCollectingFailureHandlerTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -20,13 +20,13 @@
*/
package org.dbunit.assertion;
-import java.io.FileReader;
import java.util.List;
import junit.framework.TestCase;
import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.xml.FlatXmlDataSet;
+import org.dbunit.testutil.TestUtils;
/**
* @author gommma (gommma AT users.sourceforge.net)
@@ -45,7 +45,7 @@
private IDataSet getDataSet() throws Exception
{
- return new FlatXmlDataSet(new FileReader(DbUnitAssertIT.FILE_PATH));
+ return new FlatXmlDataSet(TestUtils.getFileReader(DbUnitAssertIT.FILE_PATH));
}
public void testAssertTablesWithDifferentValues() throws Exception
Modified: trunk/dbunit/src/test/org/dbunit/database/DatabaseSequenceFilterTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/database/DatabaseSequenceFilterTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/database/DatabaseSequenceFilterTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -33,6 +33,7 @@
import org.dbunit.dataset.FilteredDataSet;
import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.filter.ITableFilter;
+import org.dbunit.testutil.TestUtils;
/**
* @author Manuel Laflamme
@@ -70,7 +71,7 @@
String[] expectedNoFilter = {"A","B","C","D","E","F","G","H",};
String[] expectedFiltered = {"D","A","F","C","G","E","H","B",};
- HypersonicEnvironment.executeDdlFile(new File("src/sql/hypersonic_fk.sql"),
+ HypersonicEnvironment.executeDdlFile(TestUtils.getFile("sql/hypersonic_fk.sql"),
_jdbcConnection);
IDatabaseConnection connection = new DatabaseConnection(_jdbcConnection);
@@ -89,7 +90,7 @@
{
String[] expectedNoFilter = {"A","B","C","D","E",};
- HypersonicEnvironment.executeDdlFile(new File("src/sql/hypersonic_cyclic.sql"),
+ HypersonicEnvironment.executeDdlFile(TestUtils.getFile("sql/hypersonic_cyclic.sql"),
_jdbcConnection);
IDatabaseConnection connection = new DatabaseConnection(_jdbcConnection);
@@ -117,7 +118,7 @@
String[] expectedNoFilter = {"MixedCaseTable","UPPER_CASE_TABLE"};
String[] expectedFiltered = {"MixedCaseTable","UPPER_CASE_TABLE"};
- HypersonicEnvironment.executeDdlFile(new File("src/sql/hypersonic_case_sensitive_test.sql"),
+ HypersonicEnvironment.executeDdlFile(TestUtils.getFile("sql/hypersonic_case_sensitive_test.sql"),
_jdbcConnection);
IDatabaseConnection connection = new DatabaseConnection(_jdbcConnection);
@@ -143,7 +144,7 @@
public void testMultiSchemaFks() throws Exception
{
Connection jdbcConnection = H2Environment.createJdbcConnection("test");
- H2Environment.executeDdlFile(new File("src/sql/h2_multischema_fk_test.sql"), jdbcConnection);
+ H2Environment.executeDdlFile(TestUtils.getFile("sql/h2_multischema_fk_test.sql"), jdbcConnection);
IDatabaseConnection connection = new DatabaseConnection(jdbcConnection);
connection.getConfig().setProperty(DatabaseConfig.FEATURE_QUALIFIED_TABLE_NAMES, Boolean.TRUE);
Modified: trunk/dbunit/src/test/org/dbunit/database/DatabaseTableMetaDataIT.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/database/DatabaseTableMetaDataIT.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/database/DatabaseTableMetaDataIT.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -42,6 +42,7 @@
import org.dbunit.dataset.datatype.DataTypeException;
import org.dbunit.dataset.datatype.DefaultDataTypeFactory;
import org.dbunit.dataset.datatype.IDataTypeFactory;
+import org.dbunit.testutil.TestUtils;
/**
* @author Manuel Laflamme
@@ -275,7 +276,7 @@
public void testGetColumnsForTablesMatchingSamePattern() throws Exception
{
Connection jdbcConnection = HypersonicEnvironment.createJdbcConnection("tempdb");
- HypersonicEnvironment.executeDdlFile(new File("src/sql/hypersonic_dataset_pattern_test.sql"),
+ HypersonicEnvironment.executeDdlFile(TestUtils.getFile("sql/hypersonic_dataset_pattern_test.sql"),
jdbcConnection);
IDatabaseConnection connection = new DatabaseConnection(jdbcConnection);
@@ -304,7 +305,7 @@
public void testCaseSensitive() throws Exception
{
Connection jdbcConnection = HypersonicEnvironment.createJdbcConnection("tempdb");
- HypersonicEnvironment.executeDdlFile(new File("src/sql/hypersonic_case_sensitive_test.sql"),
+ HypersonicEnvironment.executeDdlFile(TestUtils.getFile("sql/hypersonic_case_sensitive_test.sql"),
jdbcConnection);
IDatabaseConnection connection = new DatabaseConnection(jdbcConnection);
Modified: trunk/dbunit/src/test/org/dbunit/database/ResultSetTableMetaDataIT.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/database/ResultSetTableMetaDataIT.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/database/ResultSetTableMetaDataIT.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -8,6 +8,7 @@
import org.dbunit.dataset.Column;
import org.dbunit.dataset.Columns;
import org.dbunit.dataset.IDataSet;
+import org.dbunit.testutil.TestUtils;
/**
* @author gommma (gommma AT users.sourceforge.net)
@@ -36,7 +37,7 @@
public void testGetColumnsForTablesMatchingSamePattern() throws Exception
{
Connection jdbcConnection = HypersonicEnvironment.createJdbcConnection("tempdb");
- HypersonicEnvironment.executeDdlFile(new File("src/sql/hypersonic_dataset_pattern_test.sql"),
+ HypersonicEnvironment.executeDdlFile(TestUtils.getFile("sql/hypersonic_dataset_pattern_test.sql"),
jdbcConnection);
IDatabaseConnection connection = new DatabaseConnection(jdbcConnection);
Modified: trunk/dbunit/src/test/org/dbunit/database/search/AbstractMetaDataBasedSearchCallbackTestCase.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/database/search/AbstractMetaDataBasedSearchCallbackTestCase.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/database/search/AbstractMetaDataBasedSearchCallbackTestCase.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -31,6 +31,7 @@
import org.dbunit.database.IDatabaseConnection;
import org.dbunit.HypersonicEnvironment;
+import org.dbunit.testutil.TestUtils;
import org.dbunit.util.CollectionsHelper;
import org.dbunit.util.search.DepthFirstSearch;
import org.dbunit.util.search.ISearchCallback;
@@ -55,8 +56,10 @@
protected void setUp() throws Exception {
this.jdbcConnection = HypersonicEnvironment.createJdbcConnection("mem:tempdb");
- HypersonicEnvironment.executeDdlFile(new File(
- "src/sql/" + this.sqlFile), this.jdbcConnection);
+ HypersonicEnvironment.executeDdlFile(
+ TestUtils.getFile("sql/" + this.sqlFile),
+ this.jdbcConnection
+ );
this.connection = new DatabaseConnection(jdbcConnection);
}
Modified: trunk/dbunit/src/test/org/dbunit/database/search/TablesDependencyHelperTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/database/search/TablesDependencyHelperTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/database/search/TablesDependencyHelperTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -34,6 +34,7 @@
import org.dbunit.database.PrimaryKeyFilter.PkTableMap;
import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.NoSuchTableException;
+import org.dbunit.testutil.TestUtils;
import org.dbunit.util.search.SearchException;
/**
@@ -56,7 +57,7 @@
protected void setUp( String[] sqlFileList ) throws Exception {
this.jdbcConnection = HypersonicEnvironment.createJdbcConnection("mem:tempdb");
for (int i = 0; i < sqlFileList.length; i++) {
- File sql = new File("src/sql/" + sqlFileList[i]);
+ File sql = TestUtils.getFile("sql/" + sqlFileList[i]);
HypersonicEnvironment.executeDdlFile(sql, this.jdbcConnection);
}
this.connection = new DatabaseConnection(jdbcConnection);
Modified: trunk/dbunit/src/test/org/dbunit/dataset/CaseInsensitiveDataSetTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/dataset/CaseInsensitiveDataSetTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/dataset/CaseInsensitiveDataSetTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -24,6 +24,7 @@
import java.io.FileReader;
import org.dbunit.dataset.xml.XmlDataSet;
+import org.dbunit.testutil.TestUtils;
/**
* @author Manuel Laflamme
@@ -40,8 +41,8 @@
protected IDataSet createDataSet() throws Exception
{
- return new CaseInsensitiveDataSet(new XmlDataSet(new FileReader(
- "src/xml/caseInsensitiveDataSetTest.xml")));
+ return new CaseInsensitiveDataSet(new XmlDataSet(TestUtils.getFileReader(
+ "xml/caseInsensitiveDataSetTest.xml")));
}
protected IDataSet createDuplicateDataSet() throws Exception
Modified: trunk/dbunit/src/test/org/dbunit/dataset/CaseInsensitiveTableTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/dataset/CaseInsensitiveTableTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/dataset/CaseInsensitiveTableTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -23,6 +23,7 @@
import org.dbunit.dataset.xml.XmlDataSet;
import org.dbunit.dataset.xml.XmlTableTest;
+import org.dbunit.testutil.TestUtils;
import java.io.File;
import java.io.FileReader;
@@ -48,7 +49,7 @@
protected IDataSet createDataSet() throws Exception
{
Reader in = new FileReader(
- new File("src/xml/caseInsensitiveTableTest.xml"));
+ TestUtils.getFile("xml/caseInsensitiveTableTest.xml"));
return new XmlDataSet(in);
}
Modified: trunk/dbunit/src/test/org/dbunit/dataset/CompositeDataSetIterationTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/dataset/CompositeDataSetIterationTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/dataset/CompositeDataSetIterationTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -37,6 +37,7 @@
import org.dbunit.dataset.DefaultTable;
import org.dbunit.dataset.datatype.DataType;
import org.dbunit.dataset.xml.FlatXmlDataSet;
+import org.dbunit.testutil.TestUtils;
/**
@@ -54,7 +55,7 @@
protected void setUp() throws Exception {
super.setUp();
this.jdbcConnection = HypersonicEnvironment.createJdbcConnection("mem:tempdb");
- HypersonicEnvironment.executeDdlFile(new File("src/sql/" + sqlFile), jdbcConnection);
+ HypersonicEnvironment.executeDdlFile(TestUtils.getFile("sql/" + sqlFile), jdbcConnection);
this.connection = new DatabaseConnection(jdbcConnection);
}
Modified: trunk/dbunit/src/test/org/dbunit/dataset/CompositeDataSetTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/dataset/CompositeDataSetTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/dataset/CompositeDataSetTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -27,6 +27,7 @@
import org.dbunit.dataset.xml.FlatXmlDataSetBuilder;
import org.dbunit.dataset.xml.XmlDataSet;
+import org.dbunit.testutil.TestUtils;
/**
* @author Manuel Laflamme
@@ -44,12 +45,12 @@
protected IDataSet createDataSet() throws Exception
{
IDataSet dataSet1 = new XmlDataSet(
- new FileReader("src/xml/compositeDataSetTest1.xml"));
+ TestUtils.getFileReader("xml/compositeDataSetTest1.xml"));
assertTrue("count before combine (1)",
dataSet1.getTableNames().length < getExpectedNames().length);
IDataSet dataSet2 = new XmlDataSet(
- new FileReader("src/xml/compositeDataSetTest2.xml"));
+ TestUtils.getFileReader("xml/compositeDataSetTest2.xml"));
assertTrue("count before combine (2)",
dataSet2.getTableNames().length < getExpectedNames().length);
@@ -81,12 +82,12 @@
throws DataSetException, FileNotFoundException, IOException
{
IDataSet dataSet1 = new FlatXmlDataSetBuilder().build(
- new FileReader("src/xml/compositeDataSetDuplicateTest1.xml"));
+ TestUtils.getFileReader("xml/compositeDataSetDuplicateTest1.xml"));
assertTrue("count before combine (1)",
dataSet1.getTableNames().length < getExpectedDuplicateNames().length);
IDataSet dataSet2 = new FlatXmlDataSetBuilder().build(
- new FileReader("src/xml/compositeDataSetDuplicateTest2.xml"));
+ TestUtils.getFileReader("xml/compositeDataSetDuplicateTest2.xml"));
assertTrue("count before combine (2)",
dataSet2.getTableNames().length < getExpectedDuplicateNames().length);
Modified: trunk/dbunit/src/test/org/dbunit/dataset/DataSetProducerAdapterTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/dataset/DataSetProducerAdapterTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/dataset/DataSetProducerAdapterTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -25,6 +25,7 @@
import org.dbunit.dataset.stream.IDataSetProducer;
import org.dbunit.dataset.xml.FlatXmlDataSet;
import org.dbunit.dataset.xml.FlatXmlDataSetBuilder;
+import org.dbunit.testutil.TestUtils;
import java.io.File;
@@ -36,7 +37,7 @@
public class DataSetProducerAdapterTest extends AbstractProducerTest
{
private static final File DATASET_FILE =
- new File("src/xml/flatXmlProducerTest.xml");
+ TestUtils.getFile("xml/flatXmlProducerTest.xml");
public DataSetProducerAdapterTest(String s)
{
Modified: trunk/dbunit/src/test/org/dbunit/dataset/DefaultDataSetTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/dataset/DefaultDataSetTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/dataset/DefaultDataSetTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -23,6 +23,7 @@
import org.dbunit.database.AmbiguousTableNameException;
import org.dbunit.dataset.xml.XmlDataSet;
+import org.dbunit.testutil.TestUtils;
import java.io.FileReader;
@@ -41,7 +42,7 @@
protected IDataSet createDataSet() throws Exception
{
IDataSet dataSet = new XmlDataSet(
- new FileReader("src/xml/dataSetTest.xml"));
+ TestUtils.getFileReader("xml/dataSetTest.xml"));
ITable[] tables = DataSetUtils.getTables(dataSet);
return new DefaultDataSet(tables);
Modified: trunk/dbunit/src/test/org/dbunit/dataset/FilteredDataSetTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/dataset/FilteredDataSetTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/dataset/FilteredDataSetTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -24,6 +24,7 @@
import java.io.FileReader;
import org.dbunit.dataset.xml.XmlDataSet;
+import org.dbunit.testutil.TestUtils;
/**
* @author Manuel Laflamme
@@ -40,9 +41,9 @@
protected IDataSet createDataSet() throws Exception
{
IDataSet dataSet1 = new XmlDataSet(
- new FileReader("src/xml/dataSetTest.xml"));
+ TestUtils.getFileReader("xml/dataSetTest.xml"));
IDataSet dataSet2 = new XmlDataSet(
- new FileReader("src/xml/filteredDataSetTest.xml"));
+ TestUtils.getFileReader("xml/filteredDataSetTest.xml"));
IDataSet dataSet = new CompositeDataSet(dataSet1, dataSet2);
assertEquals("count before filter", getExpectedNames().length + 1,
@@ -53,9 +54,9 @@
protected IDataSet createDuplicateDataSet() throws Exception
{
IDataSet dataSet1 = new XmlDataSet(
- new FileReader("src/xml/xmlDataSetDuplicateTest.xml"));
+ TestUtils.getFileReader("xml/xmlDataSetDuplicateTest.xml"));
IDataSet dataSet2 = new XmlDataSet(
- new FileReader("src/xml/filteredDataSetTest.xml"));
+ TestUtils.getFileReader("xml/filteredDataSetTest.xml"));
assertEquals(2, dataSet1.getTableNames().length);
assertEquals(1, dataSet2.getTableNames().length);
Modified: trunk/dbunit/src/test/org/dbunit/dataset/ReplacementTableTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/dataset/ReplacementTableTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/dataset/ReplacementTableTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -20,7 +20,6 @@
*/
package org.dbunit.dataset;
-import java.io.File;
import java.math.BigDecimal;
import java.sql.Date;
@@ -30,6 +29,7 @@
import org.dbunit.dataset.datatype.DataType;
import org.dbunit.dataset.xml.FlatXmlDataSet;
import org.dbunit.dataset.xml.FlatXmlDataSetBuilder;
+import org.dbunit.testutil.TestUtils;
/**
*
@@ -51,7 +51,7 @@
private IDataSet createDataSet() throws Exception
{
- FlatXmlDataSet fds = new FlatXmlDataSetBuilder().build(new File("src/xml/flatXmlTableTest.xml"));
+ FlatXmlDataSet fds = new FlatXmlDataSetBuilder().build(TestUtils.getFile("xml/flatXmlTableTest.xml"));
return new ReplacementDataSet(fds);
}
Modified: trunk/dbunit/src/test/org/dbunit/dataset/RowFilterTableTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/dataset/RowFilterTableTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/dataset/RowFilterTableTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -6,6 +6,7 @@
import org.dbunit.dataset.filter.IRowFilter;
import org.dbunit.dataset.xml.FlatXmlDataSetBuilder;
+import org.dbunit.testutil.TestUtils;
/**
* @author gommma
@@ -16,8 +17,8 @@
private IDataSet getDataSet() throws Exception
{
- return new FlatXmlDataSetBuilder().build(new FileReader(
- "src/xml/rowFilterTableTest.xml"));
+ return new FlatXmlDataSetBuilder().build(TestUtils.getFileReader(
+ "xml/rowFilterTableTest.xml"));
}
Modified: trunk/dbunit/src/test/org/dbunit/dataset/SortedDataSetTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/dataset/SortedDataSetTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/dataset/SortedDataSetTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -24,6 +24,7 @@
import java.io.FileReader;
import org.dbunit.dataset.xml.FlatXmlDataSetBuilder;
+import org.dbunit.testutil.TestUtils;
/**
* @author Manuel Laflamme
@@ -40,7 +41,7 @@
protected IDataSet createDataSet() throws Exception
{
IDataSet dataSet = new FlatXmlDataSetBuilder().build(
- new FileReader("src/xml/sortedDataSetTest.xml"));
+ TestUtils.getFileReader("xml/sortedDataSetTest.xml"));
return new SortedDataSet(dataSet);
}
Modified: trunk/dbunit/src/test/org/dbunit/dataset/SortedTableTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/dataset/SortedTableTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/dataset/SortedTableTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -26,6 +26,7 @@
import org.dbunit.dataset.datatype.DataType;
import org.dbunit.dataset.xml.FlatXmlDataSetBuilder;
+import org.dbunit.testutil.TestUtils;
/**
* @author Manuel Laflamme
@@ -33,7 +34,7 @@
*/
public class SortedTableTest extends AbstractTableTest
{
- private File sortedTableTestFile = new File("src/xml/sortedTableTest.xml");
+ private File sortedTableTestFile = TestUtils.getFile("xml/sortedTableTest.xml");
public SortedTableTest(String s)
{
Modified: trunk/dbunit/src/test/org/dbunit/dataset/csv/CsvDataSetTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/dataset/csv/CsvDataSetTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/dataset/csv/CsvDataSetTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -32,6 +32,7 @@
import org.dbunit.dataset.DataSetUtils;
import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.ITable;
+import org.dbunit.testutil.TestUtils;
import org.dbunit.util.FileHelper;
/**
@@ -40,7 +41,7 @@
* @since Sep 12, 2004 (pre 2.3)
*/
public class CsvDataSetTest extends TestCase {
- protected static final File DATASET_DIR = new File("src/csv/orders");
+ protected static final File DATASET_DIR = TestUtils.getFile("csv/orders");
public CsvDataSetTest(String s) {
super(s);
Modified: trunk/dbunit/src/test/org/dbunit/dataset/csv/CsvDataSetWriterTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/dataset/csv/CsvDataSetWriterTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/dataset/csv/CsvDataSetWriterTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -5,6 +5,7 @@
import org.dbunit.dataset.CachedDataSet;
import org.dbunit.dataset.DataSetException;
import org.dbunit.dataset.IDataSet;
+import org.dbunit.testutil.TestUtils;
import java.io.File;
@@ -19,7 +20,7 @@
*/
public class CsvDataSetWriterTest extends TestCase {
private static final String DEST = "target/csv/orders-out";
- private static final String SOURCE = "src/csv/orders";
+ private static final String SOURCE = TestUtils.getFileName("csv/orders");
public void testProduceAndWriteBackToDisk () throws Exception {
produceToFolder (SOURCE, DEST);
Modified: trunk/dbunit/src/test/org/dbunit/dataset/csv/CsvParserTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/dataset/csv/CsvParserTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/dataset/csv/CsvParserTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -33,8 +33,8 @@
import org.dbunit.dataset.common.handlers.IllegalInputCharacterException;
import org.dbunit.dataset.common.handlers.PipelineException;
+import org.dbunit.testutil.TestUtils;
-
public class CsvParserTest extends TestCase {
CsvParser parser;
@@ -89,8 +89,8 @@
}
public void testAFileCanContainFieldWithNewLine () throws IOException, CsvParserException {
- final String pathname = "src/csv/with-newlines.csv";
- List list = parser.parse(new File(pathname));
+ final String pathname = "csv/with-newlines.csv";
+ List list = parser.parse(TestUtils.getFile(pathname));
assertEquals("wrong number of lines parsed from " + pathname, 2, list.size());
List row = (List) list.get(1);
assertEquals("AA\nAAA", row.get(0));
@@ -98,12 +98,12 @@
}
public void testRaiseACSVParserExceptonWhenParsingAnEmptyFile () throws IOException {
- failParsing(new File("src/csv/empty-file.csv"));
+ failParsing(TestUtils.getFile("csv/empty-file.csv"));
}
public void testRaiseACSVParserExceptonWhenParsingFileWithDifferentNumberOfColumns () throws IllegalInputCharacterException, IOException, PipelineException {
- failParsing(new File("src/csv/different-column-numbers-last.csv"));
- failParsing(new File("src/csv/different-column-numbers-first.csv"));
+ failParsing(TestUtils.getFile("csv/different-column-numbers-last.csv"));
+ failParsing(TestUtils.getFile("csv/different-column-numbers-first.csv"));
}
private void failParsing(File sample) throws IOException {
@@ -117,7 +117,7 @@
public void testSample() throws Exception {
- File sample = new File("src/csv/sample.csv");
+ File sample = TestUtils.getFile("csv/sample.csv");
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(sample)));
LineNumberReader lineNumberReader = new LineNumberReader(reader);
String line;
@@ -142,7 +142,7 @@
assertEquals(2, parsed.size());
assertEquals("Hello", parsed.get(0));
assertEquals("world", parsed.get(1));
- csv = "\" Hello, \",\" world \"";;
+ csv = "\" Hello, \",\" world \"";
parsed = parser.parse(csv);
assertEquals(2, parsed.size());
assertEquals(" Hello, ", parsed.get(0));
Modified: trunk/dbunit/src/test/org/dbunit/dataset/csv/CsvProducerTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/dataset/csv/CsvProducerTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/dataset/csv/CsvProducerTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -34,6 +34,7 @@
import org.dbunit.dataset.DataSetException;
import org.dbunit.dataset.ITable;
import org.dbunit.operation.DatabaseOperation;
+import org.dbunit.testutil.TestUtils;
import org.dbunit.util.FileHelper;
import java.io.File;
@@ -52,7 +53,7 @@
private IDatabaseConnection connection;
private static final int ORDERS_ROWS_NUMBER = 5;
private static final int ORDERS_ROW_ROWS_NUMBER = 3;
- private static final String THE_DIRECTORY = "src/csv/orders";
+ private static final String THE_DIRECTORY = TestUtils.getFileName("csv/orders");
public void testProduceFromFolder() throws DataSetException {
CsvProducer producer = new CsvProducer(THE_DIRECTORY);
@@ -150,7 +151,7 @@
protected void setUp() throws Exception {
Properties properties = new Properties();
- final FileInputStream inStream = new FileInputStream("src/csv/cvs-tests.properties");
+ final FileInputStream inStream = TestUtils.getFileInputStream("csv/cvs-tests.properties");
properties.load(inStream);
inStream.close();
driverClass = properties.getProperty("cvs-tests.driver.class");
Modified: trunk/dbunit/src/test/org/dbunit/dataset/csv/CsvURLDataSetTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/dataset/csv/CsvURLDataSetTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/dataset/csv/CsvURLDataSetTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -30,6 +30,7 @@
import org.dbunit.dataset.DataSetException;
import org.dbunit.dataset.ITable;
+import org.dbunit.testutil.TestUtils;
/**
* @author Lenny Marks (le...@ap...)
@@ -44,7 +45,7 @@
}
public void testNullColumns() throws DataSetException, MalformedURLException {
- URL csvDir = new File("src/csv/orders/").toURL();
+ URL csvDir = TestUtils.getFile("csv/orders/").toURL();
CsvURLDataSet dataSet = new CsvURLDataSet(csvDir);
ITable table = dataSet.getTable("orders");
@@ -52,7 +53,7 @@
}
public void testSpacesInColumns() throws DataSetException, MalformedURLException {
- URL csvDir = new File("src/csv/accounts/").toURL();
+ URL csvDir = TestUtils.getFile("csv/accounts/").toURL();
CsvURLDataSet dataSet = new CsvURLDataSet(csvDir);
ITable table = dataSet.getTable("accounts");
Modified: trunk/dbunit/src/test/org/dbunit/dataset/csv/CsvURLProducerTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/dataset/csv/CsvURLProducerTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/dataset/csv/CsvURLProducerTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -46,6 +46,7 @@
import org.dbunit.dataset.DataSetException;
import org.dbunit.dataset.ITable;
import org.dbunit.operation.DatabaseOperation;
+import org.dbunit.testutil.TestUtils;
import org.dbunit.util.FileHelper;
public class CsvURLProducerTest extends TestCase {
@@ -56,15 +57,15 @@
private IDatabaseConnection connection;
private static final int ORDERS_ROWS_NUMBER = 5;
private static final int ORDERS_ROW_ROWS_NUMBER = 3;
- private static final String THE_DIRECTORY = "src/csv/orders";
+ private static final String THE_DIRECTORY = "csv/orders";
public void testProduceFromFolder() throws DataSetException, MalformedURLException {
- CsvURLProducer producer = new CsvURLProducer(new File(THE_DIRECTORY).toURL(), CsvDataSet.TABLE_ORDERING_FILE);
+ CsvURLProducer producer = new CsvURLProducer(TestUtils.getFile(THE_DIRECTORY).toURL(), CsvDataSet.TABLE_ORDERING_FILE);
doTestWithProducer(producer);
}
public void testProduceFromJar() throws DataSetException, IOException {
- File file = new File(THE_DIRECTORY + "/orders.jar");
+ File file = TestUtils.getFile(THE_DIRECTORY + "/orders.jar");
URL jarFile = new URL("jar:" + file.toURL() + "!/");
CsvURLProducer producer = new CsvURLProducer(jarFile, CsvDataSet.TABLE_ORDERING_FILE);
doTestWithProducer(producer);
@@ -104,7 +105,7 @@
}
private void produceAndInsertToDatabase() throws DatabaseUnitException, SQLException, MalformedURLException {
- CsvURLProducer producer = new CsvURLProducer(new File(THE_DIRECTORY).toURL(), CsvDataSet.TABLE_ORDERING_FILE);
+ CsvURLProducer producer = new CsvURLProducer(TestUtils.getFile(THE_DIRECTORY).toURL(), CsvDataSet.TABLE_ORDERING_FILE);
CachedDataSet consumer = new CachedDataSet();
producer.setConsumer(consumer);
producer.produce();
@@ -115,7 +116,7 @@
public void testInsertOperationWithCsvFormat() throws SQLException, DatabaseUnitException {
Operation operation = new Operation();
operation.setFormat(AbstractStep.FORMAT_CSV);
- operation.setSrc(new File(THE_DIRECTORY));
+ operation.setSrc(TestUtils.getFile(THE_DIRECTORY));
operation.setType("INSERT");
operation.execute(connection);
Statement statement = connection.getConnection().createStatement();
@@ -167,7 +168,7 @@
protected void setUp() throws Exception {
Properties properties = new Properties();
- final FileInputStream inStream = new FileInputStream("src/csv/cvs-tests.properties");
+ final FileInputStream inStream = TestUtils.getFileInputStream("csv/cvs-tests.properties");
properties.load(inStream);
inStream.close();
driverClass = properties.getProperty("cvs-tests.driver.class");
Modified: trunk/dbunit/src/test/org/dbunit/dataset/excel/XlsDataSetTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/dataset/excel/XlsDataSetTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/dataset/excel/XlsDataSetTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -33,6 +33,7 @@
import org.dbunit.dataset.DataSetUtils;
import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.ITable;
+import org.dbunit.testutil.TestUtils;
/**
* @author Manuel Laflamme
@@ -48,13 +49,13 @@
protected IDataSet createDataSet() throws Exception
{
- return new XlsDataSet(new File("src/xml/dataSetTest.xls"));
+ return new XlsDataSet(TestUtils.getFile("xml/dataSetTest.xls"));
}
protected IDataSet createDuplicateDataSet() throws Exception
{
return new XlsDataSet(
- new File("src/xml/dataSetDuplicateTest.xls"));
+ TestUtils.getFile("xml/dataSetDuplicateTest.xls"));
}
protected IDataSet createMultipleCaseDuplicateDataSet() throws Exception
@@ -122,7 +123,7 @@
public void testColumnNameWithSpace() throws Exception
{
- IDataSet dataSet = new XlsDataSet(new FileInputStream("./src/xml/contactor.xls"));
+ IDataSet dataSet = new XlsDataSet(TestUtils.getFileInputStream("xml/contactor.xls"));
ITable customerTable = dataSet.getTable("customer");
Column column = Columns.getColumn("name", customerTable.getTableMetaData().getColumns());
assertNotNull(column);
Modified: trunk/dbunit/src/test/org/dbunit/dataset/excel/XlsTableTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/dataset/excel/XlsTableTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/dataset/excel/XlsTableTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -29,6 +29,7 @@
import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.ITable;
import org.dbunit.dataset.datatype.DataType;
+import org.dbunit.testutil.TestUtils;
/**
* @author Manuel Laflamme
@@ -56,7 +57,7 @@
protected IDataSet createDataSet() throws Exception
{
- return new XlsDataSet(new File("src/xml/tableTest.xls"));
+ return new XlsDataSet(TestUtils.getFile("xml/tableTest.xls"));
}
public void testGetMissingValue() throws Exception
Modified: trunk/dbunit/src/test/org/dbunit/dataset/filter/AbstractTableFilterTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/dataset/filter/AbstractTableFilterTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/dataset/filter/AbstractTableFilterTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -22,6 +22,7 @@
import org.dbunit.dataset.*;
import org.dbunit.dataset.xml.XmlDataSet;
+import org.dbunit.testutil.TestUtils;
import java.io.FileReader;
@@ -42,7 +43,7 @@
protected IDataSet createDataSet() throws Exception
{
IDataSet dataSet1 = new XmlDataSet(
- new FileReader("src/xml/dataSetTest.xml"));
+ TestUtils.getFileReader("xml/dataSetTest.xml"));
IDataSet dataSet2 = new DefaultDataSet(
new DefaultTable(getExtraTableName()));
@@ -55,7 +56,7 @@
protected IDataSet createDuplicateDataSet() throws Exception
{
IDataSet dataSet1 = new XmlDataSet(
- new FileReader("src/xml/xmlDataSetDuplicateTest.xml"));
+ TestUtils.getFileReader("xml/xmlDataSetDuplicateTest.xml"));
IDataSet dataSet2 = new DefaultDataSet(
new DefaultTable(getExtraTableName()));
Modified: trunk/dbunit/src/test/org/dbunit/dataset/sqlloader/SqlLoaderCsvDataSetTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/dataset/sqlloader/SqlLoaderCsvDataSetTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/dataset/sqlloader/SqlLoaderCsvDataSetTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -27,6 +27,7 @@
import org.dbunit.dataset.DataSetException;
import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.ITable;
+import org.dbunit.testutil.TestUtils;
/**
* @author Stephan Strittmatter (stritti AT users.sourceforge.net)
@@ -46,7 +47,7 @@
protected IDataSet getDataSet() throws DataSetException {
SqlLoaderControlDataSet loadedDataSet =
- new SqlLoaderControlDataSet(new File("src/sqlloader"), new File("src/sqlloader/tables.lst"));
+ new SqlLoaderControlDataSet(TestUtils.getFile("sqlloader"), TestUtils.getFile("sqlloader/tables.lst"));
return loadedDataSet;
}
Modified: trunk/dbunit/src/test/org/dbunit/dataset/xml/FlatDtdDataSetIT.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/dataset/xml/FlatDtdDataSetIT.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/dataset/xml/FlatDtdDataSetIT.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -32,6 +32,7 @@
import org.dbunit.dataset.FilteredDataSet;
import org.dbunit.dataset.IDataSet;
import org.dbunit.testutil.FileAsserts;
+import org.dbunit.testutil.TestUtils;
/**
* @author Manuel Laflamme
@@ -41,11 +42,11 @@
public class FlatDtdDataSetIT extends AbstractDataSetTest
{
private static final String DTD_FILE =
- "src/dtd/flatDtdDataSetTest.dtd";
+ "dtd/flatDtdDataSetTest.dtd";
private static final String DUPLICATE_FILE =
- "src/dtd/flatDtdDataSetDuplicateTest.dtd";
+ "dtd/flatDtdDataSetDuplicateTest.dtd";
private static final String DUPLICATE_MULTIPLE_CASE_FILE =
- "src/dtd/flatDtdDataSetDuplicateMultipleCaseTest.dtd";
+ "dtd/flatDtdDataSetDuplicateMultipleCaseTest.dtd";
public FlatDtdDataSetIT(String s)
{
@@ -57,22 +58,22 @@
private File getFile(String fileName) throws Exception
{
- return DatabaseEnvironment.getInstance().getFile(fileName);
+ return TestUtils.getFileForDatabaseEnvironment(TestUtils.getFileName(fileName));
}
protected IDataSet createDataSet() throws Exception
{
- return new FlatDtdDataSet(new FileReader(DTD_FILE));
+ return new FlatDtdDataSet(TestUtils.getFileReader(DTD_FILE));
}
protected IDataSet createDuplicateDataSet() throws Exception
{
- return new FlatDtdDataSet(new FileReader(DUPLICATE_FILE));
+ return new FlatDtdDataSet(TestUtils.getFileReader(DUPLICATE_FILE));
}
protected IDataSet createMultipleCaseDuplicateDataSet() throws Exception
{
- return new FlatDtdDataSet(new FileReader(DUPLICATE_MULTIPLE_CASE_FILE));
+ return new FlatDtdDataSet(TestUtils.getFileReader(DUPLICATE_MULTIPLE_CASE_FILE));
}
protected int[] getExpectedDuplicateRows()
@@ -85,7 +86,7 @@
public void testWriteFromDtd() throws Exception
{
- IDataSet dataSet = new FlatDtdDataSet(new FileReader(DTD_FILE));
+ IDataSet dataSet = new FlatDtdDataSet(TestUtils.getFileReader(DTD_FILE));
File tempFile = File.createTempFile("flatXmlDocType", ".dtd");
@@ -104,7 +105,7 @@
}
FileAsserts.assertEquals(
- new BufferedReader(new FileReader(DTD_FILE)),
+ new BufferedReader(TestUtils.getFileReader(DTD_FILE)),
new BufferedReader(new FileReader(tempFile)));
}
finally
Modified: trunk/dbunit/src/test/org/dbunit/dataset/xml/FlatDtdProducerTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/dataset/xml/FlatDtdProducerTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/dataset/xml/FlatDtdProducerTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -25,6 +25,7 @@
import org.dbunit.dataset.stream.AbstractProducerTest;
import org.dbunit.dataset.stream.IDataSetProducer;
import org.dbunit.dataset.stream.MockDataSetConsumer;
+import org.dbunit.testutil.TestUtils;
import org.xml.sax.InputSource;
import java.io.File;
@@ -41,7 +42,7 @@
public class FlatDtdProducerTest extends AbstractProducerTest
{
private static final File DTD_FILE =
- new File("src/dtd/flatDtdProducerTest.dtd");
+ TestUtils.getFile("dtd/flatDtdProducerTest.dtd");
public FlatDtdProducerTest(String s)
{
Modified: trunk/dbunit/src/test/org/dbunit/dataset/xml/FlatXmlDataSetTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/dataset/xml/FlatXmlDataSetTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/dataset/xml/FlatXmlDataSetTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -34,6 +34,7 @@
import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.ITable;
import org.dbunit.dataset.ITableMetaData;
+import org.dbunit.testutil.TestUtils;
/**
* @author Manuel Laflamme
@@ -43,17 +44,17 @@
public class FlatXmlDataSetTest extends AbstractDataSetTest
{
public static final File DATASET_FILE =
- new File("src/xml/flatXmlDataSetTest.xml");
+ TestUtils.getFile("xml/flatXmlDataSetTest.xml");
public static final File DUPLICATE_DATASET_FILE =
- new File("src/xml/flatXmlDataSetDuplicateTest.xml");
+ TestUtils.getFile("xml/flatXmlDataSetDuplicateTest.xml");
public static final File DUPLICATE_DATASET_MULTIPLE_CASE_FILE =
- new File("src/xml/flatXmlDataSetDuplicateMultipleCaseTest.xml");
+ TestUtils.getFile("xml/flatXmlDataSetDuplicateMultipleCaseTest.xml");
private static final File FLAT_XML_TABLE =
- new File("src/xml/flatXmlTableTest.xml");
+ TestUtils.getFile("xml/flatXmlTableTest.xml");
private static final File FLAT_XML_DTD_DIFFERENT_CASE_FILE =
- new File("src/xml/flatXmlDataSetDtdDifferentCaseTest.xml");
+ TestUtils.getFile("xml/flatXmlDataSetDtdDifferentCaseTest.xml");
public FlatXmlDataSetTest(String s)
{
Modified: trunk/dbunit/src/test/org/dbunit/dataset/xml/FlatXmlProducerTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/dataset/xml/FlatXmlProducerTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/dataset/xml/FlatXmlProducerTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -27,6 +27,7 @@
import org.dbunit.dataset.stream.AbstractProducerTest;
import org.dbunit.dataset.stream.IDataSetProducer;
import org.dbunit.dataset.stream.MockDataSetConsumer;
+import org.dbunit.testutil.TestUtils;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
@@ -44,7 +45,7 @@
public class FlatXmlProducerTest extends AbstractProducerTest
{
private static final File DATASET_FILE =
- new File("src/xml/flatXmlProducerTest.xml");
+ TestUtils.getFile("xml/flatXmlProducerTest.xml");
public FlatXmlProducerTest(String s)
{
Modified: trunk/dbunit/src/test/org/dbunit/dataset/xml/FlatXmlTableTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/dataset/xml/FlatXmlTableTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/dataset/xml/FlatXmlTableTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -25,6 +25,7 @@
import org.dbunit.dataset.Column;
import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.ITable;
+import org.dbunit.testutil.TestUtils;
import java.io.File;
@@ -47,7 +48,7 @@
protected IDataSet createDataSet(boolean noneAsNull) throws Exception
{
- return new FlatXmlDataSetBuilder().build(new File("src/xml/flatXmlTableTest.xml"));
+ return new FlatXmlDataSetBuilder().build(TestUtils.getFile("xml/flatXmlTableTest.xml"));
}
public void testGetMissingValue() throws Exception
Modified: trunk/dbunit/src/test/org/dbunit/dataset/xml/XmlDataSetTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/dataset/xml/XmlDataSetTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/dataset/xml/XmlDataSetTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -34,6 +34,7 @@
import org.dbunit.dataset.DataSetUtils;
import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.ITable;
+import org.dbunit.testutil.TestUtils;
/**
* @author Manuel Laflamme
@@ -51,21 +52,21 @@
protected IDataSet createDataSet() throws Exception
{
Reader in = new FileReader(
- new File("src/xml/dataSetTest.xml"));
+ TestUtils.getFile("xml/dataSetTest.xml"));
return new XmlDataSet(in);
}
protected IDataSet createDuplicateDataSet() throws Exception
{
InputStream in = new FileInputStream(
- new File("src/xml/xmlDataSetDuplicateTest.xml"));
+ TestUtils.getFile("xml/xmlDataSetDuplicateTest.xml"));
return new XmlDataSet(in);
}
protected IDataSet createMultipleCaseDuplicateDataSet() throws Exception
{
InputStream in = new FileInputStream(
- new File("src/xml/xmlDataSetDuplicateMultipleCaseTest.xml"));
+ TestUtils.getFile("xml/xmlDataSetDuplicateMultipleCaseTest.xml"));
return new XmlDataSet(in);
}
Modified: trunk/dbunit/src/test/org/dbunit/dataset/xml/XmlProducerTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/dataset/xml/XmlProducerTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ trunk/dbunit/src/test/org/dbunit/dataset/xml/XmlProducerTest.java 2010-02-11 23:29:37 UTC (rev 1162)
@@ -26,6 +26,7 @@
import org.dbunit.dataset.stream.AbstractProducerTest;
import org.dbunit.dataset.stream.IDataSetProducer;
import org.dbunit.dataset.stream.MockDataSetConsumer;
+import org.dbunit.testutil.TestUtils;
import org.xml.sax.InputSource;
import java.io.File;
@@ -39,7 +40,7 @@
public class XmlProducerTest extends AbstractProducerTest
{
private static final File DATASET_FILE =
- new File("src/xml/xmlProducerTest.xml");
+ TestUtils.getFile("xml/xmlProducerTest.xml");
public XmlProducerTest(String s)
{
Modified: trunk/dbunit/src/test/org/dbunit/dataset/xml/XmlTableTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/dataset/xml/XmlTableTest.java 2010-02-11 04:28:36 UTC (rev 1161)
+++ ...
[truncated message content] |
|
From: <jef...@us...> - 2010-02-11 04:28:42
|
Revision: 1161
http://dbunit.svn.sourceforge.net/dbunit/?rev=1161&view=rev
Author: jeffjensen
Date: 2010-02-11 04:28:36 +0000 (Thu, 11 Feb 2010)
Log Message:
-----------
Wrap cleanupData call in finally block to ensure it is called on test failures.
Modified Paths:
--------------
trunk/dbunit/src/java/org/dbunit/DefaultPrepAndExpectedTestCase.java
Modified: trunk/dbunit/src/java/org/dbunit/DefaultPrepAndExpectedTestCase.java
===================================================================
--- trunk/dbunit/src/java/org/dbunit/DefaultPrepAndExpectedTestCase.java 2010-02-10 17:04:47 UTC (rev 1160)
+++ trunk/dbunit/src/java/org/dbunit/DefaultPrepAndExpectedTestCase.java 2010-02-11 04:28:36 UTC (rev 1161)
@@ -209,8 +209,11 @@
* {@inheritDoc}
*/
public void postTest() throws Exception {
- verifyData();
- cleanupData();
+ try {
+ verifyData();
+ } finally {
+ cleanupData();
+ }
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jef...@us...> - 2010-02-10 17:04:56
|
Revision: 1160
http://dbunit.svn.sourceforge.net/dbunit/?rev=1160&view=rev
Author: jeffjensen
Date: 2010-02-10 17:04:47 +0000 (Wed, 10 Feb 2010)
Log Message:
-----------
Expose cleanupData() on interface, as is a valid use case to cleanup data but not use postTest() to avoid using the verifyData().
Modified Paths:
--------------
trunk/dbunit/src/java/org/dbunit/DefaultPrepAndExpectedTestCase.java
trunk/dbunit/src/java/org/dbunit/PrepAndExpectedTestCase.java
Modified: trunk/dbunit/src/java/org/dbunit/DefaultPrepAndExpectedTestCase.java
===================================================================
--- trunk/dbunit/src/java/org/dbunit/DefaultPrepAndExpectedTestCase.java 2010-02-10 03:28:12 UTC (rev 1159)
+++ trunk/dbunit/src/java/org/dbunit/DefaultPrepAndExpectedTestCase.java 2010-02-10 17:04:47 UTC (rev 1160)
@@ -214,6 +214,20 @@
}
/**
+ * {@inheritDoc}
+ */
+ public void cleanupData() throws Exception {
+ if (databaseTester == null) {
+ throw new IllegalStateException(
+ "databaseTester is null; must configure or set it first");
+ }
+
+ IDataSet dataset = new CompositeDataSet(prepDs, expectedDs);
+ databaseTester.setDataSet(dataset);
+ databaseTester.onTearDown();
+ }
+
+ /**
* Use the provided databaseTester to prep the database with the provided
* prep dataset. See {@link org.dbunit.IDatabaseTester#onSetup()}.
*
@@ -314,24 +328,6 @@
}
/**
- * Cleanup tables specified in prep and expected datasets, using the
- * provided databaseTester. See
- * {@link org.dbunit.IDatabaseTester#onTearDown()}.
- *
- * @throws Exception
- */
- protected void cleanupData() throws Exception {
- if (databaseTester == null) {
- throw new IllegalStateException(
- "databaseTester is null; must configure or set it first");
- }
-
- IDataSet dataset = new CompositeDataSet(prepDs, expectedDs);
- databaseTester.setDataSet(dataset);
- databaseTester.onTearDown();
- }
-
- /**
* Make a <code>IDataSet</code> from the specified files.
*
* @param dataFiles
Modified: trunk/dbunit/src/java/org/dbunit/PrepAndExpectedTestCase.java
===================================================================
--- trunk/dbunit/src/java/org/dbunit/PrepAndExpectedTestCase.java 2010-02-10 03:28:12 UTC (rev 1159)
+++ trunk/dbunit/src/java/org/dbunit/PrepAndExpectedTestCase.java 2010-02-10 17:04:47 UTC (rev 1160)
@@ -62,6 +62,15 @@
void postTest() throws Exception;
/**
+ * Cleanup tables specified in prep and expected datasets, using the
+ * provided databaseTester. See
+ * {@link org.dbunit.IDatabaseTester#onTearDown()}.
+ *
+ * @throws Exception
+ */
+ void cleanupData() throws Exception;
+
+ /**
* Get the prep dataset, created from the prepDataFiles.
*
* @return The prep dataset.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jef...@us...> - 2010-02-10 03:28:18
|
Revision: 1159
http://dbunit.svn.sourceforge.net/dbunit/?rev=1159&view=rev
Author: jeffjensen
Date: 2010-02-10 03:28:12 +0000 (Wed, 10 Feb 2010)
Log Message:
-----------
Breakout developer menu items from Overview section.
Modified Paths:
--------------
trunk/dbunit/src/site/site.xml
Modified: trunk/dbunit/src/site/site.xml
===================================================================
--- trunk/dbunit/src/site/site.xml 2010-02-10 03:20:43 UTC (rev 1158)
+++ trunk/dbunit/src/site/site.xml 2010-02-10 03:28:12 UTC (rev 1159)
@@ -50,7 +50,7 @@
<menu name="Quick Links">
<item name="Maven 1.x Plugin" href="http://maven-plugins.sourceforge.net/maven-dbunit-plugin/index.html"/>
- <item name="Maven 2 Plugin" href="http://mojo.codehaus.org/dbunit-maven-plugin/"/>
+ <item name="Maven 2.x Plugin" href="http://mojo.codehaus.org/dbunit-maven-plugin/"/>
<item name="Download" href="http://sourceforge.net/project/showfiles.php?group_id=47439"/>
<item name="Changes" href="/changes-report.html"/>
<item name="FAQ" href="/faq.html"/>
@@ -71,11 +71,14 @@
<item name="Properties" href="/properties.html"/>
<item name="Ant Task" href="/anttask.html"/>
<item name="Migration Guide" href="/migration.html"/>
+ <item name="Resources" href="/resources.html"/>
+ <item name="Credits" href="/credits.html"/>
+ </menu>
+
+ <menu name="Developer">
<item name="Building DbUnit" href="/building.html"/>
<item name="Developers Guide" href="/devguide.html"/>
<item name="Integration Tests" href="/integrationtests.html"/>
- <item name="Resources" href="/resources.html"/>
- <item name="Credits" href="/credits.html"/>
</menu>
<menu ref="parent"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jef...@us...> - 2010-02-10 03:20:50
|
Revision: 1158
http://dbunit.svn.sourceforge.net/dbunit/?rev=1158&view=rev
Author: jeffjensen
Date: 2010-02-10 03:20:43 +0000 (Wed, 10 Feb 2010)
Log Message:
-----------
Order files and table variables in slightly better sequence for understanding/examples.
Modified Paths:
--------------
trunk/dbunit/src/java/org/dbunit/DefaultPrepAndExpectedTestCase.java
trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseDiIT.java
trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseExtIT.java
trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseTest.java
Modified: trunk/dbunit/src/java/org/dbunit/DefaultPrepAndExpectedTestCase.java
===================================================================
--- trunk/dbunit/src/java/org/dbunit/DefaultPrepAndExpectedTestCase.java 2010-02-09 22:38:21 UTC (rev 1157)
+++ trunk/dbunit/src/java/org/dbunit/DefaultPrepAndExpectedTestCase.java 2010-02-10 03:20:43 UTC (rev 1158)
@@ -79,9 +79,9 @@
*
* @Test
* public void testExample() throws Exception {
- * VerifyTableDefinition[] tables = {};
* String[] prepDataFiles = {};
* String[] expectedDataFiles = {};
+ * VerifyTableDefinition[] tables = {};
*
* tc.configureTest(tables, prepDataFiles, expectedDataFiles);
* tc.preTest();
@@ -105,9 +105,9 @@
* setDatabaseTester(databaseTester);
* setDataFileLoader(dataFileLoader);
*
- * VerifyTableDefinition[] tables = {};
* String[] prepDataFiles = {};
* String[] expectedDataFiles = {};
+ * VerifyTableDefinition[] tables = {};
*
* configureTest(tables, prepDataFiles, expectedDataFiles);
* preTest();
Modified: trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseDiIT.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseDiIT.java 2010-02-09 22:38:21 UTC (rev 1157)
+++ trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseDiIT.java 2010-02-10 03:20:43 UTC (rev 1158)
@@ -50,11 +50,10 @@
}
public void testSuccessRun() throws Exception {
- VerifyTableDefinition[] tables = {TEST_TABLE, SECOND_TABLE};
-
// use same files to have no data comparison fails
String[] prepDataFiles = {PREP_DATA_FILE_NAME};
String[] expectedDataFiles = {PREP_DATA_FILE_NAME};
+ VerifyTableDefinition[] tables = {TEST_TABLE, SECOND_TABLE};
tc.configureTest(tables, prepDataFiles, expectedDataFiles);
tc.preTest();
@@ -71,10 +70,9 @@
}
public void testFailRun() throws Exception {
- VerifyTableDefinition[] tables = {TEST_TABLE, SECOND_TABLE};
-
String[] prepDataFiles = {PREP_DATA_FILE_NAME};
String[] expectedDataFiles = {EXP_DATA_FILE_NAME};
+ VerifyTableDefinition[] tables = {TEST_TABLE, SECOND_TABLE};
tc.configureTest(tables, prepDataFiles, expectedDataFiles);
tc.preTest();
Modified: trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseExtIT.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseExtIT.java 2010-02-09 22:38:21 UTC (rev 1157)
+++ trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseExtIT.java 2010-02-10 03:20:43 UTC (rev 1158)
@@ -50,10 +50,9 @@
}
public void testSuccessRun() throws Exception {
- VerifyTableDefinition[] tables = {TEST_TABLE, SECOND_TABLE};
-
String[] prepDataFiles = {PREP_DATA_FILE_NAME};
String[] expectedDataFiles = {PREP_DATA_FILE_NAME};
+ VerifyTableDefinition[] tables = {TEST_TABLE, SECOND_TABLE};
tc.configureTest(tables, prepDataFiles, expectedDataFiles);
tc.preTest();
@@ -70,10 +69,9 @@
}
public void testFailRun() throws Exception {
- VerifyTableDefinition[] tables = {TEST_TABLE, SECOND_TABLE};
-
String[] prepDataFiles = {PREP_DATA_FILE_NAME};
String[] expectedDataFiles = {EXP_DATA_FILE_NAME};
+ VerifyTableDefinition[] tables = {TEST_TABLE, SECOND_TABLE};
tc.configureTest(tables, prepDataFiles, expectedDataFiles);
tc.preTest();
Modified: trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseTest.java
===================================================================
--- trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseTest.java 2010-02-09 22:38:21 UTC (rev 1157)
+++ trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseTest.java 2010-02-10 03:20:43 UTC (rev 1158)
@@ -24,9 +24,9 @@
}
public void testConfigureTest() throws Exception {
- VerifyTableDefinition[] tables = {};
String[] prepDataFiles = {PREP_DATA_FILE_NAME};
String[] expectedDataFiles = {EXP_DATA_FILE_NAME};
+ VerifyTableDefinition[] tables = {};
tc.configureTest(tables, prepDataFiles, expectedDataFiles);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|