ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: ant/src/testcases/org/apache/tools/ant/taskdefs JarTest.java
Date Wed, 02 Apr 2003 15:53:38 GMT
bodewig     2003/04/02 07:53:38

  Modified:    src/etc/testcases/taskdefs jar.xml
               src/testcases/org/apache/tools/ant/taskdefs JarTest.java
  Log:
  Demonstrate bug 10262
  
  Revision  Changes    Path
  1.11      +8 -0      ant/src/etc/testcases/taskdefs/jar.xml
  
  Index: jar.xml
  ===================================================================
  RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/jar.xml,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- jar.xml	12 Mar 2003 10:19:59 -0000	1.10
  +++ jar.xml	2 Apr 2003 15:53:37 -0000	1.11
  @@ -200,4 +200,12 @@
       <mkdir dir="${tmp.dir}"/>
       <unzip src="${tmp.jar}" dest="${tmp.dir}"/>
     </target>
  +
  +  <!-- bug 10262 -->
  +  <target name="testNoDuplicateIndex">
  +    <mkdir dir="${tmp.dir}/META-INF"/>
  +    <touch file="${tmp.dir}/META-INF/INDEX.LIST"/>
  +    <touch file="${tmp.dir}/foo"/>
  +    <jar destfile="${tmp.jar}" index="yes" basedir="${tmp.dir}"/>
  +  </target>
   </project>
  
  
  
  1.20      +17 -0     ant/src/testcases/org/apache/tools/ant/taskdefs/JarTest.java
  
  Index: JarTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/JarTest.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- JarTest.java	12 Mar 2003 10:19:59 -0000	1.19
  +++ JarTest.java	2 Apr 2003 15:53:38 -0000	1.20
  @@ -59,6 +59,9 @@
   import java.io.IOException;
   import java.io.Reader;
   import java.util.Date;
  +import java.util.Enumeration;
  +import java.util.zip.ZipEntry;
  +import java.util.zip.ZipFile;
   import org.apache.tools.ant.BuildFileTest;
   
   /**
  @@ -225,5 +228,19 @@
           executeTarget("testUpdateIfOnlyManifestHasChanged");
           File jarXml = getProject().resolveFile(tempDir + "jar.xml");
           assertTrue(jarXml.exists());
  +    }
  +
  +    public void testNoDuplicateIndex() throws IOException {
  +        executeTarget("testNoDuplicateIndex");
  +        ZipFile archive = new ZipFile(getProject().resolveFile(tempJar));
  +        Enumeration enum = archive.entries();
  +        int numberOfIndexLists = 0;
  +        while (enum.hasMoreElements()) {
  +            ZipEntry ze = (ZipEntry) enum.nextElement();
  +            if (ze.getName().equals("META-INF/INDEX.LIST")) {
  +                numberOfIndexLists++;
  +            }
  +        }
  +        assertEquals(1, numberOfIndexLists);
       }
   }
  
  
  

Mime
View raw message