dion        02/05/28 23:42:00

  Modified:    src/java/org/apache/maven/struts Struts10WarValidator.java
                        Struts10WarFile.java Forward.java Action.java
                        FormBean.java
               src/test/org/apache/maven/struts Struts10WarFileTest.java
  Added:       src/java/org/apache/maven/struts ConfigurationEntry.java
                        ObjectConfigurationEntry.java
  Log:
  Refactored some classes, added more code for validating forwards
  
  Revision  Changes    Path
  1.9       +57 -3     
jakarta-turbine-maven/src/java/org/apache/maven/struts/Struts10WarValidator.java
  
  Index: Struts10WarValidator.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/struts/Struts10WarValidator.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Struts10WarValidator.java 29 May 2002 00:18:03 -0000      1.8
  +++ Struts10WarValidator.java 29 May 2002 06:42:00 -0000      1.9
  @@ -61,8 +61,12 @@
   import java.util.List;
   import java.util.Map;
   
  +import org.apache.commons.collections.CollectionUtils;
  +import org.apache.commons.lang.Strings;
   import org.apache.maven.j2ee.WarValidator;
   import org.apache.maven.j2ee.WarClassLoader;
  +import org.apache.regexp.RE;
  +import org.apache.regexp.RESyntaxException;
   
   /**
    * A class that validates a Struts 1.0 War File.
  @@ -70,10 +74,23 @@
    * <ol>
    *   <li>Must pass validation as a 'standard' war file</li>
    *   <li>File has a struts configuration file</li>
  + *   <li>&lt;form-bean&gt;s must have a valid <code>type</code> and
  + *      <code>className</code> that exist in the war</li>
  + *   <li>&lt;action&gt;s must have a valid <code>type</code>, 
  + *      <code>className</code> that exist in the war</li>
  + *   <li>&lt;action&gt; <code>name</code>s must refer to a &lt;form-bean&gt;
  + *      in the struts configuraion</li>
  + *   <li>&lt;action&gt; <code>scope</code> must be either <code>request</code>
  + *      or <code>session</code></li>
  + *   <li>&lt;action&gt; <code>unknown</code> and <code>validate</code> must
  + *      be <code>true</code> or <code>false</code></li>
  + *   <li>&lt;global-forwards&gt; <code>type</code> must be a class in the war</li>
  + *   <li>&lt;forward&gt; <code>redirect</code> must be <code>true</code> or
  + *      <code>false</code></li>
    * </ol>
    *
    * @author  dion
  - * @version $Id: Struts10WarValidator.java,v 1.8 2002/05/29 00:18:03 dion Exp $
  + * @version $Id: Struts10WarValidator.java,v 1.9 2002/05/29 06:42:00 dion Exp $
    */
   public class Struts10WarValidator extends WarValidator
   {
  @@ -82,6 +99,9 @@
        * Struts10WarFile#DEFAULT_CONFIG default config}
        */
       private String config = Struts10WarFile.DEFAULT_CONFIG;
  +    /** */
  +    private String actionServletName = 
  +        Struts10WarFile.DEFAULT_ACTIONSERVLET_NAME;
       
       /** Creates a new instance of Struts10WarValidator */
       public Struts10WarValidator()
  @@ -157,6 +177,10 @@
           for (int index = 0; index < formBeans.size(); index++)
           {
               bean = (FormBean) formBeans.get(index);
  +            if (CollectionUtils.cardinality(bean, formBeans) > 1)
  +            {
  +                error("form bean is a duplicate (by name)");
  +            }
               info("validating form bean: '" + bean.getName() + "', class: '" +
                   bean.getType() + "'");
               validateClass(bean.getType(), loader);
  @@ -191,6 +215,10 @@
           for (int index = 0; index < actions.size(); index++) 
           {
               action = (Action) actions.get(index);
  +            if (CollectionUtils.cardinality(action, actions) > 1)
  +            {
  +                error("action is a duplicate (by path)");
  +            }
               validateAction(action, formBeansByName, loader);
           } // end for all actions
       } // end method
  @@ -269,6 +297,10 @@
           {
               forward = (Forward) forwards.get(index);
               info("validating forward '" + forward.getName() + "'");
  +            if (CollectionUtils.cardinality(forward, forwards) > 1)
  +            {
  +                error("forward is a duplicate (by name)");
  +            }
               validateForward(war, forward, loader);
           }
       }
  @@ -279,13 +311,18 @@
        * @param loader a class loader for validating classes are in the war
        */
       private void validateForward(Struts10WarFile war, Forward forward,
  -        ClassLoader loader)
  +        ClassLoader loader) throws IOException
       {
           // check className, if provided
           if (forward.getClassName() != null)
           {
               validateClass(forward.getClassName(), loader);
           }
  +        // check name
  +        if (Strings.isEmpty(forward.getName()))
  +        {
  +            error("name attribute is required");
  +        }
           // check path
           String path = forward.getPath();
           int queryStringStart = path.indexOf("?");
  @@ -295,7 +332,24 @@
           }
           if (!war.hasFile(path))
           {
  -            // could be an action - check to see if it matches the 
  +            try
  +            {
  +                // could be an action - check to see if it matches the pattern for
  +                // action servlet, if it does, extract the action path, and make
  +                // sure it's in the list of actions
  +                RE regexp = new RE(war.getActionServletPattern());
  +                if (regexp.match(path))
  +                {
  +                    String matchingExpression = Strings.replace(path, "*", 
  +                        "(*)");
  +                    RE matching = new RE(matchingExpression);
  +                    String actionPath = matching.getParen(1);
  +                }
  +            }
  +            catch (RESyntaxException e)
  +            {
  +                // ignore temporarily
  +            }
           }
           // check redirect
           if (!isBoolean(forward.getRedirect()))
  
  
  
  1.12      +31 -3     
jakarta-turbine-maven/src/java/org/apache/maven/struts/Struts10WarFile.java
  
  Index: Struts10WarFile.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/struts/Struts10WarFile.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Struts10WarFile.java      29 May 2002 02:20:12 -0000      1.11
  +++ Struts10WarFile.java      29 May 2002 06:42:00 -0000      1.12
  @@ -75,7 +75,7 @@
    * Encapsulates a Struts 1.0 War File. Holds functionality to access Struts
    * specific resources and data in the war.
    * @author  dion
  - * @version $Id: Struts10WarFile.java,v 1.11 2002/05/29 02:20:12 dion Exp $
  + * @version $Id: Struts10WarFile.java,v 1.12 2002/05/29 06:42:00 dion Exp $
    */
   public class Struts10WarFile extends WarFile
   {
  @@ -83,6 +83,11 @@
       public static final String DEFAULT_CONFIG = "WEB-INF/struts-config.xml";
       /** property for the location of the Struts configuration file in the war */
       private String config = Struts10WarFile.DEFAULT_CONFIG;
  +    /** Default name of the action servlet in web.xml */
  +    public static final String DEFAULT_ACTIONSERVLET_NAME = "action";
  +    /** name of the action servlet in web.xml */
  +    private String actionServletName = 
  +        Struts10WarFile.DEFAULT_ACTIONSERVLET_NAME;
       
       /** 
        * Creates a new instance of Struts10WarFile
  @@ -315,11 +320,34 @@
           return forwards;
       }
       
  -    /** retrieve the url pattern for the action servlet
  -     * @return the &lt;url-pattern&gt provided for the servlet named 'action'
  +    /** retrieve the url pattern for the action servlet, or null if not found
  +     * @return the &lt;url-pattern&gt provided for the servlet named by
  +     *      {@link #getActionServletName}
        * @throws IOException when there are problems reading from the war
        */
       public String getActionServletPattern() throws IOException
       {
  +        return (String)getServletMappings().get(getActionServletName());
       }
  +    
  +    /** Getter for property actionServletName.
  +     * @return Value of property actionServletName.
  +     */
  +    public String getActionServletName()
  +    {
  +        return actionServletName;
  +    }
  +    
  +    /** Setter for property actionServletName.
  +     * @param actionServletName New value of property actionServletName.
  +     */
  +    public void setActionServletName(String actionServletName)
  +    {
  +        if (actionServletName == null) 
  +        {
  +            throw new NullPointerException("action servlet name can't be null");
  +        }
  +        this.actionServletName = actionServletName;
  +    }
  +    
    }
  
  
  
  1.2       +2 -38     
jakarta-turbine-maven/src/java/org/apache/maven/struts/Forward.java
  
  Index: Forward.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/struts/Forward.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Forward.java      29 May 2002 00:18:03 -0000      1.1
  +++ Forward.java      29 May 2002 06:42:00 -0000      1.2
  @@ -60,14 +60,10 @@
    * A class to represent a global forward as stored in the Struts configuration
    *
    * @author  dion
  - * @version $Id: Forward.java,v 1.1 2002/05/29 00:18:03 dion Exp $
  + * @version $Id: Forward.java,v 1.2 2002/05/29 06:42:00 dion Exp $
    */
  -public class Forward
  +public class Forward extends ConfigurationEntry
   {
  -    /** unique name for the forward */
  -    private String name;
  -    /** optional, fully qualified class name of the forward implementation */
  -    private String className;
       /** path to forward or redirect to */
       private String path;
       /** whether to redirect or forward to the path*/
  @@ -76,38 +72,6 @@
       /** Creates a new instance of Forward */
       public Forward()
       {
  -    }
  -    
  -    /** Getter for property className.
  -     * @return Value of property className.
  -     */
  -    public String getClassName()
  -    {
  -        return className;
  -    }
  -    
  -    /** Setter for property className.
  -     * @param className New value of property className.
  -     */
  -    public void setClassName(String className)
  -    {
  -        this.className = className;
  -    }
  -    
  -    /** Getter for property name.
  -     * @return Value of property name.
  -     */
  -    public String getName()
  -    {
  -        return name;
  -    }
  -    
  -    /** Setter for property name.
  -     * @param name New value of property name.
  -     */
  -    public void setName(String name)
  -    {
  -        this.name = name;
       }
       
       /** Getter for property path.
  
  
  
  1.4       +41 -59    
jakarta-turbine-maven/src/java/org/apache/maven/struts/Action.java
  
  Index: Action.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/struts/Action.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Action.java       27 May 2002 12:40:58 -0000      1.3
  +++ Action.java       29 May 2002 06:42:00 -0000      1.4
  @@ -61,22 +61,14 @@
    * configuration file
    *
    * @author  dion
  - * @version $Id: Action.java,v 1.3 2002/05/27 12:40:58 dion Exp $
  + * @version $Id: Action.java,v 1.4 2002/05/29 06:42:00 dion Exp $
    */
  -public class Action 
  +public class Action extends ObjectConfigurationEntry
   {
  -    /** Fully qualified Java class name of the ActionMapping implementation 
  -     *  class. */
  -    private String className;
  -    /** Unique identifier of the form bean, if any, associated with the action
  -     */
  -    private String name;
       /** context relative path of the submitted request */
       private String path;
       /** "request" or "session" - scope of the form bean for the action */
       private String scope;
  -    /** Fully qualified Java class name of the implementation class */
  -    private String type;
       /** Whether the action is to be the default for the web app */
       private String unknown;
       /** Whether the form bean should be validated before the action is called */
  @@ -87,38 +79,6 @@
       {
       }
       
  -    /** Getter for property className.
  -     * @return Value of property className.
  -     */
  -    public String getClassName()
  -    {
  -        return className;
  -    }
  -    
  -    /** Setter for property className.
  -     * @param className New value of property className.
  -     */
  -    public void setClassName(String className)
  -    {
  -        this.className = className;
  -    }
  -    
  -    /** Getter for property name.
  -     * @return Value of property name.
  -     */
  -    public String getName()
  -    {
  -        return name;
  -    }
  -    
  -    /** Setter for property name.
  -     * @param name New value of property name.
  -     */
  -    public void setName(String name)
  -    {
  -        this.name = name;
  -    }
  -    
       /** Getter for property scope.
        * @return Value of property scope.
        */
  @@ -135,22 +95,6 @@
           this.scope = scope;
       }
       
  -    /** Getter for property type.
  -     * @return Value of property type.
  -     */
  -    public String getType()
  -    {
  -        return type;
  -    }
  -    
  -    /** Setter for property type.
  -     * @param type New value of property type.
  -     */
  -    public void setType(String type)
  -    {
  -        this.type = type;
  -    }
  -    
       /** Getter for property unknown.
        * @return Value of property unknown.
        */
  @@ -198,5 +142,43 @@
       {
           this.path = path;
       }
  -    
  +
  +    /** whether the passed object is the same as this one. In the case of an
  +     * action object, the path is the unique qualifier. So two objects are equal
  +     * if they have equal paths
  +     * @param o any object
  +     * @return true if o is the same as this object, false otherwise
  +     */
  +    public boolean equals(Object o)
  +    {
  +        if (o == null)
  +        {
  +            return false;
  +        }
  +        
  +        if (getClass() != o.getClass())
  +        {
  +            return false;
  +        }
  +        
  +        return getPath().equals(((Action) o).getPath());
  +    }
  +    
  +    /** provides the hashCode of this object, which is determined by simply
  +     * delegating the responsibility to the <code>path</code> property
  +     * @return the hashCode of the name if not null, otherwise delegate to the
  +     * parent class
  +     */
  +    public int hashCode()
  +    {
  +        if (getPath() != null)
  +        {
  +            return getPath().hashCode();
  +        }
  +        else
  +        {
  +            return super.hashCode();
  +        }
  +    }
  +
   }
  
  
  
  1.4       +2 -95     
jakarta-turbine-maven/src/java/org/apache/maven/struts/FormBean.java
  
  Index: FormBean.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/struts/FormBean.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FormBean.java     27 May 2002 12:40:58 -0000      1.3
  +++ FormBean.java     29 May 2002 06:42:00 -0000      1.4
  @@ -59,107 +59,14 @@
   /**
    * A class to hold data about a Struts form bean as found in the configuration
    * @author  dion
  - * @version $Id: FormBean.java,v 1.3 2002/05/27 12:40:58 dion Exp $
  + * @version $Id: FormBean.java,v 1.4 2002/05/29 06:42:00 dion Exp $
    */
  -public class FormBean
  +public class FormBean extends ObjectConfigurationEntry
   {
  -    /** Unique identifier of this bean, used for reference in action mappings.*/
  -    private String name;
  -    /** Fully qualified Java class name of the ActionFormBean implementation 
  -     *  class. */
  -    private String className;
  -    /** Fully qualified Java class name of the implementation class */
  -    private String type;
  -    
       /** Creates a new instance of FormBean with null values for the properties
        */
       public FormBean()
       {
       }
       
  -    /** Getter for property className.
  -     * @return Value of property className.
  -     */
  -    public String getClassName()
  -    {
  -        return className;
  -    }
  -    
  -    /** Setter for property className.
  -     * @param className New value of property className.
  -     */
  -    public void setClassName(String className)
  -    {
  -        this.className = className;
  -    }
  -    
  -    /** Getter for property name.
  -     * @return Value of property name.
  -     */
  -    public String getName() 
  -    {
  -        return name;
  -    }
  -    
  -    /** Setter for property name.
  -     * @param name New value of property name.
  -     */
  -    public void setName(String name) 
  -    {
  -        this.name = name;
  -    }
  -    
  -    /** Getter for property type.
  -     * @return Value of property type.
  -     */
  -    public String getType()
  -    {
  -        return type;
  -    }
  -    
  -    /** Setter for property type.
  -     * @param type New value of property type.
  -     */
  -    public void setType(String type) 
  -    {
  -        this.type = type;
  -    }
  -    
  -    /** whether the passed object is the same as this one. In the case of a form
  -     * bean, the name is the unique qualifier. So two form beans are equal if
  -     * they have equal names
  -     * @param o any object
  -     * @return true if o is the same as this object, false otherwise
  -     */
  -    public boolean equals(Object o)
  -    {
  -        if (o == null)
  -        {
  -            return false;
  -        }
  -        
  -        if (getClass() != o.getClass())
  -        {
  -            return false;
  -        }
  -        
  -        return getName().equals(((FormBean) o).getName());
  -    }
  -    
  -    /** provides the hashCode of this object, which is determined by simply
  -     * delegating the responsibility to the name property
  -     * @return the hashCode of the name if not null, otherwise delegate to the
  -     * parent class
  -     */
  -    public int hashCode()
  -    {
  -        if (getName() != null)
  -        {
  -            return getName().hashCode();
  -        }
  -        else
  -        {
  -            return super.hashCode();
  -        }
  -    }
   }
  
  
  
  1.1                  
jakarta-turbine-maven/src/java/org/apache/maven/struts/ConfigurationEntry.java
  
  Index: ConfigurationEntry.java
  ===================================================================
  package org.apache.maven.struts;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 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 acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Maven" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Maven", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * 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/>.
   *
   * ====================================================================
   */
  
  /**
   * A class to hold common properties across struts config objects
   *
   * @author  dion
   * @version $Id: ConfigurationEntry.java,v 1.1 2002/05/29 06:42:00 dion Exp $
   */
  public class ConfigurationEntry
  {
      /** Fully qualified Java class name of the implementation class. */
      private String className;
      /** Unique identifier of the form bean, if any, associated with the action
       */
      private String name;
  
      /** Creates a new instance of ConfigurationEntry */
      public ConfigurationEntry()
      {
      }
  
      /** Getter for property className.
       * @return Value of property className.
       */
      public String getClassName()
      {
          return className;
      }
      
      /** Setter for property className.
       * @param className New value of property className.
       */
      public void setClassName(String className)
      {
          this.className = className;
      }
      
      /** Getter for property name.
       * @return Value of property name.
       */
      public String getName() 
      {
          return name;
      }
      
      /** Setter for property name.
       * @param name New value of property name.
       */
      public void setName(String name) 
      {
          this.name = name;
      }
      
      /** whether the passed object is the same as this one. In the case of a 
       * config object, the name is the unique qualifier. So two objects are equal
       * if they have equal names
       * @param o any object
       * @return true if o is the same as this object, false otherwise
       */
      public boolean equals(Object o)
      {
          if (o == null)
          {
              return false;
          }
          
          if (getClass() != o.getClass())
          {
              return false;
          }
          
          return getName().equals(((ConfigurationEntry) o).getName());
      }
      
      /** provides the hashCode of this object, which is determined by simply
       * delegating the responsibility to the name property
       * @return the hashCode of the name if not null, otherwise delegate to the
       * parent class
       */
      public int hashCode()
      {
          if (getName() != null)
          {
              return getName().hashCode();
          }
          else
          {
              return super.hashCode();
          }
      }
  }
  
  
  
  1.1                  
jakarta-turbine-maven/src/java/org/apache/maven/struts/ObjectConfigurationEntry.java
  
  Index: ObjectConfigurationEntry.java
  ===================================================================
  package org.apache.maven.struts;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 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 acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Maven" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Maven", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * 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/>.
   *
   * ====================================================================
   */
  
  /**
   * A struts configuration entry that ends up as a java object, and hence
   * has a <code>type</code> property that is a java class name.
   *
   * @author  dion
   * @version $Id: ObjectConfigurationEntry.java,v 1.1 2002/05/29 06:42:00 dion Exp $
   */
  public class ObjectConfigurationEntry extends ConfigurationEntry
  {
      /** Fully qualified Java class name of the implementing object */
      private String type;
      
      /** Creates a new instance of ObjectConfigurationEntry */
      public ObjectConfigurationEntry()
      {
      }
      
      /** Getter for property type.
       * @return Value of property type.
       */
      public String getType()
      {
          return type;
      }
      
      /** Setter for property type.
       * @param type New value of property type.
       */
      public void setType(String type) 
      {
          this.type = type;
      }
  
  }
  
  
  
  1.8       +25 -1     
jakarta-turbine-maven/src/test/org/apache/maven/struts/Struts10WarFileTest.java
  
  Index: Struts10WarFileTest.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/test/org/apache/maven/struts/Struts10WarFileTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Struts10WarFileTest.java  29 May 2002 00:18:02 -0000      1.7
  +++ Struts10WarFileTest.java  29 May 2002 06:42:00 -0000      1.8
  @@ -65,7 +65,7 @@
    * Unit tests for {@link Struts10WarFile}
    *
    * @author dion
  - * @version $Id: Struts10WarFileTest.java,v 1.7 2002/05/29 00:18:02 dion Exp $
  + * @version $Id: Struts10WarFileTest.java,v 1.8 2002/05/29 06:42:00 dion Exp $
    */
   public class Struts10WarFileTest extends TestCase {
   
  @@ -217,5 +217,29 @@
               assertEquals("Forward number " + index + " isn't "+ names[index], 
                   names[index], forward.getName());
           }
  +    }
  +
  +    /** test the action servlet name property
  +     * @throws Exception when there is an unexpected problem
  +     */
  +    public void testActionServletName() throws Exception
  +    {
  +        testConstructor();
  +        assertEquals("default action servlet name is not 'action'", "action",
  +            Struts10WarFile.DEFAULT_ACTIONSERVLET_NAME);
  +        String dummy = "dummyName";
  +        instance.setActionServletName(dummy);
  +        assertEquals("action servlet name property get or set failed", dummy,
  +            instance.getActionServletName());
  +    }
  +    
  +    /** test the action servlet pattern method
  +     * @throws Exception when there is an unexpected problem
  +     */
  +    public void testActionServletPattern() throws Exception
  +    {
  +        testConstructor();
  +        assertEquals("action servlet pattern is wrong", "*.do",
  +            instance.getActionServletPattern());
       }
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to