You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by ge...@jpmorgan.com on 2005/11/18 16:57:36 UTC

Preprocessor implementation

Hi:
    I have implemented a Preprocessor to alter the value of some fields in 
my Sampler before it is executed. For example, I am sending xml over 
Tibco, and
I want to update one of the elements in my xml with dynamic content 
returned from the previous sample.

I am able to get the dynamic field from the previous sample, but when I 
try to update the example in the current sample I notice that the field is 
null. It seems that these fields are intialized when the test starts up, 
since they are static content. I noticed this process in the log file. Any 
idea about what I am doing wrong?


Here is the code in my Preprocessor implementation, the xmlData is null at 
line marked 1>

TibcoSampler currentSampler = (TibcoSampler) getThreadContext()
                                .getCurrentSampler();
 
1> LOG.debug("XML DATA = "+currentSampler.getXmlData());

 currentSampler.setXmlData(currentSampler.getXmlData().replaceAll(
                                "REPLACE", value));


Thanks in advance
-Jerry
This communication is for informational purposes only. It is not intended
as an offer or solicitation for the purchase or sale of any financial
instrument or as an official confirmation of any transaction. All market prices,
data and other information are not warranted as to completeness or accuracy and
are subject to change without notice. Any comments or statements made herein 
do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries 
and affiliates


Re: Preprocessor implementation

Posted by sebb <se...@gmail.com>.
On 18/11/05, gerald.d.wey@jpmorgan.com <ge...@jpmorgan.com> wrote:
> Hi:
>    I have implemented a Preprocessor to alter the value of some fields in
> my Sampler before it is executed. For example, I am sending xml over
> Tibco, and
> I want to update one of the elements in my xml with dynamic content
> returned from the previous sample.
>
> I am able to get the dynamic field from the previous sample, but when I
> try to update the example in the current sample I notice that the field is
> null. It seems that these fields are intialized when the test starts up,
> since they are static content. I noticed this process in the log file. Any
> idea about what I am doing wrong?
>
>
> Here is the code in my Preprocessor implementation, the xmlData is null at
> line marked 1>
>
> TibcoSampler currentSampler = (TibcoSampler) getThreadContext()
>                                .getCurrentSampler();
>
> 1> LOG.debug("XML DATA = "+currentSampler.getXmlData());
>
>  currentSampler.setXmlData(currentSampler.getXmlData().replaceAll(
>                                "REPLACE", value));


Perhaps the TibcoSampler does not call setXmlData() ?

In the current JMeter, this is only set by the WebServiceSampler in the Gui.

S.

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