commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Massol" <vmas...@octo.com>
Subject [Jelly] How to do this?
Date Fri, 08 Nov 2002 18:07:16 GMT
Hi,

I'd like to be able to pass a list of classnames to the junit swing test
runner. These classnames should be extracted from names of files in the
file system.

Something like:

<fileScanner var="batchscanner">
  <fileset dir="${maven.cactus.src.dir}" includes="**/*.java"/>
</fileScanner>

      <j:forEach var="test" items="${batchscanner.iterator()}">
        <j:set var="length" value="${test.getPath().length() - 5}"/>
        ${test.getPath()}.substring(0,${length})}
      </j:forEach>

<java classname="junit.swingui.TestRunner" fork="true" dir="${basedir}">
  
  <j:forEach var="test" items="${batchscanner.iterator()}">
    <j:set var="classname" value="${test.getPath().substring(0,
test.getPath().length() - '.java'.length())}"/>
    <arg line="${classname}"/>
  </j:forEach>

[...]

I have 2 problems. 

The first one is that "${test.getPath().substring(0,
test.getPath().length() - '.java'.length())} does not properly evaluate.
I thought that everything inside ${} was a java expression, but
apparently it isn't so. The problem seems to be that the second
"test.getPath().length()" does not yield the expected result.

The second one is that the FileScanner is creating a File Object from an
Ant DirectoryScanner by doing the following: new File( ds.getBasedir(),
files[fileIndex] );

Thus, the path that I get from ${tests.getPath()} are absolute paths
whereas I would need relative ones. Alternatively I need to be able to
remove the absolute part. I would then need something like:

${fullpath.substring((${basedir}/${maven.cactus.src.dir}).length())

but obviously this would not work.

I could do all that from a java jelly tag, but I was wondering whether
there was not an easy jelly solution (maybe scripts? Or even simpler) to
the problem?

Thanks
-Vincent


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message