On 08.05.2004 15:29, Adam R. B. Jack wrote:
If you could add :
<junitreport nested="build/cocoon-@@DATE@@/test/output"/>
Applied it. Thanks.
I can also reproduce the failure on my local system. When I tried to do all tests some days ago (NetUtils.normalize()) it still worked.
Hmm. Now there's an interesting consequence of the CocoonBeanTestCase. It was supposed to just test one method, and when run on a Cocoon with only a few blocks, it works fine. But....
I haven't been able to run the Bean on a complete Cocoon since I can remember. So this test case has inadvertently shown up a bigger error.
I've started trying to locate the code that breaks it, but am not enough of an Avalon guru to be able to follow it all through. I suspect it is to do with not having servlet.jar in the classpath. I've got a local patch on the Deli block that should remove one such problem (attached), but when trying to debug this I've felt like I'm working pretty much in the dark.
So, we have three choices:
(1) Accept that Gump just will not work until we fix this. Not really acceptable
(2) Remove the CocoonBeanTestCase
(3) Someone more versed in Avalon initialisation have a look into getting the test case working on a full Cocoon.
Thoughts?
Regards, Upayavira
Testsuite: org.apache.cocoon.bean.CocoonBeanTestCase Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 1,5 sec
Testcase: testProcessToStream took 1,109 sec
Caused an ERROR
Could not get class
org.apache.avalon.framework.configuration.ConfigurationException: Could not get class
at org.apache.avalon.excalibur.component.ExcaliburComponentManager.configure(ExcaliburComponentManager.java:456)
at org.apache.avalon.framework.container.ContainerUtil.configure(ContainerUtil.java:240)
at org.apache.cocoon.Cocoon.configure(Cocoon.java:438)
at org.apache.cocoon.Cocoon.initialize(Cocoon.java:296)
at org.apache.avalon.framework.container.ContainerUtil.initialize(ContainerUtil.java:283)
at org.apache.cocoon.bean.CocoonWrapper.initialize(CocoonWrapper.java:151)
at org.apache.cocoon.bean.CocoonBean.initialize(CocoonBean.java:97)
at org.apache.cocoon.bean.CocoonBeanTestCase.getCocoonBean(CocoonBeanTestCase.java:74)
at org.apache.cocoon.bean.CocoonBeanTestCase.testProcessToStream(CocoonBeanTestCase.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
Caused by: java.lang.ClassNotFoundException: org.apache.cocoon.components.language.generator.ProgramGeneratorImpl
at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at org.apache.avalon.excalibur.component.ExcaliburComponentManager.configure(ExcaliburComponentManager.java:442)
... 22 more
Index: src/blocks/deli/java/org/apache/cocoon/components/deli/DeliImpl.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/deli/java/org/apache/cocoon/components/deli/DeliImpl.java,v
retrieving revision 1.10
diff -u -r1.10 DeliImpl.java
--- src/blocks/deli/java/org/apache/cocoon/components/deli/DeliImpl.java 5 Mar
2004 13:01:55 -0000 1.10
+++ src/blocks/deli/java/org/apache/cocoon/components/deli/DeliImpl.java 9 May
2004 07:42:51 -0000
@@ -49,6 +49,7 @@
import org.apache.avalon.framework.thread.ThreadSafe;
import org.apache.cocoon.Constants;
import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.environment.http.HttpContext;
import org.apache.excalibur.xml.dom.DOMParser;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -85,19 +86,27 @@
/** A context, used to retrieve the path to the configuration file */
protected CocoonServletContext servletContext;
+ private boolean isHTTPContext;
/** Contextualize this class */
public void contextualize(Context context) throws ContextException {
org.apache.cocoon.environment.Context ctx =
(org.apache.cocoon.environment.Context)context.get(
Constants.CONTEXT_ENVIRONMENT_CONTEXT);
- this.servletContext = new CocoonServletContext(ctx);
+ isHTTPContext = ctx instanceof HttpContext;
+ if (!isHTTPContext) {
+ getLogger().error("Deli is only available in an HTTP Environment");
+ } else {
+ this.servletContext = new CocoonServletContext(ctx);
+ }
}
/** Service this class */
public void service(ServiceManager manager) throws ServiceException {
this.manager = manager;
try {
- this.parser = (DOMParser)this.manager.lookup(DOMParser.ROLE);
+ if (isHTTPContext) {
+ this.parser = (DOMParser)this.manager.lookup(DOMParser.ROLE);
+ }
} catch (ServiceException e) {
getLogger().error("DELI Exception while creating parser: ", e);
throw e;
@@ -114,7 +123,9 @@
*/
public void initialize() throws Exception {
try {
- Workspace.getInstance().configure(this.servletContext, this.deliConfig);
+ if (isHTTPContext) {
+ Workspace.getInstance().configure(this.servletContext,
this.deliConfig);
+ }
} catch (Exception e) {
getLogger().error("DELI Exception while creating workspace: ", e);
throw e;
