[
http://jira.jboss.com/jira/browse/JBSEAM-2602?page=comments#action_12399058 ]
Siarhei Dudzin commented on JBSEAM-2602:
----------------------------------------
Ok, I think I might know where the default format as 'flat' is coming from in
Seam.
As you already know dbunit supports two data formats: flat and xml (actually flat is also
an xml-like format but it's somewhat closer to insert statements and also more
compact).
Apparently when performing data export with *ant tasks* it uses "flat" format as
default (which is I guess why flat format was chosen for Seam). See section
"Parameters specified as nested elements" at
http://www.dbunit.org/anttask.html
At the same time there is a maven2 plugin, which also can perform export but for some
reason the default format is "xml":
http://mojo.codehaus.org/dbunit-maven-plugin/export-mojo.html#format
While Seam reference does not specify in which format the mock data should be used I
(naively) used the default format my build system used (Maven 2). Further, when trying to
use this exported file in Seam Integration Tests (just as specified in the examples)
DbUnit was just throwing "NoSuchTableException: null" without a word on wrong
data format.
org.jboss.seam.mock.DBUnitSeamTest uses FlatXmlDataSet in "public
DataSetOperation(String dataSetLocation, DatabaseOperation operation)". DbUnit itself
also isn't doing much error handling and simply throws "NoSuchTableException:
null" if 'xml' data format is fed to FlatXmlDataSet.
As soon as I changed format to flat the problem was gone.
While I am not going to argue which format is better as a default (actually flat looks
more compact) I thought it may be a good idea at least to mention in the reference which
data format should be used or even allow usage of both formats.
Pete, is this enough for the reference or did you mean something else?
Document use of flat dataset file in the Seam reference
-------------------------------------------------------
Key: JBSEAM-2602
URL:
http://jira.jboss.com/jira/browse/JBSEAM-2602
Project: JBoss Seam
Issue Type: Bug
Components: Test Harness
Affects Versions: 2.0.1.GA
Reporter: Siarhei Dudzin
Fix For: 2.1.0.GA
"33.3.2. Integration Testing with Mock Data" specifies usage of dataset
exported with the help of dbunit.
Considering that maven uses xml export format by default and Seam uses FlatXml (just
'flat' in case of maven configuration) format this may cause confusion (DbUnit
just throws NoSuchTableException which is difficult to trace). Either changing
DataSetOperation to use XMLDataSet (so that default format would be used) or explicitly
documenting that flat data format is used for export is necessary.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira