camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r831864 - in /camel/trunk/examples: camel-example-jms-file/src/main/resources/META-INF/spring/ camel-example-jms-file/src/test/java/org/apache/camel/example/jmstofile/ camel-example-loan-broker/ camel-example-loan-broker/src/test/java/org/a...
Date Mon, 02 Nov 2009 11:13:45 GMT
Author: ningjiang
Date: Mon Nov  2 11:13:44 2009
New Revision: 831864

URL: http://svn.apache.org/viewvc?rev=831864&view=rev
Log:
Polished the examples' test code

Modified:
    camel/trunk/examples/camel-example-jms-file/src/main/resources/META-INF/spring/camelContext.xml
    camel/trunk/examples/camel-example-jms-file/src/test/java/org/apache/camel/example/jmstofile/JmsToFileRouteTest.java
    camel/trunk/examples/camel-example-loan-broker/pom.xml
    camel/trunk/examples/camel-example-loan-broker/src/test/java/org/apache/camel/loanbroker/queue/version/LoanBrokerServerTest.java

Modified: camel/trunk/examples/camel-example-jms-file/src/main/resources/META-INF/spring/camelContext.xml
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-jms-file/src/main/resources/META-INF/spring/camelContext.xml?rev=831864&r1=831863&r2=831864&view=diff
==============================================================================
--- camel/trunk/examples/camel-example-jms-file/src/main/resources/META-INF/spring/camelContext.xml
(original)
+++ camel/trunk/examples/camel-example-jms-file/src/main/resources/META-INF/spring/camelContext.xml
Mon Nov  2 11:13:44 2009
@@ -26,7 +26,7 @@
        http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core-5.3.0.xsd">
     
     <!-- lets configure the ActiveMQ JMS broker server to listen on TCP 51616 -->
-    <broker:broker useJmx="false" persistent="false" brokerName="localhost">
+    <broker:broker id="broker" useJmx="false" persistent="false" brokerName="localhost">
         <broker:transportConnectors>
             <broker:transportConnector name="tcp" uri="tcp://localhost:51616"/>
         </broker:transportConnectors>
@@ -39,7 +39,7 @@
     
     <bean id="jmsToFileRoute" class="org.apache.camel.example.jmstofile.JmsToFileRoute"/>
     
-    <camel:camelContext>
+    <camel:camelContext id="camelContext">
        <camel:routeBuilder ref="jmsToFileRoute"/>
     </camel:camelContext>
 

Modified: camel/trunk/examples/camel-example-jms-file/src/test/java/org/apache/camel/example/jmstofile/JmsToFileRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-jms-file/src/test/java/org/apache/camel/example/jmstofile/JmsToFileRouteTest.java?rev=831864&r1=831863&r2=831864&view=diff
==============================================================================
--- camel/trunk/examples/camel-example-jms-file/src/test/java/org/apache/camel/example/jmstofile/JmsToFileRouteTest.java
(original)
+++ camel/trunk/examples/camel-example-jms-file/src/test/java/org/apache/camel/example/jmstofile/JmsToFileRouteTest.java
Mon Nov  2 11:13:44 2009
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.example.jmstofile;
 
+import org.apache.camel.CamelContext;
 import org.junit.Assert;
 import org.junit.Test;
 import org.springframework.context.support.AbstractApplicationContext;
@@ -24,11 +25,13 @@
 public class JmsToFileRouteTest extends Assert {
     
     @Test
-    public void startRoute() throws InterruptedException {
+    public void startRoute() throws Exception {
         AbstractApplicationContext applicationContext =
             new ClassPathXmlApplicationContext(new String[]{"/META-INF/spring/camelContext.xml"});
-        
-        Thread.sleep(2000);
+        CamelContext camelContext = (CamelContext)applicationContext.getBean("camelContext");
+        assertNotNull("The camel context should not be null", camelContext);
+        Thread.sleep(2000);        
+        camelContext.stop();
         applicationContext.stop();
     }
 

Modified: camel/trunk/examples/camel-example-loan-broker/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-loan-broker/pom.xml?rev=831864&r1=831863&r2=831864&view=diff
==============================================================================
--- camel/trunk/examples/camel-example-loan-broker/pom.xml (original)
+++ camel/trunk/examples/camel-example-loan-broker/pom.xml Mon Nov  2 11:13:44 2009
@@ -50,6 +50,12 @@
     <dependency>
       <groupId>org.apache.camel</groupId>
       <artifactId>camel-cxf</artifactId>
+      <exclusions>
+        <exclusion>
+      	  <groupId>org.slf4j</groupId>
+      	  <artifactId>slf4j-jdk14</artifactId>
+      	</exclusion>
+      </exclusions>
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>

Modified: camel/trunk/examples/camel-example-loan-broker/src/test/java/org/apache/camel/loanbroker/queue/version/LoanBrokerServerTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-loan-broker/src/test/java/org/apache/camel/loanbroker/queue/version/LoanBrokerServerTest.java?rev=831864&r1=831863&r2=831864&view=diff
==============================================================================
--- camel/trunk/examples/camel-example-loan-broker/src/test/java/org/apache/camel/loanbroker/queue/version/LoanBrokerServerTest.java
(original)
+++ camel/trunk/examples/camel-example-loan-broker/src/test/java/org/apache/camel/loanbroker/queue/version/LoanBrokerServerTest.java
Mon Nov  2 11:13:44 2009
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.loanbroker.queue.version;
 
+import org.apache.camel.CamelContext;
 import org.junit.Assert;
 import org.junit.Test;
 import org.springframework.context.support.AbstractApplicationContext;
@@ -25,10 +26,13 @@
     
     @Test
     public void startLoanBroker() throws Exception {
-        AbstractApplicationContext context = 
+        AbstractApplicationContext applicationContext = 
             new ClassPathXmlApplicationContext(new String[]{"/META-INF/spring/queueCamelContext.xml"});
-        Thread.sleep(4000);
-        context.start();        
+        CamelContext camelContext = (CamelContext)applicationContext.getBean("camelContext");
+        assertNotNull("The camel context should not be null", camelContext);
+        Thread.sleep(2000);        
+        camelContext.stop();
+        applicationContext.stop();        
     }
 
 }



Mime
View raw message