...3) The remaining thing I dislike is the need to have some code in the sitemap to accept the requests from CocoonUnit)
Thinking wildly about point 3, maybe I could write a unit test servlet and set it up in web.xml to answer requests to /cocoon-unit. Then you wouldn't need code in your sitemap. Hmm....
Why not use sitemap definitions to let CocoonUnitClient (HttpUnit extension) talk to CocoonUnitServer (Cocoon Generator)?
<map:match pattern="/CocoonUnitControl/*/*">
<map:generate type="cocoon-unit">
<map:parameter name="test-context-id" value="{1}"/>
<map:parameter name="operation" value="{2}"/>
</map:generate>
<map:serialize type="xml"/>
</map:match>The Generator would then take care of all interactions between the client-side CocoonUnit classes and the server-side instrumentation stuff: creating test contexts, retrieving pipeline stages, etc, in a RESTish way.
-Bertrand
