activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject activemq git commit: https://issues.apache.org/jira/browse/AMQ-4727 - use OsgiBundleXmlApplicationContext from service factory so that an embedded camel route can find a required bundlecontext
Date Mon, 26 Jan 2015 15:40:17 GMT
Repository: activemq
Updated Branches:
  refs/heads/trunk a620b403f -> 3a6d67e8f


https://issues.apache.org/jira/browse/AMQ-4727 - use OsgiBundleXmlApplicationContext from
service factory so that an embedded camel route can find a required bundlecontext


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/3a6d67e8
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/3a6d67e8
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/3a6d67e8

Branch: refs/heads/trunk
Commit: 3a6d67e8f95320bea91b7c7106173c9b34773bc5
Parents: a620b40
Author: gtully <gary.tully@gmail.com>
Authored: Mon Jan 26 15:39:04 2015 +0000
Committer: gtully <gary.tully@gmail.com>
Committed: Mon Jan 26 15:39:04 2015 +0000

----------------------------------------------------------------------
 .../itest/ActiveMQBrokerNdCamelFeatureTest.java |  1 -
 ...ctiveMQBrokerNdExternalCamelFeatureTest.java |  1 +
 .../src/main/resources/features-core.xml        |  1 +
 activemq-osgi/pom.xml                           | 24 ++++++++++++++++++++
 .../activemq/osgi/ActiveMQServiceFactory.java   |  6 +++--
 5 files changed, 30 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/3a6d67e8/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerNdCamelFeatureTest.java
----------------------------------------------------------------------
diff --git a/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerNdCamelFeatureTest.java
b/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerNdCamelFeatureTest.java
index a9a0d66..45993b5 100644
--- a/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerNdCamelFeatureTest.java
+++ b/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerNdCamelFeatureTest.java
@@ -44,7 +44,6 @@ public class ActiveMQBrokerNdCamelFeatureTest extends AbstractJmsFeatureTest
{
                 configure("activemq"));
     }
 
-    @Ignore("java.lang.IllegalArgumentException: BundleContext must be specified - needs
investigation")
     @Test(timeout = 2 * 60 * 1000)
     public void test() throws Throwable {
         System.err.println(executeCommand("osgi:list").trim());

http://git-wip-us.apache.org/repos/asf/activemq/blob/3a6d67e8/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerNdExternalCamelFeatureTest.java
----------------------------------------------------------------------
diff --git a/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerNdExternalCamelFeatureTest.java
b/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerNdExternalCamelFeatureTest.java
index 615da95..4cbe10c 100644
--- a/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerNdExternalCamelFeatureTest.java
+++ b/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerNdExternalCamelFeatureTest.java
@@ -50,6 +50,7 @@ public class ActiveMQBrokerNdExternalCamelFeatureTest extends AbstractJmsFeature
 
         assertFeatureInstalled("activemq");
         executeCommand("features:addurl " + getCamelFeatureUrl());
+        installAndAssertFeature("camel");
         installAndAssertFeature("activemq-camel");
 
         withinReason(new Callable<Boolean>() {

http://git-wip-us.apache.org/repos/asf/activemq/blob/3a6d67e8/activemq-karaf/src/main/resources/features-core.xml
----------------------------------------------------------------------
diff --git a/activemq-karaf/src/main/resources/features-core.xml b/activemq-karaf/src/main/resources/features-core.xml
index 16dc95d..6a688b6 100644
--- a/activemq-karaf/src/main/resources/features-core.xml
+++ b/activemq-karaf/src/main/resources/features-core.xml
@@ -23,6 +23,7 @@
     <!-- Bundles needed if only client will be deployed in the container -->
     <feature name="activemq-client" description="ActiveMQ client libraries" version="${project.version}"
resolver="(obr)" start-level="50">
         <feature version="[3.2,4)">spring</feature>
+        <feature>spring-dm</feature>
         <bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-annotation_1.0_spec/1.1.1</bundle>
         <bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
         <bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-jms_1.1_spec/1.1.1</bundle>

http://git-wip-us.apache.org/repos/asf/activemq/blob/3a6d67e8/activemq-osgi/pom.xml
----------------------------------------------------------------------
diff --git a/activemq-osgi/pom.xml b/activemq-osgi/pom.xml
index 74be454..705b93f 100644
--- a/activemq-osgi/pom.xml
+++ b/activemq-osgi/pom.xml
@@ -62,6 +62,7 @@
       org.xmlpull*;resolution:=optional,
       scala*;resolution:=optional,
       org.springframework*;version="[3,4]";resolution:=optional,
+      org.springframework.osgi*;version="[1,4]";resolution:=optional,
       org.apache.xbean.spring*;resolution:=optional,
       javax.annotation*,
       javax.jms*,
@@ -168,6 +169,29 @@
     </dependency>
 
     <dependency>
+      <groupId>org.springframework.osgi</groupId>
+      <artifactId>spring-osgi-core</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>org.springframework</groupId>
+          <artifactId>org.springframework.aop</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.springframework</groupId>
+          <artifactId>org.springframework.beans</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.springframework</groupId>
+          <artifactId>org.springframework.context</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.springframework</groupId>
+          <artifactId>org.springframework.core</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+
+    <dependency>
       <groupId>${project.groupId}</groupId>
       <artifactId>activemq-runtime-config</artifactId>
     </dependency>

http://git-wip-us.apache.org/repos/asf/activemq/blob/3a6d67e8/activemq-osgi/src/main/java/org/apache/activemq/osgi/ActiveMQServiceFactory.java
----------------------------------------------------------------------
diff --git a/activemq-osgi/src/main/java/org/apache/activemq/osgi/ActiveMQServiceFactory.java
b/activemq-osgi/src/main/java/org/apache/activemq/osgi/ActiveMQServiceFactory.java
index 430a300..5e49dfa 100644
--- a/activemq-osgi/src/main/java/org/apache/activemq/osgi/ActiveMQServiceFactory.java
+++ b/activemq-osgi/src/main/java/org/apache/activemq/osgi/ActiveMQServiceFactory.java
@@ -26,7 +26,6 @@ import java.util.Properties;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.spring.SpringBrokerContext;
 import org.apache.activemq.spring.Utils;
-import org.apache.xbean.spring.context.ResourceXmlApplicationContext;
 import org.osgi.framework.BundleContext;
 import org.osgi.service.cm.ConfigurationException;
 import org.osgi.service.cm.ManagedServiceFactory;
@@ -35,6 +34,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
 import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.core.io.Resource;
+import org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext;
 
 public class ActiveMQServiceFactory implements ManagedServiceFactory {
 
@@ -74,12 +74,14 @@ public class ActiveMQServiceFactory implements ManagedServiceFactory {
             Thread.currentThread().setContextClassLoader(BrokerService.class.getClassLoader());
             Resource resource = Utils.resourceFromString(config);
 
-            ResourceXmlApplicationContext ctx = new ResourceXmlApplicationContext(resource,
Collections.EMPTY_LIST, null, Collections.EMPTY_LIST, false) {
+            // when camel is embedded it needs a bundle context
+            OsgiBundleXmlApplicationContext ctx = new OsgiBundleXmlApplicationContext(new
String[]{resource.getURL().toExternalForm()}) {
                 @Override
                 protected void initBeanDefinitionReader(XmlBeanDefinitionReader reader) {
                     reader.setValidating(false);
                 }
             };
+            ctx.setBundleContext(bundleContext);
 
             // Handle properties in configuration
             PropertyPlaceholderConfigurer configurator = new PropertyPlaceholderConfigurer();


Mime
View raw message