You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2009/08/03 10:15:59 UTC

svn commit: r800247 - in /camel/trunk/components/camel-spring/src/test: java/org/apache/camel/spring/CamelContextAwareTest.java resources/org/apache/camel/spring/camelContextAwareBean.xml

Author: ningjiang
Date: Mon Aug  3 08:15:59 2009
New Revision: 800247

URL: http://svn.apache.org/viewvc?rev=800247&view=rev
Log:
Add unit test to demo the BeanPostProcssor's bug

Modified:
    camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/CamelContextAwareTest.java
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/camelContextAwareBean.xml

Modified: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/CamelContextAwareTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/CamelContextAwareTest.java?rev=800247&r1=800246&r2=800247&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/CamelContextAwareTest.java (original)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/CamelContextAwareTest.java Mon Aug  3 08:15:59 2009
@@ -18,6 +18,8 @@
 
 import java.util.Map;
 
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.impl.DefaultProducerTemplate;
 import org.springframework.context.support.AbstractXmlApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
@@ -32,7 +34,13 @@
         Map<String, String> properties  = bean.getCamelContext().getProperties();
         assertNotNull("the properties should not been null", properties);
         assertEquals("No properties injected", properties.size(), 1);
-        assertEquals("Should get the value of org.apache.camel.test", properties.get("org.apache.camel.test"), "this is a test");
+        assertEquals("Should get the value of org.apache.camel.test", properties.get("org.apache.camel.test"), "this is a test second");
+    }
+    
+    public void testCamelTemplates() throws Exception {
+        DefaultProducerTemplate producer1 = getMandatoryBean(DefaultProducerTemplate.class, "producer1");
+        // The producer is injected with a wrong camel context
+        assertEquals("Inject a wrong camel context", producer1.getContext().getName(), "camel2");
     }
 
     @Override

Modified: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/camelContextAwareBean.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/camelContextAwareBean.xml?rev=800247&r1=800246&r2=800247&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/camelContextAwareBean.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/camelContextAwareBean.xml Mon Aug  3 08:15:59 2009
@@ -24,10 +24,19 @@
 
   <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
     <properties>
-       <property key="org.apache.camel.test" value="this is a test"/>
+       <property key="org.apache.camel.test" value="this is a test first"/>
     </properties>
-    <beanPostProcessor/>
+    <template id="producer1"/>
+  </camelContext>
+  
+  <camelContext id="camel2" xmlns="http://camel.apache.org/schema/spring">
+    <properties>
+       <property key="org.apache.camel.test" value="this is a test second"/>
+    </properties>
+    <template id="producer2"/>
   </camelContext>
 
   <bean id="bean" class="org.apache.camel.spring.CamelContextAwareBean"/>
+  
+  
 </beans>