Grzegorz Kossakowski pisze:
Hi,

I'll give you some background to my problem. I use ProcessInfoProvider for accessing environmental data because I've read[1] that it is a proffered way to do this in Cocoon 2.2. Now, I would like to write tests for Spring beans depending on ProcessInfoProvider. I thought that it makes sense to provide mock implementation and register it in AbstractTestCase, similarly to how settings is registered; see my commit r558983[2].

I think, that it should work well and I think that it makes sense to register ProcessInfoProvider implementation in AbstractTestCase because this component provides access to environment and should be easily available for every test. The problem is that ProcessInfoProvider refers to javax.servlet.http.HttpServletRequest and in AbstractTestCase request is created with type org.apache.cocoon.environment.Request.

I'm puzzled what to do in such case, do you have any suggestion?

[1] http://article.gmane.org/gmane.text.xml.cocoon.devel/68706
[2] http://article.gmane.org/gmane.text.xml.cocoon.cvs/24845

After exploring code for a while I came to conclusion that I need to implement stub implementation of HttpServletRequest, HttpServletResponse and ServletContext that will forward to Cocoon's corresponding classes.

Additionally, I've read /[RT] Ditching the environment abstraction/ thread[1] where Daniel proposed to switch to standard servlet interfaces from Cocoon's own ones. I've seen that several folks were rather reluctant[2][3] to allow these changes. There were concerns raised[4] that some methods in our interfaces has no counterparts in Servlet API interfaces.

Since ProcessInfoProvider operates on interfaces from Servlet API I wonder if 
community's standpoint changed to date.

Carsten, it was you who introduced ProcessInfoProvider interface, could you 
comment?

[1] http://thread.gmane.org/gmane.text.xml.cocoon.devel/59035
[2] http://article.gmane.org/gmane.text.xml.cocoon.devel/59143
[3] http://article.gmane.org/gmane.text.xml.cocoon.devel/59163
[4] http://article.gmane.org/gmane.text.xml.cocoon.devel/59118

--
Grzegorz Kossakowski
http://reflectingonthevicissitudes.wordpress.com/

Reply via email to