You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2008/09/22 10:56:50 UTC
svn commit: r697716 - in
/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel:
TestSupport.java issues/TwoTimerWithJMSIssue.java
Author: davsclaus
Date: Mon Sep 22 01:56:50 2008
New Revision: 697716
URL: http://svn.apache.org/viewvc?rev=697716&view=rev
Log:
CAMEL-927: Added unit test to try to reproduce the issue reported. Polished javadoc.
Added:
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/TwoTimerWithJMSIssue.java (with props)
Modified:
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java
Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java?rev=697716&r1=697715&r2=697716&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java (original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java Mon Sep 22 01:56:50 2008
@@ -46,7 +46,6 @@
/**
* Returns a value builder for the given header
*/
-
public <E extends Exchange> ValueBuilder<E> header(String name) {
return Builder.header(name);
}
@@ -54,7 +53,6 @@
/**
* Returns a predicate and value builder for the inbound body on an exchange
*/
-
public ValueBuilder body() {
return Builder.body();
}
@@ -63,7 +61,6 @@
* Returns a predicate and value builder for the inbound message body as a
* specific type
*/
-
public <T> ValueBuilder bodyAs(Class<T> type) {
return Builder.bodyAs(type);
}
@@ -72,7 +69,6 @@
* Returns a predicate and value builder for the outbound body on an
* exchange
*/
-
public ValueBuilder outBody() {
return Builder.outBody();
}
@@ -81,7 +77,6 @@
* Returns a predicate and value builder for the outbound message body as a
* specific type
*/
-
public <T> ValueBuilder outBodyAs(Class<T> type) {
return Builder.outBodyAs(type);
}
@@ -90,7 +85,6 @@
* Returns a predicate and value builder for the fault body on an
* exchange
*/
-
public ValueBuilder faultBody() {
return Builder.faultBody();
}
@@ -99,7 +93,6 @@
* Returns a predicate and value builder for the fault message body as a
* specific type
*/
-
public <T> ValueBuilder faultBodyAs(Class<T> type) {
return Builder.faultBodyAs(type);
}
@@ -107,7 +100,6 @@
/**
* Returns a value builder for the given system property
*/
-
public ValueBuilder systemProperty(String name) {
return Builder.systemProperty(name);
}
@@ -115,7 +107,6 @@
/**
* Returns a value builder for the given system property
*/
-
public ValueBuilder systemProperty(String name, String defaultValue) {
return Builder.systemProperty(name, defaultValue);
}
@@ -151,9 +142,10 @@
/**
* Asserts that the given exchange has an OUT message of the given body value
+ *
* @param exchange the exchange which should have an OUT message
* @param expected the expected value of the OUT message
- * @throws InvalidPayloadException
+ * @throws InvalidPayloadException is thrown if the payload is not the expected class type
*/
protected void assertInMessageBodyEquals(Exchange exchange, Object expected) throws InvalidPayloadException {
assertNotNull("Should have a response exchange!", exchange);
@@ -172,9 +164,10 @@
/**
* Asserts that the given exchange has an OUT message of the given body value
+ *
* @param exchange the exchange which should have an OUT message
* @param expected the expected value of the OUT message
- * @throws InvalidPayloadException
+ * @throws InvalidPayloadException is thrown if the payload is not the expected class type
*/
protected void assertOutMessageBodyEquals(Exchange exchange, Object expected) throws InvalidPayloadException {
assertNotNull("Should have a response exchange!", exchange);
@@ -322,9 +315,6 @@
/**
* If a processor is wrapped with a bunch of DelegateProcessor or DelegateAsyncProcessor objects
* this call will drill through them and return the wrapped Processor.
- *
- * @param processor
- * @return
*/
protected Processor unwrap(Processor processor) {
while (true) {
Added: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/TwoTimerWithJMSIssue.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/TwoTimerWithJMSIssue.java?rev=697716&view=auto
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/TwoTimerWithJMSIssue.java (added)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/TwoTimerWithJMSIssue.java Mon Sep 22 01:56:50 2008
@@ -0,0 +1,55 @@
+/**
+ * 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.issues;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.processor.interceptor.Tracer;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.builder.RouteBuilder;
+
+/**
+ * Trying to reproduce CAMEL-927.
+ */
+public class TwoTimerWithJMSIssue extends ContextTestSupport {
+
+ @Override
+ protected void setUp() throws Exception {
+ //disableJMX(); in case JMX is the culprint
+ super.setUp();
+ }
+
+ public void testTimer() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:result");
+ // we expect 4 messages to let the timers fire twice
+ mock.expectedMinimumMessageCount(4);
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() throws Exception {
+ context.addInterceptStrategy(new Tracer());
+
+ from("timer://kickoff_1?period=2000&delay=1").to("mock:result");
+
+ from("timer://kickoff_2?period=2000&delay=2").to("mock:result");
+ }
+ };
+ }
+}
Propchange: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/TwoTimerWithJMSIssue.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/TwoTimerWithJMSIssue.java
------------------------------------------------------------------------------
svn:keywords = Rev Date