I'm in the process of creating a new Listener/Visualizer that shows a
dashboard of everything you're running against with various running
totals, etc.. Num samples, Avg, Min, Max, StdDev, % Error Responses,
etc.. This morning, I noticed some issues with the ftp sampler.. 

If the client couldn't connect to the ftp server, the label of the
sample would never be set (ouch), the success flag would never be set
(another ouch).. Couple others, dropped off my mind.. 

Attached are two patches to the FTPSampler and FtpClient (naming
conventions, ahhhh :-)  ) ... Changes:

FTPSampler:

- To keep a standard labeling format (basing off the HTTP Sampler) - I
put "ftp://"; at the front of the label. 

- The label will now be set - even in exception conditions

- The SUCCESS flag will now be set correctly

- On exception conditions, the text response of the sample will now
contain the text of the exception (for example:
java.net.ConnectException - failed to connect to host blah.blah.com)


FtpConfig:

- Added a public getLabel() method which, well, returns a label to be
used elsewhere for the samples.. Maybe this should be called
"getSampleLabel"? .. I'm using that from FTPSampler, instead of
embedding the logic of creating a label format inside the Sampler code..



What I'd like to do (can I get an okay here) -- 

- Create an FTPSampleResult which extends SampleResult to include the
RESPONSE_CODE, (possibly) returned file size, etc.. (Similar to the HTTP
Result class).. FTP also uses response codes. 

- Move the PASV flag setting to the setup dialog instead of the current
hard-code-ed-ness

- Standardize naming convention -- FTP vs. Ftp contained throughout the
project

- Remove unneeded commands from the FTP Session (PWD, for example) - the
inclusion of this is just skewing results, yes? I'd think it would. 

- Redo the whole "throws exception" out of the FTP client.. Have it
throw appropriate exceptions based on error conditions, and then handle
them correctly.


J. <<ftpsampler-patch.txt>>  <<ftpconfig-patch.txt>> 




Index: sampler/FTPSampler.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-jmeter/src/org/apache/jmeter/protocol/ftp/sampler/FTPSampler.java,v

retrieving revision 1.8
diff -r1.8 FTPSampler.java
55c55
<  package org.apache.jmeter.protocol.ftp.sampler;
---
> package org.apache.jmeter.protocol.ftp.sampler;
75a76
> 
94a96
>         boolean isSuccessful = false;
96c98,99
<               LoginConfig loginConfig = 
(LoginConfig)e.getConfigElement(LoginConfig.class);
---
>         res.putValue(SampleResult.SAMPLE_LABEL,ftpConfig.getLabel());
>         LoginConfig loginConfig = 
>(LoginConfig)e.getConfigElement(LoginConfig.class);
100,101c103,106
<                       System.out.println("Connecting to "+ftpConfig.getServer()+" 
trying to get "+ftpConfig.getFilename());
<                       System.out.println("Username = "+loginConfig.getUsername());
---
>             // removed the next two lines - System.out.println is a resource DOG, 
>and putting this in the middle
>             // of a timed operation skews the results big time. -- jkb
> //                    System.out.println("Connecting to "+ftpConfig.getServer()+" 
>trying to get "+ftpConfig.getFilename());
> //                    System.out.println("Username = "+loginConfig.getUsername());
105c110
<                       ftp.setPassive(true);
---
>                       ftp.setPassive(true); // this should probably come from the 
>setup dialog
108c113
<                       
res.putValue(SampleResult.SAMPLE_LABEL,ftpConfig.getServer()+"/"+ftpConfig.getFilename());

---
>             // set the response code here somewhere
109a115
>             isSuccessful = true;
112c118
<               catch (Exception ex)
---
>               catch (java.net.ConnectException cex)
114c120,121
<                       //System.out.println(ex.toString());
---
>             // java.net.ConnectException -- 502 error code?
>             res.putValue(SampleResult.TEXT_RESPONSE, cex.toString());
116c123,128
<               // Calculate response time
---
>         catch (Exception ex) {
>             // general exception
>             res.putValue(SampleResult.TEXT_RESPONSE, ex.toString());
>         }
> 
>         // Calculate response time
117a130,133
>         res.setTime(end - start);
> 
>         // Set if we were successful or not
>         res.putValue(SampleResult.SUCCESS, new Boolean(isSuccessful));
119d134
<               res.setTime(end - start);
Index: config/FtpConfig.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-jmeter/src/org/apache/jmeter/protocol/ftp/config/FtpConfig.java,v

retrieving revision 1.8
diff -r1.8 FtpConfig.java
146a147,150
> 
>     public String getLabel() {
>         return ("ftp://"; + this.getServer() + "/" + this.getFilename());
>     }
--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to