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 2003/01/30 14:56:21 UTC

cvs commit: jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/proxy Daemon.java Proxy.java ProxyControl.java

mstover1    2003/01/30 05:56:21

  Modified:    src/protocol/http/org/apache/jmeter/protocol/http/proxy
                        Daemon.java Proxy.java ProxyControl.java
  Log:
  Minor changes that don't mean anything yet
  
  Revision  Changes    Path
  1.4       +9 -1      jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Daemon.java
  
  Index: Daemon.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Daemon.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Daemon.java	29 Aug 2002 18:17:42 -0000	1.3
  +++ Daemon.java	30 Jan 2003 13:56:21 -0000	1.4
  @@ -39,6 +39,7 @@
   	private boolean running;
   	ProxyControl target;
   	private Socket ClientSocket;
  +	static private Class proxyClass = Proxy.class;
   
   	public Daemon()
   	{
  @@ -49,6 +50,12 @@
   		this.target = target;
   		configureProxy(port);
   	}
  +	
  +	public Daemon(int port,ProxyControl target,Class proxyClass) throws UnknownHostException
  +	{
  +		this(port,target);
  +		Daemon.proxyClass = proxyClass;
  +	}
   
   	/************************************************************
   	 *  Description of the Method
  @@ -146,7 +153,8 @@
   				// Listen on main socket
   				Socket ClientSocket = MainSocket.accept();
   				// Pass request to new proxy thread
  -				Proxy thd = new Proxy(ClientSocket, cache, config,target,cookieManager);
  +				Proxy thd = (Proxy)proxyClass.newInstance();
  +				thd.configure(ClientSocket, cache, config,target,cookieManager);
   				thd.start();
   			}
   			log.info("Proxy Server stopped");
  
  
  
  1.4       +25 -12    jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
  
  Index: Proxy.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Proxy.java	29 Aug 2002 18:17:42 -0000	1.3
  +++ Proxy.java	30 Jan 2003 13:56:21 -0000	1.4
  @@ -108,21 +108,34 @@
   	// UrlConfig object for saving test cases
   	ProxyControl target;
   	CookieManager cookieManager;
  -	//
  -	// Public member methods
  -	//
  -	//
  -	// Constructor
  -	//
  -	Proxy(
  +	
  +	
  +	/**
  +	 * Constructor.  Configures Proxy at same time.
  +	 * @param clientSocket
  +	 * @param CacheManager
  +	 * @param configObject
  +	 * @param target
  +	 * @param cookieManager
  +	 */
  +	Proxy(Socket clientSocket,Cache CacheManager,Config configObject,
  +		ProxyControl target,CookieManager cookieManager) 
  +	{
  +		configure(clientSocket,CacheManager,configObject,target,cookieManager);
  +	}
  +	
  +	public Proxy()
  +	{
  +		
  +	}
  +	
  +	public void configure(
   		Socket clientSocket,
   		Cache CacheManager,
   		Config configObject,
   		ProxyControl target,
  -		CookieManager cookieManager) {
  -		//
  -		// Initialize member variables
  -		//
  +		CookieManager cookieManager)
  +	{
   		this.cookieManager = cookieManager;
   		this.target = target;
   		config = configObject;
  @@ -158,7 +171,7 @@
   			writeToClient(serverResponse,
   				new BufferedOutputStream(ClientSocket.getOutputStream()));
   			headers.removeHeaderNamed("cookie");
  -			target.deliverSampler(sampler,new TestElement[]{headers});
  +			target.deliverSampler(sampler,new TestElement[]{headers},serverResponse);
   		} catch (UnknownHostException uhe) {
   			log.warn("Server Not Found.",uhe);
   			try {
  
  
  
  1.9       +13 -8     jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
  
  Index: ProxyControl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ProxyControl.java	16 Jan 2003 00:13:21 -0000	1.8
  +++ ProxyControl.java	30 Jan 2003 13:56:21 -0000	1.9
  @@ -245,12 +245,17 @@
   	{
   		getIncludePatterns().clear();
   	}
  -	/************************************************************
  -	 *  !ToDo (Method description)
  -	 *
  -	 *@param  config  !ToDo (Parameter description)
  -	 ***********************************************************/
  -	public void deliverSampler(HTTPSampler sampler, TestElement[] subConfigs)
  +	
  +	/**
  +	 * Receives the recorded sampler from the proxy server for placing in the
  +	 * test tree
  +	 * @param sampler
  +	 * @param subConfigs
  +	 * @param serverResponse Added to allow saving of the server's response while
  +	 * recording.  A future consideration.
  +	 */
  +	public void deliverSampler(HTTPSampler sampler, TestElement[] subConfigs,
  +			byte[] serverResponse)
   	{
   		if (filterUrl(sampler))
   		{
  @@ -267,7 +272,7 @@
   			server.stopServer();
   		}
   	}
  -	private boolean filterUrl(HTTPSampler sampler)
  +	protected boolean filterUrl(HTTPSampler sampler)
   	{
   		boolean ok = false;
   		if (sampler.getDomain() == null || sampler.getDomain().equals(""))
  
  
  

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


Re: JMeterVariables

Posted by Mike Stover <ms...@apache.org>.
Well, I didn't think it could be so, and so I tried this myself, and it worked for me.  You may 
have to send me your test plan so I can look at exactly what you did.

regarding the javascript function, yes JMeter will see it.  I'm not sure what a javascript funciton 
would do though?  Sounds interesting though.

-Mike

On 30 Jan 2003 at 15:30, Thad Smith wrote:

> Question for the group...
> 
> Is there a quick and not so dirty way to modify the
> regexp function so that it inserts its variables in a
> way that any controller in the current thread of
> execution can see the variables? Currently if I call a
> regexp function inside of say, a simple controller
> A...Anywhere inside and underneath A I can see the
> variables just fine. The problem is that I can't see
> them after I leave A, even if the thread isn't
> finished with its test run. I can see the value in how
> it currently works, but very much need to change it to
> get my current tests working.
> 
> Also, has anyone ever written a javascript executing
> function? If not, if I write it myself and stick it in
> a jar in the lib/ext dir will JMeter automatically
> pick it up?
> 
> thanks and regards,
> 
> Thad Smith
> Software Engineer
> IBM Tivoli Software
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
> 



--
Michael Stover
mstover1@apache.org
Yahoo IM: mstover_ya
ICQ: 152975688
AIM: mstover777

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


JMeterVariables

Posted by Thad Smith <th...@yahoo.com>.
Question for the group...

Is there a quick and not so dirty way to modify the
regexp function so that it inserts its variables in a
way that any controller in the current thread of
execution can see the variables? Currently if I call a
regexp function inside of say, a simple controller
A...Anywhere inside and underneath A I can see the
variables just fine. The problem is that I can't see
them after I leave A, even if the thread isn't
finished with its test run. I can see the value in how
it currently works, but very much need to change it to
get my current tests working.

Also, has anyone ever written a javascript executing
function? If not, if I write it myself and stick it in
a jar in the lib/ext dir will JMeter automatically
pick it up?

thanks and regards,

Thad Smith
Software Engineer
IBM Tivoli Software


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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