Author: ningjiang
Date: Wed Dec 17 19:17:00 2008
New Revision: 727624

URL: http://svn.apache.org/viewvc?rev=727624&view=rev
Log:
CAMEL-1193 Got interceptor to work with multicast type

Modified:
    
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/MulticastType.java
    
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java

Modified: 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/MulticastType.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/MulticastType.java?rev=727624&r1=727623&r2=727624&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/MulticastType.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/MulticastType.java
 Wed Dec 17 19:17:00 2008
@@ -45,7 +45,7 @@
     @XmlAttribute(required = false)
     private String strategyRef;
     @XmlAttribute(required = false)
-    private String threadPoolRef;
+    private String threadPoolRef;    
     @XmlTransient
     private AggregationStrategy aggregationStrategy;
     @XmlTransient
@@ -101,8 +101,8 @@
     public MulticastType executor(Executor executor) {
         setExecutor(executor);
         return this;
-    }
-    
+    }    
+        
     protected Processor createCompositeProcessor(RouteContext routeContext, 
List<Processor> list) {
         if (aggregationStrategy == null && strategyRef != null) {
             aggregationStrategy = routeContext.lookup(strategyRef, 
AggregationStrategy.class);
@@ -140,10 +140,11 @@
     public void setExecutor(Executor executor) {
         this.executor = executor;        
     }
-
+    
     @Override
-    protected Processor wrapProcessorInInterceptors(RouteContext routeContext, 
Processor target) throws Exception {
-        // No need to wrap me in interceptors as they are all applied directly 
to my children
-        return new StreamCachingInterceptor(target);
+    protected Processor wrapProcessorInInterceptors(RouteContext routeContext, 
Processor target) throws Exception {        
+        //CAMEL-1193 now we need to wrap the multicast processor with the 
interceptors
+        //Current we wrap the StreamCachingInterceptor by default
+        return super.wrapProcessorInInterceptors(routeContext, new 
StreamCachingInterceptor(target));        
     }
 }
\ No newline at end of file

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?rev=727624&r1=727623&r2=727624&view=diff
==============================================================================
--- 
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
 Wed Dec 17 19:17:00 2008
@@ -247,7 +247,9 @@
             Endpoint key = route.getEndpoint();
             assertEquals("From endpoint", "seda:a", key.getEndpointUri());
             Processor processor = getProcessorWithoutErrorHandler(route);
-
+            // take off the InstrumentationProcessor
+            processor = unwrapDelegateProcessor(processor);
+            // take off the StreamCacheInterceptor
             processor = unwrapInterceptor(processor);
             MulticastProcessor multicastProcessor = 
assertIsInstanceOf(MulticastProcessor.class, processor);
             List<Processor> endpoints = new 
ArrayList<Processor>(multicastProcessor.getProcessors());
@@ -497,6 +499,15 @@
             return processor;
         }
     }
+    
+    protected Processor unwrapDelegateProcessor(Processor processor) {
+        if (processor instanceof DelegateProcessor) {
+            DelegateProcessor delegate = (DelegateProcessor) processor;
+            return delegate.getProcessor();
+        } else {
+            return processor;
+        }
+    }
 
     public void testCorrectNumberOfRoutes() throws Exception {
         RouteBuilder builder = new RouteBuilder() {


Reply via email to