camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r683147 - in /activemq/camel/trunk/components: camel-jms/src/test/java/org/apache/camel/component/jms/tx/ camel-saxon/src/test/java/org/apache/camel/component/xquery/
Date Wed, 06 Aug 2008 07:50:11 GMT
Author: ningjiang
Date: Wed Aug  6 00:50:10 2008
New Revision: 683147

URL: http://svn.apache.org/viewvc?rev=683147&view=rev
Log:
Applied the svn properties on the camel-jms camel-saxon

Modified:
    activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionalClientTest.java
  (contents, props changed)
    activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/TransactionErrorHandlerBuilderAsSpringBeanTest.java
  (contents, props changed)
    activemq/camel/trunk/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryConcurrencyTest.java
  (contents, props changed)
    activemq/camel/trunk/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryURLBasedConcurrencyTest.java
  (contents, props changed)

Modified: activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionalClientTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionalClientTest.java?rev=683147&r1=683146&r2=683147&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionalClientTest.java
(original)
+++ activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionalClientTest.java
Wed Aug  6 00:50:10 2008
@@ -1,67 +1,67 @@
-/**
- * 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.tx;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.spring.SpringTestSupport;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-/**
- * Simple unit test for transaction client EIP pattern and JMS.
- */
-public class JMSTransactionalClientTest extends SpringTestSupport {
-
-    protected ClassPathXmlApplicationContext createApplicationContext() {
-        return new ClassPathXmlApplicationContext(
-            "/org/apache/camel/component/jms/tx/JMSTransactionalClientTest.xml");
-    }
-
-    protected int getExpectedRouteCount() {
-        return 1;
-    }
-
-    public void testTransactionSuccess() throws Exception {
-        // START SNIPPET: e1
-        MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMessageCount(1);
-        mock.expectedBodiesReceived("Bye World");
-        // success at 3rd attempt
-        mock.message(0).header("count").isEqualTo(3);
-
-        template.sendBody("activemq:queue:okay", "Hello World");
-
-        mock.assertIsSatisfied();
-        // END SNIPPET: e1
-    }
-
-    // START SNIPPET: e2
-    public static class MyProcessor implements Processor {
-        private int count;
-
-        public void process(Exchange exchange) throws Exception {
-            if (++count <= 2) {
-                throw new IllegalArgumentException("Forced Exception number " + count + ",
please retry");
-            }
-            exchange.getIn().setBody("Bye World");
-            exchange.getIn().setHeader("count", count);
-        }
-    }
-    // END SNIPPET: e2
-
-}
+/**
+ * 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.tx;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.spring.SpringTestSupport;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * Simple unit test for transaction client EIP pattern and JMS.
+ */
+public class JMSTransactionalClientTest extends SpringTestSupport {
+
+    protected ClassPathXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext(
+            "/org/apache/camel/component/jms/tx/JMSTransactionalClientTest.xml");
+    }
+
+    protected int getExpectedRouteCount() {
+        return 1;
+    }
+
+    public void testTransactionSuccess() throws Exception {
+        // START SNIPPET: e1
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(1);
+        mock.expectedBodiesReceived("Bye World");
+        // success at 3rd attempt
+        mock.message(0).header("count").isEqualTo(3);
+
+        template.sendBody("activemq:queue:okay", "Hello World");
+
+        mock.assertIsSatisfied();
+        // END SNIPPET: e1
+    }
+
+    // START SNIPPET: e2
+    public static class MyProcessor implements Processor {
+        private int count;
+
+        public void process(Exchange exchange) throws Exception {
+            if (++count <= 2) {
+                throw new IllegalArgumentException("Forced Exception number " + count + ",
please retry");
+            }
+            exchange.getIn().setBody("Bye World");
+            exchange.getIn().setHeader("count", count);
+        }
+    }
+    // END SNIPPET: e2
+
+}

Propchange: activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionalClientTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionalClientTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/TransactionErrorHandlerBuilderAsSpringBeanTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/TransactionErrorHandlerBuilderAsSpringBeanTest.java?rev=683147&r1=683146&r2=683147&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/TransactionErrorHandlerBuilderAsSpringBeanTest.java
(original)
+++ activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/TransactionErrorHandlerBuilderAsSpringBeanTest.java
Wed Aug  6 00:50:10 2008
@@ -1,63 +1,63 @@
-/**
- * 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.tx;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.spring.SpringTestSupport;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-/**
- * To demonstrate the TransactionErrorHandlerBuilder configued in Spring XML.
- */
-public class TransactionErrorHandlerBuilderAsSpringBeanTest extends SpringTestSupport {
-
-    protected ClassPathXmlApplicationContext createApplicationContext() {
-        return new ClassPathXmlApplicationContext(
-            "/org/apache/camel/component/jms/tx/TransactionErrorHandlerBuilderAsSpringBeanTest.xml");
-    }
-
-    protected int getExpectedRouteCount() {
-        return 1;
-    }
-
-    public void testTransactionSuccess() throws Exception {
-        MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMessageCount(1);
-        mock.expectedBodiesReceived("Bye World");
-        // success at 3rd attempt
-        mock.message(0).header("count").isEqualTo(3);
-
-        template.sendBody("activemq:queue:okay", "Hello World");
-
-        mock.assertIsSatisfied();
-    }
-
-    public static class MyProcessor implements Processor {
-        private int count;
-
-        public void process(Exchange exchange) throws Exception {
-            if (++count <= 2) {
-                throw new IllegalArgumentException("Forced Exception number " + count + ",
please retry");
-            }
-            exchange.getIn().setBody("Bye World");
-            exchange.getIn().setHeader("count", count);
-        }
-    }
-
+/**
+ * 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.tx;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.spring.SpringTestSupport;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * To demonstrate the TransactionErrorHandlerBuilder configued in Spring XML.
+ */
+public class TransactionErrorHandlerBuilderAsSpringBeanTest extends SpringTestSupport {
+
+    protected ClassPathXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext(
+            "/org/apache/camel/component/jms/tx/TransactionErrorHandlerBuilderAsSpringBeanTest.xml");
+    }
+
+    protected int getExpectedRouteCount() {
+        return 1;
+    }
+
+    public void testTransactionSuccess() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(1);
+        mock.expectedBodiesReceived("Bye World");
+        // success at 3rd attempt
+        mock.message(0).header("count").isEqualTo(3);
+
+        template.sendBody("activemq:queue:okay", "Hello World");
+
+        mock.assertIsSatisfied();
+    }
+
+    public static class MyProcessor implements Processor {
+        private int count;
+
+        public void process(Exchange exchange) throws Exception {
+            if (++count <= 2) {
+                throw new IllegalArgumentException("Forced Exception number " + count + ",
please retry");
+            }
+            exchange.getIn().setBody("Bye World");
+            exchange.getIn().setHeader("count", count);
+        }
+    }
+
 }
\ No newline at end of file

Propchange: activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/TransactionErrorHandlerBuilderAsSpringBeanTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/TransactionErrorHandlerBuilderAsSpringBeanTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: activemq/camel/trunk/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryConcurrencyTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryConcurrencyTest.java?rev=683147&r1=683146&r2=683147&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryConcurrencyTest.java
(original)
+++ activemq/camel/trunk/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryConcurrencyTest.java
Wed Aug  6 00:50:10 2008
@@ -1,77 +1,77 @@
-/**
- * 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.xquery;
-
-import java.util.Random;
-
-import org.apache.camel.ContextTestSupport;
-import org.apache.camel.builder.DeadLetterChannelBuilder;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
-
-/**
- * Concurrency test of XQuery using transform.xquery DSL.
- */
-public class XQueryConcurrencyTest extends ContextTestSupport {
-
-    public void testConcurrency() throws Exception {
-        int total = 1000;
-
-        MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMessageCount(total);
-
-        // setup a task executor to be able send the messages in parallel
-        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
-        executor.setCorePoolSize(5);
-        executor.afterPropertiesSet();
-        for (int i = 0; i < 5; i++) {
-            final int threadCount = i;
-            executor.execute(new Runnable() {
-                public void run() {
-                    int start = threadCount * 200;
-                    for (int i = 0; i < 200; i++) {
-                        try {
-                            // do some random sleep to simulate spread in user activity
-                            Thread.sleep(new Random().nextInt(10));
-                        } catch (InterruptedException e) {
-                            // ignore
-                        }
-                        template.sendBody("seda:in", "<person><id>" + (start
+ i) + "</id><name>James</name></person>");
-                    }
-                }
-            });
-        }
-
-        mock.assertIsSatisfied();
-        mock.assertNoDuplicates(body());
-    }
-
-    protected RouteBuilder createRouteBuilder() throws Exception {
-        return new RouteBuilder() {
-            public void configure() throws Exception {
-                // no retry as we want every failure to submerge
-                errorHandler(noErrorHandler());
-
-                from("seda:in")
-                    .thread(5)
-                    .transform().xquery("/person/id", String.class)
-                    .to("mock:result");
-            }
-        };
-    }
-}
+/**
+ * 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.xquery;
+
+import java.util.Random;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.DeadLetterChannelBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+/**
+ * Concurrency test of XQuery using transform.xquery DSL.
+ */
+public class XQueryConcurrencyTest extends ContextTestSupport {
+
+    public void testConcurrency() throws Exception {
+        int total = 1000;
+
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(total);
+
+        // setup a task executor to be able send the messages in parallel
+        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+        executor.setCorePoolSize(5);
+        executor.afterPropertiesSet();
+        for (int i = 0; i < 5; i++) {
+            final int threadCount = i;
+            executor.execute(new Runnable() {
+                public void run() {
+                    int start = threadCount * 200;
+                    for (int i = 0; i < 200; i++) {
+                        try {
+                            // do some random sleep to simulate spread in user activity
+                            Thread.sleep(new Random().nextInt(10));
+                        } catch (InterruptedException e) {
+                            // ignore
+                        }
+                        template.sendBody("seda:in", "<person><id>" + (start
+ i) + "</id><name>James</name></person>");
+                    }
+                }
+            });
+        }
+
+        mock.assertIsSatisfied();
+        mock.assertNoDuplicates(body());
+    }
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                // no retry as we want every failure to submerge
+                errorHandler(noErrorHandler());
+
+                from("seda:in")
+                    .thread(5)
+                    .transform().xquery("/person/id", String.class)
+                    .to("mock:result");
+            }
+        };
+    }
+}

Propchange: activemq/camel/trunk/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryConcurrencyTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryConcurrencyTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: activemq/camel/trunk/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryURLBasedConcurrencyTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryURLBasedConcurrencyTest.java?rev=683147&r1=683146&r2=683147&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryURLBasedConcurrencyTest.java
(original)
+++ activemq/camel/trunk/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryURLBasedConcurrencyTest.java
Wed Aug  6 00:50:10 2008
@@ -1,81 +1,81 @@
-/**
- * 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.xquery;
-
-import java.util.Random;
-
-import org.apache.camel.ContextTestSupport;
-import org.apache.camel.Exchange;
-import org.apache.camel.builder.DeadLetterChannelBuilder;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
-
-/**
- * Concurrency test of XQuery using classpath resources (to).
- */
-public class XQueryURLBasedConcurrencyTest extends ContextTestSupport {
-
-    public void testConcurrency() throws Exception {
-        int total = 1000;
-
-        MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMessageCount(total);
-
-        // setup a task executor to be able send the messages in parallel
-        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
-        executor.setCorePoolSize(5);
-        executor.afterPropertiesSet();
-        for (int i = 0; i < 5; i++) {
-            final int threadCount = i;
-            executor.execute(new Runnable() {
-                public void run() {
-                    int start = threadCount * 200;
-                    for (int i = 0; i < 200; i++) {
-                        try {
-                            // do some random sleep to simulate spread in user activity
-                            Thread.sleep(new Random().nextInt(10));
-                        } catch (InterruptedException e) {
-                            // ignore
-                        }
-                        template.sendBody("direct:start",
-                            "<mail><subject>" + (start + i) + "</subject><body>Hello
world!</body></mail>");
-                    }
-                }
-            });
-        }
-
-        mock.assertIsSatisfied();
-        // must use bodyAs(String.class) to force DOM to be converted to String XML
-        // for duplication detection
-        mock.assertNoDuplicates(bodyAs(String.class));
-    }
-
-    protected RouteBuilder createRouteBuilder() throws Exception {
-        return new RouteBuilder() {
-            public void configure() throws Exception {
-                // no retry as we want every failure to submerge
-                errorHandler(noErrorHandler());
-
-                from("direct:start")
-                    .thread(5)
-                    .to("xquery:org/apache/camel/component/xquery/transform.xquery")
-                    .to("mock:result");
-            }
-        };
-    }
+/**
+ * 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.xquery;
+
+import java.util.Random;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.DeadLetterChannelBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+/**
+ * Concurrency test of XQuery using classpath resources (to).
+ */
+public class XQueryURLBasedConcurrencyTest extends ContextTestSupport {
+
+    public void testConcurrency() throws Exception {
+        int total = 1000;
+
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(total);
+
+        // setup a task executor to be able send the messages in parallel
+        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+        executor.setCorePoolSize(5);
+        executor.afterPropertiesSet();
+        for (int i = 0; i < 5; i++) {
+            final int threadCount = i;
+            executor.execute(new Runnable() {
+                public void run() {
+                    int start = threadCount * 200;
+                    for (int i = 0; i < 200; i++) {
+                        try {
+                            // do some random sleep to simulate spread in user activity
+                            Thread.sleep(new Random().nextInt(10));
+                        } catch (InterruptedException e) {
+                            // ignore
+                        }
+                        template.sendBody("direct:start",
+                            "<mail><subject>" + (start + i) + "</subject><body>Hello
world!</body></mail>");
+                    }
+                }
+            });
+        }
+
+        mock.assertIsSatisfied();
+        // must use bodyAs(String.class) to force DOM to be converted to String XML
+        // for duplication detection
+        mock.assertNoDuplicates(bodyAs(String.class));
+    }
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                // no retry as we want every failure to submerge
+                errorHandler(noErrorHandler());
+
+                from("direct:start")
+                    .thread(5)
+                    .to("xquery:org/apache/camel/component/xquery/transform.xquery")
+                    .to("mock:result");
+            }
+        };
+    }
 }
\ No newline at end of file

Propchange: activemq/camel/trunk/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryURLBasedConcurrencyTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryURLBasedConcurrencyTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message