I can answer my own (stupid) question:
JavaSamplerClient is not the TestElement needed, JavaSampler is.
I can make the problem disappear by changing JavaSampler.sample(Entry entry)
to:
public SampleResult sample(Entry entry) {
SampleResult sr =
createJavaClient().runTest(createArgumentsHashMap(getArguments()));
sr.setSamplerData(this);
return sr;
}
(although as the toString() is not implemented, it looks a little daft).
However, I don't think this is quite right, as we don't really care if it's
JavaSampler, it's JavaSamplerClient's identity we really want to know, so I
have modified AssertionVisualizer instead:
public void add(SampleResult sample)
{
if(null != sample.getSamplerData())
textArea.append(sample.getSamplerData().toString());
else
textArea.append(sample.getSampleLabel())
textArea.append(getAssertionResult(sample));
textArea.append("\n");
}
This will give a sensible result without labelling every line the same in
the case of samplers like JavaSampler which are carriers for other samplers.
There is also a bug in the build.bat script to call Ant: line 13 should be
for %%i in (".\lib\ext\*.jar") do CALL lcp %%i
and not
for %%i in (".\ext\*.jar") do CALL lcp %%i
I attach diffs.
Alistair
-----Original Message-----
From: Alistair Hopkins [mailto:[EMAIL PROTECTED]
Sent: 06 March 2003 11:18
To: [EMAIL PROTECTED]
Subject: Null pointer in JavaSamplerClient whenn using
AssertionVisualizer
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]