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 2001/01/08 19:54:23 UTC

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

curcuru     01/01/08 10:54:22

  Modified:    test/java/src/org/apache/qetest/xsl PerformanceTest.java
  Log:
  Fix minor problem with loading iterations, preload from .properties file properly
  
  Revision  Changes    Path
  1.3       +51 -3     xml-xalan/test/java/src/org/apache/qetest/xsl/PerformanceTest.java
  
  Index: PerformanceTest.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/test/java/src/org/apache/qetest/xsl/PerformanceTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PerformanceTest.java	2000/12/20 14:10:44	1.2
  +++ PerformanceTest.java	2001/01/08 18:54:18	1.3
  @@ -124,10 +124,11 @@
   
       /**
        * Initialize this test - setup description and createNewProcessor.  
  +     * Also explicitly initializes parameters related to PerformanceTest, 
  +     * like preload and iterations.
        *
  -     * NEEDSDOC @param p
  -     *
  -     * NEEDSDOC ($objectName$) @return
  +     * @param p Props (unused currently)
  +     * @return False if we should abort
        */
       public boolean doTestFileInit(Properties p)
       {
  @@ -339,6 +340,53 @@
   
           return PROCESS_OK;
       }
  +
  +
  +    /**
  +     * Set our instance variables from a Properties file.
  +     * Calls super.initializeFromProperties() to get defaults.
  +     * This is needed to explicitly initialize properties 
  +     * that are custom to this file, like iterations and 
  +     * preload.
  +     * //@todo Note that this needs some redesign, since it 
  +     * means we have to duplicate too much initialization code 
  +     * in different places.
  +     *
  +     * @param props Properties block to set name=value pairs from
  +     * @return status - true if OK, false if error.
  +     */
  +    public boolean initializeFromProperties(Properties props)
  +    {
  +        // Be sure to get our parents to initialize everything first!
  +        boolean b = super.initializeFromProperties(props);
  +
  +        // Read in our additional options from properties block (XLTest should have set this)
  +        String tmp;
  +        tmp = props.getProperty(OPT_PRELOAD, null);
  +
  +        if ((tmp != null) && tmp.equalsIgnoreCase("true"))
  +        {
  +            testProps.put(OPT_PRELOAD, "true");
  +            preload = true;
  +        }
  +
  +        tmp = null;
  +        tmp = props.getProperty(OPT_ITERATIONS, null);
  +
  +        try
  +        {
  +            iterations = Integer.parseInt(tmp);
  +            testProps.put(OPT_ITERATIONS, tmp);
  +        }
  +        catch (NumberFormatException numEx)
  +        {
  +
  +            // no-op; leave as default
  +        }
  +
  +        return b;
  +    }
  +
   
       /**
        * Cheap-o memory logger - just reports Runtime.totalMemory/freeMemory.