On 19 March 2012 16:13, Pulkit Singhal <[email protected]> wrote:
> Yup, I understand the difference between Variables and Properties, let me
> ask again so as to focus my question and get the crux of it across:
>
> I need a little more clarification as for the following 3 statements:
> props.put("upcArray1", upcArray.toString());
That is effectively HashTable#put(Object, Object).
> props.put("upcArray2", upcArray);
> props.putObject("upcArray3", upcArray);
There is no such method for Properties.
Sorry, I realise I confused properties and variables in my first reply.
> Debug Sampler yields:
>
> JMeterProperties:
>
> upcArray1="024543069706","025101200326","815849010697","083616276748","602498458433","037429040331","617917817128","021823511290","015095538741","075678164743"
>
> upcArray2=org.mozilla.javascript.NativeArray@246af18d
>
> So upcArray1 and upcArray2 don't really get the same value to be stored in
> properties ... and using putObject for upcArray3 does not store anything in
> the JMeterProperties :(
>
> So how can I do that?
>
> On Mon, Mar 19, 2012 at 11:10 AM, sebb <[email protected]> wrote:
>
>> On 19 March 2012 15:38, Pulkit Singhal <[email protected]> wrote:
>> > Thanks for the explanation sebb!
>> >
>> > But I think I need a little more clarification as for the following 3
>> > statements:
>> > vars.put("upcArray", upcArray);
>>
>> vars is of class JMeterVariables.
>>
>> > props.put("upcArray1", upcArray.toString());
>>
>> props is of class java.util.Properties
>>
>> > props.put("upcArray2", upcArray);
>> > props.putObject("upcArray3", upcArray);
>> >
>> > Debug Sampler yields:
>> >
>> > JMeterVariables:
>> >
>> upcArray="024543069706","025101200326","815849010697","083616276748","602498458433","037429040331","617917817128","021823511290","015095538741","075678164743"
>> >
>> > JMeterProperties:
>> >
>> upcArray1="024543069706","025101200326","815849010697","083616276748","602498458433","037429040331","617917817128","021823511290","015095538741","075678164743"
>> > upcArray2=org.mozilla.javascript.NativeArray@246af18d
>> >
>> > So upcArray1 and upcArray2 don't really get the same value to be stored
>> in
>> > properties ... and using putObject does not store anything in the
>> > JMeterProperties :(
>> >
>> > On Mon, Mar 19, 2012 at 10:23 AM, sebb <[email protected]> wrote:
>> >
>> >> On 19 March 2012 14:58, Pulkit Singhal <[email protected]> wrote:
>> >> > Using:
>> >> > props.put("nameArray", nameArray.toString());
>> >> > did the trick instead of:
>> >> > *${__setProperty("nameArray", nameArray)};*
>> >>
>> >> That is resolved by JMeter before the script is passed to the BSF
>> sampler.
>> >>
>> >> >
>> >> > Using:
>> >> > props.put("nameArray", nameArray);
>> >> > also looks promising but it puts an object instead of a comma
>> separated
>> >> > string into properties and I'm not quite sure if that object is
>> actually
>> >> > usable later on, will post back later with that.
>> >>
>> >> It should work the same as
>> >>
>> >> props.put("nameArray", nameArray.toString)
>> >>
>> >> because the JMeterVariables method signature is:
>> >>
>> >> public void put(String key,
>> >> String value)
>> >>
>> >> Use putObject to store an Object.
>> >>
>> >> See:
>> >>
>> >>
>> http://jmeter.apache.org/api/org/apache/jmeter/threads/JMeterVariables.html
>> >>
>> >> > On Mon, Mar 19, 2012 at 8:57 AM, Pulkit Singhal <
>> [email protected]
>> >> >wrote:
>> >> >
>> >> >> I'm using the BSF PostProcessor to put together an array of names.
>> >> >>
>> >> >> I can store it in JMeter variables as a comma,separated list just
>> fine -
>> >> >> *vars.put("nameArray", nameArray); // works :)
>> >> >>
>> >> >> *Results in Debug Sampler show -
>> >> >> *JMeterVariables:
>> >> >> nameArray="Let It Go (Japan)","Deskkontrolados","Caillou: Dr.
>> Caillou -
>> >> >> VHS","Where Did You Sleep Last Night: Lead... [LP]","20 More
>> Explosive
>> >> >> Fantastic Rockin' Mega...","The Secret NASA Transmissions: The Raw
>> >> Footage
>> >> >> - DVD","L'Etang De Kukufah","Arias (CD+DVD) (Limited Edition) (Deluxe
>> >> >> Edition) (Spkg)","Don't You Want to Rock","Talk On Corners: Special
>> >> Edition"
>> >> >> *
>> >> >>
>> >> >> But for some reason (in the next line) the same value is not being
>> >> >> accepted into the JMeter properties -
>> >> >> *${__setProperty("nameArray", nameArray)}; // does not work :(
>> >> >> *
>> >> >> Results in Debug Sampler show -
>> >> >> *JMeterProperties:
>> >> >> "nameArray"= nameArray*
>> >> >>
>> >> >> Can anyone tell me what I may be doing wrong here?
>> >> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: [email protected]
>> >> For additional commands, e-mail: [email protected]
>> >>
>> >>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]