Allow replacements to be added to each configuration
----------------------------------------------------

                 Key: MDBUNIT-22
                 URL: http://jira.codehaus.org/browse/MDBUNIT-22
             Project: Maven DbUnit Plugin
          Issue Type: New Feature
    Affects Versions: 1.0
            Reporter: Darren Bell
             Fix For: 1.0


DBUnit allows the creation of a replacement dataset.  We make use of these 
throughout or unit testing.

We could have the following:

{noformat}
  <execution>
    <id>insert</id>
    <phase>test</phase>
    <goals>
      <goal>operation</goal>
    </goals>
    <configuration>
      <type>INSERT</type>
      <format>flat</format>
      <sources>
        
<source>src/test/resources/datasets/distribution-media.dataset.xml</source>
        <source>src/test/resources/datasets/carrier.dataset.xml</source>
      </sources>
      <replacements>
        <replacement>
          <key>[YES]</key>
          <value>1</value>
        </replacement>
        <replacement>
          <key>[NO]</key>
          <value>0</value>
        </replacement>
    </configuration>
  </execution>
{noformat}

Another way is to provide a replacement file parameter which could be just a 
property file of keys and values:

{noformat}
  
<replacementProperties>src/test/resources/dbunit-replacements.properties</replacementProperties>
{noformat}

{noformat}
## replacement values:
dbunit.replace.YES=1
dbunit.replace.NO=0
dbunit.replace.DATE=CURRENT_TIME
dbunit.replace.TIMESTAMP=CURRENT_TIMESTAMP
{noformat}

I actually prefer the properties file approach as we could then use this in our 
unit tests.  the *CURRENT_DATE* and *CURRENT_TIMESTAMP* can be supplied 
constants that the plugin would look for.  These of course would be formatted 
correctly according to the dataTypeFactoryName parameter.

I had a look at the code, but this requires a change to the dbunit ant plugin.

If this is in the wrong place, then let me know.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to