ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler" <jeffgbut...@gmail.com>
Subject Re: StubObjects / ValidationObjects generation feature planned ?
Date Fri, 06 Jul 2007 18:48:56 GMT
You can plugin your own DAO generator to Abator - write a class that
implements org.apache.ibatis.abator.api.DAOGenerator and then specify that
class in your Abator configuration file.  You'll need to use the Java DOM
classes in Abator to generate Java code - I think they're pretty easy to use
(but I wrote them,so of course I think they're easy to use!)  You can look
at the methods in BaseDAOGenerator for examples of how to write methods.

If you want to add your mock DAO stubs at the same time you generate the
"real" DAOs, then subclass an existing implementation class and override the
getGeneratedJavaFiles method like this:

List getGeneratedJavaFiles(IntrospectedTable introspectedTable,
ProgressCallback progressCallback) {
  List answer = super(introspectedTable, progressCallBack);

  // add mock DAO implementation to the list here

  return answer;

Look at the "Extending Abator" section of the reference documentsion to see
which class to extend.  For example, if you are generating Spring DAOs for
Java5, then extend

Hope that helps!
Jeff Butler

On 7/6/07, tdev <tdev@freenet.de> wrote:
>  Hello, thanks,
> could you please give maybe a hint where to plug in ?
> And I agree thats very subjective.  I think about DBUnit because it seems
> I can write Unit-Tests faster,
> although DBUnit seems xml-overwhelming and with not an easy setup ?
> General asked: What is a good way/tool/framwork to write unit-tests for
> classes using the generated iBatis-DAOs ?
> ----- Original Message -----
> *From:* Jeff Butler <jeffgbutler@gmail.com>
> *To:* user-java@ibatis.apache.org
> *Sent:* Friday, July 06, 2007 7:35 PM
> *Subject:* Re: StubObjects / ValidationObjects generation feature planned
> ?
> I think that generating test stubs is very subjective - so I'm hesitant to
> add it to the base of Abator.  But Abator is very extensible - you could
> plug something in that would do what you want.
> Also - most IDE's will very quickly generate a stub from an interface -
> you could use that feature as a starting point and then fill out the
> specifics as you needed.
> I am interested in your Spring validator idea.
> Jeff Butler
> On 7/6/07, tdev <tdev@freenet.de> wrote:
> >
> >  the ***DAOStub generation should certainly be made better, e.g.:
> >  - instead of the returning 0's defaulting to 1's
> > - a setTestData method to set members, and returning them inside the
> > methods
> >
> >

View raw message