Return-Path: Delivered-To: apmail-camel-commits-archive@www.apache.org Received: (qmail 92135 invoked from network); 6 Aug 2009 10:10:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 6 Aug 2009 10:10:31 -0000 Received: (qmail 74275 invoked by uid 500); 6 Aug 2009 10:10:38 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 74198 invoked by uid 500); 6 Aug 2009 10:10:38 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 74177 invoked by uid 99); 6 Aug 2009 10:10:35 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Aug 2009 10:10:35 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Aug 2009 10:10:31 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 68892238889D; Thu, 6 Aug 2009 10:10:10 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r801588 - in /camel/sandbox/tuning-experiment/camel-core/src/test/java/org/apache/camel/processor: RoutePerformanceCountTest.java RoutePerformanceTest.java Date: Thu, 06 Aug 2009 10:10:10 -0000 To: commits@camel.apache.org From: davsclaus@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090806101010.68892238889D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: davsclaus Date: Thu Aug 6 10:10:09 2009 New Revision: 801588 URL: http://svn.apache.org/viewvc?rev=801588&view=rev Log: Added performance test not using mocks Added: camel/sandbox/tuning-experiment/camel-core/src/test/java/org/apache/camel/processor/RoutePerformanceCountTest.java (with props) Modified: camel/sandbox/tuning-experiment/camel-core/src/test/java/org/apache/camel/processor/RoutePerformanceTest.java Added: camel/sandbox/tuning-experiment/camel-core/src/test/java/org/apache/camel/processor/RoutePerformanceCountTest.java URL: http://svn.apache.org/viewvc/camel/sandbox/tuning-experiment/camel-core/src/test/java/org/apache/camel/processor/RoutePerformanceCountTest.java?rev=801588&view=auto ============================================================================== --- camel/sandbox/tuning-experiment/camel-core/src/test/java/org/apache/camel/processor/RoutePerformanceCountTest.java (added) +++ camel/sandbox/tuning-experiment/camel-core/src/test/java/org/apache/camel/processor/RoutePerformanceCountTest.java Thu Aug 6 10:10:09 2009 @@ -0,0 +1,87 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.processor; + +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.camel.ContextTestSupport; +import org.apache.camel.Exchange; +import org.apache.camel.Processor; +import org.apache.camel.builder.RouteBuilder; + +/** + * @version $Revision$ + */ +public class RoutePerformanceCountTest extends ContextTestSupport { + + private CountProcessor processor = new CountProcessor(); + private int size = 10000; + private String url = "direct:start"; + + public void testSendMessages() throws Exception { + if (!canRunOnThisPlatform()) { + return; + } + + long start = System.currentTimeMillis(); + + for (int i = 0; i < size; i++) { + template.sendBody(url, "Message " + i); + } + assertEquals(size, processor.getCounter()); + + long delta = System.currentTimeMillis() - start; + System.out.println("RoutePerformanceCountTest: Sent: " + size + " Took: " + delta + " ms"); + } + + private boolean canRunOnThisPlatform() { + String os = System.getProperty("os.name"); + // HP-UX is just to slow to run this test + return !os.toLowerCase().contains("hp-ux"); + } + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + from("direct:start").to("log:a?level=OFF", "log:b?level=OFF", "direct:c"); + + from("direct:c") + .choice() + .when().header("foo").process(processor) + .otherwise().process(processor) + .end(); + } + }; + } + + private class CountProcessor implements Processor { + + private AtomicInteger counter = new AtomicInteger(0); + + public void process(Exchange exchange) throws Exception { + counter.incrementAndGet(); + } + + public int getCounter() { + return counter.intValue(); + } + + } + +} Propchange: camel/sandbox/tuning-experiment/camel-core/src/test/java/org/apache/camel/processor/RoutePerformanceCountTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: camel/sandbox/tuning-experiment/camel-core/src/test/java/org/apache/camel/processor/RoutePerformanceCountTest.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Modified: camel/sandbox/tuning-experiment/camel-core/src/test/java/org/apache/camel/processor/RoutePerformanceTest.java URL: http://svn.apache.org/viewvc/camel/sandbox/tuning-experiment/camel-core/src/test/java/org/apache/camel/processor/RoutePerformanceTest.java?rev=801588&r1=801587&r2=801588&view=diff ============================================================================== --- camel/sandbox/tuning-experiment/camel-core/src/test/java/org/apache/camel/processor/RoutePerformanceTest.java (original) +++ camel/sandbox/tuning-experiment/camel-core/src/test/java/org/apache/camel/processor/RoutePerformanceTest.java Thu Aug 6 10:10:09 2009 @@ -31,7 +31,7 @@ */ public class RoutePerformanceTest extends ContextTestSupport { - private int size = 20000; + private int size = 10000; private SimpleDataSet dataSet = new SimpleDataSet(size); private String uri = "mock:results";