diff options
author | Vlastimil Babka <caster@gentoo.org> | 2007-05-23 19:16:58 +0000 |
---|---|---|
committer | Vlastimil Babka <caster@gentoo.org> | 2007-05-23 19:16:58 +0000 |
commit | aae3a693c447b510fc33b04357d16fd9b7c9db16 (patch) | |
tree | e30ffa050cab6a454510781c87fad908638a66ee /dev-java | |
parent | Add sun-javamail as a symlink to ant-javamail. (diff) | |
download | java-testcases-aae3a693c447b510fc33b04357d16fd9b7c9db16.tar.gz java-testcases-aae3a693c447b510fc33b04357d16fd9b7c9db16.tar.bz2 java-testcases-aae3a693c447b510fc33b04357d16fd9b7c9db16.zip |
Add some testcases for ant-apache-bsf (and thus bsf), from examples in Ant manual.
svn path=/testcases/; revision=4755
Diffstat (limited to 'dev-java')
-rw-r--r-- | dev-java/ant-apache-bsf/README | 37 | ||||
-rw-r--r-- | dev-java/ant-apache-bsf/build.xml | 65 | ||||
-rw-r--r-- | dev-java/ant-apache-bsf/src/1.tmp | 1 | ||||
-rw-r--r-- | dev-java/ant-apache-bsf/src/1.txt | 1 | ||||
l--------- | dev-java/bsf | 1 |
5 files changed, 105 insertions, 0 deletions
diff --git a/dev-java/ant-apache-bsf/README b/dev-java/ant-apache-bsf/README new file mode 100644 index 0000000..4d34486 --- /dev/null +++ b/dev-java/ant-apache-bsf/README @@ -0,0 +1,37 @@ +Prerequisities: +dev-java/ant-apache-bsf +dev-java/bsf built with (at least) USE="rhino" + +Invocation (in this directory): +(Replace sun-jdk with the available jdk for your arch (ibm, jrockit) as needed) + +GENTOO_VM=sun-jdk-1.4 ant +GENTOO_VM=sun-jdk-1.5 ant +GENTOO_VM=sun-jdk-1.6 ant (if applicable) + + +Expected output: +-----START----- +Buildfile: build.xml + +squares: + [echo] 1 + [echo] 4 + [echo] 9 + [echo] 16 + [echo] 25 + [echo] 36 + [echo] 49 + [echo] 64 + [echo] 81 + [echo] 100 + +fileset_echo: + [echo] 1.txt: 4 byte + +all: + [echo] tests passed + +BUILD SUCCESSFUL +Total time: 0 seconds +------END------
\ No newline at end of file diff --git a/dev-java/ant-apache-bsf/build.xml b/dev-java/ant-apache-bsf/build.xml new file mode 100644 index 0000000..c2a6e09 --- /dev/null +++ b/dev-java/ant-apache-bsf/build.xml @@ -0,0 +1,65 @@ +<project name="bsftest" default="all" basedir="."> + + <target name="squares"> + + <script language="javascript"> <![CDATA[ + + for (i=1; i<=10; i++) { + echo = bsftest.createTask("echo"); + echo.setMessage(i*i); + echo.perform(); + } + + ]]> </script> + + </target> + + <target name="fileset_echo"> + + <property name="fs.dir" value="src"/> + <property name="fs.includes" value="**/*.txt"/> + <property name="fs.excludes" value="**/*.tmp"/> + + <script language="javascript"> <![CDATA[ + + // import statements + // importPackage(java.io); + importClass(java.io.File); + + // Access to Ant-Properties by their names + dir = project.getProperty("fs.dir"); + includes = bsftest.getProperty("fs.includes"); + excludes = self.getProject() .getProperty("fs.excludes"); + + // Create a <fileset dir="" includes=""/> + fs = project.createDataType("fileset"); + fs.setDir( new File(dir) ); + fs.setIncludes(includes); + fs.setExcludes(excludes); + + // Get the files (array) of that fileset + ds = fs.getDirectoryScanner(project); + srcFiles = ds.getIncludedFiles(); + + // iterate over that array + for (i=0; i<srcFiles.length; i++) { + + // get the values via Java API + var basedir = fs.getDir(project); + var filename = srcFiles[i]; + var file = new File(basedir, filename); + var size = file.length(); + + // create and use a Task via Ant API + echo = bsftest.createTask("echo"); + echo.setMessage(filename + ": " + size + " byte"); + echo.perform(); + } + ]]></script> + </target> + + <target name="all" depends="squares,fileset_echo"> + <echo message="tests passed"/> + </target> + +</project>
\ No newline at end of file diff --git a/dev-java/ant-apache-bsf/src/1.tmp b/dev-java/ant-apache-bsf/src/1.tmp new file mode 100644 index 0000000..5716ca5 --- /dev/null +++ b/dev-java/ant-apache-bsf/src/1.tmp @@ -0,0 +1 @@ +bar diff --git a/dev-java/ant-apache-bsf/src/1.txt b/dev-java/ant-apache-bsf/src/1.txt new file mode 100644 index 0000000..257cc56 --- /dev/null +++ b/dev-java/ant-apache-bsf/src/1.txt @@ -0,0 +1 @@ +foo diff --git a/dev-java/bsf b/dev-java/bsf new file mode 120000 index 0000000..3440164 --- /dev/null +++ b/dev-java/bsf @@ -0,0 +1 @@ +ant-apache-bsf
\ No newline at end of file |