Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 60102 invoked from network); 17 Aug 2006 03:53:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 17 Aug 2006 03:53:27 -0000 Received: (qmail 19684 invoked by uid 500); 17 Aug 2006 03:53:22 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 19654 invoked by uid 500); 17 Aug 2006 03:53:22 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 22825 invoked by uid 99); 16 Aug 2006 07:45:32 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) X-IronPort-AV: i="4.08,130,1154923200"; d="scan'208"; a="6723555:sNHT39243470" Message-ID: From: "Allwicher, Klaus" To: Ant Users List Subject: RE: Repeating a task x times Date: Wed, 16 Aug 2006 03:45:05 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2658.27) Content-Type: text/plain X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Write you own iterator for the loop produces: 1 2 ... 13 14 15 And here a simple implementation (of course you must add an antlib.xml to your jar) public class NumberGenerator implements Iterator { long start = 0; long incr = 1; long end = -1; long current = start; public void setStart(String start) { this.start = Long.parseLong(start); current = this.start; } public void setIncrement(String incr) { this.incr = Long.parseLong(incr); } public void setEnd(String end) { this.end = Long.parseLong(end); current = this.start; } public Iterator iterator() { return this; } public boolean hasNext() { return (end==-1 || current<=end); } public Object next() { if (hasNext()) { Long next = new Long(current); current+=incr; return next; } return null; } public void remove() { } } Kind regards Klaus Allwicher > -----Original Message----- > From: Daniel Smith [mailto:dlsmith@rice.edu] > Sent: 15 August, 2006 20:27 > To: Ant Users List > Subject: Repeating a task x times > > I'm interested in writing a script that repeats some task a > user- specified number of times. This is useful where the > behavior of JUnit tests is randomized (explicitly or, in this > case, due to concurrency irregularities), and a test sample > of size larger than 1 is needed. > > The best solution we've been able to come up with is the > "for" task from ant-contrib. Unfortunately, "for" iterates > over lists (or tokenized strings), not numbers. So we can do > something like this: > > > ant -Drepeat="1,2,3" sometarget > > > recommendations do you have? > > -Dan > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For > additional commands, e-mail: user-help@ant.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org