ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Larry Meadors <larry.mead...@gmail.com>
Subject Re: Mock for DaoManager
Date Tue, 26 Jul 2005 14:18:41 GMT
Can you trim down the data? I was working on a db with ~800G of data, but it 
only *needed* a few dozen rows in each table to be usable. I was not trying 
to stress test, only unit test.

Larry


On 7/26/05, Akins, Greg <Greg.Akins@am.sony.com> wrote:
> 
> Thanks.
>  I've used DbUnit before..
>  However, the test data we have is in some cases over 20 million rows.
>  
>    1. I had planned on two sets of tests, 1 would use the actual dao 
>    implementations, to test the mappings. 2 would use mocks to speed up the 
>    rest of the testing.
> 
> So I think I can mix both your suggestions to get the results I want. 
> Thanks for the help.
> 
>  -----Original Message-----
> *From:* Larry Meadors [mailto:larry.meadors@gmail.com] 
> *Sent:* Tuesday, July 26, 2005 9:20 AM
> *To:* user-java@ibatis.apache.org
> *Subject:* Re: Mock for DaoManager
> 
> Hmm, ok.
> 
> Two options to consider:
> 1) Use dbunit to populate a database, and use your normal DAOs.
> 2) Create an alternate dao.xml that has your mocked up dao classes that 
> return hard-coded values.
> 
> I would seriously suggest #1..and yes, I know, it is not what you wanted 
> ("without requiring a call to the database"), however, with a smallish 
> database I think you'll find the performance acceptable, and you will get 
> the added benefit of testing your mapped statements, too. 
> 
> Using dbunit, you can specify the exact contents of the database, so you 
> have known quantities to test against. It is a pretty darn slick tool.
> 
> Larry
> 
> 
> On 7/26/05, Akins, Greg <Greg.Akins@am.sony.com> wrote: 
> > 
> > Well, I think I might be on the wrong path...
> >  But what I was trying to do is replace the call the StandardDaoManager 
> > with calls to a MockDaoManager that would return an instance of a mock dao 
> > object
> >  The MockDao object would just keep all the "data" in memory and the 
> > implementation of each method would return data that I could use for 
> > testing, without requiring a call to the database.
> >   
> >  -----Original Message-----
> > *From:* Larry Meadors [mailto:larry.meadors@gmail.com] 
> > *Sent:* Tuesday, July 26, 2005 8:30 AM
> > *To:* user-java@ibatis.apache.org
> > *Subject:* Re: Mock for DaoManager
> > 
> > I am not sure what you are trying to do here..do you want the DAOs 
> > defined in the dao.xml, or do you want to return different ones?
> > 
> > It would be a fairly straightforward exercise to build one that mimicked 
> > the StandardDaoManager class, and exposed the dao maps so you could replace 
> > them.
> > 
> > What is it that you are trying to accomplish? There may be an easier 
> > way...
> > 
> > Larry
> > 
> > On 7/26/05, Akins, Greg <Greg.Akins@am.sony.com> wrote: 
> > > 
> > > Has anyone written a mock object that implements DaoManager for 
> > > testing?
> > > 
> > > I started by writing a specific MockDao that returns a specific Dao
> > > implementation; but wanted something that would use the dao.xml. Just 
> > > wondering if it's been done already.
> > > 
> > > -greg
> > > 
> > > 
> > 
>

Mime
View raw message