activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r530492 - in /activemq/camel/trunk: camel-core/src/main/java/org/apache/camel/builder/ camel-core/src/main/java/org/apache/camel/component/mock/ camel-core/src/main/java/org/apache/camel/processor/ camel-core/src/test/java/org/apache/camel/...
Date Thu, 19 Apr 2007 17:15:34 GMT
Author: jstrachan
Date: Thu Apr 19 10:15:32 2007
New Revision: 530492

URL: http://svn.apache.org/viewvc?view=rev&rev=530492
Log:
various fixes for the test cases to use direct: rather than queue: to remove some async test
case errors

Added:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelegateProcess.java
      - copied, changed from r530471, activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/InterceptorProcessor.java
Removed:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/InterceptorProcessor.java
Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FromBuilder.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/InterceptorBuilder.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/InterceptorBuilderTest.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/MyInterceptorProcessor.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/pojo/PojoRouteTest.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ChoiceTest.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/FilterTest.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/IdempotentConsumerTest.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/JoinRoutesTest.java
    activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionInterceptor.java
    activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/xml/XmlRouteBuilderTest.java

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FromBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FromBuilder.java?view=diff&rev=530492&r1=530491&r2=530492
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FromBuilder.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FromBuilder.java
Thu Apr 19 10:15:32 2007
@@ -22,7 +22,7 @@
 import org.apache.camel.Predicate;
 import org.apache.camel.Processor;
 import org.apache.camel.processor.CompositeProcessor;
-import org.apache.camel.processor.InterceptorProcessor;
+import org.apache.camel.processor.DelegateProcess;
 import org.apache.camel.processor.MulticastProcessor;
 import org.apache.camel.processor.Pipeline;
 import org.apache.camel.processor.RecipientList;
@@ -241,7 +241,7 @@
     }
 
     @Fluent
-    public FromBuilder<E> intercept(@FluentArg("interceptor")InterceptorProcessor<E>
interceptor) {
+    public FromBuilder<E> intercept(@FluentArg("interceptor")DelegateProcess<E>
interceptor) {
         InterceptorBuilder<E> answer = new InterceptorBuilder<E>(this);
         answer.add(interceptor);
         addProcessBuilder(answer);

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/InterceptorBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/InterceptorBuilder.java?view=diff&rev=530492&r1=530491&r2=530492
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/InterceptorBuilder.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/InterceptorBuilder.java
Thu Apr 19 10:15:32 2007
@@ -21,7 +21,7 @@
 import java.util.List;
 
 import org.apache.camel.Exchange;
-import org.apache.camel.processor.InterceptorProcessor;
+import org.apache.camel.processor.DelegateProcess;
 import org.apache.camel.Processor;
 import org.apache.camel.RuntimeCamelException;
 
@@ -29,7 +29,7 @@
  * @version $Revision: 519943 $
  */
 public class InterceptorBuilder<E extends Exchange> implements ProcessorFactory<E>
{
-    private final List<InterceptorProcessor<E>> intercepts = new ArrayList<InterceptorProcessor<E>>();
+    private final List<DelegateProcess<E>> intercepts = new ArrayList<DelegateProcess<E>>();
 	private final FromBuilder<E> parent;
 	private FromBuilder<E> target;
 
@@ -38,7 +38,7 @@
 	}
 	
 	@Fluent("interceptor")
-	public InterceptorBuilder<E> add(@FluentArg("ref") InterceptorProcessor<E> interceptor)
{
+	public InterceptorBuilder<E> add(@FluentArg("ref") DelegateProcess<E> interceptor)
{
 		intercepts.add(interceptor);
 		return this;
 	}
@@ -56,9 +56,9 @@
     		throw new RuntimeCamelException("target provided.");
     	
     	// Interceptors are optional
-    	InterceptorProcessor<E> first=null;
-    	InterceptorProcessor<E> last=null;
-        for (InterceptorProcessor<E> p : intercepts) {
+    	DelegateProcess<E> first=null;
+    	DelegateProcess<E> last=null;
+        for (DelegateProcess<E> p : intercepts) {
             if( first == null ) {
             	first = p;
             }

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java?view=diff&rev=530492&r1=530491&r2=530492
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
Thu Apr 19 10:15:32 2007
@@ -44,13 +44,13 @@
  */
 public class MockEndpoint extends DefaultEndpoint<Exchange> {
     private static final transient Log log = LogFactory.getLog(MockEndpoint.class);
-    private int receivedCounter;
     private int expectedCount = -1;
     private Map<Integer, Processor<Exchange>> processors = new HashMap<Integer,
Processor<Exchange>>();
     private List<Exchange> exchangesReceived = new ArrayList<Exchange>();
     private List<Throwable> failures = new ArrayList<Throwable>();
     private List<Runnable> tests = new ArrayList<Runnable>();
-    private CountDownLatch latch = new CountDownLatch(1);
+    private CountDownLatch latch;
+    private long sleepForEmptyTest = 0L;
 
     public static void assertIsSatisfied(MockEndpoint... endpoints) throws InterruptedException
{
         // lets only wait on the first empty endpoint
@@ -108,7 +108,7 @@
      * Validates that all the available expectations on this endpoint are satisfied; or throw
an exception
      */
     public void assertIsSatisfied() throws InterruptedException {
-        assertIsSatisfied(1000);
+        assertIsSatisfied(sleepForEmptyTest);
     }
 
     /**
@@ -121,10 +121,13 @@
         }
         else if (expectedCount == 0) {
             // lets wait a little bit just in case
-            Thread.sleep(timeoutForEmptyEndpoints);
+            if (timeoutForEmptyEndpoints > 0) {
+                Thread.sleep(timeoutForEmptyEndpoints);
+            }
         }
 
         if (expectedCount >= 0) {
+            int receivedCounter = getReceivedCounter();
             assertEquals("Expected message count", expectedCount, receivedCounter);
         }
 
@@ -196,7 +199,7 @@
     }
 
     public int getReceivedCounter() {
-        return receivedCounter;
+        return getExchangesReceived().size();
     }
 
     public List<Exchange> getExchangesReceived() {
@@ -207,19 +210,35 @@
         return expectedCount;
     }
 
+    public long getSleepForEmptyTest() {
+        return sleepForEmptyTest;
+    }
+
+    /**
+     * Allows a sleep to be specified to wait to check that this endpoint really is empty
when
+     * {@link #expectedMessageCount(int)} is called with zero
+     *
+     * @param sleepForEmptyTest the milliseconds to sleep for to determine that this endpoint
really is empty
+     */
+    public void setSleepForEmptyTest(long sleepForEmptyTest) {
+        this.sleepForEmptyTest = sleepForEmptyTest;
+    }
+
     // Implementation methods
     //-------------------------------------------------------------------------
     protected synchronized void onExchange(Exchange exchange) {
         try {
-            exchangesReceived.add(exchange);
+            log.debug("Received exchange: " + exchange);
 
-            if (latch != null) {
-                latch.countDown();
-            }
+            exchangesReceived.add(exchange);
 
-            Processor<Exchange> processor = processors.get(++receivedCounter);
+            Processor<Exchange> processor = processors.get(getReceivedCounter());
             if (processor != null) {
                 processor.process(exchange);
+            }
+
+            if (latch != null) {
+                latch.countDown();
             }
         }
         catch (Exception e) {

Copied: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelegateProcess.java
(from r530471, activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/InterceptorProcessor.java)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelegateProcess.java?view=diff&rev=530492&p1=activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/InterceptorProcessor.java&r1=530471&p2=activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelegateProcess.java&r2=530492
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/InterceptorProcessor.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelegateProcess.java
Thu Apr 19 10:15:32 2007
@@ -18,19 +18,31 @@
 package org.apache.camel.processor;
 
 import org.apache.camel.Processor;
+import org.apache.camel.spi.Interceptor;
 import org.apache.camel.impl.ServiceSupport;
 import org.apache.camel.util.ServiceHelper;
 
 /**
+ * A Delegate pattern which delegates processing to a nested processor which can be useful
for implementation inheritence
+ * when writing an {@link Interceptor}
+ *
  * @version $Revision: 519941 $
  */
-public class InterceptorProcessor<E> extends ServiceSupport implements Processor<E>
{
+public class DelegateProcess<E> extends ServiceSupport implements Processor<E>
{
     protected Processor<E> next;
 
-    public InterceptorProcessor() {
+    public DelegateProcess() {
+    }
+
+    public DelegateProcess(Processor<E> next) {
+        this.next = next;
     }
 
     public void process(E exchange) {
+        processNext(exchange);
+    }
+
+    protected void processNext(E exchange) {
         if (next != null) {
             next.process(exchange);
         }

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/InterceptorBuilderTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/InterceptorBuilderTest.java?view=diff&rev=530492&r1=530491&r2=530492
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/InterceptorBuilderTest.java
(original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/InterceptorBuilderTest.java
Thu Apr 19 10:15:32 2007
@@ -24,7 +24,7 @@
 import org.apache.camel.Producer;
 import org.apache.camel.TestSupport;
 import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.processor.InterceptorProcessor;
+import org.apache.camel.processor.DelegateProcess;
 
 /**
  * @version $Revision: 530102 $
@@ -41,7 +41,7 @@
         CamelContext container = new DefaultCamelContext();
         final ArrayList<String> order = new ArrayList<String>();
 
-        final InterceptorProcessor<Exchange> interceptor1 = new InterceptorProcessor<Exchange>()
{
+        final DelegateProcess<Exchange> interceptor1 = new DelegateProcess<Exchange>()
{
         	@Override
         	public void process(Exchange exchange) {
         		order.add("START:1");
@@ -49,7 +49,7 @@
         		order.add("END:1");
         	}
         };
-        final InterceptorProcessor<Exchange> interceptor2 = new InterceptorProcessor<Exchange>()
{
+        final DelegateProcess<Exchange> interceptor2 = new DelegateProcess<Exchange>()
{
         	@Override
         	public void process(Exchange exchange) {
         		order.add("START:2");

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/MyInterceptorProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/MyInterceptorProcessor.java?view=diff&rev=530492&r1=530491&r2=530492
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/MyInterceptorProcessor.java
(original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/MyInterceptorProcessor.java
Thu Apr 19 10:15:32 2007
@@ -4,9 +4,9 @@
 package org.apache.camel.builder;
 
 import org.apache.camel.Exchange;
-import org.apache.camel.processor.InterceptorProcessor;
+import org.apache.camel.processor.DelegateProcess;
 
-public class MyInterceptorProcessor extends InterceptorProcessor<Exchange> {
+public class MyInterceptorProcessor extends DelegateProcess<Exchange> {
 	public void process(Exchange exchange) {
 		System.out.println("START of onExchange: "+exchange);
 		next.process(exchange);

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java?view=diff&rev=530492&r1=530491&r2=530492
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java
(original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java
Thu Apr 19 10:15:32 2007
@@ -24,7 +24,7 @@
 import org.apache.camel.processor.ChoiceProcessor;
 import org.apache.camel.processor.DeadLetterChannel;
 import org.apache.camel.processor.FilterProcessor;
-import org.apache.camel.processor.InterceptorProcessor;
+import org.apache.camel.processor.DelegateProcess;
 import org.apache.camel.processor.MulticastProcessor;
 import org.apache.camel.processor.RecipientList;
 import org.apache.camel.processor.SendProcessor;
@@ -41,8 +41,8 @@
  */
 public class RouteBuilderTest extends TestSupport {
     protected Processor<Exchange> myProcessor = new MyProcessor();
-    protected InterceptorProcessor<Exchange> interceptor1;
-    protected InterceptorProcessor<Exchange> interceptor2;
+    protected DelegateProcess<Exchange> interceptor1;
+    protected DelegateProcess<Exchange> interceptor2;
 
     protected RouteBuilder<Exchange> buildSimpleRoute() {
         // START SNIPPET: e1
@@ -232,7 +232,7 @@
     }
 
     protected RouteBuilder<Exchange> buildRouteWithInterceptor() {
-        interceptor1 = new InterceptorProcessor<Exchange>() {
+        interceptor1 = new DelegateProcess<Exchange>() {
         };
 
         // START SNIPPET: e7        
@@ -264,10 +264,10 @@
             assertEquals("From endpoint", "queue:a", key.getEndpointUri());
             Processor processor = getProcessorWithoutErrorHandler(route);
 
-            InterceptorProcessor<Exchange> p1 = assertIsInstanceOf(InterceptorProcessor.class,
processor);
+            DelegateProcess<Exchange> p1 = assertIsInstanceOf(DelegateProcess.class,
processor);
             processor = p1.getNext();
 
-            InterceptorProcessor<Exchange> p2 = assertIsInstanceOf(InterceptorProcessor.class,
processor);
+            DelegateProcess<Exchange> p2 = assertIsInstanceOf(DelegateProcess.class,
processor);
 
             assertSendTo(p2.getNext(), "queue:d");
         }

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/pojo/PojoRouteTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/pojo/PojoRouteTest.java?view=diff&rev=530492&r1=530491&r2=530492
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/pojo/PojoRouteTest.java
(original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/pojo/PojoRouteTest.java
Thu Apr 19 10:15:32 2007
@@ -24,7 +24,7 @@
 import org.apache.camel.CamelContext;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.processor.InterceptorProcessor;
+import org.apache.camel.processor.DelegateProcess;
 
 /**
  * @version $Revision: 520220 $
@@ -40,7 +40,7 @@
         container.addComponent("default", component);
         
         final AtomicInteger hitCount = new AtomicInteger();
-        final InterceptorProcessor<PojoExchange> tracingInterceptor = new InterceptorProcessor<PojoExchange>()
{
+        final DelegateProcess<PojoExchange> tracingInterceptor = new DelegateProcess<PojoExchange>()
{
         	@Override
         	public void process(PojoExchange exchange) {
         		super.process(exchange);

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ChoiceTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ChoiceTest.java?view=diff&rev=530492&r1=530491&r2=530492
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ChoiceTest.java
(original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ChoiceTest.java
Thu Apr 19 10:15:32 2007
@@ -85,7 +85,7 @@
     protected void setUp() throws Exception {
         context.addRoutes(createRouteBuilder());
 
-        startEndpoint = resolveMandatoryEndpoint(context, "queue:a");
+        startEndpoint = resolveMandatoryEndpoint(context, "direct:a");
 
         x = (MockEndpoint) resolveMandatoryEndpoint(context, "mock:x");
         y = (MockEndpoint) resolveMandatoryEndpoint(context, "mock:y");
@@ -97,7 +97,7 @@
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder<Exchange>() {
             public void configure() {
-                from("queue:a").choice()
+                from("direct:a").choice()
                         .when(header("foo").isEqualTo("bar")).to("mock:x")
                         .when(header("foo").isEqualTo("cheese")).to("mock:y")
                         .otherwise().to("mock:z");

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/FilterTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/FilterTest.java?view=diff&rev=530492&r1=530491&r2=530492
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/FilterTest.java
(original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/FilterTest.java
Thu Apr 19 10:15:32 2007
@@ -57,7 +57,7 @@
     protected void setUp() throws Exception {
         context.addRoutes(createRouteBuilder());
 
-        startEndpoint = resolveMandatoryEndpoint(context, "queue:a");
+        startEndpoint = resolveMandatoryEndpoint(context, "direct:a");
         resultEndpoint = (MockEndpoint) resolveMandatoryEndpoint(context, "mock:result");
 
         context.start();
@@ -66,7 +66,7 @@
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder<Exchange>() {
             public void configure() {
-                from("queue:a").filter(header("foo").isEqualTo("bar")).to("mock:result");
+                from("direct:a").filter(header("foo").isEqualTo("bar")).to("mock:result");
             }
         };
     }

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/IdempotentConsumerTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/IdempotentConsumerTest.java?view=diff&rev=530492&r1=530491&r2=530492
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/IdempotentConsumerTest.java
(original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/IdempotentConsumerTest.java
Thu Apr 19 10:15:32 2007
@@ -73,7 +73,7 @@
     protected void setUp() throws Exception {
         context = createContext();
 
-        String fromUri = "queue:test.a";
+        String fromUri = "direct:test.a";
         String toUri = "mock:result";
 
         // lets add some routes

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/JoinRoutesTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/JoinRoutesTest.java?view=diff&rev=530492&r1=530491&r2=530492
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/JoinRoutesTest.java
(original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/JoinRoutesTest.java
Thu Apr 19 10:15:32 2007
@@ -61,7 +61,7 @@
     protected void setUp() throws Exception {
         context.addRoutes(createRouteBuilder());
 
-        startEndpoint = resolveMandatoryEndpoint(context, "queue:a");
+        startEndpoint = resolveMandatoryEndpoint(context, "direct:a");
         resultEndpoint = (MockEndpoint) resolveMandatoryEndpoint(context, "mock:result");
 
         context.start();
@@ -70,14 +70,14 @@
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder<Exchange>() {
             public void configure() {
-                from("queue:a").choice()
-                        .when(header("foo").isEqualTo("bar")).to("queue:b")
-                        .when(header("foo").isEqualTo("cheese")).to("queue:c")
-                        .otherwise().to("queue:d");
+                from("direct:a").choice()
+                        .when(header("foo").isEqualTo("bar")).to("direct:b")
+                        .when(header("foo").isEqualTo("cheese")).to("direct:c")
+                        .otherwise().to("direct:d");
 
-                from("queue:b").to("mock:result");
-                from("queue:c").to("mock:result");
-                from("queue:d").to("mock:result");
+                from("direct:b").to("mock:result");
+                from("direct:c").to("mock:result");
+                from("direct:d").to("mock:result");
             }
         };
     }

Modified: activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionInterceptor.java?view=diff&rev=530492&r1=530491&r2=530492
==============================================================================
--- activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionInterceptor.java
(original)
+++ activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionInterceptor.java
Thu Apr 19 10:15:32 2007
@@ -18,6 +18,7 @@
 package org.apache.camel.spring.spi;
 
 import org.apache.camel.Processor;
+import org.apache.camel.processor.DelegateProcess;
 import org.apache.camel.spi.Interceptor;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -42,25 +43,26 @@
         this.template = template;
     }
 
-    public Processor<E> addIntercetors(final Processor<E> processor) {
+    public Processor<E> addIntercetors(Processor<E> processor) {
         final TransactionTemplate transactionTemplate = getTemplate();
         if (transactionTemplate == null) {
             log.warn("No TransactionTemplate available so transactions will not be enabled!");
             return processor;
         }
 
-        return new Processor<E>() {
+        return new DelegateProcess<E>(processor) {
+
             public void process(final E exchange) {
                 transactionTemplate.execute(new TransactionCallbackWithoutResult() {
                     protected void doInTransactionWithoutResult(TransactionStatus status)
{
-                        processor.process(exchange);
+                        processNext(exchange);
                     }
                 });
             }
 
             @Override
             public String toString() {
-                return "SpringTransaction[" + processor + "]";
+                return "SpringTransaction[" + getNext() + "]";
             }
         };
     }

Modified: activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/xml/XmlRouteBuilderTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/xml/XmlRouteBuilderTest.java?view=diff&rev=530492&r1=530491&r2=530492
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/xml/XmlRouteBuilderTest.java
(original)
+++ activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/xml/XmlRouteBuilderTest.java
Thu Apr 19 10:15:32 2007
@@ -20,7 +20,7 @@
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.builder.RouteBuilderTest;
-import org.apache.camel.processor.InterceptorProcessor;
+import org.apache.camel.processor.DelegateProcess;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
 /**
@@ -70,8 +70,8 @@
 	
 	@Override
 	protected RouteBuilder<Exchange> buildRouteWithInterceptor() {
-		interceptor1 = (InterceptorProcessor<Exchange>) ctx.getBean("interceptor1");
-		interceptor2 = (InterceptorProcessor<Exchange>) ctx.getBean("interceptor2");
+		interceptor1 = (DelegateProcess<Exchange>) ctx.getBean("interceptor1");
+		interceptor2 = (DelegateProcess<Exchange>) ctx.getBean("interceptor2");
 		RouteBuilder<Exchange> builder = (RouteBuilder<Exchange>) ctx.getBean("buildRouteWithInterceptor");
 		assertNotNull(builder);
 		return builder;



Mime
View raw message