mstover1    2004/10/01 09:25:08

  Modified:    bin      jmeter
  Added:       xdocs/extending notes_on_extending.txt
               src/components/org/apache/jmeter/modifiers
                        CSVDataSetResources.properties CSVDataSet.java
                        CSVDataSetBeanInfo.java
  Log:
  Beginnings of new CSVDataSet component
  
  Revision  Changes    Path
  1.25      +7 -5      jakarta-jmeter/bin/jmeter
  
  Index: jmeter
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/bin/jmeter,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- jmeter    16 Feb 2004 13:34:10 -0000      1.24
  +++ jmeter    1 Oct 2004 16:25:08 -0000       1.25
  @@ -43,7 +43,7 @@
   
   # This ratio and target have been proven OK in tests with a specially high
   # amount of per-sample objects (the HtmlParserHTMLParser tests):
  -SURVIVOR="-XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=50%"
  +# SURVIVOR="-XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=50%"
   
   # Think about it: trying to keep per-run objects in tenuring definitely
   # represents a cost, but where's the benefit? They won't disappear before
  @@ -61,7 +61,7 @@
   # memory in a short period of time, such as loading tests or listener data files.
   # Increase it if you experience OutOfMemory problems during those operations
   # without having gone through a lot of Full GC-ing just before the OOM:
  -EVACUATION="-XX:MaxLiveObjectEvacuationRatio=20%"
  +# EVACUATION="-XX:MaxLiveObjectEvacuationRatio=20%"
   
   # Avoid the RMI-induced Full GCs to run too frequently -- once every ten minutes
   # should be more than enough:
  @@ -73,6 +73,8 @@
   # Finally, some tracing to help in case things go astray:
   DEBUG="-verbose:gc -XX:+PrintTenuringDistribution"
   
  -ARGS="$HEAP $NEW $SURVIVOR $TENURING $EVACUATION $RMIGC $PERM $DEBUG"
  +SERVER="-server"
   
  -java $ARGS -jar `dirname $0`/ApacheJMeter.jar "$@"
  +ARGS="$SERVER $HEAP $NEW $SURVIVOR $TENURING $EVACUATION $RMIGC $PERM $DEBUG"
  +
  +/usr/java/j2sdk1.4.2_05/jre/bin/java $ARGS -jar `dirname $0`/ApacheJMeter.jar "$@"
  
  
  
  1.1                  jakarta-jmeter/xdocs/extending/notes_on_extending.txt
  
  Index: notes_on_extending.txt
  ===================================================================
  Making a TestBean Plugin For JMeter
  
  This component will be a CSV file reading element that will let users easily vary 
their input 
  data using csv files.
  
  1. Pick a package and make three files:
        - [ComponentName].java (CSVDataSet.java)
        - [ComponentName]BeanInfo.java (CSVDataSetBeanInfo.java)
        - [ComponentName]Resources.properties (CSVDataSetResources.properties)
        
  2. CSVDataSet.java must implement the TestBean interface.  In addition, it will 
extend 
  AbstractTestElement, and implement PreProcessor, TestListener and 
LoopIterationListener.
        - TestBean is a marker interface, so there are no methods to implement.
  
  3. CSVDataSetBeanInfo.java should extend org.apache.jmeter.testbeans.BeanInfoSupport
        - create a zero-parameter constructor in which we call super(CSVDataSet.class);
        - we'll come back to this.
  
  4. CSVDataSetResources.properties - blank for now
  
  5. Implement your special logic for you plugin class.  
        - The CSVDataSet will read a single CSV file and will store the values it 
finds into
        JMeter's running context.  The user will define the file, define the variable 
names for
        each "column".  The CSVDataSet will open the file when the test starts, and 
close it
        when the test ends (thus we implement TestListener).  The CSVDataSet will 
update the
        contents of the variables for every test thread, and for each iteration 
through its
        parent controller, by reading new lines in the file.  When we reach the end of 
the file,
        we'll start again at the beginning.
        
        - When implementing a TestBean, pay careful attention to your properties.  
These
        properties will become the basis of a gui form by which users will configure 
the CSVDataSet
        element.
        
        - Your element will be cloned by JMeter when the test starts.  Each thread 
will get it's own instance.  However, you will
        have a chance to control how the cloning is done - we'll be taking advantage 
of this for CSVDataSet (since we don't want to open the file X number of times from X 
number of threads).
        
        a. Properties: filename, variableNames.  With public getters and setters.
                - filename is self-explanatory, it will hold the name of the CSV file 
we'll read
                - variableNames is a String which will allow a user to enter the names 
of 
                the variables we'll assign values to.  Why a String?  Why not a 
Collection - surely
                users will need to enter multiple (and unknown number) variable names? 
 True, but
                if we used a List or Collection, we'd have to write a gui component to 
handle 
                collections, and I just want to do this quickly.  Instead, we'll let 
users input
                comma-delimited list of variable names.
                
        b. 
  
  
  1.1                  
jakarta-jmeter/src/components/org/apache/jmeter/modifiers/CSVDataSetResources.properties
  
        <<Binary file>>
  
  
  1.1                  
jakarta-jmeter/src/components/org/apache/jmeter/modifiers/CSVDataSet.java
  
  Index: CSVDataSet.java
  ===================================================================
  /*
   * Created on Sep 29, 2004
   *
   * TODO To change the template for this generated file go to
   * Window - Preferences - Java - Code Style - Code Templates
   */
  package org.apache.jmeter.modifiers;
  
  import java.io.File;
  
  import org.apache.jmeter.engine.event.LoopIterationEvent;
  import org.apache.jmeter.engine.event.LoopIterationListener;
  import org.apache.jmeter.processor.PreProcessor;
  import org.apache.jmeter.testbeans.TestBean;
  import org.apache.jmeter.testelement.AbstractTestElement;
  import org.apache.jmeter.testelement.TestListener;
  
  /**
   * @author mstover
   *
   * TODO To change the template for this generated type comment go to
   * Window - Preferences - Java - Code Style - Code Templates
   */
  public class CSVDataSet extends AbstractTestElement implements PreProcessor, 
TestBean, LoopIterationListener,TestListener
  {
      static final public long serialVersionUID = 1;
      
      private File filename;
      private String variableNames;
      
      /* (non-Javadoc)
       * @see org.apache.jmeter.processor.PreProcessor#process()
       */
      public void process()
      {
      // TODO Auto-generated method stub
  
      }
  
      /* (non-Javadoc)
       * @see 
org.apache.jmeter.engine.event.LoopIterationListener#iterationStart(org.apache.jmeter.engine.event.LoopIterationEvent)
       */
      public void iterationStart(LoopIterationEvent iterEvent)
      {
      // TODO Auto-generated method stub
  
      }
  
      /* (non-Javadoc)
       * @see java.lang.Object#clone()
       */
      public Object clone()
      {
          // TODO Auto-generated method stub
          return super.clone();
      }
      /* (non-Javadoc)
       * @see org.apache.jmeter.testelement.TestListener#testEnded()
       */
      public void testEnded()
      {
      // TODO Auto-generated method stub
  
      }
      /* (non-Javadoc)
       * @see org.apache.jmeter.testelement.TestListener#testEnded(java.lang.String)
       */
      public void testEnded(String host)
      {
      // TODO Auto-generated method stub
  
      }
      /* (non-Javadoc)
       * @see 
org.apache.jmeter.testelement.TestListener#testIterationStart(org.apache.jmeter.engine.event.LoopIterationEvent)
       */
      public void testIterationStart(LoopIterationEvent event)
      {
      // TODO Auto-generated method stub
  
      }
      /* (non-Javadoc)
       * @see org.apache.jmeter.testelement.TestListener#testStarted()
       */
      public void testStarted()
      {
      // TODO Auto-generated method stub
  
      }
      /* (non-Javadoc)
       * @see org.apache.jmeter.testelement.TestListener#testStarted(java.lang.String)
       */
      public void testStarted(String host)
      {
      // TODO Auto-generated method stub
  
      }
      /**
       * @return Returns the filename.
       */
      public File getFilename()
      {
          return filename;
      }
      /**
       * @param filename The filename to set.
       */
      public void setFilename(File filename)
      {
          this.filename = filename;
      }
      /**
       * @return Returns the variableNames.
       */
      public String getVariableNames()
      {
          return variableNames;
      }
      /**
       * @param variableNames The variableNames to set.
       */
      public void setVariableNames(String variableNames)
      {
          this.variableNames = variableNames;
      }
  }
  
  
  
  1.1                  
jakarta-jmeter/src/components/org/apache/jmeter/modifiers/CSVDataSetBeanInfo.java
  
  Index: CSVDataSetBeanInfo.java
  ===================================================================
  /*
   * Created on Sep 29, 2004
   *
   * TODO To change the template for this generated file go to
   * Window - Preferences - Java - Code Style - Code Templates
   */
  package org.apache.jmeter.modifiers;
  
  import org.apache.jmeter.testbeans.BeanInfoSupport;
  
  /**
   * @author mstover
   *
   * TODO To change the template for this generated type comment go to
   * Window - Preferences - Java - Code Style - Code Templates
   */
  public class CSVDataSetBeanInfo extends BeanInfoSupport
  {
  
      /**
       * @param beanClass
       */
      public CSVDataSetBeanInfo()
      {
          super(CSVDataSet.class);
      }
  }
  
  
  

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

Reply via email to