Author: gertv
Date: Tue Feb 12 08:41:37 2008
New Revision: 620857

URL: http://svn.apache.org/viewvc?rev=620857&view=rev
Log:
SM-1191: Couldn't deploy >1 separate servicemix-camel service-units

Modified:
    
servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/CamelSpringDeployer.java
    
servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/NonJbiCamelEndpointsIntegrationTest.java

Modified: 
servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/CamelSpringDeployer.java
URL: 
http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/CamelSpringDeployer.java?rev=620857&r1=620856&r2=620857&view=diff
==============================================================================
--- 
servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/CamelSpringDeployer.java
 (original)
+++ 
servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/CamelSpringDeployer.java
 Tue Feb 12 08:41:37 2008
@@ -47,12 +47,14 @@
         @Override
         protected AbstractXmlApplicationContext 
createXmlApplicationContext(String configLocation) {
             ApplicationContext parentAppContext = 
createParentApplicationContext(getXmlPreprocessors());
-            return new FileSystemXmlApplicationContext(new 
String[]{configLocation}, false, parentAppContext, getXmlPreprocessors());
+            return new FileSystemXmlApplicationContext(new String[] 
{configLocation}, false, parentAppContext, getXmlPreprocessors());
         }
     };
 
     private List<CamelJbiEndpoint> activatedEndpoints = new 
ArrayList<CamelJbiEndpoint>();
 
+    private String serviceUnitName;
+
     public CamelSpringDeployer(CamelJbiComponent component) {
         super(component);
         this.component = component;
@@ -70,13 +72,15 @@
      *      java.lang.String)
      */
     @Override
-    public ServiceUnit deploy(String serviceUnitName, String 
serviceUnitRootPath) throws DeploymentException {
+    public ServiceUnit deploy(String suName, String serviceUnitRootPath) 
throws DeploymentException {
         // lets register the deployer so that any endpoints activated are added
         // to this SU
         component.deployer = this;
 
+        this.serviceUnitName = suName;
+
         // lets install the context class loader
-        ServiceUnit serviceUnit = super.deploy(serviceUnitName, 
serviceUnitRootPath);
+        ServiceUnit serviceUnit = super.deploy(suName, serviceUnitRootPath);
         
Thread.currentThread().setContextClassLoader(serviceUnit.getConfigurationClassLoader());
         return serviceUnit;
     }
@@ -105,9 +109,10 @@
 
             // lets add a control bus endpoint to ensure we have at least one 
endpoint to deploy
             BeanComponent beanComponent = camelContext.getComponent("bean", 
BeanComponent.class);
-            Endpoint endpoint = beanComponent.createEndpoint(new 
CamelControlBus(camelContext), "camel:controlBus");
+            Endpoint endpoint = beanComponent.createEndpoint(new 
CamelControlBus(camelContext),
+                                                             "camel:" + 
serviceUnitName + "-controlBus");
             services.add(component.createJbiEndpointFromCamel(endpoint));
-            
+
             return services;
         } catch (Exception e) {
             throw new RuntimeException(e);

Modified: 
servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/NonJbiCamelEndpointsIntegrationTest.java
URL: 
http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/NonJbiCamelEndpointsIntegrationTest.java?rev=620857&r1=620856&r2=620857&view=diff
==============================================================================
--- 
servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/NonJbiCamelEndpointsIntegrationTest.java
 (original)
+++ 
servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/NonJbiCamelEndpointsIntegrationTest.java
 Tue Feb 12 08:41:37 2008
@@ -148,7 +148,7 @@
     protected void configureExchange(ServiceMixClient client,
             MessageExchange exchange) {
         ServiceEndpoint endpoint = client.getContext().getEndpoint(
-                CamelJbiEndpoint.SERVICE_NAME, "camel:controlBus");
+                CamelJbiEndpoint.SERVICE_NAME, "camel:su1-controlBus");
         assertNotNull("Should have a Camel endpoint exposed in JBI!", 
endpoint);
         exchange.setEndpoint(endpoint);
     }


Reply via email to