Hi Grzegorz,

On 22 Nov 2008, at 16:06, Grzegorz Kossakowski wrote:

Robin Wyles pisze:
<snip/>
It seems the check on the pipeline type and environment type is done by
o.a.c.components.treeprocessor.sitemap.PipelineNode, I made a simple
patch here that checks the request's scheme; if it is 'servlet' and the pipeline is internal only, then processing is allowed to continue. While not ideal, I think this method poses less of a security risk than using a special request attribute. Also it's only one extra line in one class.
WDYT?

Actually, I don't understand how you solved this problem so probably the best thing would be if you
could show me the patch (since it's one-liner).

Patch against o.a.c.components.treeprocessor.sitemap.PipelineNode is attached.


I believe implementing such a functionality on both SSF and
Sitemap-engine sides would be rather
easy task and I'm willing to help with preparing the patch and
applying it. I would require a valid
test-case for it before it gets accepted.

Can you give me some hints as to how I can write a unit test for this? I'm familiar with writing tests for sitemap components but I'm not sure
how to set up a test pipeline and set its attributes accordingly.

I believe this would be very hard to cover with plain, simple unit test so I think integration test is needed. Then it's rather trivial, you just build pipelines (by providing sitemap.xmap) and you
test what has been returned in special JUnit class.

See:
http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-webapp/src/ test/java/org/apache/cocoon/it/
(contains JUnit classes)
http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-it/src/main/ resources/COB-INF/ (contains
sitemap.xmap and rest of the resources)

I'll take a look and see if I can come up with something this week.

On another note - I have a requirement to test how several cocoon 2.2 blocks interact with each other via REST, on deployment these blocks are split into separate webapps that are hosted in different locations, but I guess for testing these could be combined into a single webapp. Is this something that I can achieve using the cocoon- it block?

Cheers,

Robin

Attachment: internal-pipeline-via-servlet-protocol.patch
Description: Binary data

Reply via email to