Re: [Mifos-developer] Do I need to upgrade DBUnit datasets if there are no schema changes?

7 views
Skip to first unread message

Adam Monsen

unread,
Feb 28, 2010, 10:34:30 AM2/28/10
to Developer
On Sun, Feb 28, 2010 at 5:01 AM, Keith Pierce wrote:
> I am about to commit a DB upgrade that only adds a lookup value but does not
> change schema. Must I upgrade the DBUnit datasets?

Yes.

> The only reason I can think of is to update some internal descriptor
> that tracks the DB version number.

Yes, that's one reason. Another is consistency: that the acceptance
tests are testing something closer to production databases.

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev

Keith Pierce

unread,
Feb 28, 2010, 11:45:01 AM2/28/10
to Mifos software development
Adam, thanks for sending a clue to the clueless :). I will summarize
what I learned by reading mifos.org pages on acceptance-testing and
DBUnit, as well as reviewing the class
org.mifos.framework.util.DataSetUpgradeUtil (which I should have done
first before posting my question). Hopefully this will help someone
else just learning about database upgrades and acceptance test data
sets:

* A Dataset is a dump of the entire contents of the Mifos database,
xml-formatted by DBUnit. It is used either to initialize the database
state before running an acceptance test, or to validate its expected
state after the test.

* When the database undergoes an upgrade (either a schema change, a
change in initial data, or some other transformation of existing data)
the current DBUnit datasets may no longer be valid and may either
cause tests to fail or abort in error or give erroneous results. The
procedure outlined at
http://www.mifos.org/developers/wiki/DataSetUpgradeUtil updates the
datasets to reflect current schema and default data. At the very
least, one change will always occur -- the contents of table
DATABASE_VERSION is updated to a higher version number.

* The upgrade procedure
** Loads the dataset into a fresh database using the previous data schema.
** Uses the Mifos application's initialization procedures to upgrade
the schema and apply any data changes needed to bring the data up to
the current version.
** Uses DBUnit to dump the data, replacing the original dataset.

Keith

Jeff Brewster

unread,
Mar 1, 2010, 1:44:50 PM3/1/10
to Mifos software development
> I will summarize what I learned

Keith,

Nicely described, thanks. I've added a link to this information on the
overall writing acceptance test wiki page -
http://www.mifos.org/developers/wiki/WritingAcceptanceTests.

Regards,
Jeff

Reply all
Reply to author
Forward
0 new messages