cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Juan José Gil <mat...@gmail.com>
Subject Re: Unit Testing cayenne apps
Date Tue, 23 Apr 2013 13:08:54 GMT
Thanks Mike, but I beleive that your code would not work at lastests
cayenne versions (I'm working with 3.1B2) where you use a CayenneRuntime.

Besides, as I'm using the same package to hold development and tests files
(its 'db', but changing the resources folder from 'main' to 'test'), so I
beleive that I should not rename the cayenne config files.


2013/4/23 Mike Kienenberger <mkienenb@gmail.com>

> In older versions of Cayenne, I used this code in my testing framework
> to change where to load the configuration files:
>
>     protected Configuration newConfiguration(String cayenneDomainFileName)
> {
>         DefaultConfiguration conf;
>         if (null == cayenneDomainFileName)
>         {
>             conf = new CustomBasicServletConfiguration();
>         }
>         else
>         {
>             conf = new
> CustomBasicServletConfiguration(cayenneDomainFileName);
>         }
>         conf.addClassPath("com/gvea/cayenne/model/ebpp");
>         return conf;
>     }
>
> However, I also use a custom file name for testing.
>
>
> On Tue, Apr 23, 2013 at 8:05 AM, Juan José Gil <matero@gmail.com> wrote:
> > Hi, I'm using cayenne as persistence layer.
> >
> > The project is builded with maven and developed with Eclipse.
> >
> > The DB is migrated using flyway (http://flywaydb.org/) and I'm using
> > different DBs config for:
> >
> >  * production
> >  * development
> >  * testing
> >
> > So, for migrations, deployment, continuous integration and anything that
> > relies on maven I'm using maven "filtering" capabilities to define the
> jdbc
> > url of the database to be used.
> >
> > BUT when I'm working at eclipse, and try to run my tests / startup my
> > webapp, I cant filter the project resources (not automatically at least)
> > So currently I'm copy-pasting my cayenne conf from src/main/resources/db
> to
> > src/test/resources/db... and I'm not happy with this solution, I feel it
> > smelly, propense to failure, it's ugly, very ugly!
> >
> > I did try to only define the cayenne config at testing resources, but
> when
> > I do that, it doesn't find the mapping xml.
> >
> > Is there a way con pass the mapping path instead of a mapping name to a
> > cayenne config?
> >
> > Can someone point me what should be done to avoid this code/conf smell?
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message