ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject git commit: make ManifestTest write its output to the common tmp-dir
Date Sat, 19 Jul 2014 18:54:41 GMT
Repository: ant
Updated Branches:
  refs/heads/master 9eb4c3a9a -> 49d1d9845


make ManifestTest write its output to the common tmp-dir


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/49d1d984
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/49d1d984
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/49d1d984

Branch: refs/heads/master
Commit: 49d1d98452a7d35d5bbec427a2f7ec1e7718cada
Parents: 9eb4c3a
Author: Stefan Bodewig <bodewig@apache.org>
Authored: Sat Jul 19 20:52:52 2014 +0200
Committer: Stefan Bodewig <bodewig@apache.org>
Committed: Sat Jul 19 20:52:52 2014 +0200

----------------------------------------------------------------------
 src/etc/testcases/taskdefs/manifest.xml         | 136 +++++++++----------
 .../apache/tools/ant/taskdefs/ManifestTest.java |  34 ++---
 2 files changed, 85 insertions(+), 85 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/49d1d984/src/etc/testcases/taskdefs/manifest.xml
----------------------------------------------------------------------
diff --git a/src/etc/testcases/taskdefs/manifest.xml b/src/etc/testcases/taskdefs/manifest.xml
index b1faf50..9c2cdb4 100644
--- a/src/etc/testcases/taskdefs/manifest.xml
+++ b/src/etc/testcases/taskdefs/manifest.xml
@@ -19,47 +19,52 @@
 <!-- Manifest tests build file
      author: Conor MacNeill -->
 <project name="manifest-test" basedir="." default="test1">
+  <import file="../buildfiletest-base.xml"/>
 
-  <target name="test1">
-    <jar file="mftest1.jar" manifest="manifests/test1.mf"/>
-    <unjar src="mftest1.jar" dest="manifests">
+  <target name="setUp">
+    <mkdir dir="${output}/manifests"/>
+  </target>
+
+  <target name="test1" depends="setUp">
+    <jar file="${output}/mftest1.jar" manifest="manifests/test1.mf"/>
+    <unjar src="${output}/mftest1.jar" dest="${output}/manifests">
       <patternset>
         <include name="META-INF/MANIFEST.MF"/>
       </patternset>
     </unjar>
   </target>
   
-  <target name="test2">
-    <jar file="mftest2.jar" manifest="manifests/test2.mf"/>
-    <unjar src="mftest2.jar" dest="manifests">
+  <target name="test2" depends="setUp">
+    <jar file="${output}/mftest2.jar" manifest="manifests/test2.mf"/>
+    <unjar src="${output}/mftest2.jar" dest="${output}/manifests">
       <patternset>
         <include name="META-INF/MANIFEST.MF"/>
       </patternset>
     </unjar>
   </target>
   
-  <target name="test3">
-    <jar file="mftest3.jar" manifest="manifests/test3.mf"/>
+  <target name="test3" depends="setUp">
+    <jar file="${output}/mftest3.jar" manifest="manifests/test3.mf"/>
   </target>
   
-  <target name="test4">
-    <jar file="mftest4.jar" manifest="manifests/test4.mf"/>
+  <target name="test4" depends="setUp">
+    <jar file="${output}/mftest4.jar" manifest="manifests/test4.mf"/>
   </target>
   
-  <target name="test5">
-    <jar file="mftest5.jar" manifest="manifests/test5.mf"/>
+  <target name="test5" depends="setUp">
+    <jar file="${output}/mftest5.jar" manifest="manifests/test5.mf"/>
   </target>
   
-  <target name="test6">
-    <jar file="mftest6.jar" manifest="manifests/test6.mf"/>
+  <target name="test6" depends="setUp">
+    <jar file="${output}/mftest6.jar" manifest="manifests/test6.mf"/>
   </target>
   
-  <target name="test7">
-    <jar file="mftest7.jar" manifest="manifests/test7.mf"/>
+  <target name="test7" depends="setUp">
+    <jar file="${output}/mftest7.jar" manifest="manifests/test7.mf"/>
   </target>
   
-  <target name="test8">
-    <jar file="mftest8.jar">
+  <target name="test8" depends="setUp">
+    <jar file="${output}/mftest8.jar">
       <manifest>
         <attribute name="Class-Path" value="fubar"/>
         <section name="Test">
@@ -67,15 +72,15 @@
         </section>
       </manifest>
     </jar>
-    <unjar src="mftest8.jar" dest="manifests">
+    <unjar src="${output}/mftest8.jar" dest="${output}/manifests">
       <patternset>
         <include name="META-INF/MANIFEST.MF"/>
       </patternset>
     </unjar>
   </target>
 
-  <target name="test9">
-    <jar file="mftest9.jar">
+  <target name="test9" depends="setUp">
+    <jar file="${output}/mftest9.jar">
       <manifest>
         <attribute name="Class-Path" value="fubar"/>
         <section name="Test">
@@ -85,24 +90,24 @@
     </jar>
   </target>
 
-  <target name="test10">
-    <jar file="mftest10.jar">
+  <target name="test10" depends="setUp">
+    <jar file="${output}/mftest10.jar">
       <manifest>
         <attribute value="fubar"/>
       </manifest>
     </jar>
   </target>
 
-  <target name="test11">
-    <jar file="mftest11.jar">
+  <target name="test11" depends="setUp">
+    <jar file="${output}/mftest11.jar">
       <manifest>
         <attribute name="Test"/>
       </manifest>
     </jar>
   </target>
 
-  <target name="test12">
-    <jar file="mftest12.jar">
+  <target name="test12" depends="setUp">
+    <jar file="${output}/mftest12.jar">
       <manifest>
         <section>
           <attribute name="TestAttr" value="Test"/>
@@ -111,8 +116,8 @@
     </jar>
   </target>
 
-  <target name="test13">
-    <jar file="mftest13.jar">
+  <target name="test13" depends="setUp">
+    <jar file="${output}/mftest13.jar">
       <manifest>
         <attribute name="Test" value="Test1"/>
         <attribute name="Test" value="Test2"/>
@@ -120,8 +125,8 @@
     </jar>
   </target>
 
-  <target name="test14">
-    <jar file="mftest14.jar">
+  <target name="test14" depends="setUp">
+    <jar file="${output}/mftest14.jar">
       <manifest>
         <attribute name="Class-path" value="Test1"/>
         <attribute name="Class-path" value="Test2"/>
@@ -129,7 +134,7 @@
         <attribute name="class-Path" value="Test4"/>
       </manifest>
     </jar>
-    <unjar src="mftest14.jar" dest="manifests">
+    <unjar src="${output}/mftest14.jar" dest="${output}/manifests">
       <patternset>
         <include name="META-INF/MANIFEST.MF"/>
       </patternset>
@@ -140,8 +145,8 @@
     <manifest />
   </target>
 
-  <target name="testLongLine">
-    <jar file="mftestLongLine.jar">
+  <target name="testLongLine" depends="setUp">
+    <jar file="${output}/mftestLongLine.jar">
       <manifest>
         <attribute name="Class-path" 
                    value="${test.longline}"/>
@@ -150,15 +155,15 @@
         <attribute name="${test.notlongname}" value="${test.value}" />
       </manifest>
     </jar>
-    <unjar src="mftestLongLine.jar" dest="manifests">
+    <unjar src="${output}/mftestLongLine.jar" dest="${output}/manifests">
       <patternset>
         <include name="META-INF/MANIFEST.MF"/>
       </patternset>
     </unjar>
   </target>
 
-  <target name="testOrder1">
-    <jar file="mftestOrder1.jar">
+  <target name="testOrder1" depends="setUp">
+    <jar file="${output}/mftestOrder1.jar">
       <manifest>
         <section name="Test1">
           <attribute name="TestAttr1" value="Test1"/>
@@ -169,15 +174,15 @@
         </section>
       </manifest>
     </jar>
-    <unjar src="mftestOrder1.jar" dest="manifests">
+    <unjar src="${output}/mftestOrder1.jar" dest="${output}/manifests">
       <patternset>
         <include name="META-INF/MANIFEST.MF"/>
       </patternset>
     </unjar>
   </target>
 
-  <target name="testOrder2">
-    <jar file="mftestOrder2.jar">
+  <target name="testOrder2" depends="setUp">
+    <jar file="${output}/mftestOrder2.jar">
       <manifest>
         <section name="Test2">
           <attribute name="TestAttrx" value="Testx"/>
@@ -188,39 +193,39 @@
         </section>
       </manifest>
     </jar>
-    <unjar src="mftestOrder2.jar" dest="manifests">
+    <unjar src="${output}/mftestOrder2.jar" dest="${output}/manifests">
       <patternset>
         <include name="META-INF/MANIFEST.MF"/>
       </patternset>
     </unjar>
   </target>
   
-  <target name="testReplace">
-    <copy file="manifests/test2.mf" toFile="mftest.mf" />
-    <manifest file="mftest.mf" />
+  <target name="testReplace" depends="setUp">
+    <copy file="manifests/test2.mf" toFile="${output}/mftest.mf" />
+    <manifest file="${output}/mftest.mf" />
   </target>
 
-  <target name="testUpdate">
-    <copy file="manifests/test2.mf" toFile="mftest.mf" />
-    <manifest file="mftest.mf" mode="update">
+  <target name="testUpdate" depends="setUp">
+    <copy file="manifests/test2.mf" toFile="${output}/mftest.mf" />
+    <manifest file="${output}/mftest.mf" mode="update">
       <attribute name="Foo" value="Bar" />
     </manifest>
 
-    <copy file="manifests/test2.mf" toFile="mftest2.mf" />
-    <manifest file="mftest2.mf" mode="update">
+    <copy file="manifests/test2.mf" toFile="${output}/mftest2.mf" />
+    <manifest file="${output}/mftest2.mf" mode="update">
       <section name="Test">
         <attribute name="Foo" value="Bar" />
       </section>
     </manifest>
-    <manifest file="mftest2.mf" mode="update">
+    <manifest file="${output}/mftest2.mf" mode="update">
       <section name="Test">
         <attribute name="Foo" value="Baz" />
       </section>
     </manifest>
   </target>
 
-  <target name="testFrom">
-    <manifest file="mftestfrom.mf" >
+  <target name="testFrom" depends="setUp">
+    <manifest file="${output}/mftestfrom.mf" >
       <section name="Test">
         <attribute name="before" value="before" />
         <attribute name="From" value="illegal"/>
@@ -229,42 +234,35 @@
     </manifest>
   </target>
   
-  <target name="testIllegalName">
-    <manifest file="mftestillegalname.mf">
+  <target name="testIllegalName" depends="setUp">
+    <manifest file="${output}/mftestillegalname.mf">
       <attribute name="has blank" value="value"/>
     </manifest>
   </target>
 
-  <target name="testIllegalNameInSection">
-    <manifest file="mftestillegalnameinsection.mf">
+  <target name="testIllegalNameInSection" depends="setUp">
+    <manifest file="${output}/mftestillegalnameinsection.mf">
       <section name="s1">
         <attribute name="has blank" value="value"/>
       </section>
     </manifest>
   </target>
 
-  <target name="testIllegalNameBegin">
-    <manifest file="mftestillegalnamebegin.mf">
+  <target name="testIllegalNameBegin" depends="setUp">
+    <manifest file="${output}/mftestillegalnamebegin.mf">
       <attribute name="-name" value="value"/>
     </manifest>
   </target>
 
-  <target name="testIllegalName2">
-    <manifest file="mftestillegalnamebegin.mf">
+  <target name="testIllegalName2" depends="setUp">
+    <manifest file="${output}/mftestillegalnamebegin.mf">
       <attribute name="has.point" value="value"/>
     </manifest>
   </target>
 
-  <target name="testIllegalName3">
-    <manifest file="mftestillegalnamebegin.mf">
+  <target name="testIllegalName3" depends="setUp">
+    <manifest file="${output}/mftestillegalnamebegin.mf">
       <attribute name="has*star" value="value"/>
     </manifest>
   </target>
-
-  <target name="clean">
-    <delete>
-      <fileset dir="." includes="mftest*"/>
-    </delete>
-    <delete dir="manifests/META-INF"/>
-  </target>
 </project>

http://git-wip-us.apache.org/repos/asf/ant/blob/49d1d984/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestTest.java
index 72bce1b..aa9432c 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestTest.java
@@ -49,8 +49,8 @@ public class ManifestTest {
     @Rule
     public final BuildFileRule buildRule = new BuildFileRule();
 
-    public static final String EXPANDED_MANIFEST
-        = "src/etc/testcases/taskdefs/manifests/META-INF/MANIFEST.MF";
+    private File expandedManifest;
+    private File outDir;
 
     public static final String LONG_LINE
         = "AReallyLongLineToTestLineBreakingInManifests-ACapabilityWhich" +
@@ -71,11 +71,13 @@ public class ManifestTest {
     @Before
     public void setUp() {
         buildRule.configureProject("src/etc/testcases/taskdefs/manifest.xml");
+        outDir = new File(buildRule.getProject().getProperty("output"));
+        expandedManifest = new File(outDir, "manifests/META-INF/MANIFEST.MF");
     }
 
     @After
     public void tearDown() {
-        buildRule.executeTarget("clean");
+        buildRule.executeTarget("tearDown");
     }
 
     /**
@@ -84,7 +86,7 @@ public class ManifestTest {
     @Test
     public void test1() throws ManifestException, IOException {
         buildRule.executeTarget("test1");
-        Manifest manifest = getManifest(EXPANDED_MANIFEST);
+        Manifest manifest = getManifest(expandedManifest);
         String version = manifest.getManifestVersion();
         assertEquals("Manifest was not created with correct version - ", "1.0", version);
     }
@@ -95,7 +97,7 @@ public class ManifestTest {
     @Test
     public void test2() throws ManifestException, IOException {
         buildRule.executeTarget("test2");
-        Manifest manifest = getManifest(EXPANDED_MANIFEST);
+        Manifest manifest = getManifest(expandedManifest);
         String version = manifest.getManifestVersion();
         assertEquals("Manifest was not created with correct version - ", "2.0", version);
     }
@@ -171,7 +173,7 @@ public class ManifestTest {
     @Test
     public void test8() throws IOException, ManifestException {
         buildRule.executeTarget("test8");
-        Manifest manifest = getManifest(EXPANDED_MANIFEST);
+        Manifest manifest = getManifest(expandedManifest);
         Manifest.Section mainSection = manifest.getMainSection();
         String classpath = mainSection.getAttributeValue("class-path");
         assertEquals("Class-Path attribute was not set correctly - ", "fubar", classpath);
@@ -253,7 +255,7 @@ public class ManifestTest {
     @Test
     public void test14() throws IOException, ManifestException {
         buildRule.executeTarget("test14");
-        Manifest manifest = getManifest(EXPANDED_MANIFEST);
+        Manifest manifest = getManifest(expandedManifest);
         Manifest.Section mainSection = manifest.getMainSection();
         String classpath = mainSection.getAttributeValue("class-path");
         assertEquals("Class-Path attribute was not set correctly - ",
@@ -273,7 +275,7 @@ public class ManifestTest {
         p.setUserProperty("test.value", VALUE);
         buildRule.executeTarget("testLongLine");
 
-        Manifest manifest = getManifest(EXPANDED_MANIFEST);
+        Manifest manifest = getManifest(expandedManifest);
         Manifest.Section mainSection = manifest.getMainSection();
         String classpath = mainSection.getAttributeValue("class-path");
         assertEquals("Class-Path attribute was not set correctly - ",
@@ -286,7 +288,7 @@ public class ManifestTest {
         value = mainSection.getAttributeValue(NOT_LONG_NAME);
         assertEquals("NOT_LONG_NAME_VALUE_MISMATCH", VALUE, value);
         
-        BufferedReader in = new BufferedReader(new FileReader(new File(System.getProperty("root"),
EXPANDED_MANIFEST)));
+        BufferedReader in = new BufferedReader(new FileReader(expandedManifest));
         
         Set set = new HashSet();
         String read = in.readLine();
@@ -313,7 +315,7 @@ public class ManifestTest {
     public void testOrder1() throws IOException, ManifestException {
         buildRule.executeTarget("testOrder1");
 
-        Manifest manifest = getManifest(EXPANDED_MANIFEST);
+        Manifest manifest = getManifest(expandedManifest);
         Enumeration e = manifest.getSectionNames();
         String section1 = (String)e.nextElement();
         String section2 = (String)e.nextElement();
@@ -337,7 +339,7 @@ public class ManifestTest {
     public void testOrder2() throws IOException, ManifestException {
         buildRule.executeTarget("testOrder2");
 
-        Manifest manifest = getManifest(EXPANDED_MANIFEST);
+        Manifest manifest = getManifest(expandedManifest);
         Enumeration e = manifest.getSectionNames();
         String section1 = (String)e.nextElement();
         String section2 = (String)e.nextElement();
@@ -373,7 +375,7 @@ public class ManifestTest {
     @Test
     public void testReplace() throws IOException, ManifestException {
         buildRule.executeTarget("testReplace");
-        Manifest mf = getManifest("src/etc/testcases/taskdefs/mftest.mf");
+        Manifest mf = getManifest(new File(outDir, "mftest.mf"));
         assertNotNull(mf);
         assertEquals(Manifest.getDefaultManifest(), mf);
     }
@@ -384,7 +386,7 @@ public class ManifestTest {
     @Test
     public void testUpdate() throws IOException, ManifestException {
         buildRule.executeTarget("testUpdate");
-        Manifest mf = getManifest("src/etc/testcases/taskdefs/mftest.mf");
+        Manifest mf = getManifest(new File(outDir, "mftest.mf"));
         assertNotNull(mf);
         assertTrue(!Manifest.getDefaultManifest().equals(mf));
         String mfAsString = mf.toString();
@@ -392,7 +394,7 @@ public class ManifestTest {
         assertTrue(mfAsString.startsWith("Manifest-Version: 2.0"));
         assertTrue(mfAsString.indexOf("Foo: Bar") > -1);
 
-        mf = getManifest("src/etc/testcases/taskdefs/mftest2.mf");
+        mf = getManifest(new File(outDir, "mftest2.mf"));
         assertNotNull(mf);
         mfAsString = mf.toString();
         assertNotNull(mfAsString);
@@ -459,8 +461,8 @@ public class ManifestTest {
     /**
      * Reads mftest.mf.
      */
-    private Manifest getManifest(String filename) throws IOException, ManifestException {
-        FileReader r = new FileReader(new File(System.getProperty("root"), filename));
+    private Manifest getManifest(File file) throws IOException, ManifestException {
+        FileReader r = new FileReader(file);
         try {
             return new Manifest(r);
         } finally {


Mime
View raw message