You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by cu...@apache.org on 2002/02/06 16:00:27 UTC

cvs commit: xml-xalan/test/java/src/org/apache/qetest/xsl ThreadedTestletDriver.java ThreadedStylesheetTestlet.java

curcuru     02/02/06 07:00:27

  Modified:    test/java/src/org/apache/qetest/xsl
                        ThreadedTestletDriver.java
                        ThreadedStylesheetTestlet.java
  Log:
  What happens when good programmers attempt to cut back on caffene:
  missed checkin on the one time I had a compile error.
  Actual changes include cleaning up the logging; changing output
  subthread result names to look nicer; and cleanup a number of
  variable references to refer to the correct datalet.var or local var in
  each of the extecute methods.
  Also fix previous bug where filenameToURL was incorrectly called.
  
  Revision  Changes    Path
  1.4       +7 -7      xml-xalan/test/java/src/org/apache/qetest/xsl/ThreadedTestletDriver.java
  
  Index: ThreadedTestletDriver.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/test/java/src/org/apache/qetest/xsl/ThreadedTestletDriver.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ThreadedTestletDriver.java	12 Dec 2001 22:07:51 -0000	1.3
  +++ ThreadedTestletDriver.java	6 Feb 2002 15:00:27 -0000	1.4
  @@ -90,7 +90,7 @@
    * tightly bound to ThreadedStylesheetTestlet/Datalet.
    *
    * @author shane_curcuru@lotus.com
  - * @version $Id: ThreadedTestletDriver.java,v 1.3 2001/12/12 22:07:51 curcuru Exp $
  + * @version $Id: ThreadedTestletDriver.java,v 1.4 2002/02/06 15:00:27 curcuru Exp $
    */
   public class ThreadedTestletDriver extends StylesheetTestletDriver
   {
  @@ -177,8 +177,7 @@
               transformWrapper = TransformWrapperFactory.newWrapper(firstDatalet.flavor);
               transformWrapper.newProcessor(null);
               reporter.logMsg(Logger.INFOMSG, "Created transformWrapper, about to process shared: " + firstDatalet.inputName);
  -            //@todo should key off of useURL/useURI
  -            transformWrapper.buildStylesheet(QetestUtils.filenameToURL(firstDatalet.inputName));
  +            transformWrapper.buildStylesheet(firstDatalet.inputName);
           }
           catch (Throwable t)
           {
  @@ -235,12 +234,12 @@
           // We now wait for every thread to finish, and only then 
           //  will we write a final report and finish the test
           //@todo probably an easier way; for now, just join the last one
  -        reporter.logMsg(Logger.STATUSMSG, "Driver main thread now joining last thread");
  +        reporter.logMsg(Logger.STATUSMSG, "Driver Attempting-to-Join last thread");
           long maxWaitMillis = 100000; // Wait at most xxxx milliseconds
           // Try waiting for the last thread several times
           testletThreads[testletThreads.length - 1].waitForComplete
                   (reporter, maxWaitMillis, 10);
  -        reporter.logMsg(Logger.TRACEMSG, "Apparently-Joined last thread");
  +        reporter.logMsg(Logger.TRACEMSG, "Driver Apparently-Joined last thread");
   
           // Also join all other threads
           for (int i = 0; i < (testletThreads.length - 1); i++)
  @@ -248,7 +247,7 @@
               // Only wait a little while for these
               testletThreads[i].waitForComplete(reporter, maxWaitMillis, 2);
           }
  -        reporter.logMsg(Logger.STATUSMSG, "Apparently-joined all threads");
  +        reporter.logMsg(Logger.INFOMSG, "Driver Apparently-joined all threads");
           
           // Log results from all threads
           for (int i = 0; i < testletThreads.length; i++)
  @@ -327,7 +326,8 @@
               //  so each testlet can automatically get a new logger 
               //  based off of our logger
               String testletLogFile = testProps.getProperty(Logger.OPT_LOGFILE, "threadedTestlet");
  -            testletLogFile = testletLogFile + ctr + ".xml";
  +            int idx = testletLogFile.lastIndexOf("."); // Assumption: there'll be a .extension
  +            testletLogFile = testletLogFile.substring(0, idx) + ctr + testletLogFile.substring(idx);
               Properties testletLoggerProperties = new Properties(testProps);
               testletLoggerProperties.put(Logger.OPT_LOGFILE, testletLogFile);
               t.setLogger(new Reporter(testletLoggerProperties));
  
  
  
  1.4       +16 -21    xml-xalan/test/java/src/org/apache/qetest/xsl/ThreadedStylesheetTestlet.java
  
  Index: ThreadedStylesheetTestlet.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/test/java/src/org/apache/qetest/xsl/ThreadedStylesheetTestlet.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ThreadedStylesheetTestlet.java	5 Feb 2002 18:59:00 -0000	1.3
  +++ ThreadedStylesheetTestlet.java	6 Feb 2002 15:00:27 -0000	1.4
  @@ -91,7 +91,7 @@
    * of calling execute(). @todo find a better way to integrate!
    *
    * @author Shane_Curcuru@lotus.com
  - * @version $Id: ThreadedStylesheetTestlet.java,v 1.3 2002/02/05 18:59:00 curcuru Exp $
  + * @version $Id: ThreadedStylesheetTestlet.java,v 1.4 2002/02/06 15:00:27 curcuru Exp $
    */
   public class ThreadedStylesheetTestlet 
           extends TestletImpl 
  @@ -265,7 +265,7 @@
           for (int ctr = 1; (ctr <= iterations); ctr++)
           {
               // Only validate on first and last iteration
  -            boolean doValidation = ((1 == ctr) || (sharedDatalet.iterations == ctr));
  +            boolean doValidation = ((1 == ctr) || (iterations == ctr));
               logger.logMsg(Logger.TRACEMSG, "About to do iteration " + ctr);
               // Note: logic moved to worker methods for clarity; 
               //  these methods just use our local vars and datalet
  @@ -320,14 +320,12 @@
           //  just go ahead and ask it to transform
           try
           {
  -            // Store local copies of XSL, XML references to avoid 
  -            //  potential for changing datalet            
  -            String xmlName = datalet.xmlName;
  +            String outputName = datalet.outputName + threadIdentifier;
   
               //@todo Should we log a custom logElement here instead?
               logger.logMsg(Logger.TRACEMSG, "About to test shared Templates: "
  -                          + " xmlName=" + xmlName 
  -                          + " outputName=" + datalet.outputName + "-" + threadIdentifier
  +                          + " xmlName=" + datalet.xmlName 
  +                          + " outputName=" + outputName
                             + " goldName=" + datalet.goldName);
   
               // Simply have the wrapper do all the transforming
  @@ -335,12 +333,12 @@
               //  stylesheet tests or just .xml embedded tests
               long retVal = 0L;
               // Here, we only use the existing Templates to do the transform
  -            long[] times = datalet.transformWrapper.transformWithStylesheet(xmlName, datalet.outputName + "-" + threadIdentifier);
  +            long[] times = datalet.transformWrapper.transformWithStylesheet(datalet.xmlName, outputName);
               retVal = times[TransformWrapper.IDX_OVERALL];
   
               if (!doValidation)
               {
  -                logger.logMsg(Logger.TRACEMSG, "Skipping validation of outputName=" + datalet.outputName + "-" + threadIdentifier);
  +                logger.logMsg(Logger.TRACEMSG, "Skipping validation of outputName=" + outputName);
                   // Only bother to validate the output if asked
                   return;
               }
  @@ -351,7 +349,7 @@
               if (null == fileChecker)
                   fileChecker = new XHTFileCheckService();
               fileChecker.check(logger,
  -                              new File(datalet.outputName + "-" + threadIdentifier), 
  +                              new File(outputName), 
                                 new File(datalet.goldName), 
                                 "Shared Templates of: " + datalet.getDescription());
           }
  @@ -377,14 +375,11 @@
           // Test our supplied input file, and compare with gold
           try
           {
  -            // Store local copies of XSL, XML references to avoid 
  -            //  potential for changing datalet            
  -            String inputName = datalet.inputName;
  -            String xmlName = datalet.xmlName;
  +            String outputName =  datalet.outputName + threadIdentifier;
   
               //@todo Should we log a custom logElement here instead?
  -            logger.logMsg(Logger.TRACEMSG, "About to test: inputName=" + inputName
  -                          + " xmlName=" + xmlName + " outputName=" + datalet.outputName + "-" + threadIdentifier
  +            logger.logMsg(Logger.TRACEMSG, "About to test: inputName=" + datalet.inputName
  +                          + " xmlName=" + datalet.xmlName + " outputName=" + outputName
                             + " goldName=" + datalet.goldName + " flavor="  + datalet.flavor);
   
               // Create a new TransformWrapper of appropriate flavor
  @@ -409,19 +404,19 @@
               if (null == datalet.inputName)
               {
                   // presume it's an embedded test
  -                long [] times = transformWrapper.transformEmbedded(xmlName, datalet.outputName + "-" + threadIdentifier);
  +                long [] times = transformWrapper.transformEmbedded(datalet.xmlName, outputName);
                   retVal = times[TransformWrapper.IDX_OVERALL];
               }
               else
               {
                   // presume it's a normal stylesheet test
  -                long[] times = transformWrapper.transform(xmlName, inputName, datalet.outputName + "-" + threadIdentifier);
  +                long[] times = transformWrapper.transform(datalet.xmlName, datalet.inputName, outputName);
                   retVal = times[TransformWrapper.IDX_OVERALL];
               }
   
               if (!doValidation)
               {
  -                logger.logMsg(Logger.TRACEMSG, "Skipping validation of outputName=" + datalet.outputName + "-" + threadIdentifier);
  +                logger.logMsg(Logger.TRACEMSG, "Skipping validation of outputName=" + outputName);
                   // Only bother to validate the output if asked
                   return;
               }
  @@ -432,9 +427,9 @@
               if (null == fileChecker)
                   fileChecker = new XHTFileCheckService();
               fileChecker.check(logger,
  -                              new File(datalet.outputName + "-" + threadIdentifier), 
  +                              new File(outputName), 
                                 new File(datalet.goldName), 
  -                              getDescription() + " " + datalet.getDescription())
  +                              getDescription() + " " + datalet.getDescription());
           }
           // Note that this class can only validate positive test 
           //  cases - we don't handle ExpectedExceptions
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org