Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
change test to look at anttest
git-svn-id: https://svn.apache.org/repos/asf/ant/antlibs/svn/trunk@573646 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Peter Reilly committed Sep 7, 2007
1 parent 90a93c3 commit 9c59a140f2eee1b94df5f681dc3777010b3723d6
Showing 3 changed files with 23 additions and 39 deletions.
@@ -56,12 +56,12 @@
</target>

<target name="report" depends="start">
<style in="${tmpdir}/log.xml"
<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"/>
</style>
</xslt>
</target>

<target name="cleanup">
@@ -22,39 +22,42 @@
xmlns:svn="antlib:org.apache.ant.svn">

<property name="tmpdir" value="tmpdir"/>
<property
name="baseURL"
value="http://svn.apache.org/repos/asf/ant/antlibs/antunit/"/>

<target name="dir-prep">
<mkdir dir="${tmpdir}"/>
</target>

<target name="diff-with-two-tags" depends="dir-prep">
<svn:tagdiff failonerror="true"
baseURL="http://svn.apache.org/repos/asf/jakarta/bcel/"
baseURL="${baseURL}"
destfile="${tmpdir}/diff.xml"
tag2="BCEL_5_0" tag1="initial"/>
tag2="10_BETA1" tag1="10"/>
</target>

<target name="diff-with-explicit-trunk" depends="dir-prep">
<svn:tagdiff failonerror="true"
baseURL="http://svn.apache.org/repos/asf/jakarta/bcel/"
baseURL="${baseURL}"
destfile="${tmpdir}/diff.xml"
tag1="BCEL_5_0" tag2="trunk"/>
tag1="10_BETA1" tag2="trunk"/>
</target>

<target name="diff-with-implicit-trunk" depends="dir-prep">
<svn:tagdiff failonerror="true"
baseURL="http://svn.apache.org/repos/asf/jakarta/bcel/"
baseURL="${baseURL}"
destfile="${tmpdir}/diff.xml"
tag1="BCEL_5_0"/>
tag1="10_BETA1"/>
</target>

<!--target name="report" depends="diff-with-implicit-trunk"-->
<target name="report">
<style in="/tmp/diff.xml"
out="/tmp/diff.html"
style="src/etc/diff.xsl">
<param name="title" expression="Jakarta BCEL diff"/>
<param name="repo" expression="http://svn.apache.org/repos/asf/jakarta/bcel/trunk"/>
<param name="title" expression="ANT UNIT DIFF"/>
<param name="repo" expression="${baseURL}"/>
</style>
</target>

@@ -43,7 +43,7 @@ public void tearDown() {

public void testDiffWithTwoTags() throws IOException {
String log = executeTargetAndReadLogFully("diff-with-two-tags");
assertAttributes(log, "initial", "BCEL_5_0");
assertAttributes(log, "10", "10_BETA1");
assertAdded1(log);
}

@@ -58,7 +58,7 @@ public void testDiffWithImplicitTrunk() throws IOException {
}

private static void assertDiffWithTrunk(String log) {
assertAttributes(log, "BCEL_5_0", "trunk");
assertAttributes(log, "10_BETA1", "trunk");
assertAdded(log);
assertModified(log);
assertDeleted(log);
@@ -86,14 +86,14 @@ private static final void assertAttributes(String log, String tag1,
Assert.assertTrue(log.indexOf("tag1=\"" + tag1 + "\"", start) < end);
Assert.assertTrue(log.indexOf("tag2=\"" + tag2 + "\"", start) > -1);
Assert.assertTrue(log.indexOf("tag2=\"" + tag2 + "\"", start) < end);
Assert.assertTrue(log.indexOf("svnurl=\"http://svn.apache.org/repos/"
+ "asf/jakarta/bcel/\"", start) > -1);
Assert.assertTrue(log.indexOf("svnurl=\"http://svn.apache.org/repos/"
+ "asf/jakarta/bcel/\"", start) < end);
Assert.assertTrue(log.indexOf("svnurl=\"http://svn.apache.org/",
start) > -1);
Assert.assertTrue(log.indexOf("svnurl=\"http://svn.apache.org/",
start) < end);
}

private static final void assertAdded(String log) {
int name = log.indexOf("<![CDATA[LICENSE.txt]]>");
int name = log.indexOf("<![CDATA[changes.xml]]>");
Assert.assertTrue(name > -1);

int pathAfterName = log.indexOf("</path>", name);
@@ -105,8 +105,7 @@ private static final void assertAdded(String log) {
}

private static final void assertModified(String log) {
int name = log.indexOf("<name><![CDATA[src/java/org/apache/bcel/"
+ "Repository.java]]></name>");
int name = log.indexOf("<name><![CDATA[NOTICE]]></name>");
Assert.assertTrue(name > -1);

int pathAfterName = log.indexOf("</path>", name);
@@ -118,29 +117,11 @@ private static final void assertModified(String log) {
}

private static final void assertDeleted(String log) {
int name = log.indexOf("<name><![CDATA[LICENSE]]></name>");
Assert.assertTrue(name > -1);

int pathAfterName = log.indexOf("</path>", name);
Assert.assertTrue(pathAfterName > -1);

Assert.assertTrue(log.indexOf("<action>deleted</action>", name) > -1);
Assert.assertTrue(log.indexOf("<action>deleted</action>", name)
< pathAfterName);
// Do nothing
}

private static final void assertAdded1(String log) {
int name = log.indexOf("<name><![CDATA[src/java/org/apache/bcel/"
+ "Repository.java]]></name>");
Assert.assertTrue("expected element for Repository.java, log was: "
+ log, name > -1);

int pathAfterName = log.indexOf("</path>", name);
Assert.assertTrue(pathAfterName > -1);

Assert.assertTrue(log.indexOf("<action>added</action>", name) > -1);
Assert.assertTrue(log.indexOf("<action>added</action>", name)
< pathAfterName);
// Do nothing
}

}

0 comments on commit 9c59a14

Please sign in to comment.