From: Jeff J. <jef...@us...> - 2006-04-17 01:44:35
|
jeffjensen 06/04/16 18:44:33 Modified: dbunit/xdocs goals.xml changes.xml properties.xml dbunit project.xml plugin.properties plugin.jelly Log: Implemented optional lists of tables and queries that dictate data exported in generate-dataset. Added more properties that dbUnit supports. Updated docs for new new features and properties. Corrected a couple of minor doc errors/misc cleanup. Added 'Default Value' column to properties doc. Revision Changes Path 1.11 +5 -5 maven-plugins/dbunit/xdocs/goals.xml Index: goals.xml =================================================================== RCS file: /cvsroot/maven-plugins/maven-plugins/dbunit/xdocs/goals.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- goals.xml 5 Aug 2004 01:13:36 -0000 1.10 +++ goals.xml 17 Apr 2006 01:44:33 -0000 1.11 @@ -9,11 +9,11 @@ <goals> <goal> <name>dbunit</name> - <description>generate dataset and dtd for connection</description> + <description>Generate dataset and DTD for connection.</description> </goal> <goal> <name>dbunit:delete-dataset</name> - <description>Import a dbunit dataset</description> + <description>Delete a dbunit dataset for a connection.</description> </goal> <goal> <name>dbunit:export-xls</name> @@ -33,15 +33,15 @@ </goal> <goal> <name>dbunit:generate-dataset</name> - <description>Generate a dbunit dataset for a connection</description> + <description>Generate a dbunit dataset for a connection.</description> </goal> <goal> <name>dbunit:generate-dtd</name> - <description>Generate a dbunit dtd for a connection</description> + <description>Generate a dbunit dtd for a connection.</description> </goal> <goal> <name>dbunit:import-dataset</name> - <description>Import a dbunit dataset</description> + <description>Import a dbunit dataset.</description> </goal> <goal> <name>dbunit:import-xls</name> 1.22 +5 -1 maven-plugins/dbunit/xdocs/changes.xml Index: changes.xml =================================================================== RCS file: /cvsroot/maven-plugins/maven-plugins/dbunit/xdocs/changes.xml,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- changes.xml 22 Jun 2005 12:20:11 -0000 1.21 +++ changes.xml 17 Apr 2006 01:44:33 -0000 1.22 @@ -6,9 +6,13 @@ <author email="dio...@so...">dIon Gillard</author> </properties> <body> + <release version="1.7-SNAPSHOT" date="2006-04-18" + description="Implemented optional lists of tables and queries that dictate data exported in generate-dataset. Added more properties that dbUnit supports. Updated docs for new new features and properties. Corrected a couple of minor doc errors/misc cleanup. Added 'Default Value' column to properties doc."> + <action dev="jeffjensen" type="add" issue="1406821">Support specifying tables and queries for export.</action> + </release> <release version="1.6" date="2005-06-22"> <action dev="diongillard" type="add" due-to="Josh Holtzman">Order tables on export.</action> - <action dev="dep4b" type="fix" due-to="Fabrizio Giustina" issue="1159028">Support mssql operations and warning for invalid values</action> + <action dev="dep4b" type="fix" due-to="Fabrizio Giustina" issue="1159028">Support mssql operations and warning for invalid values.</action> </release> <release version="1.5" date="2004-08-27"> <action dev="diongillard" type="fix">Use version of POI used with dbunit 2.1</action> 1.9 +149 -8 maven-plugins/dbunit/xdocs/properties.xml Index: properties.xml =================================================================== RCS file: /cvsroot/maven-plugins/maven-plugins/dbunit/xdocs/properties.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- properties.xml 1 Aug 2004 11:54:08 -0000 1.8 +++ properties.xml 17 Apr 2006 01:44:33 -0000 1.9 @@ -7,44 +7,50 @@ </properties> <body> <section name="Maven Dbunit Plug-in Settings"> + <p>This is a summary of the plugin's supported dbUnit properties. + Refer to the dbUnit ant task properties page for more details.</p> <table> <tr> <th>Property</th> <th>Optional?</th> <th>Description</th> + <th>Default Value</th> </tr> <tr> <td>maven.dbunit.deleteType</td> <td>Yes</td> <td> <p> - DbUnit operation type for delete. Default is <code>DELETE</code> + DbUnit operation type for delete. </p> </td> + <td><code>DELETE</code></td> </tr> <tr> <td>maven.dbunit.driverClassName</td> <td>Yes</td> <td> - <p>The class name of the JDBC driver to be used. Default value is empty.</p> + <p>The class name of the JDBC driver to be used.</p> </td> + <td>(none)</td> </tr> <tr> <td>maven.dbunit.format</td> <td>Yes</td> <td> <p> - Format for the import/delete functionality. Default is <code>xml</code>. Alternatively you + Format for the import/delete functionality. Alternatively you could specify <code>flat or csv</code>. </p> </td> + <td><code>xml</code></td> </tr> <tr> <td>maven.dbunit.importType</td> <td>Yes</td> <td> <p> - DbUnit operation type for import. Default is <code>INSERT</code>. Other valid + DbUnit operation type for import. Other valid values are: <code> UPDATE, INSERT, DELETE, DELETE_ALL, REFRESH, CLEAN_INSERT, @@ -52,36 +58,171 @@ </code> </p> </td> + <td><code>INSERT</code></td> </tr> <tr> <td>maven.dbunit.password</td> <td>Yes</td> <td> - <p>The password of the user connecting to the database. Default value is empty.</p> + <p>The password of the user connecting to the database.</p> </td> + <td>(none)</td> </tr> <tr> <td>maven.dbunit.schema</td> <td>Yes</td> <td> The schema name that tables can be found under. - <p>Default value is blank.</p> </td> + <td>(none)</td> </tr> <tr> <td>maven.dbunit.url</td> <td>Yes</td> <td> <p>The JDBC URL for the database to access, e.g. <code>jdbc:db2:SAMPLE</code>. - Default value is empty.</p> + </p> </td> + <td>(none)</td> </tr> <tr> <td>maven.dbunit.user</td> <td>Yes</td> <td> - <p>The user name used to connect to the database. The default value is empty.</p> + <p>The user name used to connect to the database.</p> + </td> + <td>(none)</td> + </tr> + + + <tr> + <td>maven.dbunit.datatypeFactory</td> + <td>Yes</td> + <td> + <p> + Set the DataType factory to add support for non-standard + database vendor data types. + </p> + </td> + <td>dbUnit's default value</td> + </tr> + <tr> + <td>maven.dbunit.useQualifiedTableNames</td> + <td>Yes</td> + <td> + <p> + Enable or disable multiple schemas support by prefixing table + names with the schema name. + </p> + </td> + <td>false</td> + </tr> + <tr> + <td>maven.dbunit.dest.dir</td> + <td>Yes</td> + <td> + <p>Directory to write the exported data file to.</p> + </td> + <td>${maven.build.dir}/dbunit</td> + </tr> + <tr> + <td>maven.dbunit.dest.file</td> + <td>Yes</td> + <td> + <p>File name of the exported data file.</p> + </td> + <td>${maven.dbunit.dest.dir}/all.xml</td> + </tr> + <tr> + <td>maven.dbunit.table.list</td> + <td>Yes</td> + <td> + <p> + Delimeter separated list of table names + (see maven.dbunit.table.list.delim). + Currently only used in generate-dataset to list the tables to + export all data from + (if tables or queries are not specified, exports all data from all tables). + For example: <code>table1,table2,table3</code> + </p> + </td> + <td>(none)</td> + </tr> + <tr> + <td>maven.dbunit.table.list.delim</td> + <td>Yes</td> + <td> + <p> + Table name delimeter for list of tables specified in + maven.dbunit.table.list. + </p> + </td> + <td>, (comma)</td> + </tr> + <tr> + <td>maven.dbunit.query.list</td> + <td>Yes</td> + <td> + <p> + Delimeter separated list of query names + (see maven.dbunit.query.list.delim). + Currently only used in generate-dataset to list the queries to + use to export specific data from + (if tables or queries are not specified, exports all data from all tables). + For example: <code>qry1,qry2,qry3</code> + </p> + <p> + For every query listed, it expects 2 additional properties: + <dl> + <dt>(queryname).name</dt> + <dd>Name to use to refer to the sql statement.</dd> + <dt>(queryname).sql</dt> + <dd>SQL to execute to select the data for export.</dd> + </dl> + </p> + <p> + For example, to pull the rows from COMPANY and PERSON tables + for a user_id field of "dbunit": +<source> +maven.dbunit.query.list=company,person +company.name=COMPANY +company.sql=select * from person where user_id = 'dbunit' +person.name=PERSON +person.sql=select * from person where user_id = 'dbunit' +</source> + </p> + </td> + <td>(none)</td> + </tr> + <tr> + <td>maven.dbunit.query.list.delim</td> + <td>Yes</td> + <td> + <p> + Query name delimeter for list of queries specified in + maven.dbunit.query.list. + </p> + </td> + <td>, (comma)</td> + </tr> + <tr> + <td>maven.dbunit.verbose.level</td> + <td>Yes</td> + <td> + <p>The level of runtime messages to display.</p> + <p> + Valid values: + <dl> + <dt>0</dt> + <dd>Specify minimum messages.</dd> + <dt>1</dt> + <dd>Specify medium level messages (e.g. summary info).</dd> + <dt>2</dt> + <dd>Specify detailed level messages (e.g. debug)</dd> + </dl> + </p> </td> + <td>0</td> </tr> </table> </section> 1.36 +14 -1 maven-plugins/dbunit/project.xml Index: project.xml =================================================================== RCS file: /cvsroot/maven-plugins/maven-plugins/dbunit/project.xml,v retrieving revision 1.35 retrieving revision 1.36 diff -u -r1.35 -r1.36 --- project.xml 11 Oct 2005 06:29:04 -0000 1.35 +++ project.xml 17 Apr 2006 01:44:33 -0000 1.36 @@ -8,7 +8,7 @@ <name>Dbunit Plug-in</name> <!-- groupId is in parent --> - <currentVersion>1.6</currentVersion> + <currentVersion>1.7-SNAPSHOT</currentVersion> <!-- organization is in parent --> <inceptionYear>2003</inceptionYear> @@ -57,6 +57,10 @@ <name>1.6</name> <tag>MAVEN_PLUGINS_DBUNIT_1_6</tag> </version> + <version> + <id>1.7-SNAPSHOT</id> + <name>1.7-SNAPSHOT</name> + </version> </versions> <!-- mailingLists is in parent --> @@ -79,6 +83,15 @@ <role>Developer</role> </roles> </developer> + <developer> + <name>Jeff Jensen</name> + <id>jeffjensen</id> + <email>jef...@us...</email> + <organization>Sourceforge</organization> + <roles> + <role>Developer</role> + </roles> + </developer> </developers> <!-- no contributors --> <!-- licenses section not done yet --> 1.5 +10 -1 maven-plugins/dbunit/plugin.properties Index: plugin.properties =================================================================== RCS file: /cvsroot/maven-plugins/maven-plugins/dbunit/plugin.properties,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- plugin.properties 25 Apr 2004 16:43:57 -0000 1.4 +++ plugin.properties 17 Apr 2006 01:44:33 -0000 1.5 @@ -8,4 +8,13 @@ maven.dbunit.format=xml maven.dbunit.importType=INSERT maven.dbunit.deleteType=DELETE -#maven.dbunit.schema= \ No newline at end of file +#maven.dbunit.schema= +#maven.dbunit.datatypeFactory= +maven.dbunit.useQualifiedTableNames=false +maven.dbunit.dest.dir=${maven.build.dir}/dbunit +maven.dbunit.dest.file=${maven.dbunit.dest.dir}/all.xml +maven.dbunit.table.list= +maven.dbunit.table.list.delim=, +maven.dbunit.query.list= +maven.dbunit.query.list.delim=, +maven.dbunit.verbose.level=0 1.15 +61 -7 maven-plugins/dbunit/plugin.jelly Index: plugin.jelly =================================================================== RCS file: /cvsroot/maven-plugins/maven-plugins/dbunit/plugin.jelly,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- plugin.jelly 2 Aug 2004 00:48:01 -0000 1.14 +++ plugin.jelly 17 Apr 2006 01:44:33 -0000 1.15 @@ -1,8 +1,9 @@ <?xml version="1.0"?> -<project +<project xmlns:j="jelly:core" - xmlns:ant="jelly:ant"> + xmlns:ant="jelly:ant" + xmlns:u="jelly:util"> <goal name="dbunit:init"> <taskdef name="dbunit" classname="org.dbunit.ant.DbUnitTask"> @@ -14,8 +15,9 @@ </classpath> </taskdef> <j:set var="schema" value="${maven.dbunit.schema}"/> + <j:set var="datatypeFactory" value="${maven.dbunit.datatypeFactory}"/> </goal> - + <goal name="dbunit" description="generate dataset and dtd for connection" prereqs="dbunit:generate-dtd,dbunit:generate-dataset"/> @@ -39,15 +41,67 @@ description="Generate a dbunit dataset for a connection"> <!-- fixme - this should be a tag lib --> - <ant:mkdir dir="${maven.build.dir}/dbunit/" /> + <ant:mkdir dir="${maven.dbunit.dest.dir}" /> <dbunit driver="${maven.dbunit.driverClassName}" url="${maven.dbunit.url}" userid="${maven.dbunit.user}" - password="${maven.dbunit.password}"> + password="${maven.dbunit.password}" + useQualifiedTableNames="${maven.dbunit.useQualifiedTableNames}" + > <j:if test="${!empty(schema)}"> <setProperty name="schema" value="${schema}"/> </j:if> - <export dest="${maven.build.dir}/dbunit/all.xml" format="${maven.dbunit.format}"/> + + <j:if test="${!empty(datatypeFactory)}"> + <setProperty name="datatypeFactory" value="${datatypeFactory}"/> + </j:if> + + <export dest="${maven.dbunit.dest.dir}/${maven.dbunit.dest.filename}" format="${maven.dbunit.format}"> + <j:if test="${!empty(maven.dbunit.table.list)}"> + <j:if test="${maven.dbunit.verbose.level > 0}"> + <ant:echo>Using table list=${maven.dbunit.table.list}</ant:echo> + </j:if> + <u:tokenize var="items" delim="${maven.dbunit.table.list.delim}"> + ${maven.dbunit.table.list} + </u:tokenize> + <j:forEach var="item" items="${items}"> + <j:if test="${maven.dbunit.verbose.level > 1}"> + <ant:echo>Adding table='${item}'</ant:echo> + </j:if> + <table name="${item}"/> + </j:forEach> + </j:if> + + <j:if test="${!empty(maven.dbunit.query.list)}"> + <j:if test="${maven.dbunit.verbose.level > 0}"> + <ant:echo>Using query list=${maven.dbunit.query.list}</ant:echo> + </j:if> + <u:tokenize var="items" delim="${maven.dbunit.query.list.delim}"> + ${maven.dbunit.query.list} + </u:tokenize> + <j:forEach var="item" items="${items}"> + <j:set var="query.prop.name" value="${item}.name"/> + <j:set var="query.prop.sql" value="${item}.sql"/> + + <!-- get value of variable held in the 'query' variable --> + <j:set var="query.name" value="${context.getVariable(query.prop.name)}"/> + <j:set var="query.sql" value="${context.getVariable(query.prop.sql)}"/> + + <j:if test="${maven.dbunit.verbose.level > 1}"> + <ant:echo>For '${item}', adding query name='${query.name}' sql='${query.sql}'</ant:echo> + </j:if> + + <j:if test="${empty(query.name)}"> + <ant:echo>ERROR: Did not find '${query.prop.name}' in properties!</ant:echo> + </j:if> + <j:if test="${empty(query.sql)}"> + <ant:echo>ERROR: Did not find '${query.prop.sql}' in properties!</ant:echo> + </j:if> + + <query name="${query.name}" sql="${query.sql}"/> + </j:forEach> + </j:if> + </export> </dbunit> </goal> @@ -88,7 +142,7 @@ <operation type="${maven.dbunit.deleteType}" src="${file}" format="${maven.dbunit.format}" /> </dbunit> </goal> - + <goal name="dbunit:export-xls"> <ant:mkdir dir="${maven.build.dir}/dbunit/" /> <j:useBean var="tool" class="net.sourceforge.mavenplugins.dbunit.DataSetTool" |