camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmuel...@apache.org
Subject svn commit: r1427011 - in /camel/branches/camel-2.10.x/tests: ./ camel-performance/ camel-performance/src/ camel-performance/src/test/ camel-performance/src/test/data/ camel-performance/src/test/java/ camel-performance/src/test/java/org/ camel-performa...
Date Sun, 30 Dec 2012 22:50:41 GMT
Author: cmueller
Date: Sun Dec 30 22:50:40 2012
New Revision: 1427011

URL: http://svn.apache.org/viewvc?rev=1427011&view=rev
Log:
CAMEL-5918: Add performance tests - work in progress

Added:
    camel/branches/camel-2.10.x/tests/camel-performance/
    camel/branches/camel-2.10.x/tests/camel-performance/README.txt
    camel/branches/camel-2.10.x/tests/camel-performance/pom.xml
      - copied, changed from r1426749, camel/branches/camel-2.10.x/tests/pom.xml
    camel/branches/camel-2.10.x/tests/camel-performance/src/
    camel/branches/camel-2.10.x/tests/camel-performance/src/test/
    camel/branches/camel-2.10.x/tests/camel-performance/src/test/data/
    camel/branches/camel-2.10.x/tests/camel-performance/src/test/data/1K_buyStocks.xml
    camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/
    camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/
    camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/
    camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/
    camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/
    camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/
    camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/AbstractBasePerformanceTest.java
    camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/ContentBasedRoutingPerformanceTest.java
    camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/HeaderBasedRoutingPerformanceTest.java
    camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/SplitterPerformanceTest.java
    camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/XPathBasedRoutingPerformanceTest.java
    camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/XQueryBasedRoutingPerformanceTest.java
    camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/XsltPerformanceTest.java
    camel/branches/camel-2.10.x/tests/camel-performance/src/test/resources/
    camel/branches/camel-2.10.x/tests/camel-performance/src/test/resources/META-INF/
    camel/branches/camel-2.10.x/tests/camel-performance/src/test/resources/META-INF/xslt/
    camel/branches/camel-2.10.x/tests/camel-performance/src/test/resources/META-INF/xslt/transform.xslt
    camel/branches/camel-2.10.x/tests/camel-performance/src/test/resources/log4j.properties
Modified:
    camel/branches/camel-2.10.x/tests/pom.xml

Added: camel/branches/camel-2.10.x/tests/camel-performance/README.txt
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/tests/camel-performance/README.txt?rev=1427011&view=auto
==============================================================================
--- camel/branches/camel-2.10.x/tests/camel-performance/README.txt (added)
+++ camel/branches/camel-2.10.x/tests/camel-performance/README.txt Sun Dec 30 22:50:40 2012
@@ -0,0 +1,10 @@
+=============================================================================
+ Camel Performance Tests
+=============================================================================
+
+Overview
+--------------------------------------------------------------------------
+ 
+ This module is where you should add performance tests.
+All tests should be disabled by default to not run on the CI server because
+we expect performance test are time and CPU consuming.
\ No newline at end of file

Copied: camel/branches/camel-2.10.x/tests/camel-performance/pom.xml (from r1426749, camel/branches/camel-2.10.x/tests/pom.xml)
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/tests/camel-performance/pom.xml?p2=camel/branches/camel-2.10.x/tests/camel-performance/pom.xml&p1=camel/branches/camel-2.10.x/tests/pom.xml&r1=1426749&r2=1427011&rev=1427011&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/tests/pom.xml (original)
+++ camel/branches/camel-2.10.x/tests/camel-performance/pom.xml Sun Dec 30 22:50:40 2012
@@ -6,9 +6,9 @@
   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.
@@ -21,33 +21,35 @@
 
   <parent>
     <groupId>org.apache.camel</groupId>
-    <artifactId>camel-parent</artifactId>
-    <version>2.10.4-SNAPSHOT</version>
-    <relativePath>../parent</relativePath>
+    <artifactId>tests</artifactId>
+    <version>2.11-SNAPSHOT</version>
   </parent>
 
-  <artifactId>tests</artifactId>
-  <name>Camel :: Integration Tests</name>
-  <description>Camel Integration Tests</description>
-  <packaging>pom</packaging>
-
-  <modules>
-    <module>test-bundles</module>
-    <module>camel-itest-standalone</module>
-    <module>camel-itest</module>
-    <module>camel-partial-classpath-test</module>
-    <module>camel-typeconverterscan-test</module>
-  </modules>
-
-  <profiles>
-    <profile>
-      <!-- default profile enables checkstyle and Xlint stuff -->
-      <id>osgi.test</id>
-      <modules>
-        <module>camel-itest-karaf</module>
-        <module>camel-itest-osgi</module>
-      </modules>
-    </profile>
-  </profiles>
-
+  <artifactId>camel-performance</artifactId>
+  <name>Camel :: Performance Tests</name>
+  <description>Performs cross component performance tests</description>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-test-spring</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-saxon</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-cxf</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
 </project>

Added: camel/branches/camel-2.10.x/tests/camel-performance/src/test/data/1K_buyStocks.xml
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/tests/camel-performance/src/test/data/1K_buyStocks.xml?rev=1427011&view=auto
==============================================================================
--- camel/branches/camel-2.10.x/tests/camel-performance/src/test/data/1K_buyStocks.xml (added)
+++ camel/branches/camel-2.10.x/tests/camel-performance/src/test/data/1K_buyStocks.xml Sun
Dec 30 22:50:40 2012
@@ -0,0 +1,14 @@
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
+<soapenv:Header><routing xmlns="http://someuri">xadmin;server1;community#1.0##</routing></soapenv:Header>
+<soapenv:Body>
+<m:buyStocks xmlns:m="http://services.samples/xsd">
+<order><symbol>IBM</symbol><buyerID>asankha</buyerID><price>140.34</price><volume>2000</volume></order>
+<order><symbol>MSFT</symbol><buyerID>ruwan</buyerID><price>23.56</price><volume>8030</volume></order>
+<order><symbol>SUN</symbol><buyerID>indika</buyerID><price>14.56</price><volume>500</volume></order>
+<order><symbol>GOOG</symbol><buyerID>chathura</buyerID><price>60.24</price><volume>40000</volume></order>
+<order><symbol>IBM</symbol><buyerID>asankha</buyerID><price>140.34</price><volume>2000</volume></order>
+<order><symbol>MSFT</symbol><buyerID>ruwan</buyerID><price>23.56</price><volume>803000</volume></order>
+<order><symbol>SUN</symbol><buyerID>indika</buyerID><price>14.56</price><volume>5000</volume></order>
+</m:buyStocks>
+</soapenv:Body>
+</soapenv:Envelope>

Added: camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/AbstractBasePerformanceTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/AbstractBasePerformanceTest.java?rev=1427011&view=auto
==============================================================================
--- camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/AbstractBasePerformanceTest.java
(added)
+++ camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/AbstractBasePerformanceTest.java
Sun Dec 30 22:50:40 2012
@@ -0,0 +1,66 @@
+/**
+ * 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.test.perf;
+
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+
+public abstract class AbstractBasePerformanceTest extends CamelTestSupport {
+
+    protected static final String BODY_1KB_PAYLOAD = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+        + "<soapenv:Header><routing xmlns=\"http://someuri\">xadmin;server1;community#1.0##</routing></soapenv:Header>"
+        + "<soapenv:Body>"
+        + "<m:buyStocks xmlns:m=\"http://services.samples/xsd\">"
+        + "<order><symbol>IBM</symbol><buyerID>asankha</buyerID><price>140.34</price><volume>2000</volume></order>"
+        + "<order><symbol>MSFT</symbol><buyerID>ruwan</buyerID><price>23.56</price><volume>8030</volume></order>"
+        + "<order><symbol>SUN</symbol><buyerID>indika</buyerID><price>14.56</price><volume>500</volume></order>"
+        + "<order><symbol>GOOG</symbol><buyerID>chathura</buyerID><price>60.24</price><volume>40000</volume></order>"
+        + "<order><symbol>IBM</symbol><buyerID>asankha</buyerID><price>140.34</price><volume>2000</volume></order>"
+        + "<order><symbol>MSFT</symbol><buyerID>ruwan</buyerID><price>23.56</price><volume>803000</volume></order>"
+        + "<order><symbol>SUN</symbol><buyerID>indika</buyerID><price>14.56</price><volume>5000</volume></order>"
+        + "</m:buyStocks>"
+        + "</soapenv:Body>"
+        + "</soapenv:Envelope>";
+
+    protected String getPayload() {
+        return BODY_1KB_PAYLOAD;
+    }
+
+    protected void resetMock(int count) {
+        MockEndpoint mock = getMockEndpoint("mock:end");
+        mock.reset();
+        mock.setRetainFirst(0);
+        mock.setRetainLast(0);
+        mock.expectedMessageCount(count);
+    }
+
+    protected void execute(int count) {
+        for (int counter = 0; counter < count; counter++) {
+            template.sendBody(getPayload());
+        }
+    }
+
+    @Override
+    public boolean isCreateCamelContextPerClass() {
+        return true;
+    }
+
+    @Override
+    protected boolean useJmx() {
+        return false;
+    }
+}
\ No newline at end of file

Added: camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/ContentBasedRoutingPerformanceTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/ContentBasedRoutingPerformanceTest.java?rev=1427011&view=auto
==============================================================================
--- camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/ContentBasedRoutingPerformanceTest.java
(added)
+++ camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/ContentBasedRoutingPerformanceTest.java
Sun Dec 30 22:50:40 2012
@@ -0,0 +1,118 @@
+/**
+ * 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.test.perf;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class ContentBasedRoutingPerformanceTest extends AbstractBasePerformanceTest {
+
+    private final int count = 30000;
+
+    @Test
+    public void testChoiceSimple() throws InterruptedException {
+        template.setDefaultEndpointUri("direct:choice-simple");
+
+        // warm up with 20.000 messages so that the JIT compiler kicks in
+        execute(20000);
+
+        resetMock(count);
+
+        long start = System.currentTimeMillis();
+        execute(count);
+        long end = System.currentTimeMillis();
+        
+        assertMockEndpointsSatisfied();
+        log.warn("Run " +  count + " tests in " + (end - start) + "ms");
+    }
+
+    @Test
+    public void testChoiceExpression() throws InterruptedException {
+        template.setDefaultEndpointUri("direct:choice-expression");
+
+        // warm up with 20.000 messages so that the JIT compiler kicks in
+        execute(20000);
+
+        resetMock(count);
+
+        long start = System.currentTimeMillis();
+        execute(count);
+        long end = System.currentTimeMillis();
+        
+        assertMockEndpointsSatisfied();
+        log.warn("Run " +  count + " tests in " + (end - start) + "ms");
+    }
+
+    @Test
+    public void testFilterSimple() throws InterruptedException {
+        template.setDefaultEndpointUri("direct:filter-simple");
+
+        // warm up with 20.000 messages so that the JIT compiler kicks in
+        execute(20000);
+
+        resetMock(count);
+
+        long start = System.currentTimeMillis();
+        execute(count);
+        long end = System.currentTimeMillis();
+
+        assertMockEndpointsSatisfied();
+        log.warn("Run " +  count + " tests in " + (end - start) + "ms");
+    }
+
+    @Test
+    public void testFilterExpression() throws InterruptedException {
+        template.setDefaultEndpointUri("direct:filter-expression");
+
+        // warm up with 20.000 messages so that the JIT compiler kicks in
+        execute(20000);
+
+        resetMock(count);
+
+        long start = System.currentTimeMillis();
+        execute(count);
+        long end = System.currentTimeMillis();
+
+        assertMockEndpointsSatisfied();
+        log.warn("Run " +  count + " tests in " + (end - start) + "ms");
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                from("direct:filter-simple")
+                    .filter().simple("${body} contains 'xadmin;server1;community#1.0##'")
+                        .to("mock:end");
+
+                from("direct:filter-expression")
+                    .filter(body().contains("<order><symbol>IBM</symbol><buyerID>asankha</buyerID>"))
+                        .to("mock:end");
+
+                from("direct:choice-simple")
+                    .choice()
+                        .when().simple("${body} contains 'xadmin;server1;community#1.0##'")
+                            .to("mock:end");
+
+                from("direct:choice-expression")
+                    .choice()
+                        .when(body().contains("<order><symbol>IBM</symbol><buyerID>asankha</buyerID>"))
+                            .to("mock:end");
+            }
+        };
+    }
+}
\ No newline at end of file

Added: camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/HeaderBasedRoutingPerformanceTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/HeaderBasedRoutingPerformanceTest.java?rev=1427011&view=auto
==============================================================================
--- camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/HeaderBasedRoutingPerformanceTest.java
(added)
+++ camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/HeaderBasedRoutingPerformanceTest.java
Sun Dec 30 22:50:40 2012
@@ -0,0 +1,125 @@
+/**
+ * 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.test.perf;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class HeaderBasedRoutingPerformanceTest extends AbstractBasePerformanceTest {
+
+    private final int count = 30000;
+
+    @Test
+    public void testChoiceSimple() throws InterruptedException {
+        template.setDefaultEndpointUri("direct:choice-simple");
+
+        // warm up with 20.000 messages so that the JIT compiler kicks in
+        execute(20000);
+
+        resetMock(count);
+
+        long start = System.currentTimeMillis();
+        execute(count);
+        long end = System.currentTimeMillis();
+        
+        assertMockEndpointsSatisfied();
+        log.warn("Run " +  count + " tests in " + (end - start) + "ms");
+    }
+
+    @Test
+    public void testChoiceExpression() throws InterruptedException {
+        template.setDefaultEndpointUri("direct:choice-expression");
+
+        // warm up with 20.000 messages so that the JIT compiler kicks in
+        execute(20000);
+
+        resetMock(count);
+        
+        long start = System.currentTimeMillis();
+        execute(count);
+        long end = System.currentTimeMillis();
+        
+        assertMockEndpointsSatisfied();
+        log.warn("Run " +  count + " tests in " + (end - start) + "ms");
+    }
+
+    @Test
+    public void testFilterSimple() throws InterruptedException {
+        template.setDefaultEndpointUri("direct:filter-simple");
+
+        // warm up with 20.000 messages so that the JIT compiler kicks in
+        execute(20000);
+
+        resetMock(count);
+
+        long start = System.currentTimeMillis();
+        execute(count);
+        long end = System.currentTimeMillis();
+
+        assertMockEndpointsSatisfied();
+        log.warn("Run " +  count + " tests in " + (end - start) + "ms");
+    }
+
+    @Test
+    public void testFilterExpression() throws InterruptedException {
+        template.setDefaultEndpointUri("direct:filter-expression");
+
+        // warm up with 20.000 messages so that the JIT compiler kicks in
+        execute(20000);
+
+        resetMock(count);
+
+        long start = System.currentTimeMillis();
+        execute(count);
+        long end = System.currentTimeMillis();
+
+        assertMockEndpointsSatisfied();
+        log.warn("Run " +  count + " tests in " + (end - start) + "ms");
+    }
+
+    @Override
+    protected void execute(int count) {
+        for (int counter = 0; counter < count; counter++) {
+            template.sendBodyAndHeader(getPayload(), "routing", "xadmin;server1;community#1.0##");
+        }
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                from("direct:filter-simple")
+                    .filter(simple("${in.header.routing} == 'xadmin;server1;community#1.0##'"))
+                        .to("mock:end");
+
+                from("direct:filter-expression")
+                    .filter(header("routing").isEqualTo("xadmin;server1;community#1.0##"))
+                        .to("mock:end");
+
+                from("direct:choice-simple")
+                    .choice()
+                        .when(simple("${in.header.routing} == 'xadmin;server1;community#1.0##'"))
+                            .to("mock:end");
+
+                from("direct:choice-expression")
+                    .choice()
+                        .when(header("routing").isEqualTo("xadmin;server1;community#1.0##"))
+                            .to("mock:end");
+            }
+        };
+    }
+}
\ No newline at end of file

Added: camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/SplitterPerformanceTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/SplitterPerformanceTest.java?rev=1427011&view=auto
==============================================================================
--- camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/SplitterPerformanceTest.java
(added)
+++ camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/SplitterPerformanceTest.java
Sun Dec 30 22:50:40 2012
@@ -0,0 +1,91 @@
+/**
+ * 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.test.perf;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class SplitterPerformanceTest extends AbstractBasePerformanceTest {
+
+    protected static final String HEADER = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+            + "<soapenv:Header><routing xmlns=\"http://someuri\">xadmin;server1;community#1.0##</routing></soapenv:Header>"
+            + "<soapenv:Body>"
+            + "<m:buyStocks xmlns:m=\"http://services.samples/xsd\">";
+
+    protected static final String BODY = "<order><symbol>IBM</symbol><buyerID>asankha</buyerID><price>140.34</price><volume>2000</volume></order>\n"
+            + "<order><symbol>MSFT</symbol><buyerID>ruwan</buyerID><price>23.56</price><volume>8030</volume></order>\n"
+            + "<order><symbol>SUN</symbol><buyerID>indika</buyerID><price>14.56</price><volume>500</volume></order>\n"
+            + "<order><symbol>GOOG</symbol><buyerID>chathura</buyerID><price>60.24</price><volume>40000</volume></order>\n"
+            + "<order><symbol>IBM</symbol><buyerID>asankha</buyerID><price>140.34</price><volume>2000</volume></order>\n"
+            + "<order><symbol>MSFT</symbol><buyerID>ruwan</buyerID><price>23.56</price><volume>803000</volume></order>\n"
+            + "<order><symbol>SUN</symbol><buyerID>indika</buyerID><price>14.56</price><volume>5000</volume></order>\n"
+            + "<order><symbol>GOOG</symbol><buyerID>chathura</buyerID><price>60.24</price><volume>40000</volume></order>\n"
+            + "<order><symbol>IBM</symbol><buyerID>asankha</buyerID><price>140.34</price><volume>2000</volume></order>\n"
+            + "<order><symbol>MSFT</symbol><buyerID>ruwan</buyerID><price>23.56</price><volume>803000</volume></order>\n";
+
+    protected static final String TRAILER = "</m:buyStocks>"
+            + "</soapenv:Body>"
+            + "</soapenv:Envelope>";
+
+    protected static String PAYLOAD = null;
+
+    static {
+        StringBuilder builder = new StringBuilder(HEADER);
+        
+        for (int i = 0; i < 2000; i++) {
+            builder.append(BODY);
+        }
+        
+        builder.append(TRAILER);
+        PAYLOAD = builder.toString();
+    }
+    
+    private final int count = 20001;
+
+    @Test
+    public void testTokenize() throws InterruptedException {
+        template.setDefaultEndpointUri("direct:tokenize");
+
+        // warm up with 30.000 messages so that the JIT compiler kicks in
+        execute(1);
+
+        resetMock(count);
+
+        long start = System.currentTimeMillis();
+        execute(1);
+        long end = System.currentTimeMillis();
+        
+        assertMockEndpointsSatisfied();
+        log.warn("Run " +  count + " tests in " + (end - start) + "ms");
+    }
+
+    @Override
+    protected String getPayload() {
+        return PAYLOAD;
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                from("direct:tokenize")
+                    .split(body().tokenize("\n"))
+                        .to("mock:end");
+            }
+        };
+    }
+}
\ No newline at end of file

Added: camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/XPathBasedRoutingPerformanceTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/XPathBasedRoutingPerformanceTest.java?rev=1427011&view=auto
==============================================================================
--- camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/XPathBasedRoutingPerformanceTest.java
(added)
+++ camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/XPathBasedRoutingPerformanceTest.java
Sun Dec 30 22:50:40 2012
@@ -0,0 +1,82 @@
+/**
+ * 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.test.perf;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class XPathBasedRoutingPerformanceTest extends AbstractBasePerformanceTest {
+
+    private final int count = 30000;
+
+    @Test
+    public void testChoice() throws InterruptedException {
+        template.setDefaultEndpointUri("direct:choice");
+
+        // warm up with 20.000 messages so that the JIT compiler kicks in
+        execute(20000);
+
+        resetMock(count);
+
+        long start = System.currentTimeMillis();
+        execute(count);
+        long end = System.currentTimeMillis();
+        
+        assertMockEndpointsSatisfied();
+        log.warn("Run " +  count + " tests in " + (end - start) + "ms");
+    }
+
+    @Test
+    public void testFilter() throws InterruptedException {
+        template.setDefaultEndpointUri("direct:filter");
+
+        // warm up with 20.000 messages so that the JIT compiler kicks in
+        execute(20000);
+
+        resetMock(count);
+
+        long start = System.currentTimeMillis();
+        execute(count);
+        long end = System.currentTimeMillis();
+
+        assertMockEndpointsSatisfied();
+        log.warn("Run " +  count + " tests in " + (end - start) + "ms");
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                Map<String, String> namespaces = new HashMap<String, String>();
+                namespaces.put("soapenv", "http://schemas.xmlsoap.org/soap/envelope/");
+                namespaces.put("m", "http://services.samples/xsd");
+
+                from("direct:filter")
+                    .filter().xpath("/soapenv:Envelope/soapenv:Body/m:buyStocks/order[1]/symbol='IBM'",
namespaces)
+                        .to("mock:end");
+
+                from("direct:choice")
+                    .choice()
+                        .when().xpath("/soapenv:Envelope/soapenv:Body/m:buyStocks/order[1]/symbol='IBM'",
namespaces)
+                            .to("mock:end");
+            }
+        };
+    }
+}
\ No newline at end of file

Added: camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/XQueryBasedRoutingPerformanceTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/XQueryBasedRoutingPerformanceTest.java?rev=1427011&view=auto
==============================================================================
--- camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/XQueryBasedRoutingPerformanceTest.java
(added)
+++ camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/XQueryBasedRoutingPerformanceTest.java
Sun Dec 30 22:50:40 2012
@@ -0,0 +1,82 @@
+/**
+ * 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.test.perf;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class XQueryBasedRoutingPerformanceTest extends AbstractBasePerformanceTest {
+
+    private final int count = 30000;
+
+    @Test
+    public void testChoice() throws InterruptedException {
+        template.setDefaultEndpointUri("direct:choice");
+
+        // warm up with 20.000 messages so that the JIT compiler kicks in
+        execute(20000);
+
+        resetMock(count);
+
+        long start = System.currentTimeMillis();
+        execute(count);
+        long end = System.currentTimeMillis();
+        
+        assertMockEndpointsSatisfied();
+        log.warn("Run " +  count + " tests in " + (end - start) + "ms");
+    }
+
+    @Test
+    public void testFilter() throws InterruptedException {
+        template.setDefaultEndpointUri("direct:filter");
+
+        // warm up with 20.000 messages so that the JIT compiler kicks in
+        execute(20000);
+
+        resetMock(count);
+
+        long start = System.currentTimeMillis();
+        execute(count);
+        long end = System.currentTimeMillis();
+
+        assertMockEndpointsSatisfied();
+        log.warn("Run " +  count + " tests in " + (end - start) + "ms");
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                Map<String, String> namespaces = new HashMap<String, String>();
+                namespaces.put("soapenv", "http://schemas.xmlsoap.org/soap/envelope/");
+                namespaces.put("m", "http://services.samples/xsd");
+
+                from("direct:filter")
+                    .filter().xquery("/soapenv:Envelope/soapenv:Body/m:buyStocks/order[1]/symbol='IBM'",
namespaces)
+                        .to("mock:end");
+
+                from("direct:choice")
+                    .choice()
+                        .when().xquery("/soapenv:Envelope/soapenv:Body/m:buyStocks/order[1]/symbol='IBM'",
namespaces)
+                            .to("mock:end");
+            }
+        };
+    }
+}
\ No newline at end of file

Added: camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/XsltPerformanceTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/XsltPerformanceTest.java?rev=1427011&view=auto
==============================================================================
--- camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/XsltPerformanceTest.java
(added)
+++ camel/branches/camel-2.10.x/tests/camel-performance/src/test/java/org/apache/camel/test/perf/XsltPerformanceTest.java
Sun Dec 30 22:50:40 2012
@@ -0,0 +1,53 @@
+/**
+ * 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.test.perf;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class XsltPerformanceTest extends AbstractBasePerformanceTest {
+
+    private final int count = 10000;
+
+    @Test
+    public void testXslt() throws InterruptedException {
+        template.setDefaultEndpointUri("direct:xslt");
+
+        // warm up with 1.000 messages so that the JIT compiler kicks in
+        execute(1000);
+
+        resetMock(count);
+
+        long start = System.currentTimeMillis();
+        execute(count);
+        long end = System.currentTimeMillis();
+        
+        assertMockEndpointsSatisfied();
+        log.warn("Run " +  count + " tests in " + (end - start) + "ms");
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                from("direct:xslt")
+                    .to("xslt://META-INF/xslt/transform.xslt")
+                    .to("mock:end");
+            }
+        };
+    }
+}
\ No newline at end of file

Added: camel/branches/camel-2.10.x/tests/camel-performance/src/test/resources/META-INF/xslt/transform.xslt
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/tests/camel-performance/src/test/resources/META-INF/xslt/transform.xslt?rev=1427011&view=auto
==============================================================================
--- camel/branches/camel-2.10.x/tests/camel-performance/src/test/resources/META-INF/xslt/transform.xslt
(added)
+++ camel/branches/camel-2.10.x/tests/camel-performance/src/test/resources/META-INF/xslt/transform.xslt
Sun Dec 30 22:50:40 2012
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="2.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:m0="http://services.samples/xsd"
+    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
+    
+    <xsl:output method="xml" omit-xml-declaration="yes" indent="yes" exclude-result-prefixes="m0"
/>
+
+    <xsl:template match="m0:buyStocks">
+        <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
+            <soapenv:Body>
+                <m:skcotSyub xmlns:m="http://services.samples/xsd">
+                    <xsl:for-each select="order">
+                        <redro>
+                            <lobmys>
+                                <xsl:value-of select="symbol" />
+                            </lobmys>
+                            <DIreyub>
+                                <xsl:value-of select="buyerID" />
+                            </DIreyub>
+                            <ecirp>
+                                <xsl:value-of select="price" />
+                            </ecirp>
+                            <emulov>
+                                <xsl:value-of select="volume" />
+                            </emulov>
+                        </redro>
+                    </xsl:for-each>
+                </m:skcotSyub>
+            </soapenv:Body>
+        </soapenv:Envelope>
+    </xsl:template>
+
+    <xsl:template match="soapenv:Header"></xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Added: camel/branches/camel-2.10.x/tests/camel-performance/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/tests/camel-performance/src/test/resources/log4j.properties?rev=1427011&view=auto
==============================================================================
--- camel/branches/camel-2.10.x/tests/camel-performance/src/test/resources/log4j.properties
(added)
+++ camel/branches/camel-2.10.x/tests/camel-performance/src/test/resources/log4j.properties
Sun Dec 30 22:50:40 2012
@@ -0,0 +1,39 @@
+## ------------------------------------------------------------------------
+## 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.
+## ------------------------------------------------------------------------
+
+#
+# The logging properties used for testing.
+#
+log4j.rootLogger=WARN, file, out
+
+# uncomment the following to enable camel debugging
+#log4j.logger.org.apache.camel=DEBUG
+#log4j.logger.org.apache.camel.test.perf=INFO
+
+# CONSOLE appender not used by default
+log4j.appender.out=org.apache.log4j.ConsoleAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=%d %c{1}.%M - %m%n
+
+# File appender
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.file=target/camel-performance-test.log
+log4j.appender.file.append=true
+log4j.appender.file.layout.ConversionPattern=%d %c{1}.%M - %m%n
+
+log4j.throwableRenderer=org.apache.log4j.EnhancedThrowableRenderer
\ No newline at end of file

Modified: camel/branches/camel-2.10.x/tests/pom.xml
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/tests/pom.xml?rev=1427011&r1=1427010&r2=1427011&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/tests/pom.xml (original)
+++ camel/branches/camel-2.10.x/tests/pom.xml Sun Dec 30 22:50:40 2012
@@ -48,6 +48,13 @@
         <module>camel-itest-osgi</module>
       </modules>
     </profile>
-  </profiles>
 
+    <!-- performance tests -->
+    <profile>
+      <id>performance.test</id>
+      <modules>
+        <module>camel-performance</module>
+      </modules>
+    </profile>
+  </profiles>
 </project>



Mime
View raw message