That's interesting.  The Java Sampler is not a particularly mature implementation. 
What it should do for you is create the SampleResult object for you and set the 
SamplerData (which is the JavaSampler class you are "plugging into").

However, you would likely be better off implementing your component as a full 
Sampler in it's own right.  You would extend AbstractSampler rather than 
AbstractJavaClient (or whatever it is).  Not significantly harder to do, but it would 
require throwing together a little GUI class (extending AbstractSamplerGui), putting 
in some text fields or whatever so you could configure it.  

For now, I'd recommend creating a dummy Sampler class to put in the 
SampleResult (it could just be new HTTPSampler() - whatever, I don't think you 
care too much what it is for now).

-Mike

On 6 Mar 2003 at 11:18, Alistair Hopkins wrote:

> Hi,
> 
> I'm using Jmeter 1.8.1 and jdk 1.4 to do some interface testing on a legacy
> application which uses nasty text over tcp sockets for interprocess comms.
> 
> I've implemented a SocketSampler which extends JavaSamplerClient and will
> write a command (as specified in the UI) to the socket, then return the
> response line as the SamplerResult response data:
> 
>       long start = System.currentTimeMillis();
>       byte[] response = makeRequest(request);  //does the nasty socket thing
>       long finish = System.currentTimeMillis();
>       SampleResult result = new SampleResult();
>       result.setDataType(SampleResult.TEXT);
>       result.setResponseData(response);
>       result.setTime(finish - start);
> 
> The only problem is that when I try to use the AssertionVisualizer I get a
> null pointer exception at AssertionVisualilzer:116 and the test run never
> exits.  I know that the SleepTest sample has the same problem.
> 
> AssertionVisualizer:116
>       textArea.append(sample.getSamplerData().toString());
> 
> So, I try to add result.setSamplerData(this); to my class - but then none of
> the visualizers work!  SamplerData is a TestElement - what TestElement is
> expected?  It seems to be only for adding a label to the panel anyway.
> 
> Can anyone tell me what I have to do to get the AssertionVisualizer working?
> (without hacking the JMeter source - I want to give this test set to 3rd
> parties and I want to keep on the development track!)
> 
> Thanks
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 



--
Michael Stover
[EMAIL PROTECTED]
Yahoo IM: mstover_ya
ICQ: 152975688
AIM: mstover777

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

Reply via email to