camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1163963 - in /camel/trunk: components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/ tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/ tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/os...
Date Thu, 01 Sep 2011 09:29:23 GMT
Author: ningjiang
Date: Thu Sep  1 09:29:22 2011
New Revision: 1163963

URL: http://svn.apache.org/viewvc?rev=1163963&view=rev
Log:
CAMEL-4402 OsgiCamelContextPublisher should publish the camel context with the camelName

Modified:
    camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextPublisher.java
    camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/OSGiBlueprintHelloWorldTest.java
    camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-13.xml

Modified: camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextPublisher.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextPublisher.java?rev=1163963&r1=1163962&r2=1163963&view=diff
==============================================================================
--- camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextPublisher.java
(original)
+++ camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextPublisher.java
Thu Sep  1 09:29:22 2011
@@ -40,6 +40,7 @@ public class OsgiCamelContextPublisher e
 
     public static final String CONTEXT_SYMBOLIC_NAME_PROPERTY = "camel.context.symbolicname";
     public static final String CONTEXT_VERSION_PROPERTY = "camel.context.version";
+    public static final String CONTEXT_NAME_PROPERTY = "camel.context.name";
 
     private final BundleContext bundleContext;
     private final Map<CamelContext, ServiceRegistration> registrations = new ConcurrentHashMap<CamelContext,
ServiceRegistration>();
@@ -55,10 +56,10 @@ public class OsgiCamelContextPublisher e
             Properties props = new Properties();
             props.put(CONTEXT_SYMBOLIC_NAME_PROPERTY, bundleContext.getBundle().getSymbolicName());
             props.put(CONTEXT_VERSION_PROPERTY, getBundleVersion(bundleContext.getBundle()));
+            props.put(CONTEXT_NAME_PROPERTY, context.getName());
+
+            log.debug("Registering CamelContext [{}] of in OSGi registry", props);
 
-            if (log.isDebugEnabled()) {
-                log.debug("Registering CamelContext [{}] in OSGi registry", context.getName());
-            }
             ServiceRegistration reg = bundleContext.registerService(CamelContext.class.getName(),
context, props);
             registrations.put(context, reg);
         } else if (event instanceof CamelContextStoppingEvent) {

Modified: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/OSGiBlueprintHelloWorldTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/OSGiBlueprintHelloWorldTest.java?rev=1163963&r1=1163962&r2=1163963&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/OSGiBlueprintHelloWorldTest.java
(original)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/OSGiBlueprintHelloWorldTest.java
Thu Sep  1 09:29:22 2011
@@ -51,7 +51,8 @@ public class OSGiBlueprintHelloWorldTest
         getInstalledBundle(name).start();
 
         // must use the camel context from osgi
-        CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname="
+ name + ")", 10000);
+        CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname="
+ name + ")"
+                + "&&(camel.context.name=camel1)", 10000);
 
         ProducerTemplate myTemplate = ctx.createProducerTemplate();
         myTemplate.start();

Modified: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-13.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-13.xml?rev=1163963&r1=1163962&r2=1163963&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-13.xml
(original)
+++ camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-13.xml
Thu Sep  1 09:29:22 2011
@@ -18,11 +18,18 @@
 <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
            xmlns:camel="http://camel.apache.org/schema/blueprint">
 
-    <camel:camelContext>
+    <camel:camelContext id="camel1">
         <camel:route>
             <camel:from uri="file:target/foo"/>
             <camel:to uri="mock:result"/>
         </camel:route>
     </camel:camelContext>
 
+    <camel:camelContext id="camel2">
+        <camel:route>
+            <camel:from uri="direct:start"/>
+            <camel:to uri="mock:end"/>
+        </camel:route>
+    </camel:camelContext>
+
 </blueprint>



Mime
View raw message