Author: bodewig
Date: Tue Oct 11 16:44:05 2011
New Revision: 1181882
URL: http://svn.apache.org/viewvc?rev=1181882&view=rev
Log:
some real tests for pack200normalize - and make it actually work
Modified:
ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Pack200Normalize.java
ant/antlibs/compress/trunk/src/tests/antunit/pack200normalize-test.xml
Modified:
ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Pack200Normalize.java
URL:
http://svn.apache.org/viewvc/ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Pack200Normalize.java?rev=1181882&r1=1181881&r2=1181882&view=diff
==============================================================================
---
ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Pack200Normalize.java
(original)
+++
ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Pack200Normalize.java
Tue Oct 11 16:44:05 2011
@@ -90,7 +90,8 @@ public class Pack200Normalize extends Ta
log("Normalizing " + src + ".");
}
try {
- Pack200Utils.normalize(src, dest, properties);
+ Pack200Utils.normalize(src, dest != null ? dest : src,
+ properties);
} catch (IOException ex) {
throw new BuildException("Caught an error normalizing "
+ src, ex);
Modified: ant/antlibs/compress/trunk/src/tests/antunit/pack200normalize-test.xml
URL:
http://svn.apache.org/viewvc/ant/antlibs/compress/trunk/src/tests/antunit/pack200normalize-test.xml?rev=1181882&r1=1181881&r2=1181882&view=diff
==============================================================================
--- ant/antlibs/compress/trunk/src/tests/antunit/pack200normalize-test.xml
(original)
+++ ant/antlibs/compress/trunk/src/tests/antunit/pack200normalize-test.xml Tue
Oct 11 16:44:05 2011
@@ -23,7 +23,9 @@
<target name="setUp">
<mkdir dir="${output}" />
- <jar destfile="${output}/foo.jar">
+ <property name="foo" location="${output}/foo.jar"/>
+ <property name="bar" location="${output}/bar.jar"/>
+ <jar destfile="${foo}">
<file file="${ant.file}"/>
</jar>
</target>
@@ -35,16 +37,16 @@
</target>
<target name="testNormalizeSelfWithoutForceDoesntDoAnything">
- <cmp:pack200normalize srcfile="${output}/foo.jar"/>
+ <cmp:pack200normalize srcfile="${foo}"/>
<au:assertLogContains
text=" not normalized as force attribute is false."
level="verbose"/>
</target>
<target name="testNormalizeDoesntDoAnythingWhenTargetIsUpToDate"
depends="setUp">
- <touch file="${output}/bar.jar"/>
- <cmp:pack200normalize srcfile="${output}/foo.jar"
- destfile="${output}/bar.jar"/>
+ <touch file="${bar}"/>
+ <cmp:pack200normalize srcfile="${foo}"
+ destfile="${bar}"/>
<au:assertLogContains
text=" not normalized as "
level="verbose"/>
@@ -52,4 +54,18 @@
text="bar.jar is up-to-date."
level="verbose"/>
</target>
+
+ <target name="testNormalizeSelfWithForce">
+ <touch file="${bar}"/>
+ <sleep seconds="2"/>
+ <cmp:pack200normalize srcfile="${foo}" force="true"/>
+ <au:assertDestIsOutofdate src="${foo}" dest="${bar}"/>
+ </target>
+
+ <target name="testNormalize">
+ <sleep seconds="2"/>
+ <cmp:pack200normalize srcfile="${foo}" destfile="${bar}"/>
+ <au:assertDestIsOutofdate dest="${foo}" src="${bar}"/>
+ </target>
+
</project>
\ No newline at end of file