You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Rick <ri...@gmail.com> on 2009/09/18 20:18:41 UTC

New to jmeter.. simple question "Way to easily read property in AbstractJavaSamplerClient implementation?"

I'm writing several AbstractJavaSamplerClient implementations to do some
remote EJB testing. I'd like to pass in a property on jmeter start up like:

./jmeter -Jprovider_url=d3npp.foobar.com:1099

Is there an easy way to access this property from my Sampler implementation?
I thought I'd be able to get a handle to it with

public SampleResult runTest(JavaSamplerContext context) {
  String provider_url = context.getParameter("provider_url", "");

But the above doesn't work (always null.)

Any help appreciated.

-- 
Rick R

Re: New to jmeter.. simple question "Way to easily read property in AbstractJavaSamplerClient implementation?"

Posted by sebb <se...@gmail.com>.
On 18/09/2009, Rick <ri...@gmail.com> wrote:
> I'm writing several AbstractJavaSamplerClient implementations to do some
>  remote EJB testing. I'd like to pass in a property on jmeter start up like:
>
>  ./jmeter -Jprovider_url=d3npp.foobar.com:1099

This defines a JMeter property.

>  Is there an easy way to access this property from my Sampler implementation?
>  I thought I'd be able to get a handle to it with
>
>  public SampleResult runTest(JavaSamplerContext context) {
>   String provider_url = context.getParameter("provider_url", "");

Here is the Javadoc:
"JavaSamplerContext is used to provide context information to a
JavaSamplerClient implementation. This currently consists of the
initialization parameters which were specified in the GUI. Additional
data may be accessible through JavaSamplerContext in the future."

i.e. not the same as a JMeter property.

>  But the above doesn't work (always null.)

>  Any help appreciated.

JMeterUtils.getPropDefault()

>
>  --
>  Rick R
>

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