You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Andrew Stevens <at...@hotmail.com> on 2005/09/06 15:33:03 UTC
Can't get CocoonTestCase for my transformer to work
Hi,
I've got some custom Cocoon components that I'm trying to write JUnit test
cases for. Copying from the unit tests I can find in the Cocoon sources
themselves, I made my tests extend
org.apache.cocoon.SitemapComponentTestCase, and included matching .xtest
files to configure them. The tests I did so far for various Action classes
are running just fine, but I'm having some trouble with the test case for a
Transformer.
Following the FilterTransformerTestCase, I declare and configure the
xml-parser,
xmlizer, xslt-processor, source-factories, source-resolver, transient-store,
persistent-store and transformers roles (changing that last one to my
transformer),
and run it with
assertEqual(load(result), transform("myfilter", src, parameters,
load(input)));
("myfilter" was the name I specified on the component-instance). However,
whenever I run the test I just get the error message
junit.framework.AssertionFailedError: Test for component manager
at
org.apache.cocoon.SitemapComponentTestCase.load(SitemapComponentTestCase.java:561)
I can only assume the component manager is missing because there's something
about my configuration it doesn't like, but how on earth can I find out
what? At least when I was doing the Actions' tests I got back useful
messages like ClassNotFoundExceptions which told me which other jars I
needed to add to the classpath. What might be missing here?
I also noticed some of Cocoon's transformers' tests use a TreeProcessor
(shorthand="sitemap") and MockEnvironment too. What determines if those are
needed? I tried adding them into my test in case that was the problem
(though I wasn't sure about the sitemap.xmap the configuration mentions or
where I'd need to put it), but that didn't work either. Instead of the
assertion error mentioned above, I now get a NullPointerException in
org.apache.cocoon.core.container.ContainerTestCase.lookup(ContainerTestCase.java:274)
which, from examining the ContainerTestCase source, appears to be because
the manager object is null. So I presume it's basically the same problem,
i.e. there's something about the configuration that stops it creating the
component manager.
Any help and advice greatly appreciated...
Andrew.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org