svn commit: r614007 - in /activemq/camel/trunk/camel-core/src/test/java/org/apache/camel: ContextTestSupport.java ExchangeTestSupport.java model/XmlTestSupport.java

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r614007 - in /activemq/camel/trunk/camel-core/src/test/java/org/apache/camel: ContextTestSupport.java ExchangeTestSupport.java model/XmlTestSupport.java

romkal-2
Author: romkal
Date: Mon Jan 21 12:56:08 2008
New Revision: 614007

URL: http://svn.apache.org/viewvc?rev=614007&view=rev
Log:
ContextTestSupport supports many RouteBuilders to be tested
Tests without test methods made abstract so eclipse doesn't complain when executing them

Modified:
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/ContextTestSupport.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/ExchangeTestSupport.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/model/XmlTestSupport.java

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/ContextTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/ContextTestSupport.java?rev=614007&r1=614006&r2=614007&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/ContextTestSupport.java (original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/ContextTestSupport.java Mon Jan 21 12:56:08 2008
@@ -24,6 +24,7 @@
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.processor.CreateRouteWithNonExistingEndpointTest;
 import org.apache.camel.spi.Language;
 import org.apache.camel.util.jndi.JndiTest;
 
@@ -68,9 +69,11 @@
         template = new CamelTemplate<Exchange>(context);
 
         if (useRouteBuilder) {
-            RouteBuilder builder = createRouteBuilder();
-            log.debug("Using created route builder: " + builder);
-            context.addRoutes(builder);
+            RouteBuilder[] builders = createRouteBuilders();
+            for (RouteBuilder builder : builders) {
+                log.debug("Using created route builder: " + builder);
+                context.addRoutes(builder);
+            }
         }
         else {
             log.debug("Using route builder from the created context: " + context);
@@ -138,6 +141,16 @@
         };
     }
 
+    /**
+     * Factory method which derived classes can use to create an array of
+     * {@link RouteBuilder}s to define the routes for testing
+     *
+     * @see #createRouteBuilder()
+     */
+    protected RouteBuilder[] createRouteBuilders() throws Exception {
+        return new RouteBuilder[] {createRouteBuilder()};
+    }
+    
     /**
      * Resolves a mandatory endpoint for the given URI or an exception is thrown
      *

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/ExchangeTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/ExchangeTestSupport.java?rev=614007&r1=614006&r2=614007&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/ExchangeTestSupport.java (original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/ExchangeTestSupport.java Mon Jan 21 12:56:08 2008
@@ -25,7 +25,7 @@
  *
  * @version $Revision: 1.1 $
  */
-public class ExchangeTestSupport extends ContextTestSupport {
+public abstract class ExchangeTestSupport extends ContextTestSupport {
     protected Exchange exchange;
 
     /**

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/model/XmlTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/model/XmlTestSupport.java?rev=614007&r1=614006&r2=614007&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/model/XmlTestSupport.java (original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/model/XmlTestSupport.java Mon Jan 21 12:56:08 2008
@@ -29,7 +29,7 @@
 /**
  * @version $Revision: 1.1 $
  */
-public class XmlTestSupport extends TestSupport {
+public abstract class XmlTestSupport extends TestSupport {
     protected final transient Log log = LogFactory.getLog(getClass());
     protected JAXBContext jaxbContext;