java/src/org/apache/qetest/xsl/BugzillaTestletDriver.java [250:339]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public Vector buildDatalets(Vector files, File testLocation, 
                                File outLocation, File goldLocation)
    {
        // Validate arguments
        if ((null == files) || (files.size() < 1))
        {
            // Bad arguments, report it as an error
            // Note: normally, this should never happen, since 
            //  this class normally validates these arguments 
            //  before calling us
            reporter.logWarningMsg("buildDatalets null or empty file vector");
            return null;
        }
        Vector v = new Vector(files.size());
        int xslCtr = 0;
        int javaCtr = 0;

        // For every file in the vector, construct the matching 
        //  out, gold, and xml/xsl files; plus see if we have 
        //  a .java file as well
        for (Enumeration elements = files.elements();
                elements.hasMoreElements(); /* no increment portion */ )
        {
            String file = null;
            try
            {
                file = (String)elements.nextElement();
            }
            catch (ClassCastException cce)
            {
                // Just skip this entry
                reporter.logWarningMsg("Bad file element found, skipping: " + cce.toString());
                continue;
            }

            Datalet d = null;
            // If it's a .java file: just set java.source.name/java.class.name
            if (file.endsWith(JAVA_EXTENSION))
            {
                // Use TraxDatalets if we have .java
                d = new TraxDatalet();
                ((TraxDatalet)d).options = new Properties(testProps);
                ((TraxDatalet)d).options.put("java.source.dir", testLocation);
                ((TraxDatalet)d).options.put(JAVA_SOURCE_NAME, file);
                ((TraxDatalet)d).options.put("fileCheckerImpl", fileChecker);
                // That's it - when we execute tests later on, if 
                //  there's a JAVA_SOURCE_NAME we simply use that to 
                //  find the testlet to execute
                javaCtr++;
            }
            // If it's a .xsl file, just set the filenames as usual
            else if (file.endsWith(XSL_EXTENSION))
            {
                // Use plain StylesheetDatalets if we just have .xsl
                d = new StylesheetDatalet();
                ((StylesheetDatalet)d).inputName = testLocation.getPath() + File.separator + file;

                String fileNameRoot = file.substring(0, file.indexOf(XSL_EXTENSION));
                // Check for existence of xml - if not there, then set to some default
                //@todo this would be a perfect use of TraxDatalet.setXMLString()
                String xmlFileName = testLocation.getPath() + File.separator + fileNameRoot + XML_EXTENSION;
                if ((new File(xmlFileName)).exists())
                {
                    ((StylesheetDatalet)d).xmlName = xmlFileName;
                }
                else
                {
                    ((StylesheetDatalet)d).xmlName = testLocation.getPath() + File.separator + DEFAULT_XML_FILE;
                }
                ((StylesheetDatalet)d).outputName = outLocation.getPath() + File.separator + fileNameRoot + OUT_EXTENSION;
                ((StylesheetDatalet)d).goldName = testLocation.getPath() + File.separator + fileNameRoot + OUT_EXTENSION;
                ((StylesheetDatalet)d).flavor = flavor;
                ((StylesheetDatalet)d).options = new Properties(testProps);
                ((StylesheetDatalet)d).options.put("fileCheckerImpl", fileChecker);
                // These tests will be run by a plain StylesheetTestlet
                xslCtr++;
            }
            else
            {
                // Hmmm - I'm not sure what we should do here
                reporter.logWarningMsg("Unexpected test file found, skipping: " + file);
                continue;
            }
            d.setDescription(file);
            v.addElement(d);
        }
        reporter.logTraceMsg("Bugzilla buildDatalets with " + javaCtr 
                + " .java Testlets, and " + xslCtr + " .xsl files to test");
        return v;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



java/src/org/apache/qetest/xsl/JiraTestletDriver.java [249:338]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public Vector buildDatalets(Vector files, File testLocation, 
                                File outLocation, File goldLocation)
    {
        // Validate arguments
        if ((null == files) || (files.size() < 1))
        {
            // Bad arguments, report it as an error
            // Note: normally, this should never happen, since 
            //  this class normally validates these arguments 
            //  before calling us
            reporter.logWarningMsg("buildDatalets null or empty file vector");
            return null;
        }
        Vector v = new Vector(files.size());
        int xslCtr = 0;
        int javaCtr = 0;

        // For every file in the vector, construct the matching 
        //  out, gold, and xml/xsl files; plus see if we have 
        //  a .java file as well
        for (Enumeration elements = files.elements();
                elements.hasMoreElements(); /* no increment portion */ )
        {
            String file = null;
            try
            {
                file = (String)elements.nextElement();
            }
            catch (ClassCastException cce)
            {
                // Just skip this entry
                reporter.logWarningMsg("Bad file element found, skipping: " + cce.toString());
                continue;
            }

            Datalet d = null;
            // If it's a .java file: just set java.source.name/java.class.name
            if (file.endsWith(JAVA_EXTENSION))
            {
                // Use TraxDatalets if we have .java
                d = new TraxDatalet();
                ((TraxDatalet)d).options = new Properties(testProps);
                ((TraxDatalet)d).options.put("java.source.dir", testLocation);
                ((TraxDatalet)d).options.put(JAVA_SOURCE_NAME, file);
                ((TraxDatalet)d).options.put("fileCheckerImpl", fileChecker);
                // That's it - when we execute tests later on, if 
                //  there's a JAVA_SOURCE_NAME we simply use that to 
                //  find the testlet to execute
                javaCtr++;
            }
            // If it's a .xsl file, just set the filenames as usual
            else if (file.endsWith(XSL_EXTENSION))
            {
                // Use plain StylesheetDatalets if we just have .xsl
                d = new StylesheetDatalet();
                ((StylesheetDatalet)d).inputName = testLocation.getPath() + File.separator + file;

                String fileNameRoot = file.substring(0, file.indexOf(XSL_EXTENSION));
                // Check for existence of xml - if not there, then set to some default
                //@todo this would be a perfect use of TraxDatalet.setXMLString()
                String xmlFileName = testLocation.getPath() + File.separator + fileNameRoot + XML_EXTENSION;
                if ((new File(xmlFileName)).exists())
                {
                    ((StylesheetDatalet)d).xmlName = xmlFileName;
                }
                else
                {
                    ((StylesheetDatalet)d).xmlName = testLocation.getPath() + File.separator + DEFAULT_XML_FILE;
                }
                ((StylesheetDatalet)d).outputName = outLocation.getPath() + File.separator + fileNameRoot + OUT_EXTENSION;
                ((StylesheetDatalet)d).goldName = testLocation.getPath() + File.separator + fileNameRoot + OUT_EXTENSION;
                ((StylesheetDatalet)d).flavor = flavor;
                ((StylesheetDatalet)d).options = new Properties(testProps);
                ((StylesheetDatalet)d).options.put("fileCheckerImpl", fileChecker);
                // These tests will be run by a plain StylesheetTestlet
                xslCtr++;
            }
            else
            {
                // Hmmm - I'm not sure what we should do here
                reporter.logWarningMsg("Unexpected test file found, skipping: " + file);
                continue;
            }
            d.setDescription(file);
            v.addElement(d);
        }
        reporter.logTraceMsg("Jira buildDatalets with " + javaCtr 
                + " .java Testlets, and " + xslCtr + " .xsl files to test");
        return v;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



