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 2020/03/27 08:23:32 UTC

[camel] branch master updated: Fix test that was hanging

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 1caad7f  Fix test that was hanging
1caad7f is described below

commit 1caad7fdfe3a888862890e6db5480009d2743b6e
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Mar 27 09:23:01 2020 +0100

    Fix test that was hanging
---
 .../jms/JmsSpringLoadBalanceFailoverTest.java      | 27 +++++++++++++---------
 .../jms/JmsSpringLoadBalanceFailoverTest.xml       |  2 ++
 2 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSpringLoadBalanceFailoverTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSpringLoadBalanceFailoverTest.java
index 61af139..a694733 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSpringLoadBalanceFailoverTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSpringLoadBalanceFailoverTest.java
@@ -16,26 +16,31 @@
  */
 package org.apache.camel.component.jms;
 
-import org.apache.camel.CamelContext;
-import org.apache.camel.spring.SpringCamelContext;
-import org.junit.Ignore;
+import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
 /**
  * Unit test for Camel loadbalancer failover with JMS
  */
-@Ignore("Hangs")
-public class JmsSpringLoadBalanceFailoverTest extends JmsLoadBalanceFailoverTest {
+public class JmsSpringLoadBalanceFailoverTest extends CamelSpringTestSupport {
 
     @Override
-    public boolean isUseRouteBuilder() {
-        return false;
+    protected AbstractApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/camel/component/jms/JmsSpringLoadBalanceFailoverTest.xml");
     }
 
-    @Override
-    protected CamelContext createCamelContext() throws Exception {
-        return SpringCamelContext.springCamelContext(
-                new ClassPathXmlApplicationContext("org/apache/camel/component/jms/JmsSpringLoadBalanceFailoverTest.xml"), true);
+    @Test
+    public void testFailover() throws Exception {
+        getMockEndpoint("mock:foo").expectedBodiesReceived("Hello World");
+        getMockEndpoint("mock:bar").expectedBodiesReceived("Hello World");
+        getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
+
+        String out = template.requestBody("direct:start", "Hello World", String.class);
+        assertEquals("Bye World", out);
+
+        assertMockEndpointsSatisfied();
     }
 
 }
\ No newline at end of file
diff --git a/components/camel-jms/src/test/resources/org/apache/camel/component/jms/JmsSpringLoadBalanceFailoverTest.xml b/components/camel-jms/src/test/resources/org/apache/camel/component/jms/JmsSpringLoadBalanceFailoverTest.xml
index 2a6c2d73..d49ce44 100644
--- a/components/camel-jms/src/test/resources/org/apache/camel/component/jms/JmsSpringLoadBalanceFailoverTest.xml
+++ b/components/camel-jms/src/test/resources/org/apache/camel/component/jms/JmsSpringLoadBalanceFailoverTest.xml
@@ -28,6 +28,8 @@
         <property name="connectionFactory">
             <bean class="org.apache.activemq.ActiveMQConnectionFactory">
                 <property name="brokerURL" value="vm://localhost?broker.persistent=false&amp;broker.useJmx=false"/>
+                <!-- need to trust when serializing java objects over JMS -->
+                <property name="trustAllPackages" value="true"/>
             </bean>
         </property>
     </bean>