Return-Path: X-Original-To: apmail-jmeter-user-archive@www.apache.org Delivered-To: apmail-jmeter-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 469EF18C06 for ; Mon, 11 May 2015 14:01:04 +0000 (UTC) Received: (qmail 99498 invoked by uid 500); 11 May 2015 14:01:03 -0000 Delivered-To: apmail-jmeter-user-archive@jmeter.apache.org Received: (qmail 99462 invoked by uid 500); 11 May 2015 14:01:03 -0000 Mailing-List: contact user-help@jmeter.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "JMeter Users List" Delivered-To: mailing list user@jmeter.apache.org Received: (qmail 99451 invoked by uid 99); 11 May 2015 14:01:03 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 May 2015 14:01:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 8F5B2C3F36 for ; Mon, 11 May 2015 14:01:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.861 X-Spam-Level: ** X-Spam-Status: No, score=2.861 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, RCVD_IN_MSPIKE_H2=-0.038, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id KbAO9ohCiQDp for ; Mon, 11 May 2015 14:01:01 +0000 (UTC) Received: from mail-ob0-f171.google.com (mail-ob0-f171.google.com [209.85.214.171]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTPS id 54FBD454BD for ; Mon, 11 May 2015 14:01:01 +0000 (UTC) Received: by obblk2 with SMTP id lk2so100406618obb.0 for ; Mon, 11 May 2015 07:01:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=7n2LRiVOHLjpyNG1qdZufH8yMkQagW/5CbxH+7XUtL8=; b=mhlYMdF4wEDTe6LTSSjjEONfT2X2COAj7lp7hrG13A3gd94fdO4U0TMOsI4eetO2VZ xMRWH6Z+mAt0OG5NQW6l3OwO3gplSPZBaOphrgWa/+oud0PGHW4XhHDyo1ayBPlgGOXI DslQ93Rmc9tXW3MeCqiHdRJy9/6hKxIf4zBO/Z0WcPPPEjZWCkivrYdEm8w4n9W6L3XJ 83kJAGUvd7l5DNjceunAFUP18hUyrE1jR2tb3e8he60KioU3V/gcQ5XcQAOyL0PUbwSb z0wBz0VUDq9eeTOy9fWDFckT1W8jGKIqvoRVZXck7m3INKKJ24XWyQMyx1E+WHGzrNyo bLWw== MIME-Version: 1.0 X-Received: by 10.182.68.103 with SMTP id v7mr8061598obt.82.1431352860674; Mon, 11 May 2015 07:01:00 -0700 (PDT) Received: by 10.202.104.196 with HTTP; Mon, 11 May 2015 07:01:00 -0700 (PDT) In-Reply-To: References: Date: Mon, 11 May 2015 19:31:00 +0530 Message-ID: Subject: Re: End jmeter test run from a Java sampler From: Shalin Shekhar Mangar To: JMeter Users List Content-Type: multipart/alternative; boundary=e89a8fb1ef2ccf0eda0515cece21 --e89a8fb1ef2ccf0eda0515cece21 Content-Type: text/plain; charset=UTF-8 Thank you, Deepak! I found that throwing JMeterStopThreadException also stops the thread. This is the same exception that CSVDataSet throws on EOF if recycle=false. On Sat, May 9, 2015 at 1:50 AM, Deepak Shetty wrote: > > https://jmeter.apache.org/api/org/apache/jmeter/threads/JMeterContextService.html > static method named getContext() > > On Fri, May 8, 2015 at 12:32 PM, Shalin Shekhar Mangar < > shalinmangar@gmail.com> wrote: > > > 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 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 < > > > shalinmangar@gmail.com> 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 > > > 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 < > > > > > shalinmangar@gmail.com> 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 < > shettyd@gmail.com> > > > > > 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 < > > > > > > > shalinmangar@gmail.com> 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. > > > -- Regards, Shalin Shekhar Mangar. --e89a8fb1ef2ccf0eda0515cece21--