cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Upayavira>
Subject Re: Eclipse debugging (was Re: [GT2003] Thank you)
Date Wed, 08 Oct 2003 23:51:24 GMT
Steve K wrote:

> 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:

One small point. The CocoonWrapper, while it does do what you need, is 
not intended to be a public interface, and, after discussions at the 
GetTogether, could change or be removed. I'd suggest you use (and extend 
if necessary) the CocoonBean, which after all has the same functionality.

> ----
> 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());

Looks simple enough. Have you tried requesting a view? E.g.:
cocoon.processURIStatus("test/?cocoon-view=links", baos);

Does that work? If it does, that means that you can access the XML as it 
passes through your pipeline by just requesting specific views. If it 
doesn't work, then it needs fixing.

> 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.

It all looks surprisingly neat and simple.

> 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.

Hmm. That would be a bit of a challenge. Why would sax events help you?

Regards, Upayavira

View raw message