mstover1    2003/02/19 18:59:16

  Modified:    src/core/org/apache/jmeter/samplers SampleResult.java
               src/core/org/apache/jmeter/testelement
                        AbstractTestElement.java
               src/protocol/http/org/apache/jmeter/protocol/http/sampler
                        HTTPSampler.java
  Added:       src/core/org/apache/jmeter/testelement ListElement.java
  Log:
  new ListElement test element that provides some convenience.
  New methods in AbstractTestElement for getting values as collections
  new dataEncoding property in SampleResult, unused currently, but should be used for 
international compatibility
  
  Revision  Changes    Path
  1.4       +28 -2     
jakarta-jmeter/src/core/org/apache/jmeter/samplers/SampleResult.java
  
  Index: SampleResult.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/samplers/SampleResult.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SampleResult.java 29 Aug 2002 18:17:39 -0000      1.3
  +++ SampleResult.java 20 Feb 2003 02:59:15 -0000      1.4
  @@ -95,6 +95,7 @@
        private boolean success;
        private boolean mark = false;
        private Set files = new HashSet();
  +    private String dataEncoding;
        
   
        Map map;
  @@ -332,4 +333,29 @@
        {
                return getSampleLabel();
        }
  +    /**
  +     * Returns the dataEncoding.
  +     * @return String
  +     */
  +    public String getDataEncoding()
  +    {
  +        if(dataEncoding != null)
  +        {
  +            return dataEncoding;
  +        }
  +        else
  +        {
  +            return "8859-1";
  +        }
  +    }
  +
  +    /**
  +     * Sets the dataEncoding.
  +     * @param dataEncoding The dataEncoding to set
  +     */
  +    public void setDataEncoding(String dataEncoding)
  +    {
  +        this.dataEncoding = dataEncoding;
  +    }
  +
   }
  
  
  
  1.8       +28 -1     
jakarta-jmeter/src/core/org/apache/jmeter/testelement/AbstractTestElement.java
  
  Index: AbstractTestElement.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/testelement/AbstractTestElement.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- AbstractTestElement.java  5 Feb 2003 05:12:09 -0000       1.7
  +++ AbstractTestElement.java  20 Feb 2003 02:59:15 -0000      1.8
  @@ -1,9 +1,12 @@
   package org.apache.jmeter.testelement;
   import java.io.Serializable;
  +import java.util.Arrays;
   import java.util.Collection;
   import java.util.Collections;
   import java.util.HashMap;
   import java.util.Iterator;
  +import java.util.LinkedList;
  +import java.util.List;
   import java.util.Map;
   
   import org.apache.log.Hierarchy;
  @@ -247,6 +250,25 @@
               return bound.toString();
           }
       }
  +    
  +    private Collection getCollectionValue(Object value)
  +    {
  +        if(value == null)
  +        {
  +            return new LinkedList();
  +        }
  +        if(value instanceof Collection)
  +        {
  +            return (Collection)value;
  +        }
  +        if(value instanceof Object[])
  +        {
  +            return Arrays.asList((Object[])value);
  +        }
  +        List newList = new LinkedList();
  +        newList.add(value);
  +        return newList;
  +    }
   
       private int getIntValue(Object bound)
       {
  @@ -315,6 +337,11 @@
       public String getPropertyAsString(String key)
       {
           return getStringValue(getProperty(key));
  +    }
  +    
  +    public Collection getPropertyAsCollection(String key)
  +    {
  +        return getCollectionValue(getProperty(key));
       }
   
       /****************************************
  
  
  
  1.1                  
jakarta-jmeter/src/core/org/apache/jmeter/testelement/ListElement.java
  
  Index: ListElement.java
  ===================================================================
  package org.apache.jmeter.testelement;
  
  import java.util.ArrayList;
  import java.util.Collection;
  import java.util.Iterator;
  import java.util.List;
  import java.util.ListIterator;
  
  /**
   * @author Administrator
   *
   * To change this generated comment edit the template variable "typecomment":
   * Window>Preferences>Java>Templates.
   */
  public class ListElement extends AbstractTestElement implements List
  {
      public final static String LIST = "listelement.list";
      
      public ListElement()
      {
          setProperty(LIST,new ArrayList());
      }
      
      public List getList()
      {
          return (List)getProperty(LIST);
      }
  
      /**
       * @see java.util.Collection#size()
       */
      public int size()
      {
          return getList().size();
      }
  
      /**
       * @see java.util.Collection#isEmpty()
       */
      public boolean isEmpty()
      {
          return getList().isEmpty();
      }
  
      /**
       * @see java.util.Collection#contains(java.lang.Object)
       */
      public boolean contains(Object arg0)
      {
          return getList().contains(arg0);
      }
  
      /**
       * @see java.util.Collection#iterator()
       */
      public Iterator iterator()
      {
          return getList().iterator();
      }
  
      /**
       * @see java.util.Collection#toArray()
       */
      public Object[] toArray()
      {
          return getList().toArray();
      }
  
      /**
       * @see java.util.Collection#toArray(java.lang.Object)
       */
      public Object[] toArray(Object[] arg0)
      {
          return getList().toArray(arg0);
      }
  
      /**
       * @see java.util.Collection#add(java.lang.Object)
       */
      public boolean add(Object arg0)
      {
          return getList().add(arg0);
      }
  
      /**
       * @see java.util.Collection#remove(java.lang.Object)
       */
      public boolean remove(Object arg0)
      {
          return getList().remove(arg0);
      }
  
      /**
       * @see java.util.Collection#containsAll(java.util.Collection)
       */
      public boolean containsAll(Collection arg0)
      {
          return getList().containsAll(arg0);
      }
  
      /**
       * @see java.util.Collection#addAll(java.util.Collection)
       */
      public boolean addAll(Collection arg0)
      {
          return getList().addAll(arg0);
      }
  
      /**
       * @see java.util.List#addAll(int, java.util.Collection)
       */
      public boolean addAll(int arg0, Collection arg1)
      {
          return getList().addAll(arg0,arg1);
      }
  
      /**
       * @see java.util.Collection#removeAll(java.util.Collection)
       */
      public boolean removeAll(Collection arg0)
      {
          return getList().removeAll(arg0);
      }
  
      /**
       * @see java.util.Collection#retainAll(java.util.Collection)
       */
      public boolean retainAll(Collection arg0)
      {
          return getList().retainAll(arg0);
      }
  
      /**
       * @see java.util.Collection#clear()
       */
      public void clear()
      {
          getList().clear();
      }
  
      /**
       * @see java.util.List#get(int)
       */
      public Object get(int arg0)
      {
          return getList().get(arg0);
      }
  
      /**
       * @see java.util.List#set(int, java.lang.Object)
       */
      public Object set(int arg0, Object arg1)
      {
          return getList().set(arg0,arg1);
      }
  
      /**
       * @see java.util.List#add(int, java.lang.Object)
       */
      public void add(int arg0, Object arg1)
      {
          getList().add(arg0,arg1);
      }
  
      /**
       * @see java.util.List#remove(int)
       */
      public Object remove(int arg0)
      {
          return getList().remove(arg0);
      }
  
      /**
       * @see java.util.List#indexOf(java.lang.Object)
       */
      public int indexOf(Object arg0)
      {
          return getList().indexOf(arg0);
      }
  
      /**
       * @see java.util.List#lastIndexOf(java.lang.Object)
       */
      public int lastIndexOf(Object arg0)
      {
          return getList().lastIndexOf(arg0);
      }
  
      /**
       * @see java.util.List#listIterator()
       */
      public ListIterator listIterator()
      {
          return getList().listIterator();
      }
  
      /**
       * @see java.util.List#listIterator(int)
       */
      public ListIterator listIterator(int arg0)
      {
          return getList().listIterator(arg0);
      }
  
      /**
       * @see java.util.List#subList(int, int)
       */
      public List subList(int arg0, int arg1)
      {
          return getList().subList(arg0,arg1);
      }
  
  }
  
  
  
  1.23      +3 -3      
jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java
  
  Index: HTTPSampler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- HTTPSampler.java  18 Feb 2003 16:03:45 -0000      1.22
  +++ HTTPSampler.java  20 Feb 2003 02:59:16 -0000      1.23
  @@ -709,7 +709,7 @@
                   headerBuf.append(": ");
                   headerBuf.append(conn.getHeaderField(i));
                   headerBuf.append("\n");
  -            }
  +            }            
           }
           headerBuf.append("\n");
           return headerBuf.toString().getBytes("8859_1");
  
  
  

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

Reply via email to