FAQ

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.

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 10 of 10 | next ›
Discussion Overview
groupuser @
categoriescayenne
postedSep 17, '12 at 12:11a
activeSep 18, '12 at 8:37a
posts10
users5
websitecayenne.apache.org

People

Translate

site design / logo © 2022 Grokbase