You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(5) |
Jul
(7) |
Aug
(37) |
Sep
|
Oct
|
Nov
(1) |
Dec
(22) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(8) |
Feb
(68) |
Mar
(72) |
Apr
(149) |
May
(32) |
Jun
(46) |
Jul
(26) |
Aug
(59) |
Sep
(25) |
Oct
(18) |
Nov
(4) |
Dec
(3) |
2004 |
Jan
(90) |
Feb
(19) |
Mar
(38) |
Apr
(41) |
May
(44) |
Jun
(2) |
Jul
(10) |
Aug
|
Sep
(14) |
Oct
|
Nov
(1) |
Dec
|
2005 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(15) |
Jun
(1) |
Jul
|
Aug
(9) |
Sep
|
Oct
(17) |
Nov
|
Dec
|
2006 |
Jan
(1) |
Feb
(16) |
Mar
|
Apr
(1) |
May
(48) |
Jun
|
Jul
(2) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(29) |
2007 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
(23) |
Mar
(31) |
Apr
|
May
(26) |
Jun
(6) |
Jul
(1) |
Aug
|
Sep
(7) |
Oct
(1) |
Nov
(8) |
Dec
(8) |
2009 |
Jan
(5) |
Feb
(9) |
Mar
(1) |
Apr
|
May
(23) |
Jun
(3) |
Jul
|
Aug
(1) |
Sep
(9) |
Oct
(28) |
Nov
(18) |
Dec
(8) |
2010 |
Jan
(19) |
Feb
(24) |
Mar
(3) |
Apr
|
May
(5) |
Jun
(4) |
Jul
|
Aug
(1) |
Sep
(11) |
Oct
|
Nov
(2) |
Dec
(1) |
2011 |
Jan
|
Feb
(7) |
Mar
|
Apr
(6) |
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(32) |
Oct
(6) |
Nov
|
Dec
|
Update of /cvsroot/dbunit/dbunit/docs/sample_webtest In directory sc8-pr-cvs1:/tmp/cvs-serv2053 Added Files: build.properties build.xml sharedConfiguration.xml subscribeEmailAddressWithOptedOutEmail.xml TestSuiteEDM.xml Log Message: Supporting sample files for Howto on DbUnit and WebTest --- NEW FILE: build.properties --- # The webserver that you will be point WebTest at web.server=localhost # Standard WebTest configuration. host=${web.server} port=80 protocol=http basepath= showhtmlparseroutput=no resultpath=result resultfile=WebTestResults.xml # How to find the WebTest libraries webtest.home=c:/java/test/canoo start.page=default.asp r.page=r.asp # How to find the DbUnit libraries dbunit.classpath=C:/java/test/dbunit-1.3/dbunit/lib/ # The sql server that you will be updating with DbUnit. sql.server=trujillo #sql.server login sql.user=MySQLUser sql.password=MySQLPassword sql.database=MyWebSite sql.jdbcdriver = com.microsoft.jdbc.sqlserver.SQLServerDriver sql.url =jdbc:microsoft:sqlserver://${sql.server}:1433;DatabaseName=${sql.database};SelectMethod=cursor sql.username =${sql.user} --- NEW FILE: build.xml --- <!-- Sample Created by David Eric Pugh. Free for all! de...@ya... --> <project name="TestSuite" default="test"> <!-- Allow any user specific values to override the defaults --> <property file="${user.home}/build.properties" /> <property file="project.properties"/> <property file="build.properties"/> <property name="resultfile" value="WebTestResults.xml"/> <property name="resultfile.txt" value="WebTestResults.txt"/> <property name="resultfile.html" value="WebTestResults.html"/> <property name="start.page" value="menu.jsp"/> <property name="base.dir" value="${basedir}"/> <taskdef name="testSpec" classname="com.canoo.webtest.ant.TestSpecificationTask"> <classpath> <pathelement location="${webtest.home}/classes"/> <fileset dir="${webtest.home}" includes="**/lib/*.jar"/> </classpath> </taskdef> <taskdef name="dbunit" classname="org.dbunit.ant.DbUnitTask"> <classpath> <fileset dir="${dbunit.classpath}" includes="dbunit.jar"/> <fileset dir="${dbunit.classpath}" includes="exml.jar"/> </classpath> </taskdef> <target name="test" depends="prepareResultDir,init" description="run all the tests"> <echo> Executing ALL testcases Webserver: ${web.server} Database: ${sql.server}/${sql.database} </echo> <ant antFile="TestSuiteEDM.xml"/> <echo>Finished testSuiteEDM for SniffTest.</echo> <ant antFile="TestSuiteSeachEngineFriendlyURLs.xml"/> <echo>Finished testSuiteSearchEngineFriendlyURLs for SniffTest.</echo> <ant antFile="TestSuiteSkuStartsWith.xml"/> <echo>Finished TestSuiteSkuStartsWith for SniffTest.</echo> <echo>Finished All Test Suites.</echo> <antcall target="CreateSummaryReport"/> </target> <target name="test:single" depends="prepareResultDir,init" description="run a single test in a suite, passed in via -Dtestcase -Dsuite"> <echo> Executing testcase ${testcase} for suite ${suite}. </echo> <ant target="${testcase}" antFile="${suite}"/> <antcall target="CreateSummaryReport"/> </target> <target name="test:suite" depends="prepareResultDir,init" description="run a single suite, passed in via -Dsuite"> <echo> Executing suite: ${suite} </echo> <ant antFile="${suite}"/> <antcall target="CreateSummaryReport"/> </target> <target name="CreateSummaryReport"> <copy file="${webtest.home}/template/report.css" todir="${resultpath}"/> <copy file="${webtest.home}/template/Services.css" todir="${resultpath}"/> <copy file="${resultpath}/${resultfile}" todir="${base.dir}"/> <copy file="${webtest.home}/template/WebTestReport.xml" todir="${base.dir}"/> <tstamp> <format property="report.time" pattern="dd.MM.yyyy hh:mm:ss"/> </tstamp> <ant antfile="${webtest.home}/template/ApplyXSL.xml" target="applySingle"> <!-- report.time already set --> <property name="resultpath" value="${base.dir}"/> <property name="resultfile" value="WebTestReport.xml"/> <property name="resultfile.html" value="TestResultOverview.html"/> <property name="style" value="${webtest.home}/template/WebTestReport.xsl"/> </ant> <move file="${base.dir}/TestResultOverview.html" todir="${resultpath}"/> <delete file="${base.dir}/${resultfile}" /> <delete file="${base.dir}/WebTestReport.xml" /> </target> <target name="prepareResultDir"> <mkdir dir="${resultpath}"/> <delete file="${resultpath}/${resultfile}"/> <delete file="${resultpath}/_resultCore.xml"/> <delete file="${resultpath}/${resultfile.txt}"/> <delete file="${resultpath}/${resultfile.html}"/> <delete file="${resultfile}"/> <delete> <fileset dir="${resultpath}" includes="*.html"/> </delete> </target> <target name="com.canoo.webtest.AllTests"> <junit> <classpath> <pathelement location="${webtest.home}/classes"/> <fileset dir="${webtest.home}" includes="**/lib/*.jar"/> </classpath> <test name="com.canoo.webtest.AllTests"/> </junit> </target> <target name="com.canoo.webtest.reporting.XmlReporterTest"> <junit> <classpath> <pathelement location="${webtest.home}/classes"/> <fileset dir="${webtest.home}" includes="**/lib/*.jar"/> <fileset dir="${webtest.home}" includes="${lib.repo}/*.jar"/> </classpath> <test name="com.canoo.webtest.reporting.XmlReporterTest"/> </junit> </target> <target name="init"> <echo> Running Tests against: web.server=${web.server} sql.server=${sql.server} </echo> </target> </project> --- NEW FILE: sharedConfiguration.xml --- <!-- Shared Configuration for the WebTest --> <config host="${host}" port="${port}" protocol="${protocol}" basepath="${basepath}" summary="true" verbose="true" saveresponse="true" resultpath="${resultpath}" resultfile="${resultfile}" haltonfailure="false" showhtmlparseroutput="false" /> --- NEW FILE: subscribeEmailAddressWithOptedOutEmail.xml --- <dataset> <EMAIL EMAIL_ID='1' EMAIL='sub...@te...' OPTIN='0'/> </dataset> --- NEW FILE: TestSuiteEDM.xml --- <!DOCTYPE project [ <!ENTITY sharedConfiguration SYSTEM "./includes/sharedConfiguration.xml"> <!ENTITY invokeHome SYSTEM "file:./includes/invokeHome.xml"> ]> <project name="TestSuiteEDM" default="testSuite"> <!-- Allow any user specific values to override the defaults --> <property file="${user.home}/build.properties" /> <property file="project.properties"/> <property file="build.properties"/> <property name="resultfile" value="WebTestResults.xml"/> <property name="resultfile.txt" value="WebTestResults.txt"/> <property name="resultfile.html" value="WebTestResults.html"/> <property name="start.page" value="menu.jsp"/> <property name="base.dir" value="${basedir}"/> <taskdef name="dbunit" classname="org.dbunit.ant.DbUnitTask"> <classpath> <fileset dir="${dbunit.classpath}" includes="dbunit.jar"/> <fileset dir="${dbunit.classpath}" includes="exml.jar"/> </classpath> </taskdef> <target name="testSuite"> <antcall target="sniffTest"/> <antcall target="userWithNoRedirectionID"/> <antcall target="userWithRedirectionIDOldStyle"/> <antcall target="userWithRedirectionID"/> <antcall target="userWithRedirectionIDBadEmailOldStyle"/> <antcall target="userWithRedirectionIDBadEmail"/> <antcall target="userWithExistingEmailAddress"/> <antcall target="userWithExistingEmailAddressOldStyle"/> <antcall target="userWithNewEmailAddress"/> <antcall target="userWithNewEmailAddressOldStyle"/> <antcall target="userWithCampaignId"/> <antcall target="userWithEverythingRedirectToProduct"/> <antcall target="userWithEverythingRedirectToProductOldStyle"/> <antcall target="redirectToExternalWebsite"/> <antcall target="redirectToExternalWebsiteOldStyle"/> <antcall target="redirectionURLEndingInSlash"/> <antcall target="unsubscribeWithBadEmailId"/> <antcall target="unsubscribeWithNoParameters"/> <antcall target="unsubscribeWithInvalidEmail"/> <antcall target="unsubscribeEmailAddressWithEmail"/> <antcall target="unsubscribeEmailAddressWithEmailID"/> <antcall target="unsubscribeEmailAddressWithNewEmailAddress"/> <antcall target="subscribeEmailAddressWithOptedOutEmail"/> <antcall target="subscribeEmailAddressWithNewEmailAddress"/> <antcall target="subscribeEmailAddressWithInvalidEmailAddress"/> <antcall target="productWithCustomCOAHeader"/> <!-- NO PRODUCT CURRENTLY AVAILABLE <antcall target="productWithPartnerLink"/> --> </target> <target name="userWithNoRedirectionID"> <testSpec name="userWithNoRedirectionID"> &sharedConfiguration; <steps> <invoke stepid="main page" url="${r.page}" save="userWithNoRedirectionID"/> <verifytext stepid="Make sure we are on the homepage" text="Our Newest Product Releases"/> </steps> </testSpec> </target> <target name="userWithRedirectionIDOldStyle"> <dbunit driver="${sql.jdbcdriver}" url="${sql.url}" userid="${sql.username}" password="${sql.password}"> <operation type="MSSQL_REFRESH" src="data/userWithRedirectionID.xml" format="flat"/> </dbunit> <testSpec name="userWithRedirectionIDOldStyle"> &sharedConfiguration; <steps> <invoke stepid="main page" url="${r.page}?r=1" save="userWithRedirectionID"/> <verifytext stepid="Make sure we are redirected to the upstate info page" text="Upstate develops the most innovative products"/> </steps> </testSpec> </target> <target name="userWithRedirectionID"> <dbunit driver="${sql.jdbcdriver}" url="${sql.url}" userid="${sql.username}" password="${sql.password}"> <operation type="MSSQL_REFRESH" src="data/userWithRedirectionID.xml" format="flat"/> </dbunit> <testSpec name="userWithRedirectionID"> &sharedConfiguration; <steps> <invoke stepid="main page" url="r.q.r.e.1" save="userWithRedirectionID"/> <verifytext stepid="Make sure we are redirected to the upstate info page" text="Upstate develops the most innovative products"/> </steps> </testSpec> </target> <target name="userWithRedirectionIDBadEmail"> <dbunit driver="${sql.jdbcdriver}" url="${sql.url}" userid="${sql.username}" password="${sql.password}"> <operation type="MSSQL_REFRESH" src="data/userWithRedirectionIDBadEmail.xml" format="flat"/> </dbunit> <testSpec name="userWithRedirectionIDBadEmail"> &sharedConfiguration; <steps> <invoke stepid="main page" url="/r.q.r.e.1.a.e.e.userWithRedirectionIDBadEmail" save="userWithRedirectionIDBadEmail"/> <verifytext stepid="Make sure we are redirected to the upstate info page despite the bad email" text="Upstate develops the most innovative products"/> </steps> </testSpec> </target> <target name="userWithRedirectionIDBadEmailOldStyle"> <dbunit driver="${sql.jdbcdriver}" url="${sql.url}" userid="${sql.username}" password="${sql.password}"> <operation type="MSSQL_REFRESH" src="data/userWithRedirectionIDBadEmail.xml" format="flat"/> </dbunit> <testSpec name="userWithRedirectionIDBadEmailOldStyle"> &sharedConfiguration; <steps> <invoke stepid="main page" url="${r.page}?r=1&e=userWithRedirectionIDBadEmail" save="userWithRedirectionIDBadEmail"/> <verifytext stepid="Make sure we are redirected to the upstate info page despite the bad email" text="Upstate develops the most innovative products"/> </steps> </testSpec> </target> <target name="redirectionURLEndingInSlash"> <dbunit driver="${sql.jdbcdriver}" url="${sql.url}" userid="${sql.username}" password="${sql.password}"> <operation type="MSSQL_REFRESH" src="data/redirectionURLEndingInSlash.xml" format="flat"/> </dbunit> <testSpec name="redirectionURLEndingInSlash"> &sharedConfiguration; <steps> <invoke stepid="redirection url ending in a slash" url="${r.page}?r=1/" save="redirectionURLEndingInSlash"/> <verifytext stepid="Make sure we are redirected to the upstate info page" text="Upstate develops the most innovative products"/> </steps> </testSpec> </target> <target name="userWithExistingEmailAddressOldStyle"> <dbunit driver="${sql.jdbcdriver}" url="${sql.url}" userid="${sql.username}" password="${sql.password}"> <operation type="MSSQL_REFRESH" src="data/userWithExistingEmailAddress.xml" format="flat"/> </dbunit> <testSpec name="userWithExistingEmailAddressOldStyle"> &sharedConfiguration; <steps> <invoke stepid="main page" url="${r.page}?r=1&e=1" save="userWithExistingEmailAddress"/> <verifytext stepid="Make sure we are redirected to the upstate info page" text="Upstate develops the most innovative products"/> </steps> </testSpec> </target> <target name="userWithExistingEmailAddress"> <dbunit driver="${sql.jdbcdriver}" url="${sql.url}" userid="${sql.username}" password="${sql.password}"> <operation type="MSSQL_REFRESH" src="data/userWithExistingEmailAddress.xml" format="flat"/> </dbunit> <testSpec name="userWithExistingEmailAddress"> &sharedConfiguration; <steps> <invoke stepid="main page" url="/r.q.r.e.1.a.e.e.1" save="userWithExistingEmailAddress"/> <verifytext stepid="Make sure we are redirected to the upstate info page" text="Upstate develops the most innovative products"/> </steps> </testSpec> </target> <target name="userWithNewEmailAddress"> <testSpec name="userWithNewEmailAddress"> &sharedConfiguration; <steps> <invoke stepid="main page" url="/r.q...@te....a.r.e.1" save="userWithNewEmailAddress"/> <verifytext stepid="Make sure we are redirected to the upstate info page" text="Upstate develops the most innovative products"/> </steps> </testSpec> </target> <target name="userWithNewEmailAddressOldStyle"> <testSpec name="userWithNewEmailAddressOldStyle"> &sharedConfiguration; <steps> <invoke stepid="main page" url="${r.page}?e=te...@te...&r=1" save="userWithNewEmailAddressOldStyle"/> <verifytext stepid="Make sure we are redirected to the upstate info page" text="Upstate develops the most innovative products"/> </steps> </testSpec> </target> <target name="userWithCampaignId"> <dbunit driver="${sql.jdbcdriver}" url="${sql.url}" userid="${sql.username}" password="${sql.password}"> <operation type="MSSQL_REFRESH" src="data/userWithCampaignId.xml" format="flat"/> </dbunit> <testSpec name="userWithCampaignId"> &sharedConfiguration; <steps> <invoke stepid="main page" url="${r.page}?r=1&e=1&c=1" save="userWithCampaignId"/> <verifytext stepid="Make sure we are redirected to the upstate info page" text="Upstate develops the most innovative products"/> </steps> </testSpec> </target> <target name="userWithEverythingRedirectToProduct"> <dbunit driver="${sql.jdbcdriver}" url="${sql.url}" userid="${sql.username}" password="${sql.password}"> <operation type="MSSQL_REFRESH" src="data/userWithEverythingRedirectToProduct.xml" format="flat"/> </dbunit> <testSpec name="userWithEverythingRedirectToProduct"> &sharedConfiguration; <steps> <invoke stepid="main page" url="/r.q.r.e.2.a.e.e.2.a.c.e.2" save="userWithEverythingRedirectToProduct"/> <verifytext stepid="Make sure we are redirected to the Anti-Striatin page" text="Anti-Striatin"/> </steps> </testSpec> </target> <target name="userWithEverythingRedirectToProductOldStyle"> <dbunit driver="${sql.jdbcdriver}" url="${sql.url}" userid="${sql.username}" password="${sql.password}"> <operation type="MSSQL_REFRESH" src="data/userWithEverythingRedirectToProduct.xml" format="flat"/> </dbunit> <testSpec name="userWithEverythingRedirectToProductOldStyle"> &sharedConfiguration; <steps> <invoke stepid="main page" url="${r.page}?r=2&e=2&c=2" save="userWithEverythingRedirectToProductOldStyle"/> <verifytext stepid="Make sure we are redirected to the Anti-Striatin page" text="Anti-Striatin"/> </steps> </testSpec> </target> <target name="redirectToExternalWebsite"> <dbunit driver="${sql.jdbcdriver}" url="${sql.url}" userid="${sql.username}" password="${sql.password}"> <operation type="MSSQL_REFRESH" src="data/redirectToExternalWebsite.xml" format="flat"/> </dbunit> <testSpec name="redirectToExternalWebsite"> &sharedConfiguration; <steps> <invoke stepid="main page" url="${r.page}?r=3" save="redirectToExternalWebsite"/> <verifytext stepid="Make sure we are redirected to the Sun website" text="Sun"/> </steps> </testSpec> </target> <target name="redirectToExternalWebsiteOldStyle"> <dbunit driver="${sql.jdbcdriver}" url="${sql.url}" userid="${sql.username}" password="${sql.password}"> <operation type="MSSQL_REFRESH" src="data/redirectToExternalWebsite.xml" format="flat"/> </dbunit> <testSpec name="redirectToExternalWebsiteOldStyle"> &sharedConfiguration; <steps> <invoke stepid="main page" url="${r.page}?r=3" save="redirectToExternalWebsite"/> <verifytext stepid="Make sure we are redirected to the Sun website" text="Sun"/> </steps> </testSpec> </target> <target name="unsubscribeWithBadEmailId"> <testSpec name="unsubscribeWithBadEmailId"> &sharedConfiguration; <steps> <invoke stepid="main page" url="/edm/unsubscribe.asp?e=9999999" save="unsubscribeWithBadEmailId"/> <verifytext stepid="Make sure we recieved the error message" text="We're sorry, but your email address could not be located."/> </steps> </testSpec> </target> <target name="unsubscribeWithNoParameters"> <testSpec name="unsubscribeWithNoParameters"> &sharedConfiguration; <steps> <invoke stepid="main page" url="/edm/unsubscribe.asp" save="unsubscribeWithNoParameters"/> <verifytext stepid="Make sure we recieved the error message" text="We're sorry, but your email address could not be located."/> </steps> </testSpec> </target> <target name="unsubscribeWithInvalidEmail"> <testSpec name="unsubscribeWithInvalidEmail"> &sharedConfiguration; <steps> <invoke stepid="main page" url="/edm/unsubscribe.asp?e=unsubscribeWithInvalidEmail" save="unsubscribeWithInvalidEmail"/> <verifytext stepid="Make sure we recieved the error message" text="We're sorry, but your email address could not be located."/> </steps> </testSpec> </target> <target name="unsubscribeEmailAddressWithEmail"> <dbunit driver="${sql.jdbcdriver}" url="${sql.url}" userid="${sql.username}" password="${sql.password}"> <operation type="MSSQL_REFRESH" src="data/unsubscribeEmailAddressWithEmail.xml" format="flat"/> </dbunit> <testSpec name="unsubscribeEmailAddress"> &sharedConfiguration; <steps> <invoke stepid="main page" url="/edm/unsubscribe.asp?e=use...@te..." save="unsubscribeEmailAddress"/> <verifytext stepid="Make sure we recieved the success message" text="You have been removed from the Upstate mailing list."/> </steps> </testSpec> </target> <target name="unsubscribeEmailAddressWithEmailID"> <dbunit driver="${sql.jdbcdriver}" url="${sql.url}" userid="${sql.username}" password="${sql.password}"> <operation type="MSSQL_REFRESH" src="data/unsubscribeEmailAddressWithEmailID.xml" format="flat"/> </dbunit> <testSpec name="unsubscribeEmailAddressWithEmailID"> &sharedConfiguration; <steps> <invoke stepid="main page" url="/edm/unsubscribe.asp?e=1" save="unsubscribeEmailAddressWithEmailID"/> <verifytext stepid="Make sure we recieved the success message" text="You have been removed from the Upstate mailing list."/> </steps> </testSpec> </target> <target name="unsubscribeEmailAddressWithNewEmailAddress"> <sql driver="${sql.jdbcdriver}" url="${sql.url}" userid="${sql.username}" password="${sql.password}"> UPDATE email set email='uns...@te...' + convert(varchar(10),email_id) WHERE email='te...@te...' </sql> <testSpec name="unsubscribeEmailAddressWithNewEmailAddress"> &sharedConfiguration; <steps> <invoke stepid="main page" url="/edm/unsubscribe.asp?e=te...@te..." save="unsubscribeEmailAddressWithNewEmailAddress"/> <verifytext stepid="Make sure we recieved the success message" text="You have been removed from the Upstate mailing list."/> </steps> </testSpec> </target> <target name="subscribeEmailAddressWithNewEmailAddress"> <sql driver="${sql.jdbcdriver}" url="${sql.url}" userid="${sql.username}" password="${sql.password}"> UPDATE email set email='sub...@te...' + convert(varchar(10),email_id) WHERE email='te...@te...' </sql> <testSpec name="subscribeEmailAddressWithNewEmailAddress"> &sharedConfiguration; <steps> <invoke stepid="main page" url="/edm/subscribe.asp?e=te...@te..." save="subscribeEmailAddressWithNewEmailAddress"/> <verifytext stepid="Make sure we recieved the success message" text="You have been subscribed to the Upstate mailing list"/> </steps> </testSpec> </target> <target name="subscribeEmailAddressWithOptedOutEmail"> <dbunit driver="${sql.jdbcdriver}" url="${sql.url}" userid="${sql.username}" password="${sql.password}"> <operation type="MSSQL_REFRESH" src="data/subscribeEmailAddressWithOptedOutEmail.xml" format="flat"/> </dbunit> <testSpec name="subscribeEmailAddressWithOptedOutEmail"> &sharedConfiguration; <steps> <invoke stepid="main page" url="/edm/subscribe.asp?e=sub...@te..." save="subscribeEmailAddressWithNewEmailAddress"/> <verifytext stepid="Make sure we recieved the success message" text="You have been subscribed to the Upstate mailing list"/> </steps> </testSpec> </target> <target name="subscribeEmailAddressWithInvalidEmailAddress"> <testSpec name="subscribeEmailAddressWithInvalidEmailAddress"> &sharedConfiguration; <steps> <invoke stepid="main page" url="/edm/subscribe.asp?e=subscribeEmailAddressWithInvalidEmailAddress" save="subscribeEmailAddressWithInvalidEmailAddress"/> <verifytext stepid="Make sure we recieved the failure message" text="We're sorry, but your email address appears to not be a valid email address."/> <invoke stepid="main page" url="/edm/subscribe.asp?e=44" save="subscribeEmailAddressWithInvalidEmailAddress2"/> <verifytext stepid="Make sure we recieved the failure message" text="We're sorry, but your email address appears invalid."/> </steps> </testSpec> </target> <target name="productWithCustomCOAHeader"> <testSpec name="productWithCustomCOAHeader"> &sharedConfiguration; <steps> <invoke stepid="main page" url="${start.page}" save="productWithCustomCOAHeader"/> <setinputfield stepid="search for test product 14-000" name="query" value="14-000"/> <clickbutton stepid="Click link to Execute QuickSearch" name="imageField"/> <verifytitle stepid="Make sure we are on product 14-000" text="Upstate - Product #14-000 - TEST ( 14000 )"/> <not> <verifytext stepid="Make sure there is no COA message." text="Certificate of Analysis:"/> </not> <verifytext stepid="Make sure there is a Product Description message." text="PRODUCT DESCRIPTION:"/> </steps> </testSpec> </target> <target name="productWithPartnerLink"> <testSpec name="productWithPartnerLink"> &sharedConfiguration; <steps> <invoke stepid="main page" url="${start.page}" save="productWithPartnerLink"/> <setinputfield stepid="search for test product 14-000" name="query" value="14-000"/> <clickbutton stepid="Click link to Execute QuickSearch" name="imageField"/> <verifytitle stepid="Make sure we are on product 14-000" text="Upstate - Product #14-000 - TEST ( 14000 )"/> <verifytext stepid="Make sure there is a link to Molecular Devices." text="Also available from Molecular Devices Corp."/> </steps> </testSpec> </target> <target name="sniffTest"> <testSpec name="Sniff"> &sharedConfiguration; <steps> &invokeHome; </steps> </testSpec> </target> </project> |
From: <de...@us...> - 2003-01-24 23:59:02
|
Update of /cvsroot/dbunit/dbunit/docs/sample_webtest In directory sc8-pr-cvs1:/tmp/cvs-serv735/sample_webtest Log Message: Directory /cvsroot/dbunit/dbunit/docs/sample_webtest added to the repository |
From: <de...@us...> - 2003-01-24 23:58:36
|
Update of /cvsroot/dbunit/dbunit/docs In directory sc8-pr-cvs1:/tmp/cvs-serv538 Modified Files: howto.html Log Message: Added to the Howto a section on using DbUnit with WebTest. This has been asked a couple times be various people. Index: howto.html =================================================================== RCS file: /cvsroot/dbunit/dbunit/docs/howto.html,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** howto.html 11 Dec 2002 15:52:48 -0000 1.19 --- howto.html 24 Jan 2003 23:58:32 -0000 1.20 *************** *** 57,60 **** --- 57,61 ---- multiple database schemas</a></li> <li><a href="#dtdsupport">How to associate a DTD with your schema to support NULL values in columns</a></li> + <li><a href="#integrate-webtest">How to Use DbUnit with WebTest to support testing database centric webapps</a></li> </ul> <hr> *************** *** 371,374 **** --- 372,454 ---- Assertion.assertEquals(expectedData, databaseData); </pre> + + <a name="integrate-webtest"> + <h2>How to Use DbUnit with WebTest to support testing database centric webapps</h2> + </a> With Dbunit 1.4's new Ant tasks, Dbunit makes it much easier to run WebTest scripts for database centric applications. <a href="http://webtest.canoo.com">WebTest</a> is a tool to simulate a user's browser clicking through the pages on a web site. It allows you to create a series of Ant based tests for your website. In fact, this can be used to perform User Acceptance tests for websites built using non Java technologies like ColdFusion or ASP! This howto walks you through a suggested format for storing tests. + <br> + <h4>Step 1: Create your dataset file</h4> + Your first step is to create your dataset file that you wan to load into your database before running your WebTest script. Use one of the various methods described above. Put the various datasets you need in a <code>/data</code> directory. + <h4>Step 2: Create your Ant build.xml file</h4> + A suggested setup is to have a single build.xml file that is the entry point for all your tests. This would include a couple targets like: + <ol> + <li> <code>test</code>: Runs all the testSuites that you have created + <li> <code>test:single</code>: Runs a single test in a specific testSuite + <li> <code>test:suite</code>: Runs all the tests for a specific testSuite + </ol> + + <h4>Step 3: Create your various Test Suites</h4> + Once you have your build.xml file set up, you can now call the various TestSuites. Create a separate TestSuiteXXX.xml for the various modules that you would like to test. In your TestSuiteXXX.xml, you should have your default target testSuite call all the testcases you have definied: + + <pre> + <target name="testSuite"> + + <antcall target="unsubscribeEmailAddressWithEmail"/> + <antcall target="unsubscribeEmailAddressWithEmailID"/> + <antcall target="unsubscribeEmailAddressWithNewEmailAddress"/> + + <antcall target="subscribeEmailAddressWithOptedOutEmail"/> + <antcall target="subscribeEmailAddressWithNewEmailAddress"/> + <antcall target="subscribeEmailAddressWithInvalidEmailAddress"/> + + </target> + </pre> + + This way you can either run all the test's in your Test Suite, or just run a specific one, all from build.xml! + + <br> + <h4>Step 4: Create your various Tests</h4> + Now you need to write your various testcases. For more information on WebTest, please refer to <a href=http://webtest.canoo.com>the WebTest</a> home page. If you have find you are duplicating pieces of XML, then place them in a <code>/includes</code> directory. + + If you have a single set of properties, then load them as part of build.xml by specifing them in your build.properties file. If you have multiple databases you need to connect to, then declare your sql connection properties in a TestSuiteXXX.properties file that you load on a per suite basis. In this example, we are using doing a clean insert into the database, and using the MSSQL_CLEAN_INSERT instead of CLEAN_INSERT because of the requirement to do identity column inserts. + <pre> + <target name="subscribeEmailAddressWithOptedOutEmail"> + <dbunit + driver="${sql.jdbcdriver}" + url="${sql.url}" + userid="${sql.username}" + password="${sql.password}"> + <operation type="MSSQL_CLEAN_INSERT" src="data/subscribeEmailAddressWithOptedOutEmail.xml" + format="flat"/> + </dbunit> + <testSpec name="subscribeEmailAddressWithOptedOutEmail"> + &sharedConfiguration; + <steps> + <invoke stepid="main page" + url="/edm/subscribe.asp?e=sub...@te..." + save="subscribeEmailAddressWithNewEmailAddress"/> + <verifytext stepid="Make sure we received the success message" + text="You have been subscribed to the mailing list"/> + + </steps> + </testSpec> + </target> + </pre> + + <br> + <h4>Sample Directory Layout</h4> + When you are done, you will have a series of files that look like this: + <pre> + \root\ + <a href="sample_webtest/build.xml">build.xml</a> + <a href="sample_webtest/build.properties">build.properties</a> + <a href="sample_webtest/TestSuiteEmail.xml">TestSuiteEmail.xml</a> + <a href="sample_webtest/TestSuiteEmail.properties">TestSuiteEmail.properties</a> + \root\data\ + <a href="sample_webtest/subscribeEmailAddressWithOptedOutEmail.xml">subscribeEmailAddressWithOptedOutEmail.xml</a> + \root\includes\ + <a href="sample_webtest/sharedConfiguration.xml">sharedConfiguration.xml</a> + </pre> + + |
From: <de...@us...> - 2002-12-16 19:21:24
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/operation/mssqlserver In directory sc8-pr-cvs1:/tmp/cvs-serv4119 Modified Files: InsertIdentityOperationTest.java Log Message: Adding another testcase source data. FlatXML for MSSQL identity insert. Index: InsertIdentityOperationTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/operation/mssqlserver/InsertIdentityOperationTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** InsertIdentityOperationTest.java 13 Dec 2002 21:46:58 -0000 1.1 --- InsertIdentityOperationTest.java 16 Dec 2002 19:21:19 -0000 1.2 *************** *** 55,63 **** ! public void testExecute() throws Exception { if (DatabaseEnvironment.getInstance() instanceof MSSQLServerEnvironment){ InputStream in = new FileInputStream("src/xml/insertIdentityOperationTest.xml"); IDataSet xmlDataSet = new XmlDataSet(in); ITable[] tablesBefore = DataSetUtils.getTables(_connection.createDataSet()); --- 55,100 ---- ! public void testExecuteXML() throws Exception { if (DatabaseEnvironment.getInstance() instanceof MSSQLServerEnvironment){ InputStream in = new FileInputStream("src/xml/insertIdentityOperationTest.xml"); IDataSet xmlDataSet = new XmlDataSet(in); + + ITable[] tablesBefore = DataSetUtils.getTables(_connection.createDataSet()); + InsertIdentityOperation.CLEAN_INSERT.execute(_connection, xmlDataSet); + ITable[] tablesAfter = DataSetUtils.getTables(_connection.createDataSet()); + + assertEquals("table count", tablesBefore.length, tablesAfter.length); + for (int i = 0; i < tablesBefore.length; i++) + { + ITable table = tablesBefore[i]; + String name = table.getTableMetaData().getTableName(); + + + if (name.startsWith("IDENTITY")) + { + + assertTrue("Should have either 0 or 6", table.getRowCount()==0 | table.getRowCount()==6); + } + } + + for (int i = 0; i < tablesAfter.length; i++) + { + ITable table = tablesAfter[i]; + String name = table.getTableMetaData().getTableName(); + if (name.startsWith("IDENTITY")) + { + Assertion.assertEquals(xmlDataSet.getTable(name), table); + } + } + } + + } + + public void testExecuteFlatXML() throws Exception + { + if (DatabaseEnvironment.getInstance() instanceof MSSQLServerEnvironment){ + InputStream in = new FileInputStream("src/xml/insertIdentityOperationTestFlat.xml"); + IDataSet xmlDataSet = new FlatXmlDataSet(in); ITable[] tablesBefore = DataSetUtils.getTables(_connection.createDataSet()); |
From: <de...@us...> - 2002-12-16 19:20:51
|
Update of /cvsroot/dbunit/dbunit/src/xml In directory sc8-pr-cvs1:/tmp/cvs-serv3858 Added Files: insertIdentityOperationTestFlat.xml Log Message: Adding another testcase source data. FlatXML for MSSQL identity insert. --- NEW FILE: insertIdentityOperationTestFlat.xml --- <!-- edited with XML Spy v3.5 NT (http://www.xmlspy.com) by Manuel Laflamme (Java development) --> <dataset> <IDENTITY_TABLE IDENTITY_TABLE_ID='1' COLUMN0='row 0 col 1' COLUMN1='row 0 col 2'/> <IDENTITY_TABLE IDENTITY_TABLE_ID='2' COLUMN0='row 1 col 1' COLUMN1='row 1 col 2'/> <IDENTITY_TABLE IDENTITY_TABLE_ID='3' COLUMN0='row 2 col 1' COLUMN1='row 2 col 2'/> <IDENTITY_TABLE IDENTITY_TABLE_ID='4' COLUMN0='row 3 col 1' COLUMN1='row 3 col 2'/> <IDENTITY_TABLE IDENTITY_TABLE_ID='5' COLUMN0='row 4 col 1' COLUMN1='row 4 col 2'/> <IDENTITY_TABLE IDENTITY_TABLE_ID='6' COLUMN0='row 5 col 1' COLUMN1='row 5 col 2'/> </dataset> |
From: <de...@us...> - 2002-12-13 21:58:52
|
Update of /cvsroot/dbunit/dbunit/docs In directory sc8-pr-cvs1:/tmp/cvs-serv4784 Modified Files: index.html Log Message: Update about new tests Index: index.html =================================================================== RCS file: /cvsroot/dbunit/dbunit/docs/index.html,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** index.html 11 Dec 2002 15:52:48 -0000 1.23 --- index.html 13 Dec 2002 21:58:49 -0000 1.24 *************** *** 57,60 **** --- 57,61 ---- </a> <ul> + <li>2002-12-13 - New JUnit testing profile for Microsoft SQL Server added, plus new testcase for inserting identity columns.</li> <li>2002-12-11 - New query element added to ant task</li> <li>2002-07-17 - The java API documentation is now available <a href="api/index.html">online</a>.</li> |
From: <de...@us...> - 2002-12-13 21:47:01
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/operation/mssqlserver In directory sc8-pr-cvs1:/tmp/cvs-serv695 Added Files: InsertIdentityOperationTest.java Log Message: fixes to support running test cases against MSSQL --- NEW FILE: InsertIdentityOperationTest.java --- /* * InsertIdentityOperationTest.java Feb 19, 2002 * * DbUnit Database Testing Framework * Copyright (C)2002, Manuel Laflamme * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package org.dbunit.operation.mssqlserver; import org.dbunit.operation.*; import org.dbunit.*; import org.dbunit.database.MockDatabaseConnection; import org.dbunit.database.statement.MockBatchStatement; import org.dbunit.database.statement.MockStatementFactory; import org.dbunit.dataset.*; import org.dbunit.dataset.datatype.DataType; import org.dbunit.dataset.xml.FlatXmlDataSet; import org.dbunit.dataset.xml.XmlDataSet; import java.io.*; import java.util.ArrayList; import java.util.List; /** * @author Manuel Laflamme * @version $Revision: 1.1 $ */ public class InsertIdentityOperationTest extends AbstractDatabaseTest { public InsertIdentityOperationTest(String s) { super(s); } // public static Test suite() // { // return new InsertIdentityOperationTest("testInsertBlob"); // } public void testExecute() throws Exception { if (DatabaseEnvironment.getInstance() instanceof MSSQLServerEnvironment){ InputStream in = new FileInputStream("src/xml/insertIdentityOperationTest.xml"); IDataSet xmlDataSet = new XmlDataSet(in); ITable[] tablesBefore = DataSetUtils.getTables(_connection.createDataSet()); InsertIdentityOperation.CLEAN_INSERT.execute(_connection, xmlDataSet); ITable[] tablesAfter = DataSetUtils.getTables(_connection.createDataSet()); assertEquals("table count", tablesBefore.length, tablesAfter.length); for (int i = 0; i < tablesBefore.length; i++) { ITable table = tablesBefore[i]; String name = table.getTableMetaData().getTableName(); if (name.startsWith("IDENTITY")) { assertTrue("Should have either 0 or 6", table.getRowCount()==0 | table.getRowCount()==6); } } for (int i = 0; i < tablesAfter.length; i++) { ITable table = tablesAfter[i]; String name = table.getTableMetaData().getTableName(); if (name.startsWith("IDENTITY")) { Assertion.assertEquals(xmlDataSet.getTable(name), table); } } } } } |
From: <de...@us...> - 2002-12-13 21:46:33
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/operation/mssqlserver In directory sc8-pr-cvs1:/tmp/cvs-serv524/mssqlserver Log Message: Directory /cvsroot/dbunit/dbunit/src/test/org/dbunit/operation/mssqlserver added to the repository |
From: <de...@us...> - 2002-12-13 21:46:12
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/operation In directory sc8-pr-cvs1:/tmp/cvs-serv386 Modified Files: AllTests.java InsertOperationTest.java Log Message: fixes to support running test cases against MSSQL Index: AllTests.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/operation/AllTests.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AllTests.java 13 Jun 2002 17:25:01 -0000 1.6 --- AllTests.java 13 Dec 2002 21:46:08 -0000 1.7 *************** *** 23,26 **** --- 23,28 ---- package org.dbunit.operation; + import org.dbunit.*; + import org.dbunit.operation.mssqlserver.*; import junit.framework.Test; import junit.framework.TestSuite; *************** *** 32,36 **** public class AllTests { ! public static Test suite() { TestSuite suite = new TestSuite(); --- 34,38 ---- public class AllTests { ! public static Test suite() throws Exception { TestSuite suite = new TestSuite(); *************** *** 44,47 **** --- 46,52 ---- suite.addTest(new TestSuite(TransactionOperationTest.class)); suite.addTest(new TestSuite(UpdateOperationTest.class)); + if (DatabaseEnvironment.getInstance() instanceof MSSQLServerEnvironment){ + suite.addTest(new TestSuite(InsertIdentityOperationTest.class)); + } return suite; Index: InsertOperationTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/operation/InsertOperationTest.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** InsertOperationTest.java 4 Aug 2002 01:07:13 -0000 1.15 --- InsertOperationTest.java 13 Dec 2002 21:46:08 -0000 1.16 *************** *** 308,317 **** expected, actual); ! // all remaining columns should be null for (int k = 1; k < columns.length; k++) { String columnName = columns[k].getColumnName(); ! assertEquals(tableName + "." + columnName, null, databaseTable.getValue(j, columnName)); } } --- 308,325 ---- expected, actual); ! // all remaining columns should be null except mssql server timestamp column which is of type binary. for (int k = 1; k < columns.length; k++) { String columnName = columns[k].getColumnName(); ! DataType columnDataType = columns[k].getDataType(); ! ! ! if (DatabaseEnvironment.getInstance() instanceof MSSQLServerEnvironment && columnDataType.equals(DataType.BINARY)){ ! assertTrue(tableName + "." + columnName,databaseTable.getValue(j, columnName)!= null); ! } ! else { ! assertEquals(tableName + "." + columnName, null, databaseTable.getValue(j, columnName)); + } } } *************** *** 323,354 **** public void testExecute() throws Exception { ! InputStream in = new FileInputStream("src/xml/insertOperationTest.xml"); ! IDataSet xmlDataSet = new XmlDataSet(in); ! ITable[] tablesBefore = DataSetUtils.getTables(_connection.createDataSet()); ! DatabaseOperation.INSERT.execute(_connection, xmlDataSet); ! ITable[] tablesAfter = DataSetUtils.getTables(_connection.createDataSet()); ! assertEquals("table count", tablesBefore.length, tablesAfter.length); ! for (int i = 0; i < tablesBefore.length; i++) ! { ! ITable table = tablesBefore[i]; ! String name = table.getTableMetaData().getTableName(); ! if (name.startsWith("EMPTY")) ! { ! assertEquals(name + "before", 0, table.getRowCount()); } - } - - for (int i = 0; i < tablesAfter.length; i++) - { - ITable table = tablesAfter[i]; - String name = table.getTableMetaData().getTableName(); ! if (name.startsWith("EMPTY")) { ! Assertion.assertEquals(xmlDataSet.getTable(name), table); } } --- 331,365 ---- public void testExecute() throws Exception { ! // this won't work because of the timestamp column. ! if (!(DatabaseEnvironment.getInstance() instanceof MSSQLServerEnvironment)){ ! InputStream in = new FileInputStream("src/xml/insertOperationTest.xml"); ! IDataSet xmlDataSet = new XmlDataSet(in); ! ITable[] tablesBefore = DataSetUtils.getTables(_connection.createDataSet()); ! DatabaseOperation.INSERT.execute(_connection, xmlDataSet); ! ITable[] tablesAfter = DataSetUtils.getTables(_connection.createDataSet()); ! assertEquals("table count", tablesBefore.length, tablesAfter.length); ! for (int i = 0; i < tablesBefore.length; i++) ! { ! ITable table = tablesBefore[i]; ! String name = table.getTableMetaData().getTableName(); ! if (name.startsWith("EMPTY")) ! { ! assertEquals(name + "before", 0, table.getRowCount()); ! } } ! for (int i = 0; i < tablesAfter.length; i++) { ! ITable table = tablesAfter[i]; ! String name = table.getTableMetaData().getTableName(); ! ! if (name.startsWith("EMPTY")) ! { ! Assertion.assertEquals(xmlDataSet.getTable(name), table); ! } } } |
From: <de...@us...> - 2002-12-13 21:45:38
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv32641 Modified Files: AbstractDataSetTest.java QueryDataSetTest.java Log Message: fixes to support running test cases against MSSQL Index: AbstractDataSetTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/AbstractDataSetTest.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** AbstractDataSetTest.java 4 Aug 2002 01:07:13 -0000 1.14 --- AbstractDataSetTest.java 13 Dec 2002 21:45:34 -0000 1.15 *************** *** 24,27 **** --- 24,28 ---- import org.dbunit.database.AmbiguousTableNameException; + import org.dbunit.*; import java.util.*; *************** *** 44,47 **** --- 45,50 ---- }; + + private static final String[] DUPLICATE_TABLE_NAMES = { "DUPLICATE_TABLE", *************** *** 55,61 **** } ! protected static String[] getExpectedNames() { return (String[])TABLE_NAMES.clone(); } --- 58,65 ---- } ! protected static String[] getExpectedNames() throws Exception { return (String[])TABLE_NAMES.clone(); + } *************** *** 77,81 **** /** * This method exclude BLOB_TABLE and CLOB_TABLE from the specified dataset ! * because BLOB and CLOB are not supported by all database vendor */ public static IDataSet removeExtraTestTables(IDataSet dataSet) throws Exception --- 81,86 ---- /** * This method exclude BLOB_TABLE and CLOB_TABLE from the specified dataset ! * because BLOB and CLOB are not supported by all database vendor. ! * @todo Should be refactored into thee various DatabaseEnvironments! */ public static IDataSet removeExtraTestTables(IDataSet dataSet) throws Exception *************** *** 90,93 **** --- 95,110 ---- nameList.remove("DBUNIT.BLOB_TABLE"); nameList.remove("DBUNIT.CLOB_TABLE"); + /* + this table shows up on MSSQLServer. It is a user table for storing diagram information + that really should be considered a system table. + */ + nameList.remove("DBUNIT.dtproperties"); + nameList.remove("dtproperties"); + /* + This table is created specifically for testing identity columns on MSSQL server. + It should be ignored on other platforms. + */ + nameList.remove("DBUNIT.IDENTITY_TABLE"); + nameList.remove("IDENTITY_TABLE"); // nameList.remove("ESCAPED TABLE"); names = (String[])nameList.toArray(new String[0]); *************** *** 207,211 **** sort(expected); ! IDataSet dataSet = createDataSet(); ITable[] tables = dataSet.getTables(); sort(tables); --- 224,230 ---- sort(expected); ! IDataSet dataSet = removeExtraTestTables(createDataSet()); ! String[] names = dataSet.getTableNames(); ! sort(names); ITable[] tables = dataSet.getTables(); sort(tables); Index: QueryDataSetTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/QueryDataSetTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** QueryDataSetTest.java 11 Dec 2002 15:57:34 -0000 1.1 --- QueryDataSetTest.java 13 Dec 2002 21:45:34 -0000 1.2 *************** *** 24,27 **** --- 24,28 ---- import org.dbunit.DatabaseEnvironment; + import org.dbunit.*; import org.dbunit.database.*; *************** *** 249,260 **** } public void testLengthSyntax() throws Exception { ! ITable table = null; ! QueryDataSet ptds = new QueryDataSet(_connection); ! ptds.addTable("ATABLE","CALL LENGTH('hello world')"); ! table = ptds.getTable("ATABLE"); ! assertEquals("","1",new String(table.getRowCount() + "")); --- 250,264 ---- } + /* This JUNIT test case only works against Hypersonic! */ public void testLengthSyntax() throws Exception { ! if (DatabaseEnvironment.getInstance() instanceof HypersonicEnvironment){ ! ITable table = null; ! QueryDataSet ptds = new QueryDataSet(_connection); ! ptds.addTable("ATABLE","CALL LENGTH('hello world')"); ! table = ptds.getTable("ATABLE"); ! assertEquals("","1",new String(table.getRowCount() + "")); ! } |
From: <de...@us...> - 2002-12-13 21:44:52
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/database In directory sc8-pr-cvs1:/tmp/cvs-serv32358 Modified Files: DatabaseDataSetTest.java DatabaseTableMetaDataTest.java Log Message: fixes to support running test cases against MSSQL Index: DatabaseDataSetTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/database/DatabaseDataSetTest.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** DatabaseDataSetTest.java 9 Dec 2002 17:59:14 -0000 1.17 --- DatabaseDataSetTest.java 13 Dec 2002 21:44:46 -0000 1.18 *************** *** 23,26 **** --- 23,27 ---- package org.dbunit.database; + import org.dbunit.*; import org.dbunit.DatabaseEnvironment; import org.dbunit.dataset.*; *************** *** 160,189 **** public void testGetQualifiedTableNames() throws Exception { ! String[] expectedNames = getExpectedNames(); ! sort(expectedNames); ! try ! { ! System.setProperty(DatabaseDataSet.QUALIFIED_TABLE_NAMES, "true"); ! IDatabaseConnection connection = new DatabaseConnection( ! _connection.getConnection(), _connection.getSchema()); ! IDataSet dataSet = removeExtraTestTables(connection.createDataSet()); ! String[] actualNames = dataSet.getTableNames(); ! sort(actualNames); ! assertEquals("name count", expectedNames.length, actualNames.length); ! for (int i = 0; i < actualNames.length; i++) { ! String expected = DataSetUtils.getQualifiedName( ! _connection.getSchema(), expectedNames[i]); ! String actual = actualNames[i]; ! assertEquals("name", expected, actual); } - } - finally - { - System.setProperty(DatabaseDataSet.QUALIFIED_TABLE_NAMES, "false"); } } --- 161,193 ---- public void testGetQualifiedTableNames() throws Exception { ! // this won't work because of the timestamp column. ! if (!(DatabaseEnvironment.getInstance() instanceof MSSQLServerEnvironment)){ ! String[] expectedNames = getExpectedNames(); ! sort(expectedNames); ! try ! { ! System.setProperty(DatabaseDataSet.QUALIFIED_TABLE_NAMES, "true"); ! IDatabaseConnection connection = new DatabaseConnection( ! _connection.getConnection(), _connection.getSchema()); ! IDataSet dataSet = removeExtraTestTables(connection.createDataSet()); ! String[] actualNames = dataSet.getTableNames(); ! sort(actualNames); ! assertEquals("name count", expectedNames.length, actualNames.length); ! for (int i = 0; i < actualNames.length; i++) ! { ! String expected = DataSetUtils.getQualifiedName( ! _connection.getSchema(), expectedNames[i]); ! String actual = actualNames[i]; ! assertEquals("name", expected, actual); ! } ! } ! finally { ! System.setProperty(DatabaseDataSet.QUALIFIED_TABLE_NAMES, "false"); } } } Index: DatabaseTableMetaDataTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/database/DatabaseTableMetaDataTest.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** DatabaseTableMetaDataTest.java 7 Aug 2002 01:32:12 -0000 1.11 --- DatabaseTableMetaDataTest.java 13 Dec 2002 21:44:47 -0000 1.12 *************** *** 23,26 **** --- 23,27 ---- package org.dbunit.database; + import org.dbunit.*; import org.dbunit.AbstractDatabaseTest; import org.dbunit.dataset.*; *************** *** 33,36 **** --- 34,62 ---- public class DatabaseTableMetaDataTest extends AbstractDatabaseTest { + private static final DataType[] EXPECTED_DATA_TYPES = { + DataType.VARCHAR, + DataType.NUMERIC, + DataType.TIMESTAMP, + DataType.VARBINARY, + }; + + private static final DataType[] EXPECTED_DATA_TYPES_MSSQLSERVER = { + DataType.VARCHAR, + DataType.NUMERIC, + DataType.BINARY, + DataType.VARBINARY, + }; + + protected static DataType[] getExpectedDataTypes() throws Exception + { + if (DatabaseEnvironment.getInstance() instanceof MSSQLServerEnvironment){ + return (DataType[])EXPECTED_DATA_TYPES_MSSQLSERVER.clone(); + } + else { + return (DataType[])EXPECTED_DATA_TYPES.clone(); + } + + } + public DatabaseTableMetaDataTest(String s) { *************** *** 128,137 **** "VARBINARY_COL", }; ! DataType[] expectedTypes = { ! DataType.VARCHAR, ! DataType.NUMERIC, ! DataType.TIMESTAMP, ! DataType.VARBINARY, ! }; ITableMetaData metaData = createDataSet().getTableMetaData(tableName); --- 154,158 ---- "VARBINARY_COL", }; ! DataType[] expectedTypes = getExpectedDataTypes(); ITableMetaData metaData = createDataSet().getTableMetaData(tableName); *************** *** 148,152 **** } } - } --- 169,172 ---- |
From: <de...@us...> - 2002-12-13 21:43:57
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit In directory sc8-pr-cvs1:/tmp/cvs-serv32098 Modified Files: DatabaseEnvironment.java Added Files: MSSQLServerEnvironment.java Log Message: New db environment --- NEW FILE: MSSQLServerEnvironment.java --- /* * MSSQLEnvironment.java Feb 18, 2002 * * The DbUnit Database Testing Framework * Copyright (C)2002, Manuel Laflamme * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package org.dbunit; import java.io.*; import java.sql.Connection; import java.sql.Statement; /** * @author Eric Pugh * @version $Revision: 1.1 $ */ public class MSSQLServerEnvironment extends DatabaseEnvironment { public MSSQLServerEnvironment(DatabaseProfile profile) throws Exception { super(profile); // Creates required tables into the mssql database /* BufferedReader sqlReader = new BufferedReader( new FileReader(new File("src/sql/mssql.sql"))); StringBuffer sqlBuffer = new StringBuffer(); while (sqlReader.ready()) { String line = sqlReader.readLine(); if (!line.startsWith("-")) { sqlBuffer.append(line); } } Connection connection = getConnection().getConnection(); Statement statement = connection.createStatement(); try { String sql = sqlBuffer.toString(); statement.execute(sql); } finally { statement.close(); } */ } } Index: DatabaseEnvironment.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/DatabaseEnvironment.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** DatabaseEnvironment.java 13 Jun 2002 17:24:59 -0000 1.10 --- DatabaseEnvironment.java 13 Dec 2002 21:43:53 -0000 1.11 *************** *** 59,62 **** --- 59,66 ---- INSTANCE = new OracleEnvironment(profile); } + else if (profileName.equals("mssql")) + { + INSTANCE = new MSSQLServerEnvironment(profile); + } else { |
From: <de...@us...> - 2002-12-13 21:43:11
|
Update of /cvsroot/dbunit/dbunit/src/xml In directory sc8-pr-cvs1:/tmp/cvs-serv31831 Added Files: insertIdentityOperationTest.xml Log Message: New testcase data --- NEW FILE: insertIdentityOperationTest.xml --- <!-- edited with XML Spy v3.5 NT (http://www.xmlspy.com) by Manuel Laflamme (Java development) --> <dataset> <table name="IDENTITY_TABLE"> <column>IDENTITY_TABLE_ID</column> <column>COLUMN0</column> <column>COLUMN1</column> <row> <value>1</value> <value>row 0 col 1</value> <value>row 0 col 2</value> </row> <row> <value>2</value> <value>row 1 col 1</value> <value>row 1 col 2</value> </row> <row> <value>3</value> <value>row 2 col 1</value> <value>row 2 col 2</value> </row> <row> <value>4</value> <value>row 3 col 1</value> <value>row 3 col 2</value> </row> <row> <value>5</value> <value>row 4 col 1</value> <value>row 4 col 2</value> </row> <row> <value>6</value> <value>row 5 col 1</value> <value>row 5 col 2</value> </row> </table> </dataset> |
From: <de...@us...> - 2002-12-13 21:42:37
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/operation/mssqlserver In directory sc8-pr-cvs1:/tmp/cvs-serv31466 Modified Files: InsertIdentityOperation.java Log Message: Fix. If you load a dataset from XML, then all the PK/identity information is missing! Requery the database! Index: InsertIdentityOperation.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/operation/mssqlserver/InsertIdentityOperation.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** InsertIdentityOperation.java 4 Aug 2002 01:07:13 -0000 1.10 --- InsertIdentityOperation.java 13 Dec 2002 21:42:34 -0000 1.11 *************** *** 21,25 **** package org.dbunit.operation.mssqlserver; ! import org.dbunit.DatabaseUnitException; import org.dbunit.database.IDatabaseConnection; --- 21,25 ---- package org.dbunit.operation.mssqlserver; ! import org.dbunit.database.*; import org.dbunit.DatabaseUnitException; import org.dbunit.database.IDatabaseConnection; *************** *** 74,77 **** --- 74,78 ---- { Column[] primaryKeys = metaData.getPrimaryKeys(); + for (int i = 0; i < primaryKeys.length; i++) { *************** *** 111,115 **** --- 112,121 ---- { ITable table = tables[i]; + ITableMetaData databaseMetaData = table.getTableMetaData(); + + if (!(databaseMetaData instanceof DatabaseTableMetaData)){ + databaseMetaData = new DatabaseTableMetaData(table.getTableMetaData().getTableName(),connection); + } String tableName = DataSetUtils.getQualifiedName( connection.getSchema(), *************** *** 118,121 **** --- 124,128 ---- // enable identity insert boolean hasIdentityColumn = hasIdentityColumn(databaseMetaData); + if (hasIdentityColumn) { |
From: <de...@us...> - 2002-12-13 21:41:36
|
Update of /cvsroot/dbunit/dbunit/src/sql In directory sc8-pr-cvs1:/tmp/cvs-serv31129 Added Files: mssql.sql Log Message: Added new database create script for mssql server, including extra identity table! --- NEW FILE: mssql.sql --- if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EMPTY_MULTITYPE_TABLE]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[EMPTY_MULTITYPE_TABLE] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EMPTY_TABLE]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[EMPTY_TABLE] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IDENTITY_TABLE]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[IDENTITY_TABLE] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ONLY_PK_TABLE]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[ONLY_PK_TABLE] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PK_TABLE]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[PK_TABLE] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SECOND_TABLE]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[SECOND_TABLE] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TEST_TABLE]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[TEST_TABLE] GO CREATE TABLE [dbo].[EMPTY_MULTITYPE_TABLE] ( [VARCHAR_COL] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [NUMERIC_COL] [numeric](38, 0) NULL , [TIMESTAMP_COL] [timestamp] NULL , [VARBINARY_COL] [varbinary] (254) NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[EMPTY_TABLE] ( [COLUMN0] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [COLUMN1] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [COLUMN2] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [COLUMN3] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[IDENTITY_TABLE] ( [IDENTITY_TABLE_ID] [int] IDENTITY (1, 1) NOT NULL , [COLUMN0] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [COLUMN1] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[ONLY_PK_TABLE] ( [PK0] [numeric](38, 0) NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[PK_TABLE] ( [PK0] [numeric](38, 0) NOT NULL , [PK1] [numeric](38, 0) NOT NULL , [PK2] [numeric](38, 0) NOT NULL , [NORMAL0] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [NORMAL1] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[SECOND_TABLE] ( [COLUMN0] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [COLUMN1] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [COLUMN2] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [COLUMN3] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[TEST_TABLE] ( [COLUMN0] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [COLUMN1] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [COLUMN2] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [COLUMN3] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY] GO |
From: <de...@us...> - 2002-12-13 21:40:36
|
Update of /cvsroot/dbunit/dbunit In directory sc8-pr-cvs1:/tmp/cvs-serv30744 Modified Files: profile.properties Log Message: Added new profile for MS Sql Server Index: profile.properties =================================================================== RCS file: /cvsroot/dbunit/dbunit/profile.properties,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** profile.properties 7 Aug 2002 01:32:11 -0000 1.21 --- profile.properties 13 Dec 2002 21:40:32 -0000 1.22 *************** *** 7,10 **** --- 7,11 ---- #dbunit.profile = mysql #dbunit.profile = antoine + #dbunit.profile = mssql # dbunit.profile.{profileName}.driverClass = com.acme.driver *************** *** 38,41 **** --- 39,48 ---- dbunit.profile.mysql.password = + dbunit.profile.mssql.driverClass = com.microsoft.jdbc.sqlserver.SQLServerDriver + dbunit.profile.mssql.connectionUrl = jdbc:microsoft:sqlserver://trujillo:1433;DatabaseName=dbunit;SelectMethod=cursor + dbunit.profile.mssql.schema = dbo + dbunit.profile.mssql.user = dbunit + dbunit.profile.mssql.password = dbunit + ## Needed for ant testing until profile.properties is merged dbunit.profile.driverClass = ${dbunit.profile.hypersonic.driverClass} *************** *** 44,46 **** --- 51,61 ---- dbunit.profile.user = ${dbunit.profile.hypersonic.user} dbunit.profile.password = ${dbunit.profile.hypersonic.password} + + #dbunit.profile.driverClass = ${dbunit.profile.mssql.driverClass} + #dbunit.profile.connectionUrl = ${dbunit.profile.mssql.connectionUrl} + ##dbunit.profile.schema = ${dbunit.profile.mssql.schema} + #dbunit.profile.user = ${dbunit.profile.mssql.user} + #dbunit.profile.password = ${dbunit.profile.mssql.password} + + |
From: <de...@us...> - 2002-12-11 15:57:38
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv30473 Modified Files: AllTests.java Added Files: QueryDataSetTest.java Log Message: New Junit test case for querydataset --- NEW FILE: QueryDataSetTest.java --- /* * QueryDataSetTest.java Feb 18, 2002 * * The DbUnit Database Testing Framework * Copyright (C)2002, Manuel Laflamme * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package org.dbunit.dataset; import org.dbunit.DatabaseEnvironment; import org.dbunit.database.*; import org.dbunit.dataset.datatype.DataType; import java.util.Arrays; import java.util.Comparator; import java.lang.reflect.Array; /** * @author Manuel Laflamme * @version $Revision: 1.1 $ */ public class QueryDataSetTest extends AbstractDataSetTest { private static final String ESCAPE_PATTERN_KEY = "dbunit.name.escapePattern"; private IDatabaseConnection _connection; public QueryDataSetTest(String s) { super(s); } //////////////////////////////////////////////////////////////////////////// // TestCase class protected void setUp() throws Exception { super.setUp(); _connection = DatabaseEnvironment.getInstance().getConnection(); } protected void tearDown() throws Exception { super.tearDown(); _connection = null; } //////////////////////////////////////////////////////////////////////////// // AbstractDataSetTest class protected IDataSet createDataSet() throws Exception { return _connection.createDataSet(); } protected IDataSet createDuplicateDataSet() throws Exception { throw new UnsupportedOperationException(); } protected void sort(Object[] array) { if (ITable[].class.isInstance(array)) { Arrays.sort(array, new TableComparator()); } else { Arrays.sort(array); } } private class TableComparator implements Comparator { public int compare(Object o1, Object o2) { String name1 = ((ITable)o1).getTableMetaData().getTableName(); String name2 = ((ITable)o2).getTableMetaData().getTableName(); return name1.compareTo(name2); } } //////////////////////////////////////////////////////////////////////////// // Test methods public void testGetSelectStatement() throws Exception { String schemaName = "schema"; String tableName = "table"; String query = "select c1, c2, c3 from schema.table where c1 > 100"; Column[] columns = new Column[]{ new Column("c1", DataType.UNKNOWN), new Column("c2", DataType.UNKNOWN), new Column("c3", DataType.UNKNOWN), }; String expected = "select c1, c2, c3 from schema.table where c1 > 100"; ITableMetaData metaData = new DefaultTableMetaData(tableName, columns); QueryDataSet ptds = new QueryDataSet(_connection); ptds.addTable(tableName,query); String s = ptds.getQuery(tableName); assertEquals("where clause coming out",query,s); } public void testGetSelectStatementWith2Tables() throws Exception { String sql = null; String tableName="table"; String tableName2="table2"; String query = "select c1, c2, c3 from schema.table where c1 > 100 order by c1, c2, c3"; String query2 = "select a1, a2, a3 from schema.table2 where c1 > 100 order by c1, c2, c3"; QueryDataSet ptds = new QueryDataSet(_connection); ptds.addTable(tableName,query); String s = ptds.getQuery(tableName); assertEquals("where clause coming out",query,s); ptds.addTable(tableName2,query2); s = ptds.getQuery(tableName2); assertEquals("where clause coming out",query2,s); } public void testGetSelectPartialData() throws Exception { QueryDataSet ptds = new QueryDataSet(_connection); ptds.addTable("PK_TABLE","SELECT PK0, PK1 FROM PK_TABLE where PK0 = 0"); ITable table = ptds.getTable("PK_TABLE"); assertEquals("","0",table.getValue(0,"PK0").toString()); assertEquals("","1",new String(table.getRowCount() + "")); } public void testGetAllColumnsWithStar() throws Exception { QueryDataSet ptds = new QueryDataSet(_connection); ptds.addTable("PK_TABLE","SELECT * FROM PK_TABLE where PK0 = 0"); ITable table = ptds.getTable("PK_TABLE"); assertEquals("","0",table.getValue(0,"PK0").toString()); assertEquals("","1",new String(table.getRowCount() + "")); } public void testGetAllRowsSingleColumn() throws Exception { QueryDataSet ptds = new QueryDataSet(_connection); ptds.addTable("PK_TABLE","SELECT PK0 FROM PK_TABLE"); ITable table = ptds.getTable("PK_TABLE"); assertEquals("","0",table.getValue(0,"PK0").toString()); assertEquals("","3",new String(table.getRowCount() + "")); } public void testOnlySpecifiedColumnsReturned() throws Exception { QueryDataSet ptds = new QueryDataSet(_connection); ptds.addTable("PK_TABLE","SELECT PK0 FROM PK_TABLE"); ITable table = ptds.getTable("PK_TABLE"); assertEquals("","0",table.getValue(0,"PK0").toString()); try { String test = table.getValue(0,"PK1").toString(); fail("Should not have reached here, we should have thrown a NoSuchColumnException"); } catch (NoSuchColumnException nsce){ String errorMsg = "org.dbunit.dataset.NoSuchColumnException: PK_TABLE.PK1"; assertTrue("Find text:" + errorMsg,nsce.toString().indexOf(errorMsg)>=0); } } public void testGetSelectPartialData2() throws Exception { QueryDataSet ptds = new QueryDataSet(_connection); ptds.addTable("SECOND_TABLE","SELECT * FROM SECOND_TABLE where COLUMN0='row 0 col 0'"); ITable table = ptds.getTable("SECOND_TABLE"); assertEquals("","row 0 col 0",table.getValue(0,"COLUMN0").toString()); assertEquals("","row 0 col 3",table.getValue(0,"COLUMN3").toString()); assertEquals("","1",new String(table.getRowCount() + "")); } public void testCombinedWhere() throws Exception { QueryDataSet ptds = new QueryDataSet(_connection); ptds.addTable("SECOND_TABLE","SELECT COLUMN0, COLUMN3 FROM SECOND_TABLE where COLUMN0='row 0 col 0' and COLUMN2='row 0 col 2'"); ITable table = ptds.getTable("SECOND_TABLE"); assertEquals("","row 0 col 0",table.getValue(0,"COLUMN0").toString()); assertEquals("","row 0 col 3",table.getValue(0,"COLUMN3").toString()); assertEquals("","1",new String(table.getRowCount() + "")); } public void testMultipleTables() throws Exception { ITable table = null; QueryDataSet ptds = new QueryDataSet(_connection); ptds.addTable("SECOND_TABLE","SELECT * from SECOND_TABLE where COLUMN0='row 0 col 0' and COLUMN2='row 0 col 2'"); ptds.addTable("PK_TABLE","SELECT * FROM PK_TABLE where PK0 = 0"); table = ptds.getTable("SECOND_TABLE"); assertEquals("","row 0 col 0",table.getValue(0,"COLUMN0").toString()); assertEquals("","row 0 col 3",table.getValue(0,"COLUMN3").toString()); assertEquals("","1",new String(table.getRowCount() + "")); table = ptds.getTable("PK_TABLE"); assertEquals("","0",table.getValue(0,"PK0").toString()); assertEquals("","1",new String(table.getRowCount() + "")); } public void testLengthSyntax() throws Exception { ITable table = null; QueryDataSet ptds = new QueryDataSet(_connection); ptds.addTable("ATABLE","CALL LENGTH('hello world')"); table = ptds.getTable("ATABLE"); assertEquals("","1",new String(table.getRowCount() + "")); } public void testMultipleTablesWithMissingWhere() throws Exception { ITable table = null; QueryDataSet ptds = new QueryDataSet(_connection); ptds.addTable("SECOND_TABLE","SELECT * from SECOND_TABLE where COLUMN0='row 0 col 0' and COLUMN2='row 0 col 2'"); ptds.addTable("PK_TABLE",null); } public void testGetDuplicateTable() throws Exception { // Cannot test! Unsupported feature. } public void testGetDuplicateTableMetaData() throws Exception { // Cannot test! Unsupported feature. } public void testGetDuplicateTableNames() throws Exception { // Cannot test! Unsupported feature. } public void testGetDuplicateTables() throws Exception { // Cannot test! Unsupported feature. } } Index: AllTests.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/AllTests.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AllTests.java 13 Jun 2002 17:25:00 -0000 1.7 --- AllTests.java 11 Dec 2002 15:57:34 -0000 1.8 *************** *** 47,50 **** --- 47,51 ---- suite.addTest(new TestSuite(DefaultTableTest.class)); suite.addTest(new TestSuite(FilteredDataSetTest.class)); + suite.addTest(new TestSuite(QueryDataSetTest.class)); return suite; |
From: <de...@us...> - 2002-12-11 15:56:49
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/ant In directory sc8-pr-cvs1:/tmp/cvs-serv30134 Modified Files: DbUnitTaskTest.java Log Message: Ant Test cases for <Query> support Index: DbUnitTaskTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/ant/DbUnitTaskTest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DbUnitTaskTest.java 3 Aug 2002 14:49:49 -0000 1.5 --- DbUnitTaskTest.java 11 Dec 2002 15:56:46 -0000 1.6 *************** *** 255,258 **** --- 255,301 ---- } + public void testExportQuery() + { + String targetName = "test-export-query"; + Export export = (Export)getFirstStepFromTarget(targetName); + assertTrue("Should have been a flat format, " + + "but was: " + export.getFormat(), + export.getFormat().equalsIgnoreCase("flat")); + List queries = export.getQueries(); + assertTrue("Export should have had two sub queries, but has: " + + queries.size(), queries.size() == 2); + Query testTable = (Query)queries.get(0); + Query pkTable = (Query)queries.get(1); + assertTrue("Should have been been TABLE TEST_TABLE, but was: " + + testTable.getName(), testTable.getName().equals("TEST_TABLE")); + assertTrue("Should have been been TABLE PK_TABLE, but was: " + + pkTable.getName(), pkTable.getName().equals("PK_TABLE")); + assertTrue("Should have been been query for TABLE TEST_TABLE, but was: " + + testTable.getSql(), testTable.getSql().equals("SELECT * FROM TEST_TABLE")); + assertTrue("Should have been been query for TABLE PK_TABLE, but was: " + + pkTable.getSql(), pkTable.getSql().equals("SELECT * FROM PK_TABLE")); + } + + public void testExportQueryMixed() + { + String targetName = "test-export-query-mixed"; + Export export = (Export)getFirstStepFromTarget(targetName); + assertTrue("Should have been a flat format, " + + "but was: " + export.getFormat(), + export.getFormat().equalsIgnoreCase("flat")); + List tables = export.getTables(); + assertTrue("Export should have had one table, but has: " + + tables.size(), tables.size() == 1); + Table testTable = (Table)tables.get(0); + + List queries = export.getQueries(); + assertTrue("Export should have had one querie, but has: " + + queries.size(), queries.size() == 1); + Query pkTable = (Query)queries.get(0); + assertTrue("Should have been been a query for TABLE PK_TABLE, but was: " + + pkTable.getSql(), pkTable.getSql()!= null); + + } + protected void assertOperationType(String failMessage, String targetName, DatabaseOperation expected) { |
From: <de...@us...> - 2002-12-11 15:56:26
|
Update of /cvsroot/dbunit/dbunit/src/xml In directory sc8-pr-cvs1:/tmp/cvs-serv29982 Modified Files: antTestBuildFile.xml Log Message: Ant Test cases for <Query> support Index: antTestBuildFile.xml =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/xml/antTestBuildFile.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** antTestBuildFile.xml 15 Jul 2002 01:00:30 -0000 1.3 --- antTestBuildFile.xml 11 Dec 2002 15:56:23 -0000 1.4 *************** *** 15,19 **** <target name="no-driver"> <dbunit url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <operation type="CLEAN_INSERT" src="${testDataSet}"/> --- 15,19 ---- <target name="no-driver"> <dbunit url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <operation type="CLEAN_INSERT" src="${testDataSet}"/> *************** *** 23,27 **** <target name="no-db-url"> <dbunit driver="${dbunit.profile.driverClass}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <operation type="CLEAN_INSERT" src="${testDataSet}"/> --- 23,27 ---- <target name="no-db-url"> <dbunit driver="${dbunit.profile.driverClass}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <operation type="CLEAN_INSERT" src="${testDataSet}"/> *************** *** 32,36 **** <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! password="${dbunit.profile.password}"> <operation type="CLEAN_INSERT" src="${testDataSet}"/> --- 32,36 ---- <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! password="${dbunit.profile.password}"> <operation type="CLEAN_INSERT" src="${testDataSet}"/> *************** *** 41,45 **** <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}"> <operation type="CLEAN_INSERT" src="${testDataSet}"/> </dbunit> --- 41,45 ---- <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}"> <operation type="CLEAN_INSERT" src="${testDataSet}"/> </dbunit> *************** *** 49,53 **** <dbunit driver="${dbunit.profile.driverClass}" url="jdbc:foobar://localhost/dbunittest" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <operation type="CLEAN_INSERT" src="${testDataSet}"/> --- 49,53 ---- <dbunit driver="${dbunit.profile.driverClass}" url="jdbc:foobar://localhost/dbunittest" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <operation type="CLEAN_INSERT" src="${testDataSet}"/> *************** *** 58,62 **** <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <operation type="INSERT" src="${testDataSet}" format="xml"/> --- 58,62 ---- <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <operation type="INSERT" src="${testDataSet}" format="xml"/> *************** *** 67,71 **** <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <operation type="INSERT" src="${testDataSet}"/> --- 67,71 ---- <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <operation type="INSERT" src="${testDataSet}"/> *************** *** 76,80 **** <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <operation type="UPDATE" src="${testDataSet}"/> --- 76,80 ---- <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <operation type="UPDATE" src="${testDataSet}"/> *************** *** 85,89 **** <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <operation type="REFRESH" src="${testDataSet}"/> --- 85,89 ---- <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <operation type="REFRESH" src="${testDataSet}"/> *************** *** 94,98 **** <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <operation type="DELETE" src="${testDataSet}"/> --- 94,98 ---- <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <operation type="DELETE" src="${testDataSet}"/> *************** *** 103,107 **** <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <operation type="DELETE_ALL" src="${testDataSet}"/> --- 103,107 ---- <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <operation type="DELETE_ALL" src="${testDataSet}"/> *************** *** 112,116 **** <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <operation type="CLEAN_INSERT" src="${testDataSet}"/> --- 112,116 ---- <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <operation type="CLEAN_INSERT" src="${testDataSet}"/> *************** *** 121,125 **** <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <operation type="MSSQL_INSERT" src="${testDataSet}"/> --- 121,125 ---- <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <operation type="MSSQL_INSERT" src="${testDataSet}"/> *************** *** 130,134 **** <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <operation type="MSSQL_REFRESH" src="${testDataSet}"/> --- 130,134 ---- <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <operation type="MSSQL_REFRESH" src="${testDataSet}"/> *************** *** 139,143 **** <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <operation type="MSSQL_CLEAN_INSERT" src="${testDataSet}"/> --- 139,143 ---- <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <operation type="MSSQL_CLEAN_INSERT" src="${testDataSet}"/> *************** *** 148,152 **** <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <operation type="CLEAN_INSERT" src="${testDataSet}"/> --- 148,152 ---- <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <operation type="CLEAN_INSERT" src="${testDataSet}"/> *************** *** 159,163 **** <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <composite src="${testDataSet}" format="xml"> --- 159,163 ---- <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <composite src="${testDataSet}" format="xml"> *************** *** 171,175 **** <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <composite src="${testDataSet}" format="xml"> --- 171,175 ---- <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <composite src="${testDataSet}" format="xml"> *************** *** 183,187 **** <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <composite src="${testDataSet}"> --- 183,187 ---- <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <composite src="${testDataSet}"> *************** *** 195,199 **** <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <export dest="${exportDataSet}"/> --- 195,199 ---- <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <export dest="${exportDataSet}"/> *************** *** 205,209 **** <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <export dest="${exportDataSet}"> --- 205,209 ---- <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <export dest="${exportDataSet}"> *************** *** 218,222 **** <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <export dest="${exportDataSet}" format="flat"/> --- 218,222 ---- <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <export dest="${exportDataSet}" format="flat"/> *************** *** 228,232 **** <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <export dest="${exportDataSet}" format="xml"/> --- 228,232 ---- <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <export dest="${exportDataSet}" format="xml"/> *************** *** 238,242 **** <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <export dest="${exportDtd}" format="dtd"/> --- 238,242 ---- <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <export dest="${exportDtd}" format="dtd"/> *************** *** 248,255 **** <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <export dest="${exportDtd}" format="invalid"/> </dbunit> </target> --- 248,281 ---- <dbunit driver="${dbunit.profile.driverClass}" url="${dbunit.profile.connectionUrl}" ! userid="${dbunit.profile.user}" password="${dbunit.profile.password}"> <export dest="${exportDtd}" format="invalid"/> </dbunit> + </target> + + <target name="test-export-query"> + <dbunit driver="${dbunit.profile.driverClass}" + url="${dbunit.profile.connectionUrl}" + userid="${dbunit.profile.user}" + password="${dbunit.profile.password}"> + <export dest="${exportDataSet}"> + <query name="TEST_TABLE" sql="SELECT * FROM TEST_TABLE"/> + <query name="PK_TABLE" sql="SELECT * FROM PK_TABLE"/> + </export> + </dbunit> + <delete file="${exportDataSet}"/> + </target> + + <target name="test-export-query-mixed"> + <dbunit driver="${dbunit.profile.driverClass}" + url="${dbunit.profile.connectionUrl}" + userid="${dbunit.profile.user}" + password="${dbunit.profile.password}"> + <export dest="${exportDataSet}"> + <table name="TEST_TABLE" /> + <query name="PK_TABLE" sql="SELECT * FROM PK_TABLE WHERE NORMAL1='0 wor'"/> + </export> + </dbunit> + <delete file="${exportDataSet}"/> </target> |
From: <de...@us...> - 2002-12-11 15:55:53
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv29728 Added Files: QueryDataSet.java Log Message: New DataSet to support queries --- NEW FILE: QueryDataSet.java --- /* * QueryDataSet.java Feb 17, 2002 * * The DbUnit Database Testing Framework * Copyright (C)2002, Manuel Laflamme * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package org.dbunit.dataset; import java.sql.*; import java.util.*; import org.dbunit.database.*; /** * @author Eric Pugh * @created December 4, 2002 * @version $Revision: 1.1 $ */ public class QueryDataSet implements IDataSet { private final IDatabaseConnection _connection; private Map _tableMap = new HashMap(); private Map _queryMap = null; /** *Create a QueryDataSet by passing in the connection to the database to use. * * @param connection The connection object to the database. * @exception SQLException Description of the Exception */ public QueryDataSet(IDatabaseConnection connection) throws SQLException { _connection = connection; } /** * Gets the tableMap attribute of the QueryDataSet object * * @return The tableMap value * @exception DataSetException Thrown if there is an issue. */ private Map getTableMap() throws DataSetException { return _tableMap; } //////////////////////////////////////////////////////////////////////////// // IDataSet interface /** * Gets the tableNames attribute of the QueryDataSet object * * @return An array of all the table names * @exception DataSetException Thrown if there is an issue. */ public String[] getTableNames() throws DataSetException { return (String[]) getTableMap().keySet().toArray(new String[0]); } /** * Gets the tableMetaData attribute of the QueryDataSet object * * @param tableName The name of the table to retrieve * @return The tableMetaData value * @exception DataSetException Thrown if there is an issue. */ public ITableMetaData getTableMetaData(String tableName) throws DataSetException { ITableMetaData metaData = (ITableMetaData) getTableMap().get(tableName); if (metaData != null) { return metaData; } if (!getTableMap().containsKey(tableName)) { throw new NoSuchTableException(tableName); } metaData = new DatabaseTableMetaData(tableName, _connection); getTableMap().put(tableName, metaData); return metaData; } /** * Gets a specific table of the QueryDataSet object * * @param tableName The name of the table to retrieve * @return The table * @exception DataSetException Thrown if there is an issue. */ public ITable getTable(String tableName) throws DataSetException { try { Connection jdbcConnection = _connection.getConnection(); String schema = _connection.getSchema(); Statement statement = jdbcConnection.createStatement(); try { String sql = getQuery(tableName); ResultSet resultSet = statement.executeQuery(sql); try { ITableMetaData metaData = ResultSetTable.createTableMetaData(tableName, resultSet); return new CachedResultSetTable(metaData, resultSet); } finally { resultSet.close(); } } finally { statement.close(); } } catch (SQLException e) { throw new DataSetException(e); } } /** * Gets the tables attribute of the QueryDataSet object * * @return The tables value * @exception DataSetException Thrown if there is an issue. */ public ITable[] getTables() throws DataSetException { String[] names = getTableNames(); List tableList = new ArrayList(names.length); for (int i = 0; i < names.length; i++) { tableList.add(getTable(names[i])); } return (ITable[]) tableList.toArray(new ITable[0]); } /** * Gets the query to be used for a specific table added to the QueryDataSet object * * @param tableName The name of the table * @return The query value */ public String getQuery(String tableName) { return (String) _queryMap.get(tableName); } /** * Adds a table and it's associted query to this dataset. * * @param tableName The name of the table * @param query The query to retrieve data with for this table */ public void addTable(String tableName, String query) { if (_queryMap == null) { _queryMap = new HashMap(); } _queryMap.put(tableName, query); _tableMap.put(tableName, null); } } |
From: <de...@us...> - 2002-12-11 15:54:37
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/database In directory sc8-pr-cvs1:/tmp/cvs-serv29165 Modified Files: DatabaseDataSet.java Log Message: Minor tweak... Index: DatabaseDataSet.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/DatabaseDataSet.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** DatabaseDataSet.java 4 Aug 2002 01:07:13 -0000 1.16 --- DatabaseDataSet.java 11 Dec 2002 15:54:32 -0000 1.17 *************** *** 63,67 **** String columnName = DataSetUtils.getQualifiedName(null, columns[i].getColumnName(), true); - // String columnName = columns[i].getColumnName(); sqlBuffer.append(columnName); } --- 63,66 ---- |
From: <de...@us...> - 2002-12-11 15:53:55
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/ant In directory sc8-pr-cvs1:/tmp/cvs-serv28874 Modified Files: Export.java Table.java Added Files: Query.java Log Message: New Ant support for <query> element --- NEW FILE: Query.java --- /* * Query.java Jun 10, 2002 * * The DbUnit Database Testing Framework * Copyright (C)2002, Timothy Ruppert && Ben Cox * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package org.dbunit.ant; /** * The <code>Query</code> class is just a step placeholder for a table name * within an <code>Export</code>. * * @author Timothy Ruppert && Ben Cox * @version $Revision: 1.1 $ */ public class Query { private String name; private String sql; public Query() { } public String getName() { return name; } public void setName(String name) { this.name = name; } public String toString() { StringBuffer result = new StringBuffer(); result.append("Query: "); result.append(" name=" + name); result.append(" sql=" + sql); return result.toString(); } public String getSql() { return sql; } public void setSql(String sql) { this.sql = sql; } } Index: Export.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/ant/Export.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Export.java 3 Aug 2002 14:49:49 -0000 1.4 --- Export.java 11 Dec 2002 15:53:50 -0000 1.5 *************** *** 26,29 **** --- 26,31 ---- import org.dbunit.database.IDatabaseConnection; import org.dbunit.dataset.IDataSet; + import org.dbunit.dataset.QueryDataSet; + import org.dbunit.dataset.CompositeDataSet; import org.dbunit.dataset.xml.*; *************** *** 49,52 **** --- 51,55 ---- private String format = "flat"; private List tables = new ArrayList(); + private List queries = new ArrayList(); public Export() *************** *** 74,77 **** --- 77,85 ---- } + public List getQueries() + { + return queries; + } + public void setDest(File dest) { *************** *** 98,141 **** } public void execute(IDatabaseConnection connection) throws DatabaseUnitException { ! IDataSet dataset; try { ! if (tables.size() == 0) ! { ! dataset = connection.createDataSet(); ! } ! else ! { ! dataset = connection.createDataSet(getTableArray()); ! } if (dest == null) { throw new DatabaseUnitException("'dest' is a required attribute of the <export> step."); } else { ! OutputStream out = new FileOutputStream(dest); ! try ! { ! if (format.equalsIgnoreCase("flat")) ! { ! FlatXmlDataSet.write(dataset, out); } ! else if (format.equalsIgnoreCase("xml")) ! { ! XmlDataSet.write(dataset, out); } ! else if (format.equalsIgnoreCase("dtd")) ! { ! FlatDtdDataSet.write(dataset, out); } } ! finally { ! out.close(); } } } --- 106,175 ---- } + public void addQuery(Query query) + { + queries.add(query); + } + public void execute(IDatabaseConnection connection) throws DatabaseUnitException { ! IDataSet dataset = null; try { ! if (dest == null) { throw new DatabaseUnitException("'dest' is a required attribute of the <export> step."); } + // retrieve the dataset if no tables or queries specifedid. + if (tables.size() == 0 && queries.size()==0) + { + dataset = connection.createDataSet(); + } else { ! if (tables.size() > 0) { ! dataset = connection.createDataSet(getTableArray()); ! } ! if (queries.size() > 0) { ! QueryDataSet queryDataSet = new QueryDataSet(connection); ! for (int i = 0; i < queries.size(); i++){ ! Query query = (Query)queries.get(i); ! if (query.getSql() == null){ ! throw new DatabaseUnitException("'sql' is a required attribute of the <query> step."); ! } ! queryDataSet.addTable(query.getName(),query.getSql()); ! } ! //crummy merge! ! if(dataset != null) { ! dataset = new CompositeDataSet(queryDataSet,dataset); } ! else { ! dataset = queryDataSet; } } ! ! } ! // save the dataset ! OutputStream out = new FileOutputStream(dest); ! try ! { ! if (format.equalsIgnoreCase("flat")) { ! FlatXmlDataSet.write(dataset, out); ! } ! else if (format.equalsIgnoreCase("xml")) ! { ! XmlDataSet.write(dataset, out); ! } ! else if (format.equalsIgnoreCase("dtd")) ! { ! FlatDtdDataSet.write(dataset, out); } } + finally + { + out.close(); + } } *************** *** 161,164 **** --- 195,208 ---- } + private String[] convertListToStringArray(List list){ + String []strArray = new String[list.size()]; + for (int i = 0; i < list.size(); i++) + { + Table table = (Table)list.get(i); + strArray[i] = table.getName(); + } + return strArray; + } + public String getLogMessage() { *************** *** 174,179 **** result.append("Export: "); result.append(" dest=" + getAbsolutePath(dest)); ! result.append(", format= " + tables); result.append(", tables= " + tables); return result.toString(); --- 218,224 ---- result.append("Export: "); result.append(" dest=" + getAbsolutePath(dest)); ! result.append(", format= " + format); result.append(", tables= " + tables); + result.append(", queries= " + queries); return result.toString(); Index: Table.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/ant/Table.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Table.java 13 Jun 2002 17:24:55 -0000 1.2 --- Table.java 11 Dec 2002 15:53:50 -0000 1.3 *************** *** 34,37 **** --- 34,38 ---- private String name; + private String query; public Table() *************** *** 55,60 **** --- 56,73 ---- result.append("Table: "); result.append(" name=" + name); + result.append(" query=" + query); + return result.toString(); + } + + public String getQuery() + { + return query; + } + + public void setQuery(String query) + { + this.query = query; } } |
From: <de...@us...> - 2002-12-11 15:52:52
|
Update of /cvsroot/dbunit/dbunit/docs In directory sc8-pr-cvs1:/tmp/cvs-serv28422 Modified Files: anttask.html components.html faq.html howto.html index.html Log Message: New docs to support the new ant step parameter <query> for the <export> step. Index: anttask.html =================================================================== RCS file: /cvsroot/dbunit/dbunit/docs/anttask.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** anttask.html 17 Jul 2002 01:55:20 -0000 1.2 --- anttask.html 11 Dec 2002 15:52:47 -0000 1.3 *************** *** 1,3 **** ! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><!-- #BeginTemplate "/Templates/main.dwt" --> --- 1,3 ---- ! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><!-- #BeginTemplate "/Templates/main.dwt" --> *************** *** 5,15 **** <meta http-equiv="Content-Style-Type" content="text/css"> <link href="stylesheet.css" rel="stylesheet" type="text/css"> ! <!-- #BeginEditable "doctitle" --> <title>The Dbunit Framework - Ant Task</title> ! <!-- #EndEditable --> </head> <body> <table cellspadding = 0 cellspacing = 0 border = 0 width="100%"> ! <tr height="100"> <td class="logo" width = 200><img src="images/logo.jpg" width=200 height=100></td> <td class="header"></td> --- 5,15 ---- <meta http-equiv="Content-Style-Type" content="text/css"> <link href="stylesheet.css" rel="stylesheet" type="text/css"> ! <!-- #BeginEditable "doctitle" --> <title>The Dbunit Framework - Ant Task</title> ! <!-- #EndEditable --> </head> <body> <table cellspadding = 0 cellspacing = 0 border = 0 width="100%"> ! <tr height="100"> <td class="logo" width = 200><img src="images/logo.jpg" width=200 height=100></td> <td class="header"></td> *************** *** 17,24 **** </table> <table cellspadding = 0 cellspacing = 0 border = 0> ! <tr> ! ! <td class="menu" nowrap valign="top" > ! <p><a href="index.html">Home</a><br> <br> <a href="intro.html">Introduction</a><br> --- 17,24 ---- </table> <table cellspadding = 0 cellspacing = 0 border = 0> ! <tr> ! ! <td class="menu" nowrap valign="top" > ! <p><a href="index.html">Home</a><br> <br> <a href="intro.html">Introduction</a><br> *************** *** 37,53 **** <br> </p> ! <div align="center"><a href="http://sourceforge.net"> <img alt="SourceForge Logo" border="0" height="31" width="88" src="http://sourceforge.net/sflogo.php?group_id=47439"> </a></div> <br> ! <div align="center"><a href="http://www.silphid.com/"><img alt="Silphid Creations" src="images/silphid.gif" border=0></a></div> </td> ! <td class="body" valign="top"> <!-- #BeginEditable "body" --> <h2>Ant Integration</h2> <h3>Installation</h3> ! The steps required to add the DbUnit task to your system are: <ol> <li>Add the DbUnit jar to Ant's classpath. </li> ! <li>Add a <taskdef> element to your build script as follows: <pre class=code><taskdef name="dbunit" classname="org.dbunit.ant.DbUnitTask"/></pre> </li> --- 37,53 ---- <br> </p> ! <div align="center"><a href="http://sourceforge.net"> <img alt="SourceForge Logo" border="0" height="31" width="88" src="http://sourceforge.net/sflogo.php?group_id=47439"> </a></div> <br> ! <div align="center"><a href="http://www.silphid.com/"><img alt="Silphid Creations" src="images/silphid.gif" border=0></a></div> </td> ! <td class="body" valign="top"> <!-- #BeginEditable "body" --> <h2>Ant Integration</h2> <h3>Installation</h3> ! The steps required to add the DbUnit task to your system are: <ol> <li>Add the DbUnit jar to Ant's classpath. </li> ! <li>Add a <taskdef> element to your build script as follows: <pre class=code><taskdef name="dbunit" classname="org.dbunit.ant.DbUnitTask"/></pre> </li> *************** *** 55,93 **** </ol> <h3>Usage </h3> ! <p>Executes either a single transaction, or a group of transactions, under the DbUnit database testing framework.</p> <h4>Parameters</h4> <table border="1"> ! <tr> <td><b>Attribute</b></td> <td><b>Description</b></td> <td><b>Required</b></td> </tr> ! <tr> <td>driver</td> <td>Class name of the jdbc driver</td> <td>Yes</td> </tr> ! <tr> <td>url</td> <td>Database connection url</td> <td>Yes</td> </tr> ! <tr> <td>userid</td> <td>Database username</td> <td>Yes</td> </tr> ! <tr> <td>password</td> <td>Database password</td> <td>Yes</td> </tr> ! <tr> <td>schema </td> <td>Database schema</td> <td>No</td> </tr> ! <tr> <td>useQualifiedTableNames</td> <td>Set System.property dbunit.qualified.table.names <br> --- 55,93 ---- </ol> <h3>Usage </h3> ! <p>Executes either a single transaction, or a group of transactions, under the DbUnit database testing framework.</p> <h4>Parameters</h4> <table border="1"> ! <tr> <td><b>Attribute</b></td> <td><b>Description</b></td> <td><b>Required</b></td> </tr> ! <tr> <td>driver</td> <td>Class name of the jdbc driver</td> <td>Yes</td> </tr> ! <tr> <td>url</td> <td>Database connection url</td> <td>Yes</td> </tr> ! <tr> <td>userid</td> <td>Database username</td> <td>Yes</td> </tr> ! <tr> <td>password</td> <td>Database password</td> <td>Yes</td> </tr> ! <tr> <td>schema </td> <td>Database schema</td> <td>No</td> </tr> ! <tr> <td>useQualifiedTableNames</td> <td>Set System.property dbunit.qualified.table.names <br> *************** *** 95,99 **** <td>No</td> </tr> ! <tr> <td>supportBatchStatement</td> <td>Set System.property<br> --- 95,99 ---- <td>No</td> </tr> ! <tr> <td>supportBatchStatement</td> <td>Set System.property<br> *************** *** 105,121 **** <h4>Parameters specified as nested elements</h4> <table cellspadding = 0 border = 1 > ! <tr> <td>operation</td> ! <td> ! <p>Use nested <operation> elements to specify which DbUnit operation to perform on the particular file. <br> </p> <table border="1"> ! <tr> <td><b>Attribute</b></td> <td><b>Description</b></td> <td><b>Required</b></td> </tr> ! <tr> <td>type</td> <td>Type of Database operation to perform. Supported types are<br> --- 105,121 ---- <h4>Parameters specified as nested elements</h4> <table cellspadding = 0 border = 1 > ! <tr> <td>operation</td> ! <td> ! <p>Use nested <operation> elements to specify which DbUnit operation to perform on the particular file. <br> </p> <table border="1"> ! <tr> <td><b>Attribute</b></td> <td><b>Description</b></td> <td><b>Required</b></td> </tr> ! <tr> <td>type</td> <td>Type of Database operation to perform. Supported types are<br> *************** *** 126,139 **** <td>Yes</td> </tr> ! <tr> <td>src</td> <td>The xml source upon which the operation is to be performed</td> <td>Yes</td> </tr> ! <tr> <td>format</td> ! <td>Format type of supplied source file. Possible values are "flat" or "xml". Defaults to <a class="code">"flat"</a></td> ! <td> <p>No</p> </td> --- 126,139 ---- <td>Yes</td> </tr> ! <tr> <td>src</td> <td>The xml source upon which the operation is to be performed</td> <td>Yes</td> </tr> ! <tr> <td>format</td> ! <td>Format type of supplied source file. Possible values are "flat" or "xml". Defaults to <a class="code">"flat"</a></td> ! <td> <p>No</p> </td> *************** *** 143,169 **** </tr> <!-- ! <tr> <td>composite</td> ! <td> ! <p>Use nested <a class="code"><composite></a> operation elements ! to combine multiple <a class="code"><operation></a>s (on the same file) into a single one.</p> <table border="1"> ! <tr> <td><b>Attribute</b></td> <td><b>Description</b></td> <td><b>Required</b></td> </tr> ! <tr> <td>src</td> <td>The xml source upon which the operation is to be performed</td> <td>Yes</td> </tr> ! <tr> <td>flat</td> ! <td>If true, use <a class="code">FlatXmlDataSet</a> type in the ! supplied src file. Otherwise use <a class="code">XmlDataSet</a>. Defaults to <a class="code">true</a></td> ! <td> <p>No</p> </td> --- 143,169 ---- </tr> <!-- ! <tr> <td>composite</td> ! <td> ! <p>Use nested <a class="code"><composite></a> operation elements ! to combine multiple <a class="code"><operation></a>s (on the same file) into a single one.</p> <table border="1"> ! <tr> <td><b>Attribute</b></td> <td><b>Description</b></td> <td><b>Required</b></td> </tr> ! <tr> <td>src</td> <td>The xml source upon which the operation is to be performed</td> <td>Yes</td> </tr> ! <tr> <td>flat</td> ! <td>If true, use <a class="code">FlatXmlDataSet</a> type in the ! supplied src file. Otherwise use <a class="code">XmlDataSet</a>. Defaults to <a class="code">true</a></td> ! <td> <p>No</p> </td> *************** *** 172,180 **** <h4>Parameters specified as nested elements </h4> <table border="1"> ! <tr> <td>operation</td> ! <td>See above definition for details. The src and flat attributes ! are supplied as attributes to the <a class="code"><composite></a> ! step and should not be attempted to be overridden by the nested <a class="code"><operation></a> step.</td> </tr> --- 172,180 ---- <h4>Parameters specified as nested elements </h4> <table border="1"> ! <tr> <td>operation</td> ! <td>See above definition for details. The src and flat attributes ! are supplied as attributes to the <a class="code"><composite></a> ! step and should not be attempted to be overridden by the nested <a class="code"><operation></a> step.</td> </tr> *************** *** 183,213 **** </tr> --> ! <tr> <td>export</td> ! <td> ! <p>Use nested <a class="code"><export></a> operation elements ! to export the database to the supplied filename. The default operation ! is to <a class="code"><export></a> the entire database to ! the destination filename with the supplied dataset type. You can ! specify individual tables to<br> ! <a class="code"><export></a> by nesting them under the <export> step.</p> <table width="100%" border="1"> ! <tr> <td><b>Attribute</b></td> <td><b>Description</b></td> <td><b>Required</b></td> </tr> ! <tr> <td>dest</td> <td>The xml destination filename</td> <td>Yes</td> </tr> ! <tr> <td>format</td> ! <td>Format type of supplied destination file. Possible values ! are "flat", "xml" or "dtd". Defaults to <a class="code">"flat"</a></td> ! <td> <p>No</p> </td> --- 183,213 ---- </tr> --> ! <tr> <td>export</td> ! <td> ! <p>Use nested <a class="code"><export></a> operation elements ! to export the database to the supplied filename. The default operation ! is to <a class="code"><export></a> the entire database to ! the destination filename with the supplied dataset type. You can ! specify individual tables or queries to<br> ! <a class="code"><export></a> by nesting them under the <export> step.</p> <table width="100%" border="1"> ! <tr> <td><b>Attribute</b></td> <td><b>Description</b></td> <td><b>Required</b></td> </tr> ! <tr> <td>dest</td> <td>The xml destination filename</td> <td>Yes</td> </tr> ! <tr> <td>format</td> ! <td>Format type of supplied destination file. Possible values ! are "flat", "xml" or "dtd". Defaults to <a class="code">"flat"</a></td> ! <td> <p>No</p> </td> *************** *** 216,231 **** <h4>Parameters specified as nested elements </h4> <table border="1"> ! <tr> <td>table</td> ! <td> ! <p>Use nested <a class=code><table></a> elements to <a class=code><export></a> specific tables. </p> <table border="1"> ! <tr> <td><b>Attribute</b></td> <td><b>Description</b></td> <td><b>Required</b></td> </tr> ! <tr> <td>name</td> <td>Name of the database table to export.</td> --- 216,231 ---- <h4>Parameters specified as nested elements </h4> <table border="1"> ! <tr> <td>table</td> ! <td> ! <p>Use nested <a class=code><table></a> elements to <a class=code><export></a> specific tables. </p> <table border="1"> ! <tr> <td><b>Attribute</b></td> <td><b>Description</b></td> <td><b>Required</b></td> </tr> ! <tr> <td>name</td> <td>Name of the database table to export.</td> *************** *** 235,238 **** --- 235,262 ---- </td> </tr> + <tr> + <td>query</td> + <td> + <p>Use nested <a class=code><query></a> elements to <a class=code><export></a> + data according to a sql statement. </p> + <table border="1"> + <tr> + <td><b>Attribute</b></td> + <td><b>Description</b></td> + <td><b>Required</b></td> + </tr> + <tr> + <td>name</td> + <td>Name to reference the sql statement.</td> + <td>No</td> + </tr> + <tr> + <td>sql</td> + <td>The sql to execute. You can use either SELECT * from Mytable or SELECT col1, col4 from MyTable</td> + <td>No</td> + </tr> + </table> + </td> + </tr> </table> </td> *************** *** 241,294 **** <h3>Examples</h3> <pre> <dbunit driver="org.hsqldb.jdbcDriver"<br> url="jdbc:hsqldb:."<br> userid="sa"<br> password=""><br> <operation type="UPDATE" src="updateFile.xml"/><br> </dbunit></pre> ! <p> Connects to the database given in url as the dbunit user using the org.hsqldb.jdbcDriver ! and executes the UPDATE operation contained within the FlatXmlDataSet file updateFile.xml.</p> <pre> <dbunit driver="org.hsqldb.jdbcDriver"<br> url="jdbc:hsqldb:."<br> userid="sa"<br> password=""><br> <operation type="INSERT" src="insertFile.xml"/><br> <operation type="UPDATE" src="updateFile.xml"/><br> </dbunit></pre> ! <p> Connects to the database given in url as the dbunit user using the org.hsqldb.jdbcDriver. ! It then executes the INSERT operation contained within the FlatXmlDataSet file insertFile.xml <br> ! followed by the execution of the UPDATE operation contained within the FlatXmlDataSet file updateFile.xml.</p> <pre> <dbunit driver="org.hsqldb.jdbcDriver"<br> url="jdbc:hsqldb:."<br> userid="sa"<br> password=""><br> <operation type="UPDATE" src="updateFile.xml" flat="false"/><br> </dbunit></pre> ! <p> Connects to the database given in url as the dbunit user using the org.hsqldb.jdbcDriver ! and executes the UPDATE operation contained within the XmlDataSet file updateFile.xml.</p> <!-- <pre> <dbunit driver="org.hsqldb.jdbcDriver"<br> url="jdbc:hsqldb:."<br> userid="sa"<br> password=""><br> <composite src="compositeFile.xml"><br> <operation type="DELETE"/><br> <operation type="INSERT"/><br> </composite><br> </dbunit></pre> ! <p> Connects to the database given in url as the dbunit user using the org.hsqldb.jdbcDriver. ! It then executes the CompositeOperation, DELETE and then UPDATE, contained within the FlatXmlDataSet file updateFile.xml.</p> <pre> <dbunit driver="org.hsqldb.jdbcDriver"<br> url="jdbc:hsqldb:."<br> userid="sa"<br> password=""><br> <composite src="compositeFile.xml" flat="false"><br> <operation type="INSERT"/><br> <operation type="UPDATE"/><br> </composite><br> </dbunit></pre> ! <p> Connects to the database given in url as the dbunit user using the org.hsqldb.jdbcDriver. ! It then executes the CompositeOperation, DELETE and then UPDATE, contained within the XmlDataSet file updateFile.xml.</p> --> <pre> <dbunit driver="org.hsqldb.jdbcDriver"<br> url="jdbc:hsqldb:."<br> userid="sa"<br> password=""><br> <export dest="exportFile.xml"/><br> </dbunit></pre> ! <p> Connects to the database given in url as the dbunit user using the org.hsqldb.jdbcDriver ! and exports the database to the given destination file as a FlatXmlDataSet. </p> <pre> <dbunit driver="org.hsqldb.jdbcDriver"<br> url="jdbc:hsqldb:."<br> userid="sa"<br> password=""><br> <export dest="exportNonFlatFile.xml" format="xml"/><br> </dbunit></pre> ! <p> Connects to the database given in url as the dbunit user using the org.hsqldb.jdbcDriver ! and exports the database to the given destination file as an XmlDataSet. </p> <pre> <dbunit driver="org.hsqldb.jdbcDriver"<br> url="jdbc:hsqldb:."<br> userid="sa"<br> password=""><br> <export dest="export.dtd" format="dtd"/><br> </dbunit></pre> ! <p> Connects to the database given in url as the dbunit user using the org.hsqldb.jdbcDriver and <br> exports the document type definition (dtd) describing the flat xml format.</p> <pre> <dbunit driver="org.hsqldb.jdbcDriver"<br> url="jdbc:hsqldb:."<br> userid="sa"<br> password=""><br> <export dest="exportFile.xml"><br> <table name="FOO"/><br> <table name="BAR"/><br> </export><br> </dbunit></pre> ! <p> Connects to the database given in url as the dbunit user using the org.hsqldb.jdbcDriver ! and exports the contents of the provided tables to the given destination file as an FlatXmlDataSet. <br> </p> ! <!-- #EndEditable --> <hr> ! <div align="center"> <p><font size="2">Copyright ©2002, Manuel Laflamme, All Rights Reserved</font></p> ! <p><font size="1"><a href="index.html">Home</a> - <a href="intro.html">Introduction</a> ! - <a href="components.html">Core Classes</a> - <a href="anttask.html">Ant ! Task</a> - <a href="howto.html">How-to Guides</a> - <a href="bestpractices.html">Best ! Practices</a> - <a href="properties.html">Properties</a> - <a href="api/index.html">API ! Reference</a> - <a href="faq.html">FAQ</a> - <a href="changes.html">Changes ! History</a> - <a href="download.html">Download</a> - <a href="support.html">Support</a> - <a href="resources.html">Resources</a></font></p> <font size="1">$Revision$ $Date$</font> </div> --- 265,324 ---- <h3>Examples</h3> <pre> <dbunit driver="org.hsqldb.jdbcDriver"<br> url="jdbc:hsqldb:."<br> userid="sa"<br> password=""><br> <operation type="UPDATE" src="updateFile.xml"/><br> </dbunit></pre> ! <p> Connects to the database given in url as the dbunit user using the org.hsqldb.jdbcDriver ! and executes the UPDATE operation contained within the FlatXmlDataSet file updateFile.xml.</p> <pre> <dbunit driver="org.hsqldb.jdbcDriver"<br> url="jdbc:hsqldb:."<br> userid="sa"<br> password=""><br> <operation type="INSERT" src="insertFile.xml"/><br> <operation type="UPDATE" src="updateFile.xml"/><br> </dbunit></pre> ! <p> Connects to the database given in url as the dbunit user using the org.hsqldb.jdbcDriver. ! It then executes the INSERT operation contained within the FlatXmlDataSet file insertFile.xml <br> ! followed by the execution of the UPDATE operation contained within the FlatXmlDataSet file updateFile.xml.</p> <pre> <dbunit driver="org.hsqldb.jdbcDriver"<br> url="jdbc:hsqldb:."<br> userid="sa"<br> password=""><br> <operation type="UPDATE" src="updateFile.xml" flat="false"/><br> </dbunit></pre> ! <p> Connects to the database given in url as the dbunit user using the org.hsqldb.jdbcDriver ! and executes the UPDATE operation contained within the XmlDataSet file updateFile.xml.</p> <!-- <pre> <dbunit driver="org.hsqldb.jdbcDriver"<br> url="jdbc:hsqldb:."<br> userid="sa"<br> password=""><br> <composite src="compositeFile.xml"><br> <operation type="DELETE"/><br> <operation type="INSERT"/><br> </composite><br> </dbunit></pre> ! <p> Connects to the database given in url as the dbunit user using the org.hsqldb.jdbcDriver. ! It then executes the CompositeOperation, DELETE and then UPDATE, contained within the FlatXmlDataSet file updateFile.xml.</p> <pre> <dbunit driver="org.hsqldb.jdbcDriver"<br> url="jdbc:hsqldb:."<br> userid="sa"<br> password=""><br> <composite src="compositeFile.xml" flat="false"><br> <operation type="INSERT"/><br> <operation type="UPDATE"/><br> </composite><br> </dbunit></pre> ! <p> Connects to the database given in url as the dbunit user using the org.hsqldb.jdbcDriver. ! It then executes the CompositeOperation, DELETE and then UPDATE, contained within the XmlDataSet file updateFile.xml.</p> --> <pre> <dbunit driver="org.hsqldb.jdbcDriver"<br> url="jdbc:hsqldb:."<br> userid="sa"<br> password=""><br> <export dest="exportFile.xml"/><br> </dbunit></pre> ! <p> Connects to the database given in url as the dbunit user using the org.hsqldb.jdbcDriver ! and exports the database to the given destination file as a FlatXmlDataSet. </p> <pre> <dbunit driver="org.hsqldb.jdbcDriver"<br> url="jdbc:hsqldb:."<br> userid="sa"<br> password=""><br> <export dest="exportNonFlatFile.xml" format="xml"/><br> </dbunit></pre> ! <p> Connects to the database given in url as the dbunit user using the org.hsqldb.jdbcDriver ! and exports the database to the given destination file as an XmlDataSet. </p> <pre> <dbunit driver="org.hsqldb.jdbcDriver"<br> url="jdbc:hsqldb:."<br> userid="sa"<br> password=""><br> <export dest="export.dtd" format="dtd"/><br> </dbunit></pre> ! <p> Connects to the database given in url as the dbunit user using the org.hsqldb.jdbcDriver and <br> exports the document type definition (dtd) describing the flat xml format.</p> <pre> <dbunit driver="org.hsqldb.jdbcDriver"<br> url="jdbc:hsqldb:."<br> userid="sa"<br> password=""><br> <export dest="exportFile.xml"><br> <table name="FOO"/><br> <table name="BAR"/><br> </export><br> </dbunit></pre> ! <p> Connects to the database given in url as the dbunit user using the org.hsqldb.jdbcDriver ! and exports the contents of the provided tables to the given destination file as an FlatXmlDataSet. <br> </p> ! <pre> <dbunit driver="org.hsqldb.jdbcDriver"<br> url="jdbc:hsqldb:."<br> userid="sa"<br> password=""><br> <export dest="exportFile.xml"><br> <table name="FOO"/><br> <query name="BAR" sql="SELECT COL1, COL2, COL3 as 'COLSPECIAL' FROM BAR WHERE COL1=4"/><br> </export><br> </dbunit></pre> ! <p> Connects to the database given in url as the dbunit user using the org.hsqldb.jdbcDriver ! and exports the contents of the provided tables to the given destination file as an FlatXmlDataSet. The contents ! of the BAR table are only shown where col1 is equal to 4. Col3 is renamed COLSPECIAL as well. ! <br> ! </p> ! <!-- #EndEditable --> <hr> ! <div align="center"> <p><font size="2">Copyright ©2002, Manuel Laflamme, All Rights Reserved</font></p> ! <p><font size="1"><a href="index.html">Home</a> - <a href="intro.html">Introduction</a> ! - <a href="components.html">Core Classes</a> - <a href="anttask.html">Ant ! Task</a> - <a href="howto.html">How-to Guides</a> - <a href="bestpractices.html">Best ! Practices</a> - <a href="properties.html">Properties</a> - <a href="api/index.html">API ! Reference</a> - <a href="faq.html">FAQ</a> - <a href="changes.html">Changes ! History</a> - <a href="download.html">Download</a> - <a href="support.html">Support</a> - <a href="resources.html">Resources</a></font></p> <font size="1">$Revision$ $Date$</font> </div> Index: components.html =================================================================== RCS file: /cvsroot/dbunit/dbunit/docs/components.html,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** components.html 16 Jun 2002 19:21:09 -0000 1.16 --- components.html 11 Dec 2002 15:52:47 -0000 1.17 *************** *** 1,3 **** ! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><!-- #BeginTemplate "/Templates/main.dwt" --> --- 1,3 ---- ! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><!-- #BeginTemplate "/Templates/main.dwt" --> *************** *** 5,15 **** <meta http-equiv="Content-Style-Type" content="text/css"> <link href="stylesheet.css" rel="stylesheet" type="text/css"> ! <!-- #BeginEditable "doctitle" --> <title>The Dbunit Framework - Framework Components</title> ! <!-- #EndEditable --> </head> <body> <table cellspadding = 0 cellspacing = 0 border = 0 width="100%"> ! <tr height="100"> <td class="logo" width = 200><img src="images/logo.jpg" width=200 height=100></td> <td class="header"></td> --- 5,15 ---- <meta http-equiv="Content-Style-Type" content="text/css"> <link href="stylesheet.css" rel="stylesheet" type="text/css"> ! <!-- #BeginEditable "doctitle" --> <title>The Dbunit Framework - Framework Components</title> ! <!-- #EndEditable --> </head> <body> <table cellspadding = 0 cellspacing = 0 border = 0 width="100%"> ! <tr height="100"> <td class="logo" width = 200><img src="images/logo.jpg" width=200 height=100></td> <td class="header"></td> *************** *** 17,24 **** </table> <table cellspadding = 0 cellspacing = 0 border = 0> ! <tr> ! ! <td class="menu" nowrap valign="top" > ! <p><a href="index.html">Home</a><br> <br> <a href="intro.html">Introduction</a><br> --- 17,24 ---- </table> <table cellspadding = 0 cellspacing = 0 border = 0> ! <tr> ! ! <td class="menu" nowrap valign="top" > ! <p><a href="index.html">Home</a><br> <br> <a href="intro.html">Introduction</a><br> *************** *** 37,49 **** <br> </p> ! <div align="center"><a href="http://sourceforge.net"> <img alt="SourceForge Logo" border="0" height="31" width="88" src="http://sourceforge.net/sflogo.php?group_id=47439"> </a></div> <br> ! <div align="center"><a href="http://www.silphid.com/"><img alt="Silphid Creations" src="images/silphid.gif" border=0></a></div> </td> ! <td class="body" valign="top"> <!-- #BeginEditable "body" --> <h2>Core Classes</h2> ! The following walks you through the core classes that make up DbUnit: <ul> <li><a href="#dataset">IDataSet (org.dbunit.dataset)</a></li> --- 37,49 ---- <br> </p> ! <div align="center"><a href="http://sourceforge.net"> <img alt="SourceForge Logo" border="0" height="31" width="88" src="http://sourceforge.net/sflogo.php?group_id=47439"> </a></div> <br> ! <div align="center"><a href="http://www.silphid.com/"><img alt="Silphid Creations" src="images/silphid.gif" border=0></a></div> </td> ! <td class="body" valign="top"> <!-- #BeginEditable "body" --> <h2>Core Classes</h2> ! The following walks you through the core classes that make up DbUnit: <ul> <li><a href="#dataset">IDataSet (org.dbunit.dataset)</a></li> *************** *** 51,62 **** <li><a href="#databaseoperation">DatabaseOperation (org.dbunit.operation)</a></li> </ul> ! <p>All the above are interfaces or abstract classes and you will find yourself using implementations or subclasses.</p> <hr> <h3><a name="dataset">IDataSet</a></h3> ! <p>The <a class="code">IDataSet</a> interface represents is a collection ! of data from various tables. As explained later, these data is used to execute setup operations on a target database. </p> ! <p>The <a class="code">IDataSet</a> implementations provided by the framework are: </p> <ul> --- 51,62 ---- <li><a href="#databaseoperation">DatabaseOperation (org.dbunit.operation)</a></li> </ul> ! <p>All the above are interfaces or abstract classes and you will find yourself using implementations or subclasses.</p> <hr> <h3><a name="dataset">IDataSet</a></h3> ! <p>The <a class="code">IDataSet</a> interface represents is a collection ! of data from various tables. As explained later, these data is used to execute setup operations on a target database. </p> ! <p>The <a class="code">IDataSet</a> implementations provided by the framework are: </p> <ul> *************** *** 68,73 **** <li><a href="#FilteredDataSet">FilteredDataSet</a></li> <li><a href="#CaseInsentiveDataSet" >CaseInsentiveDataSet</a></li> </ul> ! The <a class="code">IDataSet</a> interface: <pre>public interface IDataSet { --- 68,74 ---- <li><a href="#FilteredDataSet">FilteredDataSet</a></li> <li><a href="#CaseInsentiveDataSet" >CaseInsentiveDataSet</a></li> + <li><a href="#QueryDataSet" >QueryDataSet</a></li> </ul> ! The <a class="code">IDataSet</a> interface: <pre>public interface IDataSet { *************** *** 88,96 **** public ITable getTable(String tableName) throws DataSetException; }</pre> ! <a name="XmlDataSet"> <h4>XmlDataSet </h4> ! </a> ! <p>The <a class="code">XmlDataSet</a> class provides the persistence support ! to read from and write to the generic xml dataset format. This format is very generic and must conform to a predefined DTD.</p> <p>The generic xml dataset DTD:<br> --- 89,97 ---- public ITable getTable(String tableName) throws DataSetException; }</pre> ! <a name="XmlDataSet"> <h4>XmlDataSet </h4> ! </a> ! <p>The <a class="code">XmlDataSet</a> class provides the persistence support ! to read from and write to the generic xml dataset format. This format is very generic and must conform to a predefined DTD.</p> <p>The generic xml dataset DTD:<br> *************** *** 150,163 **** </dataset></pre> <h4><a name="FlatXmlDataSet">FlatXmlDataSet</a></h4> ! <p>The <a class="code">FlatXmlDataSet</a> class has been introduced in version ! 1.2 because I found that generic xml datasets were hard to create and ! to maintain. This was particularly painful for tables with several columns. </p> ! <p>In the flat xml format, each xml element corresponds to a table row. ! Each element name corresponds to its table name. The columns correspond ! to attributes. This format has no predefined DTD since it is different ! for each database. DbUnit can generate a DTD for your database (see the <a href="howto.html#generatedtd">How-to guide</a>). </p> ! <p> Here is a sample dataset containing the same data than the <a href="#originalxmlsample">XmlDataSet sample</a>:<br> </p> --- 151,164 ---- </dataset></pre> <h4><a name="FlatXmlDataSet">FlatXmlDataSet</a></h4> ! <p>The <a class="code">FlatXmlDataSet</a> class has been introduced in version ! 1.2 because I found that generic xml datasets were hard to create and ! to maintain. This was particularly painful for tables with several columns. </p> ! <p>In the flat xml format, each xml element corresponds to a table row. ! Each element name corresponds to its table name. The columns correspond ! to attributes. This format has no predefined DTD since it is different ! for each database. DbUnit can generate a DTD for your database (see the <a href="howto.html#generatedtd">How-to guide</a>). </p> ! <p> Here is a sample dataset containing the same data than the <a href="#originalxmlsample">XmlDataSet sample</a>:<br> </p> *************** *** 165,169 **** <!DOCTYPE dataset SYSTEM "my-dataset.dtd"> <dataset> ! <TEST_TABLE COLUMN0="row 0 col 0" COLUMN1="row 0 col 1" COLUMN2="row 0 col 2" COLUMN3="row 0 col 3"/> <TEST_TABLE COLUMN0="row 1 col 0" COLUMN3="row 1 col 3"/> --- 166,170 ---- <!DOCTYPE dataset SYSTEM "my-dataset.dtd"> <dataset> ! <TEST_TABLE COLUMN0="row 0 col 0" COLUMN1="row 0 col 1" COLUMN2="row 0 col 2" COLUMN3="row 0 col 3"/> <TEST_TABLE COLUMN0="row 1 col 0" COLUMN3="row 1 col 3"/> *************** *** 173,217 **** </dataset></pre> <h5>Null Values</h5> ! To specify a null value, you simply have to omit its corresponding attribute. ! In the above example, COLUMN1 and COLUMN2 are nulls for the second row of ! TEST_TABLE. <h5>Table metadata</h5> ! DbUnit generate table metadata from the DTD pointed by the document type ! declaration. DbUnit only support external system URI. The URI can be absolute ! or relative. ! <p> Example of system document type declaration: <pre><!DOCTYPE dataset SYSTEM "my-dataset.dtd"></pre> ! <p>If the xml document does not contain a document type declaration, the ! metadata is generated from the first row of each table. This is highly ! recommended to always provide a document type declaration since DbUnit ! will think your table is missing some columns if the first row has one ! or more null values. <h4><a name="DatabaseDataSet">DatabaseDataSet</a></h4> ! The <a class=code>DatabaseDataSet</a> is an adapter class that allows access ! to a database contents as a dataset. This class is not usually instantiated directly but from the factory method <a class="code">IDatabaseConnection.createDataSet()</a>.<br> <h4><a name="DefaultDataSet">DefaultDataSet</a></h4> ! The <a class=code>DefaultDataSet</a> class can be used to create datasets programmatically. <br> <h4><a name="CompositeDataSet">CompositeDataSet</a></h4> ! The <a class=code>CompositeDataSet</a> class combines multiple datasets into a single one at runtime.<br> <h4><a name="FilteredDataSet">FilteredDataSet</a></h4> ! The <a class="code">FileteredDataSet</a> class is is a decorator which exposes only some tables from the decorated dataset. <br> <h4><a name="CaseInsentiveDataSet">CaseInsentiveDataSet</a></h4> ! The <a class="code">CaseInsentiveDataSet</a> class is a decorator that allows ! access to a decorated dataset in a case insensitive way. Dataset implementations ! provided by the framework are case sensitive. This class allows using them in situation where case sensitiveness is not desirable. <br> <hr> <h3><a name="databaseconnection">IDatabaseConnection</a></h3> ! <p>As its name implies, the <a class="code">IDatabaseConnection</a> represent a connection to a database. </p> <p>The DbUnit framework provides two implementations: </p> <ul> ! <li><a class="code">DatabaseConnection</a>, which is a JDBC Connection adapter.</li> ! <li><a class="code">DatabaseDataSourceConnection</a>, which is a JDBC DataSource adapter.<br> </li> --- 174,222 ---- </dataset></pre> <h5>Null Values</h5> ! To specify a null value, you simply have to omit its corresponding attribute. ! In the above example, COLUMN1 and COLUMN2 are nulls for the second row of ! TEST_TABLE. <h5>Table metadata</h5> ! DbUnit generate table metadata from the DTD pointed by the document type ! declaration. DbUnit only support external system URI. The URI can be absolute ! or relative. ! <p> Example of system document type declaration: <pre><!DOCTYPE dataset SYSTEM "my-dataset.dtd"></pre> ! <p>If the xml document does not contain a document type declaration, the ! metadata is generated from the first row of each table. This is highly ! recommended to always provide a document type declaration since DbUnit ! will think your table is missing some columns if the first row has one ! or more null values. <h4><a name="DatabaseDataSet">DatabaseDataSet</a></h4> ! The <a class=code>DatabaseDataSet</a> is an adapter class that allows access ! to a database contents as a dataset. This class is not usually instantiated directly but from the factory method <a class="code">IDatabaseConnection.createDataSet()</a>.<br> <h4><a name="DefaultDataSet">DefaultDataSet</a></h4> ! The <a class=code>DefaultDataSet</a> class can be used to create datasets programmatically. <br> <h4><a name="CompositeDataSet">CompositeDataSet</a></h4> ! The <a class=code>CompositeDataSet</a> class combines multiple datasets into a single one at runtime.<br> <h4><a name="FilteredDataSet">FilteredDataSet</a></h4> ! The <a class="code">FileteredDataSet</a> class is is a decorator which exposes only some tables from the decorated dataset. <br> <h4><a name="CaseInsentiveDataSet">CaseInsentiveDataSet</a></h4> ! The <a class="code">CaseInsentiveDataSet</a> class is a decorator that allows ! access to a decorated dataset in a case insensitive way. Dataset implementations ! provided by the framework are case sensitive. This class allows using them in situation where case sensitiveness is not desirable. <br> + <h4><a name="QueryDataSet">QueryDataSet</a></h4> + The <a class="code">QueryDataSet</a> class is a dataset that allows you to + add tables, and the sql to extract the data to populate the table. It is + currently only used by the Ant query step and export step.<br> <hr> <h3><a name="databaseconnection">IDatabaseConnection</a></h3> ! <p>As its name implies, the <a class="code">IDatabaseConnection</a> represent a connection to a database. </p> <p>The DbUnit framework provides two implementations: </p> <ul> ! <li><a class="code">DatabaseConnection</a>, which is a JDBC Connection adapter.</li> ! <li><a class="code">DatabaseDataSourceConnection</a>, which is a JDBC DataSource adapter.<br> </li> *************** *** 219,224 **** <hr> <h3><a name="databaseoperation">DatabaseOperation</a></h3> ! <p>The <a class="code">DatabaseOperation</a> abstract class defines operations ! performed on a target database before and after each test. Again, the framework provides several implementations. <br> </p> --- 224,229 ---- <hr> <h3><a name="databaseoperation">DatabaseOperation</a></h3> ! <p>The <a class="code">DatabaseOperation</a> abstract class defines operations ! performed on a target database before and after each test. Again, the framework provides several implementations. <br> </p> *************** *** 235,241 **** <li><a href="#IdentityInsertOperation">IdentityInsertOperation</a> </li> </ul> ! <p>The two most usefull operations are <a href="#refresh">REFRESH</a> and ! <a href="#cleanInsert">CLEAN_INSERT</a>. As you will shortly see, they ! are the ones you will deal with most of the time. They represent two opposite testing strategies with different benefits and tradeoffs. </p> <p>The <a class="code">DatabaseOperation</a> class declaration: </p> --- 240,246 ---- <li><a href="#IdentityInsertOperation">IdentityInsertOperation</a> </li> </ul> ! <p>The two most usefull operations are <a href="#refresh">REFRESH</a> and ! <a href="#cleanInsert">CLEAN_INSERT</a>. As you will shortly see, they ! are the ones you will deal with most of the time. They represent two opposite testing strategies with different benefits and tradeoffs. </p> <p>The <a class="code">DatabaseOperation</a> class declaration: </p> *************** *** 248,254 **** public static final IDatabaseOperation REFRESH = new RefreshOperation(); public static final IDatabaseOperation DELETE = new DeleteOperation(); ! public static final IDatabaseOperation DELETE_ALL = new DeleteAllOperation(); ! public static final IDatabaseOperation CLEAN_INSERT = new CompositeOperation(DELETE_ALL, INSERT); --- 253,259 ---- public static final IDatabaseOperation REFRESH = new RefreshOperation(); public static final IDatabaseOperation DELETE = new DeleteOperation(); ! public static final IDatabaseOperation DELETE_ALL = new DeleteAllOperation(); ! public static final IDatabaseOperation CLEAN_INSERT = new CompositeOperation(DELETE_ALL, INSERT); *************** *** 260,264 **** private static class DummyAction extends DatabaseOperation { ! public void execute(IDatabaseConnection connection, IDataSet dataSet) { --- 265,269 ---- private static class DummyAction extends DatabaseOperation { ! public void execute(IDatabaseConnection connection, IDataSet dataSet) { *************** *** 267,305 **** }</pre> <h4><a name="update">DatabaseOperation</a>.UPDATE</h4> ! This operation updates the database from the dataset contents. This operation ! assumes that table data already exists in the target database and fails if this is not the case.<br> <br> <h4><a name="insert">DatabaseOperation.INSERT</a></h4> ! This operation inserts the dataset contents into the database. This operation ! assumes that table data does not exist in the target database and fails ! if this is not the case. To prevent problems with foreign keys, tables must be sequenced appropriately in the dataset. <br> <h4><a name="delete">DatabaseOperation.DELETE</a></h4> ! This operation deletes only the dataset contents from the database. This ! operation does not delete the entire table contents but only data that are present in the dataset. <br> <h4><a name="deleteall">DatabaseOperation.DELETE_ALL</a></h4> ! This operation deletes entire target database table contents for each table ! contained in dataset. In other words, if a dataset does not contain a particular ! table, but that table exists in the database, the contents of that table is not deleted. Deletes are performed on table in reverse sequence.<br> <h4><a name="refresh">DatabaseOperation.REFRESH</a></h4> ! This operation literally refreshes dataset contents into the target database. ! This means that data of existing rows are updated and non-existing row get ! inserted. Any rows which exist in the database but not in dataset stay unaffected. ! This approach is more appropriate for tests that assume other data may exist in the database. <br> <br> ! As you understand, this is a very powerful operation. This strategy can ! help you deal more easily with foreign key constraints, as you don't necessarily need to insert data in a specific sequence. <br> <br> ! If they are correctly written, tests using this strategy can even be performed on a populated database like a copy of a production database. <br> <h4><a name="cleaninsert">DatabaseOperation.CLEAN_INSERT</a></h4> ! This composite operation performs a DELETE_ALL operation followed by an ! INSERT operation. This is the safest approach to ensure that the database ! is in a known state. This is appropriate for tests that require the database to only contain a specific set of data.<br> <h4><a name="none">DatabaseOperation.NONE</a></h4> --- 272,310 ---- }</pre> <h4><a name="update">DatabaseOperation</a>.UPDATE</h4> ! This operation updates the database from the dataset contents. This operation ! assumes that table data already exists in the target database and fails if this is not the case.<br> <br> <h4><a name="insert">DatabaseOperation.INSERT</a></h4> ! This operation inserts the dataset contents into the database. This operation ! assumes that table data does not exist in the target database and fails ! if this is not the case. To prevent problems with foreign keys, tables must be sequenced appropriately in the dataset. <br> <h4><a name="delete">DatabaseOperation.DELETE</a></h4> ! This operation deletes only the dataset contents from the database. This ! operation does not delete the entire table contents but only data that are present in the dataset. <br> <h4><a name="deleteall">DatabaseOperation.DELETE_ALL</a></h4> ! This operation deletes entire target database table contents for each table ! contained in dataset. In other words, if a dataset does not contain a particular ! table, but that table exists in the database, the contents of that table is not deleted. Deletes are performed on table in reverse sequence.<br> <h4><a name="refresh">DatabaseOperation.REFRESH</a></h4> ! This operation literally refreshes dataset contents into the target database. ! This means that data of existing rows are updated and non-existing row get ! inserted. Any rows which exist in the database but not in dataset stay unaffected. ! This approach is more appropriate for tests that assume other data may exist in the database. <br> <br> ! As you understand, this is a very powerful operation. This strategy can ! help you deal more easily with foreign key constraints, as you don't necessarily need to insert data in a specific sequence. <br> <br> ! If they are correctly written, tests using this strategy can even be performed on a populated database like a copy of a production database. <br> <h4><a name="cleaninsert">DatabaseOperation.CLEAN_INSERT</a></h4> ! This composite operation performs a DELETE_ALL operation followed by an ! INSERT operation. This is the safest approach to ensure that the database ! is in a known state. This is appropriate for tests that require the database to only contain a specific set of data.<br> <h4><a name="none">DatabaseOperation.NONE</a></h4> *************** *** 308,326 **** This operation combines multiple operations into a single one.<br> <h4><a name="TransactionOperation">TransactionOperation</a></h4> ! <p>This operation decorates an operation and executes it within the context of a transaction.</p> <h4><a name="IdentityInsertOperation">IdentityInsertOperation<a ></a></a></h4> ! <p>This operation decorates an operation and disables the MS SQL Server automatic identifier generation (IDENTITY) during its execution.</p> ! <!-- #EndEditable --> <hr> ! <div align="center"> <p><font size="2">Copyright ©2002, Manuel Laflamme, All Rights Reserved</font></p> ! <p><font size="1"><a href="index.html">Home</a> - <a href="intro.html">Introduction</a> ! - <a href="components.html">Core Classes</a> - <a href="anttask.html">Ant ! Task</a> - <a href="howto.html">How-to Guides</a> - <a href="bestpractices.html">Best ! Practices</a> - <a href="properties.html">Properties</a> - <a href="api/index.html">API ! Reference</a> - <a href="faq.html">FAQ</a> - <a href="changes.html">Changes ! History</a> - <a href="download.html">Download</a> - <a href="support.html">Support</a> - <a href="resources.html">Resources</a></font></p> <font size="1">$Revision$ $Date$</font> </div> --- 313,331 ---- This operation combines multiple operations into a single one.<br> <h4><a name="TransactionOperation">TransactionOperation</a></h4> ! <p>This operation decorates an operation and executes it within the context of a transaction.</p> <h4><a name="IdentityInsertOperation">IdentityInsertOperation<a ></a></a></h4> ! <p>This operation decorates an operation and disables the MS SQL Server automatic identifier generation (IDENTITY) during its execution.</p> ! <!-- #EndEditable --> <hr> ! <div align="center"> <p><font size="2">Copyright ©2002, Manuel Laflamme, All Rights Reserved</font></p> ! <p><font size="1"><a href="index.html">Home</a> - <a href="intro.html">Introduction</a> ! - <a href="components.html">Core Classes</a> - <a href="anttask.html">Ant ! Task</a> - <a href="howto.html">How-to Guides</a> - <a href="bestpractices.html">Best ! Practices</a> - <a href="properties.html">Properties</a> - <a href="api/index.html">API ! Reference</a> - <a href="faq.html">FAQ</a> - <a href="changes.html">Changes ! History</a> - <a href="download.html">Download</a> - <a href="support.html">Support</a> - <a href="resources.html">Resources</a></font></p> <font size="1">$Revision$ $Date$</font> </div> Index: faq.html =================================================================== RCS file: /cvsroot/dbunit/dbunit/docs/faq.html,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** faq.html 17 Jul 2002 01:55:21 -0000 1.18 --- faq.html 11 Dec 2002 15:52:48 -0000 1.19 *************** *** 1,3 **** ! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><!-- #BeginTemplate "/Templates/main.dwt" --> --- 1,3 ---- ! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><!-- #BeginTemplate "/Templates/main.dwt" --> *************** *** 5,15 **** <meta http-equiv="Content-Style-Type" content="text/css"> <link href="stylesheet.css" rel="stylesheet" type="text/css"> ! <!-- #BeginEditable "doctitle" --> <title>The Dbunit Framework - FAQ</title> ! <!-- #EndEditable --> </head> <body> <table cellspadding = 0 cellspacing = 0 border = 0 width="100%"> ! <tr height="100"> <td class="logo" width = 200><img src="images/logo.jpg" width=200 height=100></td> <td class="header"></td> --- 5,15 ---- <meta http-equiv="Content-Style-Type" content="text/css"> <link href="stylesheet.css" rel="stylesheet" type="text/css"> ! <!-- #BeginEditable "doctitle" --> <title>The Dbunit Framework - FAQ</title> ! <!-- #EndEditable --> </head> <body> <table cellspadding = 0 cellspacing = 0 border = 0 width="100%"> ! <tr height="100"> <td class="logo" width = 200><img src="images/logo.jpg" width=200 height=100></td> <td class="header"></td> *************** *** 17,24 **** </table> <table cellspadding = 0 cellspacing = 0 border = 0> ! <tr> ! ! <td class="menu" nowrap valign="top" > ! <p><a href="index.html">Home</a><br> <br> <a href="intro.html">Introduction</a><br> --- 17,24 ---- </table> <table cellspadding = 0 cellspacing = 0 border = 0> ! <tr> ! ! <td class="menu" nowrap valign="top" > ! <p><a href="index.html">Home</a><br> <br> <a href="intro.html">Introduction</a><br> *************** *** 37,100 **** <br> </p> ! <div align="center"><a href="http://sourceforge.net"> <img alt="SourceForge Logo" border="0" height="31" width="88" src="http://sourceforge.net/sflogo.php?group_id=47439"> </a></div> <br> ! <div align="center"><a href="http://www.silphid.com/"><img alt="Silphid Creations" src="images/silphid.gif" border=0></a></div> </td> ! <td class="body" valign="top"> <!-- #BeginEditable "body" --> <h2><a name="faq">Frequently asked questions</a></h2> <ul> <li><a href="#supportedvendors">Which database system are supported?</a></li> ! <li><a href="#identity">Can I use DbUnit with IDENTITY or auto-increment columns?</a></li> ! <li><a href="#clonedconnection">Why I get a "Can't start a cloned connection" exception when I use InsertIdentityOperation?</a></li> ! <li><a><a href="UnsatisfiedLinkError">Why I get an "UnsatisfiedLinkError" with the DB2 driver?</a></a></li> ! <li><a href="#AmbiguousTableNameException">Why I get a AmbiguousTableNameException?</a></li> </ul> <hr> <h3><a name="supportedvendors">Which database systems are supported?</a></h3> ! <p>The Dbunit framework has been developed and tested with Oracle and HypersonicSQL. ! It uses a fairly simple SQL syntax and should be compatible with the other ! database systems. <a href="support.html">Let us know</a> if you find any incompat... [truncated message content] |
From: <de...@us...> - 2002-12-09 18:00:26
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv12254 Modified Files: IDataSet.java Log Message: Minor spelling change :-) Index: IDataSet.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/IDataSet.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** IDataSet.java 3 Aug 2002 02:26:40 -0000 1.8 --- IDataSet.java 9 Dec 2002 18:00:20 -0000 1.9 *************** *** 39,43 **** /** ! * Returns the specified table metatdata. * * @throws AmbiguousTableNameException if dataset contains multiple tables --- 39,43 ---- /** ! * Returns the specified table metadata. * * @throws AmbiguousTableNameException if dataset contains multiple tables |
From: <de...@us...> - 2002-12-09 17:59:19
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/database In directory sc8-pr-cvs1:/tmp/cvs-serv10399 Modified Files: DatabaseDataSetTest.java Log Message: Minor spelling change :-) Index: DatabaseDataSetTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/database/DatabaseDataSetTest.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** DatabaseDataSetTest.java 7 Aug 2002 01:32:12 -0000 1.16 --- DatabaseDataSetTest.java 9 Dec 2002 17:59:14 -0000 1.17 *************** *** 253,272 **** public void testGetDuplicateTable() throws Exception { ! // Cannot test! Unsuported feature. } public void testGetDuplicateTableMetaData() throws Exception { ! // Cannot test! Unsuported feature. } public void testGetDuplicateTableNames() throws Exception { ! // Cannot test! Unsuported feature. } public void testGetDuplicateTables() throws Exception { ! // Cannot test! Unsuported feature. } } --- 253,272 ---- public void testGetDuplicateTable() throws Exception { ! // Cannot test! Unsupported feature. } public void testGetDuplicateTableMetaData() throws Exception { ! // Cannot test! Unsupported feature. } public void testGetDuplicateTableNames() throws Exception { ! // Cannot test! Unsupported feature. } public void testGetDuplicateTables() throws Exception { ! // Cannot test! Unsupported feature. } } |