Thanks a lot for your contribution Polly. I will include it in trunk.

/Patrik

PS. Have you also noticed: http://fornax.itemis.de/jira/browse/CSC-382


polly.c.chang wrote:
> 
> Hi,
> 
> The code that generates the DBUnit XML file is really robust and is a
> great time-saver!  Thank you so much for writing it.  However, we noticed
> that the generated file is missing the many-to-many join tables.  This was
> pretty simple to fix though.
> 
> In dbhelper.ext:
> 
> // get unique list of join tables     
> Set[String] getJoinTableNames(Collection[DomainObject] domainObjects) :
>       domainObjects.collect( d | d.getJoinTableNames()).flatten().toSet();
> 
> // get join tables for this domain object     
> Set[String] getJoinTableNames(DomainObject domainObject) :
>       domainObject.references.select(r | isManyToMany(r) 
>               && r.to.hasOwnDatabaseRepresentation())
>               .getManyToManyJoinTableName();
> 
> In the template:
> «DEFINE dbunitTestData FOR Service»
>     «FILE "dbunit/" + name + "Test.xml" TO_RESOURCES_TEST»
> <?xml version='1.0' encoding='UTF-8'?>
> <dataset>
>       «LET module.application.getDomainObjectsInCreateOrder(true) AS
> domainObjects -»
>       «FOREACH domainObjects AS domainObject »
>               <«domainObject.getDatabaseName()» />
>       «ENDFOREACH »
>       «FOREACH domainObjects.getJoinTableNames() AS joinTableName »
>               <«joinTableName» />
>       «ENDFOREACH »
>       «ENDLET»
> </dataset>
>     «ENDFILE »
> «ENDDEFINE »
> 
> The code that I tested with is slightly different due to my
> customizations, but that should be what is needed for Sculptor trunk code. 
> Hope that helps.
> 
> Thanks,
> Polly
> 

-- 
View this message in context: 
http://www.nabble.com/-Sculptor--DbUnit-file-and-join-tables-tp25088656s17564p25091362.html
Sent from the Fornax-Platform mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Fornax-developer mailing list
Fornax-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fornax-developer

Reply via email to