You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by ms...@apache.org on 2001/10/05 21:57:12 UTC

cvs commit: jakarta-jmeter/src/org/apache/jmeter/protocol/http/sampler HTTPSampler.java HTTPSamplerFull.java

mstover1    01/10/05 12:57:12

  Modified:    src/org/apache/jmeter NewDriver.java
               src/org/apache/jmeter/gui MainFrame.java
               src/org/apache/jmeter/gui/action ExitCommand.java
               src/org/apache/jmeter/protocol/http/sampler HTTPSampler.java
                        HTTPSamplerFull.java
  Added:       src/org/apache/jmeter/gui/util ComponentUtil.java
  Log:
  Fixing minor GUI issues (bugs #: 2895,2896,2936
  
  Revision  Changes    Path
  1.8       +2 -1      jakarta-jmeter/src/org/apache/jmeter/NewDriver.java
  
  Index: NewDriver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/org/apache/jmeter/NewDriver.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- NewDriver.java	2001/08/30 17:19:01	1.7
  +++ NewDriver.java	2001/10/05 19:57:12	1.8
  @@ -60,6 +60,7 @@
   import org.apache.jmeter.gui.action.ActionRouter;
   import org.apache.jmeter.gui.tree.*;
   import org.apache.jmeter.util.JMeterUtils;
  +import org.apache.jmeter.gui.util.ComponentUtil;
   
   /************************************************************
    *  Title: JMeter Description: Copyright: Copyright (c) 2000 Company: Apache
  @@ -93,7 +94,7 @@
   		main.setTitle("Apache JMeter");
   		main.setIconImage(JMeterUtils.getImage("jmeter.jpg").getImage());
   		treeLis.setActionHandler(ActionRouter.getInstance());
  -		main.setSize(800, 600);
  +		ComponentUtil.centerComponentInWindow(main,80);
   		main.show();
   	}
   }
  
  
  
  1.10      +12 -6     jakarta-jmeter/src/org/apache/jmeter/gui/MainFrame.java
  
  Index: MainFrame.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/org/apache/jmeter/gui/MainFrame.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- MainFrame.java	2001/10/01 03:41:56	1.9
  +++ MainFrame.java	2001/10/05 19:57:12	1.10
  @@ -60,11 +60,12 @@
   import javax.swing.tree.*;
   
   import org.apache.jmeter.gui.tree.*;
  +import org.apache.jmeter.gui.action.ActionRouter;
   /************************************************************
    *  Title: JMeter Description: Copyright: Copyright (c) 2000 Company: Apache
    *
    *@author     Michael Stover
  - *@created    $Date: 2001/10/01 03:41:56 $
  + *@created    $Date: 2001/10/05 19:57:12 $
    *@version    1.0
    ***********************************************************/
   
  @@ -174,11 +175,7 @@
   		createTreePanel();
   		createMainPanel();
   		addThemAll();
  -					 addWindowListener(new WindowAdapter() {
  -						  public void windowClosing(WindowEvent evt) {
  -								System.exit(0);
  -						  }
  -					 });
  +		addWindowListener(new WindowHappenings());
   	}
   
   	private TreeCellRenderer getCellRenderer()
  @@ -263,5 +260,14 @@
   	{
   		running = newRunning;
   		this.menuBar.setEnabled(newRunning);
  +	}
  +
  +	private class WindowHappenings extends WindowAdapter
  +	{
  +		public void windowClosing(WindowEvent event)
  +		{
  +			ActionRouter.getInstance().actionPerformed(new ActionEvent(
  +			this,event.getID(),"exit"));
  +		}
   	}
   }
  
  
  
  1.5       +40 -27    jakarta-jmeter/src/org/apache/jmeter/gui/action/ExitCommand.java
  
  Index: ExitCommand.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/org/apache/jmeter/gui/action/ExitCommand.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ExitCommand.java	2001/07/26 00:34:45	1.4
  +++ ExitCommand.java	2001/10/05 19:57:12	1.5
  @@ -52,7 +52,7 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  - package org.apache.jmeter.gui.action;
  +package org.apache.jmeter.gui.action;
   
   import java.awt.event.ActionEvent;
   import java.util.*;
  @@ -62,35 +62,48 @@
   import org.apache.jmeter.gui.tree.*;
   
   /**
  - * Title:        JMeter
  - * Description:
  - * Copyright:    Copyright (c) 2000
  - * Company:      Apache
  - * @author Brendan Burns
  - * @version 1.0
  + *  Title: JMeter Description: Copyright: Copyright (c) 2000 Company: Apache
  + *
  + *@author     Brendan Burns
  + *@created    October 5, 2001
  + *@version    1.0
    */
   
   public class ExitCommand implements Command
   {
   
  -	 private static Set commands = new HashSet();
  -	 static
  -	 {
  -	commands.add("exit");
  -	 }
  -
  -	 public ExitCommand()
  -	 {
  -	 }
  -
  -	 public void doAction(ActionEvent e)
  -	 {
  -	System.err.println("Note to self, we should really prompt to save here... (bb)");
  -	System.exit(0);
  -	 }
  -
  -	 public Set getActionNames()
  -	 {
  -	return commands;
  -	 }
  +	private static Set commands = new HashSet();
  +
  +	/**
  +	 *  Constructor for the ExitCommand object
  +	 */
  +	public ExitCommand()
  +	{
  +	}
  +
  +	/**
  +	 *  Gets the ActionNames attribute of the ExitCommand object
  +	 *
  +	 *@return    The ActionNames value
  +	 */
  +	public Set getActionNames()
  +	{
  +		return commands;
  +	}
  +
  +	/**
  +	 *  Description of the Method
  +	 *
  +	 *@param  e  Description of Parameter
  +	 */
  +	public void doAction(ActionEvent e)
  +	{
  +		System.err.println("Note to self, we should really prompt to save here... (bb)");
  +		System.exit(0);
  +	}
  +
  +	static
  +	{
  +		commands.add("exit");
  +	}
   }
  
  
  
  1.1                  jakarta-jmeter/src/org/apache/jmeter/gui/util/ComponentUtil.java
  
  Index: ComponentUtil.java
  ===================================================================
  package org.apache.jmeter.gui.util;
  
  /**
   * Title:        Apache JMeter
   * Description:
   * Copyright:    Copyright (c) 2000
   * Company:      Apache Foundation
   * @author bo.regnlin@pc.nu (Bo Regnlin)
   * @version 1.0
   */
  
  import java.awt.Dimension;
  import java.awt.Component;
  
  /**
   * This class is a Util for awt Component and could be
   * used to place them in center of an other.
   *
   *
   * @author  <a href="mailto:bo.regnlin@pc.nu">Bo Regnlin</a>
  * @version 1.0
   */
  public class ComponentUtil
  {
    /**
  		 * Use this static method if you want to center
  	  * and set its proposion compared to the size of
  	  * the current users screen size.
  	  * Valid percent is between +-(0-100) minus is treated
  	  * as plus, bigger than 100 is always set to 100.
  		 *
  		 *@param  component The component you want to center and set
  size on.
  		 *@param  percentOfScreen The percent of the current screensize
  you want
  	  *        the component to be.
  		 */
    public static void centerComponentInWindow(Component component, int
  percentOfScreen)
    {
  	 if(percentOfScreen < 0)
  	 {
  		centerComponentInWindow(component, - percentOfScreen);
  		return;
  	 }
  	 if(percentOfScreen > 100)
  	 {
  		centerComponentInWindow(component, 100);
  		return;
  	 }
  	 double percent = percentOfScreen / 100.d;
  	 Dimension dimension = component.getToolkit().getScreenSize();
  	 component.setSize((int)(dimension.getWidth()*percent),
  							 (int)(dimension.getHeight()*percent));
  	 centerComponentInWindow(component);
    }
  
    /**
  		 * Use this static method if you want to center a component in
  Window.
  		 *
  		 *@param  component The component you want to center in window.
  		 */
    public static void centerComponentInWindow(Component component)
    {
  	 Dimension dimension = component.getToolkit().getScreenSize();
  
  	 component.setLocation((int)((dimension.getWidth()-component.getWidth())/2),
  								  (int)((dimension.getHeight()-component.getHeight
  ())/2));
  	 component.validate();
  	 component.repaint();
    }
  
    /**
  		 * Use this static method if you want to center
  	  * a component over an other component.
  		 *
  		 *@param  parent The component you want to use to place it on.
  		 *@param  toBeCentered The component you want to center.
  		 */
    public static void centerComponentInComponent(Component parent, Component
  toBeCentered)
    {
  	 toBeCentered.setLocation((int)parent.getX() + (int)((parent.getWidth()-
  toBeCentered.getWidth())/2),
  									 (int)parent.getY() + (int)((parent.getHeight()-
  toBeCentered.getHeight())/2));
  
  	 toBeCentered.validate();
  	 toBeCentered.repaint();
    }
  
  }
  
  
  
  1.28      +24 -23    jakarta-jmeter/src/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java
  
  Index: HTTPSampler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- HTTPSampler.java	2001/09/13 14:41:16	1.27
  +++ HTTPSampler.java	2001/10/05 19:57:12	1.28
  @@ -75,8 +75,8 @@
    *  HTTP requests, including cookies and authentication.
    *
    *@author     Michael Stover
  - *@created    $Date: 2001/09/13 14:41:16 $
  - *@version    $Revision: 1.27 $
  + *@created    $Date: 2001/10/05 19:57:12 $
  + *@version    $Revision: 1.28 $
    */
   public class HTTPSampler implements Sampler
   {
  @@ -128,9 +128,9 @@
   
   	protected static String encoding = "iso-8859-1";
   
  -	protected static final String NON_HTTP_RESPONSE_CODE = 
  +	protected static final String NON_HTTP_RESPONSE_CODE =
   		"Non HTTP response code";
  -	protected static final String NON_HTTP_RESPONSE_MESSAGE = 
  +	protected static final String NON_HTTP_RESPONSE_MESSAGE =
   		"Non HTTP response message";
   
   	private static Category catClass = Category.getInstance(
  @@ -184,7 +184,7 @@
   	 * @param  u	<code>URL</code> of the URL request
   	 * @param  url	<code>UrlConfig</code> of the URL request
   	 * @param  e	<code>Entry</code> from which all other info can
  -       *			be derived from e.g. cookies, header, authorization
  +		 *			be derived from e.g. cookies, header, authorization
   	 * @return		<code>HttpURLConnection</code> of the URL request
   	 * @exception  IOException  if an I/O Exception occurs
   	 */
  @@ -214,14 +214,14 @@
   	}
   
   	/**
  -	 * This method will setup <code>HttpURLConnection</code> to handle post using 
  +	 * This method will setup <code>HttpURLConnection</code> to handle post using
   	 * <code>sendPostData</code> method if the URL request is actually a html form
   	 * that needs to be posted
   	 *
   	 * @param  redirected       does <code>HttpURLConnection</code> allow redirection
   	 * @param  url              contains query string for POST
   	 * @param  conn             <HttpURLConnection> of the URL request
  -	 * @exception  IOException  if 
  +	 * @exception  IOException  if
   	 */
   	protected void writeToStream(boolean redirected, UrlConfig url, HttpURLConnection conn) throws IOException
   	{
  @@ -244,10 +244,10 @@
   	 * Extracts all the required cookies for that particular URL request and set them
   	 * in the <code>HttpURLConnection</code> passed in
   	 *
  -	 * @param conn		<code>HttpUrlConnection</code> which represents the 
  +	 * @param conn		<code>HttpUrlConnection</code> which represents the
   	 *				URL request
   	 * @param u			<code>URL</code> of the URL request
  -	 * @param cookieManager	the <code>CookieManager</code> containing all the 
  +	 * @param cookieManager	the <code>CookieManager</code> containing all the
   	 *				cookies for this <code>UrlConfig</code>
   	 */
   	private void setConnectionCookie(HttpURLConnection conn, URL u, CookieManager cookieManager)
  @@ -266,10 +266,10 @@
   	 * Extracts all the required headers for that particular URL request and set them
   	 * in the <code>HttpURLConnection</code> passed in
   	 *
  -	 * @param conn		<code>HttpUrlConnection</code> which represents the 
  +	 * @param conn		<code>HttpUrlConnection</code> which represents the
   	 *				URL request
   	 * @param u			<code>URL</code> of the URL request
  -	 * @param headerManager	the <code>HeaderManager</code> containing all the 
  +	 * @param headerManager	the <code>HeaderManager</code> containing all the
   	 *				cookies for this <code>UrlConfig</code>
   	 */
   	private void setConnectionHeaders(HttpURLConnection conn, URL u, HeaderManager headerManager)
  @@ -290,13 +290,13 @@
   	}
   
   	/**
  -	 * Extracts all the required authorization for that particular URL request and set 
  +	 * Extracts all the required authorization for that particular URL request and set
   	 * them in the <code>HttpURLConnection</code> passed in
   	 *
  -	 * @param conn		<code>HttpUrlConnection</code> which represents the 
  +	 * @param conn		<code>HttpUrlConnection</code> which represents the
   	 *				URL request
   	 * @param u			<code>URL</code> of the URL request
  -	 * @param authManager	the <code>AuthManager</code> containing all the 
  +	 * @param authManager	the <code>AuthManager</code> containing all the
   	 *				cookies for this <code>UrlConfig</code>
   	 */
   	private void setConnectionAuthorization(HttpURLConnection conn, URL u, AuthManager authManager)
  @@ -330,7 +330,7 @@
   			responseCode = ((HttpURLConnection) conn).getResponseCode();
   			errorLevel = responseCode / 100;
   			message = ((HttpURLConnection) conn).getResponseMessage();
  -			res.putValue(this.RESPONSE_CODE, 
  +			res.putValue(this.RESPONSE_CODE,
   				String.valueOf(responseCode));
   			res.putValue(this.RESPONSE_MESSAGE,
   				message);
  @@ -338,9 +338,9 @@
   		catch (Exception e2)
   		{
   			res.putValue(SampleResult.TEXT_RESPONSE, e2.toString());
  -			res.putValue(this.RESPONSE_CODE, 
  +			res.putValue(this.RESPONSE_CODE,
   				NON_HTTP_RESPONSE_CODE);
  -			res.putValue(this.RESPONSE_MESSAGE, 
  +			res.putValue(this.RESPONSE_MESSAGE,
   			NON_HTTP_RESPONSE_MESSAGE);
   			res.setTime(System.currentTimeMillis() - time);
   			res.putValue(SampleResult.SUCCESS, new Boolean(false));
  @@ -356,7 +356,7 @@
   	 * that the "Location" value needs to be followed to get the resultant page.
   	 *
   	 * @param conn		connection
  -	 * @param u		
  +	 * @param u
   	 * @exception MalformedURLException	if URL is not understood
   	 */
   	private void redirectUrl(HttpURLConnection conn, URL u, UrlConfig urlConfig) throws MalformedURLException
  @@ -382,10 +382,11 @@
   		URL newUrl = new URL(loc);
   		urlConfig.putProperty(UrlConfig.DOMAIN, newUrl.getHost());
   		urlConfig.putProperty(UrlConfig.PATH, newUrl.getFile());
  +		urlConfig.putProperty(UrlConfig.ARGUMENTS,new Arguments());
   	}
   
   	/**
  -	 * Samples <code>Entry</code> passed in and stores the result in 
  +	 * Samples <code>Entry</code> passed in and stores the result in
   	 * <code>SampleResult</code>
   	 *
   	 * @param e		<code>Entry</code> to be sampled
  @@ -448,9 +449,9 @@
   		{
   			ex.printStackTrace();
   			res.setTime((long) 0);
  -			res.putValue(this.RESPONSE_CODE, 
  +			res.putValue(this.RESPONSE_CODE,
   				NON_HTTP_RESPONSE_CODE);
  -			res.putValue(this.RESPONSE_MESSAGE, 
  +			res.putValue(this.RESPONSE_MESSAGE,
   				NON_HTTP_RESPONSE_MESSAGE);
   			res.putValue(SampleResult.TEXT_RESPONSE, ex.toString());
   			res.putValue(SampleResult.SUCCESS, new Boolean(false));
  @@ -463,10 +464,10 @@
   	 * From the <code>HttpURLConnection</code>, store all the "set-cookie" key-pair
   	 * values in the cookieManager of the <code>UrlConfig</code>
   	 *
  -	 * @param conn		<code>HttpUrlConnection</code> which represents the 
  +	 * @param conn		<code>HttpUrlConnection</code> which represents the
   	 *			URL request
   	 * @param u		<code>URL</code> of the URL request
  -	 * @param cookieManager	the <code>CookieManager</code> containing all the 
  +	 * @param cookieManager	the <code>CookieManager</code> containing all the
   	 *			cookies for this <code>UrlConfig</code>
   	 */
   	private void saveConnectionCookies(HttpURLConnection conn, URL u, CookieManager cookieManager)
  
  
  
  1.9       +499 -499  jakarta-jmeter/src/org/apache/jmeter/protocol/http/sampler/HTTPSamplerFull.java
  
  Index: HTTPSamplerFull.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/org/apache/jmeter/protocol/http/sampler/HTTPSamplerFull.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- HTTPSamplerFull.java	2001/09/13 14:42:10	1.8
  +++ HTTPSamplerFull.java	2001/10/05 19:57:12	1.9
  @@ -79,11 +79,11 @@
   import org.apache.jmeter.protocol.http.config.UrlConfigFull;
   /**
    * A sampler that downloads all downloadable components e.g. images,
  - * applets etc.  
  + * applets etc.
    *
    * @author	Khor Soon Hin
    * @version	1.0
  - * @created	$Date: 2001/09/13 14:42:10 $
  + * @created	$Date: 2001/10/05 19:57:12 $
    */
   public class HTTPSamplerFull extends HTTPSampler
   {
  @@ -91,8 +91,8 @@
     public final static String IMAGE = "httpSamplerFull.IMAGE";
     public final static String TOTAL_TIME = "httpSamplerFull.TOTAL_TIME";
   
  -  protected static Category catClass = 
  -    Category.getInstance(HTTPSamplerFull.class.getName());
  +  protected static Category catClass =
  +	 Category.getInstance(HTTPSamplerFull.class.getName());
   
     protected static String utfEncodingName;
   
  @@ -102,545 +102,545 @@
   
     public HTTPSamplerFull()
     {
  -    super();
  -    catClass.debug("Start : HTTPSamplerFull1");
  -    catClass.debug("End : HTTPSamplerFull1");
  +	 super();
  +	 catClass.debug("Start : HTTPSamplerFull1");
  +	 catClass.debug("End : HTTPSamplerFull1");
     }
   
     /**
  -   *  Gets the UrlConfig attribute of the HTTPSampler object
  -   *
  -   * @param  e  Description of Parameter
  -   * @return    The UrlConfig value
  -   */
  +	*  Gets the UrlConfig attribute of the HTTPSampler object
  +	*
  +	* @param  e  Description of Parameter
  +	* @return    The UrlConfig value
  +	*/
     /*public UrlConfig getUrlConfig(Entry e)
     {
  -    UrlConfig urlConfig = (UrlConfig) 
  -      e.getConfigElement(UrlConfigFull.class);
  -    if(catClass.isDebugEnabled())
  -    {
  -      catClass.debug("getUrlConfig1 : Returning urlConfig - " + urlConfig.toString());
  -    }
  -    return urlConfig;
  +	 UrlConfig urlConfig = (UrlConfig)
  +		e.getConfigElement(UrlConfigFull.class);
  +	 if(catClass.isDebugEnabled())
  +	 {
  +		catClass.debug("getUrlConfig1 : Returning urlConfig - " + urlConfig.toString());
  +	 }
  +	 return urlConfig;
     }*/
   
     /**
  -   * Samples the <code>Entry</code> passed in and stores the result in 
  -   * <code>SampleResult</code>
  -   *
  -   * @param entry	an entry to be sampled
  -   * @param redirected  whether redirection is turned on
  -   * @return	resuls of the sampling
  -   */
  +	* Samples the <code>Entry</code> passed in and stores the result in
  +	* <code>SampleResult</code>
  +	*
  +	* @param entry	an entry to be sampled
  +	* @param redirected  whether redirection is turned on
  +	* @return	resuls of the sampling
  +	*/
     public SampleResult sample(Entry e)
     {
  -    catClass.debug("Start : sample2");
  -    long totalTime = (long)0;
  -    SampleResult res = super.sample(e);
  -    String displayName = (String)res.getValue(SampleResult.SAMPLE_LABEL);
  -    res.putValue(SampleResult.DISPLAY_NAME, displayName);
  -    List loadBinaryList = new ArrayList();
  -    if(catClass.isDebugEnabled())
  -    {
  -      catClass.debug("sample2 : main page loading time - " + res.getTime());
  -    }
  -    totalTime += res.getTime();
  -    Document html = null;
  -    try
  -    {
  -      baseUrl = new URL((String)res.getValue(SampleResult.SAMPLE_LABEL));
  -      if(catClass.isDebugEnabled())
  -      {
  -        catClass.debug("sample2 : baseUrl - " + baseUrl.toString());
  -      }
  -      // now use parser to look for image tags
  -      html = (Document)getDOM((String)res.getValue(SampleResult.TEXT_RESPONSE));
  -    }
  -    catch(SAXException exception)
  -    {
  -      catClass.error("sample2 : Error parsing document - " + exception);
  -      catClass.error("sample2 : Setting SampleResult SUCCESS value to false");
  -      res.putValue(SampleResult.TEXT_RESPONSE, exception.toString());
  -      res.putValue(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
  -      res.putValue(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
  -      res.putValue(SampleResult.SUCCESS, new Boolean(false));
  -    }
  -    catch(MalformedURLException exception)
  -    {
  -      catClass.error("sample2 : Error creating URL - " + exception);
  -      catClass.error("sample2 : Setting SampleResult SUCCESS value to false");
  -      res.putValue(SampleResult.TEXT_RESPONSE, exception.toString());
  -      res.putValue(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
  -      res.putValue(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
  -      res.putValue(SampleResult.SUCCESS, new Boolean(false));
  -    }
  -    // sample result to store image from <img...> tags
  -    SampleResult imgRes = null;
  -    NodeList nodeList = html.getElementsByTagName("img");
  -    for(int i = 0; i < nodeList.getLength(); i++)
  -    {
  -      imgRes = new SampleResult();
  -      try
  -      {
  -        Node tempNode = nodeList.item(i);
  -        if(catClass.isDebugEnabled())
  -        {
  -          catClass.debug("sample2 : Image tags - " + tempNode);
  -        }
  -        // get the url of those images
  -        NamedNodeMap nnm = tempNode.getAttributes();
  -        Node namedItem = nnm.getNamedItem("src");
  -        String imgUrlStr = namedItem.getNodeValue();
  -        // set the baseUrl and imgUrl so that if error occurs
  -        // due to MalformedException then at least the values will be
  -        // visible to the user to aid correction
  -        imgRes.putValue(SampleResult.DISPLAY_NAME, baseUrl + "," + imgUrlStr);
  -        // download those images
  -        URL imgUrl = new URL(baseUrl, imgUrlStr);
  -        if(catClass.isDebugEnabled())
  -        {
  -          catClass.debug("sample2 : Image url without baseUrl - " + imgUrlStr);
  -          catClass.debug("sample2 : Image url with baseUrl - " + imgUrl);
  -        }
  -        imgRes.putValue(SampleResult.DISPLAY_NAME, imgUrl.toString());
  -        loadBinary(imgUrl, e, imgRes);
  -        ImageIcon image = new ImageIcon(imgUrl, imgUrl.toString());
  -        imgRes.putValue(IMAGE, image);
  -        totalTime += imgRes.getTime();
  -        imgRes.remove(SampleResult.TEXT_RESPONSE);
  -      }
  -      catch(IOException exception)
  -      {
  -        catClass.error("sample2 : Error reading from URL - " + exception);
  -        catClass.error("sample2 : Setting SampleResult SUCCESS value to false");
  -        imgRes.putValue(SampleResult.TEXT_RESPONSE, exception.toString());
  -        imgRes.putValue(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
  -        imgRes.putValue(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
  -        imgRes.putValue(SampleResult.SUCCESS, new Boolean(false));
  -      }
  -      loadBinaryList.add(imgRes);
  -    }
  -    SampleResult appRes = null;
  -    // use parser to look for applet tags
  -    nodeList = html.getElementsByTagName("applet");
  -    for(int i = 0; i < nodeList.getLength(); i++)
  -    {
  -      appRes = new SampleResult();
  -      try
  -      {
  -        Node tempNode = nodeList.item(i);
  -        if(catClass.isDebugEnabled())
  -        {
  -          catClass.debug("sample2 : Applet tags - " + tempNode);
  -        }
  -        // get the url of those applets
  -        NamedNodeMap nnm = tempNode.getAttributes();
  -        Node namedItem = nnm.getNamedItem("code");
  -        String appletUrlStr = namedItem.getNodeValue() + ".class";
  -        // set the baseUrl and imgUrl so that if error occurs
  -        // due to MalformedException then at least the values will be
  -        // visible to the user to aid correction
  -        appRes.putValue(SampleResult.DISPLAY_NAME, baseUrl + "," + appletUrlStr);
  -        // download those applet
  -        URL appletUrl = new URL(baseUrl, appletUrlStr);
  -        if(catClass.isDebugEnabled())
  -        {
  -          catClass.debug("sample2 : Applet url without baseUrl - " + appletUrlStr);
  -          catClass.debug("sample2 : Applet url with baseUrl - " + appletUrl);
  -        }
  -        appRes.putValue(SampleResult.DISPLAY_NAME, appletUrl.toString());
  -        appRes.putValue(SampleResult.TEXT_RESPONSE, loadBinary(appletUrl, e, appRes));
  -        totalTime += appRes.getTime();
  -      }
  -      catch(IOException exception)
  -      {
  -        catClass.error("sample2 : Error reading from URL - " + exception);
  -        catClass.error("sample2 : Setting SampleResult SUCCESS value to false");
  -        appRes.putValue(SampleResult.TEXT_RESPONSE, exception.toString());
  -        appRes.putValue(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
  -        appRes.putValue(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
  -        appRes.putValue(SampleResult.SUCCESS, new Boolean(false));
  -      }
  -      loadBinaryList.add(appRes);
  -    }
  -    // use parser to look for input tags with image types as well
  -    nodeList = html.getElementsByTagName("input");
  -    for(int i = 0; i < nodeList.getLength(); i++)
  -    {
  -      try
  -      {
  -        Node tempNode = nodeList.item(i);
  -        if(catClass.isDebugEnabled())
  -        {
  -          catClass.debug("sample2 : Input tags - " + tempNode);
  -        }
  -        // get the url of those images
  -        NamedNodeMap nnm = tempNode.getAttributes();
  -        Node namedItem = nnm.getNamedItem("type");
  -        String inputType = namedItem.getNodeValue();
  -        if(catClass.isDebugEnabled())
  -        {
  -          catClass.debug("sample2 : Input type - " + inputType);
  -        }
  -        if(inputType != null && inputType.equalsIgnoreCase("image"))
  -        {
  -          imgRes = new SampleResult();
  -          namedItem = nnm.getNamedItem("src");
  -          String imgUrlStr = namedItem.getNodeValue();
  -          // set the baseUrl and imgUrl so that if error occurs
  -          // due to MalformedException then at least the values will be
  -          // visible to the user to aid correction
  -          imgRes.putValue(SampleResult.DISPLAY_NAME, baseUrl + "," + imgUrlStr);
  -          // download those images
  -          URL imgUrl = new URL(baseUrl, imgUrlStr);
  -          if(catClass.isDebugEnabled())
  -          {
  -            catClass.debug("sample2 : Image url without baseUrl - " + imgUrlStr);
  -            catClass.debug("sample2 : Image url with baseUrl - " + imgUrl);
  -          }
  -          loadBinary(imgUrl, e, imgRes);
  -          ImageIcon image = new ImageIcon(imgUrl, imgUrl.toString());
  -          imgRes.putValue(IMAGE, image);
  -          imgRes.putValue(SampleResult.DISPLAY_NAME, imgUrl.toString());
  -          totalTime += imgRes.getTime();
  -          imgRes.remove(SampleResult.TEXT_RESPONSE);
  -        }
  -      }
  -      catch(IOException exception)
  -      {
  -        catClass.error("sample2 : Error reading from URL - " + exception);
  -        catClass.error("sample2 : Setting SampleResult SUCCESS value to false");
  -        imgRes.putValue(SampleResult.TEXT_RESPONSE, exception.toString());
  -        imgRes.putValue(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
  -        imgRes.putValue(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
  -        imgRes.putValue(SampleResult.SUCCESS, new Boolean(false));
  -      }
  -      loadBinaryList.add(imgRes);
  -    }
  -    res.putValue(RESULT_LIST, loadBinaryList);
  -    if(catClass.isDebugEnabled())
  -    {
  -      catClass.debug("sample2 : total time - " + totalTime);
  -    }
  -    res.putValue(TOTAL_TIME, new Long(totalTime));
  -    catClass.debug("End : sample2");
  -    return res;
  +	 catClass.debug("Start : sample2");
  +	 long totalTime = (long)0;
  +	 SampleResult res = super.sample(e);
  +	 String displayName = (String)res.getValue(SampleResult.SAMPLE_LABEL);
  +	 res.putValue(SampleResult.DISPLAY_NAME, displayName);
  +	 List loadBinaryList = new ArrayList();
  +	 if(catClass.isDebugEnabled())
  +	 {
  +		catClass.debug("sample2 : main page loading time - " + res.getTime());
  +	 }
  +	 totalTime += res.getTime();
  +	 Document html = null;
  +	 try
  +	 {
  +		baseUrl = new URL((String)res.getValue(SampleResult.SAMPLE_LABEL));
  +		if(catClass.isDebugEnabled())
  +		{
  +		  catClass.debug("sample2 : baseUrl - " + baseUrl.toString());
  +		}
  +		// now use parser to look for image tags
  +		html = (Document)getDOM((String)res.getValue(SampleResult.TEXT_RESPONSE));
  +	 }
  +	 catch(SAXException exception)
  +	 {
  +		catClass.error("sample2 : Error parsing document - " + exception);
  +		catClass.error("sample2 : Setting SampleResult SUCCESS value to false");
  +		res.putValue(SampleResult.TEXT_RESPONSE, exception.toString());
  +		res.putValue(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
  +		res.putValue(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
  +		res.putValue(SampleResult.SUCCESS, new Boolean(false));
  +	 }
  +	 catch(MalformedURLException exception)
  +	 {
  +		catClass.error("sample2 : Error creating URL - " + exception);
  +		catClass.error("sample2 : Setting SampleResult SUCCESS value to false");
  +		res.putValue(SampleResult.TEXT_RESPONSE, exception.toString());
  +		res.putValue(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
  +		res.putValue(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
  +		res.putValue(SampleResult.SUCCESS, new Boolean(false));
  +	 }
  +	 // sample result to store image from <img...> tags
  +	 SampleResult imgRes = null;
  +	 NodeList nodeList = html.getElementsByTagName("img");
  +	 for(int i = 0; i < nodeList.getLength(); i++)
  +	 {
  +		imgRes = new SampleResult();
  +		try
  +		{
  +		  Node tempNode = nodeList.item(i);
  +		  if(catClass.isDebugEnabled())
  +		  {
  +			 catClass.debug("sample2 : Image tags - " + tempNode);
  +		  }
  +		  // get the url of those images
  +		  NamedNodeMap nnm = tempNode.getAttributes();
  +		  Node namedItem = nnm.getNamedItem("src");
  +		  String imgUrlStr = namedItem.getNodeValue();
  +		  // set the baseUrl and imgUrl so that if error occurs
  +		  // due to MalformedException then at least the values will be
  +		  // visible to the user to aid correction
  +		  imgRes.putValue(SampleResult.DISPLAY_NAME, baseUrl + "," + imgUrlStr);
  +		  // download those images
  +		  URL imgUrl = new URL(baseUrl, imgUrlStr);
  +		  if(catClass.isDebugEnabled())
  +		  {
  +			 catClass.debug("sample2 : Image url without baseUrl - " + imgUrlStr);
  +			 catClass.debug("sample2 : Image url with baseUrl - " + imgUrl);
  +		  }
  +		  imgRes.putValue(SampleResult.DISPLAY_NAME, imgUrl.toString());
  +		  loadBinary(imgUrl, e, imgRes);
  +		  ImageIcon image = new ImageIcon(imgUrl, imgUrl.toString());
  +		  imgRes.putValue(IMAGE, image);
  +		  totalTime += imgRes.getTime();
  +		  imgRes.remove(SampleResult.TEXT_RESPONSE);
  +		}
  +		catch(IOException exception)
  +		{
  +		  catClass.error("sample2 : Error reading from URL - " + exception);
  +		  catClass.error("sample2 : Setting SampleResult SUCCESS value to false");
  +		  imgRes.putValue(SampleResult.TEXT_RESPONSE, exception.toString());
  +		  imgRes.putValue(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
  +		  imgRes.putValue(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
  +		  imgRes.putValue(SampleResult.SUCCESS, new Boolean(false));
  +		}
  +		loadBinaryList.add(imgRes);
  +	 }
  +	 SampleResult appRes = null;
  +	 // use parser to look for applet tags
  +	 nodeList = html.getElementsByTagName("applet");
  +	 for(int i = 0; i < nodeList.getLength(); i++)
  +	 {
  +		appRes = new SampleResult();
  +		try
  +		{
  +		  Node tempNode = nodeList.item(i);
  +		  if(catClass.isDebugEnabled())
  +		  {
  +			 catClass.debug("sample2 : Applet tags - " + tempNode);
  +		  }
  +		  // get the url of those applets
  +		  NamedNodeMap nnm = tempNode.getAttributes();
  +		  Node namedItem = nnm.getNamedItem("code");
  +		  String appletUrlStr = namedItem.getNodeValue() + ".class";
  +		  // set the baseUrl and imgUrl so that if error occurs
  +		  // due to MalformedException then at least the values will be
  +		  // visible to the user to aid correction
  +		  appRes.putValue(SampleResult.DISPLAY_NAME, baseUrl + "," + appletUrlStr);
  +		  // download those applet
  +		  URL appletUrl = new URL(baseUrl, appletUrlStr);
  +		  if(catClass.isDebugEnabled())
  +		  {
  +			 catClass.debug("sample2 : Applet url without baseUrl - " + appletUrlStr);
  +			 catClass.debug("sample2 : Applet url with baseUrl - " + appletUrl);
  +		  }
  +		  appRes.putValue(SampleResult.DISPLAY_NAME, appletUrl.toString());
  +		  appRes.putValue(SampleResult.TEXT_RESPONSE, loadBinary(appletUrl, e, appRes));
  +		  totalTime += appRes.getTime();
  +		}
  +		catch(IOException exception)
  +		{
  +		  catClass.error("sample2 : Error reading from URL - " + exception);
  +		  catClass.error("sample2 : Setting SampleResult SUCCESS value to false");
  +		  appRes.putValue(SampleResult.TEXT_RESPONSE, exception.toString());
  +		  appRes.putValue(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
  +		  appRes.putValue(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
  +		  appRes.putValue(SampleResult.SUCCESS, new Boolean(false));
  +		}
  +		loadBinaryList.add(appRes);
  +	 }
  +	 // use parser to look for input tags with image types as well
  +	 nodeList = html.getElementsByTagName("input");
  +	 for(int i = 0; i < nodeList.getLength(); i++)
  +	 {
  +		try
  +		{
  +		  Node tempNode = nodeList.item(i);
  +		  if(catClass.isDebugEnabled())
  +		  {
  +			 catClass.debug("sample2 : Input tags - " + tempNode);
  +		  }
  +		  // get the url of those images
  +		  NamedNodeMap nnm = tempNode.getAttributes();
  +		  Node namedItem = nnm.getNamedItem("type");
  +		  String inputType = namedItem.getNodeValue();
  +		  if(catClass.isDebugEnabled())
  +		  {
  +			 catClass.debug("sample2 : Input type - " + inputType);
  +		  }
  +		  if(inputType != null && inputType.equalsIgnoreCase("image"))
  +		  {
  +			 imgRes = new SampleResult();
  +			 namedItem = nnm.getNamedItem("src");
  +			 String imgUrlStr = namedItem.getNodeValue();
  +			 // set the baseUrl and imgUrl so that if error occurs
  +			 // due to MalformedException then at least the values will be
  +			 // visible to the user to aid correction
  +			 imgRes.putValue(SampleResult.DISPLAY_NAME, baseUrl + "," + imgUrlStr);
  +			 // download those images
  +			 URL imgUrl = new URL(baseUrl, imgUrlStr);
  +			 if(catClass.isDebugEnabled())
  +			 {
  +				catClass.debug("sample2 : Image url without baseUrl - " + imgUrlStr);
  +				catClass.debug("sample2 : Image url with baseUrl - " + imgUrl);
  +			 }
  +			 loadBinary(imgUrl, e, imgRes);
  +			 ImageIcon image = new ImageIcon(imgUrl, imgUrl.toString());
  +			 imgRes.putValue(IMAGE, image);
  +			 imgRes.putValue(SampleResult.DISPLAY_NAME, imgUrl.toString());
  +			 totalTime += imgRes.getTime();
  +			 imgRes.remove(SampleResult.TEXT_RESPONSE);
  +		  }
  +		}
  +		catch(IOException exception)
  +		{
  +		  catClass.error("sample2 : Error reading from URL - " + exception);
  +		  catClass.error("sample2 : Setting SampleResult SUCCESS value to false");
  +		  imgRes.putValue(SampleResult.TEXT_RESPONSE, exception.toString());
  +		  imgRes.putValue(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
  +		  imgRes.putValue(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
  +		  imgRes.putValue(SampleResult.SUCCESS, new Boolean(false));
  +		}
  +		loadBinaryList.add(imgRes);
  +	 }
  +	 res.putValue(RESULT_LIST, loadBinaryList);
  +	 if(catClass.isDebugEnabled())
  +	 {
  +		catClass.debug("sample2 : total time - " + totalTime);
  +	 }
  +	 res.putValue(TOTAL_TIME, new Long(totalTime));
  +	 catClass.debug("End : sample2");
  +	 return res;
     }
   
     /**
  -   * Download the binaries from given <code>URL</code>
  -   *
  -   * @param url		<code>URL</code> from where binary is to be downloaded
  -   * @param e     	<code>Entry</code> being sampled
  -   * @param res		<code>SampleResult</code> to store sampling results
  -   * @return	binary downloaded
  -   */
  -  protected String loadBinary(URL url, Entry e, SampleResult res) 
  -    throws IOException
  +	* Download the binaries from given <code>URL</code>
  +	*
  +	* @param url		<code>URL</code> from where binary is to be downloaded
  +	* @param e     	<code>Entry</code> being sampled
  +	* @param res		<code>SampleResult</code> to store sampling results
  +	* @return	binary downloaded
  +	*/
  +  protected String loadBinary(URL url, Entry e, SampleResult res)
  +	 throws IOException
     {
  -    catClass.debug("Start : loadBinary1");
  -    String ret = null;
  -    // Create a dummy UrlConfig and set only the method.  Set the method to
  -    // GET.  Pass this UrlConfig to setupConnection() 'cos it uses UrlConfig
  -    // to determine the HTTP method to get the url.  In this case, we are
  -    // loading binaries so the method has to be GET.
  -    UrlConfig urlConfig = new UrlConfig();
  -    urlConfig.setMethod(UrlConfig.GET);
  -    HttpURLConnection conn = null;
  -    try
  -    {
  -     conn = setupConnection(url, urlConfig, e);
  -     conn.connect();
  -    }
  -    catch(IOException exception)
  -    {
  -      // don't do anything 'cos persumably the connection will return the
  -      // correct http response codes
  -      if(catClass.isDebugEnabled())
  -      {
  -        catClass.debug("loadBinary1 : error in setupConnection " + exception);
  -      }
  -    }
  -    long time = System.currentTimeMillis();
  -    if(catClass.isDebugEnabled())
  -    {
  -      catClass.debug("loadBinary1 : start sampling time - " + time);
  -    }
  -    int errorLevel = getErrorLevel(conn, res);
  -    if (errorLevel == 2)
  -    {
  -      ret = readResponse(conn);
  -      res.putValue(SampleResult.SUCCESS, new Boolean(true));
  -      long endTime = System.currentTimeMillis();
  -      if(catClass.isDebugEnabled())
  -      {
  -        catClass.debug("loadBinary1 : end sampling time - " + endTime);
  -      }
  -      res.setTime(endTime - time);
  -    }
  -    else
  -    {
  -      res.putValue(SampleResult.SUCCESS, new Boolean(false));
  -      int responseCode = ((HttpURLConnection)conn).getResponseCode();
  -      String responseMessage = ((HttpURLConnection)conn).getResponseMessage();
  -      catClass.error("loadBinary1 : failed response code - " +
  -        responseCode);
  -      catClass.error("loadBinary1 : failed response message - " + 
  -        responseMessage);
  -    }
  -    if(catClass.isDebugEnabled())
  -    {
  -      catClass.debug("loadBinary1 : binary - " + ret.substring(0,5));
  -      catClass.debug("loadBinary1 : loadTime - " + res.getTime());
  -    }
  -    catClass.debug("End : loadBinary1");
  -    return ret;
  +	 catClass.debug("Start : loadBinary1");
  +	 String ret = null;
  +	 // Create a dummy UrlConfig and set only the method.  Set the method to
  +	 // GET.  Pass this UrlConfig to setupConnection() 'cos it uses UrlConfig
  +	 // to determine the HTTP method to get the url.  In this case, we are
  +	 // loading binaries so the method has to be GET.
  +	 UrlConfig urlConfig = new UrlConfig();
  +	 urlConfig.setMethod(UrlConfig.GET);
  +	 HttpURLConnection conn = null;
  +	 try
  +	 {
  +	  conn = setupConnection(url, urlConfig, e);
  +	  conn.connect();
  +	 }
  +	 catch(IOException exception)
  +	 {
  +		// don't do anything 'cos persumably the connection will return the
  +		// correct http response codes
  +		if(catClass.isDebugEnabled())
  +		{
  +		  catClass.debug("loadBinary1 : error in setupConnection " + exception);
  +		}
  +	 }
  +	 long time = System.currentTimeMillis();
  +	 if(catClass.isDebugEnabled())
  +	 {
  +		catClass.debug("loadBinary1 : start sampling time - " + time);
  +	 }
  +	 int errorLevel = getErrorLevel(conn, res);
  +	 if (errorLevel == 2)
  +	 {
  +		ret = readResponse(conn);
  +		res.putValue(SampleResult.SUCCESS, new Boolean(true));
  +		long endTime = System.currentTimeMillis();
  +		if(catClass.isDebugEnabled())
  +		{
  +		  catClass.debug("loadBinary1 : end sampling time - " + endTime);
  +		}
  +		res.setTime(endTime - time);
  +	 }
  +	 else
  +	 {
  +		res.putValue(SampleResult.SUCCESS, new Boolean(false));
  +		int responseCode = ((HttpURLConnection)conn).getResponseCode();
  +		String responseMessage = ((HttpURLConnection)conn).getResponseMessage();
  +		catClass.error("loadBinary1 : failed response code - " +
  +		  responseCode);
  +		catClass.error("loadBinary1 : failed response message - " +
  +		  responseMessage);
  +	 }
  +	 if(catClass.isDebugEnabled())
  +	 {
  +		catClass.debug("loadBinary1 : binary - " + ret.substring(0,5));
  +		catClass.debug("loadBinary1 : loadTime - " + res.getTime());
  +	 }
  +	 catClass.debug("End : loadBinary1");
  +	 return ret;
     }
   
     /**
  -   * Get the response code of the URL connection and divide it by 100 thus
  -   * returning 2(for 2xx response codes), 3(for 3xx reponse codes), etc
  -   *
  -   * @param conn          <code>HttpURLConnection</code> of URL request
  -   * @param res           where all results of sampling will be stored
  -   * @return              HTTP response code divided by 100
  -   */
  -  protected int getErrorLevel(HttpURLConnection conn, SampleResult res)        
  +	* Get the response code of the URL connection and divide it by 100 thus
  +	* returning 2(for 2xx response codes), 3(for 3xx reponse codes), etc
  +	*
  +	* @param conn          <code>HttpURLConnection</code> of URL request
  +	* @param res           where all results of sampling will be stored
  +	* @return              HTTP response code divided by 100
  +	*/
  +  protected int getErrorLevel(HttpURLConnection conn, SampleResult res)
     {
  -    catClass.debug("Start : getErrorLevel1");
  -    int errorLevel = 2;
  -    try
  -    {
  -      int responseCode = ((HttpURLConnection) conn).getResponseCode();
  -      String responseMessage = ((HttpURLConnection) conn).getResponseMessage();
  -      errorLevel = responseCode/100;
  -      res.putValue(RESPONSE_CODE, String.valueOf(responseCode));
  -      res.putValue(RESPONSE_MESSAGE, responseMessage);
  -      if(catClass.isDebugEnabled())
  -      {
  -        catClass.debug("getErrorLevel1 : responseCode - " + responseCode);
  -        catClass.debug("getErrorLevel1 : responseMessage - " + 
  -          responseMessage);
  -      }
  -    }
  -    catch (Exception e2)
  -    {
  +	 catClass.debug("Start : getErrorLevel1");
  +	 int errorLevel = 2;
  +	 try
  +	 {
  +		int responseCode = ((HttpURLConnection) conn).getResponseCode();
  +		String responseMessage = ((HttpURLConnection) conn).getResponseMessage();
  +		errorLevel = responseCode/100;
  +		res.putValue(RESPONSE_CODE, String.valueOf(responseCode));
  +		res.putValue(RESPONSE_MESSAGE, responseMessage);
  +		if(catClass.isDebugEnabled())
  +		{
  +		  catClass.debug("getErrorLevel1 : responseCode - " + responseCode);
  +		  catClass.debug("getErrorLevel1 : responseMessage - " +
  +			 responseMessage);
  +		}
  +	 }
  +	 catch (Exception e2)
  +	 {
   System.out.println("getErrorLevel1 : " + conn.getHeaderField(0));
   System.out.println("getErrorLevel1 : " + conn.getHeaderFieldKey(0));
  -      catClass.error("getErrorLevel1 : " + 
  -        "Error getting response code for HttpUrlConnection - " + e2);
  -      catClass.error("getErrorLevel1 : " + 
  -        "Setting SampleResult SUCCESS value to false");
  -      res.putValue(SampleResult.TEXT_RESPONSE, e2.toString());
  -      res.putValue(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
  -      res.putValue(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
  -      res.putValue(SampleResult.SUCCESS, new Boolean(false));
  -    }
  -    catClass.debug("End : getErrorLevel1");
  -    return errorLevel;
  +		catClass.error("getErrorLevel1 : " +
  +		  "Error getting response code for HttpUrlConnection - " + e2);
  +		catClass.error("getErrorLevel1 : " +
  +		  "Setting SampleResult SUCCESS value to false");
  +		res.putValue(SampleResult.TEXT_RESPONSE, e2.toString());
  +		res.putValue(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
  +		res.putValue(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
  +		res.putValue(SampleResult.SUCCESS, new Boolean(false));
  +	 }
  +	 catClass.debug("End : getErrorLevel1");
  +	 return errorLevel;
     }
   
     /**
  -   * Returns <code>tidy</code> as HTML parser
  -   *
  -   * @return	a <code>tidy</code> HTML parser
  -   */
  +	* Returns <code>tidy</code> as HTML parser
  +	*
  +	* @return	a <code>tidy</code> HTML parser
  +	*/
     protected static Tidy getParser()
     {
  -    catClass.debug("Start : getParser1");
  -    Tidy tidy = new Tidy();
  -    tidy.setCharEncoding(org.w3c.tidy.Configuration.UTF8);
  -    tidy.setQuiet(true);
  -    if(catClass.isDebugEnabled())
  -    {
  -      catClass.debug("getParser1 : tidy parser created - " + tidy);
  -    }
  -    catClass.debug("End : getParser1");
  -    return tidy;
  +	 catClass.debug("Start : getParser1");
  +	 Tidy tidy = new Tidy();
  +	 tidy.setCharEncoding(org.w3c.tidy.Configuration.UTF8);
  +	 tidy.setQuiet(true);
  +	 if(catClass.isDebugEnabled())
  +	 {
  +		catClass.debug("getParser1 : tidy parser created - " + tidy);
  +	 }
  +	 catClass.debug("End : getParser1");
  +	 return tidy;
     }
   
     /**
  -   * Returns a node representing a whole xml given an xml document
  -   *
  -   * @param text	an xml document
  -   * @return	a node representing a whole xml
  -   */
  +	* Returns a node representing a whole xml given an xml document
  +	*
  +	* @param text	an xml document
  +	* @return	a node representing a whole xml
  +	*/
     protected static Node getDOM(String text) throws SAXException
     {
  -    catClass.debug("Start : getDOM1");
  -    try
  -    {
  -      Node node = getParser().parseDOM(new 
  -        ByteArrayInputStream(text.getBytes(getUTFEncodingName())), null);
  -      if(catClass.isDebugEnabled())
  -      {
  -        catClass.debug("node : " + node);
  -      }
  -      catClass.debug("End : getDOM1");
  -      return node;
  -    }
  -    catch(UnsupportedEncodingException e)
  -    {
  -      catClass.error("getDOM1 : Unsupported encoding exception - " + e);
  -      catClass.debug("End : getDOM1");
  -      throw new RuntimeException("UTF-8 encoding failed");
  -    }
  +	 catClass.debug("Start : getDOM1");
  +	 try
  +	 {
  +		Node node = getParser().parseDOM(new
  +		  ByteArrayInputStream(text.getBytes(getUTFEncodingName())), null);
  +		if(catClass.isDebugEnabled())
  +		{
  +		  catClass.debug("node : " + node);
  +		}
  +		catClass.debug("End : getDOM1");
  +		return node;
  +	 }
  +	 catch(UnsupportedEncodingException e)
  +	 {
  +		catClass.error("getDOM1 : Unsupported encoding exception - " + e);
  +		catClass.debug("End : getDOM1");
  +		throw new RuntimeException("UTF-8 encoding failed");
  +	 }
     }
   
     /**
  -   * Returns the encoding type which is different for different jdks
  -   * even though the mean the same thing i.e. UTF8 or UTF-8
  -   *
  -   * @return	either UTF8 or UTF-8 depending on the jdk version
  -   */
  +	* Returns the encoding type which is different for different jdks
  +	* even though the mean the same thing i.e. UTF8 or UTF-8
  +	*
  +	* @return	either UTF8 or UTF-8 depending on the jdk version
  +	*/
     protected static String getUTFEncodingName()
     {
  -    catClass.debug("Start : getUTFEncodingName1");
  -    if (utfEncodingName == null)
  -    {
  -      String versionNum = System.getProperty( "java.version" );
  -      if(catClass.isDebugEnabled())
  -      {
  -        catClass.debug("getUTFEncodingName1 : versionNum - " + versionNum);
  -      }
  -      if (versionNum.startsWith( "1.1" ))
  -      {
  -         utfEncodingName = "UTF8";
  -      }
  -      else 
  -      {
  -        utfEncodingName = "UTF-8";
  -      }
  -    }
  -    if(catClass.isDebugEnabled())
  -    {
  -      catClass.debug("getUTFEncodingName1 : Returning utfEncodingName - " + 
  -        utfEncodingName);
  -    }
  -    catClass.debug("End : getUTFEncodingName1");
  -    return utfEncodingName;
  +	 catClass.debug("Start : getUTFEncodingName1");
  +	 if (utfEncodingName == null)
  +	 {
  +		String versionNum = System.getProperty( "java.version" );
  +		if(catClass.isDebugEnabled())
  +		{
  +		  catClass.debug("getUTFEncodingName1 : versionNum - " + versionNum);
  +		}
  +		if (versionNum.startsWith( "1.1" ))
  +		{
  +			utfEncodingName = "UTF8";
  +		}
  +		else
  +		{
  +		  utfEncodingName = "UTF-8";
  +		}
  +	 }
  +	 if(catClass.isDebugEnabled())
  +	 {
  +		catClass.debug("getUTFEncodingName1 : Returning utfEncodingName - " +
  +		  utfEncodingName);
  +	 }
  +	 catClass.debug("End : getUTFEncodingName1");
  +	 return utfEncodingName;
     }
   
     public static class Test extends TestCase
     {
  -    private HTTPSamplerFull hsf;
  -    private Entry entry;
  +	 private HTTPSamplerFull hsf;
  +	 private Entry entry;
   
  -    private static Category catClass = 
  -      Category.getInstance(Test.class.getName());
  - 
  -    public Test(String name)
  -    {
  -      super(name);
  -    }
  -
  -    protected void setUp()
  -    {
  -      catClass.debug("Start : setUp1");
  -      hsf = new HTTPSamplerFull();
  -      entry = new Entry();
  -      UrlConfigFull urlConfigFull = new UrlConfigFull();
  -      urlConfigFull.setMethod(UrlConfig.GET);
  -      urlConfigFull.setProtocol("file");
  +	 private static Category catClass =
  +		Category.getInstance(Test.class.getName());
  +
  +	 public Test(String name)
  +	 {
  +		super(name);
  +	 }
  +
  +	 protected void setUp()
  +	 {
  +		catClass.debug("Start : setUp1");
  +		hsf = new HTTPSamplerFull();
  +		entry = new Entry();
  +		UrlConfigFull urlConfigFull = new UrlConfigFull();
  +		urlConfigFull.setMethod(UrlConfig.GET);
  +		urlConfigFull.setProtocol("file");
   //      urlConfigFull.setPort(8080);
   //      urlConfigFull.setDomain("jakarta.apache.org");
  -      urlConfigFull.setPath("HTTPSamplerFullTestFile.txt");
  -      entry.setSamplerClass(HTTPSamplerFull.class);
  -      entry.addConfigElement(urlConfigFull);
  -      catClass.debug("End : setUp1");
  -    }
  -
  -    public void testGetUTFEncodingName()
  -    {
  -      catClass.debug("Start : testGetUTFEncodingName1");
  -      String javaVersion = System.getProperty("java.version");
  -      System.setProperty("java.version", "1.1");
  -      assertEquals("UTF8", HTTPSamplerFull.getUTFEncodingName());
  -      // need to clear utfEncodingName variable first 'cos
  -      // getUTFEncodingName checks to see if it's null
  -      utfEncodingName = null;
  -      System.setProperty("java.version", "1.2");
  -      assertEquals("UTF-8", HTTPSamplerFull.getUTFEncodingName());
  -      System.setProperty("java.version", javaVersion);
  -      catClass.debug("End : testGetUTFEncodingName1");
  -    }
  -
  -    public void testGetUrlConfig()
  -    {
  -      catClass.debug("Start : testGetUrlConfig1");
  -      UrlConfig urlConfig = hsf.getUrlConfig(entry);
  -      assertEquals(UrlConfig.GET, urlConfig.getMethod());
  -      assertEquals("file", urlConfig.getProtocol());
  +		urlConfigFull.setPath("HTTPSamplerFullTestFile.txt");
  +		entry.setSamplerClass(HTTPSamplerFull.class);
  +		entry.addConfigElement(urlConfigFull,UrlConfig.class);
  +		catClass.debug("End : setUp1");
  +	 }
  +
  +	 public void testGetUTFEncodingName()
  +	 {
  +		catClass.debug("Start : testGetUTFEncodingName1");
  +		String javaVersion = System.getProperty("java.version");
  +		System.setProperty("java.version", "1.1");
  +		assertEquals("UTF8", HTTPSamplerFull.getUTFEncodingName());
  +		// need to clear utfEncodingName variable first 'cos
  +		// getUTFEncodingName checks to see if it's null
  +		utfEncodingName = null;
  +		System.setProperty("java.version", "1.2");
  +		assertEquals("UTF-8", HTTPSamplerFull.getUTFEncodingName());
  +		System.setProperty("java.version", javaVersion);
  +		catClass.debug("End : testGetUTFEncodingName1");
  +	 }
  +
  +	 public void testGetUrlConfig()
  +	 {
  +		catClass.debug("Start : testGetUrlConfig1");
  +		UrlConfig urlConfig = hsf.getUrlConfig(entry);
  +		assertEquals(UrlConfig.GET, urlConfig.getMethod());
  +		assertEquals("file", urlConfig.getProtocol());
   //      assertEquals(8080, urlConfig.getPort());
   //      assertEquals("jakarta.apache.org", urlConfig.getDomain());
  -      assertEquals("HTTPSamplerFullTestFile.txt", urlConfig.getPath());
  -      catClass.debug("End : testGetUrlConfig1");
  -    }
  -    // Can't think of a self-contained way to test this 'cos it requires
  -    // http server.  Tried to use file:// but HTTPSampler's sample 
  -    // specifically requires http.
  -    public void testSampleMain()
  -    {
  -      catClass.debug("Start : testSampleMain1");
  -      // !ToDo : Have to wait till the day SampleResult is extended to 
  -      // store results of all downloaded stuff e.g. images, applets etc
  -      String fileInput = "<html>\n\n" +
  -        "<title>\n" +
  -        "  A simple applet\n" +
  -        "</title>\n" +
  -        "<body background=\"back.jpg\" vlink=\"#dd0000\" link=\"#0000ff\">\n" +
  -        "<center>\n" +
  -        "<h2>   A simple applet\n" +
  -        "</h2>\n" +
  -        "<br>\n" +
  -        "<br>\n" +
  -        "<table>\n" +
  -        "<td width = 20>\n" +
  -        "<td width = 500 align = left>\n" +
  -        "<img src=\"/tomcat.gif\">\n" +
  -        "<a href=\"Time.java\"> Read my code <a>\n" +
  -        "<p><applet code=Time width = 400 height = 200>\n" +
  -        "</applet>\n" +
  -        "</table>\n" +
  -        "<form>\n" +
  -        "  <input type=\"image\" src=\"/tomcat-power.gif\">\n" +
  -        "</form>\n" +
  -        "</body>\n" +
  -        "</html>\n";
  -      byte[] bytes = fileInput.getBytes();
  -      try
  -      {
  -        FileOutputStream fos = 
  -          new FileOutputStream("HTTPSamplerFullTestFile.txt");
  -        fos.write(bytes);
  -        fos.close();
  -      }
  -      catch(IOException e)
  -      {
  -        fail("Cannot create HTTPSamplerFullTestFile.txt in current directory " +
  -          "for testing - " + e);
  -      }
  -      // !ToDo
  -      // hsf.sample(entry);
  -      assertNull("Cannot think of way to test sample", null);
  -      catClass.debug("End : testSampleMain1");
  -    }
  -
  -    protected void tearDown()
  -    {
  -      catClass.debug("Start : tearDown1");
  -      hsf = null;
  -      entry = null;
  -      catClass.debug("End : tearDown1");
  -    }
  -
  -    public static void main(String[] args)
  -    {
  -      BasicConfigurator.configure();
  -      TestSuite suite = new TestSuite(Test.class);
  -      junit.textui.TestRunner runner = new junit.textui.TestRunner();
  -      runner.run(suite);
  -    }
  +		assertEquals("HTTPSamplerFullTestFile.txt", urlConfig.getPath());
  +		catClass.debug("End : testGetUrlConfig1");
  +	 }
  +	 // Can't think of a self-contained way to test this 'cos it requires
  +	 // http server.  Tried to use file:// but HTTPSampler's sample
  +	 // specifically requires http.
  +	 public void testSampleMain()
  +	 {
  +		catClass.debug("Start : testSampleMain1");
  +		// !ToDo : Have to wait till the day SampleResult is extended to
  +		// store results of all downloaded stuff e.g. images, applets etc
  +		String fileInput = "<html>\n\n" +
  +		  "<title>\n" +
  +		  "  A simple applet\n" +
  +		  "</title>\n" +
  +		  "<body background=\"back.jpg\" vlink=\"#dd0000\" link=\"#0000ff\">\n" +
  +		  "<center>\n" +
  +		  "<h2>   A simple applet\n" +
  +		  "</h2>\n" +
  +		  "<br>\n" +
  +		  "<br>\n" +
  +		  "<table>\n" +
  +		  "<td width = 20>\n" +
  +		  "<td width = 500 align = left>\n" +
  +		  "<img src=\"/tomcat.gif\">\n" +
  +		  "<a href=\"Time.java\"> Read my code <a>\n" +
  +		  "<p><applet code=Time width = 400 height = 200>\n" +
  +		  "</applet>\n" +
  +		  "</table>\n" +
  +		  "<form>\n" +
  +		  "  <input type=\"image\" src=\"/tomcat-power.gif\">\n" +
  +		  "</form>\n" +
  +		  "</body>\n" +
  +		  "</html>\n";
  +		byte[] bytes = fileInput.getBytes();
  +		try
  +		{
  +		  FileOutputStream fos =
  +			 new FileOutputStream("HTTPSamplerFullTestFile.txt");
  +		  fos.write(bytes);
  +		  fos.close();
  +		}
  +		catch(IOException e)
  +		{
  +		  fail("Cannot create HTTPSamplerFullTestFile.txt in current directory " +
  +			 "for testing - " + e);
  +		}
  +		// !ToDo
  +		// hsf.sample(entry);
  +		assertNull("Cannot think of way to test sample", null);
  +		catClass.debug("End : testSampleMain1");
  +	 }
  +
  +	 protected void tearDown()
  +	 {
  +		catClass.debug("Start : tearDown1");
  +		hsf = null;
  +		entry = null;
  +		catClass.debug("End : tearDown1");
  +	 }
  +
  +	 public static void main(String[] args)
  +	 {
  +		BasicConfigurator.configure();
  +		TestSuite suite = new TestSuite(Test.class);
  +		junit.textui.TestRunner runner = new junit.textui.TestRunner();
  +		runner.run(suite);
  +	 }
     }
   }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org