This is an automated email from the ASF dual-hosted git repository. gnodet pushed a commit to branch sandbox/camel-3.x in repository https://gitbox.apache.org/repos/asf/camel.git
commit 19f85fa1d8741c68ebd1d86be772cb6cf37bde57 Author: Guillaume Nodet <gno...@gmail.com> AuthorDate: Tue Sep 25 09:46:16 2018 +0200 [CAMEL-12818] Remove multiParameterArray, enrichRef, pollEnrichRef --- camel-core/src/main/docs/bean-component.adoc | 3 +- camel-core/src/main/docs/class-component.adoc | 3 +- camel-core/src/main/docs/eips/bean-eip.adoc | 3 +- camel-core/src/main/docs/eips/loadBalance-eip.adoc | 2 +- camel-core/src/main/docs/simple-language.adoc | 2 +- .../src/main/java/org/apache/camel/Exchange.java | 2 - .../component/bean/AbstractBeanProcessor.java | 16 -- .../apache/camel/component/bean/BeanEndpoint.java | 22 -- .../apache/camel/component/bean/BeanProcessor.java | 8 - .../apache/camel/component/bean/MethodInfo.java | 42 +--- .../org/apache/camel/model/BeanDefinition.java | 22 -- .../apache/camel/model/ProcessorDefinition.java | 275 +-------------------- .../java/org/apache/camel/model/ToDefinition.java | 12 - .../camel/component/bean/BeanEndpointTest.java | 1 - .../apache/camel/component/bean/BeanInfoTest.java | 3 - .../bean/BeanMethodWithMultipleParametersTest.java | 98 -------- .../camel/component/bean/BeanNoCacheTest.java | 2 +- .../camel/processor/enricher/EnricherRefTest.java | 2 +- .../processor/enricher/PollEnricherRefTest.java | 2 +- .../routingslip/RoutingSlipWithExceptionTest.java | 2 +- .../camel/runtimecatalog/JSonSchemaHelperTest.java | 7 +- .../cxf/jaxrs/CxfRsConsumerWithBeanTest.java | 4 +- 22 files changed, 29 insertions(+), 504 deletions(-) diff --git a/camel-core/src/main/docs/bean-component.adoc b/camel-core/src/main/docs/bean-component.adoc index e8f777a..b4277f8 100644 --- a/camel-core/src/main/docs/bean-component.adoc +++ b/camel-core/src/main/docs/bean-component.adoc @@ -52,7 +52,7 @@ with the following path and query parameters: |=== -==== Query Parameters (5 parameters): +==== Query Parameters (4 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -60,7 +60,6 @@ with the following path and query parameters: | Name | Description | Default | Type | *method* (producer) | Sets the name of the method to invoke on the bean | | String | *cache* (advanced) | If enabled, Camel will cache the result of the first Registry look-up. Cache can be enabled if the bean in the Registry is defined as a singleton scope. | | Boolean -| *multiParameterArray* (advanced) | *Deprecated* How to treat the parameters which are passed from the message body; if it is true, the message body should be an array of parameters. Note: This option is used internally by Camel, and is not intended for end users to use. Deprecation note: This option is used internally by Camel, and is not intended for end users to use. | false | boolean | *parameters* (advanced) | Used for configuring additional properties on the bean | | Map | *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean |=== diff --git a/camel-core/src/main/docs/class-component.adoc b/camel-core/src/main/docs/class-component.adoc index cece0d1..83a9c98 100644 --- a/camel-core/src/main/docs/class-component.adoc +++ b/camel-core/src/main/docs/class-component.adoc @@ -55,7 +55,7 @@ with the following path and query parameters: |=== -==== Query Parameters (5 parameters): +==== Query Parameters (4 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -63,7 +63,6 @@ with the following path and query parameters: | Name | Description | Default | Type | *method* (producer) | Sets the name of the method to invoke on the bean | | String | *cache* (advanced) | If enabled, Camel will cache the result of the first Registry look-up. Cache can be enabled if the bean in the Registry is defined as a singleton scope. | | Boolean -| *multiParameterArray* (advanced) | *Deprecated* How to treat the parameters which are passed from the message body; if it is true, the message body should be an array of parameters. Note: This option is used internally by Camel, and is not intended for end users to use. Deprecation note: This option is used internally by Camel, and is not intended for end users to use. | false | boolean | *parameters* (advanced) | Used for configuring additional properties on the bean | | Map | *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean |=== diff --git a/camel-core/src/main/docs/eips/bean-eip.adoc b/camel-core/src/main/docs/eips/bean-eip.adoc index d3c3917..f8c2be8 100644 --- a/camel-core/src/main/docs/eips/bean-eip.adoc +++ b/camel-core/src/main/docs/eips/bean-eip.adoc @@ -16,7 +16,7 @@ the link:registry.html[Registry] === EIP options // eip options: START -The Bean EIP supports 5 options which are listed below: +The Bean EIP supports 4 options which are listed below: [width="100%",cols="2,5,^1,2",options="header"] |=== @@ -25,7 +25,6 @@ The Bean EIP supports 5 options which are listed below: | *method* | Sets the method name on the bean to use | | String | *beanType* | Sets the Class of the bean | | String | *cache* | Caches the bean lookup, to avoid lookup up bean on every usage. | true | Boolean -| *multiParameterArray* | *Deprecated* Whether the message body is an array type. | false | Boolean |=== // eip options: END diff --git a/camel-core/src/main/docs/eips/loadBalance-eip.adoc b/camel-core/src/main/docs/eips/loadBalance-eip.adoc index 8023c64..d670bd4 100644 --- a/camel-core/src/main/docs/eips/loadBalance-eip.adoc +++ b/camel-core/src/main/docs/eips/loadBalance-eip.adoc @@ -17,7 +17,7 @@ Camel provides the following policies out-of-the-box: | Failover | In case of failures the exchange will be tried on the next endpoint. | Weighted Round-Robin | *Camel 2.5*: The weighted load balancing policy allows you to specify a processing load distribution ratio for each server with respect to the others. In addition to the weight, endpoint selection is then further refined using *round-robin* distribution based on weight. | Weighted Random | *Camel 2.5*: The weighted load balancing policy allows you to specify a processing load distribution ratio for each server with respect to others.In addition to the weight, endpoint selection is then further refined using *random* distribution based on weight. -| Custom | *Camel 2.8*: From *Camel 2.8* onwards the preferred way of using a custom Load Balancer is to use this policy, instead of using the `@deprecated` ref attribute. +| Custom | *Camel 2.8*: From *Camel 2.8* onwards the preferred way of using a custom Load Balancer is to use this policy, as the ref attribute is not supported anymore. | Circuit Breaker | *Camel 2.14*: Implements the Circuit Breaker pattern as described in "Release it!" book. |======================================================================= diff --git a/camel-core/src/main/docs/simple-language.adoc b/camel-core/src/main/docs/simple-language.adoc index b2b8ad3..89c683c 100644 --- a/camel-core/src/main/docs/simple-language.adoc +++ b/camel-core/src/main/docs/simple-language.adoc @@ -46,7 +46,7 @@ language as a Predicate then the literal text *must* be enclosed in either single or double quotes. For example: `"${body} == 'Camel'"`. Notice how we have single quotes around the literal. The old style of using `"body"` and `"header.foo"` to refer to -the message body and header is @deprecated, and it is encouraged to +the message body and header is not supported anymore, and it is required to always use $\{ } tokens for the built-in functions. The range operator now requires the range to be in single quote as well as shown: `"${header.zip} between '30000..39999'"`. diff --git a/camel-core/src/main/java/org/apache/camel/Exchange.java b/camel-core/src/main/java/org/apache/camel/Exchange.java index 500b782..55e14b9 100644 --- a/camel-core/src/main/java/org/apache/camel/Exchange.java +++ b/camel-core/src/main/java/org/apache/camel/Exchange.java @@ -90,8 +90,6 @@ public interface Exchange { String BATCH_SIZE = "CamelBatchSize"; String BATCH_COMPLETE = "CamelBatchComplete"; String BEAN_METHOD_NAME = "CamelBeanMethodName"; - @Deprecated - String BEAN_MULTI_PARAMETER_ARRAY = "CamelBeanMultiParameterArray"; String BINDING = "CamelBinding"; // do not prefix with Camel and use lower-case starting letter as its a shared key // used across other Apache products such as AMQ, SMX etc. diff --git a/camel-core/src/main/java/org/apache/camel/component/bean/AbstractBeanProcessor.java b/camel-core/src/main/java/org/apache/camel/component/bean/AbstractBeanProcessor.java index 8e44bd9..f437009 100644 --- a/camel-core/src/main/java/org/apache/camel/component/bean/AbstractBeanProcessor.java +++ b/camel-core/src/main/java/org/apache/camel/component/bean/AbstractBeanProcessor.java @@ -41,7 +41,6 @@ public abstract class AbstractBeanProcessor implements AsyncProcessor { private transient Processor processor; private transient boolean lookupProcessorDone; private final Object lock = new Object(); - private boolean multiParameterArray; private Boolean cache; private String method; private boolean shorthandMethod; @@ -162,10 +161,6 @@ public abstract class AbstractBeanProcessor implements AsyncProcessor { } } - // set temporary header which is a hint for the bean info that introspect the bean - if (isMultiParameterArray()) { - in.setHeader(Exchange.BEAN_MULTI_PARAMETER_ARRAY, Boolean.TRUE); - } // set explicit method name to invoke as a header, which is how BeanInfo can detect it if (explicitMethodName != null) { in.setHeader(Exchange.BEAN_METHOD_NAME, explicitMethodName); @@ -180,9 +175,6 @@ public abstract class AbstractBeanProcessor implements AsyncProcessor { return true; } finally { // must remove headers as they were provisional - if (isMultiParameterArray()) { - in.removeHeader(Exchange.BEAN_MULTI_PARAMETER_ARRAY); - } if (explicitMethodName != null) { in.removeHeader(Exchange.BEAN_METHOD_NAME); } @@ -217,14 +209,6 @@ public abstract class AbstractBeanProcessor implements AsyncProcessor { return method; } - public boolean isMultiParameterArray() { - return multiParameterArray; - } - - public void setMultiParameterArray(boolean mpArray) { - multiParameterArray = mpArray; - } - public Boolean getCache() { return cache; } diff --git a/camel-core/src/main/java/org/apache/camel/component/bean/BeanEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/bean/BeanEndpoint.java index 00e0c48..fbc1afc 100644 --- a/camel-core/src/main/java/org/apache/camel/component/bean/BeanEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/component/bean/BeanEndpoint.java @@ -43,10 +43,6 @@ public class BeanEndpoint extends DefaultEndpoint { @UriParam(label = "advanced", description = "If enabled, Camel will cache the result of the first Registry look-up." + " Cache can be enabled if the bean in the Registry is defined as a singleton scope.") private Boolean cache; - @UriParam(label = "advanced", description = "How to treat the parameters which are passed from the message body." - + "true means the message body should be an array of parameters.") - @Deprecated @Metadata(deprecationNode = "This option is used internally by Camel, and is not intended for end users to use.") - private boolean multiParameterArray; @UriParam(prefix = "bean.", label = "advanced", description = "Used for configuring additional properties on the bean", multiValue = true) private Map<String, Object> parameters; @@ -102,7 +98,6 @@ public class BeanEndpoint extends DefaultEndpoint { if (method != null) { processor.setMethod(method); } - processor.setMultiParameterArray(isMultiParameterArray()); processor.setCache(cache); if (parameters != null) { setProperties(processor, parameters); @@ -130,23 +125,6 @@ public class BeanEndpoint extends DefaultEndpoint { this.beanName = beanName; } - public boolean isMultiParameterArray() { - return multiParameterArray; - } - - /** - * How to treat the parameters which are passed from the message body; - * if it is true, the message body should be an array of parameters. - * <p/> - * Note: This option is used internally by Camel, and is not intended for end users to use. - * - * @deprecated this option is used internally by Camel, and is not intended for end users to use - */ - @Deprecated - public void setMultiParameterArray(boolean mpArray) { - multiParameterArray = mpArray; - } - public boolean isCache() { return cache != null ? cache : false; } diff --git a/camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java b/camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java index cbf68c4..7410508 100644 --- a/camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java +++ b/camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java @@ -69,14 +69,6 @@ public class BeanProcessor extends ServiceSupport implements AsyncProcessor { return delegate.getMethod(); } - public boolean isMultiParameterArray() { - return delegate.isMultiParameterArray(); - } - - public void setMultiParameterArray(boolean mpArray) { - delegate.setMultiParameterArray(mpArray); - } - public Boolean getCache() { return delegate.getCache(); } diff --git a/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java b/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java index 1461b2c..00e040d 100644 --- a/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java +++ b/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java @@ -641,13 +641,6 @@ public class MethodInfo { @SuppressWarnings("unchecked") public <T> T evaluate(Exchange exchange, Class<T> type) { Object body = exchange.getIn().getBody(); - boolean multiParameterArray = exchange.getIn().getHeader(Exchange.BEAN_MULTI_PARAMETER_ARRAY, false, boolean.class); - if (multiParameterArray) { - // Just change the message body to an Object array - if (!(body instanceof Object[])) { - body = exchange.getIn().getBody(Object[].class); - } - } // if there was an explicit method name to invoke, then we should support using // any provided parameter values in the method name @@ -667,21 +660,18 @@ public class MethodInfo { // we need to do this before the expressions gets evaluated as it may contain // a @Bean expression which would by mistake read these headers. So the headers // must be removed at this point of time - if (multiParameterArray) { - exchange.getIn().removeHeader(Exchange.BEAN_MULTI_PARAMETER_ARRAY); - } if (methodName != null) { exchange.getIn().removeHeader(Exchange.BEAN_METHOD_NAME); } - Object[] answer = evaluateParameterExpressions(exchange, body, multiParameterArray, it); + Object[] answer = evaluateParameterExpressions(exchange, body, it); return (T) answer; } /** * Evaluates all the parameter expressions */ - private Object[] evaluateParameterExpressions(Exchange exchange, Object body, boolean multiParameterArray, Iterator<?> it) { + private Object[] evaluateParameterExpressions(Exchange exchange, Object body, Iterator<?> it) { Object[] answer = new Object[expressions.length]; for (int i = 0; i < expressions.length; i++) { @@ -697,24 +687,16 @@ public class MethodInfo { // the value for the parameter to use Object value = null; - if (multiParameterArray && body instanceof Object[]) { - // get the value from the array - Object[] array = (Object[]) body; - if (array.length >= i) { - value = array[i]; - } - } else { - // prefer to use parameter value if given, as they override any bean parameter binding - // we should skip * as its a type placeholder to indicate any type - if (parameterValue != null && !parameterValue.equals("*")) { - // evaluate the parameter value binding - value = evaluateParameterValue(exchange, i, parameterValue, parameterType); - } - // use bean parameter binding, if still no value - Expression expression = expressions[i]; - if (value == null && expression != null) { - value = evaluateParameterBinding(exchange, expression, i, parameterType); - } + // prefer to use parameter value if given, as they override any bean parameter binding + // we should skip * as its a type placeholder to indicate any type + if (parameterValue != null && !parameterValue.equals("*")) { + // evaluate the parameter value binding + value = evaluateParameterValue(exchange, i, parameterValue, parameterType); + } + // use bean parameter binding, if still no value + Expression expression = expressions[i]; + if (value == null && expression != null) { + value = evaluateParameterBinding(exchange, expression, i, parameterType); } // remember the value to use if (value != Void.TYPE) { diff --git a/camel-core/src/main/java/org/apache/camel/model/BeanDefinition.java b/camel-core/src/main/java/org/apache/camel/model/BeanDefinition.java index 6dc0dbf..62b78f4 100644 --- a/camel-core/src/main/java/org/apache/camel/model/BeanDefinition.java +++ b/camel-core/src/main/java/org/apache/camel/model/BeanDefinition.java @@ -53,9 +53,6 @@ public class BeanDefinition extends NoOutputDefinition<BeanDefinition> { private String beanType; @XmlAttribute @Metadata(defaultValue = "true") private Boolean cache; - @XmlAttribute - @Deprecated - private Boolean multiParameterArray; @XmlTransient private Class<?> beanClass; @XmlTransient @@ -163,20 +160,6 @@ public class BeanDefinition extends NoOutputDefinition<BeanDefinition> { public void setCache(Boolean cache) { this.cache = cache; } - - public Boolean getMultiParameterArray() { - return multiParameterArray; - } - - /** - * Whether the message body is an array type. - * - * @deprecated is to be replaced with a better solution in Camel 3.0 - */ - @Deprecated - public void setMultiParameterArray(Boolean multiParameterArray) { - this.multiParameterArray = multiParameterArray; - } // Fluent API //------------------------------------------------------------------------- @@ -261,11 +244,6 @@ public class BeanDefinition extends NoOutputDefinition<BeanDefinition> { answer = new BeanProcessor(beanHolder); } - // check for multiParameterArray setting - if (multiParameterArray != null) { - answer.setMultiParameterArray(multiParameterArray); - } - // check for method exists if (method != null) { answer.setMethod(method); diff --git a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java index 4385cd9..bf1f76e 100644 --- a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java +++ b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java @@ -24,7 +24,6 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; -import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Function; @@ -869,20 +868,6 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type> } /** - * <a href="http://camel.apache.org/exchange-pattern.html">ExchangePattern:</a> - * set the exchange's ExchangePattern {@link ExchangePattern} to be InOnly - * <p/> - * The pattern set on the {@link Exchange} will be changed from this point going foward. - * - * @return the builder - * @deprecated use {@link #setExchangePattern(org.apache.camel.ExchangePattern)} instead - */ - @Deprecated - public Type inOnly() { - return setExchangePattern(ExchangePattern.InOnly); - } - - /** * Sends the message to the given endpoint using an * <a href="http://camel.apache.org/event-message.html">Event Message</a> or * <a href="http://camel.apache.org/exchange-pattern.html">InOnly exchange pattern</a> @@ -953,18 +938,6 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type> } /** - * <a href="http://camel.apache.org/exchange-pattern.html">ExchangePattern:</a> - * set the exchange's ExchangePattern {@link ExchangePattern} to be InOut - * - * @return the builder - * @deprecated use {@link #setExchangePattern(org.apache.camel.ExchangePattern)} instead - */ - @Deprecated - public Type inOut() { - return setExchangePattern(ExchangePattern.InOut); - } - - /** * Sends the message to the given endpoint using an * <a href="http://camel.apache.org/request-reply.html">Request Reply</a> or * <a href="http://camel.apache.org/exchange-pattern.html">InOut exchange pattern</a> @@ -1795,75 +1768,6 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type> * Creates a routing slip allowing you to route a message consecutively through a series of processing * steps where the sequence of steps is not known at design time and can vary for each message. * <p/> - * The list of URIs will be split based on the default delimiter {@link RoutingSlipDefinition#DEFAULT_DELIMITER} - * <p/> - * The route slip will be evaluated <i>once</i>, use {@link #dynamicRouter()} if you need even more dynamic routing. - * - * @param header is the header that the {@link org.apache.camel.processor.RoutingSlip RoutingSlip} - * class will look in for the list of URIs to route the message to. - * @return the builder - * @deprecated prefer to use {@link #routingSlip(org.apache.camel.Expression)} instead - */ - @Deprecated - public Type routingSlip(String header) { - RoutingSlipDefinition<Type> answer = new RoutingSlipDefinition<>(header); - addOutput(answer); - return (Type) this; - } - - /** - * <a href="http://camel.apache.org/routing-slip.html">Routing Slip EIP:</a> - * Creates a routing slip allowing you to route a message consecutively through a series of processing - * steps where the sequence of steps is not known at design time and can vary for each message. - * <p/> - * The route slip will be evaluated <i>once</i>, use {@link #dynamicRouter()} if you need even more dynamic routing. - * - * @param header is the header that the {@link org.apache.camel.processor.RoutingSlip RoutingSlip} - * class will look in for the list of URIs to route the message to. - * @param uriDelimiter is the delimiter that will be used to split up - * the list of URIs in the routing slip. - * @param ignoreInvalidEndpoints if this parameter is true, routingSlip will ignore the endpoints which - * cannot be resolved or a producer cannot be created or started - * @return the builder - * @deprecated prefer to use {@link #routingSlip()} instead - */ - @Deprecated - public Type routingSlip(String header, String uriDelimiter, boolean ignoreInvalidEndpoints) { - RoutingSlipDefinition<Type> answer = new RoutingSlipDefinition<>(header, uriDelimiter); - answer.setIgnoreInvalidEndpoints(ignoreInvalidEndpoints); - addOutput(answer); - return (Type) this; - } - - /** - * <a href="http://camel.apache.org/routing-slip.html">Routing Slip EIP:</a> - * Creates a routing slip allowing you to route a message consecutively through a series of processing - * steps where the sequence of steps is not known at design time and can vary for each message. - * <p/> - * The list of URIs will be split based on the default delimiter {@link RoutingSlipDefinition#DEFAULT_DELIMITER} - * <p/> - * The route slip will be evaluated <i>once</i>, use {@link #dynamicRouter()} if you need even more dynamic routing. - * - * @param header is the header that the {@link org.apache.camel.processor.RoutingSlip RoutingSlip} - * class will look in for the list of URIs to route the message to. - * @param ignoreInvalidEndpoints if this parameter is true, routingSlip will ignore the endpoints which - * cannot be resolved or a producer cannot be created or started - * @return the builder - * @deprecated prefer to use {@link #routingSlip()} instead - */ - @Deprecated - public Type routingSlip(String header, boolean ignoreInvalidEndpoints) { - RoutingSlipDefinition<Type> answer = new RoutingSlipDefinition<>(header); - answer.setIgnoreInvalidEndpoints(ignoreInvalidEndpoints); - addOutput(answer); - return (Type) this; - } - - /** - * <a href="http://camel.apache.org/routing-slip.html">Routing Slip EIP:</a> - * Creates a routing slip allowing you to route a message consecutively through a series of processing - * steps where the sequence of steps is not known at design time and can vary for each message. - * <p/> * The route slip will be evaluated <i>once</i>, use {@link #dynamicRouter()} if you need even more dynamic routing. * * @param expression to decide the destinations @@ -2626,24 +2530,6 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type> /** * <a href="http://camel.apache.org/message-translator.html">Message Translator EIP:</a> - * Adds the custom processor reference to this destination which could be a final - * destination, or could be a transformation in a pipeline - * - * @param ref reference to a {@link Processor} to lookup in the registry - * @return the builder - * @deprecated use {@link #process(String)} - */ - @SuppressWarnings("unchecked") - @Deprecated - public Type processRef(String ref) { - ProcessDefinition answer = new ProcessDefinition(); - answer.setRef(ref); - addOutput(answer); - return (Type) this; - } - - /** - * <a href="http://camel.apache.org/message-translator.html">Message Translator EIP:</a> * Adds the custom processor using a fluent builder to this destination which could be a final * destination, or could be a transformation in a pipeline * @@ -2776,49 +2662,23 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type> addOutput(answer); return (Type) this; } - - /** - * <a href="http://camel.apache.org/message-translator.html">Message Translator EIP:</a> - * Adds a bean which is invoked which could be a final destination, or could be a transformation in a pipeline - * - * @param beanType the bean class, Camel will instantiate an object at runtime - * @param method the method name to invoke on the bean (can be used to avoid ambiguity) - * @param multiParameterArray if it is true, camel will treat the message body as an object array which holds - * the multi parameter - * @return the builder - * @deprecated the option multiParameterArray is deprecated - */ - @SuppressWarnings("unchecked") - @Deprecated - public Type bean(Class<?> beanType, String method, boolean multiParameterArray) { - BeanDefinition answer = new BeanDefinition(); - answer.setBeanType(beanType); - answer.setMethod(method); - answer.setMultiParameterArray(multiParameterArray); - addOutput(answer); - return (Type) this; - } /** * <a href="http://camel.apache.org/message-translator.html">Message Translator EIP:</a> * Adds a bean which is invoked which could be a final destination, or could be a transformation in a pipeline * - * @param beanType the bean class, Camel will instantiate an object at runtime + * @param beanType the bean class, Camel will instantiate an object at runtime * @param method the method name to invoke on the bean (can be used to avoid ambiguity) - * @param multiParameterArray if it is true, camel will treat the message body as an object array which holds - * the multi parameter * @param cache if enabled, Camel will cache the result of the first Registry look-up. * Cache can be enabled if the bean in the Registry is defined as a singleton scope. + * the multi parameter * @return the builder - * @deprecated the option multiParameterArray is deprecated */ @SuppressWarnings("unchecked") - @Deprecated - public Type bean(Class<?> beanType, String method, boolean multiParameterArray, boolean cache) { + public Type bean(Class<?> beanType, String method, boolean cache) { BeanDefinition answer = new BeanDefinition(); answer.setBeanType(beanType); answer.setMethod(method); - answer.setMultiParameterArray(multiParameterArray); answer.setCache(cache); addOutput(answer); return (Type) this; @@ -3333,72 +3193,6 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type> * The difference between this and {@link #pollEnrich(String)} is that this uses a producer * to obtain the additional data, where as pollEnrich uses a polling consumer. * - * @param resourceRef Reference of resource endpoint for obtaining additional data. - * @param aggregationStrategyRef Reference of aggregation strategy to aggregate input data and additional data. - * @return the builder - * @see org.apache.camel.processor.Enricher - * @deprecated use enrich with a <tt>ref:id</tt> as the resourceUri parameter. - */ - @Deprecated - public Type enrichRef(String resourceRef, String aggregationStrategyRef) { - return enrichRef(resourceRef, aggregationStrategyRef, false); - } - - /** - * The <a href="http://camel.apache.org/content-enricher.html">Content Enricher EIP</a> - * enriches an exchange with additional data obtained from a <code>resourceUri</code>. - * <p/> - * The difference between this and {@link #pollEnrich(String)} is that this uses a producer - * to obtain the additional data, where as pollEnrich uses a polling consumer. - * - * @param resourceRef Reference of resource endpoint for obtaining additional data. - * @param aggregationStrategyRef Reference of aggregation strategy to aggregate input data and additional data. - * @param aggregateOnException whether to call {@link org.apache.camel.processor.aggregate.AggregationStrategy#aggregate(org.apache.camel.Exchange, org.apache.camel.Exchange)} if - * an exception was thrown. - * @return the builder - * @see org.apache.camel.processor.Enricher - * @deprecated use enrich with a <tt>ref:id</tt> as the resourceUri parameter. - */ - @Deprecated - public Type enrichRef(String resourceRef, String aggregationStrategyRef, boolean aggregateOnException) { - return enrichRef(resourceRef, aggregationStrategyRef, false, false); - } - - /** - * The <a href="http://camel.apache.org/content-enricher.html">Content Enricher EIP</a> - * enriches an exchange with additional data obtained from a <code>resourceUri</code>. - * <p/> - * The difference between this and {@link #pollEnrich(String)} is that this uses a producer - * to obtain the additional data, where as pollEnrich uses a polling consumer. - * - * @param resourceRef Reference of resource endpoint for obtaining additional data. - * @param aggregationStrategyRef Reference of aggregation strategy to aggregate input data and additional data. - * @param aggregateOnException whether to call {@link org.apache.camel.processor.aggregate.AggregationStrategy#aggregate(org.apache.camel.Exchange, org.apache.camel.Exchange)} if - * an exception was thrown. - * @param shareUnitOfWork whether to share unit of work - * @return the builder - * @see org.apache.camel.processor.Enricher - * @deprecated use enrich with a <tt>ref:id</tt> as the resourceUri parameter. - */ - @Deprecated - @SuppressWarnings("unchecked") - public Type enrichRef(String resourceRef, String aggregationStrategyRef, boolean aggregateOnException, boolean shareUnitOfWork) { - EnrichDefinition answer = new EnrichDefinition(); - answer.setExpression(new SimpleExpression("ref:" + resourceRef)); - answer.setAggregationStrategyRef(aggregationStrategyRef); - answer.setAggregateOnException(aggregateOnException); - answer.setShareUnitOfWork(shareUnitOfWork); - addOutput(answer); - return (Type) this; - } - - /** - * The <a href="http://camel.apache.org/content-enricher.html">Content Enricher EIP</a> - * enriches an exchange with additional data obtained from a <code>resourceUri</code>. - * <p/> - * The difference between this and {@link #pollEnrich(String)} is that this uses a producer - * to obtain the additional data, where as pollEnrich uses a polling consumer. - * * @return a expression builder clause to set the expression to use for computing the endpoint to use * @see org.apache.camel.processor.PollEnricher */ @@ -3623,69 +3417,6 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type> * If timeout is negative, we use <tt>receive</tt>. If timeout is 0 then we use <tt>receiveNoWait</tt> * otherwise we use <tt>receive(timeout)</tt>. * - * @param resourceRef Reference of resource endpoint for obtaining additional data. - * @param timeout timeout in millis to wait at most for data to be available. - * @param aggregationStrategyRef Reference of aggregation strategy to aggregate input data and additional data. - * @return the builder - * @see org.apache.camel.processor.PollEnricher - * @deprecated use pollEnrich with a <tt>ref:id</tt> as the resourceUri parameter. - */ - @Deprecated - @SuppressWarnings("unchecked") - public Type pollEnrichRef(String resourceRef, long timeout, String aggregationStrategyRef) { - PollEnrichDefinition pollEnrich = new PollEnrichDefinition(); - pollEnrich.setExpression(new SimpleExpression("ref:" + resourceRef)); - pollEnrich.setTimeout(timeout); - pollEnrich.setAggregationStrategyRef(aggregationStrategyRef); - addOutput(pollEnrich); - return (Type) this; - } - - /** - * The <a href="http://camel.apache.org/content-enricher.html">Content Enricher EIP</a> - * enriches an exchange with additional data obtained from a <code>resourceUri</code> - * using a {@link org.apache.camel.PollingConsumer} to poll the endpoint. - * <p/> - * The difference between this and {@link #enrich(String)} is that this uses a consumer - * to obtain the additional data, where as enrich uses a producer. - * <p/> - * The timeout controls which operation to use on {@link org.apache.camel.PollingConsumer}. - * If timeout is negative, we use <tt>receive</tt>. If timeout is 0 then we use <tt>receiveNoWait</tt> - * otherwise we use <tt>receive(timeout)</tt>. - * - * @param resourceRef Reference of resource endpoint for obtaining additional data. - * @param timeout timeout in millis to wait at most for data to be available. - * @param aggregationStrategyRef Reference of aggregation strategy to aggregate input data and additional data. - * @param aggregateOnException whether to call {@link org.apache.camel.processor.aggregate.AggregationStrategy#aggregate(org.apache.camel.Exchange, org.apache.camel.Exchange)} if - * an exception was thrown. - * @return the builder - * @see org.apache.camel.processor.PollEnricher - * @deprecated use pollEnrich with a <tt>ref:id</tt> as the resourceUri parameter. - */ - @Deprecated - @SuppressWarnings("unchecked") - public Type pollEnrichRef(String resourceRef, long timeout, String aggregationStrategyRef, boolean aggregateOnException) { - PollEnrichDefinition pollEnrich = new PollEnrichDefinition(); - pollEnrich.setExpression(new SimpleExpression("ref:" + resourceRef)); - pollEnrich.setTimeout(timeout); - pollEnrich.setAggregationStrategyRef(aggregationStrategyRef); - pollEnrich.setAggregateOnException(aggregateOnException); - addOutput(pollEnrich); - return (Type) this; - } - - /** - * The <a href="http://camel.apache.org/content-enricher.html">Content Enricher EIP</a> - * enriches an exchange with additional data obtained from a <code>resourceUri</code> - * using a {@link org.apache.camel.PollingConsumer} to poll the endpoint. - * <p/> - * The difference between this and {@link #enrich(String)} is that this uses a consumer - * to obtain the additional data, where as enrich uses a producer. - * <p/> - * The timeout controls which operation to use on {@link org.apache.camel.PollingConsumer}. - * If timeout is negative, we use <tt>receive</tt>. If timeout is 0 then we use <tt>receiveNoWait</tt> - * otherwise we use <tt>receive(timeout)</tt>. - * * @param expression to use an expression to dynamically compute the endpoint to poll from * @param timeout timeout in millis to wait at most for data to be available. * @param aggregationStrategyRef Reference of aggregation strategy to aggregate input data and additional data. diff --git a/camel-core/src/main/java/org/apache/camel/model/ToDefinition.java b/camel-core/src/main/java/org/apache/camel/model/ToDefinition.java index 61c86c0..6c5df76 100644 --- a/camel-core/src/main/java/org/apache/camel/model/ToDefinition.java +++ b/camel-core/src/main/java/org/apache/camel/model/ToDefinition.java @@ -80,16 +80,4 @@ public class ToDefinition extends SendDefinition<ToDefinition> { this.pattern = pattern; } - /** - * Sets the optional {@link ExchangePattern} used to invoke this endpoint - * - * @deprecated will be removed in the near future. Instead use {@link ProcessorDefinition#inOnly()} - * or {@link ProcessorDefinition#inOut()} - */ - @Deprecated - public ToDefinition pattern(ExchangePattern pattern) { - setPattern(pattern); - return this; - } - } diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/BeanEndpointTest.java b/camel-core/src/test/java/org/apache/camel/component/bean/BeanEndpointTest.java index d9c0e91..8213760 100644 --- a/camel-core/src/test/java/org/apache/camel/component/bean/BeanEndpointTest.java +++ b/camel-core/src/test/java/org/apache/camel/component/bean/BeanEndpointTest.java @@ -149,7 +149,6 @@ public class BeanEndpointTest extends ContextTestSupport { final BeanEndpoint endpoint = new BeanEndpoint(); endpoint.setCamelContext(context); endpoint.setCache(true); - endpoint.setMultiParameterArray(false); endpoint.setBeanName("foo"); endpoint.setMethod("hello"); diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoTest.java b/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoTest.java index 7c5ffbe..ed843a8 100644 --- a/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoTest.java +++ b/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoTest.java @@ -195,9 +195,6 @@ public class BeanInfoTest extends Assert { public void inOnlyMethod() { } - public void robustInOnlyMethod() { - } - public Object inOutMethod() { return null; } diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/BeanMethodWithMultipleParametersTest.java b/camel-core/src/test/java/org/apache/camel/component/bean/BeanMethodWithMultipleParametersTest.java deleted file mode 100644 index c1e18b3..0000000 --- a/camel-core/src/test/java/org/apache/camel/component/bean/BeanMethodWithMultipleParametersTest.java +++ /dev/null @@ -1,98 +0,0 @@ -/** - * 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.component.bean; - -import javax.naming.Context; - -import org.apache.camel.ContextTestSupport; -import org.apache.camel.Exchange; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.processor.BeanRouteTest; -import org.apache.camel.util.jndi.JndiContext; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @version - */ -public class BeanMethodWithMultipleParametersTest extends ContextTestSupport { - private static final Logger LOG = LoggerFactory.getLogger(BeanRouteTest.class); - protected MyBean myBean = new MyBean(); - - @Test - public void testDummy() throws Exception { - - } - - @Test - public void testSendMessageWithURI() throws Exception { - Object[] args = {"abc", 5, "def"}; - template.sendBody("bean:myBean?method=myMethod&multiParameterArray=true", args); - - assertEquals("bean.foo", "abc", myBean.foo); - assertEquals("bean.bar", 5, myBean.bar); - assertEquals("bean.x", "def", myBean.x); - } - - @Test - public void testSendMessageWithSettingHeader() throws Exception { - Object[] args = {"hello", 123, "world"}; - template.sendBodyAndHeader("direct:in", args, Exchange.BEAN_MULTI_PARAMETER_ARRAY, true); - - assertEquals("bean.foo", "hello", myBean.foo); - assertEquals("bean.bar", 123, myBean.bar); - assertEquals("bean.x", "world", myBean.x); - } - - @Override - protected Context createJndiContext() throws Exception { - JndiContext answer = new JndiContext(); - answer.bind("myBean", myBean); - return answer; - } - - protected RouteBuilder createRouteBuilder() { - return new RouteBuilder() { - public void configure() { - from("direct:in").to("bean:myBean?method=myMethod"); - } - }; - } - - public class MyBean { - public String foo; - public int bar; - public String x; - - @Override - public String toString() { - return "MyBean[foo: " + foo + " bar: " + bar + " x: " + x + "]"; - } - - public void myMethod(String foo, int bar, String x) { - this.foo = foo; - this.bar = bar; - this.x = x; - LOG.info("myMethod() method called on " + this); - } - - public void anotherMethod(Object body) { - fail("Should not have called this method!"); - } - } -} diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/BeanNoCacheTest.java b/camel-core/src/test/java/org/apache/camel/component/bean/BeanNoCacheTest.java index 66fed5c..a8202b0 100644 --- a/camel-core/src/test/java/org/apache/camel/component/bean/BeanNoCacheTest.java +++ b/camel-core/src/test/java/org/apache/camel/component/bean/BeanNoCacheTest.java @@ -46,7 +46,7 @@ public class BeanNoCacheTest extends ContextTestSupport { @Override public void configure() throws Exception { from("direct:start") - .bean(MyCoolBean.class, "doSomething", false, false) + .bean(MyCoolBean.class, "doSomething", false) .to("mock:result"); } }; diff --git a/camel-core/src/test/java/org/apache/camel/processor/enricher/EnricherRefTest.java b/camel-core/src/test/java/org/apache/camel/processor/enricher/EnricherRefTest.java index 550cb1d..488db77 100644 --- a/camel-core/src/test/java/org/apache/camel/processor/enricher/EnricherRefTest.java +++ b/camel-core/src/test/java/org/apache/camel/processor/enricher/EnricherRefTest.java @@ -63,7 +63,7 @@ public class EnricherRefTest extends ContextTestSupport { public void configure() throws Exception { cool.setCamelContext(context); - from("direct:start").enrichRef("cool", "agg"); + from("direct:start").enrich().simple("ref:cool").aggregationStrategyRef("agg"); } }; } diff --git a/camel-core/src/test/java/org/apache/camel/processor/enricher/PollEnricherRefTest.java b/camel-core/src/test/java/org/apache/camel/processor/enricher/PollEnricherRefTest.java index 59994d0..43cee0a 100644 --- a/camel-core/src/test/java/org/apache/camel/processor/enricher/PollEnricherRefTest.java +++ b/camel-core/src/test/java/org/apache/camel/processor/enricher/PollEnricherRefTest.java @@ -67,7 +67,7 @@ public class PollEnricherRefTest extends ContextTestSupport { public void configure() throws Exception { cool.setEndpointUriIfNotSpecified("cool"); - from("direct:start").pollEnrichRef("cool", 2000, "agg"); + from("direct:start").pollEnrich().simple("ref:cool").timeout(2000).aggregationStrategyRef("agg"); } }; } diff --git a/camel-core/src/test/java/org/apache/camel/processor/routingslip/RoutingSlipWithExceptionTest.java b/camel-core/src/test/java/org/apache/camel/processor/routingslip/RoutingSlipWithExceptionTest.java index 634343a..06bec14 100644 --- a/camel-core/src/test/java/org/apache/camel/processor/routingslip/RoutingSlipWithExceptionTest.java +++ b/camel-core/src/test/java/org/apache/camel/processor/routingslip/RoutingSlipWithExceptionTest.java @@ -156,7 +156,7 @@ public class RoutingSlipWithExceptionTest extends ContextTestSupport { public void configure() { from("direct:start"). doTry(). - routingSlip(ROUTING_SLIP_HEADER).to("mock:noexception"). + routingSlip(header(ROUTING_SLIP_HEADER)).end().to("mock:noexception"). doCatch(Exception.class). to("mock:exception"); } diff --git a/camel-core/src/test/java/org/apache/camel/runtimecatalog/JSonSchemaHelperTest.java b/camel-core/src/test/java/org/apache/camel/runtimecatalog/JSonSchemaHelperTest.java index ad7e11a..7be832c 100644 --- a/camel-core/src/test/java/org/apache/camel/runtimecatalog/JSonSchemaHelperTest.java +++ b/camel-core/src/test/java/org/apache/camel/runtimecatalog/JSonSchemaHelperTest.java @@ -52,13 +52,12 @@ public class JSonSchemaHelperTest extends ContextTestSupport { assertEquals("version", rows.get(16).keySet().iterator().next()); rows = JSonSchemaHelper.parseJsonSchema("properties", json, true); - assertEquals(6, rows.size()); + assertEquals(5, rows.size()); assertEquals("beanName", rows.get(0).values().iterator().next()); assertEquals("method", rows.get(1).values().iterator().next()); assertEquals("cache", rows.get(2).values().iterator().next()); - assertEquals("multiParameterArray", rows.get(3).values().iterator().next()); - assertEquals("parameters", rows.get(4).values().iterator().next()); - assertEquals("synchronous", rows.get(5).values().iterator().next()); + assertEquals("parameters", rows.get(3).values().iterator().next()); + assertEquals("synchronous", rows.get(4).values().iterator().next()); } @Test diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsConsumerWithBeanTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsConsumerWithBeanTest.java index 70706fe..1df5eb4 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsConsumerWithBeanTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsConsumerWithBeanTest.java @@ -46,8 +46,8 @@ public class CxfRsConsumerWithBeanTest extends CamelTestSupport { protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { public void configure() { - from(CXF_RS_ENDPOINT_URI).to("bean://service?multiParameterArray=true"); - from(CXF_RS_ENDPOINT_URI_2).bean(ServiceUtil.class, "invoke", true); + from(CXF_RS_ENDPOINT_URI).to("bean://service?method=invoke(${body[0]}, ${body[1]})"); + from(CXF_RS_ENDPOINT_URI_2).bean(ServiceUtil.class, "invoke(${body[0]}, ${body[1]})"); }; }; }