You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(5) |
Jul
(7) |
Aug
(37) |
Sep
|
Oct
|
Nov
(1) |
Dec
(22) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(8) |
Feb
(68) |
Mar
(72) |
Apr
(149) |
May
(32) |
Jun
(46) |
Jul
(26) |
Aug
(59) |
Sep
(25) |
Oct
(18) |
Nov
(4) |
Dec
(3) |
2004 |
Jan
(90) |
Feb
(19) |
Mar
(38) |
Apr
(41) |
May
(44) |
Jun
(2) |
Jul
(10) |
Aug
|
Sep
(14) |
Oct
|
Nov
(1) |
Dec
|
2005 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(15) |
Jun
(1) |
Jul
|
Aug
(9) |
Sep
|
Oct
(17) |
Nov
|
Dec
|
2006 |
Jan
(1) |
Feb
(16) |
Mar
|
Apr
(1) |
May
(48) |
Jun
|
Jul
(2) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(29) |
2007 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
(23) |
Mar
(31) |
Apr
|
May
(26) |
Jun
(6) |
Jul
(1) |
Aug
|
Sep
(7) |
Oct
(1) |
Nov
(8) |
Dec
(8) |
2009 |
Jan
(5) |
Feb
(9) |
Mar
(1) |
Apr
|
May
(23) |
Jun
(3) |
Jul
|
Aug
(1) |
Sep
(9) |
Oct
(28) |
Nov
(18) |
Dec
(8) |
2010 |
Jan
(19) |
Feb
(24) |
Mar
(3) |
Apr
|
May
(5) |
Jun
(4) |
Jul
|
Aug
(1) |
Sep
(11) |
Oct
|
Nov
(2) |
Dec
(1) |
2011 |
Jan
|
Feb
(7) |
Mar
|
Apr
(6) |
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(32) |
Oct
(6) |
Nov
|
Dec
|
From: <mla...@us...> - 2003-08-18 11:22:16
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/ext/db2 In directory sc8-pr-cvs1:/tmp/cvs-serv4708/src/test/org/dbunit/ext/db2 Modified Files: AllTests.java Added Files: Db2DataTypeFactoryTest.java Removed Files: Db2Test.java Log Message: * DB2 data types refactoring. * Added tests on data type factories. --- NEW FILE: Db2DataTypeFactoryTest.java --- /* * * The DbUnit Database Testing Framework * Copyright (C)2002, Manuel Laflamme * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package org.dbunit.ext.db2; import org.dbunit.dataset.datatype.AbstractDataTypeFactoryTest; import org.dbunit.dataset.datatype.IDataTypeFactory; import org.dbunit.dataset.datatype.DataType; import org.dbunit.ext.oracle.OracleDataTypeFactory; import java.sql.Types; /** * @author Manuel Laflamme * @since Aug 13, 2003 * @version $Revision: 1.1 $ */ public class Db2DataTypeFactoryTest extends AbstractDataTypeFactoryTest { public Db2DataTypeFactoryTest(String s) { super(s); } public IDataTypeFactory createFactory() throws Exception { return new Db2DataTypeFactory(); } public void testCreateXmlVarcharDataType() throws Exception { DataType expected = Db2DataTypeFactory.DB2XML_XMLVARCHAR; int sqlType = Types.DISTINCT; String sqlTypeName = "DB2XML.XMLVARCHAR"; DataType actual = createFactory().createDataType(sqlType, sqlTypeName); assertSame("type", expected, actual); } public void testCreateXmlClobDataType() throws Exception { DataType expected = Db2DataTypeFactory.DB2XML_XMLCLOB; int sqlType = Types.DISTINCT; String sqlTypeName = "DB2XML.XMLCLOB"; DataType actual = createFactory().createDataType(sqlType, sqlTypeName); assertSame("type", expected, actual); } public void testCreateXmlFileDataType() throws Exception { DataType expected = Db2DataTypeFactory.DB2XML_XMLFILE; int sqlType = Types.DISTINCT; String sqlTypeName = "DB2XML.XMLFILE"; DataType actual = createFactory().createDataType(sqlType, sqlTypeName); assertSame("type", expected, actual); } } Index: AllTests.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/ext/db2/AllTests.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AllTests.java 9 Aug 2003 11:23:32 -0000 1.2 --- AllTests.java 18 Aug 2003 11:13:09 -0000 1.3 *************** *** 35,39 **** { TestSuite suite = new TestSuite(); ! suite.addTest(new TestSuite(org.dbunit.ext.db2.xmlextender.XmlExtenderTest.class)); return suite; } --- 35,39 ---- { TestSuite suite = new TestSuite(); ! suite.addTest(new TestSuite(Db2DataTypeFactoryTest.class)); return suite; } --- Db2Test.java DELETED --- |
From: <mla...@us...> - 2003-08-18 11:22:16
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/ext/db2/xmlextender In directory sc8-pr-cvs1:/tmp/cvs-serv4708/src/java/org/dbunit/ext/db2/xmlextender Removed Files: XmlExtenderDataType.java Log Message: * DB2 data types refactoring. * Added tests on data type factories. --- XmlExtenderDataType.java DELETED --- |
From: <mla...@us...> - 2003-08-14 01:09:00
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/ext/oracle In directory sc8-pr-cvs1:/tmp/cvs-serv17378/oracle Log Message: Directory /cvsroot/dbunit/dbunit/src/test/org/dbunit/ext/oracle added to the repository |
From: <de...@us...> - 2003-08-13 09:40:06
|
Update of /cvsroot/dbunit/dbunit In directory sc8-pr-cvs1:/tmp/cvs-serv27793 Modified Files: project.xml Log Message: New xdoc version of documentation.. Index: project.xml =================================================================== RCS file: /cvsroot/dbunit/dbunit/project.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** project.xml 13 Aug 2003 08:51:49 -0000 1.5 --- project.xml 13 Aug 2003 09:40:02 -0000 1.6 *************** *** 169,172 **** --- 169,173 ---- <report>maven-tasklist-plugin</report> <report>maven-pmd-plugin</report> + <report>maven-faq-plugin</report> </reports> |
From: <de...@us...> - 2003-08-13 09:40:05
|
Update of /cvsroot/dbunit/dbunit/xdocs In directory sc8-pr-cvs1:/tmp/cvs-serv27793/xdocs Modified Files: changes.xml Added Files: bestpractices.xml components.xml intro.xml faq.fml support.xml anttask.xml navigation.xml properties.xml resources.xml download.xml howto.xml Log Message: New xdoc version of documentation.. --- NEW FILE: bestpractices.xml --- <?xml version="1.0" encoding="ISO-8859-1"?> <document><properties><title>The Dbunit Framework - Best Practices</title></properties><body><section> <h2>Best Practices</h2> <p>All existing JUnit best practices still apply to the Dbunit framework. Here is a collection of best practices specifically related to database testing and Dbunit.</p> <ul> <li><a href="#onedbperdev">Use one database copy per developer</a></li> <li><a href="#nocleanup">Good setup for every tests do not require cleanup</a></li> <li><a href="#smalldatasets">Use multiple small datasets </a></li> <li><a href="#staledata">Perform setup of stale data once for entire test class or a test suite</a></li> <li><a href="#connections">Connection management strategies</a></li> <li><a href="#tableseq">Table sequence in dataset</a></li> </ul> <hr></hr> <h3><a name="onedbperdev">Use one database copy per developer</a></h3> See <a href="intro.html">introduction</a>.<br></br> <br></br> <h3><a name="nocleanup"> Good setup for every tests do not require cleanup</a></h3> People versed in testcase design already know that a test should never depend on results from previous tests. If you always correctly initialize your database before each test you won't need to do any clean up at all after execution.<br></br> <br></br> <h3><a name="smalldatasets"> Use multiple small datasets</a></h3> Most of your tests do not require the entire database to be re-initialized. So, instead of putting your entire database data in one large dataset, try to break it into many smaller chunks.<br></br> <br></br> Those chunks could roughly corresponding to logical units, or components. This reduces the overhead caused by initializing your database for each test. This also facilitates team development since many developers working on different components can modify datasets independently.<br></br> <br></br> For integrated testing, you can still use the CompositeDataSet implementation to combine multiple datasets into one at run time.<br></br> <br></br> <h3><a name="staledata"> Perform setup of stale data once for entire test class or a test suite</a></h3> If several tests are using the same read-only data, this data could be initialized once for an entire test class or test suite. You need to be cautious and ensure you never modify this data. This can reduce the time required to run your tests but also introduces more risk. <br></br> <br></br> This feature is not yet integrated in Dbunit but may be added in the future. Something likes a DatabaseTestSuite class? <br></br> <br></br> <h3><a name="connections"> Connection management strategies</a></h3> Here are the recommended connection management strategies depending whether you test from a remote client or an in-container strategy:<br></br> <h4>Remote client with DatabaseTestCase</h4> <p>You should reuse the same connection for the entire test suite to reduce the overhead of creating a new connection for each test by using a singleton. Since version 1.1, DatabaseTestCase is closing every connection in setUp() and tearDown(). Override the closeConnection() method with an empty body to modify this behavior. </p> <h4>In-container with Cactus or JUnitEE</h4> If you use the in-container strategy you should use a DatabaseDataSourceConnection object to access the DataSource you configured for your application server. Jdbc connections are requested on demand from the DataSource. So you can rely on the built-in connection pooling capability of your application server to achieve better performance.<br></br> <pre> IDatabaseConnection connection = new DatabaseDataSourceConnection( new InitialContext(), "jdbc/myDataSource");</pre> <h3><a name="tableseq"> Table sequence in dataset</a></h3> To prevent problems with foreign keys, tables must be sequenced appropriately in dataset. The framework executes INSERT, UPDATE and REFRESH operations using the same sequence while DELETE and DELETE_ALL are executed in reverse order.<br></br> </section></body></document> --- NEW FILE: components.xml --- <?xml version="1.0" encoding="ISO-8859-1"?> <document><properties><title>The Dbunit Framework - Framework Components</title></properties><body><section> <h2>Core Classes</h2> The following walks you through the core classes that make up DbUnit: <ul> <li><a href="#dataset">IDataSet (org.dbunit.dataset)</a></li> <li><a href="#databaseconnection">IDatabaseConnection (org.dbunit.database)</a></li> <li><a href="#databaseoperation">DatabaseOperation (org.dbunit.operation)</a></li> </ul> <p>All the above are interfaces or abstract classes and you will find yourself using implementations or subclasses.</p> <hr></hr> <h3><a name="dataset">IDataSet</a></h3> <p>The <a class="code">IDataSet</a> interface represents is a collection of data from various tables. As explained later, these data is used to execute setup operations on a target database. </p> <p>The <a class="code">IDataSet</a> implementations provided by the framework are: </p> <ul> <li><a href="#XmlDataSet">XmlDataSet</a></li> <li><a href="#FlatXmlDataSet">FlatXmlDataSet</a> <font color="#FF0000">(updated)</font></li> <li><a href="#DatabaseDataSet">DatabaseDataSet</a></li> <li><a href="#DefaultDataSet">DefaultDataSet</a></li> <li><a href="#CompositeDataSet">CompositeDataSet</a></li> <li><a href="#FilteredDataSet">FilteredDataSet</a></li> <li><a href="#QueryDataSet">QueryDataSet</a> <font color="#FF0000">(new)</font></li> </ul> The <a class="code">IDataSet</a> interface: <pre>public interface IDataSet { /** * Returns list of table names this dataset contains. */ public String[] getTableNames() throws DataSetException; /** * Returns the specified table metatdata. */ public ITableMetaData getTableMetaData(String tableName) throws DataSetException; /** * Returns the specified table. */ public ITable getTable(String tableName) throws DataSetException; /**<br></br> * Returns tables contained by this dataset. Multiple table having the same<br></br> * name but different data may be returned. This method exist since version 1.5.<br></br> */<br></br> public ITable[] getTables() throws DataSetException;<br></br>}</pre> <a name="XmlDataSet"> <h4>XmlDataSet </h4> </a> <p>The <a class="code">XmlDataSet</a> class provides the persistence support to read from and write to the generic XML dataset format. This format is very verbiose and must conform to the following DTD:</p> <pre> <?xml version="1.0" encoding="UTF-8"?> <!ELEMENT dataset (table+)> <!ELEMENT table (column*, row*)> <!ATTLIST table name CDATA #REQUIRED > <!ELEMENT column (#PCDATA)> <!ELEMENT row (value | null | none)*> <!ELEMENT value (#PCDATA)> <!ELEMENT null EMPTY> </pre> <a name="originalxmlsample">Example of XML document:</a><br></br> <pre> <!DOCTYPE dataset SYSTEM "dataset.dtd"> <dataset> <table name="TEST_TABLE"> <column>COLUMN0</column> <column>COLUMN1</column> <column>COLUMN2</column> <column>COLUMN3</column> <row> <value>row 0 col 0</value> <value>row 0 col 1</value> <value>row 0 col 2</value> <value>row 0 col 3</value> </row> <row> <value>row 1 col 0</value> <null/> <null/> <value>row 1 col 3</value> </row> </table> <table name="SECOND_TABLE"> <column>COLUMN0</column> <column>COLUMN1</column> <row> <value>row 0 col 0</value> <value>row 0 col 1</value> </row> <row> <value>row 1 col 0</value> <value>row 1 col 1</value> </row> </table> <table name='EMPTY_TABLE'> <column>COLUMN0</column> <column>COLUMN1</column> <column>COLUMN2</column> <column>COLUMN3</column> </table> </dataset></pre> <h4><a name="FlatXmlDataSet">FlatXmlDataSet</a></h4> <p>The <a class="code">FlatXmlDataSet</a> class has been introduced in version 1.2. I found that generic XML datasets were hard to write and to maintain. This was particularly painful for tables having a lot of columns. </p> <p>In the flat XML format, each XML element corresponds to a table row. Each XML element name corresponds to a table name. The XML attributes correspond to table columns. Here is an example dataset containing the same data than the <a href="#originalxmlsample">XmlDataSet example</a>:<br></br> </p> <pre> <!DOCTYPE dataset SYSTEM "my-dataset.dtd"> <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" COLUMN3="row 1 col 3"/> <SECOND_TABLE COLUMN0="row 0 col 0" COLUMN1="row 0 col 1" /> <SECOND_TABLE COLUMN0="row 1 col 0" COLUMN1="row 1 col 1" /> <EMPTY_TABLE/> </dataset></pre> Learn how to export your database data to this format <a href="howto.html#extract">here</a> and how to generate a DTD representing your database schema <a href="howto.html#generatedtd">here</a>. Note that DbUnit does not automatically add a reference to your DTD when you export a dataset. You must edit the output file to manually add the DOCTYPE declaration. <h5>Null Values</h5> To specify a null value, you simply have to omit its corresponding attribute. In the above example, COLUMN1 and COLUMN2 are nulls for the second row of TEST_TABLE. <h5>Table metadata</h5> DbUnit use the DTD referenced by the document type declaration as metadata. DbUnit only support external system URI. The URI can be absolute or relative. <p> Example of system document type declaration: <pre><!DOCTYPE dataset SYSTEM "my-dataset.dtd"></pre> </p><p>If the xml document does not contain a document type declaration, the metadata is generated from the first row of each table. This is highly recommended to always provide a document type declaration since DbUnit will think your table is missing some columns if the first row has one or more null values. </p><h4><a name="DatabaseDataSet">DatabaseDataSet</a></h4> The <a class="code">DatabaseDataSet</a> is an adapter class that allows access to a database contents as a dataset. This class is not usually instantiated directly but from the factory method <a class="code">IDatabaseConnection.createDataSet()</a>.<br></br> <h4><a name="DefaultDataSet">DefaultDataSet</a></h4> The <a class="code">DefaultDataSet</a> class can be used to create datasets programmatically. <br></br> <h4><a name="CompositeDataSet">CompositeDataSet</a></h4> The <a class="code">CompositeDataSet</a> class combines multiple datasets into a single one at runtime.<br></br> <h4><a name="FilteredDataSet">FilteredDataSet</a></h4> The <a class="code">FileteredDataSet</a> class is is a decorator which exposes only some tables from the decorated dataset. <br></br> <h4><a name="QueryDataSet">QueryDataSet</a></h4> The <a class="code">QueryDataSet</a> allows to easily manipulates multiple <a href="./api/org/dbunit/database/IDatabaseConnection.html#createQueryTable(java.lang.String,%20java.lang.String)">query tables</a>.<br></br> <hr></hr> <h3><a name="databaseconnection">IDatabaseConnection</a></h3> <p>As its name implies, the <a class="code">IDatabaseConnection</a> represent a connection to a database. </p> <p>The DbUnit framework provides two implementations: </p> <ul> <li><a class="code">DatabaseConnection</a>, which is a JDBC Connection adapter.</li> <li><a class="code">DatabaseDataSourceConnection</a>, which is a JDBC DataSource adapter.<br></br> </li> </ul> <hr></hr> <h3><a name="databaseoperation">DatabaseOperation</a></h3> <p>The <a class="code">DatabaseOperation</a> abstract class defines operations performed on a target database before and after each test. Again, the framework provides several implementations. <br></br> </p> <ul> <li><a href="#update">UPDATE</a></li> <li><a href="#insert">INSERT</a></li> <li><a href="#delete">DELETE</a></li> <li><a href="#deleteall">DELETE_ALL</a></li> <li><a href="#refresh">REFRESH</a></li> <li><a href="#cleaninsert">CLEAN_INSERT</a></li> <li><a href="#none">NONE</a></li> <li><a href="#CompositeOperation">CompositeOperation</a></li> <li><a href="#TransactionOperation">TransactionOperation</a></li> <li><a href="#IdentityInsertOperation">IdentityInsertOperation</a> </li> </ul> <p>The two most usefull operations are <a href="#refresh">REFRESH</a> and <a href="#cleanInsert">CLEAN_INSERT</a>. As you will shortly see, they are the ones you will deal with most of the time. They represent two opposite testing strategies with different benefits and tradeoffs. </p> <p>The <a class="code">DatabaseOperation</a> class declaration: </p> <pre> public abstract class DatabaseOperation { public static final IDatabaseOperation NONE = new DummyAction(); public static final IDatabaseOperation UPDATE = new UpdateOperation(); public static final IDatabaseOperation INSERT = new InsertOperation(); public static final IDatabaseOperation REFRESH = new RefreshOperation(); public static final IDatabaseOperation DELETE = new DeleteOperation(); public static final IDatabaseOperation DELETE_ALL = new DeleteAllOperation(); public static final IDatabaseOperation CLEAN_INSERT = new CompositeOperation(DELETE_ALL, INSERT); /**<br></br> * Executes this operation on the specified database using the specified<br></br> * dataset contents.<br></br> *<br></br> * @param connection the database connection.<br></br> * @param dataSet the dataset to be used by this operation.<br></br> */<br></br> public abstract void execute(IDatabaseConnection connection, IDataSet dataSet) throws DatabaseUnitException, SQLException; private static class DummyAction extends DatabaseOperation { public void execute(IDatabaseConnection connection, IDataSet dataSet) { } } }</pre> <h4><a name="update">DatabaseOperation</a>.UPDATE</h4> 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.<br></br> <br></br> <h4><a name="insert">DatabaseOperation.INSERT</a></h4> 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. <br></br> <h4><a name="delete">DatabaseOperation.DELETE</a></h4> 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. <br></br> <h4><a name="deleteall">DatabaseOperation.DELETE_ALL</a></h4> This operation deletes entire target database table contents for each table contained in dataset. In other words, if a dataset does not contain a particular table, but that table exists in the database, the contents of that table is not deleted. Deletes are performed on table in reverse sequence.<br></br> <h4><a name="refresh">DatabaseOperation.REFRESH</a></h4> 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></br> <br></br> As you understand, this is a very powerful operation. This strategy can help you deal more easily with foreign key constraints, as you don't necessarily need to insert data in a specific sequence. <br></br> <br></br> If they are correctly written, tests using this strategy can even be performed on a populated database like a copy of a production database. <br></br> <h4><a name="cleaninsert">DatabaseOperation.CLEAN_INSERT</a></h4> This composite operation performs a DELETE_ALL operation followed by an INSERT 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.<br></br> <h4><a name="none">DatabaseOperation.NONE</a></h4> This operation does absolutely nothing with the target database.<br></br> <h4><a name="CompositeOperation">CompositeOperation</a></h4> This operation combines multiple operations into a single one.<br></br> <h4><a name="TransactionOperation">TransactionOperation</a></h4> <p>This operation decorates an operation and executes it within the context of a transaction.</p> <h4><a name="IdentityInsertOperation">IdentityInsertOperation<a></a></a></h4> <p>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.</p> </section></body></document> --- NEW FILE: intro.xml --- <?xml version="1.0" encoding="ISO-8859-1"?> <document><properties><title>The Dbunit Framework - Home</title></properties><body><section> <h2>Introduction</h2> <p>Richard Dallaway notes about database unit testing inspired me the realization of the DbUnit framework. I think this is a very good text about this subject. Hopefully he gave me the permission to present excerpts from his notes here on the DbUnit site.</p> <p>The original text is much longer and I strongly suggest you to read it as well. See <a href="resources.html#RichardDallaway">resources</a> for reference to it.<br></br> </p> <hr></hr> <p> </p><h3>Unit testing database code</h3> <p>These are my notes on how I've gone about unit testing database functionality.</p> <p> [...]</p> <p>The problem is this: you have a SQL database, some stored procedures, and a layer of code sitting between your application and the database. How can you put tests in place to make sure your code really is reading and writing the right data from the database? </p> <p> </p><h3>Why bother?</h3> <p>I'm guessing some, if not a lot, of database development goes like this: set up database, write code to access database, run code, do a SELECT to see if the records showed up in the database. They did? Good, then we're done. </p> <p>The problem with <strong>visual inspection</strong> is this: you don't do it often, and you don't check everything every time. It's possible that when you make changes to a system, maybe months later, you break something and some data will go missing. As a coder you may not spend much time checking the data itself, so it may take a while for this mistake to surface. I've worked on a web project where a mandatory field on a registration form was not being inserted into a database for the best part of a year. Although marketing had protested that they needed this information, the problem wasn't spotted because the data was never ever looked at it (but don't get me started on that). </p> <p>Automated tests painless tests that run often and test lots reduce the chances of your data is going missing. I find they make it easier for me to sleep at night. (Tests have other positive features: they're good examples of how to use code, they act as documentation, they make other people's code less scary when you need to change it, they reduce debugging time). </p><p>[...] </p><p>[B]ut how do we manage the testing data in the database so that it doesn't "mess up" live data? </p><p> </p><p> </p><h3>You need four databases</h3> <p>Some thoughts: A good test set is self-sufficient and creates all the data it needs. Testing can be simplified if you can get the database in a known state before a test is run. One ways to do this is to have a separate unit test database, which is under the control of the test cases: the test cases clean out the database before starting any tests.<br></br> <br></br> [...]<br></br> <br></br> Deleting and inserting data for every test may seem like a big time over head, but as tests use relatively little data, I find this approach to be quick enough (especially if you're running against a local test database).<br></br> <br></br> [...]<br></br> <br></br> The downside is that you need more than one database - but remember, they can all run on one server if necessary. The way I'm testing now needs four databases (well, two at a pinch): <br></br> <ol> <li>The <strong>production database</strong>. Live data. No testing on this database. </li> <li>Your <strong>local development database</strong>, which is where most of the testing is carried out. </li> <li>A <strong>populated development database</strong>, possibly shared by all developers so you can run your application and see it work with realistic amounts of data, rather than the hand full of records you have in your test database. You may not strictly need this, but it's reassuring to see your app work with lots of data (i.e., a copy of the production database's data). </li> <li>A <strong>deployment databas</strong>e, or integration database, where the tests are run prior to deployment to make sure any local database changes have been applied. If you're working alone, you may be able to live without this one, but you'll have to be sure any database structure or stored procedure changes have been made to the production database before you go live with your code. </li> </ol> With multiple database you have to make sure you keep the structure of the databases in sync: if you change a table definition or a stored procedure on your test machine, you'll have to remember to make those changes on the live server. The deployment database should act as a reminder to make those changes." </p> </section></body></document> --- NEW FILE: faq.fml --- <?xml version="1.0" encoding="UTF-8"?> <faqs title="Frequently Asked Questions"> <part id="general"> <title>General</title> <faq id="whats-foo"> <question> Which database system are supported? </question> <answer> The Dbunit framework has been developed and tested with Oracle and HypersonicSQL. It uses a fairly simple SQL syntax and should be compatible with the other database systems. <a href="support.html">Let us know</a> if you find any incompatibilities. </answer> </faq> <faq id="whats-bar"> <question> Can I use DbUnit with IDENTITY or auto-increment columns? </question> <answer> <p>Auto-increment columns must be disabled in order to insert the dataset values into the database. The way to disable this feature is database specific. If your database does not provide a way to disable this feature then you are out of luck and DbUnit cannot be used with it. </p> <p>Since version 1.4, DbUnit support IDENTITY columns for MS SQL Server with the class <a href="components.html#IdentityInsertOperation">IdentityInsertOperation</a>. <br></br> </p> </answer> </faq> <faq id="clonedconnection"> <question> Why I get a "Can't start a cloned connection" exception when I use InsertIdentityOperation? </question> <answer> <p>If you are using the Microsoft driver (i.e. <a class="code">com.microsoft.jdbc.sqlserver.SQLServerDriver</a>), you'll need to use the <a class="code">SelectMethod=cursor</a> parameter in the JDBC connection string (as outlined by <a href="http://forum.java.sun.com/thread.jsp?forum=48&thread=184797">this JDC thread</a>). Your database Url would look something like the following: </p> <p> <pre>jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=mydb;SelectMethod=cursor </pre> </p> </answer> </faq> <faq id="UnsatisfiedLinkError"> <question> Why I get an "UnsatisfiedLinkError" with the DB2 driver? </question> <answer> <p>DbUnit uses JDBC 2.0 features (batch updates). By default, DB2 installs the JDBC 1.0 driver. You have to install the JDBC 2.0 driver in order for DbUnit to work or you will get an <a class="code">UnsatisfiedLinkError</a> from the DB2 JDBC 1.0 driver.</p> <p>The steps for installing the DB2 JDBC 2.0 driver are covered in the DB2 documentation.</p> </answer> </faq> <faq id="AmbiguousTableNameException"> <question> Why I get a AmbiguousTableNameException? </question> <answer> <p>This situation occurs when no schema is specified and that DbUnit detect that it is getting columns information from multiple tables having the same name and located in different schemas.</p> <p>You can solve this problem in three different ways:<br></br> 1. Provide the schema name when creating the database connection.<br></br> 2. Ensure that the connection is restricted to access only one schema.<br></br> 3. Use fully qualified table names as specified <a href="howto.html#multipleschema">here</a>.<br></br> </p> </answer> </faq> <faq id="flatxmlnull"> <question> How to specify NULL values with flat XML dataset </question> <answer> <p>See FlatXmlDataSet documentation <a href="components.html#FlatXmlDataSet">here</a>.</p> </answer> </faq> <faq id="p6spy"> <question> How to use DbUnit with p6spy </question> <answer> <p><cite>p6spy</cite> is a trasparent JDBC proxy-driver specialized to log the statements performed against the actual driver you normally would use. Using p6spy would allow to log the SQL statements issued by DbUnit. See more at (<a href="http://www.p6spy.com">www.p6spy.com</a>). It could be useful to stick with version 1.1 as 1.2 as some reported minor problems.</p> <p>To install P6Spy, complete the following steps: <ol> <li>Put the p6spy.jar file in your classpath. </li><li>Move spy.properties into a directory listed in your classpath. Unlike JAR files, you do not directly reference your property file in the classpath (e.g.: if you have the file c:\r\proj\confspy.properties make sure you put c:\r\proj\conf in the classpath). </li><li>Modify your application to use the P6Spy database driver i.e. com.p6spy.engine.spy.P6SpyDriver. </li><li>Modify the realdriver line in the spy.properties file to reflect the wrapped database driver. An example of a modified realdriver line follows: realdriver = oracle.jdbc.driver.OracleDriver </li></ol> Installation is complete. When you run your application, a spy.log file is generated in the same directory from where you run the application. The log file contains a list of all of the database statements executed. You can change both the destination of spy.log and what it logs by editing the spy.properties file.</p> </answer> </faq> </part> <part id="install"> <title>Installation</title> <faq id="how-install"> <question> How do I install Foo? </question> <answer> <p>some markup goes here</p> </answer> </faq> </part> </faqs> --- NEW FILE: support.xml --- <?xml version="1.0" encoding="ISO-8859-1"?> <document><properties><title>The Dbunit Framework - Contact</title></properties><body><section> <h2>Support Information</h2> <h3>Product Support</h3> <p>If you have questions or comments about the software or documentation on this site, please post them to the mailling list: </p><p><a href="http://lists.sourceforge.net/lists/listinfo/dbunit-user">Mailling List</a> </p><h3><a name="knownissues">Known Issues</a></h3> <a href="https://sourceforge.net/tracker/?atid=449491&group_id=47439&func=browse">Bug database</a></section></body></document> --- NEW FILE: anttask.xml --- <?xml version="1.0" encoding="ISO-8859-1"?> <document><properties><title>The Dbunit Framework - Ant Task</title></properties><body><section> <h2>Ant Integration</h2> <h3>Installation</h3> The steps required to add the DbUnit task to your system are: <ol> <li>Add the DbUnit jar to Ant's classpath. </li> <li>Add a <taskdef> element to your build script as follows: <pre class="code"><taskdef name="dbunit" classname="org.dbunit.ant.DbUnitTask"/></pre> </li> <li>Use the task in the rest of the buildfile. </li> </ol> <h3>Usage </h3> <p>Executes either a single transaction, or a group of transactions, under the DbUnit database testing framework.</p> <h4>Parameters</h4> <table border="1"> <tr> <td><b>Attribute</b></td> <td><b>Description</b></td> <td><b>Required</b></td> </tr> <tr> <td>driver</td> <td>Class name of the jdbc driver</td> <td>Yes</td> </tr> <tr> <td>url</td> <td>Database connection url</td> <td>Yes</td> </tr> <tr> <td>userid</td> <td>Database username</td> <td>Yes</td> </tr> <tr> <td>password</td> <td>Database password</td> <td>Yes</td> </tr> <tr> <td>schema </td> <td>Database schema</td> <td>No</td> </tr> <tr> <td>classpath</td> <td>Classpath used to load driver</td> <td>No (use system classpath)</td> </tr> <tr> <td>useQualifiedTableNames</td> <td>Set System.property dbunit.qualified.table.names <br></br> equal to supplied boolean value</td> <td>No</td> </tr> <tr> <td>supportBatchStatement</td> <td>Set System.property<br></br> dbunit.support.batch.statement<br></br> equal to supplied boolean value</td> <td> No</td> </tr> </table> <h4>Parameters specified as nested elements</h4> <table cellspadding="0" border="1"> <tr> <td>classpath</td> <td> <p>DbUnit's classpath attribute is a PATH like structure and can also be set via a nested classpath element. It is used to load the JDBC classes.</p> </td> </tr> <tr> <td>operation</td> <td> <p>Use nested <operation> elements to specify which DbUnit operation to perform on the particular file. <br></br> </p> <table border="1"> <tr> <td><b>Attribute</b></td> <td><b>Description</b></td> <td><b>Required</b></td> </tr> <tr> <td>type</td> <td>Type of Database operation to perform. Supported types are<br></br> UPDATE, INSERT, DELETE, <br></br> DELETE_ALL, REFRESH, <br></br> CLEAN_INSERT, MSSQL_INSERT,<br></br> MSSQL_REFRESH, MSSQL_CLEAN_INSERT.</td> <td>Yes</td> </tr> <tr> <td>src</td> <td>The xml source upon which the operation is to be performed</td> <td>Yes</td> </tr> <tr> <td>format</td> <td>Format type of supplied source file. Possible values are "flat" or "xml". Defaults to <a class="code">"flat"</a></td> <td> <p>No</p> </td> </tr> </table> </td> </tr> <!-- <tr> <td>composite</td> <td> <p>Use nested <a class="code"><composite></a> operation elements to combine multiple <a class="code"><operation></a>s (on the same file) into a single one.</p> <table border="1"> <tr> <td><b>Attribute</b></td> <td><b>Description</b></td> <td><b>Required</b></td> </tr> <tr> <td>src</td> <td>The xml source upon which the operation is to be performed</td> <td>Yes</td> </tr> <tr> <td>flat</td> <td>If true, use <a class="code">FlatXmlDataSet</a> type in the supplied src file. Otherwise use <a class="code">XmlDataSet</a>. Defaults to <a class="code">true</a></td> <td> <p>No</p> </td> </tr> </table> <h4>Parameters specified as nested elements </h4> <table border="1"> <tr> <td>operation</td> <td>See above definition for details. The src and flat attributes are supplied as attributes to the <a class="code"><composite></a> step and should not be attempted to be overridden by the nested <a class="code"><operation></a> step.</td> </tr> </table> </td> </tr> --> <tr> <td>export</td> <td> <p>Use nested <a class="code"><export></a> operation elements to export the database to the supplied filename. The default operation is to <a class="code"><export></a> the entire database to the destination filename with the supplied dataset type. You can specify individual tables or queries to<br></br> <a class="code"><export></a> by nesting them under the <export> step.</p> <table width="100%" border="1"> <tr> <td><b>Attribute</b></td> <td><b>Description</b></td> <td><b>Required</b></td> </tr> <tr> <td>dest</td> <td>The xml destination filename</td> <td>Yes</td> </tr> <tr> <td>format</td> <td>Format type of supplied destination file. Possible values are "flat", "xml" or "dtd". Defaults to <a class="code">"flat"</a></td> <td> <p>No</p> </td> </tr> </table> <h4>Parameters specified as nested elements </h4> <table border="1"> <tr> <td>table</td> <td> <p>Use nested <a class="code"><table></a> elements to <a class="code"><export></a> specific tables. </p> <table border="1"> <tr> <td><b>Attribute</b></td> <td><b>Description</b></td> <td><b>Required</b></td> </tr> <tr> <td>name</td> <td>Name of the database table to export.</td> <td>Yes</td> </tr> </table> </td> </tr> <tr> <td>query</td> <td> <p>Use nested <a class="code"><query></a> elements to <a class="code"><export></a> data according to a sql statement. </p> <table border="1"> <tr> <td><b>Attribute</b></td> <td><b>Description</b></td> <td><b>Required</b></td> </tr> <tr> <td>name</td> <td>Name to reference the sql statement.</td> <td>Yes</td> </tr> <tr> <td>sql</td> <td>The sql to execute. You can use either SELECT * from Mytable or SELECT col1, col4 from MyTable</td> <td>Yes</td> </tr> </table> </td> </tr> </table> </td> </tr> </table> <h3>Examples</h3> <pre> <dbunit driver="org.hsqldb.jdbcDriver"<br></br> url="jdbc:hsqldb:."<br></br> userid="sa"<br></br> password=""> <classpath><br></br> <pathelement location="/some/jdbc.jar"/><br></br> </classpath><br></br> <operation type="UPDATE" src="updateFile.xml"/><br></br> </dbunit></pre> <p> Connects to the database given in url as the dbunit user using the org.hsqldb.jdbcDriver, searching it from /some/jdbc.jar as well from the system classpath, and executes the UPDATE operation contained within the FlatXmlDataSet file updateFile.xml.</p> <pre> <dbunit driver="org.hsqldb.jdbcDriver"<br></br> url="jdbc:hsqldb:."<br></br> userid="sa"<br></br> password=""><br></br> <operation type="INSERT" src="insertFile.xml"/><br></br> <operation type="UPDATE" src="updateFile.xml"/><br></br> </dbunit></pre> <p> Connects to the database given in url as the dbunit user using the org.hsqldb.jdbcDriver. It then executes the INSERT operation contained within the FlatXmlDataSet file insertFile.xml <br></br> followed by the execution of the UPDATE operation contained within the FlatXmlDataSet file updateFile.xml.</p> <pre> <dbunit driver="org.hsqldb.jdbcDriver"<br></br> url="jdbc:hsqldb:."<br></br> userid="sa"<br></br> password=""><br></br> <operation type="UPDATE" src="updateFile.xml" flat="false"/><br></br> </dbunit></pre> <p> Connects to the database given in url as the dbunit user using the org.hsqldb.jdbcDriver and executes the UPDATE operation contained within the XmlDataSet file updateFile.xml.</p> <!-- <pre> <dbunit driver="org.hsqldb.jdbcDriver"<br> url="jdbc:hsqldb:."<br> userid="sa"<br> password=""><br> <composite src="compositeFile.xml"><br> <operation type="DELETE"/><br> <operation type="INSERT"/><br> </composite><br> </dbunit></pre> <p> Connects to the database given in url as the dbunit user using the org.hsqldb.jdbcDriver. It then executes the CompositeOperation, DELETE and then UPDATE, contained within the FlatXmlDataSet file updateFile.xml.</p> <pre> <dbunit driver="org.hsqldb.jdbcDriver"<br> url="jdbc:hsqldb:."<br> userid="sa"<br> password=""><br> <composite src="compositeFile.xml" flat="false"><br> <operation type="INSERT"/><br> <operation type="UPDATE"/><br> </composite><br> </dbunit></pre> <p> Connects to the database given in url as the dbunit user using the org.hsqldb.jdbcDriver. It then executes the CompositeOperation, DELETE and then UPDATE, contained within the XmlDataSet file updateFile.xml.</p> --> <pre> <dbunit driver="org.hsqldb.jdbcDriver"<br></br> url="jdbc:hsqldb:."<br></br> userid="sa"<br></br> password=""><br></br> <export dest="exportFile.xml"/><br></br> </dbunit></pre> <p> Connects to the database given in url as the dbunit user using the org.hsqldb.jdbcDriver and exports the database to the given destination file as a FlatXmlDataSet. </p> <pre> <dbunit driver="org.hsqldb.jdbcDriver"<br></br> url="jdbc:hsqldb:."<br></br> userid="sa"<br></br> password=""><br></br> <export dest="exportNonFlatFile.xml" format="xml"/><br></br> </dbunit></pre> <p> Connects to the database given in url as the dbunit user using the org.hsqldb.jdbcDriver and exports the database to the given destination file as an XmlDataSet. </p> <pre> <dbunit driver="org.hsqldb.jdbcDriver"<br></br> url="jdbc:hsqldb:."<br></br> userid="sa"<br></br> password=""><br></br> <export dest="export.dtd" format="dtd"/><br></br> </dbunit></pre> <p> Connects to the database given in url as the dbunit user using the org.hsqldb.jdbcDriver and <br></br> exports the document type definition (dtd) describing the flat xml format.</p> <pre> <dbunit driver="org.hsqldb.jdbcDriver"<br></br> url="jdbc:hsqldb:."<br></br> userid="sa"<br></br> password=""><br></br> <export dest="exportFile.xml"><br></br> <table name="FOO"/><br></br> <table name="BAR"/><br></br> </export><br></br> </dbunit></pre> <p> Connects to the database given in url as the dbunit user using the org.hsqldb.jdbcDriver and exports the contents of the provided tables to the given destination file as an FlatXmlDataSet. <br></br> </p> <pre> <dbunit driver="org.hsqldb.jdbcDriver"<br></br> url="jdbc:hsqldb:."<br></br> userid="sa"<br></br> password=""><br></br> <export dest="exportFile.xml"><br></br> <table name="FOO"/><br></br> <query name="BAR" sql="SELECT COL1, COL2, COL3 as 'COLSPECIAL' FROM BAR WHERE COL1=4"/><br></br> </export><br></br> </dbunit></pre> <p> Connects to the database given in url as the dbunit user using the org.hsqldb.jdbcDriver and exports the contents of the provided tables to the given destination file as an FlatXmlDataSet. The contents of the BAR table are only shown where col1 is equal to 4. Col3 is renamed COLSPECIAL as well. <br></br> </p> </section></body></document> --- NEW FILE: navigation.xml --- <?xml version="1.0" encoding="ISO-8859-1"?> <project name="DbUnit"> <title>DbUnit</title> <body> <links> <item name="SF" href="http://www.sf.net/"/> </links> <menu name="Docs"> <item name="Intro" href="/intro.html"/> <item name="Ant Task" href="/anttask.html"/> <item name="Best Practices" href="/bestpractices.html"/> <item name="Components" href="/components.html"/> <item name="Download" href="/download.html"/> <item name="FAQ" href="/faq.html"/> <item name="Howto" href="/howto.html"/> <item name="Properties" href="/properties.html"/> <item name="Resources" href="/resources.html"/> <item name="Support" href="/support.html"/> </menu> </body> </project> --- NEW FILE: properties.xml --- <?xml version="1.0" encoding="ISO-8859-1"?> <document><properties><title>The Dbunit Framework - Properties</title></properties><body><section> <p>DbUnit does use System properties anymore since version 1.6/2.0. DbUnit use a configuration object, <a class="code">DatabaseConfig</a>, to query and set feature flags and property values for a <a class="code">IDatabaseConnection</a>. It is possible to change DbUnit behaviors, such as using batched statements or not, using the <a class="code">getFeature</a>, <a class="code">setFeature</a>, <a class="code">getProperty</a>, and <a class="code">setProperty</a> methods of <a class="code">DatabaseConfig</a>: </p> <pre> String id = "http://www.dbunit.org/features/batchedStatements"; DatabaseConfig config = connection.getConfig(); if (config.getFeature(id)) { System.out.println("Batched statements is enabled."); } else { System.out.println("Batched statements is disabled."); } </pre> While feature flags are always boolean, property values are arbitrary objects. <br></br> Here is the complete list of standard DbUnit feature flags and properties. <br></br> <h2>Feature Flags</h2> <table border="1"> <tr> <td>Feature ID</td> <td>http://www.dbunit.org/features/batchedStatements</td> </tr> <tr> <td>Default</td> <td>false</td> </tr> <tr> <td>Description</td> <td>Enable or disable multiple schemas support. If enabled, Dbunit access tables with names fully qualified by schema using this format: SCHEMA.TABLE. Also see <a href="howto.html#multipleschema">how to import/export with multiple schema</a>. </td> </tr> </table> <p> <a name="qualifiedtablenames"></a> <table border="1"> <tr> <td>Feature ID</td> <td>http://www.dbunit.org/features/qualifiedTableNames</td> </tr> <tr> <td>Default</td> <td>false (since 1.5.5)</td> </tr> <tr> <td>Description</td> <td>Enable or disable usage of JDBC batched statement by DbUnit. </td> </tr> <tr> <td>Note</td> <td>This feature is not compatible with the <a href="#escapepattern">escape pattern</a> property.</td> </tr> </table> </p><h2>Properties</h2> <p> <a name="escapepattern"></a> <table border="1"> <tr> <td>Property ID</td> <td>http://www.dbunit.org/properties/escapePattern</td> </tr> <tr> <td>Default</td> <td><i>none</i></td> </tr> <tr> <td>Description</td> <td>Allows schema, table and column names escaping. The property value is an escape pattern where the ? is replaced by the name. For example, the pattern "[?]" is expanded as "[MY_TABLE]" for a table named "MY_TABLE". </td> </tr> <tr> <td>Note</td> <td>This property is not compatible with the <a href="#qualifiedtablenames">qualified table names</a> feature.</td> </tr> </table> </p><p> <table border="1"> <tr> <td>Property ID</td> <td>http://www.dbunit.org/properties/datatypeFactory</td> </tr> <tr> <td>Default</td> <td>org.dbunit.dataset.datatype.DefaultDataTypeFactory</td> </tr> <tr> <td>Description</td> <td>Used to configure the DataType factory. You can replace the default factory to add support for non-standard database vendor data types. The Object must implement <a href="api/org/dbunit/dataset/datatype/IDataTypeFactory.html">org.dbunit.dataset.datatype.IDataTypeFactory</a>.</td> </tr> </table> </p><p> <table border="1"> <tr> <td>Property ID</td> <td>http://www.dbunit.org/properties/statementFactory</td> </tr> <tr> <td>Default</td> <td>org.dbunit.database.statement.PreparedStatementFactory</td> </tr> <tr> <td>Description</td> <td>Used to configure the statement factory. The Object must implement org.dbunit.database.statement.IStatementFactory.</td> </tr> </table> </p> <table border="1"> <tr> <td>Property ID</td> <td>http://www.dbunit.org/properties/resultSetTableFactory</td> </tr> <tr> <td>Default</td> <td>org.dbunit.database.CachedResultSetTableFactory</td> </tr> <tr> <td>Description</td> <td>Used to configure the ResultSet table factory. The Object must implement org.dbunit.database.IResultSetTableFactory.</td> </tr> </table> </section></body></document> --- NEW FILE: resources.xml --- <?xml version="1.0" encoding="ISO-8859-1"?> <document><properties><title>The Dbunit Framework - Ressources</title></properties><body><section> <h2>Project Ressources</h2> <p><a href="http://sourceforge.net/projects/dbunit/">Project summary</a></p> <p><a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/dbunit/">Browse CVS repository</a></p> <p> </p><h2>Other Ressources</h2> <p></p> <p><a href="http://groups.yahoo.com/group/agileDatabases/">The Agile Database Mailing List</a> <font color="#FF0000">(new)</font><br></br> Discussion about Database management with regards to Extreme Programming practices and principles.</p> <p><a href="http://www.agiledata.org/">The Agile Data Home Page</a> <font color="#FF0000">(new)</font><br></br> Scott W. Ambler's site about Agile Data methodology. Ambler is sharing multiple techniques about data-related software development issues. Online material is going to be published in its new book titled "Agile Database Techniques".<br></br> <br></br> <a href="http://www.martinfowler.com/articles/evodb.html">Evolutionary Database Design</a> <font color="#FF0000">(new)</font><br></br> A Martin Fowler's white paper that describes techniques that allows a database design to evolve as an application develops<br></br> </p> <p><a href="http://webtest.canoo.com/">Canoo Webtest Home</a><br></br> Canoo WebTest is a free open source tool for automated testing of web applications. </p> <p><a href="http://www.junit.org">JUnit, Testing Resources for Extreme Programming</a><br></br> The home of the Java JUnit software.<br></br> <br></br> <a name="RichardDallaway" href="http://www.dallaway.com/acad/dbunit.html">Unit testing database code</a><br></br> Richard Dallaway notes about database unit testing.</p> <p><a href="http://mockobjects.sourceforge.net/papers/jdbc_testfirst.html">Developing JDBC applications test-first</a><br></br> The Mock Objects approach applied to JDBC development.<br></br> </p> </section></body></document> --- NEW FILE: download.xml --- <?xml version="1.0" encoding="ISO-8859-1"?> <document><properties><title>The Dbunit Framework - Download</title></properties><body><section> <h2>Download</h2> <p>The current Dbunit release is version 1.5.1. The distribution archive contains the compiled classes, the java code and the java API documentation.</p> <p><a href="http://sourceforge.net/project/showfiles.php?group_id=47439&release_id=150554">Download version 1.5.1</a></p> <p>If your are not reading this page online, please visit the <a href="http://www.dbunit.org/">online version</a> of this site since a more recent version of Dbunit might be available.</p> </section></body></document> --- NEW FILE: howto.xml --- <?xml version="1.0" encoding="ISO-8859-1"?> <document><properties><title>The Dbunit Framework - Howto Guides</title></properties><body><section> <h2>How-to Guides</h2> <ul> <li><a href="#createtest">How to create a test case to setup your database</a></li> <li><a href="#noextend">How to setup your database in a test case that does not extend DatabaseTestCase</a></li> <li><a href="#extract">How to export a dataset from your database</a></li> <li><a href="#generatedtd">How to generate a DTD representing your database schema</a></li> <li><a href="#assertdata">How to verify that your database contains expected data</a> <font color="#FF0000">(updated)</font></li> <li><a href="#multipleschema">How to export data from or import data to multiple database schemas</a></li> <li><a href="#canoo">How to Use DbUnit with Canoo WebTest </a> <font color="#FF0000">(new)</font></li> </ul> <hr></hr> <a name="createtest"> <h2>How to create a test case to setup your database</h2> </a> To write a test case, please follow the steps described below.<br></br> <br></br> <h4>Step 1: Create your dataset file</h4> Your test will obviously need some data to work with. This means you must create a dataset. In most situations you will work with xml datasets. You can manually create an xml dataset from scratch or create one by exporting some data from your database (see <a href="#extract">how-to export</a>).<br></br> <br></br> <h4>Step 2: Extend the DatabaseTestCase class</h4> Now you need to create a test class. The easiest way to use Dbunit is to make your test class extend the DatabaseTestCase class. DatabaseTestCase extends the JUnit TestCase class. Two template methods are required to be implemented: <a class="code">getConnection()</a> to return a connection to your database and <a class="code">getDataSet()</a> to return the dataset you created in step 1.<br></br> <br></br> Following is a sample implementation that returns a connection to a Hypersonic database and an xml dataset:<br></br> <pre> public class SampleTest extends DatabaseTestCase { public SampleTest(String name) { super(name); } protected IDatabaseConnection getConnection() throws Exception { Class driverClass = Class.forName("org.hsqldb.jdbcDriver"); Connection jdbcConnection = DriverManager.getConnection( "jdbc:hsqldb:sample", "sa", ""); return new DatabaseConnection(jdbcConnection); } protected IDataSet getDataSet() throws Exception { return new FlatXmlDataSet(new FileInputStream("dataset.xml")); } }</pre> <br></br> <h4>Step 3: (Optional) Implement getSetUpOperation() and getTearDownOperation() methods</h4> <p>By default, Dbunit performs a <a href="components.html#cleanInsert">CLEAN_INSERT</a> operation before executing each test and performs no cleanup operation afterward. You can modify this behavior by overriding <a class="code">getSetUpOperation()</a> and <a class="code">getTearDownOperation()</a>.</p> <p>The following example demonstrates how you can easily override the operation executed before or after your test.<br></br> </p> <pre> public class SampleTest extends DatabaseTestCase { ... protected DatabaseOperation getSetUpOperation() throws Exception { return DatabaseOperation.REFRESH; } protected DatabaseOperation getTearDownOperation() throws Exception { return DatabaseOperation.NONE; } ... }</pre> <h4>Step 4: Implement your testXXX() methods</h4> Implement your test methods as you normally would with JUnit. Your database is now initialized before and cleaned-up after each test methods according to what you did in previous steps.<br></br> <br></br> <a name="noextend"> <h2>How to setup your database in a test case that does not extend DatabaseTestCase</h2> </a> In order to use Dbunit you are not required to extend the DatabaseTestCase class. Simply override the standard JUnit setUp() method and execute the desired operation on your database. Do something similar in teardown() if you need to perform any clean-up.<br></br> <br></br> For example:<br></br> <pre> public class SampleTest extends TestCase { public SampleTest(String name) { super(name); } protected void setUp() throws Exception { super.setUp(); // initialize your database connection here IDatabaseConnection connection = null; // ... // initialize your dataset here IDataSet dataSet = null; // ... try { DatabaseOperation.CLEAN_INSERT.execute(connection, dataSet); } finally { connection.close(); } } ... }</pre> <a name="extract"> <h2>How to export a dataset from your database</h2> </a> Since version 1.2, the <a href="components.html#FlatXmlDataSet">flat XML dataset</a> format is the prefered way to persist a dataset in XML. The following sample demonstrates how you can export one or many tables from a database to an flat XML dataset file.<br></br> <pre> public class DatabaseExportSample { public static void main(String[] args) throws Exception { // database connection Class driverClass = Class.forName("org.hsqldb.jdbcDriver"); Connection jdbcConnectio... [truncated message content] |
From: <de...@us...> - 2003-08-13 08:52:31
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit In directory sc8-pr-cvs1:/tmp/cvs-serv21985/src/test/org/dbunit Modified Files: AllTests.java Log Message: Fix suggested by eclipse. Index: AllTests.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/AllTests.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** AllTests.java 13 Feb 2003 04:32:42 -0000 1.10 --- AllTests.java 13 Aug 2003 08:52:29 -0000 1.11 *************** *** 46,50 **** public static void main(String args[]) throws Exception { ! new junit.textui.TestRunner().run(suite()); System.exit(0); } --- 46,50 ---- public static void main(String args[]) throws Exception { ! junit.textui.TestRunner.run(suite()); System.exit(0); } |
From: <de...@us...> - 2003-08-13 08:51:55
|
Update of /cvsroot/dbunit/dbunit In directory sc8-pr-cvs1:/tmp/cvs-serv21891 Modified Files: project.xml Log Message: Updated unitTest pom element to run appropriate unit tests only. Removed check style. Index: project.xml =================================================================== RCS file: /cvsroot/dbunit/dbunit/project.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** project.xml 9 Aug 2003 11:43:12 -0000 1.4 --- project.xml 13 Aug 2003 08:51:49 -0000 1.5 *************** *** 138,147 **** <unitTest> <includes> ! <include>**/*Test.java</include> ! <include>**/DbUnitTask*</include> </includes> <excludes> ! <exclude>**/TaskdefsTest*</exclude> ! <exclude>**/Abstract*Test*</exclude> </excludes> </unitTest> --- 138,145 ---- <unitTest> <includes> ! <include>org/dbunit/AllTests.java</include> </includes> <excludes> ! <exclude>**/*Test</exclude> </excludes> </unitTest> *************** *** 159,163 **** --- 157,163 ---- <reports> <report>maven-jdepend-plugin</report> + <!-- <report>maven-checkstyle-plugin</report> + --> <report>maven-changes-plugin</report> <report>maven-changelog-plugin</report> |
From: <mla...@us...> - 2003-08-13 04:38:36
|
Update of /cvsroot/dbunit/dbunit/docs In directory sc8-pr-cvs1:/tmp/cvs-serv20534/docs Modified Files: properties.html Log Message: Made table type configurable. Index: properties.html =================================================================== RCS file: /cvsroot/dbunit/dbunit/docs/properties.html,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** properties.html 1 Aug 2003 02:29:27 -0000 1.4 --- properties.html 13 Aug 2003 04:38:33 -0000 1.5 *************** *** 111,116 **** </tr> <tr> ! <td>Default</td> ! <td><i>none</i></td> </tr> <tr> --- 111,116 ---- </tr> <tr> ! <td>Type</td> ! <td>String</td> </tr> <tr> *************** *** 122,125 **** --- 122,129 ---- </tr> <tr> + <td>Default</td> + <td><i>none</i></td> + </tr> + <tr> <td>Note</td> <td>This property is not compatible with the <a href=#qualifiedtablenames>qualified *************** *** 134,139 **** </tr> <tr> ! <td>Default</td> ! <td>org.dbunit.dataset.datatype.DefaultDataTypeFactory</td> </tr> <tr> --- 138,143 ---- </tr> <tr> ! <td>Type</td> ! <td><a href="api/org/dbunit/dataset/datatype/IDataTypeFactory.html">org.dbunit.dataset.datatype.IDataTypeFactory</a></td> </tr> <tr> *************** *** 141,145 **** <td>Used to configure the DataType factory. You can replace the default factory to add support for non-standard database vendor data types. ! The Object must implement <a href="api/org/dbunit/dataset/datatype/IDataTypeFactory.html">org.dbunit.dataset.datatype.IDataTypeFactory</a>.</td> </tr> </table> --- 145,152 ---- <td>Used to configure the DataType factory. You can replace the default factory to add support for non-standard database vendor data types. ! </tr> ! <tr> ! <td>Default</td> ! <td>org.dbunit.dataset.datatype.DefaultDataTypeFactory</td> </tr> </table> *************** *** 151,161 **** </tr> <tr> ! <td>Default</td> ! <td>org.dbunit.database.statement.PreparedStatementFactory</td> </tr> <tr> <td>Description</td> ! <td>Used to configure the statement factory. The Object must implement ! org.dbunit.database.statement.IStatementFactory.</td> </tr> </table> --- 158,171 ---- </tr> <tr> ! <td>Type</td> ! <td>org.dbunit.database.statement.IStatementFactory</td> </tr> <tr> <td>Description</td> ! <td>Used to configure the statement factory.</td> ! </tr> ! <tr> ! <td>Default</td> ! <td>org.dbunit.database.statement.PreparedStatementFactory</td> </tr> </table> *************** *** 167,177 **** </tr> <tr> <td>Default</td> <td>org.dbunit.database.CachedResultSetTableFactory</td> </tr> <tr> <td>Description</td> ! <td>Used to configure the ResultSet table factory. The Object must implement ! org.dbunit.database.IResultSetTableFactory.</td> </tr> </table> --- 177,211 ---- </tr> <tr> + <td>Type</td> + <td>org.dbunit.database.IResultSetTableFactory</td> + </tr> + <tr> + <td>Description</td> + <td>Used to configure the ResultSet table factory.</td> + </tr> + <tr> <td>Default</td> <td>org.dbunit.database.CachedResultSetTableFactory</td> </tr> + </table> + <p> + <table border="1"> + <tr> + <td>Property ID</td> + <td>http://www.dbunit.org/properties/tableType</td> + </tr> + <tr> + <td>Type</td> + <td>String[]</td> + </tr> <tr> <td>Description</td> ! <td>Used to configure the list of table types recognized by DbUnit. ! See <a href="http://java.sun.com/j2se/1.3/docs/api/java/sql/DatabaseMetaData.html#getTables(java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String%5B%5D)">java.sql.DatabaseMetaData.getTables</a> ! for possible values.</td> ! </tr> ! <tr> ! <td>Default</td> ! <td>String[]{"TABLE"}</td> </tr> </table> |
From: <mla...@us...> - 2003-08-13 04:28:05
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/database In directory sc8-pr-cvs1:/tmp/cvs-serv19322/src/java/org/dbunit/database Modified Files: DatabaseConfig.java DatabaseDataSet.java Log Message: Made table type configurable. Index: DatabaseConfig.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/DatabaseConfig.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DatabaseConfig.java 1 Aug 2003 02:29:11 -0000 1.1 --- DatabaseConfig.java 13 Aug 2003 04:28:02 -0000 1.2 *************** *** 45,48 **** --- 45,50 ---- public static final String PROPERTY_ESCAPE_PATTERN = "http://www.dbunit.org/properties/escapePattern"; + public static final String PROPERTY_TABLE_TYPE = + "http://www.dbunit.org/properties/tableType"; public static final String FEATURE_QUALIFIED_TABLE_NAMES = *************** *** 51,54 **** --- 53,65 ---- "http://www.dbunit.org/features/batchedStatements"; + private static final DefaultDataTypeFactory DEFAULT_DATA_TYPE_FACTORY = + new DefaultDataTypeFactory(); + private static final PreparedStatementFactory PREPARED_STATEMENT_FACTORY = + new PreparedStatementFactory(); + private static final CachedResultSetTableFactory RESULT_SET_TABLE_FACTORY = + new CachedResultSetTableFactory(); + private static final String DEFAULT_ESCAPE_PATTERN = null; + private static final String[] DEFAULT_TABLE_TYPE = {"TABLE"}; + private Set _featuresSet = new HashSet(); private Map _propertyMap = new HashMap(); *************** *** 59,66 **** setFeature(FEATURE_QUALIFIED_TABLE_NAMES, false); ! setProperty(PROPERTY_STATEMENT_FACTORY, new PreparedStatementFactory()); ! setProperty(PROPERTY_RESULTSET_TABLE_FACTORY, new CachedResultSetTableFactory()); ! setProperty(PROPERTY_DATATYPE_FACTORY, new DefaultDataTypeFactory()); ! setProperty(PROPERTY_ESCAPE_PATTERN, null); } --- 70,78 ---- setFeature(FEATURE_QUALIFIED_TABLE_NAMES, false); ! setProperty(PROPERTY_STATEMENT_FACTORY, PREPARED_STATEMENT_FACTORY); ! setProperty(PROPERTY_RESULTSET_TABLE_FACTORY, RESULT_SET_TABLE_FACTORY); ! setProperty(PROPERTY_DATATYPE_FACTORY, DEFAULT_DATA_TYPE_FACTORY); ! setProperty(PROPERTY_ESCAPE_PATTERN, DEFAULT_ESCAPE_PATTERN); ! setProperty(PROPERTY_TABLE_TYPE, DEFAULT_TABLE_TYPE); } Index: DatabaseDataSet.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/DatabaseDataSet.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** DatabaseDataSet.java 1 Aug 2003 02:29:10 -0000 1.24 --- DatabaseDataSet.java 13 Aug 2003 04:28:02 -0000 1.25 *************** *** 48,53 **** public class DatabaseDataSet extends AbstractDataSet { - private static final String[] TABLE_TYPE = {"TABLE"}; - private final IDatabaseConnection _connection; private final Map _tableMap = new HashMap(); --- 48,51 ---- *************** *** 127,134 **** Connection jdbcConnection = _connection.getConnection(); String schema = _connection.getSchema(); DatabaseMetaData databaseMetaData = jdbcConnection.getMetaData(); ResultSet resultSet = databaseMetaData.getTables( ! null, schema, "%", TABLE_TYPE); try --- 125,134 ---- Connection jdbcConnection = _connection.getConnection(); String schema = _connection.getSchema(); + String[] tableType = (String[])_connection.getConfig().getProperty( + DatabaseConfig.PROPERTY_TABLE_TYPE); DatabaseMetaData databaseMetaData = jdbcConnection.getMetaData(); ResultSet resultSet = databaseMetaData.getTables( ! null, schema, "%", tableType); try |
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype In directory sc8-pr-cvs1:/tmp/cvs-serv1115/src/java/org/dbunit/dataset/datatype Modified Files: Tag: branch-1-5 AbstractDataType.java BooleanDataType.java BytesDataType.java DateDataType.java DoubleDataType.java FloatDataType.java IntegerDataType.java LongDataType.java NumberDataType.java StringDataType.java TimeDataType.java TimestampDataType.java UnknownDataType.java Log Message: Merged fix of bug #786543 (NULL fields dumped incorrectly) from Main trunk. Index: AbstractDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/AbstractDataType.java,v retrieving revision 1.5.2.1 retrieving revision 1.5.2.2 diff -C2 -d -r1.5.2.1 -r1.5.2.2 *** AbstractDataType.java 16 Jun 2003 02:09:46 -0000 1.5.2.1 --- AbstractDataType.java 13 Aug 2003 02:03:59 -0000 1.5.2.2 *************** *** 24,29 **** import java.sql.ResultSet; - import java.sql.PreparedStatement; import java.sql.SQLException; /** --- 24,29 ---- import java.sql.ResultSet; import java.sql.SQLException; + import java.sql.PreparedStatement; /** *************** *** 31,35 **** * @version $Revision$ */ ! abstract class AbstractDataType extends DataType { private final String _name; --- 31,35 ---- * @version $Revision$ */ ! public abstract class AbstractDataType extends DataType { private final String _name; *************** *** 49,52 **** --- 49,82 ---- //////////////////////////////////////////////////////////////////////////// // DataType class + + public int compare(Object o1, Object o2) throws TypeCastException + { + try + { + Comparable value1 = (Comparable)typeCast(o1); + Comparable value2 = (Comparable)typeCast(o2); + + if (value1 == null && value2 == null) + { + return 0; + } + + if (value1 == null && value2 != null) + { + return -1; + } + + if (value1 != null && value2 == null) + { + return 1; + } + + return value1.compareTo(value2); + } + catch (ClassCastException e) + { + throw new TypeCastException(e); + } + } public int getSqlType() Index: BooleanDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/BooleanDataType.java,v retrieving revision 1.9.2.1 retrieving revision 1.9.2.2 diff -C2 -d -r1.9.2.1 -r1.9.2.2 *** BooleanDataType.java 16 Jun 2003 02:09:46 -0000 1.9.2.1 --- BooleanDataType.java 13 Aug 2003 02:03:59 -0000 1.9.2.2 *************** *** 79,86 **** } public Object getSqlValue(int column, ResultSet resultSet) throws SQLException, TypeCastException { ! return resultSet.getBoolean(column) ? Boolean.TRUE : Boolean.FALSE; } --- 79,124 ---- } + public int compare(Object o1, Object o2) throws TypeCastException + { + Boolean value1 = (Boolean)typeCast(o1); + Boolean value2 = (Boolean)typeCast(o2); + + if (value1 == null && value2 == null) + { + return 0; + } + + if (value1 == null && value2 != null) + { + return -1; + } + + if (value1 != null && value2 == null) + { + return 1; + } + + if (value1.equals(value2)) + { + return 0; + } + + if (value1.equals(Boolean.FALSE)) + { + return -1; + } + + return 1; + } + public Object getSqlValue(int column, ResultSet resultSet) throws SQLException, TypeCastException { ! boolean value = resultSet.getBoolean(column); ! if (resultSet.wasNull()) ! { ! return null; ! } ! return value ? Boolean.TRUE : Boolean.FALSE; } *************** *** 90,93 **** --- 128,132 ---- statement.setBoolean(column, ((Boolean)typeCast(value)).booleanValue()); } + } Index: BytesDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/BytesDataType.java,v retrieving revision 1.8.2.1 retrieving revision 1.8.2.2 diff -C2 -d -r1.8.2.1 -r1.8.2.2 *** BytesDataType.java 16 Jun 2003 02:09:46 -0000 1.8.2.1 --- BytesDataType.java 13 Aug 2003 02:03:59 -0000 1.8.2.2 *************** *** 78,81 **** --- 78,149 ---- } + public int compare(Object o1, Object o2) throws TypeCastException + { + try + { + byte[] value1 = (byte[])typeCast(o1); + byte[] value2 = (byte[])typeCast(o2); + + if (value1 == null && value2 == null) + { + return 0; + } + + if (value1 == null && value2 != null) + { + return -1; + } + + if (value1 != null && value2 == null) + { + return 1; + } + + return compare(value1, value2); + } + catch (ClassCastException e) + { + throw new TypeCastException(e); + } + } + + public int compare(byte[] v1, byte[] v2) throws TypeCastException + { + int len1 = v1.length; + int len2 = v2.length; + int n = Math.min(len1, len2); + int i = 0; + int j = 0; + + if (i == j) + { + int k = i; + int lim = n + i; + while (k < lim) + { + byte c1 = v1[k]; + byte c2 = v2[k]; + if (c1 != c2) + { + return c1 - c2; + } + k++; + } + } + else + { + while (n-- != 0) + { + byte c1 = v1[i++]; + byte c2 = v2[j++]; + if (c1 != c2) + { + return c1 - c2; + } + } + } + return len1 - len2; + } + public Object getSqlValue(int column, ResultSet resultSet) throws SQLException, TypeCastException *************** *** 97,100 **** --- 165,169 ---- super.setSqlValue(value, column, statement); } + } Index: DateDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/DateDataType.java,v retrieving revision 1.9.2.1 retrieving revision 1.9.2.2 diff -C2 -d -r1.9.2.1 -r1.9.2.2 Index: DoubleDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/DoubleDataType.java,v retrieving revision 1.9.2.1 retrieving revision 1.9.2.2 diff -C2 -d -r1.9.2.1 -r1.9.2.2 *** DoubleDataType.java 16 Jun 2003 02:09:46 -0000 1.9.2.1 --- DoubleDataType.java 13 Aug 2003 02:03:59 -0000 1.9.2.2 *************** *** 66,70 **** throws SQLException, TypeCastException { ! return new Double(resultSet.getDouble(column)); } --- 66,75 ---- throws SQLException, TypeCastException { ! double value = resultSet.getDouble(column); ! if (resultSet.wasNull()) ! { ! return null; ! } ! return new Double(value); } *************** *** 74,77 **** --- 79,83 ---- statement.setDouble(column, ((Number)typeCast(value)).doubleValue()); } + } Index: FloatDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/FloatDataType.java,v retrieving revision 1.9.2.1 retrieving revision 1.9.2.2 diff -C2 -d -r1.9.2.1 -r1.9.2.2 *** FloatDataType.java 16 Jun 2003 02:09:46 -0000 1.9.2.1 --- FloatDataType.java 13 Aug 2003 02:03:59 -0000 1.9.2.2 *************** *** 67,71 **** throws SQLException, TypeCastException { ! return new Float(resultSet.getFloat(column)); } --- 67,76 ---- throws SQLException, TypeCastException { ! float value = resultSet.getFloat(column); ! if (resultSet.wasNull()) ! { ! return null; ! } ! return new Float(value); } Index: IntegerDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/IntegerDataType.java,v retrieving revision 1.9.2.1 retrieving revision 1.9.2.2 diff -C2 -d -r1.9.2.1 -r1.9.2.2 *** IntegerDataType.java 16 Jun 2003 02:09:46 -0000 1.9.2.1 --- IntegerDataType.java 13 Aug 2003 02:03:59 -0000 1.9.2.2 *************** *** 66,70 **** throws SQLException, TypeCastException { ! return new Integer(resultSet.getInt(column)); } --- 66,75 ---- throws SQLException, TypeCastException { ! int value = resultSet.getInt(column); ! if (resultSet.wasNull()) ! { ! return null; ! } ! return new Integer(value); } Index: LongDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/LongDataType.java,v retrieving revision 1.9.2.1 retrieving revision 1.9.2.2 diff -C2 -d -r1.9.2.1 -r1.9.2.2 *** LongDataType.java 16 Jun 2003 02:09:46 -0000 1.9.2.1 --- LongDataType.java 13 Aug 2003 02:03:59 -0000 1.9.2.2 *************** *** 67,71 **** throws SQLException, TypeCastException { ! return new Long(resultSet.getLong(column)); } --- 67,76 ---- throws SQLException, TypeCastException { ! long value = resultSet.getLong(column); ! if (resultSet.wasNull()) ! { ! return null; ! } ! return new Long(value); } Index: NumberDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/NumberDataType.java,v retrieving revision 1.8.2.1 retrieving revision 1.8.2.2 diff -C2 -d -r1.8.2.1 -r1.8.2.2 *** NumberDataType.java 16 Jun 2003 02:09:46 -0000 1.8.2.1 --- NumberDataType.java 13 Aug 2003 02:03:59 -0000 1.8.2.2 *************** *** 34,37 **** --- 34,40 ---- public class NumberDataType extends AbstractDataType { + private static final Number TRUE = new BigDecimal(1); + private static final Number FALSE = new BigDecimal(0); + NumberDataType(String name, int sqlType) { *************** *** 52,55 **** --- 55,63 ---- { return value; + } + + if (value instanceof Boolean) + { + return ((Boolean)value).booleanValue() ? TRUE : FALSE; } Index: StringDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/StringDataType.java,v retrieving revision 1.14.2.1 retrieving revision 1.14.2.2 diff -C2 -d -r1.14.2.1 -r1.14.2.2 *** StringDataType.java 16 Jun 2003 02:09:46 -0000 1.14.2.1 --- StringDataType.java 13 Aug 2003 02:03:59 -0000 1.14.2.2 *************** *** 24,32 **** import org.dbunit.util.Base64; ! import java.sql.Blob; ! import java.sql.Clob; ! import java.sql.PreparedStatement; ! import java.sql.ResultSet; ! import java.sql.SQLException; /** --- 24,28 ---- import org.dbunit.util.Base64; ! import java.sql.*; /** *************** *** 104,108 **** { Clob clobValue = (Clob)value; ! return clobValue.getSubString(1, (int)clobValue.length()); } catch (SQLException e) --- 100,109 ---- { Clob clobValue = (Clob)value; ! int length = (int)clobValue.length(); ! if (length > 0) ! { ! return clobValue.getSubString(1, length); ! } ! return ""; } catch (SQLException e) Index: TimeDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/TimeDataType.java,v retrieving revision 1.9.2.1 retrieving revision 1.9.2.2 diff -C2 -d -r1.9.2.1 -r1.9.2.2 Index: TimestampDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/TimestampDataType.java,v retrieving revision 1.9.2.1 retrieving revision 1.9.2.2 diff -C2 -d -r1.9.2.1 -r1.9.2.2 Index: UnknownDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/UnknownDataType.java,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** UnknownDataType.java 14 Feb 2003 05:12:29 -0000 1.1 --- UnknownDataType.java 13 Aug 2003 02:03:59 -0000 1.1.2.1 *************** *** 42,45 **** --- 42,50 ---- return value; } + + public int compare(Object o1, Object o2) throws TypeCastException + { + return super.compare(asString(o1), asString(o2)); + } } |
From: <mla...@us...> - 2003-08-13 02:01:35
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/database In directory sc8-pr-cvs1:/tmp/cvs-serv32082/src/test/org/dbunit/database Added Files: ExtendedMockMultiRowResultSet.java ExtendedMockSingleRowResultSet.java Log Message: * Fixed bug #786543 - NULL fields dumped incorrectly. * Added tests for DataType.getSqlValue() method. --- NEW FILE: ExtendedMockMultiRowResultSet.java --- /* * * The DbUnit Database Testing Framework * Copyright (C)2002, Manuel Laflamme * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package org.dbunit.database; import com.mockobjects.sql.MockMultiRowResultSet; import java.sql.SQLException; /** * @author Manuel Laflamme * @since Aug 11, 2003 * @version $Revision: 1.1 $ */ public class ExtendedMockMultiRowResultSet extends MockMultiRowResultSet { /** * Always returns false. */ public boolean wasNull() throws SQLException { return false; } } --- NEW FILE: ExtendedMockSingleRowResultSet.java --- /* * * The DbUnit Database Testing Framework * Copyright (C)2002, Manuel Laflamme * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package org.dbunit.database; import com.mockobjects.sql.MockMultiRowResultSet; import com.mockobjects.sql.MockSingleRowResultSet; import java.sql.SQLException; /** * @author Manuel Laflamme * @since Aug 11, 2003 * @version $Revision: 1.1 $ */ public class ExtendedMockSingleRowResultSet extends MockSingleRowResultSet { private Object _lastValue = null; public Object getObject(String s) throws SQLException { Object object = super.getObject(s); _lastValue = object; return object; } public Object getObject(int i) throws SQLException { Object object = super.getObject(i); _lastValue = object; return object; } public boolean getBoolean(int i) throws SQLException { Object object = getObject(i); if (object == null) { return false; } return super.getBoolean(i); } public boolean getBoolean(String s) throws SQLException { Object object = getObject(s); if (object == null) { return false; } return super.getBoolean(s); } public byte getByte(int i) throws SQLException { Object object = getObject(i); if (object == null) { return 0; } return super.getByte(i); } public byte getByte(String s) throws SQLException { Object object = getObject(s); if (object == null) { return 0; } return super.getByte(s); } public double getDouble(int i) throws SQLException { Object object = getObject(i); if (object == null) { return 0; } return super.getDouble(i); } public double getDouble(String s) throws SQLException { Object object = getObject(s); if (object == null) { return 0; } return super.getDouble(s); } public float getFloat(int i) throws SQLException { Object object = getObject(i); if (object == null) { return 0; } return super.getFloat(i); } public float getFloat(String s) throws SQLException { Object object = getObject(s); if (object == null) { return 0; } return super.getFloat(s); } public int getInt(int i) throws SQLException { Object object = getObject(i); if (object == null) { return 0; } return super.getInt(i); } public int getInt(String s) throws SQLException { Object object = getObject(s); if (object == null) { return 0; } return super.getInt(s); } public long getLong(int i) throws SQLException { Object object = getObject(i); if (object == null) { return 0; } return super.getLong(i); } public long getLong(String s) throws SQLException { Object object = getObject(s); if (object == null) { return 0; } return super.getLong(s); } public short getShort(String s) throws SQLException { Object object = getObject(s); if (object == null) { return 0; } return super.getShort(s); } public short getShort(int i) throws SQLException { Object object = getObject(i); if (object == null) { return 0; } return super.getShort(i); } public boolean wasNull() throws SQLException { return _lastValue == null; } } |
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype In directory sc8-pr-cvs1:/tmp/cvs-serv32082/src/java/org/dbunit/dataset/datatype Modified Files: BooleanDataType.java DoubleDataType.java FloatDataType.java IntegerDataType.java LongDataType.java Log Message: * Fixed bug #786543 - NULL fields dumped incorrectly. * Added tests for DataType.getSqlValue() method. Index: BooleanDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/BooleanDataType.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** BooleanDataType.java 17 May 2003 15:38:52 -0000 1.11 --- BooleanDataType.java 13 Aug 2003 01:53:58 -0000 1.12 *************** *** 115,119 **** throws SQLException, TypeCastException { ! return resultSet.getBoolean(column) ? Boolean.TRUE : Boolean.FALSE; } --- 115,124 ---- throws SQLException, TypeCastException { ! boolean value = resultSet.getBoolean(column); ! if (resultSet.wasNull()) ! { ! return null; ! } ! return value ? Boolean.TRUE : Boolean.FALSE; } Index: DoubleDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/DoubleDataType.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** DoubleDataType.java 17 May 2003 15:38:52 -0000 1.10 --- DoubleDataType.java 13 Aug 2003 01:53:58 -0000 1.11 *************** *** 66,70 **** throws SQLException, TypeCastException { ! return new Double(resultSet.getDouble(column)); } --- 66,75 ---- throws SQLException, TypeCastException { ! double value = resultSet.getDouble(column); ! if (resultSet.wasNull()) ! { ! return null; ! } ! return new Double(value); } Index: FloatDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/FloatDataType.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** FloatDataType.java 17 May 2003 15:38:52 -0000 1.10 --- FloatDataType.java 13 Aug 2003 01:53:58 -0000 1.11 *************** *** 67,71 **** throws SQLException, TypeCastException { ! return new Float(resultSet.getFloat(column)); } --- 67,76 ---- throws SQLException, TypeCastException { ! float value = resultSet.getFloat(column); ! if (resultSet.wasNull()) ! { ! return null; ! } ! return new Float(value); } Index: IntegerDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/IntegerDataType.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** IntegerDataType.java 17 May 2003 15:38:52 -0000 1.10 --- IntegerDataType.java 13 Aug 2003 01:53:58 -0000 1.11 *************** *** 66,70 **** throws SQLException, TypeCastException { ! return new Integer(resultSet.getInt(column)); } --- 66,75 ---- throws SQLException, TypeCastException { ! int value = resultSet.getInt(column); ! if (resultSet.wasNull()) ! { ! return null; ! } ! return new Integer(value); } Index: LongDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/LongDataType.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** LongDataType.java 17 May 2003 15:38:52 -0000 1.10 --- LongDataType.java 13 Aug 2003 01:53:58 -0000 1.11 *************** *** 67,71 **** throws SQLException, TypeCastException { ! return new Long(resultSet.getLong(column)); } --- 67,76 ---- throws SQLException, TypeCastException { ! long value = resultSet.getLong(column); ! if (resultSet.wasNull()) ! { ! return null; ! } ! return new Long(value); } |
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/datatype In directory sc8-pr-cvs1:/tmp/cvs-serv32082/src/test/org/dbunit/dataset/datatype Modified Files: AbstractDataTypeTest.java BooleanDataTypeTest.java BytesDataTypeTest.java DateDataTypeTest.java DoubleDataTypeTest.java FloatDataTypeTest.java IntegerDataTypeTest.java LongDataTypeTest.java NumberDataTypeTest.java StringDataTypeTest.java TimeDataTypeTest.java TimestampDataTypeTest.java Log Message: * Fixed bug #786543 - NULL fields dumped incorrectly. * Added tests for DataType.getSqlValue() method. Index: AbstractDataTypeTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/datatype/AbstractDataTypeTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AbstractDataTypeTest.java 31 Mar 2003 13:22:04 -0000 1.8 --- AbstractDataTypeTest.java 13 Aug 2003 01:53:58 -0000 1.9 *************** *** 53,74 **** public abstract void testAsString() throws Exception; ! // public abstract void testCompareEquals() throws Exception ! // public abstract void testCompareDifferent() throws Exception; ! // public abstract void testCompareInvalid() throws Exception; ! ! public void testCompareEquals() throws Exception ! { ! throw new UnsupportedOperationException("Not implemented yet!"); ! } ! public void testCompareDifferent() throws Exception ! { ! throw new UnsupportedOperationException("Not implemented yet!"); ! } - public void testCompareInvalid() throws Exception - { - throw new UnsupportedOperationException("Not implemented yet!"); - } } --- 53,62 ---- public abstract void testAsString() throws Exception; ! public abstract void testCompareEquals() throws Exception; ! public abstract void testCompareDifferent() throws Exception; ! public abstract void testCompareInvalid() throws Exception; ! public abstract void testGetSqlValue() throws Exception; } Index: BooleanDataTypeTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/datatype/BooleanDataTypeTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** BooleanDataTypeTest.java 31 Mar 2003 13:22:04 -0000 1.8 --- BooleanDataTypeTest.java 13 Aug 2003 01:53:58 -0000 1.9 *************** *** 22,25 **** --- 22,27 ---- package org.dbunit.dataset.datatype; + import org.dbunit.database.ExtendedMockSingleRowResultSet; + import java.sql.Types; *************** *** 240,246 **** } ! } ! ! --- 242,262 ---- } ! public void testGetSqlValue() throws Exception ! { ! Object[] expected = new Object[] { ! null, ! Boolean.TRUE, ! Boolean.FALSE, ! }; + ExtendedMockSingleRowResultSet resultSet = new ExtendedMockSingleRowResultSet(); + resultSet.addExpectedIndexedValues(expected); + for (int i = 0; i < expected.length; i++) + { + Object expectedValue = expected[i]; + Object actualValue = THIS_TYPE.getSqlValue(i + 1, resultSet); + assertEquals("value", expectedValue, actualValue); + } + } + } Index: BytesDataTypeTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/datatype/BytesDataTypeTest.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** BytesDataTypeTest.java 31 Mar 2003 13:22:04 -0000 1.6 --- BytesDataTypeTest.java 13 Aug 2003 01:53:58 -0000 1.7 *************** *** 22,25 **** --- 22,27 ---- package org.dbunit.dataset.datatype; + import org.dbunit.database.ExtendedMockSingleRowResultSet; + import java.sql.Types; import java.util.Arrays; *************** *** 250,257 **** } } - } - --- 252,279 ---- } } + public void testGetSqlValue() throws Exception + { + byte[][] expected = { + null, + new byte[0], + new byte[]{'a', 'b', 'c', 'd'}, + new byte[]{0, 1, 2, 3, 4, 5}, + }; + ExtendedMockSingleRowResultSet resultSet = new ExtendedMockSingleRowResultSet(); + resultSet.addExpectedIndexedValues(expected); + for (int i = 0; i < expected.length; i++) + { + Object expectedValue = expected[i]; + for (int j = 0; j < TYPES.length; j++) + { + DataType dataType = TYPES[j]; + Object actualValue = dataType.getSqlValue(i + 1, resultSet); + assertEquals("value " + j, expectedValue, actualValue); + } + } + } + } Index: DateDataTypeTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/datatype/DateDataTypeTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** DateDataTypeTest.java 31 Mar 2003 13:22:05 -0000 1.8 --- DateDataTypeTest.java 13 Aug 2003 01:53:58 -0000 1.9 *************** *** 22,25 **** --- 22,27 ---- package org.dbunit.dataset.datatype; + import org.dbunit.database.ExtendedMockSingleRowResultSet; + import java.sql.*; *************** *** 236,242 **** } ! } ! --- 238,258 ---- } ! public void testGetSqlValue() throws Exception ! { ! java.sql.Date[] expected = { ! null, ! new java.sql.Date(1234), ! }; + ExtendedMockSingleRowResultSet resultSet = new ExtendedMockSingleRowResultSet(); + resultSet.addExpectedIndexedValues(expected); + for (int i = 0; i < expected.length; i++) + { + Object expectedValue = expected[i]; + Object actualValue = THIS_TYPE.getSqlValue(i + 1, resultSet); + assertEquals("value", expectedValue, actualValue); + } + } + } Index: DoubleDataTypeTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/datatype/DoubleDataTypeTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** DoubleDataTypeTest.java 31 Mar 2003 13:22:05 -0000 1.8 --- DoubleDataTypeTest.java 13 Aug 2003 01:53:58 -0000 1.9 *************** *** 22,25 **** --- 22,27 ---- package org.dbunit.dataset.datatype; + import org.dbunit.database.ExtendedMockSingleRowResultSet; + import java.math.BigDecimal; import java.sql.Types; *************** *** 273,279 **** } ! } --- 275,308 ---- } ! public void testGetSqlValue() throws Exception ! { ! Double[] expected = { ! null, ! new Double(5.555), ! new Double(Float.MAX_VALUE), ! new Double(Double.MIN_VALUE), ! new Double(-7500), ! Double.valueOf("2.34E23"), ! new Double(0.666), ! new Double(5.49879), ! new Double(-99.9), ! new Double(1234), ! }; + ExtendedMockSingleRowResultSet resultSet = new ExtendedMockSingleRowResultSet(); + resultSet.addExpectedIndexedValues(expected); + for (int i = 0; i < expected.length; i++) + { + Object expectedValue = expected[i]; + for (int j = 0; j < TYPES.length; j++) + { + DataType dataType = TYPES[j]; + Object actualValue = dataType.getSqlValue(i + 1, resultSet); + assertEquals("value " + j, expectedValue, actualValue); + } + } + } + } Index: FloatDataTypeTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/datatype/FloatDataTypeTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** FloatDataTypeTest.java 31 Mar 2003 13:22:06 -0000 1.8 --- FloatDataTypeTest.java 13 Aug 2003 01:53:58 -0000 1.9 *************** *** 22,25 **** --- 22,27 ---- package org.dbunit.dataset.datatype; + import org.dbunit.database.ExtendedMockSingleRowResultSet; + import java.math.BigDecimal; import java.sql.Types; *************** *** 237,243 **** } ! } ! ! --- 239,266 ---- } ! public void testGetSqlValue() throws Exception ! { ! Float[] expected = { ! null, ! new Float(5.555), ! new Float(Float.MAX_VALUE), ! new Float(Float.MIN_VALUE), ! new Float(-7500), ! Float.valueOf("2.34E3"), ! new Float(0.666), ! new Float(5.49879), ! new Float(-99.9), ! new Float(1234), ! }; + ExtendedMockSingleRowResultSet resultSet = new ExtendedMockSingleRowResultSet(); + resultSet.addExpectedIndexedValues(expected); + for (int i = 0; i < expected.length; i++) + { + Object expectedValue = expected[i]; + Object actualValue = THIS_TYPE.getSqlValue(i + 1, resultSet); + assertEquals("value", expectedValue, actualValue); + } + } + } Index: IntegerDataTypeTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/datatype/IntegerDataTypeTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** IntegerDataTypeTest.java 31 Mar 2003 13:22:06 -0000 1.8 --- IntegerDataTypeTest.java 13 Aug 2003 01:53:58 -0000 1.9 *************** *** 22,25 **** --- 22,27 ---- package org.dbunit.dataset.datatype; + import org.dbunit.database.ExtendedMockSingleRowResultSet; + import java.math.BigDecimal; import java.sql.Types; *************** *** 303,309 **** } ! } --- 305,333 ---- } ! public void testGetSqlValue() throws Exception ! { ! Integer[] expected = { ! null, ! new Integer(5), ! new Integer(Integer.MAX_VALUE - 1), ! new Integer(Integer.MIN_VALUE + 1), ! new Integer(-7500), ! }; + ExtendedMockSingleRowResultSet resultSet = new ExtendedMockSingleRowResultSet(); + resultSet.addExpectedIndexedValues(expected); + for (int i = 0; i < expected.length; i++) + { + Object expectedValue = expected[i]; + for (int j = 0; j < TYPES.length; j++) + { + DataType dataType = TYPES[j]; + Object actualValue = dataType.getSqlValue(i + 1, resultSet); + assertEquals("value " + j, expectedValue, actualValue); + } + } + } + } Index: LongDataTypeTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/datatype/LongDataTypeTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** LongDataTypeTest.java 31 Mar 2003 13:22:06 -0000 1.8 --- LongDataTypeTest.java 13 Aug 2003 01:53:58 -0000 1.9 *************** *** 22,25 **** --- 22,27 ---- package org.dbunit.dataset.datatype; + import org.dbunit.database.ExtendedMockSingleRowResultSet; + import java.math.BigDecimal; import java.sql.Types; *************** *** 261,267 **** } ! } ! --- 263,288 ---- } ! public void testGetSqlValue() throws Exception ! { ! Long[] expected = { ! null, ! new Long(5), ! new Long(1234), ! new Long(Long.MAX_VALUE), ! new Long(Long.MIN_VALUE), ! new Long(-7500), ! new Long(0), ! }; + ExtendedMockSingleRowResultSet resultSet = new ExtendedMockSingleRowResultSet(); + resultSet.addExpectedIndexedValues(expected); + for (int i = 0; i < expected.length; i++) + { + Object expectedValue = expected[i]; + Object actualValue = THIS_TYPE.getSqlValue(i + 1, resultSet); + assertEquals("value", expectedValue, actualValue); + } + } + } Index: NumberDataTypeTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/datatype/NumberDataTypeTest.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** NumberDataTypeTest.java 31 Mar 2003 13:22:06 -0000 1.9 --- NumberDataTypeTest.java 13 Aug 2003 01:53:58 -0000 1.10 *************** *** 22,25 **** --- 22,27 ---- package org.dbunit.dataset.datatype; + import org.dbunit.database.ExtendedMockSingleRowResultSet; + import java.math.BigDecimal; import java.math.BigInteger; *************** *** 255,261 **** } ! } --- 257,282 ---- } ! public void testGetSqlValue() throws Exception ! { ! BigDecimal[] expected = { ! null, ! new BigDecimal("12.34"), ! }; + ExtendedMockSingleRowResultSet resultSet = new ExtendedMockSingleRowResultSet(); + resultSet.addExpectedIndexedValues(expected); + for (int i = 0; i < expected.length; i++) + { + Object expectedValue = expected[i]; + for (int j = 0; j < TYPES.length; j++) + { + DataType dataType = TYPES[j]; + Object actualValue = dataType.getSqlValue(i + 1, resultSet); + assertEquals("value " + j, expectedValue, actualValue); + } + } + } + } Index: StringDataTypeTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/datatype/StringDataTypeTest.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** StringDataTypeTest.java 9 Aug 2003 11:23:31 -0000 1.9 --- StringDataTypeTest.java 13 Aug 2003 01:53:58 -0000 1.10 *************** *** 22,25 **** --- 22,27 ---- package org.dbunit.dataset.datatype; + import org.dbunit.database.ExtendedMockSingleRowResultSet; + import java.sql.Types; *************** *** 270,276 **** } ! } --- 272,297 ---- } ! public void testGetSqlValue() throws Exception ! { ! String[] expected = { ! null, ! "bla", ! }; + ExtendedMockSingleRowResultSet resultSet = new ExtendedMockSingleRowResultSet(); + resultSet.addExpectedIndexedValues(expected); + for (int i = 0; i < expected.length; i++) + { + Object expectedValue = expected[i]; + for (int j = 0; j < TYPES.length; j++) + { + DataType dataType = TYPES[j]; + Object actualValue = dataType.getSqlValue(i + 1, resultSet); + assertEquals("value " + j, expectedValue, actualValue); + } + } + } + } Index: TimeDataTypeTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/datatype/TimeDataTypeTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** TimeDataTypeTest.java 31 Mar 2003 13:22:06 -0000 1.8 --- TimeDataTypeTest.java 13 Aug 2003 01:53:58 -0000 1.9 *************** *** 22,25 **** --- 22,27 ---- package org.dbunit.dataset.datatype; + import org.dbunit.database.ExtendedMockSingleRowResultSet; + import java.sql.*; *************** *** 233,239 **** } ! } ! --- 235,259 ---- } ! public void testGetSqlValue() throws Exception ! { ! java.sql.Time[] expected = { ! null, ! new Time(1234), ! new Time(new java.sql.Date(1234).getTime()), ! new Time(new Timestamp(1234).getTime()), ! Time.valueOf(new Time(1234).toString()), ! new Time(1234), ! }; + ExtendedMockSingleRowResultSet resultSet = new ExtendedMockSingleRowResultSet(); + resultSet.addExpectedIndexedValues(expected); + for (int i = 0; i < expected.length; i++) + { + Object expectedValue = expected[i]; + Object actualValue = THIS_TYPE.getSqlValue(i + 1, resultSet); + assertEquals("value", expectedValue, actualValue); + } + } + } Index: TimestampDataTypeTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/datatype/TimestampDataTypeTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** TimestampDataTypeTest.java 31 Mar 2003 13:22:07 -0000 1.8 --- TimestampDataTypeTest.java 13 Aug 2003 01:53:58 -0000 1.9 *************** *** 22,26 **** package org.dbunit.dataset.datatype; ! import java.sql.*; /** --- 22,31 ---- package org.dbunit.dataset.datatype; ! import org.dbunit.database.ExtendedMockSingleRowResultSet; ! ! import java.sql.Date; ! import java.sql.Time; ! import java.sql.Timestamp; ! import java.sql.Types; /** *************** *** 234,238 **** --- 239,262 ---- } + public void testGetSqlValue() throws Exception + { + Timestamp[] expected = { + null, + new Timestamp(1234), + }; + + ExtendedMockSingleRowResultSet resultSet = new ExtendedMockSingleRowResultSet(); + resultSet.addExpectedIndexedValues(expected); + + for (int i = 0; i < expected.length; i++) + { + Object expectedValue = expected[i]; + Object actualValue = THIS_TYPE.getSqlValue(i + 1, resultSet); + assertEquals("value", expectedValue, actualValue); + } + } + } + |
From: <de...@us...> - 2003-08-09 15:24:40
|
Update of /cvsroot/dbunit/dbunit In directory sc8-pr-cvs1:/tmp/cvs-serv19292 Modified Files: project.properties Added Files: maven.xml Log Message: Using html2xdoc to temporarily convert existing docs into xdoc format and linking to site. --- NEW FILE: maven.xml --- <project default="jar:jar" xmlns:j="jelly:core" xmlns:u="jelly:util" xmlns:ant="jelly:ant" xmlns:maven="jelly:maven" xmlns:m="maven" xmlns:deploy="deploy"> <preGoal name="xdoc:jelly-transform"> <attainGoal name="html2xdoc"/> </preGoal> </project> Index: project.properties =================================================================== RCS file: /cvsroot/dbunit/dbunit/project.properties,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** project.properties 9 Aug 2003 11:58:58 -0000 1.2 --- project.properties 9 Aug 2003 15:24:37 -0000 1.3 *************** *** 5,7 **** --- 5,9 ---- maven.junit.fork=true + maven.html2xdoc.dir=docs + |
From: <de...@us...> - 2003-08-09 11:59:01
|
Update of /cvsroot/dbunit/dbunit In directory sc8-pr-cvs1:/tmp/cvs-serv17371 Modified Files: project.properties Log Message: The magic maven.junit.fork seems to make all tests pass! Darn XML parser hell... Index: project.properties =================================================================== RCS file: /cvsroot/dbunit/dbunit/project.properties,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** project.properties 17 Jul 2003 00:54:50 -0000 1.1 --- project.properties 9 Aug 2003 11:58:58 -0000 1.2 *************** *** 1,2 **** --- 1,7 ---- maven.xdoc.date=left maven.xdoc.version=${pom.currentVersion} + + maven.junit.usefile=false + maven.junit.fork=true + + |
From: <de...@us...> - 2003-08-09 11:43:15
|
Update of /cvsroot/dbunit/dbunit In directory sc8-pr-cvs1:/tmp/cvs-serv15755 Modified Files: project.xml Log Message: Updated links to mailing lists. Still can't get links to CVS for changelog to work right.. Index: project.xml =================================================================== RCS file: /cvsroot/dbunit/dbunit/project.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** project.xml 9 Aug 2003 11:24:29 -0000 1.3 --- project.xml 9 Aug 2003 11:43:12 -0000 1.4 *************** *** 47,52 **** the connection element has the form: scm:<system>:<system specific connection string> --> ! <repository> ! <connection>scm:cvs:pserver:an...@cv...:/cvsroot/dbunit:dbunit</connection> <url>http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/dbunit/dbunit</url> --- 47,53 ---- the connection element has the form: scm:<system>:<system specific connection string> --> ! <repository> ! <connection>scm:cvs:pserver:ano...@cv...:/cvsroot/dbunit:dbunit</connection> ! <developerConnection>scm:cvs:ext:${maven.username}@cvs.sourceforge.net:/cvsroot/dbunit:dbunit</developerConnection> <url>http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/dbunit/dbunit</url> *************** *** 54,58 **** <!-- any mailing lists for the project --> ! <mailingLists/> <!-- who the developers are for the project --> --- 55,78 ---- <!-- any mailing lists for the project --> ! <mailingLists> ! <mailingList> ! <name>DbUnit User List</name> ! <subscribe>http://lists.sourceforge.net/lists/listinfo/dbunit-user</subscribe> ! <unsubscribe>http://lists.sourceforge.net/lists/listinfo/dbunit-user</unsubscribe> ! <archive>http://sourceforge.net/mailarchive/forum.php?forum_id=8154</archive> ! </mailingList> ! <mailingList> ! <name>DbUnit Developer List</name> ! <subscribe>http://lists.sourceforge.net/lists/listinfo/dbunit-developer</subscribe> ! <unsubscribe>http://lists.sourceforge.net/lists/listinfo/dbunit-developer</unsubscribe> ! <archive>http://sourceforge.net/mailarchive/forum.php?forum_id=9162</archive> ! </mailingList> ! <mailingList> ! <name>DbUnit CVS Commit List</name> ! <subscribe>http://lists.sourceforge.net/lists/listinfo/dbunit-commit</subscribe> ! <unsubscribe>http://lists.sourceforge.net/lists/listinfo/dbunit-commit</unsubscribe> ! <archive>http://sourceforge.net/mailarchive/forum.php?forum_id=9771</archive> ! </mailingList> ! </mailingLists> <!-- who the developers are for the project --> |
From: <de...@us...> - 2003-08-09 11:24:32
|
Update of /cvsroot/dbunit/dbunit In directory sc8-pr-cvs1:/tmp/cvs-serv13472 Modified Files: project.xml Log Message: Added explicit reports to generate. Added PMD checking of code. Index: project.xml =================================================================== RCS file: /cvsroot/dbunit/dbunit/project.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** project.xml 17 Jul 2003 16:07:08 -0000 1.2 --- project.xml 9 Aug 2003 11:24:29 -0000 1.3 *************** *** 136,139 **** --- 136,153 ---- </resources> </build> + + <reports> + <report>maven-jdepend-plugin</report> + <report>maven-checkstyle-plugin</report> + <report>maven-changes-plugin</report> + <report>maven-changelog-plugin</report> + <report>maven-file-activity-plugin</report> + <report>maven-developer-activity-plugin</report> + <report>maven-javadoc-plugin</report> + <report>maven-jxr-plugin</report> + <report>maven-junit-report-plugin</report> + <report>maven-tasklist-plugin</report> + <report>maven-pmd-plugin</report> + </reports> |
From: <de...@us...> - 2003-08-09 11:24:03
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/util/xml In directory sc8-pr-cvs1:/tmp/cvs-serv13148/src/java/org/dbunit/util/xml Modified Files: XmlWriter.java Log Message: A bunch of import fixes and unused variables suggested by running PMD using Maven Index: XmlWriter.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/util/xml/XmlWriter.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** XmlWriter.java 17 Jul 2003 16:06:33 -0000 1.3 --- XmlWriter.java 9 Aug 2003 11:23:22 -0000 1.4 *************** *** 56,63 **** import java.io.IOException; - import java.io.Writer; import java.io.OutputStreamWriter; ! import java.io.BufferedWriter; ! import java.util.Stack; --- 56,61 ---- import java.io.IOException; import java.io.OutputStreamWriter; ! import java.io.Writer; import java.util.Stack; |
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml In directory sc8-pr-cvs1:/tmp/cvs-serv13148/src/java/org/dbunit/dataset/xml Modified Files: FlatDtdDataSet.java FlatDtdWriter.java FlatXmlDataSet.java FlatXmlProducer.java XmlProducer.java Log Message: A bunch of import fixes and unused variables suggested by running PMD using Maven Index: FlatDtdDataSet.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/FlatDtdDataSet.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** FlatDtdDataSet.java 19 Jun 2003 03:17:16 -0000 1.8 --- FlatDtdDataSet.java 9 Aug 2003 11:23:21 -0000 1.9 *************** *** 11,23 **** package org.dbunit.dataset.xml; - import org.dbunit.dataset.*; - - import org.xml.sax.InputSource; - import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; - import java.io.PrintWriter; import java.io.Reader; import java.io.Writer; --- 11,18 ---- *************** *** 27,30 **** --- 22,38 ---- import java.util.List; import java.util.Map; + + import org.dbunit.dataset.AbstractDataSet; + import org.dbunit.dataset.DataSetException; + import org.dbunit.dataset.DefaultTable; + import org.dbunit.dataset.DefaultTableIterator; + import org.dbunit.dataset.IDataSet; + import org.dbunit.dataset.IDataSetConsumer; + import org.dbunit.dataset.IDataSetProducer; + import org.dbunit.dataset.ITable; + import org.dbunit.dataset.ITableIterator; + import org.dbunit.dataset.ITableMetaData; + import org.dbunit.dataset.NoSuchTableException; + import org.xml.sax.InputSource; /** Index: FlatDtdWriter.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/FlatDtdWriter.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FlatDtdWriter.java 19 Jun 2003 03:17:16 -0000 1.2 --- FlatDtdWriter.java 9 Aug 2003 11:23:22 -0000 1.3 *************** *** 21,31 **** package org.dbunit.dataset.xml; import org.dbunit.dataset.Column; import org.dbunit.dataset.DataSetException; import org.dbunit.dataset.IDataSet; - import org.dbunit.dataset.ITableMetaData; - - import java.io.PrintWriter; - import java.io.Writer; /** --- 21,30 ---- package org.dbunit.dataset.xml; + import java.io.PrintWriter; + import java.io.Writer; + import org.dbunit.dataset.Column; import org.dbunit.dataset.DataSetException; import org.dbunit.dataset.IDataSet; /** Index: FlatXmlDataSet.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/FlatXmlDataSet.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** FlatXmlDataSet.java 19 Jun 2003 03:17:16 -0000 1.22 --- FlatXmlDataSet.java 9 Aug 2003 11:23:22 -0000 1.23 *************** *** 23,36 **** package org.dbunit.dataset.xml; - import org.dbunit.dataset.CachedDataSet; - import org.dbunit.dataset.DataSetException; - import org.dbunit.dataset.IDataSet; - - import org.xml.sax.EntityResolver; - import org.xml.sax.InputSource; - import org.xml.sax.SAXException; - import java.io.File; - import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; --- 23,27 ---- *************** *** 39,42 **** --- 30,40 ---- import java.io.Reader; import java.io.Writer; + + import org.dbunit.dataset.CachedDataSet; + import org.dbunit.dataset.DataSetException; + import org.dbunit.dataset.IDataSet; + import org.xml.sax.EntityResolver; + import org.xml.sax.InputSource; + import org.xml.sax.SAXException; /** Index: FlatXmlProducer.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/FlatXmlProducer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FlatXmlProducer.java 19 Jun 2003 03:17:16 -0000 1.2 --- FlatXmlProducer.java 9 Aug 2003 11:23:22 -0000 1.3 *************** *** 21,26 **** --- 21,33 ---- package org.dbunit.dataset.xml; + import java.io.IOException; + import java.io.StringReader; + + import javax.xml.parsers.ParserConfigurationException; + import javax.xml.parsers.SAXParserFactory; + import org.dbunit.dataset.Column; import org.dbunit.dataset.DataSetException; + import org.dbunit.dataset.DefaultConsumer; import org.dbunit.dataset.DefaultTableMetaData; import org.dbunit.dataset.IDataSet; *************** *** 28,47 **** import org.dbunit.dataset.IDataSetProducer; import org.dbunit.dataset.ITableMetaData; - import org.dbunit.dataset.DefaultConsumer; import org.dbunit.dataset.datatype.DataType; - import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; - import org.xml.sax.EntityResolver; import org.xml.sax.helpers.DefaultHandler; - - import javax.xml.parsers.ParserConfigurationException; - import javax.xml.parsers.SAXParser; - import javax.xml.parsers.SAXParserFactory; - import java.io.IOException; - import java.io.StringReader; /** --- 35,46 ---- import org.dbunit.dataset.IDataSetProducer; import org.dbunit.dataset.ITableMetaData; import org.dbunit.dataset.datatype.DataType; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; + import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.DefaultHandler; /** Index: XmlProducer.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/XmlProducer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** XmlProducer.java 19 Jun 2003 03:17:16 -0000 1.2 --- XmlProducer.java 9 Aug 2003 11:23:22 -0000 1.3 *************** *** 21,24 **** --- 21,32 ---- package org.dbunit.dataset.xml; + import java.io.IOException; + import java.io.InputStream; + import java.util.LinkedList; + import java.util.List; + + import javax.xml.parsers.ParserConfigurationException; + import javax.xml.parsers.SAXParserFactory; + import org.dbunit.dataset.Column; import org.dbunit.dataset.DataSetException; *************** *** 27,34 **** import org.dbunit.dataset.IDataSetConsumer; import org.dbunit.dataset.IDataSetProducer; - import org.dbunit.dataset.ITableMetaData; import org.dbunit.dataset.ITable; import org.dbunit.dataset.datatype.DataType; - import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; --- 35,41 ---- import org.dbunit.dataset.IDataSetConsumer; import org.dbunit.dataset.IDataSetProducer; import org.dbunit.dataset.ITable; + import org.dbunit.dataset.ITableMetaData; import org.dbunit.dataset.datatype.DataType; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; *************** *** 39,51 **** import org.xml.sax.XMLReader; import org.xml.sax.helpers.DefaultHandler; - - import javax.xml.parsers.ParserConfigurationException; - import javax.xml.parsers.SAXParserFactory; - import java.io.IOException; - import java.io.InputStream; - import java.util.LinkedList; - import java.util.List; - import java.util.Arrays; - import java.util.Iterator; /** --- 46,49 ---- |
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv13148/src/java/org/dbunit/dataset Modified Files: IDataSet.java IDataSetConsumer.java DataSetProducerAdapter.java FilteredDataSet.java IDataSetProducer.java Log Message: A bunch of import fixes and unused variables suggested by running PMD using Maven Index: IDataSet.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/IDataSet.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** IDataSet.java 9 Apr 2003 22:52:09 -0000 1.12 --- IDataSet.java 9 Aug 2003 11:23:19 -0000 1.13 *************** *** 23,28 **** package org.dbunit.dataset; - import org.dbunit.database.AmbiguousTableNameException; - /** * Represents a collection of tables. --- 23,26 ---- Index: IDataSetConsumer.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/IDataSetConsumer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IDataSetConsumer.java 19 Jun 2003 03:17:16 -0000 1.2 --- IDataSetConsumer.java 9 Aug 2003 11:23:20 -0000 1.3 *************** *** 21,26 **** package org.dbunit.dataset; - import org.dbunit.dataset.DataSetException; - import org.dbunit.dataset.ITableMetaData; /** --- 21,24 ---- Index: DataSetProducerAdapter.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/DataSetProducerAdapter.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DataSetProducerAdapter.java 19 Jun 2003 03:17:16 -0000 1.2 --- DataSetProducerAdapter.java 9 Aug 2003 11:23:20 -0000 1.3 *************** *** 21,31 **** package org.dbunit.dataset; ! import org.dbunit.dataset.ITableIterator; ! import org.dbunit.dataset.DataSetException; ! import org.dbunit.dataset.ITableMetaData; ! import org.dbunit.dataset.ITable; ! import org.dbunit.dataset.Column; ! import org.dbunit.dataset.RowOutOfBoundsException; ! import org.dbunit.dataset.IDataSet; /** --- 21,25 ---- package org.dbunit.dataset; ! /** Index: FilteredDataSet.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/FilteredDataSet.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** FilteredDataSet.java 9 Apr 2003 22:52:09 -0000 1.13 --- FilteredDataSet.java 9 Aug 2003 11:23:21 -0000 1.14 *************** *** 23,29 **** package org.dbunit.dataset; - import org.dbunit.dataset.filter.IncludeTableFilter; import org.dbunit.dataset.filter.SequenceTableFilter; - import org.dbunit.dataset.filter.ExcludeTableFilter; import org.dbunit.dataset.filter.ITableFilter; --- 23,27 ---- Index: IDataSetProducer.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/IDataSetProducer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IDataSetProducer.java 19 Jun 2003 03:17:16 -0000 1.2 --- IDataSetProducer.java 9 Aug 2003 11:23:21 -0000 1.3 *************** *** 21,26 **** package org.dbunit.dataset; - import org.dbunit.dataset.DataSetException; - import org.dbunit.dataset.IDataSetConsumer; /** --- 21,24 ---- |
From: <de...@us...> - 2003-08-09 11:23:51
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit In directory sc8-pr-cvs1:/tmp/cvs-serv13148/src/java/org/dbunit Modified Files: Assertion.java Log Message: A bunch of import fixes and unused variables suggested by running PMD using Maven Index: Assertion.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/Assertion.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Assertion.java 2 Apr 2003 02:06:42 -0000 1.8 --- Assertion.java 9 Aug 2003 11:23:17 -0000 1.9 *************** *** 23,36 **** package org.dbunit; - import org.dbunit.dataset.*; - import org.dbunit.dataset.datatype.DataType; - import org.dbunit.dataset.datatype.DataTypeException; - import org.dbunit.dataset.datatype.UnknownDataType; - import java.util.Arrays; import java.util.Comparator; - import java.util.ArrayList; import junit.framework.Assert; /** --- 23,38 ---- package org.dbunit; import java.util.Arrays; import java.util.Comparator; import junit.framework.Assert; + + import org.dbunit.dataset.Column; + import org.dbunit.dataset.DataSetException; + import org.dbunit.dataset.IDataSet; + import org.dbunit.dataset.ITable; + import org.dbunit.dataset.ITableMetaData; + import org.dbunit.dataset.datatype.DataType; + import org.dbunit.dataset.datatype.UnknownDataType; /** |
From: <de...@us...> - 2003-08-09 11:23:51
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/filter In directory sc8-pr-cvs1:/tmp/cvs-serv13148/src/java/org/dbunit/dataset/filter Modified Files: ExcludeTableFilter.java ITableFilter.java Log Message: A bunch of import fixes and unused variables suggested by running PMD using Maven Index: ExcludeTableFilter.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/filter/ExcludeTableFilter.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ExcludeTableFilter.java 19 Mar 2003 02:59:21 -0000 1.3 --- ExcludeTableFilter.java 9 Aug 2003 11:23:15 -0000 1.4 *************** *** 21,26 **** package org.dbunit.dataset.filter; - import java.util.HashSet; - import java.util.Set; /** --- 21,24 ---- Index: ITableFilter.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/filter/ITableFilter.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ITableFilter.java 9 Apr 2003 22:52:10 -0000 1.2 --- ITableFilter.java 9 Aug 2003 11:23:16 -0000 1.3 *************** *** 23,28 **** import org.dbunit.dataset.DataSetException; import org.dbunit.dataset.IDataSet; ! import org.dbunit.dataset.ITable; ! import org.dbunit.dataset.*; /** --- 23,27 ---- import org.dbunit.dataset.DataSetException; import org.dbunit.dataset.IDataSet; ! import org.dbunit.dataset.ITableIterator; /** |
From: <de...@us...> - 2003-08-09 11:23:51
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/database In directory sc8-pr-cvs1:/tmp/cvs-serv13148/src/java/org/dbunit/database Modified Files: QueryDataSet.java IResultSetTable.java Log Message: A bunch of import fixes and unused variables suggested by running PMD using Maven Index: QueryDataSet.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/QueryDataSet.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** QueryDataSet.java 9 Apr 2003 22:52:08 -0000 1.3 --- QueryDataSet.java 9 Aug 2003 11:23:11 -0000 1.4 *************** *** 22,34 **** package org.dbunit.database; ! import java.sql.*; ! import java.util.*; - import org.dbunit.database.*; import org.dbunit.dataset.AbstractDataSet; import org.dbunit.dataset.DataSetException; import org.dbunit.dataset.ITable; import org.dbunit.dataset.ITableIterator; - import org.dbunit.dataset.DefaultTableIterator; /** --- 22,35 ---- package org.dbunit.database; ! import java.sql.SQLException; ! import java.util.ArrayList; ! import java.util.Iterator; ! import java.util.List; import org.dbunit.dataset.AbstractDataSet; import org.dbunit.dataset.DataSetException; + import org.dbunit.dataset.DefaultTableIterator; import org.dbunit.dataset.ITable; import org.dbunit.dataset.ITableIterator; /** Index: IResultSetTable.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/IResultSetTable.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IResultSetTable.java 13 Apr 2003 02:40:09 -0000 1.1 --- IResultSetTable.java 9 Aug 2003 11:23:12 -0000 1.2 *************** *** 24,28 **** import org.dbunit.dataset.DataSetException; - import java.sql.SQLException; /** --- 24,27 ---- |
From: <de...@us...> - 2003-08-09 11:23:51
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv13148/src/test/org/dbunit/dataset Modified Files: LowerCaseDataSetTest.java MockDataSet.java DataSetProducerAdapterTest.java SortedTableTest.java CaseInsensitiveDataSetTest.java CompositeDataSetTest.java SortedDataSetTest.java Log Message: A bunch of import fixes and unused variables suggested by running PMD using Maven Index: LowerCaseDataSetTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/LowerCaseDataSetTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LowerCaseDataSetTest.java 15 Feb 2003 05:42:43 -0000 1.1 --- LowerCaseDataSetTest.java 9 Aug 2003 11:23:09 -0000 1.2 *************** *** 11,19 **** package org.dbunit.dataset; - import org.dbunit.dataset.xml.XmlDataSet; - import org.dbunit.dataset.xml.FlatXmlDataSet; - - import java.io.FileInputStream; import java.io.FileReader; /** --- 11,17 ---- package org.dbunit.dataset; import java.io.FileReader; + + import org.dbunit.dataset.xml.FlatXmlDataSet; /** Index: MockDataSet.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/MockDataSet.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MockDataSet.java 13 Apr 2003 05:13:53 -0000 1.1 --- MockDataSet.java 9 Aug 2003 11:23:09 -0000 1.2 *************** *** 21,37 **** package org.dbunit.dataset; - import org.dbunit.dataset.DefaultDataSet; - import org.dbunit.dataset.ITableIterator; - import org.dbunit.dataset.AbstractDataSet; - import org.dbunit.dataset.ITable; - import org.dbunit.dataset.DataSetException; - import org.dbunit.dataset.DefaultTableIterator; - import org.dbunit.dataset.DefaultTable; - - import com.mockobjects.Verifiable; - - import java.util.List; import java.util.ArrayList; import java.util.Iterator; /** --- 21,29 ---- package org.dbunit.dataset; import java.util.ArrayList; import java.util.Iterator; + import java.util.List; + + import com.mockobjects.Verifiable; /** Index: DataSetProducerAdapterTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/DataSetProducerAdapterTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DataSetProducerAdapterTest.java 19 Jun 2003 03:17:17 -0000 1.2 --- DataSetProducerAdapterTest.java 9 Aug 2003 11:23:09 -0000 1.3 *************** *** 21,37 **** package org.dbunit.dataset; - import org.dbunit.dataset.AbstractTest; - import org.dbunit.dataset.DataSetException; - import org.dbunit.dataset.ITableMetaData; - import org.dbunit.dataset.DataSetProducerAdapter; - import org.dbunit.dataset.IDataSetConsumer; - import org.dbunit.dataset.IDataSetProducer; - import org.dbunit.dataset.xml.FlatXmlDataSet; - import org.dbunit.dataset.xml.FlatXmlProducer; - - import org.xml.sax.InputSource; - - import java.io.FileReader; import java.io.File; /** --- 21,27 ---- package org.dbunit.dataset; import java.io.File; + + import org.dbunit.dataset.xml.FlatXmlDataSet; /** Index: SortedTableTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/SortedTableTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SortedTableTest.java 20 Feb 2003 03:55:16 -0000 1.1 --- SortedTableTest.java 9 Aug 2003 11:23:09 -0000 1.2 *************** *** 23,30 **** package org.dbunit.dataset; - import org.dbunit.dataset.*; - import org.dbunit.dataset.xml.FlatXmlDataSet; - import java.io.File; /** --- 23,29 ---- package org.dbunit.dataset; import java.io.File; + + import org.dbunit.dataset.xml.FlatXmlDataSet; /** Index: CaseInsensitiveDataSetTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/CaseInsensitiveDataSetTest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CaseInsensitiveDataSetTest.java 9 Apr 2003 22:52:14 -0000 1.5 --- CaseInsensitiveDataSetTest.java 9 Aug 2003 11:23:09 -0000 1.6 *************** *** 11,19 **** package org.dbunit.dataset; - import org.dbunit.dataset.xml.XmlDataSet; - import org.dbunit.dataset.xml.FlatXmlDataSet; - - import java.io.FileInputStream; import java.io.FileReader; /** --- 11,18 ---- package org.dbunit.dataset; import java.io.FileReader; + + import org.dbunit.dataset.xml.FlatXmlDataSet; + import org.dbunit.dataset.xml.XmlDataSet; /** Index: CompositeDataSetTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/CompositeDataSetTest.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** CompositeDataSetTest.java 9 Apr 2003 22:52:14 -0000 1.9 --- CompositeDataSetTest.java 9 Aug 2003 11:23:09 -0000 1.10 *************** *** 23,31 **** package org.dbunit.dataset; - import org.dbunit.dataset.xml.XmlDataSet; - import org.dbunit.dataset.xml.FlatXmlDataSet; - - import java.io.FileInputStream; import java.io.FileReader; /** --- 23,30 ---- package org.dbunit.dataset; import java.io.FileReader; + + import org.dbunit.dataset.xml.FlatXmlDataSet; + import org.dbunit.dataset.xml.XmlDataSet; /** Index: SortedDataSetTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/SortedDataSetTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SortedDataSetTest.java 20 Feb 2003 03:55:16 -0000 1.1 --- SortedDataSetTest.java 9 Aug 2003 11:23:09 -0000 1.2 *************** *** 23,31 **** package org.dbunit.dataset; - import org.dbunit.dataset.xml.XmlDataSet; - import org.dbunit.dataset.xml.FlatXmlDataSet; - - import java.io.FileInputStream; import java.io.FileReader; /** --- 23,30 ---- package org.dbunit.dataset; import java.io.FileReader; + + import org.dbunit.dataset.xml.FlatXmlDataSet; + import org.dbunit.dataset.xml.XmlDataSet; /** |
From: <de...@us...> - 2003-08-09 11:23:35
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/util In directory sc8-pr-cvs1:/tmp/cvs-serv13148/src/java/org/dbunit/util Modified Files: FileAsserts.java Log Message: A bunch of import fixes and unused variables suggested by running PMD using Maven Index: FileAsserts.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/util/FileAsserts.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FileAsserts.java 24 Feb 2003 02:37:22 -0000 1.1 --- FileAsserts.java 9 Aug 2003 11:23:32 -0000 1.2 *************** *** 24,28 **** */ ! import java.io.*; import junit.framework.Assert; --- 24,33 ---- */ ! import java.io.BufferedReader; ! import java.io.File; ! import java.io.FileInputStream; ! import java.io.IOException; ! import java.io.InputStream; ! import java.io.InputStreamReader; import junit.framework.Assert; *************** *** 110,115 **** Assert.assertTrue(actual.canRead()); ! int lineCounter = 0; ! String problem = null; BufferedReader expectedData = new BufferedReader(new InputStreamReader(expected)); --- 115,119 ---- Assert.assertTrue(actual.canRead()); ! BufferedReader expectedData = new BufferedReader(new InputStreamReader(expected)); |