Re: unable to share variables

2012-03-21 Thread Jake_Devore
I got it working to an acceptable level.  I had some issues in the script 
that was causing problems, but all is well now.  Thank you for the help.

Jake Devore
SCE WWS OTG Operations Engineering
(253) 981-4252



sebb  
03/20/2012 06:51 PM
Please respond to
"JMeter Users List" 


To
JMeter Users List 
cc

Subject
Re: unable to share variables






On 21 March 2012 01:44,   wrote:
> Can I write out to that csv file?  Basically I need to write out the 
paths
> that are generated to a file so I can read them in later.

How are the paths generated?
If they are stored in a JMeter variable, you could even potentially
use the Simple Data Writer with a configuration that saves nothing
apart from the variable(s):

http://jmeter.apache.org/usermanual/listeners.html#sample_variables

Use a setUp Thread Group to create the file.

> Thanks,
>
> Jake Devore
> SCE WWS OTG Operations Engineering
> (253) 981-4252
>
>
>
> sebb 
> 03/20/2012 05:56 PM
> Please respond to
> "JMeter Users List" 
>
>
> To
> JMeter Users List 
> cc
>
> Subject
> Re: unable to share variables
>
>
>
>
>
>
> On 20 March 2012 20:08,   wrote:
>>>This suggests that you are trying to share variables across threads -
>>>is that the case?
>>
>> For testing I only have one thread to cut down time, but I was trying 
to
>> use multiple threads before.
>>
>>>CSV Dataset or the StringFromFile function might be suitable for
>>>reading the file.
>>
>>>To write to a single file, a Listener would be appropriate.
>>
>> I added this to my BeanShellSampler.bshrc:
>>
>> bsh.shared.lock = new ReentrantReadWriteLock();
>> bsh.shared.vpaths = new Vector(1000, 1000);
>> bsh.shared.index = 0;
>>
>> I tried declaring the var types before the bsh.shared... with the same
>> issues.
>>
>> I have a beanshell preprocessor outside the threads group with this
> code:
>>
>> import java.util.*;
>> import java.io.*;
>>
>> int wm = Integer.parseInt(vars.get("write_mode"));
>> if(wm == 0)
>> {
>>BufferedReader file = new BufferedReader(new
> FileReader("paths"));
>>String s;
>>while((s = file.readLine()) != null)
>>{
>>bsh.shared.vpaths.addElement(new String(s));
>>}
>>file.close();
>> }
>>
>> In the thread group I have a loop with this beanshell preprocessor on
> it:
>>
>> import java.util.*;
>> import java.util.concurrent.locks.ReentrantReadWriteLock;
>>
>> bsh.shared.lock.readLock().lock();
>> vars.put("path", bsh.shared.vpaths.elementAt(bsh.shared.index));
>> ++bsh.shared.index
>> bsh.shared.lock.readLock().unlock();
>>
>> The above is on the read type of test.  I've tried forward declarations
>> but it seems like beanshell can't tell what type of variables they are,
> it
>> works fine on integers.  I've also tried using putObject and getObject,
>> but it seems that the vars are reset each time the shell is invoked,
> even
>> if the reset is set to false.
>>
>> I was using the BufferedReader before directly in each read or write
>> preprocessor, but it only got the first line of the file so I figured a
>> string list might work, but it just has different issues.
>
> CSVDataset and StringFromFile are designed for use with JMeter threads.
>
> Given what you have said are the requirements, these are suitable.
>
> If they don't seem to work, then describe what you have tried, what
> happened, and what you expected to happen.
>
>> Thanks,
>>
>> Jake Devore
>> SCE WWS OTG Operations Engineering
>> (253) 981-4252
>>
>>
>>
>> sebb 
>> 03/20/2012 12:44 PM
>> Please respond to
>> "JMeter Users List" 
>>
>>
>> To
>> JMeter Users List 
>> cc
>>
>> Subject
>> Re: unable to share variables
>>
>>
>>
>>
>>
>>
>> On 20 March 2012 19:00,   wrote:
>>> So I've tried using the vars.putObject/vars.getObject, the vars always
>>> seem to be reset, even when the param to reset is false.  I've tried
>>> throwing variables in BeanShellSampler.bshrc in the bsh.shared
>> namespace,
>>> which had good results, except it only works on ints.
>>
>> This suggests that you are trying to share variables across threads -
>> is that the case?
>>
>>> Basically I want to be able to open a file and read a single line per
>> loop
>>> iteration in each th

Re: unable to share variables

2012-03-20 Thread Jake_Devore
Nevermind, I can just write a script or something to gen this and try out 
the csv thing.

Thanks,

Jake Devore
SCE WWS OTG Operations Engineering
(253) 981-4252



Jake Devore/SDPD/SCEA@Playstation 
03/20/2012 06:44 PM
Please respond to
"JMeter Users List" 


To
"JMeter Users List" 
cc
JMeter Users List 
Subject
Re: unable to share variables






Can I write out to that csv file?  Basically I need to write out the paths 

that are generated to a file so I can read them in later.

Thanks,

Jake Devore
SCE WWS OTG Operations Engineering
(253) 981-4252



sebb  
03/20/2012 05:56 PM
Please respond to
"JMeter Users List" 


To
JMeter Users List 
cc

Subject
Re: unable to share variables






On 20 March 2012 20:08,   wrote:
>>This suggests that you are trying to share variables across threads -
>>is that the case?
>
> For testing I only have one thread to cut down time, but I was trying to
> use multiple threads before.
>
>>CSV Dataset or the StringFromFile function might be suitable for
>>reading the file.
>
>>To write to a single file, a Listener would be appropriate.
>
> I added this to my BeanShellSampler.bshrc:
>
> bsh.shared.lock = new ReentrantReadWriteLock();
> bsh.shared.vpaths = new Vector(1000, 1000);
> bsh.shared.index = 0;
>
> I tried declaring the var types before the bsh.shared... with the same
> issues.
>
> I have a beanshell preprocessor outside the threads group with this 
code:
>
> import java.util.*;
> import java.io.*;
>
> int wm = Integer.parseInt(vars.get("write_mode"));
> if(wm == 0)
> {
>BufferedReader file = new BufferedReader(new 
FileReader("paths"));
>String s;
>while((s = file.readLine()) != null)
>{
>bsh.shared.vpaths.addElement(new String(s));
>}
>file.close();
> }
>
> In the thread group I have a loop with this beanshell preprocessor on 
it:
>
> import java.util.*;
> import java.util.concurrent.locks.ReentrantReadWriteLock;
>
> bsh.shared.lock.readLock().lock();
> vars.put("path", bsh.shared.vpaths.elementAt(bsh.shared.index));
> ++bsh.shared.index
> bsh.shared.lock.readLock().unlock();
>
> The above is on the read type of test.  I've tried forward declarations
> but it seems like beanshell can't tell what type of variables they are, 
it
> works fine on integers.  I've also tried using putObject and getObject,
> but it seems that the vars are reset each time the shell is invoked, 
even
> if the reset is set to false.
>
> I was using the BufferedReader before directly in each read or write
> preprocessor, but it only got the first line of the file so I figured a
> string list might work, but it just has different issues.

CSVDataset and StringFromFile are designed for use with JMeter threads.

Given what you have said are the requirements, these are suitable.

If they don't seem to work, then describe what you have tried, what
happened, and what you expected to happen.

> Thanks,
>
> Jake Devore
> SCE WWS OTG Operations Engineering
> (253) 981-4252
>
>
>
> sebb 
> 03/20/2012 12:44 PM
> Please respond to
> "JMeter Users List" 
>
>
> To
> JMeter Users List 
> cc
>
> Subject
> Re: unable to share variables
>
>
>
>
>
>
> On 20 March 2012 19:00,   wrote:
>> So I've tried using the vars.putObject/vars.getObject, the vars always
>> seem to be reset, even when the param to reset is false.  I've tried
>> throwing variables in BeanShellSampler.bshrc in the bsh.shared
> namespace,
>> which had good results, except it only works on ints.
>
> This suggests that you are trying to share variables across threads -
> is that the case?
>
>> Basically I want to be able to open a file and read a single line per
> loop
>> iteration in each thread and be able to do the same with writing to a
>> file.
>
> CSV Dataset or the StringFromFile function might be suitable for
> reading the file.
>
> To write to a single file, a Listener would be appropriate.
>
>> Thanks,
>>
>> Jake Devore
>
> -
> To unsubscribe, e-mail: user-unsubscr...@jmeter.apache.org
> For additional commands, e-mail: user-h...@jmeter.apache.org
>
>

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





Re: unable to share variables

2012-03-20 Thread sebb
On 21 March 2012 01:44,   wrote:
> Can I write out to that csv file?  Basically I need to write out the paths
> that are generated to a file so I can read them in later.

How are the paths generated?
If they are stored in a JMeter variable, you could even potentially
use the Simple Data Writer with a configuration that saves nothing
apart from the variable(s):

http://jmeter.apache.org/usermanual/listeners.html#sample_variables

Use a setUp Thread Group to create the file.

> Thanks,
>
> Jake Devore
> SCE WWS OTG Operations Engineering
> (253) 981-4252
>
>
>
> sebb 
> 03/20/2012 05:56 PM
> Please respond to
> "JMeter Users List" 
>
>
> To
> JMeter Users List 
> cc
>
> Subject
> Re: unable to share variables
>
>
>
>
>
>
> On 20 March 2012 20:08,   wrote:
>>>This suggests that you are trying to share variables across threads -
>>>is that the case?
>>
>> For testing I only have one thread to cut down time, but I was trying to
>> use multiple threads before.
>>
>>>CSV Dataset or the StringFromFile function might be suitable for
>>>reading the file.
>>
>>>To write to a single file, a Listener would be appropriate.
>>
>> I added this to my BeanShellSampler.bshrc:
>>
>> bsh.shared.lock = new ReentrantReadWriteLock();
>> bsh.shared.vpaths = new Vector(1000, 1000);
>> bsh.shared.index = 0;
>>
>> I tried declaring the var types before the bsh.shared... with the same
>> issues.
>>
>> I have a beanshell preprocessor outside the threads group with this
> code:
>>
>> import java.util.*;
>> import java.io.*;
>>
>> int wm = Integer.parseInt(vars.get("write_mode"));
>> if(wm == 0)
>> {
>>        BufferedReader file = new BufferedReader(new
> FileReader("paths"));
>>        String s;
>>        while((s = file.readLine()) != null)
>>        {
>>                bsh.shared.vpaths.addElement(new String(s));
>>        }
>>        file.close();
>> }
>>
>> In the thread group I have a loop with this beanshell preprocessor on
> it:
>>
>> import java.util.*;
>> import java.util.concurrent.locks.ReentrantReadWriteLock;
>>
>> bsh.shared.lock.readLock().lock();
>> vars.put("path", bsh.shared.vpaths.elementAt(bsh.shared.index));
>> ++bsh.shared.index
>> bsh.shared.lock.readLock().unlock();
>>
>> The above is on the read type of test.  I've tried forward declarations
>> but it seems like beanshell can't tell what type of variables they are,
> it
>> works fine on integers.  I've also tried using putObject and getObject,
>> but it seems that the vars are reset each time the shell is invoked,
> even
>> if the reset is set to false.
>>
>> I was using the BufferedReader before directly in each read or write
>> preprocessor, but it only got the first line of the file so I figured a
>> string list might work, but it just has different issues.
>
> CSVDataset and StringFromFile are designed for use with JMeter threads.
>
> Given what you have said are the requirements, these are suitable.
>
> If they don't seem to work, then describe what you have tried, what
> happened, and what you expected to happen.
>
>> Thanks,
>>
>> Jake Devore
>> SCE WWS OTG Operations Engineering
>> (253) 981-4252
>>
>>
>>
>> sebb 
>> 03/20/2012 12:44 PM
>> Please respond to
>> "JMeter Users List" 
>>
>>
>> To
>> JMeter Users List 
>> cc
>>
>> Subject
>> Re: unable to share variables
>>
>>
>>
>>
>>
>>
>> On 20 March 2012 19:00,   wrote:
>>> So I've tried using the vars.putObject/vars.getObject, the vars always
>>> seem to be reset, even when the param to reset is false.  I've tried
>>> throwing variables in BeanShellSampler.bshrc in the bsh.shared
>> namespace,
>>> which had good results, except it only works on ints.
>>
>> This suggests that you are trying to share variables across threads -
>> is that the case?
>>
>>> Basically I want to be able to open a file and read a single line per
>> loop
>>> iteration in each thread and be able to do the same with writing to a
>>> file.
>>
>> CSV Dataset or the StringFromFile function might be suitable for
>> reading the file.
>>
>> To write to a single file, a Listener would be appropriate.
>>
>>> Thanks,
>>>
>>> Jake Devore
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@jmeter.apache.org
>> For additional commands, e-mail: user-h...@jmeter.apache.org
>>
>>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@jmeter.apache.org
> For additional commands, e-mail: user-h...@jmeter.apache.org
>
>

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



Re: unable to share variables

2012-03-20 Thread Jake_Devore
Can I write out to that csv file?  Basically I need to write out the paths 
that are generated to a file so I can read them in later.

Thanks,

Jake Devore
SCE WWS OTG Operations Engineering
(253) 981-4252



sebb  
03/20/2012 05:56 PM
Please respond to
"JMeter Users List" 


To
JMeter Users List 
cc

Subject
Re: unable to share variables






On 20 March 2012 20:08,   wrote:
>>This suggests that you are trying to share variables across threads -
>>is that the case?
>
> For testing I only have one thread to cut down time, but I was trying to
> use multiple threads before.
>
>>CSV Dataset or the StringFromFile function might be suitable for
>>reading the file.
>
>>To write to a single file, a Listener would be appropriate.
>
> I added this to my BeanShellSampler.bshrc:
>
> bsh.shared.lock = new ReentrantReadWriteLock();
> bsh.shared.vpaths = new Vector(1000, 1000);
> bsh.shared.index = 0;
>
> I tried declaring the var types before the bsh.shared... with the same
> issues.
>
> I have a beanshell preprocessor outside the threads group with this 
code:
>
> import java.util.*;
> import java.io.*;
>
> int wm = Integer.parseInt(vars.get("write_mode"));
> if(wm == 0)
> {
>BufferedReader file = new BufferedReader(new 
FileReader("paths"));
>String s;
>while((s = file.readLine()) != null)
>{
>bsh.shared.vpaths.addElement(new String(s));
>}
>file.close();
> }
>
> In the thread group I have a loop with this beanshell preprocessor on 
it:
>
> import java.util.*;
> import java.util.concurrent.locks.ReentrantReadWriteLock;
>
> bsh.shared.lock.readLock().lock();
> vars.put("path", bsh.shared.vpaths.elementAt(bsh.shared.index));
> ++bsh.shared.index
> bsh.shared.lock.readLock().unlock();
>
> The above is on the read type of test.  I've tried forward declarations
> but it seems like beanshell can't tell what type of variables they are, 
it
> works fine on integers.  I've also tried using putObject and getObject,
> but it seems that the vars are reset each time the shell is invoked, 
even
> if the reset is set to false.
>
> I was using the BufferedReader before directly in each read or write
> preprocessor, but it only got the first line of the file so I figured a
> string list might work, but it just has different issues.

CSVDataset and StringFromFile are designed for use with JMeter threads.

Given what you have said are the requirements, these are suitable.

If they don't seem to work, then describe what you have tried, what
happened, and what you expected to happen.

> Thanks,
>
> Jake Devore
> SCE WWS OTG Operations Engineering
> (253) 981-4252
>
>
>
> sebb 
> 03/20/2012 12:44 PM
> Please respond to
> "JMeter Users List" 
>
>
> To
> JMeter Users List 
> cc
>
> Subject
> Re: unable to share variables
>
>
>
>
>
>
> On 20 March 2012 19:00,   wrote:
>> So I've tried using the vars.putObject/vars.getObject, the vars always
>> seem to be reset, even when the param to reset is false.  I've tried
>> throwing variables in BeanShellSampler.bshrc in the bsh.shared
> namespace,
>> which had good results, except it only works on ints.
>
> This suggests that you are trying to share variables across threads -
> is that the case?
>
>> Basically I want to be able to open a file and read a single line per
> loop
>> iteration in each thread and be able to do the same with writing to a
>> file.
>
> CSV Dataset or the StringFromFile function might be suitable for
> reading the file.
>
> To write to a single file, a Listener would be appropriate.
>
>> Thanks,
>>
>> Jake Devore
>
> -
> To unsubscribe, e-mail: user-unsubscr...@jmeter.apache.org
> For additional commands, e-mail: user-h...@jmeter.apache.org
>
>

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




Re: unable to share variables

2012-03-20 Thread sebb
On 20 March 2012 20:08,   wrote:
>>This suggests that you are trying to share variables across threads -
>>is that the case?
>
> For testing I only have one thread to cut down time, but I was trying to
> use multiple threads before.
>
>>CSV Dataset or the StringFromFile function might be suitable for
>>reading the file.
>
>>To write to a single file, a Listener would be appropriate.
>
> I added this to my BeanShellSampler.bshrc:
>
> bsh.shared.lock = new ReentrantReadWriteLock();
> bsh.shared.vpaths = new Vector(1000, 1000);
> bsh.shared.index = 0;
>
> I tried declaring the var types before the bsh.shared... with the same
> issues.
>
> I have a beanshell preprocessor outside the threads group with this code:
>
> import java.util.*;
> import java.io.*;
>
> int wm = Integer.parseInt(vars.get("write_mode"));
> if(wm == 0)
> {
>        BufferedReader file = new BufferedReader(new FileReader("paths"));
>        String s;
>        while((s = file.readLine()) != null)
>        {
>                bsh.shared.vpaths.addElement(new String(s));
>        }
>        file.close();
> }
>
> In the thread group I have a loop with this beanshell preprocessor on it:
>
> import java.util.*;
> import java.util.concurrent.locks.ReentrantReadWriteLock;
>
> bsh.shared.lock.readLock().lock();
> vars.put("path", bsh.shared.vpaths.elementAt(bsh.shared.index));
> ++bsh.shared.index
> bsh.shared.lock.readLock().unlock();
>
> The above is on the read type of test.  I've tried forward declarations
> but it seems like beanshell can't tell what type of variables they are, it
> works fine on integers.  I've also tried using putObject and getObject,
> but it seems that the vars are reset each time the shell is invoked, even
> if the reset is set to false.
>
> I was using the BufferedReader before directly in each read or write
> preprocessor, but it only got the first line of the file so I figured a
> string list might work, but it just has different issues.

CSVDataset and StringFromFile are designed for use with JMeter threads.

Given what you have said are the requirements, these are suitable.

If they don't seem to work, then describe what you have tried, what
happened, and what you expected to happen.

> Thanks,
>
> Jake Devore
> SCE WWS OTG Operations Engineering
> (253) 981-4252
>
>
>
> sebb 
> 03/20/2012 12:44 PM
> Please respond to
> "JMeter Users List" 
>
>
> To
> JMeter Users List 
> cc
>
> Subject
> Re: unable to share variables
>
>
>
>
>
>
> On 20 March 2012 19:00,   wrote:
>> So I've tried using the vars.putObject/vars.getObject, the vars always
>> seem to be reset, even when the param to reset is false.  I've tried
>> throwing variables in BeanShellSampler.bshrc in the bsh.shared
> namespace,
>> which had good results, except it only works on ints.
>
> This suggests that you are trying to share variables across threads -
> is that the case?
>
>> Basically I want to be able to open a file and read a single line per
> loop
>> iteration in each thread and be able to do the same with writing to a
>> file.
>
> CSV Dataset or the StringFromFile function might be suitable for
> reading the file.
>
> To write to a single file, a Listener would be appropriate.
>
>> Thanks,
>>
>> Jake Devore
>
> -
> To unsubscribe, e-mail: user-unsubscr...@jmeter.apache.org
> For additional commands, e-mail: user-h...@jmeter.apache.org
>
>

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



Re: unable to share variables

2012-03-20 Thread Jake_Devore
>This suggests that you are trying to share variables across threads -
>is that the case?

For testing I only have one thread to cut down time, but I was trying to 
use multiple threads before.

>CSV Dataset or the StringFromFile function might be suitable for
>reading the file.

>To write to a single file, a Listener would be appropriate.

I added this to my BeanShellSampler.bshrc:

bsh.shared.lock = new ReentrantReadWriteLock();
bsh.shared.vpaths = new Vector(1000, 1000);
bsh.shared.index = 0;

I tried declaring the var types before the bsh.shared... with the same 
issues.

I have a beanshell preprocessor outside the threads group with this code:

import java.util.*;
import java.io.*;

int wm = Integer.parseInt(vars.get("write_mode"));
if(wm == 0)
{
BufferedReader file = new BufferedReader(new FileReader("paths"));
String s;
while((s = file.readLine()) != null)
{
bsh.shared.vpaths.addElement(new String(s));
}
file.close();
}

In the thread group I have a loop with this beanshell preprocessor on it:

import java.util.*;
import java.util.concurrent.locks.ReentrantReadWriteLock;

bsh.shared.lock.readLock().lock();
vars.put("path", bsh.shared.vpaths.elementAt(bsh.shared.index));
++bsh.shared.index
bsh.shared.lock.readLock().unlock();

The above is on the read type of test.  I've tried forward declarations 
but it seems like beanshell can't tell what type of variables they are, it 
works fine on integers.  I've also tried using putObject and getObject, 
but it seems that the vars are reset each time the shell is invoked, even 
if the reset is set to false.

I was using the BufferedReader before directly in each read or write 
preprocessor, but it only got the first line of the file so I figured a 
string list might work, but it just has different issues.

Thanks,

Jake Devore
SCE WWS OTG Operations Engineering
(253) 981-4252



sebb  
03/20/2012 12:44 PM
Please respond to
"JMeter Users List" 


To
JMeter Users List 
cc

Subject
Re: unable to share variables






On 20 March 2012 19:00,   wrote:
> So I've tried using the vars.putObject/vars.getObject, the vars always
> seem to be reset, even when the param to reset is false.  I've tried
> throwing variables in BeanShellSampler.bshrc in the bsh.shared 
namespace,
> which had good results, except it only works on ints.

This suggests that you are trying to share variables across threads -
is that the case?

> Basically I want to be able to open a file and read a single line per 
loop
> iteration in each thread and be able to do the same with writing to a
> file.

CSV Dataset or the StringFromFile function might be suitable for
reading the file.

To write to a single file, a Listener would be appropriate.

> Thanks,
>
> Jake Devore

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




Re: unable to share variables

2012-03-20 Thread sebb
On 20 March 2012 19:00,   wrote:
> So I've tried using the vars.putObject/vars.getObject, the vars always
> seem to be reset, even when the param to reset is false.  I've tried
> throwing variables in BeanShellSampler.bshrc in the bsh.shared namespace,
> which had good results, except it only works on ints.

This suggests that you are trying to share variables across threads -
is that the case?

> Basically I want to be able to open a file and read a single line per loop
> iteration in each thread and be able to do the same with writing to a
> file.

CSV Dataset or the StringFromFile function might be suitable for
reading the file.

To write to a single file, a Listener would be appropriate.

> Thanks,
>
> Jake Devore

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



unable to share variables

2012-03-20 Thread Jake_Devore
So I've tried using the vars.putObject/vars.getObject, the vars always 
seem to be reset, even when the param to reset is false.  I've tried 
throwing variables in BeanShellSampler.bshrc in the bsh.shared namespace, 
which had good results, except it only works on ints.

Basically I want to be able to open a file and read a single line per loop 
iteration in each thread and be able to do the same with writing to a 
file.

Thanks,

Jake Devore