Hi Deepak, I must be missing something obvious. How can my Sampler get access to the the JMeterContextService? I don't see any methods exposed via AbstractJavaSamplerClient or JavaSamplerContext which let me get the JMeterContextService object.
On Wed, May 6, 2015 at 7:39 PM, Deepak Shetty <[email protected]> wrote: > If the CSV reads the field into say a variable called query , then just > define a parameter on the JavaSampler with a value of ${query} > If you need all defined variables then you can use the same > JMeterContextService --> getJMeterContext() -->getVariables() which gives > you the JMeterVariables object on which you can get/set whatever variables > you need. > > On Tue, May 5, 2015 at 11:07 PM, Shalin Shekhar Mangar < > [email protected]> wrote: > > > Okay, I think I understand your hint about the CSV Data Set Config. I can > > use that and set the "Stop thread on EOF" property to true. So let's say > > that I read a line of my query file using the CSV Data Set Config, how > do I > > access that string from inside my Java sampler? > > > > On Wed, May 6, 2015 at 12:31 AM, Deepak Shetty <[email protected]> > wrote: > > > > > ok try - use JMeterContextService - Get JmeterContext from which you > can > > > get the JMeter thread of JMeterThreadGroup and do ask it to stop -- > > > > > > https://jmeter.apache.org/api/org/apache/jmeter/threads/JMeterContext.html > > > (Note its a different matter that I dont think you should be doing thi > ) > > > > > > On Tue, May 5, 2015 at 11:54 AM, Shalin Shekhar Mangar < > > > [email protected]> wrote: > > > > > > > No, I am reading the file contents myself i.e. with Java code inside > > the > > > > custom sampler. > > > > > > > > On Tue, May 5, 2015 at 11:15 PM, Deepak Shetty <[email protected]> > > > wrote: > > > > > > > > > Are you using CSV Data Set Config to read the query file? > > > > > > > > > > On Tue, May 5, 2015 at 9:57 AM, Shalin Shekhar Mangar < > > > > > [email protected]> wrote: > > > > > > > > > > > Hello, > > > > > > > > > > > > I am writing a Java sampler that generates queries from a file to > > run > > > > > > against my custom application server. How do I signal to Jmeter > > that > > > I > > > > > have > > > > > > run out of queries and that the test is complete? > > > > > > > > > > > > I have set the thread group to loop forever. I can of course > > > constrain > > > > it > > > > > > to run only a certain number of times but I'd like to test with > > many > > > > > > different query files and I don't want to create different > > > > configuration > > > > > > (loop count, num threads) for each query file. > > > > > > > > > > > > -- > > > > > > Regards, > > > > > > Shalin Shekhar Mangar. > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > Regards, > > > > Shalin Shekhar Mangar. > > > > > > > > > > > > > > > -- > > Regards, > > Shalin Shekhar Mangar. > > > -- Regards, Shalin Shekhar Mangar.
