I extended the replacement data set to allow for dynamic replacement. Instead of replacing keys in the data with values from a Map this passes values in the dataset to a function (registered with that table and column) and replaces the values with the results of the function. The function is passed the original value and a reference to the ITable object so it can grab values from other columns. I use this to replace dates in my dataset with new dates that are timeshifted to new point in time. Thanks for keeping up the good work. Hope this helps someone else. I'll upload my code. It is all new files with no changes to existing files.
dbunit: 5c487f4588dde20ccd40cbec
dbunit: 5c51c8c4860ca8723ac53c27
I have another approach to this issue that I've been hoping to add to DbUnit shortly, using a IValueReplacer interface. It might be simpler and more generic than this approach. We should review them both.
svn patch file of changes. compiles with jdk 1.4
added dbunit-dynamic-replacement-dataset-patch.txt which is a svn patch file. Also I took out the jdk 1.5 stuff I had. Added a test case too.
I think if we put any of this kind of generic replacement dataset into the sources (the proposed one or Johns) we should also rewrite the internals of the old ReplacementDataSet to use this new functionality. This avoids redundant code and improves reusability.
I'd vote +1 for this feature.
rgds,
matthias