use Ant site rather than an antlib for tests
authorStefan Bodewig <bodewig@apache.org>
Sun, 27 Jul 2014 11:24:53 +0000 (13:24 +0200)
committerStefan Bodewig <bodewig@apache.org>
Sun, 27 Jul 2014 11:24:53 +0000 (13:24 +0200)
src/etc/testcases/abstractsvntask.xml
src/etc/testcases/changelog.xml
src/etc/testcases/revisiondiff.xml
src/tests/junit/org/apache/ant/svn/AbstractSvnTaskTest.java
src/tests/junit/org/apache/ant/svn/SvnChangeLogTaskTest.java
src/tests/junit/org/apache/ant/svn/SvnRevisionDiffTest.java

index 2876fe2..fe99f92 100644 (file)
          default="all" xmlns:svn="antlib:org.apache.ant.svn">
 
   <property name="tmpdir" value="${java.io.tmpdir}/svnantlib"/>
-  <property name="trunkdir" value="${tmpdir}/trunk"/>
-  <property name="file" value="build.xml"/>
+  <property name="sitedir" value="${tmpdir}/svn"/>
+  <property name="file" value="index.xml"/>
 
   <target name="setup">
     <mkdir dir="${tmpdir}"/>
     <svn:svn
-      svnURL="http://svn.apache.org/repos/asf/ant/antlibs/common/trunk/"
+      svnURL="http://svn.apache.org/repos/asf/ant/site/ant/sources/antlibs/svn/"
       dest="${tmpdir}"/>
   </target>
 
   <target name="all" depends="setup">
-    <svn:svn failonerror="true" subcommand="status ${file}" dest="${trunkdir}"/>
-    <svn:svn failonerror="true" dest="${trunkdir}">
+    <svn:svn failonerror="true" subcommand="status ${file}" dest="${sitedir}"/>
+    <svn:svn failonerror="true" dest="${sitedir}">
       <commandline>
         <argument value="up"/>
         <argument value="-r"/>
-        <argument value="161881"/>
+        <argument value="948574"/>
         <argument value="${file}"/>
       </commandline>
     </svn:svn>
-    <svn:svn failonerror="true" subcommand="status ${file}" dest="${trunkdir}"/>
-    <svn:svn failonerror="true" dest="${trunkdir}">
+    <svn:svn failonerror="true" subcommand="status ${file}" dest="${sitedir}"/>
+    <svn:svn failonerror="true" dest="${sitedir}">
       <commandline>
         <argument line="up -r HEAD ${file}" />
       </commandline>
     </svn:svn>
-    <svn:svn failonerror="true" subcommand="status ${file}" dest="${trunkdir}"/>
+    <svn:svn failonerror="true" subcommand="status ${file}" dest="${sitedir}"/>
   </target>
 
   <target name="revision-attribute">
     <mkdir dir="${tmpdir}" />
     <svn:svn
-      svnURL="http://svn.apache.org/repos/asf/ant/antlibs/common/trunk/"
+      svnURL="http://svn.apache.org/repos/asf/ant/site/ant/sources/antlibs/svn/"
       dest="${tmpdir}"
       quiet="false"
-      revision="161881"/>
+      revision="948574"/>
   </target>
 
   <target name="cleanup">
index b186000..6595769 100644 (file)
          default="log" xmlns:svn="antlib:org.apache.ant.svn">
 
   <property name="tmpdir" value="${java.io.tmpdir}/svnantlib"/>
-  <property name="trunkdir" value="${tmpdir}/trunk"/>
+  <property name="sitedir" value="${tmpdir}/svn"/>
 
   <target name="setup">
     <mkdir dir="${tmpdir}"/>
     <svn:svn
-      svnURL="http://svn.apache.org/repos/asf/ant/antlibs/svn/trunk"
+      svnURL="http://svn.apache.org/repos/asf/ant/site/ant/sources/antlibs/svn/"
       dest="${tmpdir}"/>
   </target>
 
   <target name="log" depends="setup">
-    <svn:changelog failonerror="true" dest="${trunkdir}"
+    <svn:changelog failonerror="true" dest="${sitedir}"
       destfile="${tmpdir}/log.xml" />
   </target>
 
   <target name="start" depends="setup">
-    <svn:changelog failonerror="true" dest="${trunkdir}"
-      destfile="${tmpdir}/log.xml" start="161500"/>
+    <svn:changelog failonerror="true" dest="${sitedir}"
+      destfile="${tmpdir}/log.xml" start="450000"/>
   </target>
 
   <target name="startDate" depends="setup">
-    <svn:changelog failonerror="true" dest="${trunkdir}"
-      destfile="${tmpdir}/log.xml" start="{2005-04-18}"/>
+    <svn:changelog failonerror="true" dest="${sitedir}"
+      destfile="${tmpdir}/log.xml" start="{2006-10-01}"/>
   </target>
 
   <target name="end" depends="setup">
-    <svn:changelog failonerror="true" dest="${trunkdir}"
-      destfile="${tmpdir}/log.xml" end="161500"/>
+    <svn:changelog failonerror="true" dest="${sitedir}"
+      destfile="${tmpdir}/log.xml" end="450000"/>
   </target>
 
   <target name="endDate" depends="setup">
-    <svn:changelog failonerror="true" dest="${trunkdir}"
-      destfile="${tmpdir}/log.xml" end="{2005-04-18}"/>
+    <svn:changelog failonerror="true" dest="${sitedir}"
+      destfile="${tmpdir}/log.xml" end="{2006-10-01}"/>
   </target>
 
   <target name="report" depends="start">
     <xslt in="${tmpdir}/log.xml" 
       out="${tmpdir}/log.html" 
       style="src/etc/changelog.xsl">
-      <param name="title" expression="Ant SVN Antlib ChangeLog"/>
-      <param name="repo" expression="http://svn.apache.org/repos/ant/antlibs/svn"/>
+      <param name="title" expression="Ant SVN Antlib Site ChangeLog"/>
+      <param name="repo" expression="http://svn.apache.org/repos/asf/ant/site/ant/sources/antlibs/svn/"/>
     </xslt>
   </target>
 
index 2db3fb8..89e5f36 100644 (file)
@@ -21,7 +21,7 @@
          default="diff" xmlns:svn="antlib:org.apache.ant.svn">
 
   <property name="tmpdir" value="${java.io.tmpdir}/svnantlib"/>
-  <property name="trunkdir" value="${tmpdir}/trunk"/>
+  <property name="sitedir" value="${tmpdir}/svn"/>
 
   <target name="dir-prep">
     <mkdir dir="${tmpdir}"/>
 
   <target name="setup" depends="dir-prep">
     <svn:svn
-      svnURL="http://svn.apache.org/repos/asf/ant/antlibs/svn/trunk"
+      svnURL="http://svn.apache.org/repos/asf/ant/site/ant/sources/antlibs/svn/"
       dest="${tmpdir}"/>
   </target>
 
   <target name="diff" depends="setup">
-    <svn:revisiondiff failonerror="true" dest="${trunkdir}"
-      destfile="${tmpdir}/diff.xml" start="161469" end="161885"/>
+    <svn:revisiondiff failonerror="true" dest="${sitedir}"
+      destfile="${tmpdir}/diff.xml" start="371996" end="439435"/>
   </target>
 
   <target name="diff-using-url" depends="dir-prep">
     <svn:revisiondiff failonerror="true"
-      svnURL="http://svn.apache.org/repos/asf/ant/antlibs/svn/trunk"
-      destfile="${tmpdir}/diff.xml" start="161469" end="161885"/>
+      svnURL="http://svn.apache.org/repos/asf/ant/site/ant/sources/antlibs/svn/"
+      destfile="${tmpdir}/diff.xml" start="371996" end="439435"/>
   </target>
 
   <target name="report" depends="diff-using-url">
     <style in="${tmpdir}/diff.xml" 
       out="${tmpdir}/diff.html" 
       style="src/etc/diff.xsl">
-      <param name="title" expression="svn Antlib diff report"/>
-      <param name="repo" expression="http://svn.apache.org/repos/asf/ant/antlibs/svn/trunk"/>
+      <param name="title" expression="svn Antlib Site diff report"/>
+      <param name="repo" expression="http://svn.apache.org/repos/asf/ant/site/ant/sources/antlibs/svn/"/>
     </style>
   </target>
 
index e6a1627..8105008 100644 (file)
@@ -47,7 +47,7 @@ public class AbstractSvnTaskTest extends BuildFileTest {
 
     public void testRevisionAttribute() {
         String tmpDir = getProject().getProperty("tmpdir");
-        File f = getProject().resolveFile(tmpDir + "/trunk/build.xml");
+        File f = getProject().resolveFile(tmpDir + "/svn/index.xml");
         assertTrue("starting empty", !f.exists());
 
         // used to be
@@ -56,9 +56,9 @@ public class AbstractSvnTaskTest extends BuildFileTest {
         // on the version of the command line client
         executeTarget("revision-attribute");
         String log = getLog();
-        int buildFileIndex = Math.max(log.indexOf("trunk/build.xml"),
-                                      log.indexOf("trunk\\build.xml"));
-        assertTrue("expected message about build.xml, log was: " + log,
+        int buildFileIndex = Math.max(log.indexOf("svn/index.xml"),
+                                      log.indexOf("svn\\index.xml"));
+        assertTrue("expected message about index.xml, log was: " + log,
                    buildFileIndex > -1);
         for (int i = buildFileIndex - 1; i > -1; --i) {
             char c = log.charAt(i);
@@ -67,7 +67,7 @@ public class AbstractSvnTaskTest extends BuildFileTest {
                 break;
             }
         }
-        assertTrue("expected 'A' status for build.xml, log was:" +log,
+        assertTrue("expected 'A' status for index.xml, log was:" +log,
                    buildFileIndex > -1);
 
         assertTrue("now it is there", f.exists());
index 67408da..419265e 100644 (file)
@@ -43,33 +43,32 @@ public class SvnChangeLogTaskTest extends BuildFileTest {
 
     public void testLog() throws IOException {
         String log = executeTargetAndReadLogFully("log");
-        assertRev161885(log);
-        assertRev161469(log);
+        assertRev482074(log);
+        assertRev371996(log);
     }
 
     public void testStart() throws IOException {
         String log = executeTargetAndReadLogFully("start");
-        assertRev161885(log);
-        assertNoRev161469(log);
+        assertRev482074(log);
+        assertNoRev371996(log);
     }
 
-    // moving the files in svn has broken date based history
-    public void XtestStartDate() throws IOException {
+    public void testStartDate() throws IOException {
         String log = executeTargetAndReadLogFully("startDate");
-        assertRev161885(log);
-        assertNoRev161469(log);
+        assertRev482074(log);
+        assertNoRev371996(log);
     }
 
     public void testEnd() throws IOException {
         String log = executeTargetAndReadLogFully("end");
-        assertNoRev161885(log);
-        assertRev161469(log);
+        assertNoRev482074(log);
+        assertRev371996(log);
     }
 
     public void testEndDate() throws IOException {
         String log = executeTargetAndReadLogFully("endDate");
-        assertNoRev161885(log);
-        assertRev161469(log);
+        assertNoRev482074(log);
+        assertRev371996(log);
     }
 
     private String executeTargetAndReadLogFully(String target) 
@@ -85,9 +84,9 @@ public class SvnChangeLogTaskTest extends BuildFileTest {
         }
     }
 
-    private static final void assertRev161885(String log) {
-        int rev = log.indexOf("<revision>161885</revision>");
-        Assert.assertTrue("Expected to find revision 161885, but log was "
+    private static final void assertRev482074(String log) {
+        int rev = log.indexOf("<revision>482074</revision>");
+        Assert.assertTrue("Expected to find revision 482074, but log was "
                           + log, rev > -1);
         int entryBeforeRev = log.lastIndexOf("<entry>", rev);
         int entryAfterRev = log.indexOf("</entry>", rev);
@@ -99,20 +98,20 @@ public class SvnChangeLogTaskTest extends BuildFileTest {
             .assertTrue(log.lastIndexOf("<author><![CDATA[bodewig]]></author>",
                                         rev) > entryBeforeRev);
         Assert
-            .assertTrue(log.indexOf("<name><![CDATA[/ant/sandbox/antlibs/"
-                                    + "antunit/trunk]]></name>", rev)
+            .assertTrue(log.indexOf("<name><![CDATA[ant/site/ant/sources/"
+                                    + "antlibs/svn]]></name>", rev)
                         < entryAfterRev);
         Assert
             .assertTrue(log.indexOf("<action>modified</action>", rev) 
                         < entryAfterRev);
         Assert
-            .assertTrue(log.indexOf("<message><![CDATA[Make sandboxes build"
-                                    + "]]></message>", rev)
+            .assertTrue(log.indexOf("<message><![CDATA[linefeeds]]></message>",
+                                    rev)
                         < entryAfterRev);
     }
 
-    private static final void assertRev161469(String log) {
-        int rev = log.indexOf("<revision>161469</revision>");
+    private static final void assertRev371996(String log) {
+        int rev = log.indexOf("<revision>371996</revision>");
         Assert.assertTrue(rev > -1);
         int entryBeforeRev = log.lastIndexOf("<entry>", rev);
         int entryAfterRev = log.indexOf("</entry>", rev);
@@ -124,25 +123,25 @@ public class SvnChangeLogTaskTest extends BuildFileTest {
             .assertTrue(log.lastIndexOf("<![CDATA[bodewig]]>", rev) 
                         > entryBeforeRev);
         Assert
-            .assertTrue(log.indexOf("<name><![CDATA[/ant/sandbox/antlibs/"
-                                    + "antunit]]></name>", rev)
+            .assertTrue(log.indexOf("<name><![CDATA[ant/site/ant/sources/"
+                                    + "antlibs/svn]]></name>", rev)
                         < entryAfterRev);
         Assert
             .assertTrue(log.indexOf("<action>added</action>", rev) 
                         < entryAfterRev);
         Assert
-            .assertTrue(log.indexOf("<message><![CDATA[Import sandbox antlibs"
-                                    + "]]></message>", rev)
+            .assertTrue(log.indexOf("<message><![CDATA[Update Antlib status]]>"
+                                    + "</message>", rev)
                         < entryAfterRev);
     }
 
-    private static final void assertNoRev161885(String log) {
-        int rev = log.indexOf("<revision>161885</revision>");
+    private static final void assertNoRev482074(String log) {
+        int rev = log.indexOf("<revision>482074</revision>");
         Assert.assertEquals(-1, rev);
     }
 
-    private static final void assertNoRev161469(String log) {
-        int rev = log.indexOf("<revision>161469</revision>");
+    private static final void assertNoRev371996(String log) {
+        int rev = log.indexOf("<revision>371996</revision>");
         Assert.assertEquals(-1, rev);
     }
 }
index ab36eef..3518e25 100644 (file)
@@ -71,10 +71,10 @@ public class SvnRevisionDiffTest extends BuildFileTest {
         Assert.assertTrue(start > -1);
         int end = log.indexOf(">", start);
         Assert.assertTrue(end > -1);
-        Assert.assertTrue(log.indexOf("start=\"161469\"", start) > -1);
-        Assert.assertTrue(log.indexOf("start=\"161469\"", start) < end);
-        Assert.assertTrue(log.indexOf("end=\"161885\"", start) > -1);
-        Assert.assertTrue(log.indexOf("end=\"161885\"", start) < end);
+        Assert.assertTrue(log.indexOf("start=\"371996\"", start) > -1);
+        Assert.assertTrue(log.indexOf("start=\"371996\"", start) < end);
+        Assert.assertTrue(log.indexOf("end=\"439435\"", start) > -1);
+        Assert.assertTrue(log.indexOf("end=\"439435\"", start) < end);
     }
 
     private static final void assertAttributesNoURL(String log) {
@@ -87,17 +87,17 @@ public class SvnRevisionDiffTest extends BuildFileTest {
         int start = log.indexOf("<revisiondiff");
         int end = log.indexOf(">", start);
         Assert.assertTrue(log.indexOf("svnurl=\"http://svn.apache.org/repos/"
-                                      + "asf/ant/antlibs/svn/trunk\"",
+                                      + "asf/ant/site/ant/sources/antlibs/svn/\"",
                                       start)
                           > -1);
         Assert.assertTrue(log.indexOf("svnurl=\"http://svn.apache.org/repos/"
-                                      + "asf/ant/antlibs/svn/trunk\"",
+                                      + "asf/ant/site/ant/sources/antlibs/svn/\"",
                                       start)
                           < end);
     }
 
     private static final void assertModified(String log) {
-        int name = log.indexOf("<name><![CDATA[build.xml]]></name>");
+        int name = log.indexOf("<name><![CDATA[index.xml]]></name>");
         Assert.assertTrue(name > -1);
 
         int pathAfterName = log.indexOf("</path>", name);