You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by vm...@apache.org on 2003/07/14 12:10:37 UTC

cvs commit: jakarta-cactus/samples/jetty/src/script build.xml

vmassol     2003/07/14 03:10:37

  Modified:    documentation/docs/xdocs/integration integration_jetty.xml
               documentation/docs/xdocs/writing navigation.xml
               framework/src/java/j2ee13/org/apache/cactus/extension/jetty
                        package.html
               documentation/docs/xdocs changes.xml features.xml
                        sitemap.xml
               samples/jetty build.xml
               framework/src/java/share/org/apache/cactus/internal/client
                        ClientTestCaseDelegate.java
               samples/jetty/src/script build.xml
  Added:       framework/src/java/j2ee13/org/apache/cactus/extension/jetty
                        JettyTestSetup.java
               samples/jetty/src/test-cactus/org/apache/cactus/sample
                        TestJettyAll.java
  Removed:     framework/src/java/share/org/apache/cactus/client/initialization
                        Initializable.java package.html
                        ClientInitializer.java
               documentation/docs/xdocs/writing howto_initializer.xml
               framework/src/java/j2ee13/org/apache/cactus/extension/jetty
                        JettyInitializer.java
               samples/servlet/src/test-cactus/j2ee13/org/apache/cactus/sample
                        TestAll.java
  Log:
  Replaced the Initializer feature by the simple and standard JUnit TestSetup feature
  
  Revision  Changes    Path
  1.3       +63 -51    jakarta-cactus/documentation/docs/xdocs/integration/integration_jetty.xml
  
  Index: integration_jetty.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/documentation/docs/xdocs/integration/integration_jetty.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- integration_jetty.xml	13 Jul 2003 23:29:52 -0000	1.2
  +++ integration_jetty.xml	14 Jul 2003 10:10:36 -0000	1.3
  @@ -6,6 +6,7 @@
       <title>Jetty Integration</title>
       <authors>
         <author name="Julien Ruaux" email="jruaux@octo.com"/>
  +      <author name="Vincent Massol" email="vmassol@apache.org"/>
       </authors>
     </properties>
   
  @@ -24,47 +25,60 @@
       <section title="Setting up Jetty">
   
         <p>
  -        The idea is to use the Jetty initializer provided by Cactus so that
  -        Jetty is run before the tests are run. Generally Cactus tests are
  -        launched by a JUnit runner, so we will describe here how to hook the
  -        initializer to it.
  +        The idea is to use the 
  +        <code>org.apache.cactus.extension.jetty.JettyTestSetup</code> JUnit
  +        TestSetup class provided by Cactus so that Jetty is started before the 
  +        tests are run.
         </p>
         
         <p>
  -        There are only two things to do to set up Cactus for Jetty :
  -        <ul>
  -          <li>
  -            Add the Jetty and optionally Jasper jars to the classpath
  -          </li>
  -          <li>
  -            Set the appropriate system properties :
  -            <ul>
  -              <li>
  -                <code>cactus.initializer</code> (required), value :
  -                <code>org.apache.cactus.extension.jetty.JettyInitializer</code> 
  -                : tells Cactus to use JettyInitializer as the initializer.
  -              </li>
  -              <li>
  -                <code>cactus.jetty.config</code> (optional), value :
  -                location of a jetty.xml file (see Jetty's documentation
  -                for details)
  -              </li>
  -              <li>
  -                <code>cactus.jetty.resourceDir</code> (optional), value :
  -                location of a webapp directory (expanded war)
  -              </li>
  -            </ul>
  -          </li>
  -        </ul>
  +        In order to use the TestSetup, perform the following steps you need
  +        to wrap your test suite in <code>JettyTestSetup</code>:
         </p>
  +<source><![CDATA[
  +public class TestJettyAll extends TestCase
  +{
  +    public static Test suite()
  +    {
  +        TestSuite suite = new TestSuite();
  +        suite.addTestSuite(MyTestClass1.class);
  +        [...]
  +        suite.addTestSuite(MyTestClassN.class);
  +        
  +        return new JettyTestSetup(suite);
  +    }        
  +]]></source>
  +      
  +      <p>
  +        You also need to define some System properties to control the Jetty
  +        Test Setup behavior:
  +      </p>      
  +      <ul>
  +        <li>
  +          <code>cactus.jetty.config</code> (optional), value :
  +          location of a jetty.xml file (see Jetty's documentation
  +          for details)
  +        </li>
  +        <li>
  +          <code>cactus.jetty.resourceDir</code> (optional), value :
  +          location of a webapp directory (expanded war)
  +        </li>
  +      </ul>
  +
  +      <note>
  +        If you're using JSPs you'll need to add the Jasper jars to your 
  +        runtime Classpath (in addition to the Jetty jar).
  +      </note>      
   
  -	    <section title="Case 1: running from Ant">
  +      <section title="Case 1: running from Ant">
   	
  -	      <p>
  -	        Let's assume we have a JUnit task that launches the tests.
  -	        All we have to do is add the correct VM arguments to tell Cactus
  -	        to launch Jetty before the tests, and add the Jetty and optionally
  -	        Jasper jars to the classpath. For example : <br/><br/>
  +        <p>
  +          Let's assume we have a JUnit task that launches the tests.
  +          We need to add the Jetty jar and optionally the Jasper jars
  +          (if we use JSPs) to the runtime classpath. Then, all we have 
  +          to do is add the correct VM arguments to configure
  +          the <code>JettyTestSetup</code> behavior. For example:
  +        </p>
   <source><![CDATA[
   <junit>
   
  @@ -72,7 +86,6 @@
       
       <jvmarg value="-Dcactus.contextURL=http://localhost:${test.port}/test"/>
       <jvmarg value="-Dcactus.jetty.resourceDir=${src.webapp.dir}"/>
  -    <jvmarg value="-Dcactus.initializer=org.apache.cactus.extension.jetty.JettyInitializer"/>
       <jvmarg value="-Dcactus.jetty.config=${src.webapp.dir}/test/jetty.xml"/>
   
       <classpath>
  @@ -83,29 +96,28 @@
           <pathelement location="${jasper-runtime.jar}"/>    
       </classpath>
       
  -    <test name="org.apache.cactus.sample.TestAll"/>
  +    <test name="org.apache.cactus.sample.TestJettyAll"/>
   
   </junit>
   ]]></source>
  -	      </p>
   	    
  -	    </section>
  +      </section>
   	    
  -		  <section title="Case 2: running from an IDE">
  +      <section title="Case 2: running from an IDE">
   		
  -		    <p>
  -		      Again all you have to do is add the correct VM arguments, and the
  -		      Jetty and Jasper jars, to the JUnit launch.
  -		    </p>
  +        <p>
  +          Again all you have to do is add the correct VM arguments, and the
  +          Jetty and Jasper jars, to the JUnit launch.
  +        </p>
   		    
  -		    <p>
  -		      For example in Eclipse you would add the jars, and create a JUnit
  -		      launch configuration as below:
  -		      <figure src="images/jetty_eclipse.png"
  -		        alt="Eclipse configuration for Jetty"/>          
  -		    </p>
  +        <p>
  +          For example in Eclipse you would add the jars, and create a JUnit
  +          launch configuration as below:
  +        </p>
  +        <figure src="images/jetty_eclipse.png"
  +          alt="Eclipse configuration for Jetty"/>          
   		
  -		  </section>
  +      </section>
   
       </section>
     </body>
  
  
  
  1.6       +0 -1      jakarta-cactus/documentation/docs/xdocs/writing/navigation.xml
  
  Index: navigation.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/documentation/docs/xdocs/writing/navigation.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- navigation.xml	6 May 2003 17:00:39 -0000	1.5
  +++ navigation.xml	14 Jul 2003 10:10:36 -0000	1.6
  @@ -19,7 +19,6 @@
     <menu label="Advanced Topics">
       <item id="howto_httpunit" label="Integrating HttpUnit"/>
       <item id="howto_security" label="Using Authentication"/>
  -    <item id="howto_initializer" label="Using Initializers"/>
     </menu>
   
     <menu label="Reference">
  
  
  
  1.2       +0 -6      jakarta-cactus/framework/src/java/j2ee13/org/apache/cactus/extension/jetty/package.html
  
  Index: package.html
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/framework/src/java/j2ee13/org/apache/cactus/extension/jetty/package.html,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- package.html	4 Jan 2003 16:45:16 -0000	1.1
  +++ package.html	14 Jul 2003 10:10:36 -0000	1.2
  @@ -10,12 +10,6 @@
     Contains classes to support running Cactus tests against an embedded Jetty
     container.
   </p>
  -<p>
  -  <strong>WARNING</strong><br/>
  -  The classes and interfaces in this package are not intended for use by API 
  -  clients. They may be altered in backwards-incompatible ways and even moved 
  -  or removed at any time without further notice.
  -</p>
   
   </body>
   </html>
  
  
  
  1.1                  jakarta-cactus/framework/src/java/j2ee13/org/apache/cactus/extension/jetty/JettyTestSetup.java
  
  Index: JettyTestSetup.java
  ===================================================================
  /*
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Cactus" and "Apache Software
   *    Foundation" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.cactus.extension.jetty;
  
  import java.net.URL;
  
  import junit.extensions.TestSetup;
  import junit.framework.Test;
  
  import org.apache.cactus.configuration.BaseConfiguration;
  import org.apache.cactus.configuration.Configuration;
  import org.apache.cactus.configuration.FilterConfiguration;
  import org.apache.cactus.configuration.ServletConfiguration;
  import org.apache.cactus.server.FilterTestRedirector;
  import org.apache.cactus.server.ServletTestRedirector;
  import org.apache.cactus.util.ClassLoaderUtils;
  
  /**
   * Custom JUnit test setup to use to automatically start Jetty. Example:<br/>
   * <code><pre>
   * public static Test suite()
   * {
   *     TestSuite suite = new TestSuite(Myclass.class);
   *     return new JettyTestSetup(suite);
   * }
   * </pre></code>
   * 
   * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
   *
   * @version $Id: JettyTestSetup.java,v 1.1 2003/07/14 10:10:36 vmassol Exp $
   */
  public class JettyTestSetup extends TestSetup
  {
      /**
       * Name of optional system property that points to a Jetty XML
       * configuration file.
       */
      private static final String CACTUS_JETTY_CONFIG_PROPERTY = 
          "cactus.jetty.config";
  
      /**
       * Name of optional system property that gives the directory
       * where JSPs and other resources are located. 
       */
      private static final String CACTUS_JETTY_RESOURCE_DIR_PROPERTY = 
          "cactus.jetty.resourceDir";
  
      /**
       * @param theTest the test we are decorating (usually a test suite)
       */
      public JettyTestSetup(Test theTest)
      {
          super(theTest);
      }
  
      /**
       * Start an embedded Jetty server. It is allowed to pass a Jetty XML as
       * a system property (<code>cactus.jetty.config</code>) to further 
       * configure Jetty. Example: 
       * <code>-Dcactus.jetty.config=./jetty.xml</code>.
       *
       * @exception Exception if an error happens during initialization
       */
      public void setUp() throws Exception
      {
          // Note: We are currently using reflection in order not to need Jetty
          // to compile Cactus. If the code becomes more complex or we need to 
          // add other initializer, it will be worth considering moving them
          // to a separate "extension" subproject which will need additional jars
          // in its classpath (using the same mechanism as the Ant project is
          // using to conditionally compile tasks).
  
          // Create configuration objects
          BaseConfiguration baseConfig = new BaseConfiguration();
          ServletConfiguration servletConfig = new ServletConfiguration();
          FilterConfiguration filterConfig = new FilterConfiguration();
  
          // Create a Jetty Server object and configure a listener
          Object server = createServer(baseConfig);
  
          // Create a Jetty context.
          Object context = createContext(server, baseConfig);
          
          // Add the Cactus Servlet redirector
          addServletRedirector(context, servletConfig);
  
          // Add the Cactus Jsp redirector
          addJspRedirector(context);
  
          // Add the Cactus Filter redirector
          addFilterRedirector(context, filterConfig);
  
          // Configure Jetty with an XML file if one has been specified on the
          // command line.
          if (System.getProperty(CACTUS_JETTY_CONFIG_PROPERTY) != null)
          {
              server.getClass().getMethod("configure", 
                  new Class[] {String.class})
                  .invoke(server, new Object[] {System.getProperty(
                      CACTUS_JETTY_CONFIG_PROPERTY)});
          }
  
          // Start the Jetty server
          server.getClass().getMethod("start", null).invoke(server, null);
      }
  
      /**
       * Create a Jetty server object and configures a listener on the
       * port defined in the Cactus context URL property.
       * 
       * @param theConfiguration the base Cactus configuration
       * @return the Jetty <code>Server</code> object
       * 
       * @exception Exception if an error happens during initialization
       */
      private Object createServer(Configuration theConfiguration) 
          throws Exception
      {
          // Create Jetty Server object
          Class serverClass = ClassLoaderUtils.loadClass(
              "org.mortbay.jetty.Server", this.getClass());
          Object server = serverClass.newInstance();
  
          URL contextURL = new URL(theConfiguration.getContextURL());
  
          // Add a listener on the port defined in the Cactus configuration
          server.getClass().getMethod("addListener", 
              new Class[] {String.class})
              .invoke(server, new Object[] {"" + contextURL.getPort()});
  
          return server;
      }
  
      /**
       * Create a Jetty Context. We use a <code>WebApplicationContext</code>
       * because we need to use Servlet Filters.
       * 
       * @param theServer the Jetty Server object
       * @param theConfiguration the base Cactus configuration
       * @return Object the <code>WebApplicationContext</code> object
       * 
       * @exception Exception if an error happens during initialization
       */
      private Object createContext(Object theServer,
          Configuration theConfiguration) throws Exception
      {
          // Add a web application. This creates a WebApplicationContext.
          // Note: We do not put any WEB-INF/, lib/ nor classes/ directory
          // in the webapp.
          URL contextURL = new URL(theConfiguration.getContextURL());
  
          if (System.getProperty(CACTUS_JETTY_RESOURCE_DIR_PROPERTY) != null)
          {
              theServer.getClass().getMethod("addWebApplication", 
                  new Class[] {String.class, String.class})
                  .invoke(theServer, new Object[] {contextURL.getPath(), 
                  System.getProperty(CACTUS_JETTY_RESOURCE_DIR_PROPERTY)});
          }
          
          // Retrieves the WebApplication context created by the
          // "addWebApplication". We need it to be able to manually configure
          // other items in the context.
          Object context = theServer.getClass().getMethod(
              "getContext", new Class[] {String.class})
              .invoke(theServer, new Object[] {contextURL.getPath()});
  
          return context;
      }
      
      /**
       * Adds the Cactus Servlet redirector configuration
       * 
       * @param theContext the Jetty context under which to add the configuration
       * @param theConfiguration the Cactus Servlet configuration
       * 
       * @exception Exception if an error happens during initialization
       */
      private void addServletRedirector(Object theContext,
          ServletConfiguration theConfiguration) throws Exception
      {
          theContext.getClass().getMethod("addServlet", 
              new Class[] {String.class, String.class, String.class})
              .invoke(theContext, 
              new Object[] {theConfiguration.getDefaultRedirectorName(),
              "/" + theConfiguration.getDefaultRedirectorName(), 
              ServletTestRedirector.class.getName()});
      }
      
      /**
       * Adds the Cactus Jsp redirector configuration. We only add it if the
       * CACTUS_JETTY_RESOURCE_DIR_PROPERTY has been provided by the user. This
       * is because JSPs need to be attached to a WebApplicationHandler in Jetty.
       * 
       * @param theContext the Jetty context under which to add the configuration
       * 
       * @exception Exception if an error happens during initialization
       */
      private void addJspRedirector(Object theContext) throws Exception
      {
          if (System.getProperty(CACTUS_JETTY_RESOURCE_DIR_PROPERTY) != null)
          {
              theContext.getClass().getMethod("addServlet", 
                  new Class[] {String.class, String.class})
                  .invoke(theContext, 
                  new Object[] {"*.jsp", 
                  "org.apache.jasper.servlet.JspServlet"});
  
              // Get the WebApplicationHandler object in order to be able to 
              // call the addServlet() method that accpets a forced path.
              Object handler = theContext.getClass().getMethod(
                  "getWebApplicationHandler", 
                  new Class[] {}).invoke(theContext, new Object[] {});
  
              handler.getClass().getMethod("addServlet", 
                  new Class[] {String.class, String.class, String.class, 
                      String.class})
                  .invoke(handler, 
                  new Object[] {"JspRedirector",
                  "/JspRedirector",
                  "org.apache.jasper.servlet.JspServlet",
                  "/jspRedirector.jsp"});
          }
      }
  
      /**
       * Adds the Cactus Filter redirector configuration. We only add it if the
       * CACTUS_JETTY_RESOURCE_DIR_PROPERTY has been provided by the user. This
       * is because Filters need to be attached to a WebApplicationHandler in 
       * Jetty.
       * 
       * @param theContext the Jetty context under which to add the configuration
       * @param theConfiguration the Cactus Filter configuration
       * 
       * @exception Exception if an error happens during initialization
       */
      private void addFilterRedirector(Object theContext,
          FilterConfiguration theConfiguration) throws Exception
      {
          if (System.getProperty(CACTUS_JETTY_RESOURCE_DIR_PROPERTY) != null)
          {
              // Get the WebApplicationHandler object in order to be able to add
              // the Cactus Filter redirector
              Object handler = theContext.getClass().getMethod(
                  "getWebApplicationHandler", 
                  new Class[] {}).invoke(theContext, new Object[] {});
      
              Object filterHolder = handler.getClass().getMethod("defineFilter",
                  new Class[] {String.class, String.class})
                  .invoke(handler, 
                  new Object[] {theConfiguration.getDefaultRedirectorName(),
                  FilterTestRedirector.class.getName()});        
      
              filterHolder.getClass().getMethod("addAppliesTo",
                  new Class[] {String.class})
                  .invoke(filterHolder, new Object[] {"REQUEST"});        
      
              // Map the Cactus Filter redirector to a path
              handler.getClass().getMethod("mapPathToFilter", 
                  new Class[] {String.class, String.class})
                  .invoke(handler, 
                  new Object[] {"/" 
                  + theConfiguration.getDefaultRedirectorName(),
                  theConfiguration.getDefaultRedirectorName()});
          }
      }
  
  }
  
  
  
  1.119     +5 -15     jakarta-cactus/documentation/docs/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/documentation/docs/xdocs/changes.xml,v
  retrieving revision 1.118
  retrieving revision 1.119
  diff -u -r1.118 -r1.119
  --- changes.xml	13 Jul 2003 18:08:44 -0000	1.118
  +++ changes.xml	14 Jul 2003 10:10:36 -0000	1.119
  @@ -320,16 +320,17 @@
           </action>
           <action dev="VMA" type="add">
             Added a Jetty Sample application to demonstrate how to use the new
  -          Jetty initializer.
  +          <code>JettyTestSetup</code> that automatically starts Jetty before
  +          a test suite.
           </action>
           <action dev="JRU" type="add">
             Added a <link href="site:integration_jetty">Jetty integration 
             tutorial</link>.
           </action>
           <action dev="VMA" type="add">
  -          Added a Jetty initializer. This is the first implementation of the 
  -          new initializer feature. This initializer starts Jetty before Cactus 
  -          tests are run. This is really nice to quickly run tests inside any 
  +          Added a <code>org.apache.cactus.extension.jetty.JettyTestSetup</code>
  +          JUnit TestSetup to automatically start Jetty before a test suite
  +          is executed. This is really nice to quickly run tests inside any 
             IDE or even from a simple <code>&lt;junit&gt;</code> Ant taks without 
             the need to package and deploy a WAR. In addition, it is real nice to 
             debug tests this way. Moreover, Jetty starts in less than 1 second, 
  @@ -337,17 +338,6 @@
             order of magnitude as pure JUnit tests in term of speed ... :-). Of 
             course, this is only for Servlet tests ... I am still waiting for an
             embeddable EJB container that starts in less than 1 second ...
  -        </action>
  -        <action dev="JRU" type="add">
  -          Added a <link href="site:howto_initializer">tutorial</link> that explains 
  -          how to use the initializer feature.
  -        </action>
  -        <action dev="VMA" type="add">
  -          Added notion of Initializer. This is an optional class that you can 
  -          specify in <code>cactus.properties</code> or as a System property (
  -          the property name is <code>cactus.initializer</code>). It will be run
  -          once per JVM only. The initializer class must implement the
  -          <code>org.apache.cactus.util.Initializable</code> interface.
           </action>
           <action dev="VMA" type="add">
             Added support for client side <code>begin(...)</code>
  
  
  
  1.21      +3 -11     jakarta-cactus/documentation/docs/xdocs/features.xml
  
  Index: features.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/documentation/docs/xdocs/features.xml,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- features.xml	13 Jul 2003 18:09:56 -0000	1.20
  +++ features.xml	14 Jul 2003 10:10:36 -0000	1.21
  @@ -296,16 +296,8 @@
             be protected.
           </li>
           <li>
  -          Provides a hook for executing initialization code once on the client
  -          side through the use a <code>cactus.initializer</code> System 
  -          property which points to your class implementing the
  -          <code>org.apache.cactus.util.Initializable</code> interface.
  -          <img src="images/new.jpg" alt="New in Cactus 1.5"/>           
  -        </li>
  -        <li>
  -          Provides a Jetty Initializer which can be used to seamlessly and
  -          automatically start the Jetty container before running the Cactus
  -          tests.
  +          Provides a <code>JettyTestSetup</code> JUnit TestSetup class to
  +          automatically start Jetty before a test suite starts executing.
             <img src="images/new.jpg" alt="New in Cactus 1.5"/>           
           </li>
           <li>
  @@ -315,7 +307,7 @@
           </li>
           <li>
             Provide a sample application that demonstrates how to use the 
  -          Jetty Initializer to run Cactus tests.
  +          <code>JettyTestSetup</code> feature to run Cactus tests.
             <img src="images/new.jpg" alt="New in Cactus 1.5"/>           
           </li>
           <li>
  
  
  
  1.54      +0 -5      jakarta-cactus/documentation/docs/xdocs/sitemap.xml
  
  Index: sitemap.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/documentation/docs/xdocs/sitemap.xml,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- sitemap.xml	13 Jul 2003 20:14:15 -0000	1.53
  +++ sitemap.xml	14 Jul 2003 10:10:36 -0000	1.54
  @@ -125,11 +125,6 @@
       Introduction to writing Cactus-based unit tests.
     </resource>
   
  -  <resource id="howto_initializer" target="writing/howto_initializer.html"
  -      name="Initializer Howto">
  -    Information about using the Cactus initializer feature.
  -  </resource>
  -  
     <resource id="howto_testcase_servlet"
         target="writing/howto_testcase_servlet.html"
         name="Writing Cactus Tests for Servlets">
  
  
  
  1.16      +7 -1      jakarta-cactus/samples/jetty/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/samples/jetty/build.xml,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- build.xml	14 Jul 2003 07:47:44 -0000	1.15
  +++ build.xml	14 Jul 2003 10:10:36 -0000	1.16
  @@ -47,6 +47,7 @@
       <property name="src.conf.dir" location="${base.dir}/src/conf"/>
       <property name="src.java.dir" location="${src.dir}/java"/>
       <property name="src.cactus.dir" location="${src.dir}/test-cactus"/>
  +    <property name="src.cactus.jetty.dir" location="${base.dir}/src/test-cactus"/>
       <property name="src.script.dir" location="${base.dir}/src/script"/>
       <property name="src.webapp.dir" location="${base.dir}/src/webapp"/>
   
  @@ -153,6 +154,11 @@
       <mkdir dir="${target.sample.src.cactus.dir}"/>
       <copy todir="${target.sample.src.cactus.dir}">
         <fileset dir="${src.cactus.dir}" excludes="**/unit/**"/>
  +    </copy>
  +
  +    <!-- Copy the Jetty-sample specific source files to the target src dir -->
  +    <copy todir="${target.sample.src.cactus.dir}">
  +      <fileset dir="${src.cactus.jetty.dir}"/>
       </copy>
   
       <!-- Copy web-app files -->
  
  
  
  1.1                  jakarta-cactus/samples/jetty/src/test-cactus/org/apache/cactus/sample/TestJettyAll.java
  
  Index: TestJettyAll.java
  ===================================================================
  /*
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Cactus" and "Apache Software
   *    Foundation" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.cactus.sample;
  
  import org.apache.cactus.extension.jetty.JettyTestSetup;
  
  import junit.framework.Test;
  import junit.framework.TestCase;
  import junit.framework.TestSuite;
  
  /**
   * Run all tests inside the Jetty container.
   *
   * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
   *
   * @version $Id: TestJettyAll.java,v 1.1 2003/07/14 10:10:36 vmassol Exp $
   */
  public class TestJettyAll extends TestCase
  {
      /**
       * @return a <code>JettyTestSetup</code> test suite that wraps all our
       *         tests so that Jetty will be started before the tests execute
       */
      public static Test suite()
      {
          TestSuite suite = new TestSuite(
              "Cactus unit tests executing in Jetty");
  
          // Functional tests
           suite.addTestSuite(org.apache.cactus.sample.TestSampleServlet.class);
           suite.addTestSuite(
               org.apache.cactus.sample.TestSampleServletConfig.class);
           suite.addTestSuite(org.apache.cactus.sample.TestSampleTag.class);
           suite.addTestSuite(org.apache.cactus.sample.TestSampleBodyTag.class);
           suite.addTestSuite(org.apache.cactus.sample.TestSampleFilter.class);
  
          return new JettyTestSetup(suite);
      }
  }
  
  
  
  1.2       +1 -16     jakarta-cactus/framework/src/java/share/org/apache/cactus/internal/client/ClientTestCaseDelegate.java
  
  Index: ClientTestCaseDelegate.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/framework/src/java/share/org/apache/cactus/internal/client/ClientTestCaseDelegate.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ClientTestCaseDelegate.java	12 Jul 2003 19:31:40 -0000	1.1
  +++ ClientTestCaseDelegate.java	14 Jul 2003 10:10:37 -0000	1.2
  @@ -65,7 +65,6 @@
   
   import org.apache.cactus.Request;
   import org.apache.cactus.WebRequest;
  -import org.apache.cactus.client.initialization.ClientInitializer;
   import org.apache.cactus.configuration.Configuration;
   import org.apache.cactus.util.JUnitVersionHelper;
   import org.apache.commons.logging.Log;
  @@ -121,12 +120,6 @@
       protected static final String CLIENT_GLOBAL_END_METHOD = "end";
   
       /**
  -     * Flag used to verify if client initialization has already been performed
  -     * for the current test suite or not.
  -     */
  -    private static boolean isClientInitialized;
  -
  -    /**
        * The logger (only used on the client side).
        */
       private Log logger;
  @@ -279,14 +272,6 @@
           // current extending class so that log statements will contain the
           // actual class name (that's why the logged instance is not static).
           this.logger = LogFactory.getLog(this.getClass());
  -
  -        // Initialize client side configuration
  -        if (!isClientInitialized)
  -        {
  -            // Call client side initializer (if defined). It will be called 
  -            // only once per JVM.
  -            ClientInitializer.initialize(getConfiguration());
  -        }
   
           // Mark beginning of test on client side
           getLogger().debug("------------- Test: " 
  
  
  
  1.5       +1 -3      jakarta-cactus/samples/jetty/src/script/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/samples/jetty/src/script/build.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- build.xml	13 Jul 2003 23:29:52 -0000	1.4
  +++ build.xml	14 Jul 2003 10:10:37 -0000	1.5
  @@ -233,8 +233,6 @@
         <sysproperty key="cactus.contextURL"
             value="http://localhost:${cactus.port}/test"/>
         <sysproperty key="cactus.jetty.resourceDir" file="${src.webapp.dir}"/>
  -      <sysproperty key="cactus.initializer"
  -          value="org.apache.cactus.extension.jetty.JettyInitializer"/>
         <sysproperty key="cactus.jetty.config" file="${src.conf.dir}/jetty.xml"/>
         <classpath>
           <path refid="cactus.classpath"/>
  @@ -245,7 +243,7 @@
         <formatter type="brief" usefile="false"/>
         <formatter type="xml"/>
         <test todir="${target.testreports.dir}"
  -          name="org.apache.cactus.sample.TestAll"/>
  +          name="org.apache.cactus.sample.TestJettyAll"/>
       </junit>
   
       <junitreport todir="${target.testreports.dir}">
  
  
  

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