sbailliez    02/02/03 14:21:08

  Modified:    src/testcases/org/apache/tools/ant BuildFileTest.java
  Log:
  Add a getResource method. I would rather prefer to
  load resource this way than assuming the JVM is the
  root directory.
  
  Revision  Changes    Path
  1.7       +14 -2     
jakarta-ant/src/testcases/org/apache/tools/ant/BuildFileTest.java
  
  Index: BuildFileTest.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/BuildFileTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- BuildFileTest.java        16 Jan 2002 11:25:49 -0000      1.6
  +++ BuildFileTest.java        3 Feb 2002 22:21:08 -0000       1.7
  @@ -57,6 +57,7 @@
   import junit.framework.*;
   import org.apache.tools.ant.*;
   import java.io.*;
  +import java.net.URL;
   
   /**
    * A BuildFileTest is a TestCase which executes targets from an Ant 
buildfile 
  @@ -256,9 +257,20 @@
           expectPropertySet(target, property, null);
       }
   
  -    
  +    /**
  +     * Retrieve a resource from the caller classloader to avoid
  +     * assuming a vm working directory. The resource path must be
  +     * relative to the package name or absolute from the root path.
  +     * @param resource the resource to retrieve its url.
  +     * @throws AssertionFailureException if resource is not found.
  +     */
  +    protected URL getResource(String resource){
  +        URL url = getClass().getResource(resource);
  +        assertNotNull("Could not find resource :" + resource, url);
  +        return url;
  +    }
   
  -    private class AntOutputStream extends java.io.OutputStream { 
  +    private class AntOutputStream extends java.io.OutputStream {
           public void write(int b) { 
               outBuffer.append((char)b);
           }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to