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-02-09 22:38:32
|
Revision: 1157 http://dbunit.svn.sourceforge.net/dbunit/?rev=1157&view=rev Author: jeffjensen Date: 2010-02-09 22:38:21 +0000 (Tue, 09 Feb 2010) Log Message: ----------- Add getters for prep and expected datasets. Modified Paths: -------------- trunk/dbunit/src/java/org/dbunit/DefaultPrepAndExpectedTestCase.java trunk/dbunit/src/java/org/dbunit/PrepAndExpectedTestCase.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 04:48:00 UTC (rev 1156) +++ trunk/dbunit/src/java/org/dbunit/DefaultPrepAndExpectedTestCase.java 2010-02-09 22:38:21 UTC (rev 1157) @@ -416,6 +416,20 @@ } /** + * {@inheritDoc} + */ + public IDataSet getPrepDataset() { + return prepDs; + } + + /** + * {@inheritDoc} + */ + public IDataSet getExpectedDataset() { + return expectedDs; + } + + /** * Get the databaseTester. * * @see {@link databaseTester}. @@ -462,17 +476,6 @@ } /** - * Get the prepDs. - * - * @see {@link prepDs}. - * - * @return The prepDs. - */ - public IDataSet getPrepDs() { - return prepDs; - } - - /** * Set the prepDs. * * @see {@link prepDs}. @@ -485,17 +488,6 @@ } /** - * Get the expectedDs. - * - * @see {@link expectedDs}. - * - * @return The expectedDs. - */ - public IDataSet getExpectedDs() { - return expectedDs; - } - - /** * Set the expectedDs. * * @see {@link expectedDs}. Modified: trunk/dbunit/src/java/org/dbunit/PrepAndExpectedTestCase.java =================================================================== --- trunk/dbunit/src/java/org/dbunit/PrepAndExpectedTestCase.java 2010-02-09 04:48:00 UTC (rev 1156) +++ trunk/dbunit/src/java/org/dbunit/PrepAndExpectedTestCase.java 2010-02-09 22:38:21 UTC (rev 1157) @@ -20,6 +20,8 @@ */ package org.dbunit; +import org.dbunit.dataset.IDataSet; + /** * Test case supporting prep data and expected data. * @@ -58,4 +60,18 @@ * @throws Exception */ void postTest() throws Exception; -} + + /** + * Get the prep dataset, created from the prepDataFiles. + * + * @return The prep dataset. + */ + IDataSet getPrepDataset(); + + /** + * Get the expected dataset, created from the expectedDataFiles. + * + * @return The expected dataset. + */ + IDataSet getExpectedDataset(); +} \ No newline at end of file Modified: trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseTest.java =================================================================== --- trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseTest.java 2010-02-09 04:48:00 UTC (rev 1156) +++ trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseTest.java 2010-02-09 22:38:21 UTC (rev 1157) @@ -34,10 +34,10 @@ .getTableDefs()); IDataSet expPrepDs = dataFileLoader.load(PREP_DATA_FILE_NAME); - Assertion.assertEquals(expPrepDs, tc.getPrepDs()); + Assertion.assertEquals(expPrepDs, tc.getPrepDataset()); IDataSet expExpDs = dataFileLoader.load(EXP_DATA_FILE_NAME); - Assertion.assertEquals(expExpDs, tc.getExpectedDs()); + Assertion.assertEquals(expExpDs, tc.getExpectedDataset()); } public void testPreTest() throws Exception { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jef...@us...> - 2010-02-09 04:48:07
|
Revision: 1156 http://dbunit.svn.sourceforge.net/dbunit/?rev=1156&view=rev Author: jeffjensen Date: 2010-02-09 04:48:00 +0000 (Tue, 09 Feb 2010) Log Message: ----------- Add new test case base class supporting prep and expected datasets. Added Paths: ----------- trunk/dbunit/src/java/org/dbunit/DefaultPrepAndExpectedTestCase.java trunk/dbunit/src/java/org/dbunit/PrepAndExpectedTestCase.java trunk/dbunit/src/java/org/dbunit/VerifyTableDefinition.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 trunk/dbunit/src/xml/flatXmlDataSetTestChanged.xml Added: trunk/dbunit/src/java/org/dbunit/DefaultPrepAndExpectedTestCase.java =================================================================== --- trunk/dbunit/src/java/org/dbunit/DefaultPrepAndExpectedTestCase.java (rev 0) +++ trunk/dbunit/src/java/org/dbunit/DefaultPrepAndExpectedTestCase.java 2010-02-09 04:48:00 UTC (rev 1156) @@ -0,0 +1,532 @@ +/* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002-2008, DbUnit.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package org.dbunit; + +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; +import org.dbunit.dataset.IDataSet; +import org.dbunit.dataset.ITable; +import org.dbunit.dataset.SortedTable; +import org.dbunit.dataset.filter.DefaultColumnFilter; +import org.dbunit.util.fileloader.DataFileLoader; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Test case base class supporting prep data and expected data. + * + * Use this class in two ways: + * <ol> + * <li>Dependency inject it as its interface into a test class.</li> + * <p> + * Configure a bean of its interface, injecting a IDatabaseTester and a + * DataFileLoader using the databaseTester and a dataFileLoader properties. + * </p> + * + * <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). + * + * <pre> + * 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: + * <ul> + * <li>For the whole test case, i.e. in setUp() and tearDown().</li> + * <li>In each test method.</li> + * <li>Or some combination of both test case setup/teardown and test methods.</li> + * </ul> + * + * <h4>When each test method requires different prep and expected data</h4> + * + * If each test method requires its own prep and expected data, then the test + * methods will look something like the following: + * + * <pre> + * @Autowired + * private PrepAndExpectedTestCase tc; + * + * @Test + * public void testExample() throws Exception { + * VerifyTableDefinition[] tables = {}; + * String[] prepDataFiles = {}; + * String[] expectedDataFiles = {}; + * + * tc.configureTest(tables, prepDataFiles, expectedDataFiles); + * tc.preTest(); + * + * // execute test + * + * tc.postTest(); + * } + * + * </pre> + * + * <h4>When all test methods share the same prep and/or expected data</h4> + * + * If each test method can share all of the prep and/or expected data, then use + * setUp() for the configureTest() and preTest() calls and tearDown() for the + * postTest() call. The methods will look something like the following: + * + * <pre> + * @Override + * protected void setUp() throws Exception { + * setDatabaseTester(databaseTester); + * setDataFileLoader(dataFileLoader); + * + * VerifyTableDefinition[] tables = {}; + * String[] prepDataFiles = {}; + * String[] expectedDataFiles = {}; + * + * configureTest(tables, prepDataFiles, expectedDataFiles); + * preTest(); + * super.setUp(); + * } + * + * @Override + * protected void tearDown() throws Exception { + * postTest(); + * super.tearDown(); + * } + * + * @Test + * public void testExample() throws Exception { + * // execute test + * } + * </pre> + * + * Note that it is unlikely that all test methods can share the same expected + * data. + * + * <h4>Sharing common (but not all) prep or expected data among test methods.</h4> + * + * Put common data in one or more files and pass the needed ones in the correct + * data file array. + * + * <h4>Additional examples</h4> + * + * For additional examples, refer to the ITs (listed in the See Also section). + * + * @see org.dbunit.DefaultPrepAndExpectedTestCaseDiIT + * @see org.dbunit.DefaultPrepAndExpectedTestCaseExtIT + * + * @author Jeff Jensen jeffjensen AT users.sourceforge.net + * @author Last changed by: $Author$ + * @version $Revision$ $Date$ + * @since 2.4.8 + */ +public class DefaultPrepAndExpectedTestCase extends TestCase implements + PrepAndExpectedTestCase { + private final Logger LOG = + LoggerFactory.getLogger(DefaultPrepAndExpectedTestCase.class); + + private IDatabaseTester databaseTester; + private DataFileLoader dataFileLoader; + + private IDataSet prepDs; + private IDataSet expectedDs; + private VerifyTableDefinition[] tableDefs; + + /** Create new instance. */ + public DefaultPrepAndExpectedTestCase() { + } + + /** + * Create new instance with specified dataFileLoader and databasetester. + * + * @param dataFileLoader + * Load to use for loading the data files. + * @param databaseTester + * Tester to use for database manipulation. + */ + public DefaultPrepAndExpectedTestCase(DataFileLoader dataFileLoader, + IDatabaseTester databaseTester) { + this.dataFileLoader = dataFileLoader; + this.databaseTester = databaseTester; + } + + /** + * Create new instance with specified test case name. + * + * @param name + * The test case name. + */ + public DefaultPrepAndExpectedTestCase(String name) { + super(name); + } + + /** + * {@inheritDoc} + */ + public void configureTest(VerifyTableDefinition[] tables, + String[] prepDataFiles, String[] expectedDataFiles) + throws Exception { + LOG.debug("configureTest: saving instance variables"); + this.prepDs = makeCompositeDataSet(prepDataFiles); + this.expectedDs = makeCompositeDataSet(expectedDataFiles); + this.tableDefs = tables; + } + + /** + * {@inheritDoc} + */ + public void preTest() throws Exception { + setupData(); + } + + /** + * {@inheritDoc} + */ + public void postTest() throws Exception { + verifyData(); + cleanupData(); + } + + /** + * Use the provided databaseTester to prep the database with the provided + * prep dataset. See {@link org.dbunit.IDatabaseTester#onSetup()}. + * + * @throws Exception + */ + protected void setupData() throws Exception { + LOG.debug("setupData: setting prep dataset and inserting rows"); + if (databaseTester == null) { + throw new IllegalStateException( + "databaseTester is null; must configure or set it first"); + } + + databaseTester.setDataSet(prepDs); + databaseTester.onSetup(); + } + + /** + * For the provided VerifyTableDefinitions, verify each table's actual + * results are as expected. Uses the connection from the provided + * databaseTester. + * + * @throws Exception + */ + protected void verifyData() throws Exception { + if (databaseTester == null) { + throw new IllegalStateException( + "databaseTester is null; must configure or set it first"); + } + + 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"); + } + + 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.debug(" Loading its rows from expected dataset"); + ITable expectedTable = expectedDs.getTable(tableName); + + LOG.debug(" Loading its rows from actual table"); + ITable actualTable = connection.createTable(tableName); + + verifyData(expectedTable, actualTable, excludeColumns, + includeColumns); + } + } + + /** + * For the specified expected and actual tables (and excluding and including + * the specified columns), verify the actual data is as expected. + * + * @param expectedTable + * The expected table to compare the actual table to. + * @param actualTable + * The actual table to compare to the expected table. + * @param excludeColumns + * The column names to exclude from comparison. See + * {@link org.dbunit.dataset.filter.DefaultColumnFilter#excludeColumn(String)} + * . + * @param includeColumns + * The column names to only include in comparison. See + * {@link org.dbunit.dataset.filter.DefaultColumnFilter#includeColumn(String)} + * . + * @throws DatabaseUnitException. + */ + protected void verifyData(ITable expectedTable, ITable actualTable, + String[] excludeColumns, String[] includeColumns) + throws DatabaseUnitException { + // Filter out the columns from the expected and actual results + LOG.debug("Applying filters to expected table"); + ITable expectedFilteredTable = + applyColumnFilters(expectedTable, excludeColumns, + includeColumns); + LOG.debug("Applying filters to actual table"); + ITable actualFilteredTable = + applyColumnFilters(actualTable, excludeColumns, includeColumns); + + LOG.debug("Sorting expected table"); + SortedTable expectedSortedTable = + new SortedTable(expectedFilteredTable); + LOG.debug("Sorting actual table"); + SortedTable actualSortedTable = + new SortedTable(actualFilteredTable, expectedFilteredTable + .getTableMetaData()); + + LOG.debug("Comparing expected table to actual table"); + Assertion.assertEquals(expectedSortedTable, actualSortedTable); + } + + /** + * 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 + * Represents the array of dbUnit data files. + * @return The composite dataset. + * @throws DataSetException + * On dbUnit errors. + */ + protected IDataSet makeCompositeDataSet(String[] dataFiles) + throws DataSetException { + if (dataFileLoader == null) { + throw new IllegalStateException( + "dataFileLoader is null; must configure or set it first"); + } + + int count = dataFiles.length; + LOG.debug("makeCompositeDataSet: dataFiles count=" + count); + if (count == 0) { + LOG.warn("makeCompositeDataSet: Specified zero data files"); + } + + List list = new ArrayList(); + for (int i = 0; i < count; i++) { + IDataSet ds = dataFileLoader.load(dataFiles[i]); + list.add(ds); + } + + IDataSet[] dataSet = (IDataSet[]) list.toArray(new IDataSet[] {}); + IDataSet compositeDS = new CompositeDataSet(dataSet); + return compositeDS; + } + + /** + * Apply the specified exclude and include column filters to the specified + * table. + * + * @param table + * The table to apply the filters to. + * @param excludeColumns + * The exclude filters. + * @param includeColumns + * The include filters. + * @return The filtered table. + * @throws DataSetException + */ + protected ITable applyColumnFilters(ITable table, String[] excludeColumns, + String[] includeColumns) throws DataSetException { + ITable filteredTable = table; + + if (table == null) { + 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 + // not wanting to compare anything! + if (includeColumns.length > 0) { + LOG.debug("applyColumnFilters: including columns={}", + new Object[] {includeColumns}); + filteredTable = + DefaultColumnFilter.includedColumnsTable(filteredTable, + includeColumns); + } else { + LOG.debug("applyColumnFilters: including columns=(all)"); + } + + LOG.debug("applyColumnFilters: excluding columns={}", + new Object[] {excludeColumns}); + filteredTable = + DefaultColumnFilter.excludedColumnsTable(filteredTable, + excludeColumns); + + return filteredTable; + } + + /** + * Get the databaseTester. + * + * @see {@link databaseTester}. + * + * @return The databaseTester. + */ + public IDatabaseTester getDatabaseTester() { + return databaseTester; + } + + /** + * Set the databaseTester. + * + * @see {@link databaseTester}. + * + * @param databaseTester + * The databaseTester to set. + */ + public void setDatabaseTester(IDatabaseTester databaseTester) { + this.databaseTester = databaseTester; + } + + /** + * Get the dataFileLoader. + * + * @see {@link dataFileLoader}. + * + * @return The dataFileLoader. + */ + public DataFileLoader getDataFileLoader() { + return dataFileLoader; + } + + /** + * Set the dataFileLoader. + * + * @see {@link dataFileLoader}. + * + * @param dataFileLoader + * The dataFileLoader to set. + */ + public void setDataFileLoader(DataFileLoader dataFileLoader) { + this.dataFileLoader = dataFileLoader; + } + + /** + * Get the prepDs. + * + * @see {@link prepDs}. + * + * @return The prepDs. + */ + public IDataSet getPrepDs() { + return prepDs; + } + + /** + * Set the prepDs. + * + * @see {@link prepDs}. + * + * @param prepDs + * The prepDs to set. + */ + public void setPrepDs(IDataSet prepDs) { + this.prepDs = prepDs; + } + + /** + * Get the expectedDs. + * + * @see {@link expectedDs}. + * + * @return The expectedDs. + */ + public IDataSet getExpectedDs() { + return expectedDs; + } + + /** + * Set the expectedDs. + * + * @see {@link expectedDs}. + * + * @param expectedDs + * The expectedDs to set. + */ + public void setExpectedDs(IDataSet expectedDs) { + this.expectedDs = expectedDs; + } + + /** + * Get the tableDefs. + * + * @see {@link tableDefs}. + * + * @return The tableDefs. + */ + public VerifyTableDefinition[] getTableDefs() { + return tableDefs; + } + + /** + * Set the tableDefs. + * + * @see {@link tableDefs}. + * + * @param tableDefs + * The tableDefs to set. + */ + public void setTableDefs(VerifyTableDefinition[] tableDefs) { + this.tableDefs = tableDefs; + } +} Property changes on: trunk/dbunit/src/java/org/dbunit/DefaultPrepAndExpectedTestCase.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: trunk/dbunit/src/java/org/dbunit/PrepAndExpectedTestCase.java =================================================================== --- trunk/dbunit/src/java/org/dbunit/PrepAndExpectedTestCase.java (rev 0) +++ trunk/dbunit/src/java/org/dbunit/PrepAndExpectedTestCase.java 2010-02-09 04:48:00 UTC (rev 1156) @@ -0,0 +1,61 @@ +/* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002-2008, DbUnit.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package org.dbunit; + +/** + * Test case supporting prep data and expected data. + * + * @author Jeff Jensen jeffjensen AT users.sourceforge.net + * @author Last changed by: $Author$ + * @version $Revision$ $Date$ + * @since 2.4.8 + */ +public interface PrepAndExpectedTestCase { + /** + * Configure the test. Call this method before performing the test steps. + * + * @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 configureTest(VerifyTableDefinition[] tables, String[] prepDataFiles, + String[] expectedDataFiles) throws Exception; + + /** + * Execute pre-test steps. Call this method before performing the test + * steps. + * + * @throws Exception + */ + void preTest() throws Exception; + + /** + * Execute post-test steps. Call this method after performing the test + * steps. + * + * @throws Exception + */ + void postTest() throws Exception; +} Property changes on: trunk/dbunit/src/java/org/dbunit/PrepAndExpectedTestCase.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: trunk/dbunit/src/java/org/dbunit/VerifyTableDefinition.java =================================================================== --- trunk/dbunit/src/java/org/dbunit/VerifyTableDefinition.java (rev 0) +++ trunk/dbunit/src/java/org/dbunit/VerifyTableDefinition.java 2010-02-09 04:48:00 UTC (rev 1156) @@ -0,0 +1,98 @@ +/* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002-2008, DbUnit.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package org.dbunit; + +/** + * Defines a database table to verify (assert on data), specifying include and + * exclude column filters. + * + * @author Jeff Jensen jeffjensen AT users.sourceforge.net + * @author Last changed by: $Author$ + * @version $Revision$ $Date$ + * @since 2.4.8 + */ +public class VerifyTableDefinition { + /** The name of the table. */ + private final String tableName; + + /** The columns to exclude in table comparisons. */ + private final String[] columnExclusionFilters; + + /** The columns to include in table comparisons. */ + private final String[] columnInclusionFilters; + + /** + * Create a valid instance with no include columns specified (meaning + * include all columns). + * + * @param table + * The name of the table. + * @param excludeColumns + * The columns in the table to ignore (filter out) in expected vs + * actual comparisons. + */ + public VerifyTableDefinition(String table, String[] excludeColumns) { + this(table, excludeColumns, new String[] {}); + } + + /** + * Create a valid instance specifying exclude and include columns. + * + * @param table + * The name of the table. + * @param excludeColumns + * The columns in the table to ignore (filter out) in expected vs + * actual comparisons. + * @param includeColumns + * The columns in the table to include in expected vs actual + * comparisons. + */ + public VerifyTableDefinition(String table, String[] excludeColumns, + String[] includeColumns) { + if (table == null) { + 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; + } + + public String getTableName() { + return tableName; + } + + public String[] getColumnExclusionFilters() { + return columnExclusionFilters; + } + + public String[] getColumnInclusionFilters() { + return columnInclusionFilters; + } +} Property changes on: trunk/dbunit/src/java/org/dbunit/VerifyTableDefinition.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseDiIT.java =================================================================== --- trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseDiIT.java (rev 0) +++ trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseDiIT.java 2010-02-09 04:48:00 UTC (rev 1156) @@ -0,0 +1,98 @@ +package org.dbunit; + +import junit.framework.ComparisonFailure; +import junit.framework.TestCase; + +import org.dbunit.database.IDatabaseConnection; +import org.dbunit.util.fileloader.DataFileLoader; +import org.dbunit.util.fileloader.FlatXmlDataFileLoader; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Integration test of composition of the PrepAndExpected (simulated DI). + * + * @author Jeff Jensen jeffjensen AT users.sourceforge.net + * @author Last changed by: $Author$ + * @version $Revision$ $Date$ + * @since 2.4.8 + */ +public class DefaultPrepAndExpectedTestCaseDiIT extends TestCase { + 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 VerifyTableDefinition TEST_TABLE = + new VerifyTableDefinition("TEST_TABLE", new String[] {}); + + private static final VerifyTableDefinition SECOND_TABLE = + new VerifyTableDefinition("SECOND_TABLE", new String[] {}); + + private final DataFileLoader dataFileLoader = new FlatXmlDataFileLoader(); + + private DatabaseEnvironment dbEnv; + 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); + + super.setUp(); + } + + 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}; + + tc.configureTest(tables, prepDataFiles, expectedDataFiles); + tc.preTest(); + + // skip modifying data and just verify the insert + + // reopen connection as DefaultOperationListener closes it after inserts + // maybe we need a KeepConnectionOpenOperationListener class?! + connection = dbEnv.getConnection(); + databaseTester = new DefaultDatabaseTester(connection); + tc.setDatabaseTester(databaseTester); + + tc.postTest(); + } + + public void testFailRun() throws Exception { + VerifyTableDefinition[] tables = {TEST_TABLE, SECOND_TABLE}; + + String[] prepDataFiles = {PREP_DATA_FILE_NAME}; + String[] expectedDataFiles = {EXP_DATA_FILE_NAME}; + + tc.configureTest(tables, prepDataFiles, expectedDataFiles); + tc.preTest(); + + // skip modifying data and just verify the insert + + // reopen connection as DefaultOperationListener closes it after inserts + // maybe we need a KeepConnectionOpenOperationListener class?! + connection = dbEnv.getConnection(); + databaseTester = new DefaultDatabaseTester(connection); + tc.setDatabaseTester(databaseTester); + + try { + tc.postTest(); + fail("Did not catch expected exception:" + + " junit.framework.ComparisonFailure"); + } catch (ComparisonFailure e) { + // test passes + } + } +} Property changes on: trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseDiIT.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseExtIT.java =================================================================== --- trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseExtIT.java (rev 0) +++ trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseExtIT.java 2010-02-09 04:48:00 UTC (rev 1156) @@ -0,0 +1,97 @@ +package org.dbunit; + +import junit.framework.ComparisonFailure; + +import org.dbunit.database.IDatabaseConnection; +import org.dbunit.util.fileloader.DataFileLoader; +import org.dbunit.util.fileloader.FlatXmlDataFileLoader; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Integration test of extends of the PrepAndExpected. + * + * @author Jeff Jensen jeffjensen AT users.sourceforge.net + * @author Last changed by: $Author$ + * @version $Revision$ $Date$ + * @since 2.4.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 VerifyTableDefinition TEST_TABLE = + new VerifyTableDefinition("TEST_TABLE", new String[] {}); + + private static final VerifyTableDefinition SECOND_TABLE = + new VerifyTableDefinition("SECOND_TABLE", new String[] {}); + + private final Logger LOG = + LoggerFactory.getLogger(DefaultPrepAndExpectedTestCaseExtIT.class); + + private final DataFileLoader dataFileLoader = new FlatXmlDataFileLoader(); + + private DatabaseEnvironment dbEnv; + 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); + + super.setUp(); + } + + public void testSuccessRun() throws Exception { + VerifyTableDefinition[] tables = {TEST_TABLE, SECOND_TABLE}; + + String[] prepDataFiles = {PREP_DATA_FILE_NAME}; + String[] expectedDataFiles = {PREP_DATA_FILE_NAME}; + + tc.configureTest(tables, prepDataFiles, expectedDataFiles); + tc.preTest(); + + // skip modifying data and just verify the insert + + // reopen connection as DefaultOperationListener closes it after inserts + // maybe we need a KeepConnectionOpenOperationListener class?! + connection = dbEnv.getConnection(); + databaseTester = new DefaultDatabaseTester(connection); + tc.setDatabaseTester(databaseTester); + + tc.postTest(); + } + + public void testFailRun() throws Exception { + VerifyTableDefinition[] tables = {TEST_TABLE, SECOND_TABLE}; + + String[] prepDataFiles = {PREP_DATA_FILE_NAME}; + String[] expectedDataFiles = {EXP_DATA_FILE_NAME}; + + tc.configureTest(tables, prepDataFiles, expectedDataFiles); + tc.preTest(); + + // skip modifying data and just verify the insert + + // reopen connection as DefaultOperationListener closes it after inserts + // maybe we need a KeepConnectionOpenOperationListener class?! + connection = dbEnv.getConnection(); + databaseTester = new DefaultDatabaseTester(connection); + tc.setDatabaseTester(databaseTester); + + try { + tc.postTest(); + fail("Did not catch expected exception:" + + " junit.framework.ComparisonFailure"); + } catch (ComparisonFailure e) { + // test passes + } + } +} Property changes on: trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseExtIT.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseTest.java =================================================================== --- trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseTest.java (rev 0) +++ trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseTest.java 2010-02-09 04:48:00 UTC (rev 1156) @@ -0,0 +1,74 @@ +package org.dbunit; + +import junit.framework.TestCase; + +import org.dbunit.dataset.IDataSet; +import org.dbunit.util.fileloader.DataFileLoader; +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 final DataFileLoader dataFileLoader = new FlatXmlDataFileLoader(); + // private final IDatabaseTester databaseTester = new + // JdbcDatabaseTester(driverClass, connectionUrl); + + private final DefaultPrepAndExpectedTestCase tc = + new DefaultPrepAndExpectedTestCase(); + + protected void setUp() throws Exception { + super.setUp(); + // tc.setDatabaseTester(databaseTester); + tc.setDataFileLoader(dataFileLoader); + } + + public void testConfigureTest() throws Exception { + VerifyTableDefinition[] tables = {}; + String[] prepDataFiles = {PREP_DATA_FILE_NAME}; + String[] expectedDataFiles = {EXP_DATA_FILE_NAME}; + + tc.configureTest(tables, prepDataFiles, expectedDataFiles); + + assertEquals("Configured tables do not match expected.", tables, tc + .getTableDefs()); + + IDataSet expPrepDs = dataFileLoader.load(PREP_DATA_FILE_NAME); + Assertion.assertEquals(expPrepDs, tc.getPrepDs()); + + IDataSet expExpDs = dataFileLoader.load(EXP_DATA_FILE_NAME); + Assertion.assertEquals(expExpDs, tc.getExpectedDs()); + } + + public void testPreTest() throws Exception { + // TODO implement test + } + + public void testPostTest() { + // TODO implement test + } + + public void testSetupData() { + // TODO implement test + } + + public void testVerifyData() { + // TODO implement test + } + + public void testVerifyDataITableITableStringArrayStringArray() { + // TODO implement test + } + + public void testCleanupData() { + // TODO implement test + } + + public void testMakeCompositeDataSet() { + // TODO implement test + } + + public void testApplyColumnFilters() { + // TODO implement test + } +} Property changes on: trunk/dbunit/src/test/org/dbunit/DefaultPrepAndExpectedTestCaseTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: trunk/dbunit/src/xml/flatXmlDataSetTestChanged.xml =================================================================== --- trunk/dbunit/src/xml/flatXmlDataSetTestChanged.xml (rev 0) +++ trunk/dbunit/src/xml/flatXmlDataSetTestChanged.xml 2010-02-09 04:48:00 UTC (rev 1156) @@ -0,0 +1,21 @@ +<!-- edited with XML Spy v4.1 U (http://www.xmlspy.com) by Stephane Besson (R&D) --> +<dataset> + <TEST_TABLE COLUMN0="row 0 col 0" COLUMN1="row 0 col 1" COLUMN2="row 0 col 2" COLUMN3="row 0 col 3"/> + <TEST_TABLE COLUMN0="row 1 col 0" COLUMN1="different value 1" COLUMN2="row 1 col 2" COLUMN3="row 1 col 3"/> + <TEST_TABLE COLUMN0="row 2 col 0" COLUMN1="row 2 col 1" COLUMN2="row 2 col 2" COLUMN3="row 2 col 3"/> + <TEST_TABLE COLUMN0="row 3 col 0" COLUMN1="row 3 col 1" COLUMN2="row 3 col 2" COLUMN3="row 3 col 3"/> + <TEST_TABLE COLUMN0="row 4 col 0" COLUMN1="different value 2" COLUMN2="row 4 col 2" COLUMN3="row 4 col 3"/> + <TEST_TABLE COLUMN0="row 5 col 0" COLUMN1="row 5 col 1" COLUMN2="row 5 col 2" COLUMN3="row 5 col 3"/> + <SECOND_TABLE COLUMN0="row 0 col 0" COLUMN1="row 0 col 1" COLUMN2="row 0 col 2" COLUMN3="row 0 col 3"/> + <SECOND_TABLE COLUMN0="row 1 col 0" COLUMN1="row 1 col 1" COLUMN2="row 1 col 2" COLUMN3="row 1 col 3"/> + <SECOND_TABLE COLUMN0="row 2 col 0" COLUMN1="row 2 col 1" COLUMN2="row 2 col 2" COLUMN3="row 2 col 3"/> + <SECOND_TABLE COLUMN0="row 3 col 0" COLUMN1="row 3 col 1" COLUMN2="row 3 col 2" COLUMN3="row 3 col 3"/> + <SECOND_TABLE COLUMN0="row 4 col 0" COLUMN1="row 4 col 1" COLUMN2="row 4 col 2" COLUMN3="row 4 col 3"/> + <SECOND_TABLE COLUMN0="row 5 col 0" COLUMN1="row 5 col 1" COLUMN2="row 5 col 2" COLUMN3="row 5 col 3"/> + <EMPTY_TABLE/> + <PK_TABLE PK0="0" PK1="0" PK2="0" NORMAL0="row 0" NORMAL1="0 wor"/> + <PK_TABLE PK0="1" PK1="1" PK2="1" NORMAL0="row 1" NORMAL1="1 wor"/> + <PK_TABLE PK0="2" PK1="2" PK2="2" NORMAL0="row 2" NORMAL1="2 wor"/> + <ONLY_PK_TABLE/> + <EMPTY_MULTITYPE_TABLE/> +</dataset> Property changes on: trunk/dbunit/src/xml/flatXmlDataSetTestChanged.xml ___________________________________________________________________ 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-08 06:34:14
|
Revision: 1155 http://dbunit.svn.sourceforge.net/dbunit/?rev=1155&view=rev Author: jeffjensen Date: 2010-02-08 00:52:07 +0000 (Mon, 08 Feb 2010) Log Message: ----------- Update log message to match method name. Modified Paths: -------------- trunk/dbunit/src/java/org/dbunit/DefaultOperationListener.java Modified: trunk/dbunit/src/java/org/dbunit/DefaultOperationListener.java =================================================================== --- trunk/dbunit/src/java/org/dbunit/DefaultOperationListener.java 2010-02-07 07:26:52 UTC (rev 1154) +++ trunk/dbunit/src/java/org/dbunit/DefaultOperationListener.java 2010-02-08 00:52:07 UTC (rev 1155) @@ -48,12 +48,12 @@ } public void operationSetUpFinished(IDatabaseConnection connection) { - logger.debug("operationSetUpDone(connection={}) - start", connection); + logger.debug("operationSetUpFinished(connection={}) - start", connection); closeConnection(connection); } public void operationTearDownFinished(IDatabaseConnection connection) { - logger.debug("operationTearDownDone(connection={}) - start", connection); + logger.debug("operationTearDownFinished(connection={}) - start", connection); closeConnection(connection); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jef...@us...> - 2010-02-07 07:26:58
|
Revision: 1154 http://dbunit.svn.sourceforge.net/dbunit/?rev=1154&view=rev Author: jeffjensen Date: 2010-02-07 07:26:52 +0000 (Sun, 07 Feb 2010) Log Message: ----------- Configure Logback for unit tests. Remove the slf4j-nop dep to see the messages. Add log4j and commons-logging excludes to POI dep to prevent transitive dep leakage to users of dbunit. Modified Paths: -------------- trunk/dbunit/pom.xml Added Paths: ----------- trunk/dbunit/src/testresources/ trunk/dbunit/src/testresources/logback-test.xml Modified: trunk/dbunit/pom.xml =================================================================== --- trunk/dbunit/pom.xml 2010-02-06 05:55:11 UTC (rev 1153) +++ trunk/dbunit/pom.xml 2010-02-07 07:26:52 UTC (rev 1154) @@ -22,6 +22,8 @@ <properties> <compileSource>1.4</compileSource> <checkstyle.excludes>org/dbunit/util/concurrent/*.java</checkstyle.excludes> + <logbackVersion>0.9.15</logbackVersion> + <slf4jVersion>1.5.6</slf4jVersion> </properties> <scm> @@ -226,7 +228,27 @@ <!-- TODO: add exclusion for dependencies that include xerces/xalan --> + <!-- LOGGING --> + <!-- NOTE: must list slf4j first to override other logger frameworks --> <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>${slf4jVersion}</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>jcl-over-slf4j</artifactId> + <version>${slf4jVersion}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <version>${logbackVersion}</version> + <scope>test</scope> + </dependency> + + <dependency> <groupId>hsqldb</groupId> <artifactId>hsqldb</artifactId> <version>1.8.0.1</version> @@ -238,11 +260,6 @@ <version>3.8.2</version> </dependency> <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - <version>1.5.6</version> - </dependency> - <dependency> <groupId>commons-collections</groupId> <artifactId>commons-collections</artifactId> <version>3.2.1</version> @@ -257,6 +274,16 @@ <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.2-FINAL</version> + <exclusions> + <exclusion> + <artifactId>log4j</artifactId> + <groupId>log4j</groupId> + </exclusion> + <exclusion> + <artifactId>commons-logging</artifactId> + <groupId>commons-logging</groupId> + </exclusion> + </exclusions> <optional>true</optional> </dependency> @@ -311,13 +338,6 @@ <version>1.4</version> <scope>test</scope> </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-nop</artifactId> - <version>1.5.6</version> - <scope>runtime</scope> - <optional>true</optional> - </dependency> </dependencies> <build> @@ -364,6 +384,9 @@ <testResource> <directory>${project.basedir}/src/csv</directory> </testResource> + <testResource> + <directory>${project.basedir}/src/testresources</directory> + </testResource> </testResources> <plugins> Added: trunk/dbunit/src/testresources/logback-test.xml =================================================================== --- trunk/dbunit/src/testresources/logback-test.xml (rev 0) +++ trunk/dbunit/src/testresources/logback-test.xml 2010-02-07 07:26:52 UTC (rev 1154) @@ -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> Property changes on: trunk/dbunit/src/testresources/logback-test.xml ___________________________________________________________________ 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-06 05:55:17
|
Revision: 1153 http://dbunit.svn.sourceforge.net/dbunit/?rev=1153&view=rev Author: jeffjensen Date: 2010-02-06 05:55:11 +0000 (Sat, 06 Feb 2010) Log Message: ----------- Correct typo of onSetup method name. Modified Paths: -------------- trunk/dbunit/src/site/xdoc/howto.xml Modified: trunk/dbunit/src/site/xdoc/howto.xml =================================================================== --- trunk/dbunit/src/site/xdoc/howto.xml 2010-01-24 06:06:20 UTC (rev 1152) +++ trunk/dbunit/src/site/xdoc/howto.xml 2010-02-06 05:55:11 UTC (rev 1153) @@ -196,7 +196,7 @@ databaseTester.setDataSet( dataSet ); // will call default setUpOperation - databaseTester.onSetUp(); + databaseTester.onSetup(); } protected void tearDown() throws Exception This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jef...@us...> - 2010-01-24 06:06:26
|
Revision: 1152 http://dbunit.svn.sourceforge.net/dbunit/?rev=1152&view=rev Author: jeffjensen Date: 2010-01-24 06:06:20 +0000 (Sun, 24 Jan 2010) Log Message: ----------- Initial add of "Data File Loader" section. Modified Paths: -------------- trunk/dbunit/src/site/xdoc/howto.xml Modified: trunk/dbunit/src/site/xdoc/howto.xml =================================================================== --- trunk/dbunit/src/site/xdoc/howto.xml 2010-01-24 04:55:47 UTC (rev 1151) +++ trunk/dbunit/src/site/xdoc/howto.xml 2010-01-24 06:06:20 UTC (rev 1152) @@ -10,6 +10,9 @@ <li><a href="#assertdata"> Database data verification </a></li> + <li><a href="#fileloader"> + Data File Loader + </a></li> <li><a href="#canoo"> DbUnit Ant task and Canoo WebTest </a></li></ol> @@ -334,6 +337,30 @@ </p> + <a name="fileloader"> + <h3>Data File Loader</h3> + </a> + <p> + Nearly all tests need to load data from one or more files, + particularly for prep or expected data. + dbUnit has a set of data file loader utility helper classes + to load data sets from files on the classpath. + The available loaders are in package org.dbunit.util.fileloader. + A simple usage example: + </p> + <source> +DataFileLoader loader = new FlatXmlDataFileLoader(); +IDataSet ds = loader.load("/the/package/prepData.xml"); + </source> + <p> + Note the constructors for the various DataFileLoaders + accept replacement object and replacement substring maps + as used with ReplacementDataSet. + </p> + <p> + Refer to the DataFileLoader JavaDoc for further details. + </p> + <a name="canoo"> <h3>DbUnit Ant task and Canoo WebTest</h3> </a> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jef...@us...> - 2010-01-24 04:55:54
|
Revision: 1151 http://dbunit.svn.sourceforge.net/dbunit/?rev=1151&view=rev Author: jeffjensen Date: 2010-01-24 04:55:47 +0000 (Sun, 24 Jan 2010) Log Message: ----------- Rename file loader classes. Modified Paths: -------------- trunk/dbunit/src/test/org/dbunit/util/fileloader/AbstractDataFileLoaderTest.java Added Paths: ----------- trunk/dbunit/src/java/org/dbunit/util/fileloader/CsvDataFileLoader.java trunk/dbunit/src/java/org/dbunit/util/fileloader/FlatXmlDataFileLoader.java trunk/dbunit/src/java/org/dbunit/util/fileloader/FullXmlDataFileLoader.java trunk/dbunit/src/java/org/dbunit/util/fileloader/XlsDataFileLoader.java trunk/dbunit/src/test/org/dbunit/util/fileloader/CsvDataFileLoaderTest.java trunk/dbunit/src/test/org/dbunit/util/fileloader/FlatXmlDataFileLoaderTest.java trunk/dbunit/src/test/org/dbunit/util/fileloader/FullXmlDataFileLoaderTest.java trunk/dbunit/src/test/org/dbunit/util/fileloader/XlsDataFileLoaderTest.java Removed Paths: ------------- trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderCsv.java trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderFlatXml.java trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderFullXml.java trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderXls.java trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderCsvTest.java trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderFlatXmlTest.java trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderFullXmlTest.java trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderXlsTest.java Copied: trunk/dbunit/src/java/org/dbunit/util/fileloader/CsvDataFileLoader.java (from rev 1150, trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderCsv.java) =================================================================== --- trunk/dbunit/src/java/org/dbunit/util/fileloader/CsvDataFileLoader.java (rev 0) +++ trunk/dbunit/src/java/org/dbunit/util/fileloader/CsvDataFileLoader.java 2010-01-24 04:55:47 UTC (rev 1151) @@ -0,0 +1,78 @@ +/* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002-2008, DbUnit.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +package org.dbunit.util.fileloader; + +import java.io.IOException; +import java.net.URL; +import java.util.Map; + +import org.dbunit.dataset.DataSetException; +import org.dbunit.dataset.IDataSet; +import org.dbunit.dataset.csv.CsvURLDataSet; + +/** + * @author Jeff Jensen jeffjensen AT users.sourceforge.net + * @author Last changed by: $Author$ + * @version $Revision$ $Date$ + * @since <dbunit-version> + * + */ +public class CsvDataFileLoader extends AbstractDataFileLoader { + /** Create new instance. */ + public CsvDataFileLoader() { + } + + /** + * Create new instance with replacement objects. + * + * @param replacementObjects + * The replacement objects for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + */ + public CsvDataFileLoader(Map ro) { + super(ro); + } + + /** + * Create new instance with replacement objects and replacement substrings. + * + * @param ro + * The replacement objects for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + * @param rs + * The replacement substrings for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + */ + public CsvDataFileLoader(Map ro, Map rs) { + super(ro, rs); + } + + /** + * {@inheritDoc} + */ + protected IDataSet loadDataSet(URL url) throws DataSetException, + IOException { + IDataSet ds = new CsvURLDataSet(url); + + return ds; + } +} Property changes on: trunk/dbunit/src/java/org/dbunit/util/fileloader/CsvDataFileLoader.java ___________________________________________________________________ Added: svn:mime-type + text/plain Deleted: trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderCsv.java =================================================================== --- trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderCsv.java 2010-01-23 22:23:25 UTC (rev 1150) +++ trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderCsv.java 2010-01-24 04:55:47 UTC (rev 1151) @@ -1,78 +0,0 @@ -/* - * - * The DbUnit Database Testing Framework - * Copyright (C)2002-2008, DbUnit.org - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -package org.dbunit.util.fileloader; - -import java.io.IOException; -import java.net.URL; -import java.util.Map; - -import org.dbunit.dataset.DataSetException; -import org.dbunit.dataset.IDataSet; -import org.dbunit.dataset.csv.CsvURLDataSet; - -/** - * @author Jeff Jensen jeffjensen AT users.sourceforge.net - * @author Last changed by: $Author$ - * @version $Revision$ $Date$ - * @since <dbunit-version> - * - */ -public class DataFileLoaderCsv extends AbstractDataFileLoader { - /** Create new instance. */ - public DataFileLoaderCsv() { - } - - /** - * Create new instance with replacement objects. - * - * @param replacementObjects - * The replacement objects for use with - * {@link org.dbunit.dataset.ReplacementDataSet}. - */ - public DataFileLoaderCsv(Map ro) { - super(ro); - } - - /** - * Create new instance with replacement objects and replacement substrings. - * - * @param ro - * The replacement objects for use with - * {@link org.dbunit.dataset.ReplacementDataSet}. - * @param rs - * The replacement substrings for use with - * {@link org.dbunit.dataset.ReplacementDataSet}. - */ - public DataFileLoaderCsv(Map ro, Map rs) { - super(ro, rs); - } - - /** - * {@inheritDoc} - */ - protected IDataSet loadDataSet(URL url) throws DataSetException, - IOException { - IDataSet ds = new CsvURLDataSet(url); - - return ds; - } -} Deleted: trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderFlatXml.java =================================================================== --- trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderFlatXml.java 2010-01-23 22:23:25 UTC (rev 1150) +++ trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderFlatXml.java 2010-01-24 04:55:47 UTC (rev 1151) @@ -1,132 +0,0 @@ -/* - * - * The DbUnit Database Testing Framework - * Copyright (C)2002-2008, DbUnit.org - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -package org.dbunit.util.fileloader; - -import java.io.IOException; -import java.net.URL; -import java.util.Map; - -import org.dbunit.dataset.DataSetException; -import org.dbunit.dataset.IDataSet; -import org.dbunit.dataset.xml.FlatXmlDataSetBuilder; - -/** - * @author Jeff Jensen jeffjensen AT users.sourceforge.net - * @author Last changed by: $Author$ - * @version $Revision$ $Date$ - * @since 2.4.8 - */ -public class DataFileLoaderFlatXml extends AbstractDataFileLoader { - private FlatXmlDataSetBuilder builder = new FlatXmlDataSetBuilder(); - - /** Create new instance. */ - public DataFileLoaderFlatXml() { - } - - /** - * Create new instance with replacement objects. - * - * @param replacementObjects - * The replacement objects for use with - * {@link org.dbunit.dataset.ReplacementDataSet}. - */ - public DataFileLoaderFlatXml(Map ro) { - super(ro); - } - - /** - * Create new instance with replacement objects and replacement substrings. - * - * @param ro - * The replacement objects for use with - * {@link org.dbunit.dataset.ReplacementDataSet}. - * @param rs - * The replacement substrings for use with - * {@link org.dbunit.dataset.ReplacementDataSet}. - */ - public DataFileLoaderFlatXml(Map ro, Map rs) { - super(ro, rs); - } - - /** - * Create new instance with replacement objects, replacement substrings, and - * {@link org.dbunit.dataset.xml.FlatXmlDataSetBuilder}. - * - * @param ro - * The replacement objects for use with - * {@link org.dbunit.dataset.ReplacementDataSet}. - * @param rs - * The replacement substrings for use with - * {@link org.dbunit.dataset.ReplacementDataSet}. - * @param builder - * The {@link org.dbunit.dataset.xml.FlatXmlDataSetBuilder} to - * use. - */ - public DataFileLoaderFlatXml(Map ro, Map rs, FlatXmlDataSetBuilder builder) { - super(ro, rs); - this.builder = builder; - } - - /** - * Create new instance with a - * {@link org.dbunit.dataset.xml.FlatXmlDataSetBuilder}. - * - * @param builder - * The {@link org.dbunit.dataset.xml.FlatXmlDataSetBuilder} to - * use. - */ - public DataFileLoaderFlatXml(FlatXmlDataSetBuilder builder) { - this.builder = builder; - } - - /** - * {@inheritDoc} - */ - protected IDataSet loadDataSet(URL url) throws DataSetException, - IOException { - IDataSet ds = builder.build(url); - - return ds; - } - - /** - * Get the builder. - * - * @see {@link builder}. - * - * @return The builder. - */ - public FlatXmlDataSetBuilder getBuilder() { - return builder; - } - - /** - * Set the builder. - * - * @see {@link builder}. - * - * @param builder - * The builder to set. - */ - public void setBuilder(FlatXmlDataSetBuilder builder) { - this.builder = builder; - } -} Deleted: trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderFullXml.java =================================================================== --- trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderFullXml.java 2010-01-23 22:23:25 UTC (rev 1150) +++ trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderFullXml.java 2010-01-24 04:55:47 UTC (rev 1151) @@ -1,79 +0,0 @@ -/* - * - * The DbUnit Database Testing Framework - * Copyright (C)2002-2008, DbUnit.org - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -package org.dbunit.util.fileloader; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.Map; - -import org.dbunit.dataset.DataSetException; -import org.dbunit.dataset.IDataSet; -import org.dbunit.dataset.xml.XmlDataSet; - -/** - * @author Jeff Jensen jeffjensen AT users.sourceforge.net - * @author Last changed by: $Author$ - * @version $Revision$ $Date$ - * @since 2.4.8 - */ -public class DataFileLoaderFullXml extends AbstractDataFileLoader { - /** Create new instance. */ - public DataFileLoaderFullXml() { - } - - /** - * Create new instance with replacement objects. - * - * @param replacementObjects - * The replacement objects for use with - * {@link org.dbunit.dataset.ReplacementDataSet}. - */ - public DataFileLoaderFullXml(Map ro) { - super(ro); - } - - /** - * Create new instance with replacement objects and replacement substrings. - * - * @param ro - * The replacement objects for use with - * {@link org.dbunit.dataset.ReplacementDataSet}. - * @param rs - * The replacement substrings for use with - * {@link org.dbunit.dataset.ReplacementDataSet}. - */ - public DataFileLoaderFullXml(Map ro, Map rs) { - super(ro, rs); - } - - /** - * {@inheritDoc} - */ - protected IDataSet loadDataSet(URL url) throws DataSetException, - IOException { - InputStream in = url.openStream(); - IDataSet ds = new XmlDataSet(in); - - return ds; - } -} Deleted: trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderXls.java =================================================================== --- trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderXls.java 2010-01-23 22:23:25 UTC (rev 1150) +++ trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderXls.java 2010-01-24 04:55:47 UTC (rev 1151) @@ -1,80 +0,0 @@ -/* - * - * The DbUnit Database Testing Framework - * Copyright (C)2002-2008, DbUnit.org - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -package org.dbunit.util.fileloader; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.Map; - -import org.dbunit.dataset.DataSetException; -import org.dbunit.dataset.IDataSet; -import org.dbunit.dataset.excel.XlsDataSet; - -/** - * @author Jeff Jensen jeffjensen AT users.sourceforge.net - * @author Last changed by: $Author$ - * @version $Revision$ $Date$ - * @since 2.4.8 - * - */ -public class DataFileLoaderXls extends AbstractDataFileLoader { - /** Create new instance. */ - public DataFileLoaderXls() { - } - - /** - * Create new instance with replacement objects. - * - * @param replacementObjects - * The replacement objects for use with - * {@link org.dbunit.dataset.ReplacementDataSet}. - */ - public DataFileLoaderXls(Map ro) { - super(ro); - } - - /** - * Create new instance with replacement objects and replacement substrings. - * - * @param ro - * The replacement objects for use with - * {@link org.dbunit.dataset.ReplacementDataSet}. - * @param rs - * The replacement substrings for use with - * {@link org.dbunit.dataset.ReplacementDataSet}. - */ - public DataFileLoaderXls(Map ro, Map rs) { - super(ro, rs); - } - - /** - * {@inheritDoc} - */ - protected IDataSet loadDataSet(URL url) throws DataSetException, - IOException { - InputStream in = url.openStream(); - IDataSet ds = new XlsDataSet(in); - - return ds; - } -} Copied: trunk/dbunit/src/java/org/dbunit/util/fileloader/FlatXmlDataFileLoader.java (from rev 1150, trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderFlatXml.java) =================================================================== --- trunk/dbunit/src/java/org/dbunit/util/fileloader/FlatXmlDataFileLoader.java (rev 0) +++ trunk/dbunit/src/java/org/dbunit/util/fileloader/FlatXmlDataFileLoader.java 2010-01-24 04:55:47 UTC (rev 1151) @@ -0,0 +1,132 @@ +/* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002-2008, DbUnit.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package org.dbunit.util.fileloader; + +import java.io.IOException; +import java.net.URL; +import java.util.Map; + +import org.dbunit.dataset.DataSetException; +import org.dbunit.dataset.IDataSet; +import org.dbunit.dataset.xml.FlatXmlDataSetBuilder; + +/** + * @author Jeff Jensen jeffjensen AT users.sourceforge.net + * @author Last changed by: $Author$ + * @version $Revision$ $Date$ + * @since 2.4.8 + */ +public class FlatXmlDataFileLoader extends AbstractDataFileLoader { + private FlatXmlDataSetBuilder builder = new FlatXmlDataSetBuilder(); + + /** Create new instance. */ + public FlatXmlDataFileLoader() { + } + + /** + * Create new instance with replacement objects. + * + * @param replacementObjects + * The replacement objects for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + */ + public FlatXmlDataFileLoader(Map ro) { + super(ro); + } + + /** + * Create new instance with replacement objects and replacement substrings. + * + * @param ro + * The replacement objects for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + * @param rs + * The replacement substrings for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + */ + public FlatXmlDataFileLoader(Map ro, Map rs) { + super(ro, rs); + } + + /** + * Create new instance with replacement objects, replacement substrings, and + * {@link org.dbunit.dataset.xml.FlatXmlDataSetBuilder}. + * + * @param ro + * The replacement objects for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + * @param rs + * The replacement substrings for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + * @param builder + * The {@link org.dbunit.dataset.xml.FlatXmlDataSetBuilder} to + * use. + */ + public FlatXmlDataFileLoader(Map ro, Map rs, FlatXmlDataSetBuilder builder) { + super(ro, rs); + this.builder = builder; + } + + /** + * Create new instance with a + * {@link org.dbunit.dataset.xml.FlatXmlDataSetBuilder}. + * + * @param builder + * The {@link org.dbunit.dataset.xml.FlatXmlDataSetBuilder} to + * use. + */ + public FlatXmlDataFileLoader(FlatXmlDataSetBuilder builder) { + this.builder = builder; + } + + /** + * {@inheritDoc} + */ + protected IDataSet loadDataSet(URL url) throws DataSetException, + IOException { + IDataSet ds = builder.build(url); + + return ds; + } + + /** + * Get the builder. + * + * @see {@link builder}. + * + * @return The builder. + */ + public FlatXmlDataSetBuilder getBuilder() { + return builder; + } + + /** + * Set the builder. + * + * @see {@link builder}. + * + * @param builder + * The builder to set. + */ + public void setBuilder(FlatXmlDataSetBuilder builder) { + this.builder = builder; + } +} Property changes on: trunk/dbunit/src/java/org/dbunit/util/fileloader/FlatXmlDataFileLoader.java ___________________________________________________________________ Added: svn:mime-type + text/plain Copied: trunk/dbunit/src/java/org/dbunit/util/fileloader/FullXmlDataFileLoader.java (from rev 1150, trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderFullXml.java) =================================================================== --- trunk/dbunit/src/java/org/dbunit/util/fileloader/FullXmlDataFileLoader.java (rev 0) +++ trunk/dbunit/src/java/org/dbunit/util/fileloader/FullXmlDataFileLoader.java 2010-01-24 04:55:47 UTC (rev 1151) @@ -0,0 +1,79 @@ +/* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002-2008, DbUnit.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +package org.dbunit.util.fileloader; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.Map; + +import org.dbunit.dataset.DataSetException; +import org.dbunit.dataset.IDataSet; +import org.dbunit.dataset.xml.XmlDataSet; + +/** + * @author Jeff Jensen jeffjensen AT users.sourceforge.net + * @author Last changed by: $Author$ + * @version $Revision$ $Date$ + * @since 2.4.8 + */ +public class FullXmlDataFileLoader extends AbstractDataFileLoader { + /** Create new instance. */ + public FullXmlDataFileLoader() { + } + + /** + * Create new instance with replacement objects. + * + * @param replacementObjects + * The replacement objects for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + */ + public FullXmlDataFileLoader(Map ro) { + super(ro); + } + + /** + * Create new instance with replacement objects and replacement substrings. + * + * @param ro + * The replacement objects for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + * @param rs + * The replacement substrings for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + */ + public FullXmlDataFileLoader(Map ro, Map rs) { + super(ro, rs); + } + + /** + * {@inheritDoc} + */ + protected IDataSet loadDataSet(URL url) throws DataSetException, + IOException { + InputStream in = url.openStream(); + IDataSet ds = new XmlDataSet(in); + + return ds; + } +} Property changes on: trunk/dbunit/src/java/org/dbunit/util/fileloader/FullXmlDataFileLoader.java ___________________________________________________________________ Added: svn:mime-type + text/plain Copied: trunk/dbunit/src/java/org/dbunit/util/fileloader/XlsDataFileLoader.java (from rev 1150, trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderXls.java) =================================================================== --- trunk/dbunit/src/java/org/dbunit/util/fileloader/XlsDataFileLoader.java (rev 0) +++ trunk/dbunit/src/java/org/dbunit/util/fileloader/XlsDataFileLoader.java 2010-01-24 04:55:47 UTC (rev 1151) @@ -0,0 +1,80 @@ +/* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002-2008, DbUnit.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +package org.dbunit.util.fileloader; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.Map; + +import org.dbunit.dataset.DataSetException; +import org.dbunit.dataset.IDataSet; +import org.dbunit.dataset.excel.XlsDataSet; + +/** + * @author Jeff Jensen jeffjensen AT users.sourceforge.net + * @author Last changed by: $Author$ + * @version $Revision$ $Date$ + * @since 2.4.8 + * + */ +public class XlsDataFileLoader extends AbstractDataFileLoader { + /** Create new instance. */ + public XlsDataFileLoader() { + } + + /** + * Create new instance with replacement objects. + * + * @param replacementObjects + * The replacement objects for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + */ + public XlsDataFileLoader(Map ro) { + super(ro); + } + + /** + * Create new instance with replacement objects and replacement substrings. + * + * @param ro + * The replacement objects for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + * @param rs + * The replacement substrings for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + */ + public XlsDataFileLoader(Map ro, Map rs) { + super(ro, rs); + } + + /** + * {@inheritDoc} + */ + protected IDataSet loadDataSet(URL url) throws DataSetException, + IOException { + InputStream in = url.openStream(); + IDataSet ds = new XlsDataSet(in); + + return ds; + } +} Property changes on: trunk/dbunit/src/java/org/dbunit/util/fileloader/XlsDataFileLoader.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: trunk/dbunit/src/test/org/dbunit/util/fileloader/AbstractDataFileLoaderTest.java =================================================================== --- trunk/dbunit/src/test/org/dbunit/util/fileloader/AbstractDataFileLoaderTest.java 2010-01-23 22:23:25 UTC (rev 1150) +++ trunk/dbunit/src/test/org/dbunit/util/fileloader/AbstractDataFileLoaderTest.java 2010-01-24 04:55:47 UTC (rev 1151) @@ -34,13 +34,13 @@ */ public class AbstractDataFileLoaderTest extends TestCase { // just using this one so can run tests. - DataFileLoaderFlatXml loader = null; + FlatXmlDataFileLoader loader = null; /** * {@inheritDoc} */ protected void setUp() throws Exception { - loader = new DataFileLoaderFlatXml(); + loader = new FlatXmlDataFileLoader(); } public void testLoadDefaultDataSetEmpty() throws DataSetException { Copied: trunk/dbunit/src/test/org/dbunit/util/fileloader/CsvDataFileLoaderTest.java (from rev 1150, trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderCsvTest.java) =================================================================== --- trunk/dbunit/src/test/org/dbunit/util/fileloader/CsvDataFileLoaderTest.java (rev 0) +++ trunk/dbunit/src/test/org/dbunit/util/fileloader/CsvDataFileLoaderTest.java 2010-01-24 04:55:47 UTC (rev 1151) @@ -0,0 +1,54 @@ +/* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002-2008, DbUnit.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +package org.dbunit.util.fileloader; + +import junit.framework.TestCase; + +import org.dbunit.dataset.DataSetException; +import org.dbunit.dataset.IDataSet; + +/** + * @author Jeff Jensen jeffjensen AT users.sourceforge.net + * @author Last changed by: $Author$ + * @version $Revision$ $Date$ + * @since 2.4.8 + */ +public class CsvDataFileLoaderTest extends TestCase { + CsvDataFileLoader loader = null; + + /** + * {@inheritDoc} + */ + protected void setUp() throws Exception { + loader = new CsvDataFileLoader(); + } + + /** + * Test can load the specified file. + */ + public void testLoad() throws DataSetException { + String filename = "/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 + } +} Property changes on: trunk/dbunit/src/test/org/dbunit/util/fileloader/CsvDataFileLoaderTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Deleted: trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderCsvTest.java =================================================================== --- trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderCsvTest.java 2010-01-23 22:23:25 UTC (rev 1150) +++ trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderCsvTest.java 2010-01-24 04:55:47 UTC (rev 1151) @@ -1,54 +0,0 @@ -/* - * - * The DbUnit Database Testing Framework - * Copyright (C)2002-2008, DbUnit.org - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -package org.dbunit.util.fileloader; - -import junit.framework.TestCase; - -import org.dbunit.dataset.DataSetException; -import org.dbunit.dataset.IDataSet; - -/** - * @author Jeff Jensen jeffjensen AT users.sourceforge.net - * @author Last changed by: $Author$ - * @version $Revision$ $Date$ - * @since 2.4.8 - */ -public class DataFileLoaderCsvTest extends TestCase { - DataFileLoaderCsv loader = null; - - /** - * {@inheritDoc} - */ - protected void setUp() throws Exception { - loader = new DataFileLoaderCsv(); - } - - /** - * Test can load the specified file. - */ - public void testLoad() throws DataSetException { - String filename = "/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 - } -} Deleted: trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderFlatXmlTest.java =================================================================== --- trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderFlatXmlTest.java 2010-01-23 22:23:25 UTC (rev 1150) +++ trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderFlatXmlTest.java 2010-01-24 04:55:47 UTC (rev 1151) @@ -1,54 +0,0 @@ -/* - * - * The DbUnit Database Testing Framework - * Copyright (C)2002-2008, DbUnit.org - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -package org.dbunit.util.fileloader; - -import junit.framework.TestCase; - -import org.dbunit.dataset.DataSetException; -import org.dbunit.dataset.IDataSet; - -/** - * @author Jeff Jensen jeffjensen AT users.sourceforge.net - * @author Last changed by: $Author$ - * @version $Revision$ $Date$ - * @since 2.4.8 - */ -public class DataFileLoaderFlatXmlTest extends TestCase { - DataFileLoaderFlatXml loader = null; - - /** - * {@inheritDoc} - */ - protected void setUp() throws Exception { - loader = new DataFileLoaderFlatXml(); - } - - /** - * Test can load the specified file. - */ - public void testLoad() throws DataSetException { - String filename = "/flatXmlDataSetTest.xml"; - IDataSet ds = loader.load(filename); - assertTrue("No tables found in dataset.", ds.getTableNames().length > 0); - // DataSet loading tests verify data accuracy - } -} Deleted: trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderFullXmlTest.java =================================================================== --- trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderFullXmlTest.java 2010-01-23 22:23:25 UTC (rev 1150) +++ trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderFullXmlTest.java 2010-01-24 04:55:47 UTC (rev 1151) @@ -1,54 +0,0 @@ -/* - * - * The DbUnit Database Testing Framework - * Copyright (C)2002-2008, DbUnit.org - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -package org.dbunit.util.fileloader; - -import junit.framework.TestCase; - -import org.dbunit.dataset.DataSetException; -import org.dbunit.dataset.IDataSet; - -/** - * @author Jeff Jensen jeffjensen AT users.sourceforge.net - * @author Last changed by: $Author$ - * @version $Revision$ $Date$ - * @since 2.4.8 - */ -public class DataFileLoaderFullXmlTest extends TestCase { - DataFileLoaderFullXml loader = null; - - /** - * {@inheritDoc} - */ - protected void setUp() throws Exception { - loader = new DataFileLoaderFullXml(); - } - - /** - * Test can load the specified file. - */ - public void testLoad() throws DataSetException { - String filename = "/xmlTableTest.xml"; - IDataSet ds = loader.load(filename); - assertTrue("No tables found in dataset.", ds.getTableNames().length > 0); - // DataSet loading tests verify data accuracy - } -} Deleted: trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderXlsTest.java =================================================================== --- trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderXlsTest.java 2010-01-23 22:23:25 UTC (rev 1150) +++ trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderXlsTest.java 2010-01-24 04:55:47 UTC (rev 1151) @@ -1,54 +0,0 @@ -/* - * - * The DbUnit Database Testing Framework - * Copyright (C)2002-2008, DbUnit.org - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -package org.dbunit.util.fileloader; - -import junit.framework.TestCase; - -import org.dbunit.dataset.DataSetException; -import org.dbunit.dataset.IDataSet; - -/** - * @author Jeff Jensen jeffjensen AT users.sourceforge.net - * @author Last changed by: $Author$ - * @version $Revision$ $Date$ - * @since 2.4.8 - */ -public class DataFileLoaderXlsTest extends TestCase { - DataFileLoaderXls loader = null; - - /** - * {@inheritDoc} - */ - protected void setUp() throws Exception { - loader = new DataFileLoaderXls(); - } - - /** - * Test can load the specified file. - */ - public void testLoad() throws DataSetException { - String filename = "/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/org/dbunit/util/fileloader/FlatXmlDataFileLoaderTest.java (from rev 1150, trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderFlatXmlTest.java) =================================================================== --- trunk/dbunit/src/test/org/dbunit/util/fileloader/FlatXmlDataFileLoaderTest.java (rev 0) +++ trunk/dbunit/src/test/org/dbunit/util/fileloader/FlatXmlDataFileLoaderTest.java 2010-01-24 04:55:47 UTC (rev 1151) @@ -0,0 +1,54 @@ +/* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002-2008, DbUnit.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +package org.dbunit.util.fileloader; + +import junit.framework.TestCase; + +import org.dbunit.dataset.DataSetException; +import org.dbunit.dataset.IDataSet; + +/** + * @author Jeff Jensen jeffjensen AT users.sourceforge.net + * @author Last changed by: $Author$ + * @version $Revision$ $Date$ + * @since 2.4.8 + */ +public class FlatXmlDataFileLoaderTest extends TestCase { + FlatXmlDataFileLoader loader = null; + + /** + * {@inheritDoc} + */ + protected void setUp() throws Exception { + loader = new FlatXmlDataFileLoader(); + } + + /** + * Test can load the specified file. + */ + public void testLoad() throws DataSetException { + String filename = "/flatXmlDataSetTest.xml"; + IDataSet ds = loader.load(filename); + assertTrue("No tables found in dataset.", ds.getTableNames().length > 0); + // DataSet loading tests verify data accuracy + } +} Property changes on: trunk/dbunit/src/test/org/dbunit/util/fileloader/FlatXmlDataFileLoaderTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Copied: trunk/dbunit/src/test/org/dbunit/util/fileloader/FullXmlDataFileLoaderTest.java (from rev 1150, trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderFullXmlTest.java) =================================================================== --- trunk/dbunit/src/test/org/dbunit/util/fileloader/FullXmlDataFileLoaderTest.java (rev 0) +++ trunk/dbunit/src/test/org/dbunit/util/fileloader/FullXmlDataFileLoaderTest.java 2010-01-24 04:55:47 UTC (rev 1151) @@ -0,0 +1,54 @@ +/* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002-2008, DbUnit.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +package org.dbunit.util.fileloader; + +import junit.framework.TestCase; + +import org.dbunit.dataset.DataSetException; +import org.dbunit.dataset.IDataSet; + +/** + * @author Jeff Jensen jeffjensen AT users.sourceforge.net + * @author Last changed by: $Author$ + * @version $Revision$ $Date$ + * @since 2.4.8 + */ +public class FullXmlDataFileLoaderTest extends TestCase { + FullXmlDataFileLoader loader = null; + + /** + * {@inheritDoc} + */ + protected void setUp() throws Exception { + loader = new FullXmlDataFileLoader(); + } + + /** + * Test can load the specified file. + */ + public void testLoad() throws DataSetException { + String filename = "/xmlTableTest.xml"; + IDataSet ds = loader.load(filename); + assertTrue("No tables found in dataset.", ds.getTableNames().length > 0); + // DataSet loading tests verify data accuracy + } +} Property changes on: trunk/dbunit/src/test/org/dbunit/util/fileloader/FullXmlDataFileLoaderTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Copied: trunk/dbunit/src/test/org/dbunit/util/fileloader/XlsDataFileLoaderTest.java (from rev 1150, trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderXlsTest.java) =================================================================== --- trunk/dbunit/src/test/org/dbunit/util/fileloader/XlsDataFileLoaderTest.java (rev 0) +++ trunk/dbunit/src/test/org/dbunit/util/fileloader/XlsDataFileLoaderTest.java 2010-01-24 04:55:47 UTC (rev 1151) @@ -0,0 +1,54 @@ +/* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002-2008, DbUnit.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +package org.dbunit.util.fileloader; + +import junit.framework.TestCase; + +import org.dbunit.dataset.DataSetException; +import org.dbunit.dataset.IDataSet; + +/** + * @author Jeff Jensen jeffjensen AT users.sourceforge.net + * @author Last changed by: $Author$ + * @version $Revision$ $Date$ + * @since 2.4.8 + */ +public class XlsDataFileLoaderTest extends TestCase { + XlsDataFileLoader loader = null; + + /** + * {@inheritDoc} + */ + protected void setUp() throws Exception { + loader = new XlsDataFileLoader(); + } + + /** + * Test can load the specified file. + */ + public void testLoad() throws DataSetException { + String filename = "/dataSetTest.xls"; + IDataSet ds = loader.load(filename); + assertTrue("No tables found in dataset.", ds.getTableNames().length > 0); + // DataSet loading tests verify data accuracy + } +} Property changes on: trunk/dbunit/src/test/org/dbunit/util/fileloader/XlsDataFileLoaderTest.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: <jb...@us...> - 2010-01-23 22:23:55
|
Revision: 1150 http://dbunit.svn.sourceforge.net/dbunit/?rev=1150&view=rev Author: jbhurst Date: 2010-01-23 22:23:25 +0000 (Sat, 23 Jan 2010) Log Message: ----------- [2938029] - Corrected filename of xmlTableTest.xml. Modified Paths: -------------- trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderFullXmlTest.java Modified: trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderFullXmlTest.java =================================================================== --- trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderFullXmlTest.java 2010-01-23 22:21:16 UTC (rev 1149) +++ trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderFullXmlTest.java 2010-01-23 22:23:25 UTC (rev 1150) @@ -46,7 +46,7 @@ * Test can load the specified file. */ public void testLoad() throws DataSetException { - String filename = "/XmlTableTest.xml"; + String filename = "/xmlTableTest.xml"; IDataSet ds = loader.load(filename); assertTrue("No tables found in dataset.", ds.getTableNames().length > 0); // DataSet loading tests verify data accuracy This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2010-01-23 22:21:27
|
Revision: 1149 http://dbunit.svn.sourceforge.net/dbunit/?rev=1149&view=rev Author: jbhurst Date: 2010-01-23 22:21:16 +0000 (Sat, 23 Jan 2010) Log Message: ----------- [2875235] - Fixed Oracle dependencies for "official" profile. Modified Paths: -------------- trunk/dbunit/pom.xml Modified: trunk/dbunit/pom.xml =================================================================== --- trunk/dbunit/pom.xml 2010-01-23 22:17:13 UTC (rev 1148) +++ trunk/dbunit/pom.xml 2010-01-23 22:21:16 UTC (rev 1149) @@ -698,6 +698,17 @@ <profiles> <profile> <id>official</id> + <!-- JH_TODO: it would be better to "chain" these from the default profile. But it appears this isn't possible with Maven. --> + <properties> + <dbunit.profile>hsqldb</dbunit.profile> + <dbunit.profile.driverClass>org.hsqldb.jdbcDriver</dbunit.profile.driverClass> + <dbunit.profile.url>jdbc:hsqldb:mem:.</dbunit.profile.url> + <dbunit.profile.schema>PUBLIC</dbunit.profile.schema> + <dbunit.profile.user>sa</dbunit.profile.user> + <dbunit.profile.password></dbunit.profile.password> + <dbunit.profile.unsupportedFeatures>BLOB,CLOB,SCROLLABLE_RESULTSET,INSERT_IDENTITY,TRUNCATE_TABLE,SDO_GEOMETRY</dbunit.profile.unsupportedFeatures> + <dbunit.profile.ddl>empty.sql</dbunit.profile.ddl> <!-- DDL in HypersonicEnvironment --> + </properties> <dependencies> <dependency> <groupId>javax.sql</groupId> @@ -705,6 +716,12 @@ <version>2.0</version> <optional>true</optional> </dependency> + <dependency> + <groupId>com.oracle</groupId> + <artifactId>ojdbc14</artifactId> + <version>10.2.0.4.0</version> + <optional>true</optional> + </dependency> </dependencies> <build> <pluginManagement> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2010-01-23 22:17:20
|
Revision: 1148 http://dbunit.svn.sourceforge.net/dbunit/?rev=1148&view=rev Author: jbhurst Date: 2010-01-23 22:17:13 +0000 (Sat, 23 Jan 2010) Log Message: ----------- [2905970] - Reverted POI-3.5 changes -- incompatible with Java 1.4. Modified Paths: -------------- trunk/dbunit/pom.xml trunk/dbunit/src/changes/changes.xml trunk/dbunit/src/java/org/dbunit/dataset/excel/XlsTable.java trunk/dbunit/src/site/xdoc/components.xml trunk/dbunit/src/site/xdoc/migration.xml Modified: trunk/dbunit/pom.xml =================================================================== --- trunk/dbunit/pom.xml 2010-01-23 16:57:03 UTC (rev 1147) +++ trunk/dbunit/pom.xml 2010-01-23 22:17:13 UTC (rev 1148) @@ -256,7 +256,7 @@ <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> - <version>3.5-FINAL</version> + <version>3.2-FINAL</version> <optional>true</optional> </dependency> Modified: trunk/dbunit/src/changes/changes.xml =================================================================== --- trunk/dbunit/src/changes/changes.xml 2010-01-23 16:57:03 UTC (rev 1147) +++ trunk/dbunit/src/changes/changes.xml 2010-01-23 22:17:13 UTC (rev 1148) @@ -14,7 +14,6 @@ <action dev="gommma" type="fix" issue="2887115" due-to="unwissender2009">SQL: "Create Domain" ... Data Types are not supported.</action> <action dev="jbhurst" type="add" issue="2875253" due-to="caseylucas">Additional refinements for Oracle SDO_GEOMETRY datatype</action> <action dev="jbhurst" type="add" issue="2921131" due-to="vlamp">Add timezone support for timestamp data type</action> - <action dev="jbhurst" type="add" issue="2905970" due-to="pkamm">Upgrade to POI Version 3.5-FINAL</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> </release> Modified: trunk/dbunit/src/java/org/dbunit/dataset/excel/XlsTable.java =================================================================== --- trunk/dbunit/src/java/org/dbunit/dataset/excel/XlsTable.java 2010-01-23 16:57:03 UTC (rev 1147) +++ trunk/dbunit/src/java/org/dbunit/dataset/excel/XlsTable.java 2010-01-23 22:17:13 UTC (rev 1148) @@ -30,9 +30,9 @@ import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFCellStyle; +import org.apache.poi.hssf.usermodel.HSSFDateUtil; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; -import org.apache.poi.ss.usermodel.DateUtil; import org.dbunit.dataset.AbstractTable; import org.dbunit.dataset.Column; import org.dbunit.dataset.DataSetException; @@ -150,7 +150,7 @@ { case HSSFCell.CELL_TYPE_NUMERIC: HSSFCellStyle style = cell.getCellStyle(); - if (DateUtil.isCellDateFormatted(cell)) + if (HSSFDateUtil.isCellDateFormatted(cell)) { return getDateValue(cell); } @@ -203,7 +203,7 @@ logger.debug("getDateValue(cell={}) - start", cell); double numericValue = cell.getNumericCellValue(); - Date date = DateUtil.getJavaDate(numericValue); + Date date = HSSFDateUtil.getJavaDate(numericValue); // Add the timezone offset again because it was subtracted automatically by Apache-POI (we need UTC) long tzOffset = TimeZone.getDefault().getOffset(date.getTime()); date = new Date(date.getTime() + tzOffset); Modified: trunk/dbunit/src/site/xdoc/components.xml =================================================================== --- trunk/dbunit/src/site/xdoc/components.xml 2010-01-23 16:57:03 UTC (rev 1147) +++ trunk/dbunit/src/site/xdoc/components.xml 2010-01-23 22:17:13 UTC (rev 1148) @@ -1,24 +1,24 @@ <?xml version="1.0" encoding="ISO-8859-1"?> <document><properties><title>Core Components</title></properties><body><section> - + <h3>Core Components</h3> - <p>This document attemps to give you an overview of the core classes that make up DbUnit. + <p>This document attemps to give you an overview of the core classes that make up DbUnit. Following are the core interfaces or abstract classes: - + <table border="1"> - <tr> + <tr> <th>Class</th> <th>Description</th> </tr> - <tr> + <tr> <td><a href="#databaseconnection">IDatabaseConnection</a></td> <td>Interface representing a DbUnit connection to a database.</td> </tr> - <tr> + <tr> <td><a href="#dataset">IDataSet</a></td> <td>Interface representing a collection of tables.</td> </tr> - <tr> + <tr> <td><a href="#databaseoperation">DatabaseOperation</a></td> <td>Abstract class representing an operation performed on the database before and after each test.</td> </tr> @@ -26,72 +26,72 @@ </p> <h3><a name="databaseconnection">IDatabaseConnection</a></h3> - <p>The <a href="apidocs/org/dbunit/database/IDatabaseConnection.html">IDatabaseConnection</a> interface represents - a DbUnit connection to a database. - + <p>The <a href="apidocs/org/dbunit/database/IDatabaseConnection.html">IDatabaseConnection</a> interface represents + a DbUnit connection to a database. + <table border="1"> - <tr> + <tr> <th>Class</th> <th>Description</th> </tr> - <tr> + <tr> <td><a href="apidocs/org/dbunit/database/DatabaseConnection.html">DatabaseConnection</a></td> <td>Wraps a JDBC connection.</td> </tr> - <tr> + <tr> <td><a href="apidocs/org/dbunit/database/DatabaseDataSourceConnection.html">DatabaseDataSourceConnection</a></td> <td>Wraps a JDBC DataSource.</td> </tr> </table> </p> - + <h3><a name="dataset">IDataSet</a></h3> - <p>The <a href="apidocs/org/dbunit/dataset/IDataSet.html">IDataSet</a> interface represents is a collection - of tables. This is the primary abstraction used by DbUnit to manipulate tabular data. + <p>The <a href="apidocs/org/dbunit/dataset/IDataSet.html">IDataSet</a> interface represents is a collection + of tables. This is the primary abstraction used by DbUnit to manipulate tabular data. </p> - <p>Most commonly used implemetations: + <p>Most commonly used implemetations: <table border="1"> - <tr> + <tr> <th>Implementation</th> <th>Description</th> </tr> - <tr> + <tr> <td><a name="flatxmldataset" href="apidocs/org/dbunit/dataset/xml/FlatXmlDataSet.html">FlatXmlDataSet</a></td> - <td> - Reads and writes flat XML dataset document. Each XML element corresponds to a table row. - Each XML element name corresponds to a table name. The XML attributes + <td> + Reads and writes flat XML dataset document. Each XML element corresponds to a table row. + Each XML element name corresponds to a table name. The XML attributes correspond to table columns.<br/> Flat XML dataset document sample: <source><![CDATA[ <!DOCTYPE dataset SYSTEM "my-dataset.dtd"> <dataset> - <TEST_TABLE COL0="row 0 col 0" + <TEST_TABLE COL0="row 0 col 0" COL1="row 0 col 1" - COL2="row 0 col 2"/> + COL2="row 0 col 2"/> <TEST_TABLE COL1="row 1 col 1"/> - <SECOND_TABLE COL0="row 0 col 0" + <SECOND_TABLE COL0="row 0 col 0" COL1="row 0 col 1" /> <EMPTY_TABLE/> </dataset>]]></source> <br/> - To specify null values, omit corresponding attribute. + To specify null values, omit corresponding attribute. In the above example, missing COL0 and COL2 attributes of TEST_TABLE second row represents null values. <br/> Table metadata is deduced from the first row of each table by default, whereas it is possible to enable the <i>column sensing</i> feature as described in <a name="FAQ-differentcolumnnumber" href="faq.html#differentcolumnnumber">differentcolumnnumber</a> <b>Beware you may get a NoSuchColumnException if the first row of a table has one or more null values.</b> - Because of that, this is highly recommended to use DTD. DbUnit will use the - columns declared in the DTD as table metadata. DbUnit only support external system URI. + Because of that, this is highly recommended to use DTD. DbUnit will use the + columns declared in the DTD as table metadata. DbUnit only support external system URI. The URI can be absolute or relative. <br/> Another way to cope with this problem is to use the <a href= "#replacementdataset">ReplacementDataSet</a>. - + </td> </tr> - <tr> + <tr> <td><a name="xmldataset" href="apidocs/org/dbunit/dataset/xml/XmlDataSet.html">XmlDataSet</a></td> <td> - Reads and writes original XML dataset document. This format + Reads and writes original XML dataset document. This format is very verbose and must conform to the following DTD: <source><![CDATA[ <?xml version="1.0" encoding="UTF-8"?> @@ -141,13 +141,13 @@ <br/> </td> </tr> - <tr> + <tr> <td><a name="streamingdataset" href="apidocs/org/dbunit/database/StreamingDataSet.html">StreamingDataSet</a></td> <td>Consumes a producer and expose its content as a dataset. Provides cursor like forward only access to it and only keeps the active row in memory. Can be used with FlatXmlProducer and XmlProvider. <br/> This is a very efficient way to load XML dataset document when working with forward only database operations (UPDATE, INSERT, REFRESH). <br/> -Following sample shows how to load a flat XML dataset with the StreamingDataSet: +Following sample shows how to load a flat XML dataset with the StreamingDataSet: <source> IDataSetProducer producer = new FlatXmlProducer( new InputSource("dataset.xml")); @@ -155,13 +155,13 @@ </source> </td> </tr> - <tr> + <tr> <td><a name="databasedataset" href="apidocs/org/dbunit/database/DatabaseDataSet.html">DatabaseDataSet</a></td> - <td>Adapter that provides access - to a database instance as a dataset. This class is not usually instantiated + <td>Adapter that provides access + to a database instance as a dataset. This class is not usually instantiated directly but from the factory method <code>IDatabaseConnection.createDataSet()</code>.</td> </tr> - <tr> + <tr> <td><a name="querydataset" href="apidocs/org/dbunit/database/QueryDataSet.html">QueryDataSet</a></td> <td>Holds collection of tables resulting from database queries. <br/> @@ -174,41 +174,41 @@ </td> </tr> - <tr> + <tr> <td><a name="defaultdataset" href="apidocs/org/dbunit/dataset/DefaultDataSet.html">DefaultDataSet</a></td> <td>Uses to create datasets programmatically.</td> </tr> - <tr> + <tr> <td><a name="compositedataset" href="apidocs/org/dbunit/dataset/CompositeDataSet.html">CompositeDataSet</a></td> <td>Combines multiple datasets into a single logical dataset.</td> </tr> - <tr> + <tr> <td><a name="filtereddataset" href="apidocs/org/dbunit/dataset/FilteredDataSet.html">FilteredDataSet</a></td> <td>Decorator that exposes only some tables from decorated dataset. Can be used with different filtering strategies. Some strategies can include/exclude tables without altering their order while others expose tables with a different order. <table border="1"> - <tr> + <tr> <th>Strategy</th> <th>Description</th> </tr> - <tr> + <tr> <td>IncludeTableFilter</td> <td>Exposes only matching tables pattern without modifying the original table order. Support wildcards. </td> </tr> - <tr> + <tr> <td>ExcludeTableFilter </td> <td>Hides matching tables pattern without modifying the original table order. Support wildcards.</td> </tr> - <tr> + <tr> <td>SequenceTableFilter </td> <td>Exposes a configured table sequence and can be used to reorder dataset table. This is the original filtering strategy from DbUnit 1.x. </td> </tr> - <tr> + <tr> <td>DatabaseSequenceFilter</td> - <td> Automatically determine the tables order using foreign/exported keys information. - This strategy is vendor - independent and should work with any JDBC driver that implement the - <code>DatabaseMetaData.getExportedKeys()</code> method. + <td> Automatically determine the tables order using foreign/exported keys information. + This strategy is vendor + independent and should work with any JDBC driver that implement the + <code>DatabaseMetaData.getExportedKeys()</code> method. <br/> Support simple multi-level dependency like this: <source> @@ -224,14 +224,13 @@ </td> </tr> - <tr> + <tr> <td><a name="xlsdataset" href="apidocs/org/dbunit/dataset/excel/XlsDataSet.html">XlsDataSet</a></td> <td>Read and writes MS Excel dataset documents. Each sheet represents a table. The first row of a sheet defines the columns names and remaining rows contains the data.</td> - <td><b>Note:</b> You need to include Apache POI version 3.5-FINAL or later in your classpath to use XmlDataSet.</td> </tr> - <tr> + <tr> <td><a name= "replacementdataset" href="apidocs/org/dbunit/dataset/ReplacementDataSet.html">ReplacementDataSet</a></td> <td>Decorator that replaces placeholder objects from the decorated dataset with replacement objects. Substring substitution is also possible. <br/> @@ -240,19 +239,19 @@ <source><![CDATA[ <?xml version="1.0"?> <dataset> - <TEST_TABLE COL0="row 0 col 0" - COL1="[null]"/> + <TEST_TABLE COL0="row 0 col 0" + COL1="[null]"/> <TEST_TABLE COL1="row 1 col 0" - COL2="row 1 col 1"/> + COL2="row 1 col 1"/> </dataset>]]></source> <br/> Loading the flat XML dataset: <source><![CDATA[ ReplacementDataSet dataSet = new ReplacementDataSet( - new FlatXmlDataSet(\x85)); + new FlatXmlDataSet(\x85)); dataSet.addReplacementObject("[NULL]", null);]]></source> <br/> - You can choose to use a fail-fast replacement to ensure that all placeholders are actually set + You can choose to use a fail-fast replacement to ensure that all placeholders are actually set and no one is missing in the replacement map. If one is missing the replacement will fail immediately throwing an exception. (Note that the default behaviour is to leave the non-replaced placeholder there and proceeding work silently): <source>replacementDataSet.setStrictReplacement(true);</source> @@ -263,80 +262,80 @@ </p> <h3><a name="databaseoperation">DatabaseOperation</a></h3> <p><a href="apidocs/org/dbunit/operation/DatabaseOperation.html">DatabaseOperation</a> is an abstract class that represents an operation performed on the database before and after each test. </p> - <p>The two most usefull operations are <a href="#refresh">REFRESH</a> and - <a href="#cleanInsert">CLEAN_INSERT</a>. They - are the ones you will deal usualy with. They represent two + <p>The two most usefull operations are <a href="#refresh">REFRESH</a> and + <a href="#cleanInsert">CLEAN_INSERT</a>. They + are the ones you will deal usualy with. They represent two testing strategies with different benefits and tradeoffs. </p> <table border="1"> - <tr> + <tr> <th>Operation</th> <th>Description</th> </tr> - <tr> + <tr> <td><a href="apidocs/org/dbunit/operation/UpdateOperation.html">DatabaseOperation.UPDATE</a></td> - <td>This operation updates the database from the dataset contents. This operation - assumes that table data already exists in the target database and fails + <td>This operation updates the database from the dataset contents. This operation + assumes that table data already exists in the target database and fails if this is not the case.</td> </tr> - <tr> + <tr> <td><a name="insert" href="apidocs/org/dbunit/operation/InsertOperation.html">DatabaseOperation.INSERT</a></td> - <td>This operation inserts the dataset contents into the database. This operation - assumes that table data does not exist in the target database and fails - if this is not the case. To prevent problems with foreign keys, tables must + <td>This operation inserts the dataset contents into the database. This operation + assumes that table data does not exist in the target database and fails + if this is not the case. To prevent problems with foreign keys, tables must be sequenced appropriately in the dataset.</td> </tr> - <tr> + <tr> <td><a name="delete" href="apidocs/org/dbunit/operation/DeleteOperation.html">DatabaseOperation.DELETE</a></td> - <td>This operation deletes only the dataset contents from the database. This - operation does not delete the entire table contents but only data that are + <td>This operation deletes only the dataset contents from the database. This + operation does not delete the entire table contents but only data that are present in the dataset.</td> </tr> - <tr> + <tr> <td><a name="deleteall" href="apidocs/org/dbunit/operation/DeleteAllOperation.html">DatabaseOperation.DELETE_ALL</a></td> <td>Deletes all rows of tables present in the specified dataset. If the dataset does not contains a particular table, but that table exists in the database, the database table is not affected. Table are truncated in reverse sequence.</td> </tr> - <tr> + <tr> <td><a name="truncate" href="apidocs/org/dbunit/operation/TruncateTableOperation.html">DatabaseOperation.TRUNCATE</a></td> - <td>Truncate tables present in the specified dataset. If the dataset does not contains a particular table, but that table exists in the database, the database table is not affected. Table are truncated in reverse sequence. + <td>Truncate tables present in the specified dataset. If the dataset does not contains a particular table, but that table exists in the database, the database table is not affected. Table are truncated in reverse sequence. </td> </tr> - <tr> + <tr> <td><a name="refresh" href="apidocs/org/dbunit/operation/RefreshOperation.html">DatabaseOperation.REFRESH</a></td> - <td>This operation literally refreshes dataset contents into the target database. - This means that data of existing rows are updated and non-existing row get - inserted. Any rows which exist in the database but not in dataset stay unaffected. - This approach is more appropriate for tests that assume other data may exist + <td>This operation literally refreshes dataset contents into the target database. + This means that data of existing rows are updated and non-existing row get + inserted. Any rows which exist in the database but not in dataset stay unaffected. + This approach is more appropriate for tests that assume other data may exist in the database.<br/> - if they are correctly written, tests using this strategy can even be performed + if they are correctly written, tests using this strategy can even be performed on a populated database like a copy of a production database.</td> </tr> - <tr> + <tr> <td><a name="cleanInsert">DatabaseOperation.CLEAN_INSERT</a></td> - <td>This composite operation performs a <a href="#deleteall">DELETE_ALL</a> operation followed by an - <a href="#insert">INSERT</a> operation. This is the safest approach to ensure that the database - is in a known state. This is appropriate for tests that require the database + <td>This composite operation performs a <a href="#deleteall">DELETE_ALL</a> operation followed by an + <a href="#insert">INSERT</a> operation. This is the safest approach to ensure that the database + is in a known state. This is appropriate for tests that require the database to only contain a specific set of data.</td> </tr> - <tr> + <tr> <td>DatabaseOperation.NONE</td> <td>Empty operation that does absolutely nothing.</td> </tr> - <tr> + <tr> <td><a href="apidocs/org/dbunit/operation/CompositeOperation.html">CompositeOperation</a></td> <td>This operation combines multiple operations into a single one.</td> </tr> - <tr> + <tr> <td><a href="apidocs/org/dbunit/operation/TransactionOperation.html">TransactionOperation</a></td> - <td>This operation decorates an operation and executes it within the context + <td>This operation decorates an operation and executes it within the context of a transaction.</td> </tr> - <tr> + <tr> <td><a name="InsertIdentityOperation" href="apidocs/org/dbunit/ext/mssql/InsertIdentityOperation.html">InsertIdentityOperation</a></td> - <td>This operation decorates an insert operation and disables the MS SQL - Server automatic identifier generation (IDENTITY) during its execution. - Use following constants InsertIdentityOperation.INSERT, InsertIdentityOperation.CLEAN_INSERT + <td>This operation decorates an insert operation and disables the MS SQL + Server automatic identifier generation (IDENTITY) during its execution. + Use following constants InsertIdentityOperation.INSERT, InsertIdentityOperation.CLEAN_INSERT or InsertIdentityOperation.REFRESH instead of those defined in DatabaseOperation.</td> </tr> </table> Modified: trunk/dbunit/src/site/xdoc/migration.xml =================================================================== --- trunk/dbunit/src/site/xdoc/migration.xml 2010-01-23 16:57:03 UTC (rev 1147) +++ trunk/dbunit/src/site/xdoc/migration.xml 2010-01-23 22:17:13 UTC (rev 1148) @@ -6,30 +6,7 @@ <h2>Migration guide</h2> <p>To migrate from an older DbUnit release to a newer one you can find some useful information here.</p> - - <subsection name="2.4.7 to 2.4.8"> - <p>There is a change to dependencies. - <table border="1"> - <tr> - <th>Tracker #</th> - <th>Affects</th> - <th>Migration</th> - <th>Background information</th> - </tr> - - <tr> - <td>2905970</td> - <td>XlsDataSet</td> - <td>Upgrade to POI 3.5-FINAL or later. - <td>POI moved static utility methods from org.apache.poi.hssf.usermodel.HSSFDateUtil to a superclass. - This required a recompile against the new version, and clients will need to use the new version. - </td> - </td> - </tr> - </table> - </p> - </subsection> - + <subsection name="2.4.3 to 2.4.4"> <p>There has been a very small change to the API.</p> <table border="1"> @@ -40,42 +17,42 @@ <th>Background information</th> </tr> - <tr> + <tr> <td>2567724</td> <td><code>new method org.dbunit.IDatabaseTester#setOperationListener()</code></td> <td>If you extend from AbstractDatabaseTester then there is nothing to do. If you implement the IDatabaseTester interface then you must support the methods of IOperationListener. As reference implementation you can look at the AbstractDatabaseTester.</td> - <td>This change was necessary to ensure that the user defined IDatabaseConnection setup provided by + <td>This change was necessary to ensure that the user defined IDatabaseConnection setup provided by <code>DatabaseTestCase#setUpDatabaseConfig(DatabaseConfig databaseConfig)</code> is also used in the setUp and tearDown operations. </td> </tr> - <tr> + <tr> <td>1956543</td> <td><code>new method org.dbunit.database.IDatabaseConnection#createTable(String tableName, PreparedStatement preparedStatement)</code></td> <td>If you extend from AbstractDatabaseConnection then there is nothing to do. If you implement the IDatabaseConnection interface then you must implement the new method. As reference implementation you can look into AbstractDatabaseConnection.</td> - <td>This addition comes from the feature request + <td>This addition comes from the feature request <a href='https://sourceforge.net/tracker/index.php?func=detail&aid=1956543&group_id=47439&atid=449494'>1956543</a> where you can read details about why this is useful. </td> </tr> - <tr> + <tr> <td>1956543</td> <td><code>new method org.dbunit.database.IResultSetTableFactory#createTable(String tableName, PreparedStatement preparedStatement, IDatabaseConnection connection)</code></td> <td>If you provide a custom IResultSetTableFactory then you have to implement this new method. As reference implementation you can look into ForwardOnlyResultSetTableFactory.</td> - <td>This addition comes from the feature request + <td>This addition comes from the feature request <a href='https://sourceforge.net/tracker/index.php?func=detail&aid=1956543&group_id=47439&atid=449494'>1956543</a> where you can read details about why this is useful. </td> </tr> </table> </subsection> - + <subsection name="2.4.2 to 2.4.3"> <p>There has been a very small change to the API.</p> <table border="1"> @@ -86,20 +63,20 @@ <th>Background information</th> </tr> - <tr> + <tr> <td>2023994</td> <td><code>org.dbunit.DBTestCase#getConnection() is final</code></td> - <td>To control the creation of the IDatabaseConnection, override method DBTestCase#newDatabaseTester() which provides + <td>To control the creation of the IDatabaseConnection, override method DBTestCase#newDatabaseTester() which provides the connection via IDatabaseTester#getConnection()</td> - <td>The method DBTestCase#getConnection() is now final and the master object for retrieving a - connection here is the IDatabaseTester. It is created via the DBTestCase#newDatabaseTester() - method and provides the database connection via IDatabaseTester#getConnection. The reason for + <td>The method DBTestCase#getConnection() is now final and the master object for retrieving a + connection here is the IDatabaseTester. It is created via the DBTestCase#newDatabaseTester() + method and provides the database connection via IDatabaseTester#getConnection. The reason for this change is firstly to provide a consistent access to the database connection - and secondly to allow the user to easily configure dbunit properties by overriding the + and secondly to allow the user to easily configure dbunit properties by overriding the method setUpDatabaseConfig(DatabaseConfig databaseConfig). </td> </tr> - <tr> + <tr> <td>2023994</td> <td><code>Removed setters from org.dbunit.JdbcDatabaseTester and added constructors</code></td> <td>Just invoke the appropriate constructor of JdbcDatabaseTester</td> @@ -131,7 +108,7 @@ (or copy-pasted) multiple times before. </td> </tr> - + <tr> <td>1961269</td> <td><code>org.dbunit.dataset.datatype.IDataTypeFactory.createDataType(int sqlType, String sqlTypeName, String tableName, String columnName)</code></td> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jef...@us...> - 2010-01-23 16:57:12
|
Revision: 1147 http://dbunit.svn.sourceforge.net/dbunit/?rev=1147&view=rev Author: jeffjensen Date: 2010-01-23 16:57:03 +0000 (Sat, 23 Jan 2010) Log Message: ----------- Add "file loader" utility change. Modified Paths: -------------- trunk/dbunit/src/changes/changes.xml Modified: trunk/dbunit/src/changes/changes.xml =================================================================== --- trunk/dbunit/src/changes/changes.xml 2010-01-23 06:00:06 UTC (rev 1146) +++ trunk/dbunit/src/changes/changes.xml 2010-01-23 16:57:03 UTC (rev 1147) @@ -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="2905970" due-to="pkamm">Upgrade to POI Version 3.5-FINAL</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> </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-01-23 06:00:15
|
Revision: 1146 http://dbunit.svn.sourceforge.net/dbunit/?rev=1146&view=rev Author: jeffjensen Date: 2010-01-23 06:00:06 +0000 (Sat, 23 Jan 2010) Log Message: ----------- Move test-generated file to target dir, out of source area, so clean deletes it. Modified Paths: -------------- trunk/dbunit/src/test/org/dbunit/dataset/CompositeDataSetIterationTest.java Modified: trunk/dbunit/src/test/org/dbunit/dataset/CompositeDataSetIterationTest.java =================================================================== --- trunk/dbunit/src/test/org/dbunit/dataset/CompositeDataSetIterationTest.java 2010-01-22 21:48:03 UTC (rev 1145) +++ trunk/dbunit/src/test/org/dbunit/dataset/CompositeDataSetIterationTest.java 2010-01-23 06:00:06 UTC (rev 1146) @@ -94,7 +94,7 @@ // 4. Write try { - FlatXmlDataSet.write(compositeDataSet, new FileOutputStream("full.xml")); + FlatXmlDataSet.write(compositeDataSet, new FileOutputStream("target/full.xml")); } catch (Exception e) { fail(e.getMessage()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2010-01-22 21:48:09
|
Revision: 1145 http://dbunit.svn.sourceforge.net/dbunit/?rev=1145&view=rev Author: jbhurst Date: 2010-01-22 21:48:03 +0000 (Fri, 22 Jan 2010) Log Message: ----------- [2875235] - Added documentation note about failsafe plugin. Modified Paths: -------------- trunk/dbunit/src/site/apt/integrationtests.apt Modified: trunk/dbunit/src/site/apt/integrationtests.apt =================================================================== --- trunk/dbunit/src/site/apt/integrationtests.apt 2010-01-22 21:04:41 UTC (rev 1144) +++ trunk/dbunit/src/site/apt/integrationtests.apt 2010-01-22 21:48:03 UTC (rev 1145) @@ -34,6 +34,8 @@ mvn help:all-profiles --- + <<Note:>> The integration tests are run using the {{{http://mojo.codehaus.org/failsafe-maven-plugin/}Maven failsafe-plugin}}. + Database Properties Each database is configured by properties and dependencies. @@ -136,7 +138,7 @@ mvn clean verify -Poracle-default,postgresql --- - <<Note:>> currently the oracle-default profile is required, along with the postgresql profile, to ensure all JARs required on the compile-time classpath in Maven. + <<Note:>> Currently the oracle-default profile is required, along with the postgresql profile, to ensure all JARs required on the compile-time classpath in Maven. Running MySQL Integration Tests @@ -167,7 +169,7 @@ mvn clean verify -Poracle-default,mysql --- - <<Note:>> currently the oracle-default profile is required, along with the mysql profile, to ensure all JARs required on the compile-time classpath in Maven. + <<Note:>> Currently the oracle-default profile is required, along with the mysql profile, to ensure all JARs required on the compile-time classpath in Maven. Running Apache Derby Integration Tests @@ -179,7 +181,7 @@ mvn clean verify -Poracle-default,derby --- - <<Note:>> currently the oracle-default profile is required, along with the derby profile, to ensure all JARs required on the compile-time classpath in Maven. + <<Note:>> Currently the oracle-default profile is required, along with the derby profile, to ensure all JARs required on the compile-time classpath in Maven. Running H2 Integration Tests @@ -191,7 +193,7 @@ mvn clean verify -Poracle-default,h2 --- - <<Note:>> currently the oracle-default profile is required, along with the h2 profile, to ensure all JARs required on the compile-time classpath in Maven. + <<Note:>> Currently the oracle-default profile is required, along with the h2 profile, to ensure all JARs required on the compile-time classpath in Maven. TODO: Other databases, notably mssql, db2. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Jeff J. <jj...@ap...> - 2010-01-22 21:35:07
|
Original one bounced as my SF email was not subscribed. Fixed that... ;-) Revision: 1143 http://dbunit.svn.sourceforge.net/dbunit/?rev=1143&view=rev Author: jeffjensen Date: 2010-01-22 20:50:04 +0000 (Fri, 22 Jan 2010) Log Message: ----------- Initial add of fileloader package and tests to ease loading of dataset files. POM change: Added csv and xml src dirs to test classpath so files are available to test with (temp - will adjust with Maven 2 dir changes). Modified Paths: -------------- trunk/dbunit/pom.xml Added Paths: ----------- trunk/dbunit/src/java/org/dbunit/util/fileloader/ trunk/dbunit/src/java/org/dbunit/util/fileloader/AbstractDataFileLoader.java trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoader.java trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderCsv.java trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderFlatXml.java trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderFullXml.java trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderXls.java trunk/dbunit/src/test/org/dbunit/util/fileloader/ trunk/dbunit/src/test/org/dbunit/util/fileloader/AbstractDataFileLoaderTest.java trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderCsvTest.java trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderFlatXmlTest.java trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderFullXmlTest.java trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderXlsTest.java Property Changed: ---------------- trunk/dbunit/ Property changes on: trunk/dbunit ___________________________________________________________________ Modified: svn:ignore - .classpath .project .settings target + .classpath .project .settings target full.xml Modified: trunk/dbunit/pom.xml =================================================================== --- trunk/dbunit/pom.xml 2010-01-22 02:06:34 UTC (rev 1142) +++ trunk/dbunit/pom.xml 2010-01-22 20:50:04 UTC (rev 1143) @@ -355,6 +355,17 @@ <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> + </testResources> + <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> Added: trunk/dbunit/src/java/org/dbunit/util/fileloader/AbstractDataFileLoader.java =================================================================== --- trunk/dbunit/src/java/org/dbunit/util/fileloader/AbstractDataFileLoader.java (rev 0) +++ trunk/dbunit/src/java/org/dbunit/util/fileloader/AbstractDataFileLoader.java 2010-01-22 20:50:04 UTC (rev 1143) @@ -0,0 +1,198 @@ +/* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002-2008, DbUnit.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package org.dbunit.util.fileloader; + +import java.io.IOException; +import java.net.URL; +import java.util.HashMap; +import java.util.Map; + +import org.dbunit.DatabaseUnitRuntimeException; +import org.dbunit.dataset.DataSetException; +import org.dbunit.dataset.DefaultDataSet; +import org.dbunit.dataset.IDataSet; +import org.dbunit.dataset.ReplacementDataSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Base class with common implementation for dbUnit data file loaders. + * + * @author Jeff Jensen jeffjensen AT users.sourceforge.net + * @author Last changed by: $Author$ + * @version $Revision$ $Date$ + * @since 2.4.8 + */ +public abstract class AbstractDataFileLoader implements DataFileLoader { + private final Logger LOG = + LoggerFactory.getLogger(AbstractDataFileLoader.class); + + private Map replacementObjects; + private Map replacementSubstrings; + + /** Create new instance. */ + public AbstractDataFileLoader() { + this(new HashMap(), new HashMap()); + } + + /** + * Create new instance with replacement objects. + * + * @param replacementObjects + * The replacement objects for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + */ + public AbstractDataFileLoader(Map ro) { + this(ro, new HashMap()); + } + + /** + * Create new instance with replacement objects and replacement substrings. + * + * @param ro + * The replacement objects for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + * @param rs + * The replacement substrings for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + */ + public AbstractDataFileLoader(Map ro, Map rs) { + if (ro == null) { + throw new IllegalArgumentException( + "Replacement object map is null."); + } + + if (rs == null) { + throw new IllegalArgumentException( + "Replacement substrings map is null."); + } + + this.replacementObjects = ro; + this.replacementSubstrings = rs; + } + + /** + * {@inheritDoc} + */ + public IDataSet load(String filename) throws DatabaseUnitRuntimeException { + IDataSet ds = new DefaultDataSet(); + + LOG.debug("load: processing file={}", filename); + + if (filename == null || "".equals(filename)) { + final String msg = + "load: filename is null or empty string," + + " using DefaultDataSet()"; + LOG.debug(msg); + } else { + URL url = this.getClass().getResource(filename); + + if (url == null) { + final String msg = "Could not find file named=" + filename; + throw new DatabaseUnitRuntimeException(msg); + } + + try { + ds = loadDataSet(url); + ds = processReplacementTokens(ds); + } catch (DataSetException e) { + final String msg = + "DataSetException occurred loading data set file name='" + + filename + "', msg='" + + e.getLocalizedMessage() + "'"; + throw new DatabaseUnitRuntimeException(msg, e); + } catch (IOException e) { + final String msg = + "IOException occurred loading data set file name='" + + filename + '\'' + ", msg='" + + e.getLocalizedMessage() + "'"; + throw new DatabaseUnitRuntimeException(msg, e); + } + } + + return ds; + } + + /** + * Make the dbUnit dataset ({@link org.dbunit.dataset.IDataSet}) from the + * input stream of a dbUnit data file. The type of dbUnit dataset created is + * delegated to the implementing subclass. + * + * @param url + * The dbUnit data file url. + * @return dbUnit dataset of the corresponding input file type. + * @throws DataSetException + * On data errors. + * @throws IOException + * On file errors. + * @since 2.4.8 + */ + protected abstract IDataSet loadDataSet(URL url) throws DataSetException, + IOException; + + /** + * Add the replacements in the maps (objects and substrings) to the + * specified dataset. + * + * @param ds + * The dataset to wrap with a <code>ReplacementDataSet</code> and + * process replacement tokens on. + * @return The specified dataset decorated with + * <code>ReplacementDataSet</code> and processed with the tokens in + * the replacement maps. + * @since 2.4.8 + */ + protected ReplacementDataSet processReplacementTokens(IDataSet ds) { + ReplacementDataSet rds = + new ReplacementDataSet(ds, replacementObjects, + replacementSubstrings); + + return rds; + } + + /** + * {@inheritDoc} + */ + public void addReplacementObjects(Map ro) { + this.replacementObjects.putAll(ro); + } + + /** + * {@inheritDoc} + */ + public void addReplacementSubstrings(Map rs) { + this.replacementSubstrings.putAll(rs); + } + + /** + * {@inheritDoc} + */ + public void removeAllReplacementObjects() { + this.replacementObjects.clear(); + } + + /** + * {@inheritDoc} + */ + public void removeAllReplacementSubstrings() { + this.replacementSubstrings.clear(); + } +} Property changes on: trunk/dbunit/src/java/org/dbunit/util/fileloader/AbstractDataFileLoader.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoader.java =================================================================== --- trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoader.java (rev 0) +++ trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoader.java 2010-01-22 20:50:04 UTC (rev 1143) @@ -0,0 +1,88 @@ +/* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002-2008, DbUnit.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package org.dbunit.util.fileloader; + +import java.util.Map; + +import org.dbunit.DatabaseUnitRuntimeException; +import org.dbunit.dataset.IDataSet; + +/** + * Defines a dbUnit data file loader supporting replacement objects and + * substrings with {@link org.dbunit.dataset.ReplacementDataSet}. + * + * @author Jeff Jensen jeffjensen AT users.sourceforge.net + * @author Last changed by: $Author$ + * @version $Revision$ $Date$ + * @since 2.4.8 + */ +public interface DataFileLoader { + /** + * Load the specified filename from the classpath into a dbUnit dataset. If + * filename == null or "", then returns an empty + * {@link org.dbunit.dataset.DefaultDataSet}. + * + * @param filename + * The dbUnit file to load, in the format for the loader + * implementation and fully qualified name with package syntax. + * @return The dbUnit dataset of the specified file. + * @throws DatabaseUnitRuntimeException + * DataSetException wrapped in a DatabaseUnitRuntimeException + * when file load errors occur. + */ + IDataSet load(String fileName); + + /** + * Add the specified replacement objects to existing ones for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + * + * @param replacementObjects + * The replacement objects to include. + * @since 2.4.8 + */ + void addReplacementObjects(Map replacementObjects); + + /** + * Add the specified replacement substrings to existing ones for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + * + * @param replacementSubstrings + * The replacement substrings to include. + * @since 2.4.8 + */ + void addReplacementSubstrings(Map replacementSubstrings); + + /** + * Remove all existing replacement objects, resetting to none so no object + * replacements occur. + * + * @since 2.4.8 + */ + void removeAllReplacementObjects(); + + /** + * Remove all existing replacement substring objects, resetting to none so + * no substring replacements occur. + * + * @since 2.4.8 + */ + void removeAllReplacementSubstrings(); +} Property changes on: trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoader.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderCsv.java =================================================================== --- trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderCsv.java (rev 0) +++ trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderCsv.java 2010-01-22 20:50:04 UTC (rev 1143) @@ -0,0 +1,78 @@ +/* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002-2008, DbUnit.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +package org.dbunit.util.fileloader; + +import java.io.IOException; +import java.net.URL; +import java.util.Map; + +import org.dbunit.dataset.DataSetException; +import org.dbunit.dataset.IDataSet; +import org.dbunit.dataset.csv.CsvURLDataSet; + +/** + * @author Jeff Jensen jeffjensen AT users.sourceforge.net + * @author Last changed by: $Author$ + * @version $Revision$ $Date$ + * @since <dbunit-version> + * + */ +public class DataFileLoaderCsv extends AbstractDataFileLoader { + /** Create new instance. */ + public DataFileLoaderCsv() { + } + + /** + * Create new instance with replacement objects. + * + * @param replacementObjects + * The replacement objects for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + */ + public DataFileLoaderCsv(Map ro) { + super(ro); + } + + /** + * Create new instance with replacement objects and replacement substrings. + * + * @param ro + * The replacement objects for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + * @param rs + * The replacement substrings for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + */ + public DataFileLoaderCsv(Map ro, Map rs) { + super(ro, rs); + } + + /** + * {@inheritDoc} + */ + protected IDataSet loadDataSet(URL url) throws DataSetException, + IOException { + IDataSet ds = new CsvURLDataSet(url); + + return ds; + } +} Property changes on: trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderCsv.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderFlatXml.java =================================================================== --- trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderFlatXml.java (rev 0) +++ trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderFlatXml.java 2010-01-22 20:50:04 UTC (rev 1143) @@ -0,0 +1,132 @@ +/* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002-2008, DbUnit.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package org.dbunit.util.fileloader; + +import java.io.IOException; +import java.net.URL; +import java.util.Map; + +import org.dbunit.dataset.DataSetException; +import org.dbunit.dataset.IDataSet; +import org.dbunit.dataset.xml.FlatXmlDataSetBuilder; + +/** + * @author Jeff Jensen jeffjensen AT users.sourceforge.net + * @author Last changed by: $Author$ + * @version $Revision$ $Date$ + * @since 2.4.8 + */ +public class DataFileLoaderFlatXml extends AbstractDataFileLoader { + private FlatXmlDataSetBuilder builder = new FlatXmlDataSetBuilder(); + + /** Create new instance. */ + public DataFileLoaderFlatXml() { + } + + /** + * Create new instance with replacement objects. + * + * @param replacementObjects + * The replacement objects for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + */ + public DataFileLoaderFlatXml(Map ro) { + super(ro); + } + + /** + * Create new instance with replacement objects and replacement substrings. + * + * @param ro + * The replacement objects for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + * @param rs + * The replacement substrings for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + */ + public DataFileLoaderFlatXml(Map ro, Map rs) { + super(ro, rs); + } + + /** + * Create new instance with replacement objects, replacement substrings, and + * {@link org.dbunit.dataset.xml.FlatXmlDataSetBuilder}. + * + * @param ro + * The replacement objects for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + * @param rs + * The replacement substrings for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + * @param builder + * The {@link org.dbunit.dataset.xml.FlatXmlDataSetBuilder} to + * use. + */ + public DataFileLoaderFlatXml(Map ro, Map rs, FlatXmlDataSetBuilder builder) { + super(ro, rs); + this.builder = builder; + } + + /** + * Create new instance with a + * {@link org.dbunit.dataset.xml.FlatXmlDataSetBuilder}. + * + * @param builder + * The {@link org.dbunit.dataset.xml.FlatXmlDataSetBuilder} to + * use. + */ + public DataFileLoaderFlatXml(FlatXmlDataSetBuilder builder) { + this.builder = builder; + } + + /** + * {@inheritDoc} + */ + protected IDataSet loadDataSet(URL url) throws DataSetException, + IOException { + IDataSet ds = builder.build(url); + + return ds; + } + + /** + * Get the builder. + * + * @see {@link builder}. + * + * @return The builder. + */ + public FlatXmlDataSetBuilder getBuilder() { + return builder; + } + + /** + * Set the builder. + * + * @see {@link builder}. + * + * @param builder + * The builder to set. + */ + public void setBuilder(FlatXmlDataSetBuilder builder) { + this.builder = builder; + } +} Property changes on: trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderFlatXml.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderFullXml.java =================================================================== --- trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderFullXml.java (rev 0) +++ trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderFullXml.java 2010-01-22 20:50:04 UTC (rev 1143) @@ -0,0 +1,79 @@ +/* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002-2008, DbUnit.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +package org.dbunit.util.fileloader; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.Map; + +import org.dbunit.dataset.DataSetException; +import org.dbunit.dataset.IDataSet; +import org.dbunit.dataset.xml.XmlDataSet; + +/** + * @author Jeff Jensen jeffjensen AT users.sourceforge.net + * @author Last changed by: $Author$ + * @version $Revision$ $Date$ + * @since 2.4.8 + */ +public class DataFileLoaderFullXml extends AbstractDataFileLoader { + /** Create new instance. */ + public DataFileLoaderFullXml() { + } + + /** + * Create new instance with replacement objects. + * + * @param replacementObjects + * The replacement objects for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + */ + public DataFileLoaderFullXml(Map ro) { + super(ro); + } + + /** + * Create new instance with replacement objects and replacement substrings. + * + * @param ro + * The replacement objects for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + * @param rs + * The replacement substrings for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + */ + public DataFileLoaderFullXml(Map ro, Map rs) { + super(ro, rs); + } + + /** + * {@inheritDoc} + */ + protected IDataSet loadDataSet(URL url) throws DataSetException, + IOException { + InputStream in = url.openStream(); + IDataSet ds = new XmlDataSet(in); + + return ds; + } +} Property changes on: trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderFullXml.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderXls.java =================================================================== --- trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderXls.java (rev 0) +++ trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderXls.java 2010-01-22 20:50:04 UTC (rev 1143) @@ -0,0 +1,80 @@ +/* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002-2008, DbUnit.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +package org.dbunit.util.fileloader; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.Map; + +import org.dbunit.dataset.DataSetException; +import org.dbunit.dataset.IDataSet; +import org.dbunit.dataset.excel.XlsDataSet; + +/** + * @author Jeff Jensen jeffjensen AT users.sourceforge.net + * @author Last changed by: $Author$ + * @version $Revision$ $Date$ + * @since 2.4.8 + * + */ +public class DataFileLoaderXls extends AbstractDataFileLoader { + /** Create new instance. */ + public DataFileLoaderXls() { + } + + /** + * Create new instance with replacement objects. + * + * @param replacementObjects + * The replacement objects for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + */ + public DataFileLoaderXls(Map ro) { + super(ro); + } + + /** + * Create new instance with replacement objects and replacement substrings. + * + * @param ro + * The replacement objects for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + * @param rs + * The replacement substrings for use with + * {@link org.dbunit.dataset.ReplacementDataSet}. + */ + public DataFileLoaderXls(Map ro, Map rs) { + super(ro, rs); + } + + /** + * {@inheritDoc} + */ + protected IDataSet loadDataSet(URL url) throws DataSetException, + IOException { + InputStream in = url.openStream(); + IDataSet ds = new XlsDataSet(in); + + return ds; + } +} Property changes on: trunk/dbunit/src/java/org/dbunit/util/fileloader/DataFileLoaderXls.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: trunk/dbunit/src/test/org/dbunit/util/fileloader/AbstractDataFileLoaderTest.java =================================================================== --- trunk/dbunit/src/test/org/dbunit/util/fileloader/AbstractDataFileLoaderTest.java (rev 0) +++ trunk/dbunit/src/test/org/dbunit/util/fileloader/AbstractDataFileLoaderTest.java 2010-01-22 20:50:04 UTC (rev 1143) @@ -0,0 +1,51 @@ +/* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002-2008, DbUnit.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +package org.dbunit.util.fileloader; + +import junit.framework.TestCase; + +import org.dbunit.dataset.DataSetException; +import org.dbunit.dataset.IDataSet; + +/** + * @author Jeff Jensen jeffjensen AT users.sourceforge.net + * @author Last changed by: $Author$ + * @version $Revision$ $Date$ + * @since 2.4.8 + */ +public class AbstractDataFileLoaderTest extends TestCase { + // just using this one so can run tests. + DataFileLoaderFlatXml loader = null; + + /** + * {@inheritDoc} + */ + protected void setUp() throws Exception { + loader = new DataFileLoaderFlatXml(); + } + + public void testLoadDefaultDataSetEmpty() throws DataSetException { + IDataSet ds = loader.load(null); + assertEquals("Default dataset had tables in it.", + ds.getTableNames().length, 0); + } +} Property changes on: trunk/dbunit/src/test/org/dbunit/util/fileloader/AbstractDataFileLoaderTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderCsvTest.java =================================================================== --- trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderCsvTest.java (rev 0) +++ trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderCsvTest.java 2010-01-22 20:50:04 UTC (rev 1143) @@ -0,0 +1,54 @@ +/* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002-2008, DbUnit.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +package org.dbunit.util.fileloader; + +import junit.framework.TestCase; + +import org.dbunit.dataset.DataSetException; +import org.dbunit.dataset.IDataSet; + +/** + * @author Jeff Jensen jeffjensen AT users.sourceforge.net + * @author Last changed by: $Author$ + * @version $Revision$ $Date$ + * @since 2.4.8 + */ +public class DataFileLoaderCsvTest extends TestCase { + DataFileLoaderCsv loader = null; + + /** + * {@inheritDoc} + */ + protected void setUp() throws Exception { + loader = new DataFileLoaderCsv(); + } + + /** + * Test can load the specified file. + */ + public void testLoad() throws DataSetException { + String filename = "/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 + } +} Property changes on: trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderCsvTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderFlatXmlTest.java =================================================================== --- trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderFlatXmlTest.java (rev 0) +++ trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderFlatXmlTest.java 2010-01-22 20:50:04 UTC (rev 1143) @@ -0,0 +1,54 @@ +/* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002-2008, DbUnit.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +package org.dbunit.util.fileloader; + +import junit.framework.TestCase; + +import org.dbunit.dataset.DataSetException; +import org.dbunit.dataset.IDataSet; + +/** + * @author Jeff Jensen jeffjensen AT users.sourceforge.net + * @author Last changed by: $Author$ + * @version $Revision$ $Date$ + * @since 2.4.8 + */ +public class DataFileLoaderFlatXmlTest extends TestCase { + DataFileLoaderFlatXml loader = null; + + /** + * {@inheritDoc} + */ + protected void setUp() throws Exception { + loader = new DataFileLoaderFlatXml(); + } + + /** + * Test can load the specified file. + */ + public void testLoad() throws DataSetException { + String filename = "/flatXmlDataSetTest.xml"; + IDataSet ds = loader.load(filename); + assertTrue("No tables found in dataset.", ds.getTableNames().length > 0); + // DataSet loading tests verify data accuracy + } +} Property changes on: trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderFlatXmlTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderFullXmlTest.java =================================================================== --- trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderFullXmlTest.java (rev 0) +++ trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderFullXmlTest.java 2010-01-22 20:50:04 UTC (rev 1143) @@ -0,0 +1,54 @@ +/* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002-2008, DbUnit.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +package org.dbunit.util.fileloader; + +import junit.framework.TestCase; + +import org.dbunit.dataset.DataSetException; +import org.dbunit.dataset.IDataSet; + +/** + * @author Jeff Jensen jeffjensen AT users.sourceforge.net + * @author Last changed by: $Author$ + * @version $Revision$ $Date$ + * @since 2.4.8 + */ +public class DataFileLoaderFullXmlTest extends TestCase { + DataFileLoaderFullXml loader = null; + + /** + * {@inheritDoc} + */ + protected void setUp() throws Exception { + loader = new DataFileLoaderFullXml(); + } + + /** + * Test can load the specified file. + */ + public void testLoad() throws DataSetException { + String filename = "/XmlTableTest.xml"; + IDataSet ds = loader.load(filename); + assertTrue("No tables found in dataset.", ds.getTableNames().length > 0); + // DataSet loading tests verify data accuracy + } +} Property changes on: trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderFullXmlTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderXlsTest.java =================================================================== --- trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderXlsTest.java (rev 0) +++ trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderXlsTest.java 2010-01-22 20:50:04 UTC (rev 1143) @@ -0,0 +1,54 @@ +/* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002-2008, DbUnit.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +package org.dbunit.util.fileloader; + +import junit.framework.TestCase; + +import org.dbunit.dataset.DataSetException; +import org.dbunit.dataset.IDataSet; + +/** + * @author Jeff Jensen jeffjensen AT users.sourceforge.net + * @author Last changed by: $Author$ + * @version $Revision$ $Date$ + * @since 2.4.8 + */ +public class DataFileLoaderXlsTest extends TestCase { + DataFileLoaderXls loader = null; + + /** + * {@inheritDoc} + */ + protected void setUp() throws Exception { + loader = new DataFileLoaderXls(); + } + + /** + * Test can load the specified file. + */ + public void testLoad() throws DataSetException { + String filename = "/dataSetTest.xls"; + IDataSet ds = loader.load(filename); + assertTrue("No tables found in dataset.", ds.getTableNames().length > 0); + // DataSet loading tests verify data accuracy + } +} Property changes on: trunk/dbunit/src/test/org/dbunit/util/fileloader/DataFileLoaderXlsTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain --- the forwarded message follows --- |
From: <jb...@us...> - 2010-01-22 21:04:47
|
Revision: 1144 http://dbunit.svn.sourceforge.net/dbunit/?rev=1144&view=rev Author: jbhurst Date: 2010-01-22 21:04:41 +0000 (Fri, 22 Jan 2010) Log Message: ----------- [2875235] - Generate reports for both Surefire tests and Failsafe integration tests. Modified Paths: -------------- trunk/dbunit/pom.xml Modified: trunk/dbunit/pom.xml =================================================================== --- trunk/dbunit/pom.xml 2010-01-22 20:50:04 UTC (rev 1143) +++ trunk/dbunit/pom.xml 2010-01-22 21:04:41 UTC (rev 1144) @@ -578,6 +578,32 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-report-plugin</artifactId> + <reportSets> + <reportSet> + <id>tests</id> + <reports> + <report>report-only</report> + </reports> + <configuration> + <outputName>surefire-report</outputName> + <reportsDirectories> + <reportsDirectory>target/surefire-reports</reportsDirectory> + </reportsDirectories> + </configuration> + </reportSet> + <reportSet> + <id>integration-tests</id> + <reports> + <report>report-only</report> + </reports> + <configuration> + <outputName>failsafe-report</outputName> + <reportsDirectories> + <reportsDirectory>target/failsafe-reports</reportsDirectory> + </reportsDirectories> + </configuration> + </reportSet> + </reportSets> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2010-01-22 02:06:41
|
Revision: 1142 http://dbunit.svn.sourceforge.net/dbunit/?rev=1142&view=rev Author: jbhurst Date: 2010-01-22 02:06:34 +0000 (Fri, 22 Jan 2010) Log Message: ----------- [2875235] - mvn sql plugin to run DDL for integration tests. Simplified plugin dependencies. Modified Paths: -------------- trunk/dbunit/pom.xml Modified: trunk/dbunit/pom.xml =================================================================== --- trunk/dbunit/pom.xml 2010-01-22 01:58:47 UTC (rev 1141) +++ trunk/dbunit/pom.xml 2010-01-22 02:06:34 UTC (rev 1142) @@ -496,6 +496,38 @@ <username>${dbunit.profile.user}</username> <password>${dbunit.profile.password}</password> </configuration> + <dependencies> + <dependency> + <groupId>hsqldb</groupId> + <artifactId>hsqldb</artifactId> + <version>1.8.0.1</version> + </dependency> + <dependency> + <groupId>com.oracle</groupId> + <artifactId>ojdbc14</artifactId> + <version>10.2.0.4.0</version> + </dependency> + <dependency> + <groupId>postgresql</groupId> + <artifactId>postgresql</artifactId> + <version>8.4-701.jdbc3</version> + </dependency> + <dependency> + <groupId>mysql</groupId> + <artifactId>mysql-connector-java</artifactId> + <version>5.1.6</version> + </dependency> + <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derby</artifactId> + <version>10.4.1.3</version> + </dependency> + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <version>1.1.118</version> + </dependency> + </dependencies> <executions> <execution> <id>sql-ddl</id> @@ -710,21 +742,6 @@ <dbunit.profile.unsupportedFeatures>BLOB,CLOB,SCROLLABLE_RESULTSET,INSERT_IDENTITY,TRUNCATE_TABLE,SDO_GEOMETRY</dbunit.profile.unsupportedFeatures> <dbunit.profile.ddl>empty.sql</dbunit.profile.ddl> <!-- DDL in HypersonicEnvironment --> </properties> - <build> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>sql-maven-plugin</artifactId> - <dependencies> - <dependency> - <groupId>hsqldb</groupId> - <artifactId>hsqldb</artifactId> - <version>1.8.0.1</version> - </dependency> - </dependencies> - </plugin> - </plugins> - </build> </profile> <!-- "original" OracleDataTypeFactory (NOT 10g) with Oracle 10 JDBC driver for Java 1.4 --> <profile> @@ -747,22 +764,6 @@ <optional>true</optional> </dependency> </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>sql-maven-plugin</artifactId> - <dependencies> - <dependency> - <groupId>com.oracle</groupId> - <artifactId>ojdbc14</artifactId> - <version>10.2.0.4.0</version> - <optional>true</optional> - </dependency> - </dependencies> - </plugin> - </plugins> - </build> </profile> <!-- "original" OracleDataTypeFactory (NOT 10g) with Oracle 11 JDBC driver for Java 6 --> <profile> @@ -785,22 +786,6 @@ <optional>true</optional> </dependency> </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>sql-maven-plugin</artifactId> - <dependencies> - <dependency> - <groupId>com.oracle</groupId> - <artifactId>ojdbc14</artifactId> - <version>10.2.0.4.0</version> - <optional>true</optional> - </dependency> - </dependencies> - </plugin> - </plugins> - </build> </profile> <!-- "newer" Oracle10DataTypeFactory with Oracle 10 JDBC driver for Java 1.4 --> <profile> @@ -823,22 +808,6 @@ <optional>true</optional> </dependency> </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>sql-maven-plugin</artifactId> - <dependencies> - <dependency> - <groupId>com.oracle</groupId> - <artifactId>ojdbc14</artifactId> - <version>10.2.0.4.0</version> - <optional>true</optional> - </dependency> - </dependencies> - </plugin> - </plugins> - </build> </profile> <!-- "newer" Oracle10DataTypeFactory with Oracle 11 JDBC driver for Java 6 --> <profile> @@ -861,22 +830,6 @@ <optional>true</optional> </dependency> </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>sql-maven-plugin</artifactId> - <dependencies> - <dependency> - <groupId>com.oracle</groupId> - <artifactId>ojdbc14</artifactId> - <version>10.2.0.4.0</version> - <optional>true</optional> - </dependency> - </dependencies> - </plugin> - </plugins> - </build> </profile> <profile> <id>postgresql</id> @@ -897,21 +850,6 @@ <version>8.4-701.jdbc3</version> </dependency> </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>sql-maven-plugin</artifactId> - <dependencies> - <dependency> - <groupId>postgresql</groupId> - <artifactId>postgresql</artifactId> - <version>8.4-701.jdbc3</version> - </dependency> - </dependencies> - </plugin> - </plugins> - </build> </profile> <profile> <id>mysql</id> @@ -932,21 +870,6 @@ <version>5.1.6</version> </dependency> </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>sql-maven-plugin</artifactId> - <dependencies> - <dependency> - <groupId>mysql</groupId> - <artifactId>mysql-connector-java</artifactId> - <version>5.1.6</version> - </dependency> - </dependencies> - </plugin> - </plugins> - </build> </profile> <profile> <id>mssql</id> @@ -961,15 +884,6 @@ <dbunit.profile.ddl>mssql.sql</dbunit.profile.ddl> </properties> <!-- JH_TODO: mssql dependencies --> - <build> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>sql-maven-plugin</artifactId> - <!-- JH_TODO: mssql dependencies --> - </plugin> - </plugins> - </build> </profile> <profile> <id>db2</id> @@ -984,15 +898,6 @@ <dbunit.profile.ddl>db2xml.sql</dbunit.profile.ddl> </properties> <!-- JH_TODO: db2 dependencies --> - <build> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>sql-maven-plugin</artifactId> - <!-- JH_TODO: db2 dependencies --> - </plugin> - </plugins> - </build> </profile> <profile> <id>derby</id> @@ -1014,22 +919,6 @@ <scope>test</scope> </dependency> </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>sql-maven-plugin</artifactId> - <dependencies> - <dependency> - <groupId>org.apache.derby</groupId> - <artifactId>derby</artifactId> - <version>10.4.1.3</version> - <scope>test</scope> - </dependency> - </dependencies> - </plugin> - </plugins> - </build> </profile> <profile> <id>h2</id> @@ -1050,21 +939,6 @@ <version>1.1.118</version> </dependency> </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>sql-maven-plugin</artifactId> - <dependencies> - <dependency> - <groupId>com.h2database</groupId> - <artifactId>h2</artifactId> - <version>1.1.118</version> - </dependency> - </dependencies> - </plugin> - </plugins> - </build> </profile> </profiles> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2010-01-22 01:58:53
|
Revision: 1141 http://dbunit.svn.sourceforge.net/dbunit/?rev=1141&view=rev Author: jbhurst Date: 2010-01-22 01:58:47 +0000 (Fri, 22 Jan 2010) Log Message: ----------- [2875235] - mvn sql plugin to run DDL for integration tests. Updated documentation. Modified Paths: -------------- trunk/dbunit/src/site/apt/integrationtests.apt Modified: trunk/dbunit/src/site/apt/integrationtests.apt =================================================================== --- trunk/dbunit/src/site/apt/integrationtests.apt 2010-01-22 01:49:19 UTC (rev 1140) +++ trunk/dbunit/src/site/apt/integrationtests.apt 2010-01-22 01:58:47 UTC (rev 1141) @@ -8,8 +8,12 @@ Overview DbUnit includes a comprehensive test suite. + Most of the tests are <<unit tests>>, and do not rely on any particular database environment. + The unit tests are executed in the normal Maven test phase. + Some of the tests are <<integration tests>>, and can test DbUnit functionality against a particular database. + The integration tests are executed in the Maven integration-test phase. Maven profiles control which database environment is in use for a particular test run. @@ -21,7 +25,7 @@ use this command: --- -mvn clean test -Poracle10-ojdbc14 +mvn clean verify -Poracle10-ojdbc14 --- List all profiles using this command: @@ -52,6 +56,8 @@ * dbunit.profile.unsupportedFeatures - comma-separated list of features not to test + * dbunit.profile.ddl - database-specific DDL script to create tables + [] These properties are all configured with defaults per test profile. @@ -77,7 +83,7 @@ Run the full test suite, including integration tests, with this command: --- -mvn clean test +mvn clean verify --- Running Oracle Integration Tests @@ -89,20 +95,17 @@ These values are the defaults configured in the project. If you use different values, you will need to override the properties in your Maven settings.xml. - [[3]] Log in to your dbunit schema and run src/sql/oracle.sql. - [] - This should create the DbUnit test schema in your Oracle database. You are now ready to run tests. Run the full test suite, including integration tests, with one of these commands: --- -mvn clean test -Poracle-ojdbc14 -mvn clean test -Poracle-ojdbc6 -mvn clean test -Poracle10-ojdbc14 -mvn clean test -Poracle10-ojdbc6 +mvn clean verify -Poracle-ojdbc14 +mvn clean verify -Poracle-ojdbc6 +mvn clean verify -Poracle10-ojdbc14 +mvn clean verify -Poracle10-ojdbc6 --- Running PostgreSQL Integration Tests @@ -123,17 +126,14 @@ These values are the defaults configured in the project. If you use different values, you will need to override the properties in your Maven settings.xml. - [[3]] Log in to your dbunit user and run src/sql/postgresql.sql. - [] - This should create the DbUnit test schema in your PostgreSQL database. You are now ready to run tests. Run the full test suite, including integration tests, with this command: --- -mvn clean test -Poracle-default,postgresql +mvn clean verify -Poracle-default,postgresql --- <<Note:>> currently the oracle-default profile is required, along with the postgresql profile, to ensure all JARs required on the compile-time classpath in Maven. @@ -157,21 +157,14 @@ If you need to connect remotely to your database your need to specify the client host name. You may also need to adjust your MySQL configuration to permit remote connection. - [[3]] Log in to your dbunit user and run src/sql/mysql.sql: - ---- -mysql -hmysql_host -Ddbunit -udbunit -pdbunit <src/sql/mysql.sql ---- - [] - This should create the DbUnit test schema in your MySQL database. You are now ready to run tests. Run the full test suite, including integration tests, with this command: --- -mvn clean test -Poracle-default,mysql +mvn clean verify -Poracle-default,mysql --- <<Note:>> currently the oracle-default profile is required, along with the mysql profile, to ensure all JARs required on the compile-time classpath in Maven. @@ -183,10 +176,22 @@ Run the full test suite, including integration tests, with this command: --- -mvn clean test -Poracle-default,derby +mvn clean verify -Poracle-default,derby --- <<Note:>> currently the oracle-default profile is required, along with the derby profile, to ensure all JARs required on the compile-time classpath in Maven. -TODO: Other databases. +Running H2 Integration Tests + Nothing special is required. + + Run the full test suite, including integration tests, with this command: + +--- +mvn clean verify -Poracle-default,h2 +--- + + <<Note:>> currently the oracle-default profile is required, along with the h2 profile, to ensure all JARs required on the compile-time classpath in Maven. + +TODO: Other databases, notably mssql, db2. + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2010-01-22 01:49:26
|
Revision: 1140 http://dbunit.svn.sourceforge.net/dbunit/?rev=1140&view=rev Author: jbhurst Date: 2010-01-22 01:49:19 +0000 (Fri, 22 Jan 2010) Log Message: ----------- Fixed checkstyle.xml to work with current CheckStyle plugin; seems like CheckStyle 5.0 broke compatibility in some areas. Modified Paths: -------------- trunk/dbunit/checkstyle.xml Modified: trunk/dbunit/checkstyle.xml =================================================================== --- trunk/dbunit/checkstyle.xml 2010-01-22 01:32:39 UTC (rev 1139) +++ trunk/dbunit/checkstyle.xml 2010-01-22 01:49:19 UTC (rev 1140) @@ -8,6 +8,11 @@ "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"> <module name="Checker"> + <module name="RegexpHeader"> + <property + name="header" + value="^/\*\n.*\n.*\n.*Copyright.*\(C\)\d\d\d\d.*DbUnit.org.*"/> + </module> <module name="TreeWalker"> <module name="AvoidStarImport"/> <module name="IllegalImport"/> @@ -19,11 +24,6 @@ <property name="versionFormat" value="\$Revision.*\$.*"/> <!--<property name="versionFormat" value="\$Revision.*\$ \$Date.*\$.*"/>--> </module> - <module name="RegexpHeader"> - <property - name="header" - value="^/\*\n.*\n.*\n.*Copyright.*\(C\)\d\d\d\d.*DbUnit.org.*"/> - </module> <module name="JavadocStyle"> <property name="scope" value="public"/> <property name="checkFirstSentence" value="false"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2010-01-22 01:32:46
|
Revision: 1139 http://dbunit.svn.sourceforge.net/dbunit/?rev=1139&view=rev Author: jbhurst Date: 2010-01-22 01:32:39 +0000 (Fri, 22 Jan 2010) Log Message: ----------- [2905970] - Upgrade to POI Version 3.5-FINAL. Thanks pkamm. (fixed double ending-tag.) Modified Paths: -------------- trunk/dbunit/src/site/xdoc/migration.xml Modified: trunk/dbunit/src/site/xdoc/migration.xml =================================================================== --- trunk/dbunit/src/site/xdoc/migration.xml 2010-01-22 01:06:13 UTC (rev 1138) +++ trunk/dbunit/src/site/xdoc/migration.xml 2010-01-22 01:32:39 UTC (rev 1139) @@ -30,7 +30,6 @@ </p> </subsection> - </subsection> <subsection name="2.4.3 to 2.4.4"> <p>There has been a very small change to the API.</p> <table border="1"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2010-01-22 01:06:26
|
Revision: 1138 http://dbunit.svn.sourceforge.net/dbunit/?rev=1138&view=rev Author: jbhurst Date: 2010-01-22 01:06:13 +0000 (Fri, 22 Jan 2010) Log Message: ----------- [2875235] - mvn sql plugin to run DDL for integration tests. Modified Paths: -------------- trunk/dbunit/pom.xml trunk/dbunit/src/sql/db2xml.sql trunk/dbunit/src/sql/mssql.sql trunk/dbunit/src/sql/oracle.sql trunk/dbunit/src/sql/postgresql.sql Added Paths: ----------- trunk/dbunit/src/sql/empty.sql Modified: trunk/dbunit/pom.xml =================================================================== --- trunk/dbunit/pom.xml 2010-01-21 22:31:08 UTC (rev 1137) +++ trunk/dbunit/pom.xml 2010-01-22 01:06:13 UTC (rev 1138) @@ -488,6 +488,32 @@ </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> + <artifactId>sql-maven-plugin</artifactId> + <version>1.3</version> + <configuration> + <driver>${dbunit.profile.driverClass}</driver> + <url>${dbunit.profile.url}</url> + <username>${dbunit.profile.user}</username> + <password>${dbunit.profile.password}</password> + </configuration> + <executions> + <execution> + <id>sql-ddl</id> + <phase>pre-integration-test</phase> + <goals> + <goal>execute</goal> + </goals> + <configuration> + <srcFiles> + <srcFile>src/sql/${dbunit.profile.ddl}</srcFile> + </srcFiles> + <onError>continue</onError> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> <executions> <execution> @@ -682,7 +708,23 @@ <dbunit.profile.user>sa</dbunit.profile.user> <dbunit.profile.password></dbunit.profile.password> <dbunit.profile.unsupportedFeatures>BLOB,CLOB,SCROLLABLE_RESULTSET,INSERT_IDENTITY,TRUNCATE_TABLE,SDO_GEOMETRY</dbunit.profile.unsupportedFeatures> + <dbunit.profile.ddl>empty.sql</dbunit.profile.ddl> <!-- DDL in HypersonicEnvironment --> </properties> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>sql-maven-plugin</artifactId> + <dependencies> + <dependency> + <groupId>hsqldb</groupId> + <artifactId>hsqldb</artifactId> + <version>1.8.0.1</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> </profile> <!-- "original" OracleDataTypeFactory (NOT 10g) with Oracle 10 JDBC driver for Java 1.4 --> <profile> @@ -695,6 +737,7 @@ <dbunit.profile.user>dbunit</dbunit.profile.user> <dbunit.profile.password>dbunit</dbunit.profile.password> <dbunit.profile.unsupportedFeatures>INSERT_IDENTITY,SCROLLABLE_RESULTSET</dbunit.profile.unsupportedFeatures> + <dbunit.profile.ddl>oracle.sql</dbunit.profile.ddl> </properties> <dependencies> <dependency> @@ -704,6 +747,22 @@ <optional>true</optional> </dependency> </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>sql-maven-plugin</artifactId> + <dependencies> + <dependency> + <groupId>com.oracle</groupId> + <artifactId>ojdbc14</artifactId> + <version>10.2.0.4.0</version> + <optional>true</optional> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> </profile> <!-- "original" OracleDataTypeFactory (NOT 10g) with Oracle 11 JDBC driver for Java 6 --> <profile> @@ -716,6 +775,7 @@ <dbunit.profile.user>dbunit</dbunit.profile.user> <dbunit.profile.password>dbunit</dbunit.profile.password> <dbunit.profile.unsupportedFeatures>INSERT_IDENTITY,SCROLLABLE_RESULTSET</dbunit.profile.unsupportedFeatures> + <dbunit.profile.ddl>oracle.sql</dbunit.profile.ddl> </properties> <dependencies> <dependency> @@ -725,6 +785,22 @@ <optional>true</optional> </dependency> </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>sql-maven-plugin</artifactId> + <dependencies> + <dependency> + <groupId>com.oracle</groupId> + <artifactId>ojdbc14</artifactId> + <version>10.2.0.4.0</version> + <optional>true</optional> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> </profile> <!-- "newer" Oracle10DataTypeFactory with Oracle 10 JDBC driver for Java 1.4 --> <profile> @@ -737,6 +813,7 @@ <dbunit.profile.user>dbunit</dbunit.profile.user> <dbunit.profile.password>dbunit</dbunit.profile.password> <dbunit.profile.unsupportedFeatures>INSERT_IDENTITY,SCROLLABLE_RESULTSET</dbunit.profile.unsupportedFeatures> + <dbunit.profile.ddl>oracle.sql</dbunit.profile.ddl> </properties> <dependencies> <dependency> @@ -746,6 +823,22 @@ <optional>true</optional> </dependency> </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>sql-maven-plugin</artifactId> + <dependencies> + <dependency> + <groupId>com.oracle</groupId> + <artifactId>ojdbc14</artifactId> + <version>10.2.0.4.0</version> + <optional>true</optional> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> </profile> <!-- "newer" Oracle10DataTypeFactory with Oracle 11 JDBC driver for Java 6 --> <profile> @@ -758,6 +851,7 @@ <dbunit.profile.user>dbunit</dbunit.profile.user> <dbunit.profile.password>dbunit</dbunit.profile.password> <dbunit.profile.unsupportedFeatures>INSERT_IDENTITY,SCROLLABLE_RESULTSET</dbunit.profile.unsupportedFeatures> + <dbunit.profile.ddl>oracle.sql</dbunit.profile.ddl> </properties> <dependencies> <dependency> @@ -767,6 +861,22 @@ <optional>true</optional> </dependency> </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>sql-maven-plugin</artifactId> + <dependencies> + <dependency> + <groupId>com.oracle</groupId> + <artifactId>ojdbc14</artifactId> + <version>10.2.0.4.0</version> + <optional>true</optional> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> </profile> <profile> <id>postgresql</id> @@ -778,6 +888,7 @@ <dbunit.profile.user>dbunit</dbunit.profile.user> <dbunit.profile.password>dbunit</dbunit.profile.password> <dbunit.profile.unsupportedFeatures>INSERT_IDENTITY,CLOB,BLOB,SCROLLABLE_RESULTSET,SDO_GEOMETRY</dbunit.profile.unsupportedFeatures> + <dbunit.profile.ddl>postgresql.sql</dbunit.profile.ddl> </properties> <dependencies> <dependency> @@ -786,6 +897,21 @@ <version>8.4-701.jdbc3</version> </dependency> </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>sql-maven-plugin</artifactId> + <dependencies> + <dependency> + <groupId>postgresql</groupId> + <artifactId>postgresql</artifactId> + <version>8.4-701.jdbc3</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> </profile> <profile> <id>mysql</id> @@ -797,6 +923,7 @@ <dbunit.profile.user>dbunit</dbunit.profile.user> <dbunit.profile.password>dbunit</dbunit.profile.password> <dbunit.profile.unsupportedFeatures>BLOB,CLOB,SCROLLABLE_RESULTSET,INSERT_IDENTITY,SDO_GEOMETRY</dbunit.profile.unsupportedFeatures> + <dbunit.profile.ddl>mysql.sql</dbunit.profile.ddl> </properties> <dependencies> <dependency> @@ -805,6 +932,21 @@ <version>5.1.6</version> </dependency> </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>sql-maven-plugin</artifactId> + <dependencies> + <dependency> + <groupId>mysql</groupId> + <artifactId>mysql-connector-java</artifactId> + <version>5.1.6</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> </profile> <profile> <id>mssql</id> @@ -816,7 +958,18 @@ <dbunit.profile.user>dbunit</dbunit.profile.user> <dbunit.profile.password>dbunit</dbunit.profile.password> <dbunit.profile.unsupportedFeatures>BLOB,CLOB,SCROLLABLE_RESULTSET,SDO_GEOMETRY</dbunit.profile.unsupportedFeatures> + <dbunit.profile.ddl>mssql.sql</dbunit.profile.ddl> </properties> + <!-- JH_TODO: mssql dependencies --> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>sql-maven-plugin</artifactId> + <!-- JH_TODO: mssql dependencies --> + </plugin> + </plugins> + </build> </profile> <profile> <id>db2</id> @@ -828,7 +981,18 @@ <dbunit.profile.user>TODO</dbunit.profile.user> <dbunit.profile.password>TODO</dbunit.profile.password> <dbunit.profile.unsupportedFeatures>TODO</dbunit.profile.unsupportedFeatures> + <dbunit.profile.ddl>db2xml.sql</dbunit.profile.ddl> </properties> + <!-- JH_TODO: db2 dependencies --> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>sql-maven-plugin</artifactId> + <!-- JH_TODO: db2 dependencies --> + </plugin> + </plugins> + </build> </profile> <profile> <id>derby</id> @@ -840,6 +1004,7 @@ <dbunit.profile.user>APP</dbunit.profile.user> <dbunit.profile.password>APP</dbunit.profile.password> <dbunit.profile.unsupportedFeatures>VARBINARY,BLOB,CLOB,TRANSACTION,SCROLLABLE_RESULTSET,INSERT_IDENTITY,TRUNCATE_TABLE,SDO_GEOMETRY</dbunit.profile.unsupportedFeatures> + <dbunit.profile.ddl>empty.sql</dbunit.profile.ddl> <!-- DDL in DerbyEnvironment --> </properties> <dependencies> <dependency> @@ -849,6 +1014,22 @@ <scope>test</scope> </dependency> </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>sql-maven-plugin</artifactId> + <dependencies> + <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derby</artifactId> + <version>10.4.1.3</version> + <scope>test</scope> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> </profile> <profile> <id>h2</id> @@ -860,6 +1041,7 @@ <dbunit.profile.user>sa</dbunit.profile.user> <dbunit.profile.password /> <dbunit.profile.unsupportedFeatures>BLOB,CLOB,SCROLLABLE_RESULTSET,INSERT_IDENTITY,TRUNCATE_TABLE,SDO_GEOMETRY</dbunit.profile.unsupportedFeatures> + <dbunit.profile.ddl>empty.sql</dbunit.profile.ddl> <!-- DDL in H2Environment --> </properties> <dependencies> <dependency> @@ -868,6 +1050,21 @@ <version>1.1.118</version> </dependency> </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>sql-maven-plugin</artifactId> + <dependencies> + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <version>1.1.118</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> </profile> </profiles> Modified: trunk/dbunit/src/sql/db2xml.sql =================================================================== --- trunk/dbunit/src/sql/db2xml.sql 2010-01-21 22:31:08 UTC (rev 1137) +++ trunk/dbunit/src/sql/db2xml.sql 2010-01-22 01:06:13 UTC (rev 1138) @@ -1,23 +1,15 @@ --- DROP TABLE TEST_TABLE; --- DROP TABLE SECOND_TABLE; --- DROP TABLE EMPTY_TABLE; --- DROP TABLE PK_TABLE; --- DROP TABLE ONLY_PK_TABLE; --- DROP TABLE EMPTY_MULTITYPE_TABLE; --- DROP TABLE IDENTITY_TABLE; --- DROP TABLE TEST_IDENTITY_NOT_PK; -- DROP TABLE XMLTYPES; --- CREATE TABLE XMLTYPES --- (XMLVARCHAR DB2XML.XMLVARCHAR, --- XMLCLOB DB2XML.XMLCLOBNOT LOGGED NOT COMPACT, +-- CREATE TABLE XMLTYPES +-- (XMLVARCHAR DB2XML.XMLVARCHAR, +-- XMLCLOB DB2XML.XMLCLOBNOT LOGGED NOT COMPACT, -- XMLFILE DB2XML.XMLFILE); ----------------------------------------------------------------------------- -- TEST_TABLE ----------------------------------------------------------------------------- --- DROP TABLE TEST_TABLE +DROP TABLE TEST_TABLE; CREATE TABLE TEST_TABLE (COLUMN0 VARCHAR(32), COLUMN1 VARCHAR(32), @@ -27,7 +19,7 @@ ----------------------------------------------------------------------------- -- SECOND_TABLE ----------------------------------------------------------------------------- --- DROP TABLE SECOND_TABLE +DROP TABLE SECOND_TABLE; CREATE TABLE SECOND_TABLE (COLUMN0 VARCHAR(32), COLUMN1 VARCHAR(32), @@ -37,7 +29,7 @@ ----------------------------------------------------------------------------- -- EMPTY_TABLE ----------------------------------------------------------------------------- --- DROP TABLE EMPTY_TABLE +DROP TABLE EMPTY_TABLE; CREATE TABLE EMPTY_TABLE (COLUMN0 VARCHAR(32), COLUMN1 VARCHAR(32), @@ -47,7 +39,7 @@ ----------------------------------------------------------------------------- -- PK_TABLE ----------------------------------------------------------------------------- --- DROP TABLE PK_TABLE +DROP TABLE PK_TABLE; CREATE TABLE PK_TABLE (PK0 DECIMAL(31, 0) NOT NULL, PK1 DECIMAL(31, 0) NOT NULL, @@ -58,14 +50,14 @@ ----------------------------------------------------------------------------- -- ONLY_PK_TABLE ----------------------------------------------------------------------------- --- DROP TABLE ONLY_PK_TABLE +DROP TABLE ONLY_PK_TABLE; CREATE TABLE ONLY_PK_TABLE (PK0 NUMERIC(31, 0) NOT NULL PRIMARY KEY); ----------------------------------------------------------------------------- -- EMPTY_MULTITYPE_TABLE ----------------------------------------------------------------------------- --- DROP TABLE EMPTY_MULTITYPE_TABLE +DROP TABLE EMPTY_MULTITYPE_TABLE; CREATE TABLE EMPTY_MULTITYPE_TABLE (VARCHAR_COL VARCHAR(32), NUMERIC_COL DECIMAL(31, 0), @@ -75,7 +67,7 @@ ----------------------------------------------------------------------------- -- IDENTITY_TABLE ----------------------------------------------------------------------------- --- DROP TABLE IDENTITY_TABLE +DROP TABLE IDENTITY_TABLE; CREATE TABLE IDENTITY_TABLE (IDENTITY_TABLE_ID BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY ( START WITH +0 , INCREMENT BY +1 , NO CACHE ) NOT NULL, COLUMN0 VARCHAR(32), @@ -84,7 +76,7 @@ ----------------------------------------------------------------------------- -- IDENTITY_TABLE ----------------------------------------------------------------------------- --- DROP TABLE TEST_IDENTITY_NOT_PK +DROP TABLE TEST_IDENTITY_NOT_PK; CREATE TABLE TEST_IDENTITY_NOT_PK (COL01 BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY ( START WITH +0 , INCREMENT BY +1 , NO CACHE ) NOT NULL, COL02 VARCHAR(64)); Added: trunk/dbunit/src/sql/empty.sql =================================================================== --- trunk/dbunit/src/sql/empty.sql (rev 0) +++ trunk/dbunit/src/sql/empty.sql 2010-01-22 01:06:13 UTC (rev 1138) @@ -0,0 +1,4 @@ +-- This is a dummy SQL/DDL file. +-- It's provided for in-memory database environments such as HSQLDB. +-- Those databases have their schemas created on connection by their respective Environment classes. + Property changes on: trunk/dbunit/src/sql/empty.sql ___________________________________________________________________ Added: svn:keywords + Id Modified: trunk/dbunit/src/sql/mssql.sql =================================================================== --- trunk/dbunit/src/sql/mssql.sql 2010-01-21 22:31:08 UTC (rev 1137) +++ trunk/dbunit/src/sql/mssql.sql 2010-01-22 01:06:13 UTC (rev 1138) @@ -2,6 +2,7 @@ -- TEST_TABLE ----------------------------------------------------------------------------- +DROP TABLE TEST_TABLE; CREATE TABLE TEST_TABLE (COLUMN0 VARCHAR(32), COLUMN1 VARCHAR(32), @@ -12,6 +13,7 @@ -- SECOND_TABLE ----------------------------------------------------------------------------- +DROP TABLE SECOND_TABLE; CREATE TABLE SECOND_TABLE (COLUMN0 VARCHAR(32), COLUMN1 VARCHAR(32), @@ -22,6 +24,7 @@ -- EMPTY_TABLE ----------------------------------------------------------------------------- +DROP TABLE EMPTY_TABLE; CREATE TABLE EMPTY_TABLE (COLUMN0 VARCHAR(32), COLUMN1 VARCHAR(32), @@ -32,6 +35,7 @@ -- PK_TABLE ----------------------------------------------------------------------------- +DROP TABLE PK_TABLE; CREATE TABLE PK_TABLE (PK0 NUMERIC(38, 0) NOT NULL, PK1 NUMERIC(38, 0) NOT NULL, @@ -43,6 +47,7 @@ -- ONLY_PK_TABLE ----------------------------------------------------------------------------- +DROP TABLE ONLY_PK_TABLE; CREATE TABLE ONLY_PK_TABLE (PK0 NUMERIC(38, 0) NOT NULL PRIMARY KEY); @@ -50,6 +55,7 @@ -- EMPTY_MULTITYPE_TABLE ----------------------------------------------------------------------------- +DROP TABLE EMPTY_MULTITYPE_TABLE; CREATE TABLE EMPTY_MULTITYPE_TABLE (VARCHAR_COL VARCHAR(32), NUMERIC_COL NUMERIC(38, 0), @@ -60,6 +66,7 @@ -- IDENTITY_TABLE ----------------------------------------------------------------------------- +DROP TABLE IDENTITY_TABLE; CREATE TABLE IDENTITY_TABLE (IDENTITY_TABLE_ID INT IDENTITY (1, 1) NOT NULL, COLUMN0 VARCHAR(32), @@ -69,6 +76,8 @@ -- TEST_IDENTITY_NOT_PK ----------------------------------------------------------------------------- +DROP TABLE TEST_IDENTITY_NOT_PK; CREATE TABLE TEST_IDENTITY_NOT_PK (COL01 INT IDENTITY (1, 1) NOT NULL, COL02 VARCHAR(64)); + Modified: trunk/dbunit/src/sql/oracle.sql =================================================================== --- trunk/dbunit/src/sql/oracle.sql 2010-01-21 22:31:08 UTC (rev 1137) +++ trunk/dbunit/src/sql/oracle.sql 2010-01-22 01:06:13 UTC (rev 1138) @@ -2,6 +2,7 @@ -- TEST_TABLE ----------------------------------------------------------------------------- +DROP TABLE TEST_TABLE; CREATE TABLE TEST_TABLE (COLUMN0 VARCHAR2(32), COLUMN1 VARCHAR2(32), @@ -12,6 +13,7 @@ -- SECOND_TABLE ----------------------------------------------------------------------------- +DROP TABLE SECOND_TABLE; CREATE TABLE SECOND_TABLE (COLUMN0 VARCHAR2(32), COLUMN1 VARCHAR2(32), @@ -22,6 +24,7 @@ -- EMPTY_TABLE ----------------------------------------------------------------------------- +DROP TABLE EMPTY_TABLE; CREATE TABLE EMPTY_TABLE (COLUMN0 VARCHAR2(32), COLUMN1 VARCHAR2(32), @@ -32,6 +35,7 @@ -- PK_TABLE ----------------------------------------------------------------------------- +DROP TABLE PK_TABLE; CREATE TABLE PK_TABLE (PK0 NUMERIC(38, 0) NOT NULL, PK1 NUMERIC(38, 0) NOT NULL, @@ -43,6 +47,7 @@ -- ONLY_PK_TABLE ----------------------------------------------------------------------------- +DROP TABLE ONLY_PK_TABLE; CREATE TABLE ONLY_PK_TABLE (PK0 NUMERIC(38, 0) NOT NULL PRIMARY KEY); @@ -50,6 +55,7 @@ -- EMPTY_MULTITYPE_TABLE ----------------------------------------------------------------------------- +DROP TABLE EMPTY_MULTITYPE_TABLE; CREATE TABLE EMPTY_MULTITYPE_TABLE (VARCHAR_COL VARCHAR2(32), NUMERIC_COL NUMERIC(38, 0), @@ -60,6 +66,7 @@ -- CLOB_TABLE ----------------------------------------------------------------------------- +DROP TABLE CLOB_TABLE; CREATE TABLE CLOB_TABLE (PK NUMERIC(38, 0) NOT NULL, CLOB CLOB, PRIMARY KEY (PK)); @@ -68,6 +75,7 @@ -- BLOB_TABLE ----------------------------------------------------------------------------- +DROP TABLE BLOB_TABLE; CREATE TABLE BLOB_TABLE (PK NUMERIC(38, 0) NOT NULL, BLOB BLOB, PRIMARY KEY (PK)); @@ -76,6 +84,7 @@ -- SDO_GEOMETRY_TABLE ----------------------------------------------------------------------------- +DROP TABLE SDO_GEOMETRY_TABLE; CREATE TABLE SDO_GEOMETRY_TABLE (PK NUMERIC(38, 0) NOT NULL, VAL SDO_GEOMETRY, Modified: trunk/dbunit/src/sql/postgresql.sql =================================================================== --- trunk/dbunit/src/sql/postgresql.sql 2010-01-21 22:31:08 UTC (rev 1137) +++ trunk/dbunit/src/sql/postgresql.sql 2010-01-22 01:06:13 UTC (rev 1138) @@ -2,6 +2,7 @@ -- TEST_TABLE ----------------------------------------------------------------------------- +DROP TABLE TEST_TABLE; CREATE TABLE TEST_TABLE (COLUMN0 VARCHAR(32), COLUMN1 VARCHAR(32), @@ -12,6 +13,7 @@ -- SECOND_TABLE ----------------------------------------------------------------------------- +DROP TABLE SECOND_TABLE; CREATE TABLE SECOND_TABLE (COLUMN0 VARCHAR(32), COLUMN1 VARCHAR(32), @@ -22,6 +24,7 @@ -- EMPTY_TABLE ----------------------------------------------------------------------------- +DROP TABLE EMPTY_TABLE; CREATE TABLE EMPTY_TABLE (COLUMN0 VARCHAR(32), COLUMN1 VARCHAR(32), @@ -32,6 +35,7 @@ -- PK_TABLE ----------------------------------------------------------------------------- +DROP TABLE PK_TABLE; CREATE TABLE PK_TABLE (PK0 NUMERIC(38, 0) NOT NULL, PK1 NUMERIC(38, 0) NOT NULL, @@ -43,6 +47,7 @@ -- ONLY_PK_TABLE ----------------------------------------------------------------------------- +DROP TABLE ONLY_PK_TABLE; CREATE TABLE ONLY_PK_TABLE (PK0 NUMERIC(38, 0) NOT NULL PRIMARY KEY); @@ -50,6 +55,7 @@ -- EMPTY_MULTITYPE_TABLE ----------------------------------------------------------------------------- +DROP TABLE EMPTY_MULTITYPE_TABLE; CREATE TABLE EMPTY_MULTITYPE_TABLE (VARCHAR_COL VARCHAR(32), NUMERIC_COL NUMERIC(38, 0), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2010-01-21 22:31:16
|
Revision: 1137 http://dbunit.svn.sourceforge.net/dbunit/?rev=1137&view=rev Author: jbhurst Date: 2010-01-21 22:31:08 +0000 (Thu, 21 Jan 2010) Log Message: ----------- [2875235] - Integration tests renamed XxxIT; added failsafe plugin to run them. Modified Paths: -------------- trunk/dbunit/pom.xml trunk/dbunit/src/test/org/dbunit/AllTests.java trunk/dbunit/src/test/org/dbunit/ant/AllTests.java trunk/dbunit/src/test/org/dbunit/assertion/AllTests.java trunk/dbunit/src/test/org/dbunit/assertion/DiffCollectingFailureHandlerTest.java trunk/dbunit/src/test/org/dbunit/database/AllTests.java trunk/dbunit/src/test/org/dbunit/database/ScrollableResultSetTableTest.java trunk/dbunit/src/test/org/dbunit/dataset/xml/AllTests.java trunk/dbunit/src/test/org/dbunit/ext/mssql/AllTests.java trunk/dbunit/src/test/org/dbunit/ext/postgresql/AllTests.java trunk/dbunit/src/test/org/dbunit/operation/AllTests.java Added Paths: ----------- trunk/dbunit/src/test/org/dbunit/AbstractDatabaseIT.java trunk/dbunit/src/test/org/dbunit/AbstractDatabaseTesterIT.java trunk/dbunit/src/test/org/dbunit/DBTestCaseIT.java trunk/dbunit/src/test/org/dbunit/DatabaseTestCaseIT.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/database/AbstractDatabaseConnectionIT.java trunk/dbunit/src/test/org/dbunit/database/AbstractDatabaseTesterConnectionIT.java trunk/dbunit/src/test/org/dbunit/database/CachedResultSetTableIT.java trunk/dbunit/src/test/org/dbunit/database/DatabaseConnectionIT.java trunk/dbunit/src/test/org/dbunit/database/DatabaseDataSetIT.java trunk/dbunit/src/test/org/dbunit/database/DatabaseTableMetaDataIT.java trunk/dbunit/src/test/org/dbunit/database/DefaultDatabaseTesterConnectionIT.java trunk/dbunit/src/test/org/dbunit/database/ForwardOnlyResultSetTableIT.java trunk/dbunit/src/test/org/dbunit/database/JdbcDatabaseTesterConnectionIT.java trunk/dbunit/src/test/org/dbunit/database/QueryDataSetIT.java trunk/dbunit/src/test/org/dbunit/database/ResultSetTableMetaDataIT.java trunk/dbunit/src/test/org/dbunit/dataset/xml/FlatDtdDataSetIT.java trunk/dbunit/src/test/org/dbunit/ext/mssql/InsertIdentityOperationIT.java trunk/dbunit/src/test/org/dbunit/ext/postgresql/SQLHelperDomainPostgreSQLIT.java trunk/dbunit/src/test/org/dbunit/operation/AbstractBatchOperationIT.java trunk/dbunit/src/test/org/dbunit/operation/CloseConnectionOperationIT.java trunk/dbunit/src/test/org/dbunit/operation/CompositeOperationIT.java trunk/dbunit/src/test/org/dbunit/operation/DeleteAllOperationIT.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/TruncateTableOperationIT.java trunk/dbunit/src/test/org/dbunit/operation/UpdateOperationIT.java Removed Paths: ------------- trunk/dbunit/src/test/org/dbunit/AbstractDatabaseTest.java trunk/dbunit/src/test/org/dbunit/AbstractDatabaseTesterTest.java trunk/dbunit/src/test/org/dbunit/DBTestCaseTest.java trunk/dbunit/src/test/org/dbunit/DatabaseTestCaseTest.java trunk/dbunit/src/test/org/dbunit/ant/DbUnitTaskTest.java trunk/dbunit/src/test/org/dbunit/assertion/DbUnitAssertTest.java trunk/dbunit/src/test/org/dbunit/database/AbstractDatabaseConnectionTest.java trunk/dbunit/src/test/org/dbunit/database/AbstractDatabaseTesterConnectionTest.java trunk/dbunit/src/test/org/dbunit/database/CachedResultSetTableTest.java trunk/dbunit/src/test/org/dbunit/database/DatabaseConnectionTest.java trunk/dbunit/src/test/org/dbunit/database/DatabaseDataSetTest.java trunk/dbunit/src/test/org/dbunit/database/DatabaseTableMetaDataTest.java trunk/dbunit/src/test/org/dbunit/database/DefaultDatabaseTesterConnectionTest.java trunk/dbunit/src/test/org/dbunit/database/ForwardOnlyResultSetTableTest.java trunk/dbunit/src/test/org/dbunit/database/JdbcDatabaseTesterConnectionTest.java trunk/dbunit/src/test/org/dbunit/database/QueryDataSetTest.java trunk/dbunit/src/test/org/dbunit/database/ResultSetTableMetaDataTest.java trunk/dbunit/src/test/org/dbunit/dataset/xml/FlatDtdDataSetTest.java trunk/dbunit/src/test/org/dbunit/ext/mssql/InsertIdentityOperationTest.java trunk/dbunit/src/test/org/dbunit/ext/postgresql/SQLHelperDomainPostgreSQLTest.java trunk/dbunit/src/test/org/dbunit/operation/AbstractBatchOperationTest.java trunk/dbunit/src/test/org/dbunit/operation/CloseConnectionOperationTest.java trunk/dbunit/src/test/org/dbunit/operation/CompositeOperationTest.java trunk/dbunit/src/test/org/dbunit/operation/DeleteAllOperationTest.java trunk/dbunit/src/test/org/dbunit/operation/DeleteOperationTest.java trunk/dbunit/src/test/org/dbunit/operation/InsertOperationTest.java trunk/dbunit/src/test/org/dbunit/operation/RefreshOperationTest.java trunk/dbunit/src/test/org/dbunit/operation/TransactionOperationTest.java trunk/dbunit/src/test/org/dbunit/operation/TruncateTableOperationTest.java trunk/dbunit/src/test/org/dbunit/operation/UpdateOperationTest.java Modified: trunk/dbunit/pom.xml =================================================================== --- trunk/dbunit/pom.xml 2010-01-07 20:50:16 UTC (rev 1136) +++ trunk/dbunit/pom.xml 2010-01-21 22:31:08 UTC (rev 1137) @@ -399,6 +399,52 @@ </configuration> </plugin> <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>failsafe-maven-plugin</artifactId> + <version>2.4.3-alpha-1</version> + <configuration> + <encoding>UTF-8</encoding> + <systemProperties> + <property> + <name>dbunit.profile</name> + <value>${dbunit.profile}</value> + </property> + <property> + <name>dbunit.profile.driverClass</name> + <value>${dbunit.profile.driverClass}</value> + </property> + <property> + <name>dbunit.profile.url</name> + <value>${dbunit.profile.url}</value> + </property> + <property> + <name>dbunit.profile.schema</name> + <value>${dbunit.profile.schema}</value> + </property> + <property> + <name>dbunit.profile.user</name> + <value>${dbunit.profile.user}</value> + </property> + <property> + <name>dbunit.profile.password</name> + <value>${dbunit.profile.password}</value> + </property> + <property> + <name>dbunit.profile.unsupportedFeatures</name> + <value>${dbunit.profile.unsupportedFeatures}</value> + </property> + </systemProperties> + </configuration> + <executions> + <execution> + <goals> + <goal>integration-test</goal> + <goal>verify</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> Copied: trunk/dbunit/src/test/org/dbunit/AbstractDatabaseIT.java (from rev 1136, trunk/dbunit/src/test/org/dbunit/AbstractDatabaseTest.java) =================================================================== --- trunk/dbunit/src/test/org/dbunit/AbstractDatabaseIT.java (rev 0) +++ trunk/dbunit/src/test/org/dbunit/AbstractDatabaseIT.java 2010-01-21 22:31:08 UTC (rev 1137) @@ -0,0 +1,186 @@ +/* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002-2004, DbUnit.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +package org.dbunit; + +import org.dbunit.database.DatabaseConfig; +import org.dbunit.database.IDatabaseConnection; +import org.dbunit.dataset.IDataSet; +import org.dbunit.dataset.ITable; +import org.dbunit.dataset.SortedTable; +import org.dbunit.operation.DatabaseOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Manuel Laflamme + * @version $Revision$ + * @since Feb 18, 2002 + */ +public abstract class AbstractDatabaseIT extends DatabaseTestCase +{ + protected IDatabaseConnection _connection; + + protected final Logger logger = LoggerFactory.getLogger(getClass()); + + public AbstractDatabaseIT(String s) + { + super(s); + } + + protected DatabaseEnvironment getEnvironment() throws Exception + { + return DatabaseEnvironment.getInstance(); + } + + protected ITable createOrderedTable(String tableName, String orderByColumn) + throws Exception + { + return new SortedTable(_connection.createDataSet().getTable(tableName), + new String[]{orderByColumn}); +// String sql = "select * from " + tableName + " order by " + orderByColumn; +// return _connection.createQueryTable(tableName, sql); + } + + /** + * Returns the string converted as an identifier according to the metadata rules of the database environment. + * Most databases convert all metadata identifiers to uppercase. + * PostgreSQL converts identifiers to lowercase. + * MySQL preserves case. + * @param str The identifier. + * @return The identifier converted according to database rules. + */ + protected String convertString(String str) throws Exception + { + return getEnvironment().convertString(str); + } + + //////////////////////////////////////////////////////////////////////////// + // TestCase class + + protected void setUp() throws Exception + { + super.setUp(); + + _connection = getDatabaseTester().getConnection(); + setUpDatabaseConfig(_connection.getConfig()); + } + + protected IDatabaseTester getDatabaseTester() throws Exception + { + try{ + return getEnvironment().getDatabaseTester(); + } + catch( Exception e ){ + //TODO matthias: this here hides original exceptions from being shown in the JUnit results + //(logger is not configured for unit tests). Think about how exceptions can be passed through + // So I temporarily added the "e.printStackTrace()"... + logger.error("getDatabaseTester()", e ); + e.printStackTrace(); + } + return super.getDatabaseTester(); + } + + protected void setUpDatabaseConfig(DatabaseConfig config) + { + try + { + getEnvironment().setupDatabaseConfig(config); + } + catch (Exception ex) + { + throw new RuntimeException(ex); // JH_TODO: is this the "DbUnit way" to handle exceptions? + } + } + + protected void tearDown() throws Exception + { + super.tearDown(); + + DatabaseOperation.DELETE_ALL.execute(_connection, _connection.createDataSet()); + + _connection = null; + } + + //////////////////////////////////////////////////////////////////////////// + // DatabaseTestCase class + + protected IDatabaseConnection getConnection() throws Exception + { + IDatabaseConnection connection = getEnvironment().getConnection(); + return connection; + +// return new DatabaseEnvironment(getEnvironment().getProfile()).getConnection(); +// return new DatabaseConnection(connection.getConnection(), connection.getSchema()); + } + + protected IDataSet getDataSet() throws Exception + { + return getEnvironment().getInitDataSet(); + } + + protected void closeConnection(IDatabaseConnection connection) throws Exception + { +// getEnvironment().closeConnection(); + } +// +// protected DatabaseOperation getTearDownOperation() throws Exception +// { +// return DatabaseOperation.DELETE_ALL; +// } + + /** + * This method is used so sub-classes can disable the tests according to + * some characteristics of the environment + * @param testName name of the test to be checked + * @return flag indicating if the test should be executed or not + */ + protected boolean runTest(String testName) { + return true; + } + + protected void runTest() throws Throwable { + if ( runTest(getName()) ) { + super.runTest(); + } else { + if ( logger.isDebugEnabled() ) { + logger.debug( "Skipping test " + getClass().getName() + "." + getName() ); + } + } + } + + public static boolean environmentHasFeature(TestFeature feature) { + try { + final DatabaseEnvironment environment = DatabaseEnvironment.getInstance(); + final boolean runIt = environment.support(feature); + return runIt; + } catch ( Exception e ) { + throw new DatabaseUnitRuntimeException(e); + } + } + +} + + + + + + Property changes on: trunk/dbunit/src/test/org/dbunit/AbstractDatabaseIT.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Deleted: trunk/dbunit/src/test/org/dbunit/AbstractDatabaseTest.java =================================================================== --- trunk/dbunit/src/test/org/dbunit/AbstractDatabaseTest.java 2010-01-07 20:50:16 UTC (rev 1136) +++ trunk/dbunit/src/test/org/dbunit/AbstractDatabaseTest.java 2010-01-21 22:31:08 UTC (rev 1137) @@ -1,186 +0,0 @@ -/* - * - * The DbUnit Database Testing Framework - * Copyright (C)2002-2004, DbUnit.org - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -package org.dbunit; - -import org.dbunit.database.DatabaseConfig; -import org.dbunit.database.IDatabaseConnection; -import org.dbunit.dataset.IDataSet; -import org.dbunit.dataset.ITable; -import org.dbunit.dataset.SortedTable; -import org.dbunit.operation.DatabaseOperation; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author Manuel Laflamme - * @version $Revision$ - * @since Feb 18, 2002 - */ -public abstract class AbstractDatabaseTest extends DatabaseTestCase -{ - protected IDatabaseConnection _connection; - - protected final Logger logger = LoggerFactory.getLogger(getClass()); - - public AbstractDatabaseTest(String s) - { - super(s); - } - - protected DatabaseEnvironment getEnvironment() throws Exception - { - return DatabaseEnvironment.getInstance(); - } - - protected ITable createOrderedTable(String tableName, String orderByColumn) - throws Exception - { - return new SortedTable(_connection.createDataSet().getTable(tableName), - new String[]{orderByColumn}); -// String sql = "select * from " + tableName + " order by " + orderByColumn; -// return _connection.createQueryTable(tableName, sql); - } - - /** - * Returns the string converted as an identifier according to the metadata rules of the database environment. - * Most databases convert all metadata identifiers to uppercase. - * PostgreSQL converts identifiers to lowercase. - * MySQL preserves case. - * @param str The identifier. - * @return The identifier converted according to database rules. - */ - protected String convertString(String str) throws Exception - { - return str; - } - - //////////////////////////////////////////////////////////////////////////// - // TestCase class - - protected void setUp() throws Exception - { - super.setUp(); - - _connection = getDatabaseTester().getConnection(); - setUpDatabaseConfig(_connection.getConfig()); - } - - protected IDatabaseTester getDatabaseTester() throws Exception - { - try{ - return getEnvironment().getDatabaseTester(); - } - catch( Exception e ){ - //TODO matthias: this here hides original exceptions from being shown in the JUnit results - //(logger is not configured for unit tests). Think about how exceptions can be passed through - // So I temporarily added the "e.printStackTrace()"... - logger.error("getDatabaseTester()", e ); - e.printStackTrace(); - } - return super.getDatabaseTester(); - } - - protected void setUpDatabaseConfig(DatabaseConfig config) - { - try - { - getEnvironment().setupDatabaseConfig(config); - } - catch (Exception ex) - { - throw new RuntimeException(ex); // JH_TODO: is this the "DbUnit way" to handle exceptions? - } - } - - protected void tearDown() throws Exception - { - super.tearDown(); - - DatabaseOperation.DELETE_ALL.execute(_connection, _connection.createDataSet()); - - _connection = null; - } - - //////////////////////////////////////////////////////////////////////////// - // DatabaseTestCase class - - protected IDatabaseConnection getConnection() throws Exception - { - IDatabaseConnection connection = getEnvironment().getConnection(); - return connection; - -// return new DatabaseEnvironment(getEnvironment().getProfile()).getConnection(); -// return new DatabaseConnection(connection.getConnection(), connection.getSchema()); - } - - protected IDataSet getDataSet() throws Exception - { - return getEnvironment().getInitDataSet(); - } - - protected void closeConnection(IDatabaseConnection connection) throws Exception - { -// getEnvironment().closeConnection(); - } -// -// protected DatabaseOperation getTearDownOperation() throws Exception -// { -// return DatabaseOperation.DELETE_ALL; -// } - - /** - * This method is used so sub-classes can disable the tests according to - * some characteristics of the environment - * @param testName name of the test to be checked - * @return flag indicating if the test should be executed or not - */ - protected boolean runTest(String testName) { - return true; - } - - protected void runTest() throws Throwable { - if ( runTest(getName()) ) { - super.runTest(); - } else { - if ( logger.isDebugEnabled() ) { - logger.debug( "Skipping test " + getClass().getName() + "." + getName() ); - } - } - } - - public static boolean environmentHasFeature(TestFeature feature) { - try { - final DatabaseEnvironment environment = DatabaseEnvironment.getInstance(); - final boolean runIt = environment.support(feature); - return runIt; - } catch ( Exception e ) { - throw new DatabaseUnitRuntimeException(e); - } - } - -} - - - - - - Copied: trunk/dbunit/src/test/org/dbunit/AbstractDatabaseTesterIT.java (from rev 1136, trunk/dbunit/src/test/org/dbunit/AbstractDatabaseTesterTest.java) =================================================================== --- trunk/dbunit/src/test/org/dbunit/AbstractDatabaseTesterIT.java (rev 0) +++ trunk/dbunit/src/test/org/dbunit/AbstractDatabaseTesterIT.java 2010-01-21 22:31:08 UTC (rev 1137) @@ -0,0 +1,144 @@ +/* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002-2004, DbUnit.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package org.dbunit; + +import junit.framework.TestCase; + +import org.dbunit.database.IDatabaseConnection; +import org.dbunit.dataset.IDataSet; +import org.dbunit.dataset.ITable; +import org.dbunit.dataset.SortedTable; +import org.dbunit.operation.DatabaseOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Andres Almiray (aal...@us...) + * @author Last changed by: $Author$ + * @version $Revision$ $Date$ + * @since 2.2.0 + */ +public abstract class AbstractDatabaseTesterIT extends TestCase +{ + protected IDatabaseConnection _connection; + protected IDatabaseTester _databaseTester; + + protected final Logger logger = LoggerFactory.getLogger(AbstractDatabaseTesterIT.class); + + public AbstractDatabaseTesterIT( String s ) + { + super( s ); + } + + protected DatabaseEnvironment getEnvironment() throws Exception + { + return DatabaseEnvironment.getInstance(); + } + + protected ITable createOrderedTable( String tableName, String orderByColumn ) throws Exception + { + return new SortedTable( _connection.createDataSet() + .getTable( tableName ), new String[] { orderByColumn } ); + } + + // ////////////////////////////////////////////////////////////////////////// + // TestCase class + + protected void setUp() throws Exception + { + super.setUp(); + + assertNotNull( "DatabaseTester is not set", getDatabaseTester() ); + getDatabaseTester().setSetUpOperation( getSetUpOperation() ); + getDatabaseTester().setDataSet( getDataSet() ); + getDatabaseTester().onSetup(); + + _connection = getDatabaseTester().getConnection(); + } + + protected void tearDown() throws Exception + { + super.tearDown(); + + assertNotNull( "DatabaseTester is not set", getDatabaseTester() ); + getDatabaseTester().setTearDownOperation( getTearDownOperation() ); + getDatabaseTester().setDataSet( getDataSet() ); + getDatabaseTester().onTearDown(); + + DatabaseOperation.DELETE_ALL.execute( _connection, _connection.createDataSet() ); + + _connection = null; + } + + // ////////////////////////////////////////////////////////////////////////// + + protected IDataSet getDataSet() throws Exception + { + return getEnvironment().getInitDataSet(); + } + + protected DatabaseOperation getSetUpOperation() + { + return DatabaseOperation.CLEAN_INSERT; + } + + protected DatabaseOperation getTearDownOperation() + { + return DatabaseOperation.NONE; + } + + protected abstract IDatabaseTester getDatabaseTester() throws Exception; + + /** + * This method is used so sub-classes can disable the tests according to some + * characteristics of the environment + * + * @param testName name of the test to be checked + * @return flag indicating if the test should be executed or not + */ + protected boolean runTest( String testName ) + { + return true; + } + + protected void runTest() throws Throwable + { + if( runTest( getName() ) ){ + super.runTest(); + }else{ + if( logger.isDebugEnabled() ){ + logger.debug( "Skipping test " + getClass().getName() + "." + getName() ); + } + } + } + + public static boolean environmentHasFeature( TestFeature feature ) + { + try{ + final DatabaseEnvironment environment = DatabaseEnvironment.getInstance(); + final boolean runIt = environment.support( feature ); + return runIt; + } + catch( Exception e ){ + throw new DatabaseUnitRuntimeException( e ); + } + } +} Property changes on: trunk/dbunit/src/test/org/dbunit/AbstractDatabaseTesterIT.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Deleted: trunk/dbunit/src/test/org/dbunit/AbstractDatabaseTesterTest.java =================================================================== --- trunk/dbunit/src/test/org/dbunit/AbstractDatabaseTesterTest.java 2010-01-07 20:50:16 UTC (rev 1136) +++ trunk/dbunit/src/test/org/dbunit/AbstractDatabaseTesterTest.java 2010-01-21 22:31:08 UTC (rev 1137) @@ -1,144 +0,0 @@ -/* - * - * The DbUnit Database Testing Framework - * Copyright (C)2002-2004, DbUnit.org - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -package org.dbunit; - -import junit.framework.TestCase; - -import org.dbunit.database.IDatabaseConnection; -import org.dbunit.dataset.IDataSet; -import org.dbunit.dataset.ITable; -import org.dbunit.dataset.SortedTable; -import org.dbunit.operation.DatabaseOperation; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author Andres Almiray (aal...@us...) - * @author Last changed by: $Author$ - * @version $Revision$ $Date$ - * @since 2.2.0 - */ -public abstract class AbstractDatabaseTesterTest extends TestCase -{ - protected IDatabaseConnection _connection; - protected IDatabaseTester _databaseTester; - - protected final Logger logger = LoggerFactory.getLogger(AbstractDatabaseTesterTest.class); - - public AbstractDatabaseTesterTest( String s ) - { - super( s ); - } - - protected DatabaseEnvironment getEnvironment() throws Exception - { - return DatabaseEnvironment.getInstance(); - } - - protected ITable createOrderedTable( String tableName, String orderByColumn ) throws Exception - { - return new SortedTable( _connection.createDataSet() - .getTable( tableName ), new String[] { orderByColumn } ); - } - - // ////////////////////////////////////////////////////////////////////////// - // TestCase class - - protected void setUp() throws Exception - { - super.setUp(); - - assertNotNull( "DatabaseTester is not set", getDatabaseTester() ); - getDatabaseTester().setSetUpOperation( getSetUpOperation() ); - getDatabaseTester().setDataSet( getDataSet() ); - getDatabaseTester().onSetup(); - - _connection = getDatabaseTester().getConnection(); - } - - protected void tearDown() throws Exception - { - super.tearDown(); - - assertNotNull( "DatabaseTester is not set", getDatabaseTester() ); - getDatabaseTester().setTearDownOperation( getTearDownOperation() ); - getDatabaseTester().setDataSet( getDataSet() ); - getDatabaseTester().onTearDown(); - - DatabaseOperation.DELETE_ALL.execute( _connection, _connection.createDataSet() ); - - _connection = null; - } - - // ////////////////////////////////////////////////////////////////////////// - - protected IDataSet getDataSet() throws Exception - { - return getEnvironment().getInitDataSet(); - } - - protected DatabaseOperation getSetUpOperation() - { - return DatabaseOperation.CLEAN_INSERT; - } - - protected DatabaseOperation getTearDownOperation() - { - return DatabaseOperation.NONE; - } - - protected abstract IDatabaseTester getDatabaseTester() throws Exception; - - /** - * This method is used so sub-classes can disable the tests according to some - * characteristics of the environment - * - * @param testName name of the test to be checked - * @return flag indicating if the test should be executed or not - */ - protected boolean runTest( String testName ) - { - return true; - } - - protected void runTest() throws Throwable - { - if( runTest( getName() ) ){ - super.runTest(); - }else{ - if( logger.isDebugEnabled() ){ - logger.debug( "Skipping test " + getClass().getName() + "." + getName() ); - } - } - } - - public static boolean environmentHasFeature( TestFeature feature ) - { - try{ - final DatabaseEnvironment environment = DatabaseEnvironment.getInstance(); - final boolean runIt = environment.support( feature ); - return runIt; - } - catch( Exception e ){ - throw new DatabaseUnitRuntimeException( e ); - } - } -} Modified: trunk/dbunit/src/test/org/dbunit/AllTests.java =================================================================== --- trunk/dbunit/src/test/org/dbunit/AllTests.java 2010-01-07 20:50:16 UTC (rev 1136) +++ trunk/dbunit/src/test/org/dbunit/AllTests.java 2010-01-21 22:31:08 UTC (rev 1137) @@ -44,8 +44,8 @@ suite.addTest(org.dbunit.util.search.AllTests.suite()); suite.addTest(new TestSuite(DatabaseUnitExceptionTest.class)); suite.addTest(new TestSuite(DatabaseProfileTest.class)); - suite.addTest(new TestSuite(DatabaseTestCaseTest.class)); - suite.addTest(new TestSuite(DBTestCaseTest.class)); + suite.addTest(new TestSuite(DatabaseTestCaseIT.class)); + suite.addTest(new TestSuite(DBTestCaseIT.class)); return suite; } Copied: trunk/dbunit/src/test/org/dbunit/DBTestCaseIT.java (from rev 1136, trunk/dbunit/src/test/org/dbunit/DBTestCaseTest.java) =================================================================== --- trunk/dbunit/src/test/org/dbunit/DBTestCaseIT.java (rev 0) +++ trunk/dbunit/src/test/org/dbunit/DBTestCaseIT.java 2010-01-21 22:31:08 UTC (rev 1137) @@ -0,0 +1,179 @@ +/* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002-2008, DbUnit.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package org.dbunit; + +import java.sql.SQLException; + +import org.dbunit.database.DatabaseConfig; +import org.dbunit.database.IDatabaseConnection; +import org.dbunit.dataset.IDataSet; +import org.dbunit.dataset.ITable; +import org.dbunit.dataset.xml.FlatXmlDataSetBuilder; +import org.dbunit.dataset.xml.FlatXmlDataSetTest; +import org.dbunit.operation.DatabaseOperation; + +import junit.framework.TestCase; + +/** + * @author gommma + * @author Last changed by: $Author: gommma $ + * @version $Revision: 789 $ $Date: 2008-08-15 16:45:18 +0200 (Fr, 15. Aug 2008) $ + * @since 2.4.3 + */ +public class DBTestCaseIT extends TestCase +{ + + /** + * Tests whether the user can simply change the {@link DatabaseConfig} by + * overriding the method {@link DatabaseTestCase#setUpDatabaseConfig(DatabaseConfig)}. + * @throws Exception + */ + public void testConfigureConnection() throws Exception + { + DatabaseEnvironment dbEnv = DatabaseEnvironment.getInstance(); + final IDatabaseConnection conn = dbEnv.getConnection(); + final DefaultDatabaseTester tester = new DefaultDatabaseTester(conn); + final DatabaseOperation operation = new DatabaseOperation(){ + public void execute(IDatabaseConnection connection, IDataSet dataSet) + throws DatabaseUnitException, SQLException { + assertEquals(new Integer(97), connection.getConfig().getProperty(DatabaseConfig.PROPERTY_BATCH_SIZE)); + assertEquals(true, connection.getConfig().getFeature(DatabaseConfig.FEATURE_BATCHED_STATEMENTS)); + } + }; + + DBTestCase testSubject = new DBTestCase() { + + /** + * method under test + */ + protected void setUpDatabaseConfig(DatabaseConfig config) { + config.setProperty(DatabaseConfig.PROPERTY_BATCH_SIZE, new Integer(97)); + config.setFeature(DatabaseConfig.FEATURE_BATCHED_STATEMENTS, true); + } + + protected IDatabaseTester newDatabaseTester() throws Exception { + return tester; + } + + protected DatabaseOperation getSetUpOperation() throws Exception { + return operation; + } + + protected DatabaseOperation getTearDownOperation() throws Exception { + return operation; + } + + protected IDataSet getDataSet() throws Exception { + return null; + } + }; + + // Simulate JUnit which first of all calls the "setUp" method + testSubject.setUp(); + + IDatabaseConnection actualConn = testSubject.getConnection(); + assertEquals(new Integer(97), actualConn.getConfig().getProperty(DatabaseConfig.PROPERTY_BATCH_SIZE)); + assertSame(conn, actualConn); + + IDatabaseConnection actualConn2 = testSubject.getDatabaseTester().getConnection(); + assertEquals(new Integer(97), actualConn2.getConfig().getProperty(DatabaseConfig.PROPERTY_BATCH_SIZE)); + assertSame(tester, testSubject.getDatabaseTester()); + assertSame(conn, testSubject.getDatabaseTester().getConnection()); + } + + + /** + * Tests the simple setup/teardown invocations while keeping the DatabaseConnection open. + * @throws Exception + */ + public void testExecuteSetUpTearDown() throws Exception + { + //TODO implement this + DatabaseEnvironment dbEnv = DatabaseEnvironment.getInstance(); + // Retrieve one single connection which is + final IDatabaseConnection conn = dbEnv.getConnection(); + try{ + final DefaultDatabaseTester tester = new DefaultDatabaseTester(conn); + final IDataSet dataset = new FlatXmlDataSetBuilder().build(FlatXmlDataSetTest.DATASET_FILE); + + // Connection should not be closed during setUp/tearDown because of userDefined IOperationListener + DBTestCase testSubject = new DBTestCase() { + + protected IDatabaseTester newDatabaseTester() throws Exception { + return tester; + } + + protected DatabaseOperation getSetUpOperation() throws Exception { + return DatabaseOperation.CLEAN_INSERT; + } + + protected DatabaseOperation getTearDownOperation() throws Exception { + return DatabaseOperation.DELETE_ALL; + } + + protected IDataSet getDataSet() throws Exception { + return dataset; + } + + protected IOperationListener getOperationListener() { + return new DefaultOperationListener(){ + public void operationSetUpFinished( + IDatabaseConnection connection) + { + // Do not invoke the "super" method to avoid that the connection is closed + // Just do nothing + } + + public void operationTearDownFinished( + IDatabaseConnection connection) + { + // Do not invoke the "super" method to avoid that the connection is closed + // Just do nothing + } + + }; + } + + + }; + + // Simulate JUnit which first of all calls the "setUp" method + testSubject.setUp(); + // The connection should still be open so we should be able to select from the DB + ITable testTableAfterSetup = conn.createTable("TEST_TABLE"); + assertEquals(6, testTableAfterSetup.getRowCount()); + assertFalse(conn.getConnection().isClosed()); + + // Simulate JUnit and invoke "tearDown" + testSubject.tearDown(); + // The connection should still be open so we should be able to select from the DB + ITable testTableAfterTearDown = conn.createTable("TEST_TABLE"); + assertEquals(0, testTableAfterTearDown.getRowCount()); + assertFalse(conn.getConnection().isClosed()); + } + finally{ + // Ensure that the connection is closed again so that + // it can be established later by subsequent test cases + dbEnv.closeConnection(); + } + } + +} \ No newline at end of file Deleted: trunk/dbunit/src/test/org/dbunit/DBTestCaseTest.java =================================================================== --- trunk/dbunit/src/test/org/dbunit/DBTestCaseTest.java 2010-01-07 20:50:16 UTC (rev 1136) +++ trunk/dbunit/src/test/org/dbunit/DBTestCaseTest.java 2010-01-21 22:31:08 UTC (rev 1137) @@ -1,179 +0,0 @@ -/* - * - * The DbUnit Database Testing Framework - * Copyright (C)2002-2008, DbUnit.org - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -package org.dbunit; - -import java.sql.SQLException; - -import org.dbunit.database.DatabaseConfig; -import org.dbunit.database.IDatabaseConnection; -import org.dbunit.dataset.IDataSet; -import org.dbunit.dataset.ITable; -import org.dbunit.dataset.xml.FlatXmlDataSetBuilder; -import org.dbunit.dataset.xml.FlatXmlDataSetTest; -import org.dbunit.operation.DatabaseOperation; - -import junit.framework.TestCase; - -/** - * @author gommma - * @author Last changed by: $Author: gommma $ - * @version $Revision: 789 $ $Date: 2008-08-15 16:45:18 +0200 (Fr, 15. Aug 2008) $ - * @since 2.4.3 - */ -public class DBTestCaseTest extends TestCase -{ - - /** - * Tests whether the user can simply change the {@link DatabaseConfig} by - * overriding the method {@link DatabaseTestCase#setUpDatabaseConfig(DatabaseConfig)}. - * @throws Exception - */ - public void testConfigureConnection() throws Exception - { - DatabaseEnvironment dbEnv = DatabaseEnvironment.getInstance(); - final IDatabaseConnection conn = dbEnv.getConnection(); - final DefaultDatabaseTester tester = new DefaultDatabaseTester(conn); - final DatabaseOperation operation = new DatabaseOperation(){ - public void execute(IDatabaseConnection connection, IDataSet dataSet) - throws DatabaseUnitException, SQLException { - assertEquals(new Integer(97), connection.getConfig().getProperty(DatabaseConfig.PROPERTY_BATCH_SIZE)); - assertEquals(true, connection.getConfig().getFeature(DatabaseConfig.FEATURE_BATCHED_STATEMENTS)); - } - }; - - DBTestCase testSubject = new DBTestCase() { - - /** - * method under test - */ - protected void setUpDatabaseConfig(DatabaseConfig config) { - config.setProperty(DatabaseConfig.PROPERTY_BATCH_SIZE, new Integer(97)); - config.setFeature(DatabaseConfig.FEATURE_BATCHED_STATEMENTS, true); - } - - protected IDatabaseTester newDatabaseTester() throws Exception { - return tester; - } - - protected DatabaseOperation getSetUpOperation() throws Exception { - return operation; - } - - protected DatabaseOperation getTearDownOperation() throws Exception { - return operation; - } - - protected IDataSet getDataSet() throws Exception { - return null; - } - }; - - // Simulate JUnit which first of all calls the "setUp" method - testSubject.setUp(); - - IDatabaseConnection actualConn = testSubject.getConnection(); - assertEquals(new Integer(97), actualConn.getConfig().getProperty(DatabaseConfig.PROPERTY_BATCH_SIZE)); - assertSame(conn, actualConn); - - IDatabaseConnection actualConn2 = testSubject.getDatabaseTester().getConnection(); - assertEquals(new Integer(97), actualConn2.getConfig().getProperty(DatabaseConfig.PROPERTY_BATCH_SIZE)); - assertSame(tester, testSubject.getDatabaseTester()); - assertSame(conn, testSubject.getDatabaseTester().getConnection()); - } - - - /** - * Tests the simple setup/teardown invocations while keeping the DatabaseConnection open. - * @throws Exception - */ - public void testExecuteSetUpTearDown() throws Exception - { - //TODO implement this - DatabaseEnvironment dbEnv = DatabaseEnvironment.getInstance(); - // Retrieve one single connection which is - final IDatabaseConnection conn = dbEnv.getConnection(); - try{ - final DefaultDatabaseTester tester = new DefaultDatabaseTester(conn); - final IDataSet dataset = new FlatXmlDataSetBuilder().build(FlatXmlDataSetTest.DATASET_FILE); - - // Connection should not be closed during setUp/tearDown because of userDefined IOperationListener - DBTestCase testSubject = new DBTestCase() { - - protected IDatabaseTester newDatabaseTester() throws Exception { - return tester; - } - - protected DatabaseOperation getSetUpOperation() throws Exception { - return DatabaseOperation.CLEAN_INSERT; - } - - protected DatabaseOperation getTearDownOperation() throws Exception { - return DatabaseOperation.DELETE_ALL; - } - - protected IDataSet getDataSet() throws Exception { - return dataset; - } - - protected IOperationListener getOperationListener() { - return new DefaultOperationListener(){ - public void operationSetUpFinished( - IDatabaseConnection connection) - { - // Do not invoke the "super" method to avoid that the connection is closed - // Just do nothing - } - - public void operationTearDownFinished( - IDatabaseConnection connection) - { - // Do not invoke the "super" method to avoid that the connection is closed - // Just do nothing - } - - }; - } - - - }; - - // Simulate JUnit which first of all calls the "setUp" method - testSubject.setUp(); - // The connection should still be open so we should be able to select from the DB - ITable testTableAfterSetup = conn.createTable("TEST_TABLE"); - assertEquals(6, testTableAfterSetup.getRowCount()); - assertFalse(conn.getConnection().isClosed()); - - // Simulate JUnit and invoke "tearDown" - testSubject.tearDown(); - // The connection should still be open so we should be able to select from the DB - ITable testTableAfterTearDown = conn.createTable("TEST_TABLE"); - assertEquals(0, testTableAfterTearDown.getRowCount()); - assertFalse(conn.getConnection().isClosed()); - } - finally{ - // Ensure that the connection is closed again so that - // it can be established later by subsequent test cases - dbEnv.closeConnection(); - } - } - -} \ No newline at end of file Copied: trunk/dbunit/src/test/org/dbunit/DatabaseTestCaseIT.java (from rev 1136, trunk/dbunit/src/test/org/dbunit/DatabaseTestCaseTest.java) =================================================================== --- trunk/dbunit/src/test/org/dbunit/DatabaseTestCaseIT.java (rev 0) +++ trunk/dbunit/src/test/org/dbunit/DatabaseTestCaseIT.java 2010-01-21 22:31:08 UTC (rev 1137) @@ -0,0 +1,89 @@ +/* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002-2004, DbUnit.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package org.dbunit; + +import org.dbunit.database.DatabaseConfig; +import org.dbunit.database.IDatabaseConnection; +import org.dbunit.dataset.IDataSet; +import org.dbunit.operation.DatabaseOperation; + +import junit.framework.TestCase; + +/** + * @author gommma + * @author Last changed by: $Author$ + * @version $Revision$ $Date$ + * @since 2.3.0 + */ +public class DatabaseTestCaseIT extends TestCase +{ + + public void testTearDownExceptionDoesNotObscureTestException() + { + //TODO implement #1087040 tearDownOperation Exception obscures underlying problem + } + + /** + * Tests whether the user can simply change the {@link DatabaseConfig} by + * overriding the method {@link DatabaseTestCase#setUpDatabaseConfig(DatabaseConfig)}. + * @throws Exception + */ + public void testConfigureConnection() throws Exception + { + DatabaseEnvironment dbEnv = DatabaseEnvironment.getInstance(); + final IDatabaseConnection conn = dbEnv.getConnection(); + + DatabaseTestCase testSubject = new DatabaseTestCase() { + + /** + * method under test + */ + protected void setUpDatabaseConfig(DatabaseConfig config) { + config.setProperty(DatabaseConfig.PROPERTY_BATCH_SIZE, new Integer(97)); + } + + protected IDatabaseConnection getConnection() throws Exception { + return conn; + } + + protected IDataSet getDataSet() throws Exception { + return null; + } + + protected DatabaseOperation getSetUpOperation() throws Exception { + return DatabaseOperation.NONE; + } + + protected DatabaseOperation getTearDownOperation() throws Exception { + return DatabaseOperation.NONE; + } + }; + + // Simulate JUnit which first of all calls the "setUp" method + testSubject.setUp(); + + IDatabaseConnection actualConn = testSubject.getConnection(); + assertEquals(new Integer(97), actualConn.getConfig().getProperty(DatabaseConfig.PROPERTY_BATCH_SIZE)); + + IDatabaseConnection actualConn2 = testSubject.getDatabaseTester().getConnection(); + assertEquals(new Integer(97), actualConn2.getConfig().getProperty(DatabaseConfig.PROPERTY_BATCH_SIZE)); + } +} Property changes on: trunk/dbunit/src/test/org/dbunit/DatabaseTestCaseIT.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision LastChangedRevision LastChangedBy LastChangedDate HeadURL Deleted: trunk/dbunit/src/test/org/dbunit/DatabaseTestCaseTest.java =================================================================== --- trunk/dbunit/src/test/org/dbunit/DatabaseTestCaseTest.java 2010-01-07 20:50:16 UTC (rev 1136) +++ trunk/dbunit/src/test/org/dbunit/DatabaseTestCaseTest.java 2010-01-21 22:31:08 UTC (rev 1137) @@ -1,89 +0,0 @@ -/* - * - * The DbUnit Database Testing Framework - * Copyright (C)2002-2004, DbUnit.org - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -package org.dbunit; - -import org.dbunit.database.DatabaseConfig; -import org.dbunit.database.IDatabaseConnection; -import org.dbunit.dataset.IDataSet; -import org.dbunit.operation.DatabaseOperation; - -import junit.framework.TestCase; - -/** - * @author gommma - * @author Last changed by: $Author$ - * @version $Revision$ $Date$ - * @since 2.3.0 - */ -public class DatabaseTestCaseTest extends TestCase -{ - - public void testTearDownExceptionDoesNotObscureTestException() - { - //TODO implement #1087040 tearDownOperation Exception obscures underlying problem - } - - /** - * Tests whether the user can simply change the {@link DatabaseConfig} by - * overriding the method {@link DatabaseTestCase#setUpDatabaseConfig(DatabaseConfig)}. - * @throws Exception - */ - public void testConfigureConnection() throws Exception - { - DatabaseEnvironment dbEnv = DatabaseEnvironment.getInstance(); - final IDatabaseConnection conn = dbEnv.getConnection(); - - DatabaseTestCase testSubject = new DatabaseTestCase() { - - /** - * method under test - */ - protected void setUpDatabaseConfig(DatabaseConfig config) { - config.setProperty(DatabaseConfig.PROPERTY_BATCH_SIZE, new Integer(97)); - } - - protected IDatabaseConnection getConnection() throws Exception { - return conn; - } - - protected IDataSet getDataSet() throws Exception { - return null; - } - - protected DatabaseOperation getSetUpOperation() throws Exception { - return DatabaseOperation.NONE; - } - - protected DatabaseOperation getTearDownOperation() throws Exception { - return DatabaseOperation.NONE; - } - }; - - // Simulate JUnit which first of all calls the "setUp" method - testSubject.setUp(); - - IDatabaseConnection actualConn = testSubject.getConnection(); - assertEquals(new Integer(97), actualConn.getConfig().getProperty(DatabaseConfig.PROPERTY_BATCH_SIZE)); - - IDatabaseConnection actualConn2 = testSubject.getDatabaseTester().getConnection(); - assertEquals(new Integer(97), actualConn2.getConfig().getProperty(DatabaseConfig.PROPERTY_BATCH_SIZE)); - } -} Modified: trunk/dbunit/src/test/org/dbunit/ant/AllTests.java =================================================================== --- trunk/dbunit/src/test/org/dbunit/ant/AllTests.java 2010-01-07 20:50:16 UTC (rev 1136) +++ trunk/dbunit/src/test/org/dbunit/ant/AllTests.java 2010-01-21 22:31:08 UTC (rev 1137) @@ -33,7 +33,7 @@ public static Test suite() { TestSuite suite = new TestSuite(); - suite.addTest(new TestSuite(DbUnitTaskTest.class)); + suite.addTest(new TestSuite(DbUnitTaskIT.class)); return suite; } } Copied: trunk/dbunit/src/test/org/dbunit/ant/DbUnitTaskIT.java (from rev 1136, trunk/dbunit/src/test/org/dbunit/ant/DbUnitTaskTest.java) =================================================================== --- trunk/dbunit/src/test/org/dbunit/ant/DbUnitTaskIT.java (rev 0) +++ trunk/dbunit/src/test/org/dbunit/ant/DbUnitTaskIT.java 2010-01-21 22:31:08 UTC (rev 1137) @@ -0,0 +1,633 @@ +/* + * + * The DbUnit Database Testing Framework + * Copyright (C)2002-2004, DbUnit.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +package org.dbunit.ant; + +import java.io.File; +import java.sql.SQLException; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; + +import junit.framework.Test; +import junit.framework.TestSuite; +import junitx.framework.ArrayAssert; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.BuildFileTest; +import org.apache.tools.ant.Target; +import org.dbunit.DatabaseEnvironment; +import org.dbunit.DatabaseUnitException; +import org.dbunit.IDatabaseTester; +import org.dbunit.database.DatabaseConfig; +import org.dbunit.database.IDatabaseConnection; +import org.dbunit.dataset.FilteredDataSet; +import org.dbunit.dataset.IDataSet; +import org.dbunit.dataset.NoSuchTableException; +import org.dbunit.dataset.ITable; +import org.dbunit.dataset.datatype.IDataTypeFactory; +import org.dbunit.ext.mssql.InsertIdentityOperation; +import org.dbunit.ext.oracle.OracleDataTypeFactory; +import org.dbunit.operation.DatabaseOperation; +import org.dbunit.util.FileHelper; + +/** + * Ant-based test class for the Dbunit ant task definition. + * + * @author Timothy Ruppert + * @author Ben Cox + * @author Last changed by: $Author$ + * @version $Revision$ $Date$ + * @since Jun 10, 2002 + * @see org.dbunit.ant.AntTest + */ +public class DbUnitTaskIT extends BuildFileTest +{ + static protected Class classUnderTest = DbUnitTaskIT.class; + + private static final String BUILD_FILE_DIR = "src/xml"; + private static final String OUTPUT_DIR = "target/xml"; + + private File outputDir; + + public DbUnitTaskIT(String name) + { + super(name); + } + + public void setUp() throws Exception + { + // This line ensure test database is initialized + DatabaseEnvironment.getInstance(); + + String filePath = BUILD_FILE_DIR + "/antTestBuildFile.xml"; + assertTrue("Buildfile not found", new File(filePath).isFile()); + configureProject(filePath); + + outputDir = new File(getProjectDir(), OUTPUT_DIR); + outputDir.mkdirs(); + } + + protected void tearDown() throws Exception + { + super.tearDown(); + + outputDir = new File(getProjectDir(), OUTPUT_DIR); + FileHelper.deleteDirectory(outputDir); + } + + public void testNoDriver() + { + expectBuildException("no-driver", "Should have required a driver attribute."); + } + + public void testNoDbUrl() + { + expectBuildException("no-db-url", "Should have required a url attribute."); + } + + public void testNoUserid() + { + expectBuildException("no-userid", "Should have required a userid attribute."); + } + + public void testNoPassword() + { + expectBuildException("no-password", "Should have required a password attribute."); + } + + public void testInvalidDatabaseInformation() + { + Throwable sql = null; + try + { + executeTarget("invalid-db-info"); + } + catch (BuildException e) + { + sql = e.getException(); + } + finally + { + assertNotNull("Should have thrown a SQLException.", sql); + assertTrue("Should have thrown a SQLException.", (sql instanceof SQLException)); + } + } + + public void testInvalidOperationType() + { + Throwable iae = null; + try + { + executeTarget("invalid-type"); + } + catch (BuildException e) + { + iae = e.getException(); + } + finally + { + assertNotNull("Should have thrown an IllegalArgumentException.", iae); + assertTrue("Should have thrown an IllegalArgumentException.", + (iae instanceof IllegalArgumentException)); + } + } + + public void testSetFlatFalse() + { + String targetName = "set-format-xml"; + Operation operation = (Operation)getFirstStepFromTarget(targetName); + assertTrue("Operation attribute format should have been 'xml', but was: " + + operation.getFormat(), operation.getFormat().equalsIgnoreCase("xml")); + } + + public void testResolveOperationTypes() + { + assertOperationType("Should have been a NONE operation", + "test-type-none", DatabaseOperation.NONE); + assertOperationType("Should have been an DELETE_ALL operation", + "test-type-delete-all", DatabaseOperation.DELETE_ALL); + assert... [truncated message content] |
From: <jb...@us...> - 2010-01-07 20:50:23
|
Revision: 1136 http://dbunit.svn.sourceforge.net/dbunit/?rev=1136&view=rev Author: jbhurst Date: 2010-01-07 20:50:16 +0000 (Thu, 07 Jan 2010) Log Message: ----------- Spelling and grammar corrections on credits page. Modified Paths: -------------- trunk/dbunit/src/site/xdoc/credits.xml Modified: trunk/dbunit/src/site/xdoc/credits.xml =================================================================== --- trunk/dbunit/src/site/xdoc/credits.xml 2010-01-07 20:47:51 UTC (rev 1135) +++ trunk/dbunit/src/site/xdoc/credits.xml 2010-01-07 20:50:16 UTC (rev 1136) @@ -10,23 +10,23 @@ <!-- The body of the document contains a number of sections --> <section name="Credits"> - <p>As many open source projects <b>DbUnit</b> have to thanks not only the developers and the users community but some supporting companies too as they provide us licenses, bandwith, space adn all sort of things which usually you should pay for.</p> + <p>As with many open source projects, <b>DbUnit</b> has to thank not only the developer and the user community but some supporting companies too, as they provide us licenses, bandwith, space and all sorts of things that usually you have to pay for.</p> <p>Here follows the list of companies supporting the project.</p> <ul> <li> - <a href="http://www.sourceforge.net">SourceForge</a> provides us the web space, the Subversion repository and all other tools in it's great platform;<br/> + <a href="http://www.sourceforge.net">SourceForge</a> provides us the web space, the Subversion repository and all other tools in its great platform;<br/> <a href="https://sourceforge.net/projects/smartweb/"><img style="float:none" src="http://sourceforge.net/sflogo.php?group_id=47439&type=5" title="Hosted by SourceForge"/></a> </li> <li> - <a href="http://www.cenqua.com">Cenqua</a> is providing us it's Clover code coverage tool with Maven plugin;<br/> + <a href="http://www.cenqua.com">Cenqua</a> is providing us its Clover code coverage tool with Maven plugin;<br/> <a href="http://www.cenqua.com/clover"><img style="float:none" src="http://www.cenqua.com/images/clovered.gif" title="Supported by Cenqua"/></a> </li> <li> - <a href="http://www.gentleware.com">Gentleware</a> provides us it's UML diagramming tool;<br/> + <a href="http://www.gentleware.com">Gentleware</a> provides us its UML diagramming tool;<br/> <a href="http://www.gentleware.com"><img style="float:none" src="http://www.gentleware.com/uploads/pics/apollo_withlogo_01.png" title="Sponsored by Apollo for Eclipse"/></a> </li> <li> - <a href="http://www.ej-technologies.com">ejTechnologies</a> have issued free license of their profiling tool;<br/> + <a href="http://www.ej-technologies.com">ejTechnologies</a> have issued free license of its profiling tool;<br/> <a href="http://www.ej-technologies.com/products/jprofiler/overview.html"><img style="float:none" src="http://www.ej-technologies.com/images/headlines/3453392302.png"/></a> </li> </ul> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2010-01-07 20:47:58
|
Revision: 1135 http://dbunit.svn.sourceforge.net/dbunit/?rev=1135&view=rev Author: jbhurst Date: 2010-01-07 20:47:51 +0000 (Thu, 07 Jan 2010) Log Message: ----------- Corrected support link. Modified Paths: -------------- trunk/dbunit/src/site/site.xml Modified: trunk/dbunit/src/site/site.xml =================================================================== --- trunk/dbunit/src/site/site.xml 2010-01-07 20:32:54 UTC (rev 1134) +++ trunk/dbunit/src/site/site.xml 2010-01-07 20:47:51 UTC (rev 1135) @@ -55,7 +55,7 @@ <item name="Changes" href="/changes-report.html"/> <item name="FAQ" href="/faq.html"/> <item name="Wiki" href="http://dbunit.wikidot.com/"/> - <item name="Get Support" href="http://sourceforge.net/support/getsupport.php?group_id=47439"/> + <item name="Get support" href="http://sourceforge.net/projects/dbunit/support"/> <item name="Get source" href="/source-repository.html"/> <item name="Browse source" href="/xref/index.html"/> <item name="JavaDocs" href="/apidocs/index.html"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2010-01-07 20:33:01
|
Revision: 1134 http://dbunit.svn.sourceforge.net/dbunit/?rev=1134&view=rev Author: jbhurst Date: 2010-01-07 20:32:54 +0000 (Thu, 07 Jan 2010) Log Message: ----------- [2925662] - General Logging Message Change Requests Modified Paths: -------------- trunk/dbunit/src/java/org/dbunit/database/DatabaseTableMetaData.java trunk/dbunit/src/java/org/dbunit/dataset/datatype/BytesDataType.java trunk/dbunit/src/java/org/dbunit/util/SQLHelper.java Modified: trunk/dbunit/src/java/org/dbunit/database/DatabaseTableMetaData.java =================================================================== --- trunk/dbunit/src/java/org/dbunit/database/DatabaseTableMetaData.java 2009-12-27 23:21:46 UTC (rev 1133) +++ trunk/dbunit/src/java/org/dbunit/database/DatabaseTableMetaData.java 2010-01-07 20:32:54 UTC (rev 1134) @@ -122,7 +122,7 @@ if(!caseSensitiveMetaData) { _originalTableName = SQLHelper.correctCase(tableName, jdbcConnection); - SQLHelper.logInfoIfValueChanged(tableName, _originalTableName, "Corrected table name:", DatabaseTableMetaData.class); + SQLHelper.logDebugIfValueChanged(tableName, _originalTableName, "Corrected table name:", DatabaseTableMetaData.class); } else { Modified: trunk/dbunit/src/java/org/dbunit/dataset/datatype/BytesDataType.java =================================================================== --- trunk/dbunit/src/java/org/dbunit/dataset/datatype/BytesDataType.java 2009-12-27 23:21:46 UTC (rev 1133) +++ trunk/dbunit/src/java/org/dbunit/dataset/datatype/BytesDataType.java 2010-01-07 20:32:54 UTC (rev 1134) @@ -134,7 +134,7 @@ } catch (FileNotFoundException e2) { - logger.info("Assuming given string to be Base64 and not a URI or File"); + logger.debug("Assuming given string to be Base64 and not a URI or File"); // Not a file name either return Base64.decode(stringValue); } Modified: trunk/dbunit/src/java/org/dbunit/util/SQLHelper.java =================================================================== --- trunk/dbunit/src/java/org/dbunit/util/SQLHelper.java 2009-12-27 23:21:46 UTC (rev 1133) +++ trunk/dbunit/src/java/org/dbunit/util/SQLHelper.java 2010-01-07 20:32:54 UTC (rev 1134) @@ -622,6 +622,23 @@ } /** + * Checks whether two given values are unequal and if so print a log message (level DEBUG) + * @param oldValue The old value of a property + * @param newValue The new value of a property + * @param message The message to be logged + * @param source The class which invokes this method - used for enriching the log message + * @since 2.4.8 + */ + public static final void logDebugIfValueChanged(String oldValue, String newValue, String message, Class source) + { + if (logger.isDebugEnabled()) + { + if (oldValue != null && !oldValue.equals(newValue)) + logger.debug("{}. {} oldValue={} newValue={}", new Object[] {source, message, oldValue, newValue}); + } + } + + /** * @param tableName * @param dbIdentifierQuoteString * @return This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2009-12-27 23:21:58
|
Revision: 1133 http://dbunit.svn.sourceforge.net/dbunit/?rev=1133&view=rev Author: jbhurst Date: 2009-12-27 23:21:46 +0000 (Sun, 27 Dec 2009) Log Message: ----------- [2919427] - OracleDataTypeFactory recognises 'SYS.XMLTYPE'. Modified Paths: -------------- trunk/dbunit/src/changes/changes.xml trunk/dbunit/src/java/org/dbunit/ext/oracle/OracleDataTypeFactory.java Modified: trunk/dbunit/src/changes/changes.xml =================================================================== --- trunk/dbunit/src/changes/changes.xml 2009-12-27 21:36:20 UTC (rev 1132) +++ trunk/dbunit/src/changes/changes.xml 2009-12-27 23:21:46 UTC (rev 1133) @@ -15,6 +15,7 @@ <action dev="jbhurst" type="add" issue="2875253" due-to="caseylucas">Additional refinements for Oracle SDO_GEOMETRY datatype</action> <action dev="jbhurst" type="add" issue="2921131" due-to="vlamp">Add timezone support for timestamp data type</action> <action dev="jbhurst" type="add" issue="2905970" due-to="pkamm">Upgrade to POI Version 3.5-FINAL</action> + <action dev="jbhurst" type="add" issue="2919427" due-to="dbamberghi (Daniele Bamberghi)">OracleDataTypeFactory recognises "SYS.XMLTYPE"</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/java/org/dbunit/ext/oracle/OracleDataTypeFactory.java =================================================================== --- trunk/dbunit/src/java/org/dbunit/ext/oracle/OracleDataTypeFactory.java 2009-12-27 21:36:20 UTC (rev 1132) +++ trunk/dbunit/src/java/org/dbunit/ext/oracle/OracleDataTypeFactory.java 2009-12-27 23:21:46 UTC (rev 1133) @@ -87,7 +87,7 @@ } // XMLTYPE - if ("XMLTYPE".equals(sqlTypeName)) + if ("XMLTYPE".equals(sqlTypeName) || "SYS.XMLTYPE".equals(sqlTypeName)) { return ORACLE_XMLTYPE; } @@ -162,3 +162,5 @@ return super.createDataType(sqlType, sqlTypeName); } } + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |