activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jans...@apache.org
Subject svn commit: r709735 - in /activemq/trunk: activemq-camel/src/main/java/org/apache/activemq/camel/component/JournalEndpoint.java activemq-camel/src/test/java/org/apache/activemq/camel/component/AutoExposeQueuesInCamelTest.java pom.xml
Date Sat, 01 Nov 2008 17:46:44 GMT
Author: janstey
Date: Sat Nov  1 10:46:44 2008
New Revision: 709735

URL: http://svn.apache.org/viewvc?rev=709735&view=rev
Log:
AMQ-1986 - Upgrade to Camel 1.5.0

Modified:
    activemq/trunk/activemq-camel/src/main/java/org/apache/activemq/camel/component/JournalEndpoint.java
    activemq/trunk/activemq-camel/src/test/java/org/apache/activemq/camel/component/AutoExposeQueuesInCamelTest.java
    activemq/trunk/pom.xml

Modified: activemq/trunk/activemq-camel/src/main/java/org/apache/activemq/camel/component/JournalEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-camel/src/main/java/org/apache/activemq/camel/component/JournalEndpoint.java?rev=709735&r1=709734&r2=709735&view=diff
==============================================================================
--- activemq/trunk/activemq-camel/src/main/java/org/apache/activemq/camel/component/JournalEndpoint.java
(original)
+++ activemq/trunk/activemq-camel/src/main/java/org/apache/activemq/camel/component/JournalEndpoint.java
Sat Nov  1 10:46:44 2008
@@ -27,6 +27,7 @@
 import org.apache.camel.CamelExchangeException;
 import org.apache.camel.Consumer;
 import org.apache.camel.Exchange;
+import org.apache.camel.NoTypeConversionAvailableException;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.RuntimeCamelException;
@@ -188,9 +189,10 @@
             public void process(Exchange exchange) throws Exception {
                 incrementReference();
                 try {
-
-                    ByteSequence body = exchange.getIn().getBody(ByteSequence.class);
-                    if (body == null) {
+                    ByteSequence body = null;
+                    try {
+                        body = exchange.getIn().getBody(ByteSequence.class);
+                    } catch(NoTypeConversionAvailableException e) {
                         byte[] bytes = exchange.getIn().getBody(byte[].class);
                         if (bytes != null) {
                             body = new ByteSequence(bytes);

Modified: activemq/trunk/activemq-camel/src/test/java/org/apache/activemq/camel/component/AutoExposeQueuesInCamelTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-camel/src/test/java/org/apache/activemq/camel/component/AutoExposeQueuesInCamelTest.java?rev=709735&r1=709734&r2=709735&view=diff
==============================================================================
--- activemq/trunk/activemq-camel/src/test/java/org/apache/activemq/camel/component/AutoExposeQueuesInCamelTest.java
(original)
+++ activemq/trunk/activemq-camel/src/test/java/org/apache/activemq/camel/component/AutoExposeQueuesInCamelTest.java
Sat Nov  1 10:46:44 2008
@@ -16,15 +16,17 @@
  */
 package org.apache.activemq.camel.component;
 
+import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 
-import org.apache.activemq.EmbeddedBrokerTestSupport;
-import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.ActiveMQQueue;
 import org.apache.activemq.command.ActiveMQTopic;
+import org.apache.activemq.EmbeddedBrokerTestSupport;
+import org.apache.activemq.broker.BrokerService;
 import org.apache.camel.CamelContext;
-import org.apache.camel.CamelTemplate;
+import org.apache.camel.Endpoint;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.spi.BrowsableEndpoint;
 import org.apache.camel.util.CamelContextHelper;
@@ -44,18 +46,31 @@
     protected ActiveMQTopic sampleTopic = new ActiveMQTopic("cheese");
 
     protected CamelContext camelContext = new DefaultCamelContext();
-    protected CamelTemplate template;
 
     public void testWorks() throws Exception {
         Thread.sleep(2000);
         LOG.debug("Looking for endpoints...");
-        List<BrowsableEndpoint> endpoints = CamelContextHelper.getSingletonEndpoints(camelContext,
BrowsableEndpoint.class);
+        // Changed from using CamelContextHelper.getSingletonEndpoints here because JMS Endpoints
in Camel
+        // are always non-singleton
+        List<BrowsableEndpoint> endpoints = getEndpoints(camelContext, BrowsableEndpoint.class);
         for (BrowsableEndpoint endpoint : endpoints) {
             LOG.debug("Endpoint: " + endpoint);
         }
         assertEquals("Should have found an endpoint: "+ endpoints, 1, endpoints.size());
     }
 
+    public <T> List<T> getEndpoints(CamelContext camelContext, Class<T>
type) {
+        List<T> answer = new ArrayList<T>();
+        Collection<Endpoint> endpoints = camelContext.getEndpoints();
+        for (Endpoint endpoint : endpoints) {
+            if (type.isInstance(endpoint)) {
+                T value = type.cast(endpoint);
+                answer.add(value);
+            }
+        }
+        return answer;
+    }    
+    
     @Override
     protected void setUp() throws Exception {
         super.setUp();

Modified: activemq/trunk/pom.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/pom.xml?rev=709735&r1=709734&r2=709735&view=diff
==============================================================================
--- activemq/trunk/pom.xml (original)
+++ activemq/trunk/pom.xml Sat Nov  1 10:46:44 2008
@@ -42,7 +42,7 @@
     <aopalliance-version>1.0</aopalliance-version>
     <axion-version>1.0-M3-dev</axion-version>
     <axis-version>1.2-RC1</axis-version>
-    <camel-version>1.4.0</camel-version>
+    <camel-version>1.5.0</camel-version>
     <cglib-version>2.0</cglib-version>
     <commons-beanutils-version>1.6.1</commons-beanutils-version>
     <commons-collections-version>3.1</commons-collections-version>



Mime
View raw message