You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2012/01/24 14:21:23 UTC

svn commit: r1235242 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/impl/ components/camel-test/src/main/java/org/apache/camel/test/ components/camel-test/src/main/java/org/apache/camel/test/junit4/ components/camel-testng/src/main/java/o...

Author: davsclaus
Date: Tue Jan 24 13:21:23 2012
New Revision: 1235242

URL: http://svn.apache.org/viewvc?rev=1235242&view=rev
Log:
CAMEL-4934: Moved CamelBeanPostProcessor from camel-spring to camel-core, to make it reusable by others. Ensure CamelTestSupport and camel-test-blueprint can run and do Camel @EndpointInjection without Spring JARs on classpath.

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelBeanPostProcessor.java
    camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/CamelSpringTestSupport.java
    camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/CamelTestSupport.java
    camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelSpringTestSupport.java
    camel/trunk/components/camel-testng/src/main/java/org/apache/camel/testng/CamelSpringTestSupport.java
    camel/trunk/components/camel-testng/src/main/java/org/apache/camel/testng/CamelTestSupport.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelBeanPostProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelBeanPostProcessor.java?rev=1235242&r1=1235241&r2=1235242&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelBeanPostProcessor.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelBeanPostProcessor.java Tue Jan 24 13:21:23 2012
@@ -46,7 +46,7 @@ import org.slf4j.LoggerFactory;
  */
 public class DefaultCamelBeanPostProcessor {
 
-    protected final transient Logger log = LoggerFactory.getLogger(getClass());
+    protected static final transient Logger LOG = LoggerFactory.getLogger(DefaultCamelBeanPostProcessor.class);
     protected CamelPostProcessorHelper camelPostProcessorHelper;
     protected CamelContext camelContext;
 
@@ -70,7 +70,7 @@ public class DefaultCamelBeanPostProcess
      * @throws Exception is thrown if error post processing bean
      */
     public Object postProcessBeforeInitialization(Object bean, String beanName) throws Exception {
-        log.trace("Camel bean processing before initialization for bean: {}", beanName);
+        LOG.trace("Camel bean processing before initialization for bean: {}", beanName);
 
         // some beans cannot be post processed at this given time, so we gotta check beforehand
         if (!canPostProcessBean(bean, beanName)) {
@@ -84,7 +84,7 @@ public class DefaultCamelBeanPostProcess
             CamelContextAware contextAware = (CamelContextAware)bean;
             CamelContext context = getOrLookupCamelContext();
             if (context == null) {
-                log.warn("No CamelContext defined yet so cannot inject into bean: " + beanName);
+                LOG.warn("No CamelContext defined yet so cannot inject into bean: " + beanName);
             } else {
                 contextAware.setCamelContext(context);
             }
@@ -106,7 +106,7 @@ public class DefaultCamelBeanPostProcess
      * @throws Exception is thrown if error post processing bean
      */
     public Object postProcessAfterInitialization(Object bean, String beanName) throws Exception {
-        log.trace("Camel bean processing after initialization for bean: {}", beanName);
+        LOG.trace("Camel bean processing after initialization for bean: {}", beanName);
 
         // some beans cannot be post processed at this given time, so we gotta check beforehand
         if (!canPostProcessBean(bean, beanName)) {
@@ -147,7 +147,7 @@ public class DefaultCamelBeanPostProcess
             CamelContextAware camelContextAware = (CamelContextAware) bean;
             CamelContext context = camelContextAware.getCamelContext();
             if (context != null) {
-                log.trace("CamelContext already set on bean with id [{}]. Will keep existing CamelContext on bean.", beanName);
+                LOG.trace("CamelContext already set on bean with id [{}]. Will keep existing CamelContext on bean.", beanName);
                 return false;
             }
         }
@@ -207,7 +207,7 @@ public class DefaultCamelBeanPostProcess
         Class<?>[] parameterTypes = method.getParameterTypes();
         if (parameterTypes != null) {
             if (parameterTypes.length != 1) {
-                log.warn("Ignoring badly annotated method for injection due to incorrect number of parameters: " + method);
+                LOG.warn("Ignoring badly annotated method for injection due to incorrect number of parameters: " + method);
             } else {
                 String propertyName = ObjectHelper.getPropertyName(method);
                 Object value = getPostProcessorHelper().getInjectionValue(parameterTypes[0], endpointUri, endpointRef, propertyName, bean, beanName);

Modified: camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/CamelSpringTestSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/CamelSpringTestSupport.java?rev=1235242&r1=1235241&r2=1235242&view=diff
==============================================================================
--- camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/CamelSpringTestSupport.java (original)
+++ camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/CamelSpringTestSupport.java Tue Jan 24 13:21:23 2012
@@ -71,7 +71,8 @@ public abstract class CamelSpringTestSup
         CamelBeanPostProcessor processor = new CamelBeanPostProcessor();
         processor.setApplicationContext(applicationContext);
         processor.setCamelContext(context);
-        processor.postProcessBeforeInitialization(this, "this");
+        processor.postProcessBeforeInitialization(this, getClass().getName());
+        processor.postProcessAfterInitialization(this, getClass().getName());
     }
 
     @SuppressWarnings("unchecked")

Modified: camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/CamelTestSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/CamelTestSupport.java?rev=1235242&r1=1235241&r2=1235242&view=diff
==============================================================================
--- camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/CamelTestSupport.java (original)
+++ camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/CamelTestSupport.java Tue Jan 24 13:21:23 2012
@@ -248,7 +248,8 @@ public abstract class CamelTestSupport e
     protected void postProcessTest() throws Exception {
         // use the default bean post processor from camel-core
         DefaultCamelBeanPostProcessor processor = new DefaultCamelBeanPostProcessor(context);
-        processor.postProcessBeforeInitialization(this, "this");
+        processor.postProcessBeforeInitialization(this, getClass().getName());
+        processor.postProcessAfterInitialization(this, getClass().getName());
     }
 
     protected void stopCamelContext() throws Exception {

Modified: camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelSpringTestSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelSpringTestSupport.java?rev=1235242&r1=1235241&r2=1235242&view=diff
==============================================================================
--- camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelSpringTestSupport.java (original)
+++ camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelSpringTestSupport.java Tue Jan 24 13:21:23 2012
@@ -64,7 +64,8 @@ public abstract class CamelSpringTestSup
         CamelBeanPostProcessor processor = new CamelBeanPostProcessor();
         processor.setApplicationContext(applicationContext);
         processor.setCamelContext(context);
-        processor.postProcessBeforeInitialization(this, "this");
+        processor.postProcessBeforeInitialization(this, getClass().getName());
+        processor.postProcessAfterInitialization(this, getClass().getName());
     }
 
     @Override

Modified: camel/trunk/components/camel-testng/src/main/java/org/apache/camel/testng/CamelSpringTestSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-testng/src/main/java/org/apache/camel/testng/CamelSpringTestSupport.java?rev=1235242&r1=1235241&r2=1235242&view=diff
==============================================================================
--- camel/trunk/components/camel-testng/src/main/java/org/apache/camel/testng/CamelSpringTestSupport.java (original)
+++ camel/trunk/components/camel-testng/src/main/java/org/apache/camel/testng/CamelSpringTestSupport.java Tue Jan 24 13:21:23 2012
@@ -55,7 +55,8 @@ public abstract class CamelSpringTestSup
         CamelBeanPostProcessor processor = new CamelBeanPostProcessor();
         processor.setApplicationContext(applicationContext);
         processor.setCamelContext(context);
-        processor.postProcessBeforeInitialization(this, "this");
+        processor.postProcessBeforeInitialization(this, getClass().getName());
+        processor.postProcessAfterInitialization(this, getClass().getName());
     }
 
     @Override

Modified: camel/trunk/components/camel-testng/src/main/java/org/apache/camel/testng/CamelTestSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-testng/src/main/java/org/apache/camel/testng/CamelTestSupport.java?rev=1235242&r1=1235241&r2=1235242&view=diff
==============================================================================
--- camel/trunk/components/camel-testng/src/main/java/org/apache/camel/testng/CamelTestSupport.java (original)
+++ camel/trunk/components/camel-testng/src/main/java/org/apache/camel/testng/CamelTestSupport.java Tue Jan 24 13:21:23 2012
@@ -359,7 +359,8 @@ public abstract class CamelTestSupport e
 
         // use the default bean post processor from camel-core
         DefaultCamelBeanPostProcessor processor = new DefaultCamelBeanPostProcessor(context);
-        processor.postProcessBeforeInitialization(this, "this");
+        processor.postProcessBeforeInitialization(this, getClass().getName());
+        processor.postProcessAfterInitialization(this, getClass().getName());
     }
 
     protected void stopCamelContext() throws Exception {