[keycloak-dev] Running unit tests with different model implementations

Bill Burke bburke at redhat.com
Mon Feb 10 16:02:36 EST 2014

I still think there is a bit of model work to be done.  This is why I've 
turned off the picketlink and mongo builds as it is a pain to keep them 
in sync while we're developing new features.

But, the idea was that Model classes are as close to the data model as 
possible with as little business logic as possible.  Manager classes are 
business logic, and the Resource/Service classes are the JAX-RS layer. 
We need to move logic to Manager layer and create a better API at the 
Manager level.  Then move the Manager code to another module (model-api?).

We used to run mongo, picketlink, and JPA as you describe (you 
implemented it).

On 2/10/2014 3:45 PM, Marek Posolda wrote:
> Hi,
> For improving testability, it would be nice if it's possible to execute
> unit tests with all available model implementations.
> It seems that for testability of various model implementations, it may
> be good to move majority of unit test classes (like AdapterTest,
> ImportTest etc) from module "services" into "model/api" and then each
> model implementation will run all unit tests for particular model during
> it's own build. So building of module "model/jpa" will run all unit
> tests with JPA model and similarly building of "model/mongo" will run
> same set of tests for mongo module. This means that unit tests for all
> enabled models will be automatically executed during Keycloak build,
> which means that various model implementations won't be out of sync.
> This would mean that some util classes used in unit tests will be moved
> from services to model/api as well because unit tests need them (For
> example RealmManager, ApplicationManager etc.)
> Another possibility is to keep unit tests in "services" module and just
> add some dedicated profile for running tests with Mongo. So for example
> -Dkeycloak.model=mongo will run unit tests with Mongo model and
> -Dkeycloak.model=all will run unit tests with all available model
> implementations (so currently jpa and mongo).
> What do you think?
> Thanks,
> Marek
> _______________________________________________
> keycloak-dev mailing list
> keycloak-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-dev

Bill Burke
JBoss, a division of Red Hat

More information about the keycloak-dev mailing list