Author: davsclaus Date: Thu Feb 19 14:00:18 2009 New Revision: 745870 URL: http://svn.apache.org/viewvc?rev=745870&view=rev Log: Merged revisions 745826 via svnmerge from https://svn.apache.org/repos/asf/camel/trunk
........ r745826 | davsclaus | 2009-02-19 12:54:30 +0100 (Thu, 19 Feb 2009) | 1 line CAMEL-879: Fixed intercept in spring DSL not working with predicate and having stop/proceed. In fact better initialization of interceptor in Spring DSL. ........ Added: camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/StopType.java - copied unchanged from r745826, camel/trunk/camel-core/src/main/java/org/apache/camel/model/StopType.java camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/util/ProcessorTypeHelper.java - copied, changed from r745826, camel/trunk/camel-core/src/main/java/org/apache/camel/util/ProcessorTypeHelper.java camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/InterceptWhenNoStopTest.java - copied, changed from r745826, camel/trunk/camel-core/src/test/java/org/apache/camel/processor/InterceptWhenNoStopTest.java camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/InterceptWhenTest.java (with props) camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/InterceptWhenWithChoiceTest.java - copied, changed from r745826, camel/trunk/camel-core/src/test/java/org/apache/camel/processor/InterceptWhenWithChoiceTest.java camel/branches/camel-1.x/components/camel-spring/src/test/java/org/apache/camel/spring/processor/GoofyBean.java (with props) camel/branches/camel-1.x/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringInterceptWhenNoStopTest.java - copied unchanged from r745826, camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringInterceptWhenNoStopTest.java camel/branches/camel-1.x/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringInterceptWhenTest.java - copied unchanged from r745826, camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringInterceptWhenTest.java camel/branches/camel-1.x/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringInterceptWhenWithChoiceTest.java - copied unchanged from r745826, camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringInterceptWhenWithChoiceTest.java camel/branches/camel-1.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptWhenNoStopTest.xml - copied, changed from r745826, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptWhenNoStopTest.xml camel/branches/camel-1.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptWhenTest.xml - copied, changed from r745826, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptWhenTest.xml camel/branches/camel-1.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptWhenWithChoiceTest.xml - copied, changed from r745826, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptWhenWithChoiceTest.xml Modified: camel/branches/camel-1.x/ (props changed) camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/InterceptType.java camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/OutputType.java camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ProceedType.java camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java camel/branches/camel-1.x/camel-core/src/main/resources/org/apache/camel/model/jaxb.index camel/branches/camel-1.x/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java Propchange: camel/branches/camel-1.x/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Feb 19 14:00:18 2009 @@ -1 +1 @@ -/camel/trunk:739733,739904,740251,740295,740306,740596,740663,741848,742231,742705,742739,742854,742856,742898,742906,743613,743762,743773,743920,743959-743960,744123,745105,745367,745541,745751 +/camel/trunk:739733,739904,740251,740295,740306,740596,740663,741848,742231,742705,742739,742854,742856,742898,742906,743613,743762,743773,743920,743959-743960,744123,745105,745367,745541,745751,745826 Propchange: camel/branches/camel-1.x/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/InterceptType.java URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/InterceptType.java?rev=745870&r1=745869&r2=745870&view=diff ============================================================================== --- camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/InterceptType.java (original) +++ camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/InterceptType.java Thu Feb 19 14:00:18 2009 @@ -16,17 +16,13 @@ */ package org.apache.camel.model; -import java.util.Collection; -import java.util.Collections; +import java.util.ArrayList; import java.util.List; - import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlTransient; -import org.apache.camel.Intercept; import org.apache.camel.Predicate; import org.apache.camel.Processor; import org.apache.camel.builder.PredicateBuilder; @@ -78,6 +74,9 @@ /** * Applies this interceptor only if the given predicate is true + * + * @param predicate the predicate + * @return the builder */ public ChoiceType when(Predicate predicate) { usePredicate = Boolean.TRUE; @@ -94,11 +93,51 @@ setStopIntercept(Boolean.TRUE); } - @XmlElement(name = "stop", required = false) - public void setStop(String elementValue /* not used */) { - stopIntercept(); - } - + /** + * This method is <b>only</b> for handling some post configuration + * that is needed from the Spring DSL side as JAXB does not invoke the fluent + * builders, so we need to manually handle this afterwards, and since this is + * an interceptor it has to do a bit of magic logic to fixup to handle predicates + * with or without proceed/stop set as well. + */ + public void afterPropertiesSet() { + List<ProcessorType<?>> list = new ArrayList<ProcessorType<?>>(); + for (ProcessorType<?> out : outputs) { + if (out instanceof WhenType) { + // JAXB does not invoke the when() fluent builder so we need to wrap the when in + // a choice with the proceed as the when for the Java DSL does + WhenType when = (WhenType) out; + usePredicate = Boolean.TRUE; + ChoiceType choice = new ChoiceType(); + choice.when(PredicateBuilder.not(when.getExpression())); + choice.addOutput(proceed); + list.add(choice); + + ChoiceType otherwise = choice.otherwise(); + // add the children to the otherwise + for (ProcessorType child : when.getOutputs()) { + if (child instanceof StopType) { + // notify we should stop + stopIntercept(); + } else { + otherwise.addOutput(child); + } + } + } else if (out instanceof StopType) { + // notify we shuld stop + stopIntercept(); + } else { + list.add(out); + } + } + + // replace old output with this redone output list + outputs.clear(); + for (ProcessorType<?> out : list) { + addOutput(out); + } + } + public InterceptType createProxy() { InterceptType answer = new InterceptType(); answer.getOutputs().addAll(this.getOutputs()); @@ -119,24 +158,24 @@ // for the predicated version we add the proceed() to otherwise() // before knowing if stop() will follow, so let's make a small adjustment - if (usePredicate.booleanValue() && getStopIntercept().booleanValue()) { + if (usePredicate && getStopIntercept()) { WhenType when = choice.getWhenClauses().get(0); when.getOutputs().remove(this.getProceed()); } // add proceed to the when clause addProceedProxy(this.getProceed(), answer.getProceed(), - choice.getWhenClauses().get(choice.getWhenClauses().size() - 1), usePredicate.booleanValue() && !getStopIntercept().booleanValue()); + choice.getWhenClauses().get(choice.getWhenClauses().size() - 1), usePredicate && !getStopIntercept()); // force adding a proceed at the end (otherwise) if its not a stop type - addProceedProxy(this.getProceed(), answer.getProceed(), choice.getOtherwise(), !getStopIntercept().booleanValue()); + addProceedProxy(this.getProceed(), answer.getProceed(), choice.getOtherwise(), !getStopIntercept()); - if (getStopIntercept().booleanValue()) { + if (getStopIntercept()) { // must add proceed to when clause if stop is explictiy declared, otherwise when the // predicate test fails then there is no proceed // See example: InterceptorSimpleRouteTest (City Paris is never proceeded) addProceedProxy(this.getProceed(), answer.getProceed(), - choice.getWhenClauses().get(choice.getWhenClauses().size() - 1), usePredicate.booleanValue()); + choice.getWhenClauses().get(choice.getWhenClauses().size() - 1), usePredicate); } break; @@ -144,7 +183,7 @@ } if (choice == null) { // force adding a proceed at the end if its not a stop type - addProceedProxy(this.getProceed(), answer.getProceed(), answer, !getStopIntercept().booleanValue()); + addProceedProxy(this.getProceed(), answer.getProceed(), answer, !getStopIntercept()); } } Modified: camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/OutputType.java URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/OutputType.java?rev=745870&r1=745869&r2=745870&view=diff ============================================================================== --- camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/OutputType.java (original) +++ camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/OutputType.java Thu Feb 19 14:00:18 2009 @@ -61,14 +61,5 @@ output.setErrorHandlerBuilder(getErrorHandlerBuilder()); } // don't inherit interceptors by default -/* - List<InterceptorType> list = output.getInterceptors(); - if (list == null) { - log.warn("No interceptor collection: " + output); - } - else { - list.addAll(getInterceptors()); - } -*/ } } Modified: camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ProceedType.java URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ProceedType.java?rev=745870&r1=745869&r2=745870&view=diff ============================================================================== --- camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ProceedType.java (original) +++ camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ProceedType.java Thu Feb 19 14:00:18 2009 @@ -37,9 +37,17 @@ return "proceed"; } - // TODO we should be just returning the outputs! public Processor createProcessor(RouteContext routeContext) throws Exception { - //return routeContext.createProceedProcessor(); return createOutputsProcessor(routeContext); } + + @Override + public String getLabel() { + return getShortName(); + } + + @Override + public String toString() { + return "proceed[" + getOutputs() + "]"; + } } Modified: camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java?rev=745870&r1=745869&r2=745870&view=diff ============================================================================== --- camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java (original) +++ camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java Thu Feb 19 14:00:18 2009 @@ -38,9 +38,6 @@ * Creates a {...@link PollingConsumer} and polls all pending messages on the endpoint * and invokes the given {...@link Processor} to process each {...@link Exchange} and then closes * down the consumer and throws any exceptions thrown. - * - * @param endpoint - * @param processor */ public static void pollEndpoint(Endpoint endpoint, Processor processor, long timeout) throws Exception { PollingConsumer consumer = endpoint.createPollingConsumer(); @@ -69,9 +66,6 @@ * endpoint and invokes the given {...@link Processor} to process each * {...@link Exchange} and then closes down the consumer and throws any * exceptions thrown. - * - * @param endpoint - * @param processor */ public static void pollEndpoint(Endpoint endpoint, Processor processor) throws Exception { pollEndpoint(endpoint, processor, 1000L); Copied: camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/util/ProcessorTypeHelper.java (from r745826, camel/trunk/camel-core/src/main/java/org/apache/camel/util/ProcessorTypeHelper.java) URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/util/ProcessorTypeHelper.java?p2=camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/util/ProcessorTypeHelper.java&p1=camel/trunk/camel-core/src/main/java/org/apache/camel/util/ProcessorTypeHelper.java&r1=745826&r2=745870&rev=745870&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/util/ProcessorTypeHelper.java (original) +++ camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/util/ProcessorTypeHelper.java Thu Feb 19 14:00:18 2009 @@ -39,7 +39,7 @@ * @return the first found type, or <tt>null</tt> if not found */ @SuppressWarnings("unchecked") - public static <T> T findFirstTypeInOutputs(List<ProcessorType> outputs, Class<T> type) { + public static <T> T findFirstTypeInOutputs(List<ProcessorType<?>> outputs, Class<T> type) { if (outputs == null || outputs.isEmpty()) { return null; } @@ -53,14 +53,14 @@ if (out instanceof ChoiceType) { ChoiceType choice = (ChoiceType) out; for (WhenType when : choice.getWhenClauses()) { - List<ProcessorType> children = when.getOutputs(); + List<ProcessorType<?>> children = when.getOutputs(); T child = findFirstTypeInOutputs(children, type); if (child != null) { return child; } } - List<ProcessorType> children = choice.getOtherwise().getOutputs(); + List<ProcessorType<?>> children = choice.getOtherwise().getOutputs(); T child = findFirstTypeInOutputs(children, type); if (child != null) { return child; @@ -68,7 +68,7 @@ } // try children as well - List<ProcessorType> children = out.getOutputs(); + List<ProcessorType<?>> children = out.getOutputs(); T child = findFirstTypeInOutputs(children, type); if (child != null) { return child; Modified: camel/branches/camel-1.x/camel-core/src/main/resources/org/apache/camel/model/jaxb.index URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/camel-core/src/main/resources/org/apache/camel/model/jaxb.index?rev=745870&r1=745869&r2=745870&view=diff ============================================================================== --- camel/branches/camel-1.x/camel-core/src/main/resources/org/apache/camel/model/jaxb.index (original) +++ camel/branches/camel-1.x/camel-core/src/main/resources/org/apache/camel/model/jaxb.index Thu Feb 19 14:00:18 2009 @@ -59,6 +59,7 @@ SetOutHeaderType SetPropertyType SplitterType +StopType ThrottlerType ThreadType ThrowFaultType Copied: camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/InterceptWhenNoStopTest.java (from r745826, camel/trunk/camel-core/src/test/java/org/apache/camel/processor/InterceptWhenNoStopTest.java) URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/InterceptWhenNoStopTest.java?p2=camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/InterceptWhenNoStopTest.java&p1=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/InterceptWhenNoStopTest.java&r1=745826&r2=745870&rev=745870&view=diff ============================================================================== --- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/InterceptWhenNoStopTest.java (original) +++ camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/InterceptWhenNoStopTest.java Thu Feb 19 14:00:18 2009 @@ -18,8 +18,6 @@ import org.apache.camel.ContextTestSupport; import org.apache.camel.builder.RouteBuilder; -import static org.apache.camel.builder.PredicateBuilder.toPredicate; -import static org.apache.camel.language.simple.SimpleLanguage.simple; /** * @version $Revision$ @@ -49,7 +47,7 @@ return new RouteBuilder() { @Override public void configure() throws Exception { - intercept().when(toPredicate(simple("${body} contains 'Goofy'"))).to("mock:goofy"); + intercept().when(body().contains("Goofy")).to("mock:goofy"); from("direct:start").to("mock:end"); } Added: camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/InterceptWhenTest.java URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/InterceptWhenTest.java?rev=745870&view=auto ============================================================================== --- camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/InterceptWhenTest.java (added) +++ camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/InterceptWhenTest.java Thu Feb 19 14:00:18 2009 @@ -0,0 +1,56 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.processor; + +import org.apache.camel.ContextTestSupport; +import org.apache.camel.builder.RouteBuilder; + +/** + * @version $Revision$ + */ +public class InterceptWhenTest extends ContextTestSupport { + + public void testInterceptorWhen() throws Exception { + getMockEndpoint("mock:goofy").expectedMessageCount(0); + getMockEndpoint("mock:end").expectedMessageCount(1); + + sendBody("direct:start", "Hello World!"); + + assertMockEndpointsSatisfied(); + } + + public void testInterceptorWhenGoofy() throws Exception { + getMockEndpoint("mock:goofy").expectedMessageCount(1); + getMockEndpoint("mock:end").expectedMessageCount(0); + + sendBody("direct:start", "Hello Goofy"); + + assertMockEndpointsSatisfied(); + } + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + intercept().when(body().contains("Goofy")).to("mock:goofy").stop(); + + from("direct:start").to("mock:end"); + } + }; + } +} \ No newline at end of file Propchange: camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/InterceptWhenTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/InterceptWhenTest.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Copied: camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/InterceptWhenWithChoiceTest.java (from r745826, camel/trunk/camel-core/src/test/java/org/apache/camel/processor/InterceptWhenWithChoiceTest.java) URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/InterceptWhenWithChoiceTest.java?p2=camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/InterceptWhenWithChoiceTest.java&p1=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/InterceptWhenWithChoiceTest.java&r1=745826&r2=745870&rev=745870&view=diff ============================================================================== --- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/InterceptWhenWithChoiceTest.java (original) +++ camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/InterceptWhenWithChoiceTest.java Thu Feb 19 14:00:18 2009 @@ -18,8 +18,6 @@ import org.apache.camel.ContextTestSupport; import org.apache.camel.builder.RouteBuilder; -import static org.apache.camel.builder.PredicateBuilder.toPredicate; -import static org.apache.camel.language.simple.SimpleLanguage.simple; /** * @version $Revision$ @@ -65,7 +63,7 @@ @Override public void configure() throws Exception { intercept() - .when(toPredicate(simple("${body} contains 'Goofy'"))) + .when(body().contains("Goofy")) .choice() .when(body().contains("Hello")).to("mock:hello") .otherwise().to("mock:goofy") Modified: camel/branches/camel-1.x/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java?rev=745870&r1=745869&r2=745870&view=diff ============================================================================== --- camel/branches/camel-1.x/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java (original) +++ camel/branches/camel-1.x/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java Thu Feb 19 14:00:18 2009 @@ -49,6 +49,7 @@ import org.apache.camel.processor.interceptor.Tracer; import org.apache.camel.spi.LifecycleStrategy; import org.apache.camel.spi.Registry; +import org.apache.camel.util.ProcessorTypeHelper; import org.apache.camel.util.ResolverUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -64,7 +65,6 @@ import static org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException; - /** * A Spring {...@link FactoryBean} to create and initialize a * {...@link SpringCamelContext} and install routes either explicitly configured in @@ -214,17 +214,17 @@ // add exception handlers as top children route.getOutputs().addAll(exceptionHandlers); - // add the interceptor + // add the interceptor but we must do some pre configuration beforehand + intercept.afterPropertiesSet(); InterceptType proxy = intercept.createProxy(); route.addOutput(proxy); route.pushBlock(proxy.getProceed()); - int outputsSize = proxy.getOutputs().size(); - if (outputsSize > 0) { - ProcessorType processorType = proxy.getOutputs().get(outputsSize - 1); - if (processorType instanceof ProceedType) { - route.getOutputs().addAll(outputs); - } + // if there is a proceed in the interceptor proxy then we should add + // the current outputs to out route so we will proceed and continue to route to them + ProceedType proceed = ProcessorTypeHelper.findFirstTypeInOutputs(proxy.getOutputs(), ProceedType.class); + if (proceed != null) { + proceed.getOutputs().addAll(outputs); } } Added: camel/branches/camel-1.x/components/camel-spring/src/test/java/org/apache/camel/spring/processor/GoofyBean.java URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-spring/src/test/java/org/apache/camel/spring/processor/GoofyBean.java?rev=745870&view=auto ============================================================================== --- camel/branches/camel-1.x/components/camel-spring/src/test/java/org/apache/camel/spring/processor/GoofyBean.java (added) +++ camel/branches/camel-1.x/components/camel-spring/src/test/java/org/apache/camel/spring/processor/GoofyBean.java Thu Feb 19 14:00:18 2009 @@ -0,0 +1,28 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.spring.processor; + +public class GoofyBean { + + public boolean isGoody(String body) { + return body.contains("Goofy"); + } + + public boolean isHello(String body) { + return body.contains("Hello"); + } +} Propchange: camel/branches/camel-1.x/components/camel-spring/src/test/java/org/apache/camel/spring/processor/GoofyBean.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: camel/branches/camel-1.x/components/camel-spring/src/test/java/org/apache/camel/spring/processor/GoofyBean.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Copied: camel/branches/camel-1.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptWhenNoStopTest.xml (from r745826, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptWhenNoStopTest.xml) URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptWhenNoStopTest.xml?p2=camel/branches/camel-1.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptWhenNoStopTest.xml&p1=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptWhenNoStopTest.xml&r1=745826&r2=745870&rev=745870&view=diff ============================================================================== --- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptWhenNoStopTest.xml (original) +++ camel/branches/camel-1.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptWhenNoStopTest.xml Thu Feb 19 14:00:18 2009 @@ -19,14 +19,14 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd - http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd + http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd "> <!-- START SNIPPET: example --> - <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> + <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring"> <intercept> <when> - <simple>${body} contains 'Goofy'</simple> + <methodCall bean="goofy" method="isGoody"/> <to uri="mock:goofy"/> </when> </intercept> @@ -35,5 +35,7 @@ <to uri="mock:end"/> </route> </camelContext> + + <bean id="goofy" class="org.apache.camel.spring.processor.GoofyBean"/> <!-- END SNIPPET: example --> </beans> Copied: camel/branches/camel-1.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptWhenTest.xml (from r745826, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptWhenTest.xml) URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptWhenTest.xml?p2=camel/branches/camel-1.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptWhenTest.xml&p1=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptWhenTest.xml&r1=745826&r2=745870&rev=745870&view=diff ============================================================================== --- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptWhenTest.xml (original) +++ camel/branches/camel-1.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptWhenTest.xml Thu Feb 19 14:00:18 2009 @@ -19,14 +19,14 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd - http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd + http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd "> <!-- START SNIPPET: example --> - <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> + <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring"> <intercept> <when> - <simple>${body} contains 'Goofy'</simple> + <methodCall bean="goofy" method="isGoody"/> <to uri="mock:goofy"/> <stop/> </when> @@ -36,5 +36,7 @@ <to uri="mock:end"/> </route> </camelContext> + + <bean id="goofy" class="org.apache.camel.spring.processor.GoofyBean"/> <!-- END SNIPPET: example --> </beans> Copied: camel/branches/camel-1.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptWhenWithChoiceTest.xml (from r745826, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptWhenWithChoiceTest.xml) URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptWhenWithChoiceTest.xml?p2=camel/branches/camel-1.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptWhenWithChoiceTest.xml&p1=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptWhenWithChoiceTest.xml&r1=745826&r2=745870&rev=745870&view=diff ============================================================================== --- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptWhenWithChoiceTest.xml (original) +++ camel/branches/camel-1.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptWhenWithChoiceTest.xml Thu Feb 19 14:00:18 2009 @@ -19,17 +19,17 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd - http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd + http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd "> <!-- START SNIPPET: example --> - <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> + <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring"> <intercept> <when> - <simple>${body} contains 'Goofy'</simple> + <methodCall bean="goofy" method="isGoody"/> <choice> <when> - <simple>${body} contains 'Hello'</simple> + <methodCall bean="goofy" method="isHello"/> <to uri="mock:hello"/> </when> <otherwise> @@ -45,5 +45,7 @@ <to uri="mock:end"/> </route> </camelContext> + + <bean id="goofy" class="org.apache.camel.spring.processor.GoofyBean"/> <!-- END SNIPPET: example --> </beans>