activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r521152 - in /activemq/camel/trunk: camel-core/src/main/java/org/apache/camel/builder/ camel-core/src/test/java/org/apache/camel/builder/ camel-spring/src/main/java/org/apache/camel/spring/ camel-spring/src/main/resources/org/apache/camel/s...
Date Thu, 22 Mar 2007 08:41:12 GMT
Author: chirino
Date: Thu Mar 22 01:41:08 2007
New Revision: 521152

URL: http://svn.apache.org/viewvc?view=rev&rev=521152
Log:
More enhancements to the CamelBeanDefinitionParser.
 - It can now continue building off child elements 
 - It can now automatically add an builder action as a result of reaching the end of an element
 - interceptor configuration is now working
 

Added:
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/MyInterceptorProcessor.java
    activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/IllegalActionException.java
      - copied, changed from r521138, activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/IllegalRouteException.java
Removed:
    activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/IllegalRouteException.java
Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/Fluent.java
    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/test/java/org/apache/camel/builder/RouteBuilderTest.java
    activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/BuilderAction.java
    activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanDefinitionParser.java
    activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/MethodInfo.java
    activemq/camel/trunk/camel-spring/src/main/resources/org/apache/camel/spring/camel-1.0.xsd
    activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/SpringRouteBuilderTest.java
    activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/examples.xml
    activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/spring_route_builder_test.xml

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/Fluent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/Fluent.java?view=diff&rev=521152&r1=521151&r2=521152
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/Fluent.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/Fluent.java Thu
Mar 22 01:41:08 2007
@@ -27,4 +27,23 @@
 @Retention(RetentionPolicy.RUNTIME)
 @Target(ElementType.METHOD)
 public @interface Fluent {
+	
+	/**
+	 * Used to change the default element name of the action.
+	 * @return
+	 */
+	String value() default "";
+	
+	/** 
+	 * Should nested elements be evaluated against the current builder.
+	 * @return
+	 */
+	boolean nestedActions() default false;
+
+	/** 
+	 * Should this method be called at the end of the evaluating the 
+	 * element.
+	 * @return
+	 */
+	boolean callOnElementEnd() default false;
 }

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=521152&r1=521151&r2=521152
==============================================================================
--- 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 Mar 22 01:41:08 2007
@@ -207,7 +207,7 @@
         return this;
     }
     
-    @Fluent
+    @Fluent(nestedActions=true)
     public InterceptorBuilder<E> intercept() {
         InterceptorBuilder<E> answer = new InterceptorBuilder<E>(this);
         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=521152&r1=521151&r2=521152
==============================================================================
--- 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 Mar 22 01:41:08 2007
@@ -36,12 +36,14 @@
 	public InterceptorBuilder(FromBuilder<E> parent) {
         this.parent = parent;
 	}
-
-	public InterceptorBuilder<E> add(InterceptorProcessor<E> intercept) {
-		intercepts.add(intercept);
+	
+	@Fluent("interceptor")
+	public InterceptorBuilder<E> add(@FluentArg("ref") InterceptorProcessor<E> interceptor)
{
+		intercepts.add(interceptor);
 		return this;
 	}
 	
+	@Fluent(callOnElementEnd=true)
     public FromBuilder<E> target() {
         this.target = new FromBuilder<E>(parent);
         return target;

Added: 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=auto&rev=521152
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/MyInterceptorProcessor.java
(added)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/MyInterceptorProcessor.java
Thu Mar 22 01:41:08 2007
@@ -0,0 +1,15 @@
+/**
+ * 
+ */
+package org.apache.camel.builder;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.processor.InterceptorProcessor;
+
+public class MyInterceptorProcessor extends InterceptorProcessor<Exchange> {
+	public void onExchange(Exchange exchange) {
+		System.out.println("START of onExchange: "+exchange);
+		next.onExchange(exchange);
+		System.out.println("END of onExchange: "+exchange);
+	}
+}
\ 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?view=diff&rev=521152&r1=521151&r2=521152
==============================================================================
--- 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 Mar 22 01:41:08 2007
@@ -16,25 +16,23 @@
  */
 package org.apache.camel.builder;
 
-import junit.framework.TestCase;
-import org.apache.camel.builder.RouteBuilder;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.TestSupport;
 import org.apache.camel.processor.ChoiceProcessor;
-import org.apache.camel.processor.SendProcessor;
+import org.apache.camel.processor.DeadLetterChannel;
 import org.apache.camel.processor.FilterProcessor;
 import org.apache.camel.processor.InterceptorProcessor;
+import org.apache.camel.processor.MulticastProcessor;
 import org.apache.camel.processor.RecipientList;
+import org.apache.camel.processor.SendProcessor;
 import org.apache.camel.processor.Splitter;
-import org.apache.camel.processor.DeadLetterChannel;
-import org.apache.camel.processor.MulticastProcessor;
-import org.apache.camel.TestSupport;
-import org.apache.camel.Processor;
-import org.apache.camel.Exchange;
-import org.apache.camel.Endpoint;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
 
 /**
  * @version $Revision$
@@ -42,8 +40,8 @@
 public class RouteBuilderTest extends TestSupport {
 	
 	protected Processor<Exchange> myProcessor = new MyProcessor();    	
-	private InterceptorProcessor<Exchange> interceptor1;
-	private InterceptorProcessor<Exchange> interceptor2;
+	protected InterceptorProcessor<Exchange> interceptor1;
+	protected InterceptorProcessor<Exchange> interceptor2;
     
 	protected RouteBuilder<Exchange> buildSimpleRoute() {
 		// START SNIPPET: e1
@@ -246,13 +244,7 @@
         };
 
         // START SNIPPET: e7        
-        interceptor2 = new InterceptorProcessor<Exchange>() {
-        	public void onExchange(Exchange exchange) {
-        		System.out.println("START of onExchange: "+exchange);
-        		next.onExchange(exchange);
-        		System.out.println("END of onExchange: "+exchange);
-        	}
-        };
+        interceptor2 = new MyInterceptorProcessor();
 
         RouteBuilder<Exchange> builder = new RouteBuilder<Exchange>() {
             public void configure() {

Modified: activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/BuilderAction.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/BuilderAction.java?view=diff&rev=521152&r1=521151&r2=521152
==============================================================================
--- activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/BuilderAction.java
(original)
+++ activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/BuilderAction.java
Thu Mar 22 01:41:08 2007
@@ -54,4 +54,8 @@
 	public String getName() {
 		return methodInfo.getName();
 	}
+
+	public MethodInfo getMethodInfo() {
+		return methodInfo;
+	}
 }

Modified: activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanDefinitionParser.java?view=diff&rev=521152&r1=521151&r2=521152
==============================================================================
--- activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanDefinitionParser.java
(original)
+++ activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanDefinitionParser.java
Thu Mar 22 01:41:08 2007
@@ -3,7 +3,6 @@
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
@@ -39,7 +38,12 @@
 		if (childElements != null && childElements.size() > 0) {
 			for (int i = 0; i < childElements.size(); ++i) {
 				Element routeElement = (Element) childElements.get(i);
-				BuilderStatement statement = parseRouteElement(routeElement);
+
+				ArrayList<BuilderAction> actions = new ArrayList<BuilderAction>();
+				Class type = parseBuilderElement(routeElement, RouteBuilder.class, actions);
+				BuilderStatement statement = new BuilderStatement();
+				statement.setReturnType(type);
+				statement.setActions(actions);
 				routes.add(statement);
 			}
 		}
@@ -50,30 +54,56 @@
 
 	/**
 	 * Use reflection to figure out what is the valid next element.
-	 * 
+	 * @param builder TODO
 	 * @param routeElement
+	 * 
 	 * @return
 	 */
-	private BuilderStatement parseRouteElement(Element element) {
-		BuilderStatement rc = new BuilderStatement();
-		Class currentBuilder = RouteBuilder.class;
-
+	private Class parseBuilderElement(Element element, Class<RouteBuilder> builder, ArrayList<BuilderAction>
actions) {
+		Class currentBuilder = builder;
 		NodeList childElements = element.getChildNodes();
-		ArrayList<BuilderAction> actions = new ArrayList<BuilderAction>(childElements.getLength());
-		if (childElements != null && childElements.getLength() > 0) {
-			Element previousElement = null;
-			for (int i = 0; i < childElements.getLength(); ++i) {
-				Node node = childElements.item(i);
-				if (node.getNodeType() == Node.ELEMENT_NODE) {
-					currentBuilder = parseAction(currentBuilder, actions, (Element) node, previousElement);
-					previousElement = (Element) node;
+		Element previousElement = null;
+		for (int i = 0; i < childElements.getLength(); ++i) {
+			Node node = childElements.item(i);
+			if (node.getNodeType() == Node.ELEMENT_NODE) {
+				currentBuilder = parseAction(currentBuilder, actions, (Element) node, previousElement);
+				previousElement = (Element) node;
+				BuilderAction action = actions.get(actions.size()-1);
+				
+				if( action.getMethodInfo().methodAnnotation.nestedActions() ) {
+					currentBuilder = parseBuilderElement((Element) node, currentBuilder, actions);
+				} else {
+					// Make sure the there are no child elements.
+					NodeList nl = node.getChildNodes();
+					for (int j = 0; j < nl.getLength(); ++j) {
+						if( nl.item(j).getNodeType() == Node.ELEMENT_NODE ) {
+							throw new IllegalArgumentException("The element "+node.getLocalName()+" should not
have any child elements.");
+						}
+					}
 				}
+				
 			}
 		}
-
-		rc.setReturnType(currentBuilder);
-		rc.setActions(actions);
-		return rc;
+		
+		// Add the builder actions that are annotated with @Fluent(callOnElementEnd=true) 
+		if( currentBuilder!=null ) {
+			Method[] methods = currentBuilder.getMethods();
+			for (int i = 0; i < methods.length; i++) {
+				Method method = methods[i];
+				Fluent annotation = method.getAnnotation(Fluent.class);
+				if( annotation!=null && annotation.callOnElementEnd() ) {
+					
+					if( method.getParameterTypes().length > 0 ) {
+						throw new RuntimeException("Only methods with no parameters can annotated with @Fluent(callOnElementEnd=true):
"+method); 
+					}
+					
+					MethodInfo methodInfo = new MethodInfo(method, annotation, new LinkedHashMap<String,
Class>(), new LinkedHashMap<String, FluentArg>());
+					actions.add(new BuilderAction(methodInfo, new HashMap<String, Object>()));
+					currentBuilder = method.getReturnType();
+				}
+			}
+		}
+		return currentBuilder;
 	}
 
 	private Class parseAction(Class currentBuilder, ArrayList<BuilderAction> actions,
Element element, Element previousElement) {
@@ -83,7 +113,7 @@
 		// Get a list of method names that match the action.
 		ArrayList<MethodInfo> methods = findFluentMethodsWithName(currentBuilder, element.getLocalName());
 		if (methods.isEmpty()) {
-			throw new IllegalRouteException(actionName, previousElement == null ? null : previousElement.getLocalName());
+			throw new IllegalActionException(actionName, previousElement == null ? null : previousElement.getLocalName());
 		}
 
 		// Pick the best method out of the list. Sort by argument length. Pick
@@ -103,7 +133,7 @@
 		MethodInfo match = null;
 		match = findMethodMatch(methods, attributeArguments.keySet(), elementArguments.keySet());
 		if (match == null)
-			throw new IllegalRouteException(actionName, previousElement == null ? null : previousElement.getLocalName());
+			throw new IllegalActionException(actionName, previousElement == null ? null : previousElement.getLocalName());
 
 		// Move element arguments into the attributeArguments map if needed. 
 		Set<String> parameterNames = new HashSet<String>(match.parameters.keySet());
@@ -137,10 +167,16 @@
 				return new RuntimeBeanReference(ref);
 			}
 			
-			BuilderStatement statement = parseRouteElement(element);
+			ArrayList<BuilderAction> actions = new ArrayList<BuilderAction>();
+			Class type = parseBuilderElement(element, RouteBuilder.class, actions);
+			BuilderStatement statement = new BuilderStatement();
+			statement.setReturnType(type);
+			statement.setActions(actions);
+			
 			if( !clazz.isAssignableFrom( statement.getReturnType() ) ) {
 				throw new IllegalStateException("Builder does not produce object of expected type: "+clazz.getName());
 			}
+			
 			return statement;
 		}
 	}
@@ -152,7 +188,7 @@
 			// attributes
 			boolean miss = false;
 			for (String key : attributeNames) {
-				FluentArg arg = method.annotations.get(key);
+				FluentArg arg = method.parameterAnnotations.get(key);
 				if (arg == null || !arg.attribute()) {
 					miss = true;
 					break;
@@ -176,7 +212,7 @@
 				}
 				// We only want to use the first child elements as arguments,
 				// once we don't match, we can stop looking.
-				FluentArg arg = method.annotations.get(key);
+				FluentArg arg = method.parameterAnnotations.get(key);
 				if (arg == null || !arg.element()) {
 					break;
 				}
@@ -261,13 +297,15 @@
 		Method[] methods = clazz.getMethods();
 		for (int i = 0; i < methods.length; i++) {
 			Method method = methods[i];
-			if (name.equals(method.getName())) {
-
-				if (!method.isAnnotationPresent(Fluent.class)) {
-					List<Annotation> l = Arrays.asList(method.getAnnotations());
-					System.out.println(l);
-					continue;
-				}
+			if (!method.isAnnotationPresent(Fluent.class)) {
+				continue;
+			}
+			
+			// Use the fluent supplied name for the action, or the method name if not set.
+			Fluent fluentAnnotation = method.getAnnotation(Fluent.class);
+			if ( StringUtils.hasText(fluentAnnotation.value()) ? 
+					name.equals(fluentAnnotation.value()) :
+					name.equals(method.getName()) ) {
 
 				LinkedHashMap<String, Class> map = new LinkedHashMap<String, Class>();
 				LinkedHashMap<String, FluentArg> amap = new LinkedHashMap<String, FluentArg>();
@@ -285,7 +323,7 @@
 
 				// If all the parameters were annotated...
 				if (parameters.length == map.size()) {
-					rc.add(new MethodInfo(method, map, amap));
+					rc.add(new MethodInfo(method, fluentAnnotation, map, amap));
 				}
 			}
 		}

Copied: activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/IllegalActionException.java
(from r521138, activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/IllegalRouteException.java)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/IllegalActionException.java?view=diff&rev=521152&p1=activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/IllegalRouteException.java&r1=521138&p2=activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/IllegalActionException.java&r2=521152
==============================================================================
--- activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/IllegalRouteException.java
(original)
+++ activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/IllegalActionException.java
Thu Mar 22 01:41:08 2007
@@ -1,12 +1,12 @@
 package org.apache.camel.spring;
 
-public class IllegalRouteException extends IllegalArgumentException {
+public class IllegalActionException extends IllegalArgumentException {
 
 	private static final long serialVersionUID = -2166507687211986107L;
 	private final String actionName;
 	private final String previousAction;
 
-	public IllegalRouteException(String actionName, String previousAction) {
+	public IllegalActionException(String actionName, String previousAction) {
 		super("Illegal route.");
 		this.actionName = actionName;
 		this.previousAction = previousAction;

Modified: activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/MethodInfo.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/MethodInfo.java?view=diff&rev=521152&r1=521151&r2=521152
==============================================================================
--- activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/MethodInfo.java
(original)
+++ activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/MethodInfo.java
Thu Mar 22 01:41:08 2007
@@ -6,17 +6,21 @@
 import java.lang.reflect.Method;
 import java.util.LinkedHashMap;
 
+import org.apache.camel.builder.Fluent;
 import org.apache.camel.builder.FluentArg;
 
 public class MethodInfo {
+	
 	final Method method;
+	final Fluent methodAnnotation;
 	final LinkedHashMap<String, Class> parameters;
-	final LinkedHashMap<String, FluentArg> annotations;
+	final LinkedHashMap<String, FluentArg> parameterAnnotations;
 	
-	public MethodInfo(Method method, LinkedHashMap<String, Class> parameters, LinkedHashMap<String,
FluentArg> annotations) {
+	public MethodInfo(Method method, Fluent fluentAnnotation, LinkedHashMap<String, Class>
parameters, LinkedHashMap<String, FluentArg> annotations) {
 		this.method=method;
+		this.methodAnnotation = fluentAnnotation;
 		this.parameters=parameters;
-		this.annotations = annotations;
+		this.parameterAnnotations = annotations;
 	}
 
 	public String getName() {

Modified: activemq/camel/trunk/camel-spring/src/main/resources/org/apache/camel/spring/camel-1.0.xsd
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/main/resources/org/apache/camel/spring/camel-1.0.xsd?view=diff&rev=521152&r1=521151&r2=521152
==============================================================================
--- activemq/camel/trunk/camel-spring/src/main/resources/org/apache/camel/spring/camel-1.0.xsd
(original)
+++ activemq/camel/trunk/camel-spring/src/main/resources/org/apache/camel/spring/camel-1.0.xsd
Thu Mar 22 01:41:08 2007
@@ -35,7 +35,6 @@
       </xs:sequence>
     </xs:complexType>
   </xs:element>
-  
   <xs:element name="from">
     <xs:complexType>
       <xs:attribute name="endpoint" type="xs:NMTOKEN"/>
@@ -53,7 +52,7 @@
   </xs:element>
   <xs:element name="interceptor">
     <xs:complexType>
-      <xs:attribute name="interceptor" use="required"/>
+      <xs:attribute name="ref" use="required"/>
     </xs:complexType>
   </xs:element>
   <xs:element name="choice">

Modified: activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/SpringRouteBuilderTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/SpringRouteBuilderTest.java?view=diff&rev=521152&r1=521151&r2=521152
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/SpringRouteBuilderTest.java
(original)
+++ activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/SpringRouteBuilderTest.java
Thu Mar 22 01:41:08 2007
@@ -20,6 +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.springframework.context.support.ClassPathXmlApplicationContext;
 
 /**
@@ -69,8 +70,11 @@
 	
 	@Override
 	protected RouteBuilder<Exchange> buildRouteWithInterceptor() {
-		// TODO Auto-generated method stub
-		return super.buildRouteWithInterceptor();
+		interceptor1 = (InterceptorProcessor<Exchange>) ctx.getBean("interceptor1");
+		interceptor2 = (InterceptorProcessor<Exchange>) ctx.getBean("interceptor2");
+		RouteBuilder<Exchange> builder = (RouteBuilder<Exchange>) ctx.getBean("buildRouteWithInterceptor");
+		assertNotNull(builder);
+		return builder;
 	}
 	
 	@Override

Modified: activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/examples.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/examples.xml?view=diff&rev=521152&r1=521151&r2=521152
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/examples.xml
(original)
+++ activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/examples.xml
Thu Mar 22 01:41:08 2007
@@ -50,7 +50,7 @@
 
        <route>
          <from uri="queue:a"/>
-         <process ref="#myProcessor"/>
+         <process ref="myProcessor"/>
        </route>
 
        <route>
@@ -73,12 +73,12 @@
        <route>
          <from uri="queue:a"/>
          <intercept>
-         	<interceptor interceptor="#myInterceptor"/>
-         	<interceptor interceptor="#myInterceptor"/>
+             <interceptor ref="interceptor1"/>
+             <interceptor ref="#interceptor2"/>
          </intercept>
          <intercept>
-         	<interceptor interceptor="#myInterceptor"/>
-         	<interceptor interceptor="#myInterceptor"/>
+             <interceptor ref="#interceptor1"/>
+             <interceptor ref="interceptor2"/>
          </intercept>
          <to uri="queue:b"/>
        </route>

Modified: activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/spring_route_builder_test.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/spring_route_builder_test.xml?view=diff&rev=521152&r1=521151&r2=521152
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/spring_route_builder_test.xml
(original)
+++ activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/spring_route_builder_test.xml
Thu Mar 22 01:41:08 2007
@@ -66,17 +66,17 @@
               .add(interceptor2)
            .target().to("queue:d");
      -->
+    <bean id="interceptor1" class="org.apache.camel.builder.MyInterceptorProcessor"/>
+    <bean id="interceptor2" class="org.apache.camel.builder.MyInterceptorProcessor"/>
    
     <routeBuilder id="buildRouteWithInterceptor" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
-       <!-- 
        <route>
          <from uri="queue:a"/>
          <intercept>
-             <s:bean id="interceptor1" class="some.InterceptorProcessor"/>
-             <s:bean id="interceptor2" class="some.InterceptorProcessor"/>
+             <interceptor ref="#interceptor1"/>
+             <interceptor ref="#interceptor2"/>
          </intercept>
-         <to uri="queue:b"/>
+         <to uri="queue:d"/>
        </route>
-        -->
     </routeBuilder>
 
     <!-- 



Mime
View raw message