jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Novotny <novo...@aei.mpg.de>
Subject adding cactus to my webapp
Date Mon, 31 Mar 2003 14:40:13 GMT

Hi,

    I'm trying to configure my webapp to work with Cactus and I read the 
docs and looked at the samples which I'm trying to use for my project. I 
have a GridSphereServlet which is my gridsphere webapp. Normally this 
gets invoked by a user when they go to 
http://127.0.0.1:8080/gridsphere/gridsphere

So what I've done is add these lines to web.xml

<servlet>
        <servlet-name>Redirect</servlet-name>
        <jsp-file>/jsp/redirect.jsp</jsp-file>
    </servlet>

    <servlet>
        <servlet-name>ServletRedirector</servlet-name>
        
<servlet-class>org.apache.commons.cactus.server.ServletTestRedirector</servlet-class>
    </servlet>

<servlet-mapping>
        <servlet-name>ServletRedirector</servlet-name>
        <url-pattern>/ServletRedirector</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>JspRedirector</servlet-name>
        <url-pattern>/JspRedirector</url-pattern>
    </servlet-mapping>

Then I have a GridSphereTests which extends ServletTestCase instantiates 
my servlet and performs some tests as follows:

public static Test suite() {
        URL propsUrl = 
GridSphereTests.class.getResource("/gridsphere/log4j.properties");
        PropertyConfigurator.configure(propsUrl);

        // Instantiate the class to test
        GridSphereServlet servlet = new GridSphereServlet();

        TestSuite suite = new TestSuite();
        suite.addTest(new TestSuite(PortletDescriptorTest.class));
        suite.addTest(new TestSuite(ServiceDescriptorTest.class));
   
    ....

        return suite;
    }

Now I'm trying to add the necessary stuff in my build.xml to get it all 
working together.

I added start and stop Tomcat tasks in my build.xml taken from the samples--

<!--
       
========================================================================
         Start Tomcat 4.1
       
========================================================================
    -->
    <target name="start_tomcat_41">
        <java classname="org.apache.catalina.startup.Bootstrap" fork="yes">
            <jvmarg value="-Dcatalina.home=${tomcat.home.41}"/>
            <arg value="-config"/>
            <arg value="${out.tomcat41.full.dir}/conf/server.xml"/>
            <arg value="start"/>
            <classpath>
              <pathelement location="${java.home}/../lib/tools.jar"/>
              <fileset dir="${tomcat.home.41}">
                  <include name="bin/bootstrap.jar"/>
                  <include name="server/catalina.jar"/>
              </fileset>
            </classpath>
        </java>
    </target>

    <!--
       
========================================================================
         Stop Tomcat 4.1
       
========================================================================
    -->
    <target name="stop_tomcat_41">

        <java classname="org.apache.catalina.startup.Bootstrap" fork="yes">
            <jvmarg value="-Dcatalina.home=${env.CATALINA_HOME}"/>
            <arg value="stop"/>
            <classpath>
              <fileset dir="${env.CATALINA_HOME}">
                  <include name="bin/bootstrap.jar"/>
                  <include name="server/lib/catalina.jar"/>
              </fileset>
            </classpath>
        </java>

    </target>

And now I want to just use <junt> tasks instead of the specialized 
cactus ant tasks--- something like:

<junit printsummary="yes" fork="yes" haltonfailure="no">
            <classpath>
                <path refid="classpath"/>
                <pathelement 
location="${gridsphere.build}/lib/gridsphere.jar"/>
            </classpath>
            <test name="org.gridlab.gridsphere.GridSphereTests" 
todir="${gridsphere.build}/reports">
                <formatter type="xml"/>
            </test>
        </junit>

And then I have a cactus.properties in my 
webapps/gridsphere/WEB-INF/classes that looks like:

cactus.servletRedirectorURL = 
http://127.0.0.1:8080/gridsphere/ServletRedirector
cactus.jspRedirectorURL = http://127.0.0.1:8080/gridsphere/JspRedirector

    Is everything correct here?

    Thanks a lot, Jason






Mime
View raw message