Return-Path: Delivered-To: apmail-camel-users-archive@www.apache.org Received: (qmail 79706 invoked from network); 10 Apr 2010 18:35:52 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 10 Apr 2010 18:35:52 -0000 Received: (qmail 64641 invoked by uid 500); 10 Apr 2010 18:35:52 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 64614 invoked by uid 500); 10 Apr 2010 18:35:52 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 64606 invoked by uid 99); 10 Apr 2010 18:35:52 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 10 Apr 2010 18:35:52 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of pagrus@gmail.com designates 74.125.82.45 as permitted sender) Received: from [74.125.82.45] (HELO mail-ww0-f45.google.com) (74.125.82.45) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 10 Apr 2010 18:35:45 +0000 Received: by wwb28 with SMTP id 28so1446312wwb.32 for ; Sat, 10 Apr 2010 11:35:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:received:message-id:subject:from:to:content-type; bh=YXbKJT+JgUXGB9gMSA8nMyaHjtPXprs5zr/WdrcuykQ=; b=v4aSXDkhW85q2PE1y4tRbyD2V24h6dAT1Dg+MPBjzIzKTPF++yPK4OHDA/aAILXusH tN1h7NxwBqqnSgvBcwU6VoWf/1Wb1aSTL6UjKJhQPn9uxh/+fw+ppyCodlB69mFPNf16 st/f+kTNb6VcFsaxI9HQZuFCtFUgSh25AQo/M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=awqpJBN9ilw/8vVVddbw5a8mqHAbstlIQByoKyI03JpuvdycImsQJrHRrYwQfPsrQ/ TnT1Fg5m97c9q78b9M9tU8+4lcpJj6kCnNpLVuCI3CYwFoy3AIOg8qydX1NKpXA2eqIV 7g0iP+g54rNlhHBH3PDMbfAeazP1yWBZaO0do= MIME-Version: 1.0 Received: by 10.216.36.197 with HTTP; Sat, 10 Apr 2010 11:35:25 -0700 (PDT) In-Reply-To: References: Date: Sat, 10 Apr 2010 21:35:25 +0300 Received: by 10.216.175.142 with SMTP id z14mr979784wel.73.1270924525314; Sat, 10 Apr 2010 11:35:25 -0700 (PDT) Message-ID: Subject: Re: Throttler & mock endpoint question From: Pavel To: users@camel.apache.org Content-Type: multipart/alternative; boundary=001636417155de23dd0483e62cbe X-Virus-Checked: Checked by ClamAV on apache.org --001636417155de23dd0483e62cbe Content-Type: text/plain; charset=UTF-8 Hi, I'm fine with +/- 10%, but perhaps with my massive examples I shifted the focus away from the original issue: Route throttler is configured for 7 messages per second, but mock endpoint will match message count of 7, or 14, or anything in between. Thus the closest test I can do to verify intended limit of 7/second is targetMock.expectedMinimumMessageCount(15); targetMock.setResultWaitTime(1000); ... targetMock.assertIsNotSatisfied(); ... which is +/- 114%, and value of such test is questionable. And I'm trying to figure out which of the following is the case 1. My code or test is incorrect 2. There is an issue with throttler 3. There is an issue with mock endpoint 4. Mock endpoint by design is not the right tool for the job If #3 or #4, I'll need different approach to testing. Otherwise implementation needs to be changed. Thanks, Pavel On Sat, Apr 10, 2010 at 7:04 PM, Claus Ibsen wrote: > Hi > > You can newer trust 100% on System time millis as its not accurate. So > make assertions on a given +/- delta. > > > > On Sat, Apr 10, 2010 at 5:27 PM, Pavel wrote: > > Tried that, and noticed a few differences. maximumRequestsPerPeriod is 7. > > > > * Expected message count <7 consistently fails with "Expected , but > was > > <7>" > > * Expected message count 7-11 passes > > * Expected message count 12,13 seems racy: sometimes test would fail with > > "Expected , but was " > > * Expected message count 14,15 passes (or I simply did not catch races). > > * Expected message count 16-18 is racy again, e.g. "Expected <17>, but > was > > <19>" > > * Expected message count 30 is racy, e.g. "Expected: <30> but was: <32>" > > > > That is not 100% precise, as I was giving limited number of tries for > each > > case. > > > > BTW, camel 2.2.0, activemq-camel 5.3.1. > > > > Thanks, > > Pavel > > > > On Sat, Apr 10, 2010 at 2:31 PM, Claus Ibsen > wrote: > > > >> Hi > >> > >> Can you try with > >> targetMock.assertIsSatisfied(1000); > >> > >> > >> On Sat, Apr 10, 2010 at 11:43 AM, Pavel wrote: > >> > Hello, > >> > > >> > I'm facing strange behaviour of throttler + mock endpoint when route > >> under > >> > test is this: > >> > > >> > > >> > > >> > > >> > >> maximumRequestsPerPeriod="7"> > >> > > >> > > >> > > >> > > >> > test itself defines producer for "direct -> activemq:A" route, as well > as > >> > "activemq:B -> targetMock" route, and then does this: > >> > > >> > targetMock.expectedMessageCount(7); > >> > targetMock.setResultWaitTime(1000); > >> > for(int i=0; i<40; i++) > >> > { > >> > producer.sendBody("Message " + i); > >> > } > >> > targetMock.assertIsSatisfied(); > >> > > >> > This passes. > >> > *BUT* if I change targetMock.expectedMessageCount(7); to e.g. > >> > targetMock.expectedMessageCount(11); it passes as well! > >> > > >> > Looks like test would pass if expectedMessageCount is anything between > >> > [maximumRequestsPerPeriod, 2* maximumRequestsPerPeriod]. > >> > > >> > I tested various expected message counts against > >> > maximumRequestsPerPeriod="7" > >> > > >> > 3: Expected: <3> but was: <7> > >> > 4: Expected: <4> but was: <7> > >> > 5: Expected: <5> but was: <7> > >> > 6: Expected: <6> but was: <7> > >> > 7: passed > >> > 8: passed > >> > 9: passed > >> > 10: passed > >> > 11: passed > >> > 12: passed > >> > 13: passed > >> > 14: passed > >> > 15: Expected: <15> but was: <14> > >> > 16: Expected: <16> but was: <14> > >> > 17: Expected: <17> but was: <14> > >> > 18: Expected: <18> but was: <14> > >> > 19: Expected: <19> but was: <14> > >> > 20: Expected: <20> but was: <14> > >> > > >> > ... and against maximumRequestsPerPeriod="3" > >> > > >> > 2: Expected: <2> but was: <3> > >> > 3: passed > >> > 4: passed > >> > 5: passed > >> > 6: passed > >> > 7: Expected: <7> but was: <6> > >> > 8: Expected: <8> but was: <6> > >> > 9: Expected: <9> but was: <6> > >> > 10: Expected: <10> but was: <6> > >> > > >> > Can you please explain that? Is it some sort of mock endpoint > specifics? > >> > I'd like my test to be fairly strict, as the goal is to verify that > route > >> > meets SLA... > >> > > >> > Thanks, > >> > Pavel > >> > > >> > >> > >> > >> -- > >> Claus Ibsen > >> Apache Camel Committer > >> > >> Author of Camel in Action: http://www.manning.com/ibsen/ > >> Open Source Integration: http://fusesource.com > >> Blog: http://davsclaus.blogspot.com/ > >> Twitter: http://twitter.com/davsclaus > >> > > > > > > -- > Claus Ibsen > Apache Camel Committer > > Author of Camel in Action: http://www.manning.com/ibsen/ > Open Source Integration: http://fusesource.com > Blog: http://davsclaus.blogspot.com/ > Twitter: http://twitter.com/davsclaus > --001636417155de23dd0483e62cbe--