java/src/org/apache/qetest/xsl/BugzillaTestletDriver.java [337:439]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                + " .java Testlets, and " + xslCtr + " .xsl files to test");
        return v;
    }


    /**
     * Execute a Testlet with a specific user.dir.
     * Bugzilla testlets hardcode their input file names, assuming 
     * they're in the current directory.  But this automation is 
     * frequently run in another directory, and uses the inputDir 
     * setting to point where the files are.  Hence this worker 
     * method to change user.dir, execute the Testlet, and then 
     * switch back.
     * Note: will not work in Applet context, obviously.
     *
     * @param t Testlet to execute
     * @param dir to change user.dir to first
     * @throws propagates any non-user.dir exceptions
     */
    public void executeTestletInDir(Testlet t, Datalet d, String dir)
        throws Exception
    {
        final String USER_DIR = "user.dir";
        try
        {
            // Note: we must actually keep a cloned copy of the 
            //  whole system properties block to replace later 
            //  in case a Bugzilla testlet changes any other 
            //  properties during it's execution
            Properties p = System.getProperties();
            Properties cacheProps = (Properties)p.clone();
            // This should, I hope, properly get the correct path 
            //  for what the inputDir would be, whether it's a 
            //  relative or absolute path from where we are now
            File f = new File(inputDir);
            try
            {
                // Note the canonical form seems to be the most reliable for our purpose
                p.put(USER_DIR, f.getCanonicalPath());
            } 
            catch (IOException ioe)
            {
                p.put(USER_DIR, f.getAbsolutePath());
            }
            System.setProperties(p);

            // Now just execute the Testlet from here
            t.execute(d);

            // Replace the system properties to be polite!
            System.setProperties(cacheProps);
        } 
        catch (SecurityException se)
        {
            reporter.logThrowable(Logger.ERRORMSG, se, "executeTestletInDir threw");
            reporter.checkErr("executeTestletInDir threw :" + se 
                    + " cannot execute Testlet in correct dir " + dir);
        }
    }


    /**
     * Convenience method to get a Bugzilla Testlet to use.  
     * Take the TraxDatalet given and find the java classname 
     * from it.  Then just load an instance of that Testlet class.
     * 
     * @return Testlet for use in this test; null if error
     */
    public Testlet getTestlet(TraxDatalet d)
    {
        try
        {
            // Calculate the java classname
            String testletSourceName = (String)d.options.get(JAVA_SOURCE_NAME);
            // Potential problem: what if the SourceName doesn't have .java at end?
            String testletClassName = testletSourceName.substring(0, testletSourceName.indexOf(JAVA_EXTENSION));
            //@todo should we attempt to compile to a .class file 
            //  if we can't find the class here?  This adds a bunch 
            //  of complexity here; so I'm thinking it's better to 
            //  simply require the user to 'build all' first
            Class testletClazz = Class.forName(testletClassName);
            // Create it and set our reporter into it
            Testlet t = (Testlet)testletClazz.newInstance();
            t.setLogger((Logger)reporter);
            return (Testlet)t;
        }
        catch (Exception e)
        {
            // Ooops, none found, log an error
            reporter.logThrowable(Logger.ERRORMSG, e, "getTestlet(d) threw");
            reporter.checkErr("getTestlet(d) threw: " + e.toString());
            return null;
        }
    }


    /**
     * Convenience method to get a default filter for files.  
     * Returns special file filter for our use.
     * 
     * @return FilenameFilter using BugzillaFileRules(excludes).
     */
    public FilenameFilter getFileFilter()
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



java/src/org/apache/qetest/xsl/JiraTestletDriver.java [336:438]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                + " .java Testlets, and " + xslCtr + " .xsl files to test");
        return v;
    }


    /**
     * Execute a Testlet with a specific user.dir.
     * Jira testlets hardcode their input file names, assuming 
     * they're in the current directory.  But this automation is 
     * frequently run in another directory, and uses the inputDir 
     * setting to point where the files are.  Hence this worker 
     * method to change user.dir, execute the Testlet, and then 
     * switch back.
     * Note: will not work in Applet context, obviously.
     *
     * @param t Testlet to execute
     * @param dir to change user.dir to first
     * @throws propagates any non-user.dir exceptions
     */
    public void executeTestletInDir(Testlet t, Datalet d, String dir)
        throws Exception
    {
        final String USER_DIR = "user.dir";
        try
        {
            // Note: we must actually keep a cloned copy of the 
            //  whole system properties block to replace later 
            //  in case a Jira testlet changes any other 
            //  properties during it's execution
            Properties p = System.getProperties();
            Properties cacheProps = (Properties)p.clone();
            // This should, I hope, properly get the correct path 
            //  for what the inputDir would be, whether it's a 
            //  relative or absolute path from where we are now
            File f = new File(inputDir);
            try
            {
                // Note the canonical form seems to be the most reliable for our purpose
                p.put(USER_DIR, f.getCanonicalPath());
            } 
            catch (IOException ioe)
            {
                p.put(USER_DIR, f.getAbsolutePath());
            }
            System.setProperties(p);

            // Now just execute the Testlet from here
            t.execute(d);

            // Replace the system properties to be polite!
            System.setProperties(cacheProps);
        } 
        catch (SecurityException se)
        {
            reporter.logThrowable(Logger.ERRORMSG, se, "executeTestletInDir threw");
            reporter.checkErr("executeTestletInDir threw :" + se 
                    + " cannot execute Testlet in correct dir " + dir);
        }
    }


    /**
     * Convenience method to get a Jira Testlet to use.  
     * Take the TraxDatalet given and find the java classname 
     * from it.  Then just load an instance of that Testlet class.
     * 
     * @return Testlet for use in this test; null if error
     */
    public Testlet getTestlet(TraxDatalet d)
    {
        try
        {
            // Calculate the java classname
            String testletSourceName = (String)d.options.get(JAVA_SOURCE_NAME);
            // Potential problem: what if the SourceName doesn't have .java at end?
            String testletClassName = testletSourceName.substring(0, testletSourceName.indexOf(JAVA_EXTENSION));
            //@todo should we attempt to compile to a .class file 
            //  if we can't find the class here?  This adds a bunch 
            //  of complexity here; so I'm thinking it's better to 
            //  simply require the user to 'build all' first
            Class testletClazz = Class.forName(testletClassName);
            // Create it and set our reporter into it
            Testlet t = (Testlet)testletClazz.newInstance();
            t.setLogger((Logger)reporter);
            return (Testlet)t;
        }
        catch (Exception e)
        {
            // Ooops, none found, log an error
            reporter.logThrowable(Logger.ERRORMSG, e, "getTestlet(d) threw");
            reporter.checkErr("getTestlet(d) threw: " + e.toString());
            return null;
        }
    }


    /**
     * Convenience method to get a default filter for files.  
     * Returns special file filter for our use.
     * 
     * @return FilenameFilter using JiraFileRules(excludes).
     */
    public FilenameFilter getFileFilter()
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



