[opencms-dev] Integration of DI solution and testing

Jakub Ječmínek jakub.jecminek at nelasoft.cz
Sat Sep 21 20:11:21 CEST 2013


Hello,
I was trying to figure out the best way how to test my OpenCMS modules for
a while. One of the most problematic things that I have encountered is the
fact that
the CmsObject class is final and has no interface(but you need for almost
everything), therefore standard mocking tools such as EasyMock or Mockito
cannot be used.
The only one mocking framework that is capable of this is PowerMock, but it
is not optimal. Therefore I would like to ask if anybody tried to solve
this problem, whether you
have some custom mocking framework customized for OpenCMS or if there are
plans in OpenCms development to make some architectural changes, that would
allow
better testability.

Another question I have is about dependency injection. Do you use some
library, or do you recommend some DI framework for integration wht OpenCms?
I am used to separating my layers, for example I have DAO object that just
accesses the db and on top of that I have service layer where some business
code lives(in these days sort of standard layout).
One problem that I have is the fact that by default OpenCms is not shipped
with any DI framework.
This would greatly improve development experience when working on bigger
modules, also testability of code would be improved.
So I ask if anybody has experience with integration of some DI framework
with OpenCms or if there are plans to include one in the future releases.
For example CDI reference implementation JBOSS Weld can be easily
integrated with servlet containers such as Apache Tomcat. Apache also has
its own implementation
called OpenWebBeans and set of CDI extensions called DeltaSpike.

Best regards,
Jakub Ječmínek
------------------------------------------------
NELASOFT Technologies, s.r.o.
Mob: +420 604 575 772
E-mail: jakub.jecminek at nelasoft.cz
Web: www.nelasoft.cz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20130921/924ec1ef/attachment.htm>


More information about the opencms-dev mailing list