camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r735955 - in /camel/trunk/components/camel-cxf/src: main/java/org/apache/camel/component/cxf/ main/java/org/apache/camel/component/cxf/spring/ main/java/org/apache/camel/component/cxf/transport/ test/java/org/apache/camel/component/cxf/ tes...
Date Tue, 20 Jan 2009 07:36:24 GMT
Author: ningjiang
Date: Mon Jan 19 23:36:23 2009
New Revision: 735955

URL: http://svn.apache.org/viewvc?rev=735955&view=rev
Log:
CAMEL-1275 get the CamelEndpointSpringConfigureTest work in Camel trunk

Modified:
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java
    camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java
    camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstTest.java
    camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java
    camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsWithSpringTest.java

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java?rev=735955&r1=735954&r2=735955&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
(original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
Mon Jan 19 23:36:23 2009
@@ -114,4 +114,7 @@
         super.doStop();
     }
     
+    public Server getServer() {
+        return server;
+    }
 }

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java?rev=735955&r1=735954&r2=735955&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
(original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
Mon Jan 19 23:36:23 2009
@@ -176,7 +176,7 @@
     }
 
     protected Bus doGetBus() {
-        return BusFactory.getThreadDefaultBus();
+        return BusFactory.getDefaultBus();
     }
     
     /**
@@ -372,12 +372,12 @@
         if (bus == null) {
             bus = doGetBus();
             if (LOG.isDebugEnabled()) {
-                LOG.debug("Using ThreadDefaultBus " + bus);
+                LOG.debug("Using DefaultBus " + bus);
             }
         }
         
         if (!getBusHasBeenCalled.getAndSet(true) && isSetDefaultBus) {
-            BusFactory.setThreadDefaultBus(bus);
+            BusFactory.setDefaultBus(bus);
             if (LOG.isDebugEnabled()) {
                 LOG.debug("Set bus " + bus + " as thread default bus");
             }

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java?rev=735955&r1=735954&r2=735955&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
(original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
Mon Jan 19 23:36:23 2009
@@ -216,5 +216,9 @@
         }
         return answer;
     }
+    
+    public Client getClient() {
+        return client;
+    }
 
 }

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java?rev=735955&r1=735954&r2=735955&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java
(original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java
Mon Jan 19 23:36:23 2009
@@ -109,10 +109,10 @@
         
         public void setApplicationContext(ApplicationContext ctx) throws BeansException {
             if (getBus() == null) {
-                Bus bus = BusFactory.getThreadDefaultBus();
-                BusWiringBeanFactoryPostProcessor.updateBusReferencesInContext(bus, ctx);
+                Bus bus = BusFactory.getThreadDefaultBus();                
                 setBus(bus);
-            }            
+            }
+            BusWiringBeanFactoryPostProcessor.updateBusReferencesInContext(getBus(), ctx);
         }
         
     }

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java?rev=735955&r1=735954&r2=735955&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java
(original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java
Mon Jan 19 23:36:23 2009
@@ -86,6 +86,10 @@
     }
 
     public CamelContext getCamelContext() {
+        if (camelContext == null) {
+            getLogger().log(Level.INFO, "No CamelContext injected, create a default one");
+            camelContext = new DefaultCamelContext();
+        }
         return camelContext;
     }
 
@@ -122,9 +126,8 @@
     }
 
     public ProducerTemplate getCamelTemplate() {
-        if (camelTemplate == null) {
-            CamelContext ctx = camelContext != null ? camelContext : new DefaultCamelContext();
-            camelTemplate = ctx.createProducerTemplate();
+        if (camelTemplate == null) {            
+            camelTemplate = getCamelContext().createProducerTemplate();
         }
         return camelTemplate;
     }

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java?rev=735955&r1=735954&r2=735955&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java
(original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java
Mon Jan 19 23:36:23 2009
@@ -122,9 +122,8 @@
     }
 
     public ProducerTemplate getCamelTemplate() {
-        if (camelTemplate == null) {
-            CamelContext ctx = camelContext != null ? camelContext : new DefaultCamelContext();
-            camelTemplate = ctx.createProducerTemplate();
+        if (camelTemplate == null) {            
+            camelTemplate = getCamelContext().createProducerTemplate();
         }
         return camelTemplate;
     }
@@ -138,6 +137,10 @@
     }
 
     public CamelContext getCamelContext() {
+        if (camelContext == null) {
+            getLogger().log(Level.INFO, "No CamelContext injected, create a default one");
+            camelContext = new DefaultCamelContext();
+        }
         return camelContext;
     }
 

Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java?rev=735955&r1=735954&r2=735955&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java
(original)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java
Mon Jan 19 23:36:23 2009
@@ -32,6 +32,7 @@
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.cxf.BusFactory;
 import org.apache.cxf.bus.CXFBusFactory;
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.ServerImpl;
@@ -83,6 +84,7 @@
         if (jaxwsEndpoint != null) {
             jaxwsEndpoint.stop();
         }
+        BusFactory.setDefaultBus(null);
     }
 
 

Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstTest.java?rev=735955&r1=735954&r2=735955&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstTest.java
(original)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstTest.java
Mon Jan 19 23:36:23 2009
@@ -35,6 +35,7 @@
 import org.apache.camel.wsdl_first.PersonImpl;
 import org.apache.camel.wsdl_first.PersonService;
 import org.apache.camel.wsdl_first.UnknownPersonFault;
+import org.apache.cxf.BusFactory;
 import org.apache.cxf.endpoint.ServerImpl;
 import org.apache.cxf.jaxws.EndpointImpl;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
@@ -71,8 +72,9 @@
     protected void tearDown() throws Exception {
         if (server != null) {
             server.stop();
-        }
+        }        
         super.tearDown();
+        BusFactory.setDefaultBus(null);
     }
 
     protected RouteBuilder createRouteBuilder() {

Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java?rev=735955&r1=735954&r2=735955&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java
(original)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java
Mon Jan 19 23:36:23 2009
@@ -26,6 +26,7 @@
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.component.cxf.CxfConstants;
+import org.apache.cxf.BusFactory;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
 
@@ -37,6 +38,7 @@
 
     protected void tearDown() throws Exception {
         ctx.close();
+        BusFactory.setDefaultBus(null);
     }
 
     public void testCxfEndpointBeanDefinitionParser() {

Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsWithSpringTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsWithSpringTest.java?rev=735955&r1=735954&r2=735955&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsWithSpringTest.java
(original)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsWithSpringTest.java
Mon Jan 19 23:36:23 2009
@@ -23,6 +23,7 @@
 import org.apache.camel.component.cxf.CxfSpringEndpoint;
 import org.apache.camel.component.cxf.DataFormat;
 import org.apache.camel.spring.SpringCamelContext;
+import org.apache.cxf.BusFactory;
 import org.springframework.context.support.AbstractXmlApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
@@ -43,6 +44,7 @@
             applicationContext.destroy();
         }
         super.tearDown();
+        BusFactory.setDefaultBus(null);
     }
 
     @Override



Mime
View raw message