ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs JarTest.java
Date Fri, 17 Jan 2003 10:35:10 GMT
bodewig     2003/01/17 02:35:10

  Modified:    src/etc/testcases/taskdefs jar.xml
               src/main/org/apache/tools/ant XmlLogger.java
               src/testcases/org/apache/tools/ant/taskdefs JarTest.java
  Log:
  Add (disabled) tests for 10755
  
  Revision  Changes    Path
  1.5       +49 -7     jakarta-ant/src/etc/testcases/taskdefs/jar.xml
  
  Index: jar.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/etc/testcases/taskdefs/jar.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- jar.xml	8 Jan 2002 09:46:26 -0000	1.4
  +++ jar.xml	17 Jan 2003 10:35:09 -0000	1.5
  @@ -2,6 +2,8 @@
   
   <project name="jar-test" basedir="." default="test1">
   
  +  <property name="tmp.jar" location="tmp.jar"/>
  +
     <target name="test1">
       <jar/>
     </target>
  @@ -22,23 +24,63 @@
   
     <target name="test4">
      <jar
  -    	destfile="tmp.jar"
  +    	destfile="${tmp.jar}"
   	basedir="."
   	includes="jar.xml"
       />
     </target>
   
  -  <!-- This test is to make sure upToDate is working -->
  -  <target name="test5">
  +  <target name="testNoRecreateWithUpdate">
       <jar
  -    	destfile="tmp.jar"
  -	basedir="."
  -	includes="jar.xml"
  +         destfile="${tmp.jar}"
  +         basedir="."
  +         includes="jar.xml"
  +         update="true"
  +    />
  +  </target>
  +
  +  <target name="testRecreateNewerFileSetup" depends="test4">
  +    <touch file="jar.xml"/>
  +    <sleep seconds="2"/>
  +    <touch file="${tmp.jar}"/>
  +  </target>
  +
  +  <target name="testRecreateWithoutUpdateAdditionalFiles">
  +    <jar
  +         destfile="${tmp.jar}"
  +         includes="*.xml"
  +         basedir="."
  +    />
  +  </target>
  +
  +  <target name="testRecreateWithUpdateAdditionalFiles">
  +    <jar
  +         destfile="${tmp.jar}"
  +         basedir="."
  +         includes="*.xml"
  +         update="true"
  +    />
  +  </target>
  +
  +  <target name="testRecreateWithoutUpdateNewerFile">
  +    <jar
  +         destfile="${tmp.jar}"
  +         basedir="."
  +         includes="jar.xml"
  +    />
  +  </target>
  +
  +  <target name="testRecreateWithUpdateNewerFile">
  +    <jar
  +         destfile="${tmp.jar}"
  +         basedir="."
  +         includes="jar.xml"
  +         update="true"
       />
     </target>
   
     <target name="cleanup">
  -    <delete file="tmp.jar" />
  +    <delete file="${tmp.jar}" />
     </target>
   
   </project>
  
  
  
  1.33      +1 -1      jakarta-ant/src/main/org/apache/tools/ant/XmlLogger.java
  
  Index: XmlLogger.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/XmlLogger.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- XmlLogger.java	16 Jan 2003 14:45:24 -0000	1.32
  +++ XmlLogger.java	17 Jan 2003 10:35:10 -0000	1.33
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2000-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  
  
  
  1.9       +53 -6     jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/JarTest.java
  
  Index: JarTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/JarTest.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- JarTest.java	10 Jan 2002 10:13:12 -0000	1.8
  +++ JarTest.java	17 Jan 2003 10:35:10 -0000	1.9
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2000-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -63,7 +63,6 @@
    */
   public class JarTest extends BuildFileTest {
   
  -    private static long jarModifiedDate;
       private static String tempJar = "tmp.jar";
   
       public JarTest(String name) {
  @@ -94,12 +93,60 @@
           executeTarget("test4");
           File jarFile = new File(getProjectDir(), tempJar);
           assertTrue(jarFile.exists());
  -        jarModifiedDate = jarFile.lastModified();
       }
   
  -    public void XXXtest5() {
  -        executeTarget("test5");
  +    public void testNoRecreateWithoutUpdate() {
  +        testNoRecreate("test4");
  +    }
  +
  +    public void testNoRecreateWithUpdate() {
  +        testNoRecreate("testNoRecreateWithUpdate");
  +    }
  +
  +    private void testNoRecreate(String secondTarget) {
  +        executeTarget("test4");
  +        File jarFile = new File(getProjectDir(), tempJar);
  +        long jarModifiedDate = jarFile.lastModified();
  +        try {
  +            // give Windows a chance
  +            Thread.currentThread().sleep(2500);
  +        } catch (InterruptedException e) {
  +        } // end of try-catch
  +        executeTarget(secondTarget);
  +        assertEquals("jar has not been recreated in " + secondTarget,
  +                     jarModifiedDate, jarFile.lastModified());
  +    }
  +
  +    public void XtestRecreateWithoutUpdateAdditionalFiles() {
  +        testRecreate("test4", "testRecreateWithoutUpdateAdditionalFiles");
  +    }
  +
  +    public void XtestRecreateWithUpdateAdditionalFiles() {
  +        testRecreate("test4", "testRecreateWithUpdateAdditionalFiles");
  +    }
  +
  +    public void XtestRecreateWithoutUpdateNewerFile() {
  +        testRecreate("testRecreateNewerFileSetup",
  +                     "testRecreateWithoutUpdateNewerFile");
  +    }
  +
  +    public void XtestRecreateWithUpdateNewerFile() {
  +        testRecreate("testRecreateNewerFileSetup",
  +                     "testRecreateWithUpdateNewerFile");
  +    }
  +
  +    private void testRecreate(String firstTarget, String secondTarget) {
  +        executeTarget(firstTarget);
  +        try {
  +            // give Windows a chance
  +            Thread.currentThread().sleep(2500);
  +        } catch (InterruptedException e) {
  +        } // end of try-catch
           File jarFile = new File(getProjectDir(), tempJar);
  -        assertEquals(jarModifiedDate, jarFile.lastModified());
  +        long jarModifiedDate = jarFile.lastModified();
  +        executeTarget(secondTarget);
  +        jarFile = new File(getProjectDir(), tempJar);
  +        assertTrue("jar has been recreated in " + secondTarget,
  +                   jarModifiedDate < jarFile.lastModified());
       }
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message