cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Durchholz, Joachim" <Joachim.Durchh...@hennig-fahrzeugteile.de>
Subject RE: Registering Extended Types
Date Tue, 18 Sep 2012 08:37:01 GMT
> Is there a way to avoid accessing / initializing a DB
> in order to be able to use Cayenne generated models?
> I mean, most of my "business logic" unit tests / specs
> time is consumed by configuring cayenne access to an
> in-memory derby db.
> 
> As far as I understand how cayenne works I could avoid
> some of this time by having some "persistent" (not in
> memory) db for unit tests & similar; but... is there a
> way to use models without accessing the db?

Approach 1: Per-test-class setup and teardown. Junit has mechanisms exactly for this.
Approach 2: Package the setup stuff in a class, and use a static class member during testing.
Bonus points if you register a shutdown hook for teardown (but if you simply recreate the
Derby db for every test run, you don't need this).

Nothing of this is Cayenne-specific.
Which means it applies to anything else that might take too long to set up: Tomcat test servers,
virtual machines with FTP server, or what else you might have.

Mime
View raw message