Upayavira wrote:
Start Cocoon with cocoon servlet-debug (instead of just cocoon servlet)

Then, in eclipse, select run/debug...
Click remove java application, then new at the bottom.
Select your cocoon project. Click apply/debug.

The way I've been debugging cocoon is by extending the CocoonWrapper class and adding a slightly different version of the processURI() method that returns the status rather than throwing a ProcessingException on failure. Then I have a Main class (actually, it is a ExcaliburTestCase class) that does the following:


----

CocoonTester cocoon = new CocoonTester();
ByteArrayOutputStream baos = new ByteArrayOutputStream();

cocoon.setContextDir("src/webapp");
cocoon.setLogKit("src/webapp/WEB-INF/debug-logkit.xconf");
cocoon.setLogger("stream");
cocoon.initialize();

cocoon.processURIStatus("test/", baos);
System.out.println(baos.toString());

----

Note that CocoonTester is my subclass of CocoonWrapper, and debug-logkit.xconf is a modified version of the regular cocoon logkit.xconf that uses the stream target to log everything to System.out.

This is the beginnings of my effort to come up with a way to start unit testing cocoon pipelines. It is easier than dealing with remote debugging, and dumping all the logs to the console is helpful as well. I'm looking into a way to send requests to cocoon using the SitemapSource rather than cocoon.process() to request a page since I'd like to get back SAX events rather than bytes.

cheers,
-steve



Reply via email to