svn commit: r802705 - in /camel/sandbox/tuning-experiment/components/camel-jms/src/test: java/org/apache/camel/component/jms/tuning/ resources/org/apache/camel/component/jms/tuning/

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r802705 - in /camel/sandbox/tuning-experiment/components/camel-jms/src/test: java/org/apache/camel/component/jms/tuning/ resources/org/apache/camel/component/jms/tuning/

davsclaus-2
Author: davsclaus
Date: Mon Aug 10 09:44:10 2009
New Revision: 802705

URL: http://svn.apache.org/viewvc?rev=802705&view=rev
Log:
tuning experiment

Added:
    camel/sandbox/tuning-experiment/components/camel-jms/src/test/java/org/apache/camel/component/jms/tuning/PerformanceRoutePojoTest.java   (with props)
    camel/sandbox/tuning-experiment/components/camel-jms/src/test/java/org/apache/camel/component/jms/tuning/RoutePojo.java   (with props)
    camel/sandbox/tuning-experiment/components/camel-jms/src/test/resources/org/apache/camel/component/jms/tuning/
    camel/sandbox/tuning-experiment/components/camel-jms/src/test/resources/org/apache/camel/component/jms/tuning/PerformanceRoutePojoTest-context.xml   (with props)
Modified:
    camel/sandbox/tuning-experiment/components/camel-jms/src/test/java/org/apache/camel/component/jms/tuning/PerformanceRouteTest.java

Added: camel/sandbox/tuning-experiment/components/camel-jms/src/test/java/org/apache/camel/component/jms/tuning/PerformanceRoutePojoTest.java
URL: http://svn.apache.org/viewvc/camel/sandbox/tuning-experiment/components/camel-jms/src/test/java/org/apache/camel/component/jms/tuning/PerformanceRoutePojoTest.java?rev=802705&view=auto
==============================================================================
--- camel/sandbox/tuning-experiment/components/camel-jms/src/test/java/org/apache/camel/component/jms/tuning/PerformanceRoutePojoTest.java (added)
+++ camel/sandbox/tuning-experiment/components/camel-jms/src/test/java/org/apache/camel/component/jms/tuning/PerformanceRoutePojoTest.java Mon Aug 10 09:44:10 2009
@@ -0,0 +1,73 @@
+/**
+ * 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.component.jms.tuning;
+
+import org.apache.camel.test.CamelSpringTestSupport;
+import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import org.junit.Test;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+/**
+ * @version $Revision$
+ */
+public class PerformanceRoutePojoTest extends CamelSpringTestSupport {
+
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/camel/component/jms/tuning/PerformanceRoutePojoTest-context.xml");
+    }
+
+    private int size = 5000;
+
+    @Test
+    public void testPojoPerformance() throws Exception {
+        if (!canRunOnThisPlatform()) {
+            return;
+        }
+
+        long start = System.currentTimeMillis();
+
+        getMockEndpoint("mock:audit").expectedMessageCount(size);
+        getMockEndpoint("mock:audit").expectsNoDuplicates().body();
+
+        getMockEndpoint("mock:gold").expectedMessageCount((size / 2) - (size / 10));
+        getMockEndpoint("mock:silver").expectedMessageCount(size / 10);
+
+        for (int i = 0; i < size; i++) {
+            String type;
+            if (i % 10 == 0) {
+                type = "silver";
+            } else if (i % 2 == 0) {
+                 type = "gold";
+            } else {
+                type = "bronze";
+            }
+            template.sendBodyAndHeader("activemq:queue:inbox", "Message " + i, "type", type);
+        }
+
+        assertMockEndpointsSatisfied();
+
+        long delta = System.currentTimeMillis() - start;
+        System.out.println("RoutePerformancePojoTest: 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");
+    }
+
+}

Propchange: camel/sandbox/tuning-experiment/components/camel-jms/src/test/java/org/apache/camel/component/jms/tuning/PerformanceRoutePojoTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/sandbox/tuning-experiment/components/camel-jms/src/test/java/org/apache/camel/component/jms/tuning/PerformanceRoutePojoTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: camel/sandbox/tuning-experiment/components/camel-jms/src/test/java/org/apache/camel/component/jms/tuning/PerformanceRouteTest.java
URL: http://svn.apache.org/viewvc/camel/sandbox/tuning-experiment/components/camel-jms/src/test/java/org/apache/camel/component/jms/tuning/PerformanceRouteTest.java?rev=802705&r1=802704&r2=802705&view=diff
==============================================================================
--- camel/sandbox/tuning-experiment/components/camel-jms/src/test/java/org/apache/camel/component/jms/tuning/PerformanceRouteTest.java (original)
+++ camel/sandbox/tuning-experiment/components/camel-jms/src/test/java/org/apache/camel/component/jms/tuning/PerformanceRouteTest.java Mon Aug 10 09:44:10 2009
@@ -30,7 +30,7 @@
  */
 public class PerformanceRouteTest extends CamelTestSupport {
 
-    private int size = 1000;
+    private int size = 5000;
 
     @Test
     public void testPerformance() throws Exception {
@@ -84,7 +84,7 @@
             @Override
             public void configure() throws Exception {
                 from("activemq:queue:inbox?concurrentConsumers=10")
-                    .wireTap("activemq:topic:audit")
+                    .to("activemq:topic:audit")
                     .choice()
                         .when(header("type").isEqualTo("gold"))
                             .to("direct:gold")
@@ -98,11 +98,9 @@
                     .to("mock:gold");
 
                 from("direct:silver")
-                    .delay(5)
                     .to("mock:silver");
 
                 from("direct:bronze")
-                    .delay(10)
                     .to("mock:bronze");
 
                 from("activemq:topic:audit").to("mock:audit");

Added: camel/sandbox/tuning-experiment/components/camel-jms/src/test/java/org/apache/camel/component/jms/tuning/RoutePojo.java
URL: http://svn.apache.org/viewvc/camel/sandbox/tuning-experiment/components/camel-jms/src/test/java/org/apache/camel/component/jms/tuning/RoutePojo.java?rev=802705&view=auto
==============================================================================
--- camel/sandbox/tuning-experiment/components/camel-jms/src/test/java/org/apache/camel/component/jms/tuning/RoutePojo.java (added)
+++ camel/sandbox/tuning-experiment/components/camel-jms/src/test/java/org/apache/camel/component/jms/tuning/RoutePojo.java Mon Aug 10 09:44:10 2009
@@ -0,0 +1,41 @@
+/**
+ * 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.component.jms.tuning;
+
+import org.apache.camel.Consume;
+import org.apache.camel.Exchange;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.RecipientList;
+
+/**
+ * @version $Revision$
+ */
+public class RoutePojo {
+
+    @Produce(uri = "activemq:topic:audit")
+    private ProducerTemplate topic;
+
+    @Consume(uri = "activemq:queue:inbox?concurrentConsumers=10")
+    @RecipientList
+    public String listen(Exchange exchange) {
+        topic.send(exchange);
+
+        String type = exchange.getIn().getHeader("type", String.class);
+        return "direct:" + type;
+    }
+}

Propchange: camel/sandbox/tuning-experiment/components/camel-jms/src/test/java/org/apache/camel/component/jms/tuning/RoutePojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/sandbox/tuning-experiment/components/camel-jms/src/test/java/org/apache/camel/component/jms/tuning/RoutePojo.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/sandbox/tuning-experiment/components/camel-jms/src/test/resources/org/apache/camel/component/jms/tuning/PerformanceRoutePojoTest-context.xml
URL: http://svn.apache.org/viewvc/camel/sandbox/tuning-experiment/components/camel-jms/src/test/resources/org/apache/camel/component/jms/tuning/PerformanceRoutePojoTest-context.xml?rev=802705&view=auto
==============================================================================
--- camel/sandbox/tuning-experiment/components/camel-jms/src/test/resources/org/apache/camel/component/jms/tuning/PerformanceRoutePojoTest-context.xml (added)
+++ camel/sandbox/tuning-experiment/components/camel-jms/src/test/resources/org/apache/camel/component/jms/tuning/PerformanceRoutePojoTest-context.xml Mon Aug 10 09:44:10 2009
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+    ">
+
+    <bean id="pojo" class="org.apache.camel.component.jms.tuning.RoutePojo"/>
+
+    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+        <route>
+            <from uri="direct:gold"/>
+            <to uri="mock:gold"/>
+        </route>
+        <route>
+            <from uri="direct:silver"/>
+            <to uri="mock:silver"/>
+        </route>
+        <route>
+            <from uri="direct:bronze"/>
+            <to uri="mock:bronze"/>
+        </route>
+
+        <route>
+            <from uri="activemq:topic:audit"/>
+            <to uri="mock:audit"/>
+        </route>
+    </camelContext>
+
+    <bean id="activemq" class="org.apache.camel.component.jms.JmsComponent">
+        <property name="connectionFactory">
+            <bean class="org.apache.activemq.ActiveMQConnectionFactory">
+                <property name="brokerURL" value="vm://localhost?broker.persistent=false"/>
+            </bean>
+        </property>
+    </bean>
+
+</beans>

Propchange: camel/sandbox/tuning-experiment/components/camel-jms/src/test/resources/org/apache/camel/component/jms/tuning/PerformanceRoutePojoTest-context.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/sandbox/tuning-experiment/components/camel-jms/src/test/resources/org/apache/camel/component/jms/tuning/PerformanceRoutePojoTest-context.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/sandbox/tuning-experiment/components/camel-jms/src/test/resources/org/apache/camel/component/jms/tuning/PerformanceRoutePojoTest-context.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml