velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Teemu Kanstrén <t...@mail.student.oulu.fi>
Subject loading toolbox.xml outside container
Date Mon, 19 Jul 2004 11:46:09 GMT
Hello,

 I am using HttpUnit/ServletUnit to test my webapp. I use velocity 1.4
for my templates, with velocitytools 1.1.

 My tests do not run inside a real container such as tomcat, so they
can't load anything with a path like /WEB-INF/toolbox.xml.

Yet my web.xml defines the init param for the toolbox with

    <init-param>
      <param-name>org.apache.velocity.toolbox</param-name>
      <param-value>/WEB-INF/toolbox.xml</param-value>
    </init-param>

Any ideas how I can get this to load when using HttpUnit/ServletUnit?

I can load the web.xml because ServletUnit provides a constructor to
load it from an InputStream. I can load the templates because I use
a custom ResourceLoader to load them from a jar. Couldn't figure out
how to do it easily for the tools though.

 First I thought I would subclass the VelocityLayoutServlet and just
add the tools to context in the createContext method. Then I realised
it requires the ToolboxManager since I started getting NullPointers
from the tools, which of course makes sense.

 So any ideas on how I could get my tools to load? I guess I can write
my tests around it but I would rather have it working properly..

 The pages work fine under a real container such as tomcat, and when
testing in HttpUnit/ServletUnit everything else works except the tools..



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message