CVS: junit/build/experimental-use-of-antunit junit.ant, NONE, 1.1 build.xml, NONE, 1.1 junit.properties, NONE, 1.1 touch.ant, NONE, 1.1 junit-slow.ant, NONE, 1.1

David Saff <[email protected]>
Newsgroups gmane.comp.java.junit.devel
Message-ID <[email protected]>
Update of /cvsroot/junit/junit/build/experimental-use-of-antunit
In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv4902/build/experimental-use-of-antunit

Added Files:
	junit.ant build.xml junit.properties touch.ant junit-slow.ant 
Log Message:
Created a separate build directory for new build scripts, including FTP upload

--- NEW FILE: junit.ant ---
<project xmlns:au="antlib:org.apache.ant.antunit">
	<property file="junit.properties" />

	<!-- is called prior to the test -->
	<target name="setUp">
	</target>

	<!-- is called after the test, even if that caused an error -->
	<target name="tearDown">
		<delete dir="${antdistdir}" />
		<delete dir="${tempdir}" />
		<delete file="${exttestjavadoczip}" />
	</target>

	<macrodef name="junitbuild">
		<attribute name="target" />
		<sequential>
			<ant antfile="build.xml" target="@{target}" dir="${junitdir}">
				<property name="dist" value="${antdist}" />
				<property name="javadocdir"
				          value="${antdist}/ant-unit-java-docs"
				/>
				<property name="javadoczip" value="${testjavadoczip}" />
				<property name="javadocpackages" value="org.junit" />
			</ant>
		</sequential>
	</macrodef>

	<macrodef name="sizeOfDir">
		<attribute name="property.name" />
		<sequential>
			<length property="@{property.name}">
				<fileset dir="." includes="**/*" />
			</length>
		</sequential>
	</macrodef>

	<macrodef name="dirSizeChanges">
		<attribute name="property.name" />
		<element implicit="yes" name="operation" />

		<sequential>
			<sizeOfDir property.name="oldlength" />
			<operation />
			<sizeOfDir property.name="newlength" />
			<condition property="@{property.name}">
				<not>
					<equals arg1="${oldlength}" arg2="${newlength}" />
				</not>
			</condition>
		</sequential>
	</macrodef>

	<target name="testTearDown">
		<mkdir dir="${antdistdir}" />
		<mkdir dir="${tempdir}" />
		<touch file="${exttestjavadoczip}" />

		<antcall target="tearDown" />

		<au:assertFileDoesntExist file="${antdistdir}" />
		<au:assertFileDoesntExist file="${tempdir}" />
		<au:assertFileDoesntExist file="${exttestjavadoczip}" />
	</target>

	<target name="testCharacterize_JavadocGeneratesJavadoc">
		<junitbuild target="javadoc" />
		<au:assertFileExists file="${antdistdir}/ant-unit-java-docs" />
	</target>

	<target name="testJavaDocZip">
		<junitbuild target="javadoczip" />
		<au:assertFileExists file="${exttestjavadoczip}" />

		<antcall target="unzip.exttestjavadoczip" />
		<au:assertFileExists file="${tempdir}/org" />
	</target>

	<target name="testUnzipOnlyCreatesDirectoryCleanedByTeardown">
		<dirSizeChanges property.name="changed">
			<junitbuild target="javadoczip" />
			<antcall target="unzip.exttestjavadoczip" />
			<antcall target="tearDown" />
		</dirSizeChanges>
		<au:assertFalse>
			<isset property="changed" />
		</au:assertFalse>
	</target>

	<target name="testCharacterize_DirSizeChanges">
		<dirSizeChanges property.name="changed">
			<mkdir dir="${tempdir}" />
			<echo message="h" file="${tempdir}/whatever.txt" />
		</dirSizeChanges>
		<au:assertPropertySet name="changed" />
	</target>

	<target name="unzip.exttestjavadoczip">
		<unzip dest="${tempdir}" src="${exttestjavadoczip}" />
	</target>

	<target name="testJavaDocZipDeletedOnClean">
		<touch file="${exttestjavadoczip}" />
		<junitbuild target="clean" />
		<au:assertFileDoesntExist file="${exttestjavadoczip}" />
	</target>
</project>
--- NEW FILE: build.xml ---
<project xmlns:au="antlib:org.apache.ant.antunit" default="fast">
	<taskdef uri="antlib:org.apache.ant.antunit"
	         resource="org/apache/ant/antunit/antlib.xml"
	         classpath="lib/ant-antunit-1.0.jar"
	/>

	<target name="fast">
		<au:antunit>
			<fileset dir="." includes="touch.ant,junit.ant" />
			<au:plainlistener />
		</au:antunit>
	</target>

	<target name="all">
		<au:antunit>
			<fileset dir="." includes="touch.ant,junit.ant,junit-slow.ant" />
			<au:plainlistener />
		</au:antunit>
	</target>
</project>
--- NEW FILE: junit.properties ---
junitdir=../..
antdist=temp-dist-directory-for-ant-unit
antdistdir=${junitdir}/${antdist}
testjavadoczip=new-england-javadoc.zip
exttestjavadoczip=${junitdir}/${testjavadoczip}
tempdir=tempdir
--- NEW FILE: touch.ant ---
<project xmlns:au="antlib:org.apache.ant.antunit">
  <!-- is called prior to the test -->
  <target name="setUp">
    <property name="foo" value="foo"/>
  </target>

  <!-- is called after the test, even if that caused an error -->
  <target name="tearDown">
    <delete file="${foo}" quiet="true"/>
  </target>

  <!-- the actual test case -->
  <target name="testTouchCreatesFile">
    <au:assertFileDoesntExist file="${foo}"/>
    <touch file="${foo}"/>
    <au:assertFileExists file="${foo}"/>
  </target>
</project>
--- NEW FILE: junit-slow.ant ---
<project xmlns:au="antlib:org.apache.ant.antunit">
	<property file="junit.properties" />

	<!-- is called prior to the test -->
	<target name="setUp">
	</target>

	<!-- is called after the test, even if that caused an error -->
	<target name="tearDown">
		<delete dir="${antdistdir}" />
	</target>

	<target name="testTearDown">
		<mkdir dir="${antdistdir}"/>
		<antcall target="tearDown" />
		<au:assertFileDoesntExist file="${antdistdir}" />
	</target>

	<target name="testCharacterize_DistGeneratesJavadoc">
		<ant antfile="build.xml" target="dist" dir="${junitdir}">
			<property name="dist" value="${antdist}" />
			<property name="javadocdir" value="${antdist}/ant-unit-java-docs" />
		</ant>

		<au:assertFileExists file="${antdistdir}/ant-unit-java-docs" />
	</target>
	
	<target name="testCharacterize_DistRunsTests">
		<ant antfile="build.xml" target="dist" dir="${junitdir}">
			<property name="dist" value="${antdist}" />
		</ant>

		<au:assertLogContains text="Time:" />
	</target>
</project>

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.