felipeal    2005/04/21 04:56:33

  Modified:    integration/ant/src/java/org/apache/cactus/integration/ant
                        CactifyWarTask.java
               integration/ant/src/test/org/apache/cactus/integration/ant
                        TestCactifyWarTask.java
               integration/ant/src/test-input/org/apache/cactus/integration/ant
                        test-cactifywar.xml
               documentation/docs/xdocs changes.xml
  Log:
  CACTUS-204: CactifyWar task should not require a web.xml
  
  Revision  Changes    Path
  1.33      +4 -9      
jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/CactifyWarTask.java
  
  Index: CactifyWarTask.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/CactifyWarTask.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- CactifyWarTask.java       31 May 2004 20:05:24 -0000      1.32
  +++ CactifyWarTask.java       21 Apr 2005 11:56:33 -0000      1.33
  @@ -353,7 +353,7 @@
               // Parse the original deployment descriptor
               webXml = getOriginalWebXml();
           }
  -        else
  +        if (this.srcFile == null || webXml == null)
           {
               if (this.version == null)
               {
  @@ -674,8 +674,8 @@
        * Extracts and parses the original web deployment descriptor from the
        * web-app.
        * 
  -     * @return The parsed descriptor
  -     * @throws BuildException If the descriptor is not found or could not be 
  +     * @return The parsed descriptor or null if not found
  +     * @throws BuildException If the descriptor could not be 
        *         parsed
        */
       private WebXml getOriginalWebXml() throws BuildException
  @@ -686,11 +686,6 @@
           {
               war = new DefaultWarArchive(this.srcFile);
               WebXml webXml = war.getWebXml();
  -            if (webXml == null)
  -            {
  -                throw new BuildException("The WAR source file does not "
  -                    + "contain a WEB-INF/web.xml deployment descriptor");
  -            }
               return webXml;
           }
           catch (SAXException e)
  
  
  
  1.22      +43 -3     
jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/TestCactifyWarTask.java
  
  Index: TestCactifyWarTask.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/TestCactifyWarTask.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- TestCactifyWarTask.java   31 May 2004 20:05:23 -0000      1.21
  +++ TestCactifyWarTask.java   21 Apr 2005 11:56:33 -0000      1.22
  @@ -124,11 +124,51 @@
           }
           catch (BuildException expected)
           {
  -            assertEquals("The WAR source file does not contain a "
  -                + "WEB-INF/web.xml deployment descriptor", 
  +            assertEquals("You need to specify either the [srcfile] or the "
  +                                     + "[version] attribute", 
                   expected.getMessage());
           }
       }
  +     
  +    /**
  +     * Verifies an empty web was created when the source archive does not 
  +     * contain a web deployment descriptor but specifies the version.
  +     * 
  +     * @throws Exception If an unexpected error occurs
  +     */
  +    public void testSrcFileWithoutWebXmlNewWebXml22() throws Exception
  +    {
  +             try
  +             {
  +                     executeTestTarget();
  +             }
  +             catch (BuildException e)
  +             {
  +                     fail("The WAR source file does not contain a "
  +                                     + "WEB-INF/web.xml deployment 
descriptor, but Cactus should "
  +                                     + "should have created an empty one" );
  +             }
  +     }       
  +     
  +    /**
  +     * Verifies an empty web was created when the source archive does not 
  +     * contain a web deployment descriptor but specifies the version.
  +     * 
  +     * @throws Exception If an unexpected error occurs
  +     */
  +    public void testSrcFileWithoutWebXmlNewWebXml23() throws Exception
  +    {
  +             try
  +             {
  +                     executeTestTarget();
  +             }
  +             catch (BuildException e)
  +             {
  +                     fail("The WAR source file does not contain a "
  +                                     + "WEB-INF/web.xml deployment 
descriptor, but Cactus should "
  +                                     + "should have created an empty one" );
  +             }
  +     }       
   
       /**
        * Tests whether the Cactus test redirectors are correctly added to the 
  
  
  
  1.10      +10 -0     
jakarta-cactus/integration/ant/src/test-input/org/apache/cactus/integration/ant/test-cactifywar.xml
  
  Index: test-cactifywar.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-cactus/integration/ant/src/test-input/org/apache/cactus/integration/ant/test-cactifywar.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- test-cactifywar.xml       15 Jun 2003 13:18:11 -0000      1.9
  +++ test-cactifywar.xml       21 Apr 2005 11:56:33 -0000      1.10
  @@ -21,6 +21,16 @@
           destfile="${work.dir}/destfile.war"/>
     </target>
   
  +  <target name="testSrcFileWithoutWebXmlNewWebXml22">
  +    <cactifywar srcfile="nowebxml.war" version="2.2"
  +        destfile="${work.dir}/destfile.war"/>
  +  </target>
  +  
  +  <target name="testSrcFileWithoutWebXmlNewWebXml23">
  +    <cactifywar srcfile="nowebxml.war" version="2.3"
  +        destfile="${work.dir}/destfile.war"/>
  +  </target>
  +  
     <target name="testDefaultRedirectorsNoDoctype">
       <cactifywar srcfile="empty.war"
           destfile="${work.dir}/destfile.war"/>
  
  
  
  1.215     +4 -0      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.214
  retrieving revision 1.215
  diff -u -r1.214 -r1.215
  --- changes.xml       10 Feb 2005 19:51:34 -0000      1.214
  +++ changes.xml       21 Apr 2005 11:56:33 -0000      1.215
  @@ -91,6 +91,10 @@
         </devs>
   
         <release version="1.8dev" date="in CVS">
  +        <action dev="FAL" type="fix" issue="CACTUS-204">
  +          <code>CactifyWar</code> task now does not require a <code>web.xml
  +          </code> and creates an empty one if necessary.
  +        </action>
           <action dev="VMA" type="update" issue="CACTUS-189" due-to="Magnus 
Grimsell">
             Added support for merging <code>&lt;run-as&gt;</code> element from 
a 
             provided <code>web.xml</code> file in the cactifywar Ant task.
  
  
  

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

Reply via email to