You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by he...@apache.org on 2015/12/01 16:30:28 UTC

camel git commit: [CAMEL-9381] Upgraded AMQP to qpid-jms-client.

Repository: camel
Updated Branches:
  refs/heads/master 1f2127362 -> 4997c2e92


[CAMEL-9381] Upgraded AMQP to qpid-jms-client.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4997c2e9
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4997c2e9
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4997c2e9

Branch: refs/heads/master
Commit: 4997c2e929d11a1e45fbaaaff3c9cbf6cfbeea08
Parents: 1f21273
Author: Henryk Konsek <he...@gmail.com>
Authored: Tue Dec 1 16:30:22 2015 +0100
Committer: Henryk Konsek <he...@gmail.com>
Committed: Tue Dec 1 16:30:22 2015 +0100

----------------------------------------------------------------------
 components/camel-amqp/pom.xml                   | 22 ++++++--
 .../camel/component/amqp/AMQPComponent.java     | 11 ++--
 .../camel/component/amqp/AMQPRouteTest.java     | 20 +++----
 .../camel-amqp/src/test/resources/config.json   | 27 ---------
 .../camel-amqp/src/test/resources/log4j.xml     | 37 -------------
 components/camel-amqp/src/test/resources/passwd | 23 --------
 .../src/test/resources/virtualhosts.xml         | 58 --------------------
 parent/pom.xml                                  |  1 +
 .../features/src/main/resources/features.xml    |  4 +-
 9 files changed, 34 insertions(+), 169 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/4997c2e9/components/camel-amqp/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-amqp/pom.xml b/components/camel-amqp/pom.xml
index b3aeed5..03ae156 100644
--- a/components/camel-amqp/pom.xml
+++ b/components/camel-amqp/pom.xml
@@ -30,6 +30,13 @@
   <description>Camel AMQP component which is based on the Apache Qid project</description>
 
   <properties>
+    <!-- Wrapped qpid-jms-client requires invalid version of the package.
+    Remove this after migration to ServiceMix bundles. -->
+    <camel.osgi.import>
+      org.apache.qpid.jms,
+      ${camel.osgi.import.defaults},
+      *
+    </camel.osgi.import>
     <camel.osgi.export.pkg>org.apache.camel.component.amqp.*</camel.osgi.export.pkg>
     <camel.osgi.export.service>org.apache.camel.spi.ComponentResolver;component=amqp</camel.osgi.export.service>
   </properties>
@@ -46,8 +53,8 @@
     </dependency>
     <dependency>
       <groupId>org.apache.qpid</groupId>
-      <artifactId>qpid-amqp-1-0-client-jms</artifactId>
-      <version>${qpid-version}</version>
+      <artifactId>qpid-jms-client</artifactId>
+      <version>${qpid-jms-client-version}</version>
     </dependency>
     <dependency>
         <groupId>org.apache.qpid</groupId>
@@ -57,9 +64,14 @@
 
     <!-- testing -->
     <dependency>
-      <groupId>org.apache.qpid</groupId>
-      <artifactId>qpid-broker</artifactId>
-      <version>${qpid-version}</version>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>activemq-broker</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>activemq-amqp</artifactId>
+      <version>${activemq-version}</version>
       <scope>test</scope>
     </dependency>
     <dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/4997c2e9/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java b/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java
index 6397fd4..383b960 100644
--- a/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java
+++ b/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java
@@ -24,8 +24,7 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.Component;
 import org.apache.camel.component.jms.JmsComponent;
 import org.apache.camel.component.jms.JmsConfiguration;
-import org.apache.qpid.amqp_1_0.jms.impl.ConnectionFactoryImpl;
-import org.apache.qpid.client.AMQConnectionFactory;
+import org.apache.qpid.jms.JmsConnectionFactory;
 
 /**
  * This component supports the AMQP protocol using the Client API of the Apache Qpid project.
@@ -52,19 +51,19 @@ public class AMQPComponent extends JmsComponent {
         if (old) {
             return amqpComponentOld(uri);
         }
-        return new AMQPComponent(ConnectionFactoryImpl.createFromURL(uri));
+        return new AMQPComponent(new JmsConnectionFactory(uri));
     }
 
     public static Component amqpComponentOld(String uri) throws URISyntaxException {
-        return new AMQPComponent(new AMQConnectionFactory(uri));
+        return new AMQPComponent(new JmsConnectionFactory(uri));
     }
 
     public static Component amqpComponent(String uri) throws MalformedURLException {
-        return new AMQPComponent(ConnectionFactoryImpl.createFromURL(uri));
+        return new AMQPComponent(new JmsConnectionFactory(uri));
     }
 
     public static AMQPComponent amqp10Component(String uri) throws MalformedURLException {
-        ConnectionFactoryImpl connectionFactory = ConnectionFactoryImpl.createFromURL(uri);
+        JmsConnectionFactory connectionFactory = new JmsConnectionFactory(uri);
         connectionFactory.setTopicPrefix("topic://");
         return new AMQPComponent(connectionFactory);
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/4997c2e9/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java b/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java
index 1b63ad8..e78e035 100644
--- a/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java
+++ b/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java
@@ -16,12 +16,11 @@
  */
 package org.apache.camel.component.amqp;
 
+import org.apache.activemq.broker.BrokerService;
 import org.apache.camel.CamelContext;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit4.CamelTestSupport;
-import org.apache.qpid.server.Broker;
-import org.apache.qpid.server.BrokerOptions;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -29,7 +28,7 @@ import static org.apache.camel.component.amqp.AMQPComponent.amqpComponent;
 
 public class AMQPRouteTest extends CamelTestSupport {
     protected MockEndpoint resultEndpoint;
-    protected Broker broker;
+    protected BrokerService broker;
     
     @Test
     public void testJmsRouteWithTextMessage() throws Exception {
@@ -45,13 +44,10 @@ public class AMQPRouteTest extends CamelTestSupport {
 
     @Before
     public void setUp() throws Exception {
-        BrokerOptions options = new BrokerOptions();
-        options.setConfigurationStoreType("memory");
-        options.setInitialConfigurationLocation("src/test/resources/config.json");
-        options.setLogConfigFileLocation("src/test/resources/log4j.xml");
-
-        broker = new Broker();
-        broker.startup(options);
+        broker = new BrokerService();
+        broker.setPersistent(false);
+        broker.addConnector("amqp://0.0.0.0:5672");
+        broker.start();
 
         super.setUp();
         resultEndpoint = context.getEndpoint("mock:result", MockEndpoint.class);
@@ -60,12 +56,12 @@ public class AMQPRouteTest extends CamelTestSupport {
     @Override
     public void tearDown() throws Exception {
         super.tearDown();
-        broker.shutdown();
+        broker.stop();
     }
 
     protected CamelContext createCamelContext() throws Exception {
         CamelContext camelContext = super.createCamelContext();
-        camelContext.addComponent("amqp1-0", amqpComponent("amqp://guest:guest@localhost:5672?remote-host=test", false));
+        camelContext.addComponent("amqp1-0", amqpComponent("amqp://localhost:5672", false));
         return camelContext;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/4997c2e9/components/camel-amqp/src/test/resources/config.json
----------------------------------------------------------------------
diff --git a/components/camel-amqp/src/test/resources/config.json b/components/camel-amqp/src/test/resources/config.json
deleted file mode 100644
index 915f325..0000000
--- a/components/camel-amqp/src/test/resources/config.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
-  "name": "Broker",
-  "defaultVirtualHost": "test",
-  "modelVersion": "1.0",
-  "storeVersion": 1,
-  "authenticationproviders": [
-    {
-      "name": "passwordFile",
-      "path": "src/test/resources/passwd",
-      "type": "PlainPasswordFile"
-    }
-  ],
-  "ports": [
-    {
-      "authenticationProvider": "passwordFile",
-      "name": "AMQP",
-      "port": "5672"
-    }
-  ],
-  "virtualhosts": [
-    {
-      "name": "test",
-      "type" : "VirtualHost",
-      "configPath": "src/test/resources/virtualhosts.xml"
-    }
-  ]
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/4997c2e9/components/camel-amqp/src/test/resources/log4j.xml
----------------------------------------------------------------------
diff --git a/components/camel-amqp/src/test/resources/log4j.xml b/components/camel-amqp/src/test/resources/log4j.xml
deleted file mode 100644
index 688a10b..0000000
--- a/components/camel-amqp/src/test/resources/log4j.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?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.
--->
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" >
-<log4j:configuration>
-  <appender name="stdout" class="org.apache.log4j.ConsoleAppender">
-    <layout class="org.apache.log4j.PatternLayout">
-      <param name="ConversionPattern" value="%d{ABSOLUTE}
-      %5p %c{1} - %m%n"/>
-    </layout>
-  </appender>
-  <appender name="file" class="org.apache.log4j.FileAppender">
-    <param name="file" value="target/camel-amqp-test.log"/>
-    <layout class="org.apache.log4j.PatternLayout">
-      <param name="ConversionPattern" value="%d{ABSOLUTE}
-      %5p %c{1} - %m%n"/>
-    </layout>
-  </appender>
-  <root>
-    <priority value="info"></priority>
-    <appender-ref ref="file"/>
-  </root>
-</log4j:configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/4997c2e9/components/camel-amqp/src/test/resources/passwd
----------------------------------------------------------------------
diff --git a/components/camel-amqp/src/test/resources/passwd b/components/camel-amqp/src/test/resources/passwd
deleted file mode 100644
index 99f0f05..0000000
--- a/components/camel-amqp/src/test/resources/passwd
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# 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.
-#
-guest:guest
-client:guest
-server:guest
-admin:admin
-

http://git-wip-us.apache.org/repos/asf/camel/blob/4997c2e9/components/camel-amqp/src/test/resources/virtualhosts.xml
----------------------------------------------------------------------
diff --git a/components/camel-amqp/src/test/resources/virtualhosts.xml b/components/camel-amqp/src/test/resources/virtualhosts.xml
deleted file mode 100644
index 091386b..0000000
--- a/components/camel-amqp/src/test/resources/virtualhosts.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-  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.
--->
-<virtualhosts>
-    <default>test</default>
-    <virtualhost>
-        <name>test</name>
-        <test>
-            <store>
-                <class>org.apache.qpid.server.store.MemoryMessageStore</class>
-            </store>
-            <queues>
-                <minimumAlertRepeatGap>30000</minimumAlertRepeatGap>
-                <maximumMessageCount>50</maximumMessageCount>
-                <queue>
-                    <name>queue</name>
-                    <queue>
-                        <exchange>amq.direct</exchange>
-                        <maximumQueueDepth>4235264</maximumQueueDepth>
-                        <!-- 4Mb -->
-                        <maximumMessageSize>2117632</maximumMessageSize>
-                        <!-- 2Mb -->
-                        <maximumMessageAge>600000</maximumMessageAge>
-                        <!-- 10 mins -->
-                    </queue>
-                </queue>
-                <queue>
-                    <name>ping</name>
-                    <ping>
-                        <exchange>amq.direct</exchange>
-                        <maximumQueueDepth>4235264</maximumQueueDepth>
-                        <!-- 4Mb -->
-                        <maximumMessageSize>2117632</maximumMessageSize>
-                        <!-- 2Mb -->
-                        <maximumMessageAge>600000</maximumMessageAge>
-                        <!-- 10 mins -->
-                    </ping>
-                </queue>
-            </queues>
-        </test>
-    </virtualhost>
-</virtualhosts>
-
-

http://git-wip-us.apache.org/repos/asf/camel/blob/4997c2e9/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 197db7c..8f4582c 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -415,6 +415,7 @@
     <protobuf-version>2.6.1</protobuf-version>
     <qpid-bundle-version>0.28_1</qpid-bundle-version>
     <qpid-version>0.28</qpid-version>
+    <qpid-jms-client-version>0.6.0</qpid-jms-client-version>
     <quartz-bundle-version>1.8.6_1</quartz-bundle-version>
     <quartz-version>1.8.6</quartz-version>
     <quartz-version-range>[1.8,2)</quartz-version-range>

http://git-wip-us.apache.org/repos/asf/camel/blob/4997c2e9/platforms/karaf/features/src/main/resources/features.xml
----------------------------------------------------------------------
diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml
index 5cb42b1..625957a 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -81,7 +81,9 @@
     <bundle dependency='true'>mvn:commons-lang/commons-lang/${commons-lang-version}</bundle>
     <bundle dependency='true'>mvn:commons-collections/commons-collections/${commons-collections-version}</bundle>
     <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.mina/${mina-bundle-version}</bundle>
-    <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.qpid/${qpid-bundle-version}</bundle>
+    <bundle dependency='true'>wrap:mvn:org.apache.qpid/qpid-jms-client/${qpid-jms-client-version}</bundle>
+    <bundle dependency='true'>wrap:mvn:org.apache.qpid/proton-j/0.10</bundle>
+    <bundle dependency='true'>wrap:mvn:io.netty/netty-all/4.0.17.Final</bundle>
     <feature version='${project.version}'>camel-jms</feature>
     <bundle>mvn:org.apache.camel/camel-amqp/${project.version}</bundle>
   </feature>