Remove deprecations from previous versions

* Remove Boon dependency and its usage
* Remove overloaded methods from the `IntegrationFlowDefinition`
- we can simply rely now on the super class
* Remove (or rework) deprecated entities in the docs
* Fix tests for removed deprecated APIs
* Rework affected tests to JUnit 5
This commit is contained in:
Artem Bilan
2020-01-09 15:28:50 -05:00
committed by Gary Russell
parent cfaabe2a8d
commit 370e943428
47 changed files with 134 additions and 2688 deletions

View File

@@ -50,7 +50,6 @@ ext {
assertjVersion = '3.14.0'
assertkVersion = '0.20'
awaitilityVersion = '4.0.1'
boonVersion = '0.34'
commonsDbcp2Version = '2.7.0'
commonsIoVersion = '2.6'
commonsNetVersion = '3.6'
@@ -411,7 +410,6 @@ project('spring-integration-core') {
api 'io.projectreactor:reactor-core'
optionalApi 'com.fasterxml.jackson.core:jackson-databind'
optionalApi "com.jayway.jsonpath:json-path:$jsonpathVersion"
optionalApi "io.fastjson:boon:$boonVersion"
optionalApi "com.esotericsoftware:kryo-shaded:$kryoShadedVersion"
optionalApi "io.micrometer:micrometer-core:$micrometerVersion"
optionalApi "io.github.resilience4j:resilience4j-ratelimiter:$resilience4jVersion"

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -314,16 +314,6 @@ public class AmqpChannelFactoryBean extends AbstractFactoryBean<AbstractAmqpChan
this.transactionManager = transactionManager;
}
/**
* Specify a batch size for consumer.
* @param txSize the batch size to use
* @deprecated since 5.2 in favor of {@link #setBatchSize(Integer)}
*/
@Deprecated
public void setTxSize(int txSize) {
setBatchSize(txSize);
}
public void setBatchSize(Integer batchSize) {
this.batchSize = batchSize;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -202,17 +202,6 @@ public class AmqpMessageChannelSpec<S extends AmqpMessageChannelSpec<S>> extends
return _this();
}
/**
* Configure the txSize.
* @param txSize the txSize.
* @return the spec.
* @deprecated since 5.2 in favor of {@link #batchSize(int)}
*/
@Deprecated
public S txSize(int txSize) {
return batchSize(txSize);
}
/**
* Configure the batch size.
* @param batchSize the batchSize.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017-2019 the original author or authors.
* Copyright 2017-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -107,17 +107,6 @@ public class SimpleMessageListenerContainerSpec extends
return this;
}
/**
* @param txSize the txSize.
* @return the spec.
* @see SimpleMessageListenerContainer#setBatchSize(int)
* @deprecated since 5.2 in favor of {@link #batchSize(int)}
*/
@Deprecated
public SimpleMessageListenerContainerSpec txSize(int txSize) {
return batchSize(txSize);
}
/**
* The batch size to use.
* @param batchSize the batchSize.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -79,14 +79,6 @@ public class MessagePublishingInterceptor implements MethodInterceptor, BeanFact
this.metadataSource = metadataSource;
}
/**
* @param metadataSource the {@link PublisherMetadataSource} to use.
* @deprecated since 5.2 in favor constructor argument.
*/
@Deprecated
public void setPublisherMetadataSource(PublisherMetadataSource metadataSource) {
}
/**
* @param defaultChannelName the default channel name.
* @since 4.0.3

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -51,6 +51,7 @@ import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessageDeliveryException;
import org.springframework.messaging.converter.MessageConverter;
import org.springframework.messaging.support.ChannelInterceptor;
import org.springframework.messaging.support.InterceptableChannel;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
@@ -68,7 +69,7 @@ import org.springframework.util.StringUtils;
@IntegrationManagedResource
@SuppressWarnings("deprecation")
public abstract class AbstractMessageChannel extends IntegrationObjectSupport
implements MessageChannel, TrackableComponent, ChannelInterceptorAware,
implements MessageChannel, TrackableComponent, InterceptableChannel,
org.springframework.integration.support.management.MessageChannelMetrics,
ConfigurableMetricsAware<AbstractMessageChannelMetrics>,
IntegrationPattern {

View File

@@ -1,50 +0,0 @@
/*
* Copyright 2014-2019 the original author or authors.
*
* Licensed 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
*
* https://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.springframework.integration.channel;
import java.util.List;
import org.springframework.messaging.support.ChannelInterceptor;
import org.springframework.messaging.support.InterceptableChannel;
/**
* A marker interface providing the ability to configure {@link ChannelInterceptor}s
* on {@link org.springframework.messaging.MessageChannel} implementations.
* <p>
* Typically useful when the target {@link org.springframework.messaging.MessageChannel}
* is an AOP Proxy.
* *
* @author Artem Bilan
* @author Gary Russell
*
* @since 4.0
*
* @deprecated since 5.2 in favor of {@link InterceptableChannel}.
* Will be removed in the next 5.3 version.
*/
@Deprecated
public interface ChannelInterceptorAware extends InterceptableChannel {
/**
* return the {@link ChannelInterceptor} list.
* @return the {@link ChannelInterceptor} list.
*/
default List<ChannelInterceptor> getChannelInterceptors() {
return getInterceptors();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2019 the original author or authors.
* Copyright 2015-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,8 +16,10 @@
package org.springframework.integration.channel;
import org.springframework.messaging.support.InterceptableChannel;
/**
* The {@link ChannelInterceptorAware} extension for the cases when
* The {@link InterceptableChannel} extension for the cases when
* the {@link org.springframework.messaging.support.ExecutorChannelInterceptor}s
* may have reason (e.g. {@link ExecutorChannel} or {@link QueueChannel})
* and the implementors require to know if they should make the
@@ -28,8 +30,7 @@ package org.springframework.integration.channel;
*
* @since 4.2
*/
@SuppressWarnings("deprecation")
public interface ExecutorChannelInterceptorAware extends ChannelInterceptorAware {
public interface ExecutorChannelInterceptorAware extends InterceptableChannel {
boolean hasExecutorInterceptors();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2019 the original author or authors.
* Copyright 2016-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -179,32 +179,6 @@ public abstract class IntegrationFlowAdapter implements IntegrationFlow, SmartLi
return IntegrationFlows.from(inboundGatewaySpec);
}
/**
* @param service service for polling method
* @param methodName method to poll
* @return the IntegrationFlowBuilder
* @deprecated since 5.2 in favor of method reference via {@link #from(Supplier)}
*/
@Deprecated
protected IntegrationFlowBuilder from(Object service, String methodName) {
return IntegrationFlows.from(service, methodName);
}
/**
*
* @param service service for polling method
* @param methodName method to poll
* @param endpointConfigurer configurer for {@link SourcePollingChannelAdapterSpec}
* @return the IntegrationFlowBuilder
* @deprecated since 5.2 in favor of method reference via {@link #from(Supplier)}
*/
@Deprecated
protected IntegrationFlowBuilder from(Object service, String methodName,
Consumer<SourcePollingChannelAdapterSpec> endpointConfigurer) {
return IntegrationFlows.from(service, methodName, endpointConfigurer);
}
protected <T> IntegrationFlowBuilder from(Supplier<T> messageSource) {
return IntegrationFlows.from(messageSource);
}
@@ -219,18 +193,6 @@ public abstract class IntegrationFlowAdapter implements IntegrationFlow, SmartLi
return IntegrationFlows.from(serviceInterface);
}
/**
* Start a flow from a proxy for the service interface.
* @param serviceInterface the service interface to proxy for the gateway.
* @param beanName the bean name for the gateway proxy.
* @return the {@link IntegrationFlowBuilder} instance
* @deprecated since 5.2 in favor of {@link #from(Class, Consumer)}
*/
@Deprecated
protected IntegrationFlowBuilder from(Class<?> serviceInterface, @Nullable String beanName) {
return from(serviceInterface, (gateway) -> gateway.beanName(beanName));
}
/**
* Start a flow from a proxy for the service interface.
* @param serviceInterface the service interface class.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2019 the original author or authors.
* Copyright 2016-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,38 +16,16 @@
package org.springframework.integration.dsl;
import java.util.Map;
import java.util.concurrent.Executor;
import java.util.function.Consumer;
import java.util.function.Function;
import org.reactivestreams.Publisher;
import org.springframework.expression.Expression;
import org.springframework.integration.core.GenericSelector;
import org.springframework.integration.handler.BridgeHandler;
import org.springframework.integration.handler.GenericHandler;
import org.springframework.integration.handler.LoggingHandler;
import org.springframework.integration.handler.MessageTriggerAction;
import org.springframework.integration.handler.ServiceActivatingHandler;
import org.springframework.integration.router.AbstractMessageRouter;
import org.springframework.integration.router.ErrorMessageExceptionTypeRouter;
import org.springframework.integration.router.ExpressionEvaluatingRouter;
import org.springframework.integration.router.MethodInvokingRouter;
import org.springframework.integration.splitter.AbstractMessageSplitter;
import org.springframework.integration.splitter.DefaultMessageSplitter;
import org.springframework.integration.splitter.ExpressionEvaluatingSplitter;
import org.springframework.integration.splitter.MethodInvokingSplitter;
import org.springframework.integration.store.MessageStore;
import org.springframework.integration.support.MapBuilder;
import org.springframework.integration.transformer.GenericTransformer;
import org.springframework.integration.transformer.HeaderFilter;
import org.springframework.integration.transformer.MessageTransformingHandler;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessageHandler;
import reactor.core.publisher.Flux;
/**
* The {@code BaseIntegrationFlowDefinition} extension for syntax sugar with generics for some
@@ -270,818 +248,4 @@ public abstract class IntegrationFlowDefinition<B extends IntegrationFlowDefinit
return route(null, router, routerConfigurer);
}
// All the methods below override super for byte code backward compatibility.
@Override
public B fixedSubscriberChannel() { // NOSONAR - byte code backward compatibility
return super.fixedSubscriberChannel();
}
@Override
public B fixedSubscriberChannel(String messageChannelName) { // NOSONAR - byte code backward compatibility
return super.fixedSubscriberChannel(messageChannelName);
}
@Override
public B channel(String messageChannelName) { // NOSONAR - byte code backward compatibility
return super.channel(messageChannelName);
}
@Override
public B channel(MessageChannelSpec<?, ?> messageChannelSpec) { // NOSONAR - byte code backward compatibility
return super.channel(messageChannelSpec);
}
@Override
public B channel(MessageChannel messageChannel) { // NOSONAR - byte code backward compatibility
return super.channel(messageChannel);
}
@Override
public B channel(Function<Channels, MessageChannelSpec<?, ?>> channels) { // NOSONAR - byte code backward compatibility
return super.channel(channels);
}
@Override
public B publishSubscribeChannel(Consumer<PublishSubscribeSpec> publishSubscribeChannelConfigurer) { // NOSONAR - byte code backward compatibility
return super.publishSubscribeChannel(publishSubscribeChannelConfigurer);
}
@Override
public B publishSubscribeChannel(Executor executor,
Consumer<PublishSubscribeSpec> publishSubscribeChannelConfigurer) { // NOSONAR - byte code backward compatibility
return super.publishSubscribeChannel(executor, publishSubscribeChannelConfigurer);
}
@Override
public B wireTap(IntegrationFlow flow) { // NOSONAR - byte code backward compatibility
return super.wireTap(flow);
}
@Override
public B wireTap(String wireTapChannel) { // NOSONAR - byte code backward compatibility
return super.wireTap(wireTapChannel);
}
@Override
public B wireTap(MessageChannel wireTapChannel) { // NOSONAR - byte code backward compatibility
return super.wireTap(wireTapChannel);
}
@Override
public B wireTap(IntegrationFlow flow, Consumer<WireTapSpec> wireTapConfigurer) { // NOSONAR - byte code backward compatibility
return super.wireTap(flow, wireTapConfigurer);
}
@Override
public B wireTap(String wireTapChannel, Consumer<WireTapSpec> wireTapConfigurer) { // NOSONAR - byte code backward compatibility
return super.wireTap(wireTapChannel, wireTapConfigurer);
}
@Override
public B wireTap(MessageChannel wireTapChannel, Consumer<WireTapSpec> wireTapConfigurer) { // NOSONAR - byte code backward compatibility
return super.wireTap(wireTapChannel, wireTapConfigurer);
}
@Override
public B wireTap(WireTapSpec wireTapSpec) { // NOSONAR - byte code backward compatibility
return super.wireTap(wireTapSpec);
}
@Override
public B controlBus() { // NOSONAR - byte code backward compatibility
return super.controlBus();
}
@Override
public B controlBus(Consumer<GenericEndpointSpec<ServiceActivatingHandler>> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.controlBus(endpointConfigurer);
}
@Override
public B transform(String expression) { // NOSONAR - byte code backward compatibility
return super.transform(expression);
}
@Override
public B transform(String expression,
Consumer<GenericEndpointSpec<MessageTransformingHandler>> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.transform(expression, endpointConfigurer);
}
@Override
public B transform(Object service) { // NOSONAR - byte code backward compatibility
return super.transform(service);
}
@Override
public B transform(Object service, String methodName) { // NOSONAR - byte code backward compatibility
return super.transform(service, methodName);
}
@Override
public B transform(Object service, String methodName,
Consumer<GenericEndpointSpec<MessageTransformingHandler>> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.transform(service, methodName, endpointConfigurer);
}
@Override
public B transform(MessageProcessorSpec<?> messageProcessorSpec) { // NOSONAR - byte code backward compatibility
return super.transform(messageProcessorSpec);
}
@Override
public B transform(MessageProcessorSpec<?> messageProcessorSpec,
Consumer<GenericEndpointSpec<MessageTransformingHandler>> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.transform(messageProcessorSpec, endpointConfigurer);
}
@Override
public <P> B convert(Class<P> payloadType) { // NOSONAR - byte code backward compatibility
return super.convert(payloadType);
}
@Override
public <P, T> B transform(Class<P> payloadType, GenericTransformer<P, T> genericTransformer) { // NOSONAR - byte code backward compatibility
return super.transform(payloadType, genericTransformer);
}
@Override
public <P> B convert(Class<P> payloadType,
Consumer<GenericEndpointSpec<MessageTransformingHandler>> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.convert(payloadType, endpointConfigurer);
}
@Override
public <P, T> B transform(Class<P> payloadType, GenericTransformer<P, T> genericTransformer,
Consumer<GenericEndpointSpec<MessageTransformingHandler>> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.transform(payloadType, genericTransformer, endpointConfigurer);
}
@Override
public B filter(String expression) { // NOSONAR - byte code backward compatibility
return super.filter(expression);
}
@Override
public B filter(String expression, Consumer<FilterEndpointSpec> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.filter(expression, endpointConfigurer);
}
@Override
public B filter(Object service) { // NOSONAR - byte code backward compatibility
return super.filter(service);
}
@Override
public B filter(Object service, String methodName) { // NOSONAR - byte code backward compatibility
return super.filter(service, methodName);
}
@Override
public B filter(Object service, String methodName, Consumer<FilterEndpointSpec> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.filter(service, methodName, endpointConfigurer);
}
@Override
public B filter(MessageProcessorSpec<?> messageProcessorSpec) { // NOSONAR - byte code backward compatibility
return super.filter(messageProcessorSpec);
}
@Override
public B filter(MessageProcessorSpec<?> messageProcessorSpec, Consumer<FilterEndpointSpec> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.filter(messageProcessorSpec, endpointConfigurer);
}
@Override
public <P> B filter(Class<P> payloadType, GenericSelector<P> genericSelector) { // NOSONAR - byte code backward compatibility
return super.filter(payloadType, genericSelector);
}
@Override
public <P> B filter(Class<P> payloadType, GenericSelector<P> genericSelector,
Consumer<FilterEndpointSpec> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.filter(payloadType, genericSelector, endpointConfigurer);
}
@Override
public <H extends MessageHandler> B handle(MessageHandlerSpec<?, H> messageHandlerSpec) { // NOSONAR - byte code backward compatibility
return super.handle(messageHandlerSpec);
}
@Override
public B handle(MessageHandler messageHandler) { // NOSONAR - byte code backward compatibility
return super.handle(messageHandler);
}
@Override
public B handle(String beanName, String methodName) { // NOSONAR - byte code backward compatibility
return super.handle(beanName, methodName);
}
@Override
public B handle(String beanName, String methodName,
Consumer<GenericEndpointSpec<ServiceActivatingHandler>> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.handle(beanName, methodName, endpointConfigurer);
}
@Override
public B handle(Object service) { // NOSONAR - byte code backward compatibility
return super.handle(service);
}
@Override
public B handle(Object service, String methodName) { // NOSONAR - byte code backward compatibility
return super.handle(service, methodName);
}
@Override
public B handle(Object service, String methodName,
Consumer<GenericEndpointSpec<ServiceActivatingHandler>> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.handle(service, methodName, endpointConfigurer);
}
@Override
public <P> B handle(Class<P> payloadType, GenericHandler<P> handler) { // NOSONAR - byte code backward compatibility
return super.handle(payloadType, handler);
}
@Override
public <P> B handle(Class<P> payloadType, GenericHandler<P> handler,
Consumer<GenericEndpointSpec<ServiceActivatingHandler>> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.handle(payloadType, handler, endpointConfigurer);
}
@Override
public B handle(MessageProcessorSpec<?> messageProcessorSpec) { // NOSONAR - byte code backward compatibility
return super.handle(messageProcessorSpec);
}
@Override
public B handle(MessageProcessorSpec<?> messageProcessorSpec,
Consumer<GenericEndpointSpec<ServiceActivatingHandler>> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.handle(messageProcessorSpec, endpointConfigurer);
}
@Override
public <H extends MessageHandler> B handle(MessageHandlerSpec<?, H> messageHandlerSpec,
Consumer<GenericEndpointSpec<H>> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.handle(messageHandlerSpec, endpointConfigurer);
}
@Override
public <H extends MessageHandler> B handle(H messageHandler, Consumer<GenericEndpointSpec<H>> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.handle(messageHandler, endpointConfigurer);
}
@Override
public B bridge() { // NOSONAR - byte code backward compatibility
return super.bridge();
}
@Override
public B bridge(Consumer<GenericEndpointSpec<BridgeHandler>> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.bridge(endpointConfigurer);
}
@Override
public B delay(String groupId) { // NOSONAR - byte code backward compatibility
return super.delay(groupId);
}
@Override
public B delay(String groupId, Consumer<DelayerEndpointSpec> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.delay(groupId, endpointConfigurer);
}
@Override
public B enrich(Consumer<EnricherSpec> enricherConfigurer) { // NOSONAR - byte code backward compatibility
return super.enrich(enricherConfigurer);
}
@Override
public B enrichHeaders(MapBuilder<?, String, Object> headers) { // NOSONAR - byte code backward compatibility
return super.enrichHeaders(headers);
}
@Override
public B enrichHeaders(MapBuilder<?, String, Object> headers,
Consumer<GenericEndpointSpec<MessageTransformingHandler>> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.enrichHeaders(headers, endpointConfigurer);
}
@Override
public B enrichHeaders(Map<String, Object> headers,
Consumer<GenericEndpointSpec<MessageTransformingHandler>> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.enrichHeaders(headers, endpointConfigurer);
}
@Override
public B enrichHeaders(Consumer<HeaderEnricherSpec> headerEnricherConfigurer) { // NOSONAR - byte code backward compatibility
return super.enrichHeaders(headerEnricherConfigurer);
}
@Override
public B split() { // NOSONAR - byte code backward compatibility
return super.split();
}
@Override
public B split(Consumer<SplitterEndpointSpec<DefaultMessageSplitter>> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.split(endpointConfigurer);
}
@Override
public B split(String expression) { // NOSONAR - byte code backward compatibility
return super.split(expression);
}
@Override
public B split(String expression, Consumer<SplitterEndpointSpec<ExpressionEvaluatingSplitter>> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.split(expression, endpointConfigurer);
}
@Override
public B split(Object service) { // NOSONAR - byte code backward compatibility
return super.split(service);
}
@Override
public B split(Object service, String methodName) { // NOSONAR - byte code backward compatibility
return super.split(service, methodName);
}
@Override
public B split(Object service, String methodName,
Consumer<SplitterEndpointSpec<MethodInvokingSplitter>> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.split(service, methodName, endpointConfigurer);
}
@Override
public B split(String beanName, String methodName) { // NOSONAR - byte code backward compatibility
return super.split(beanName, methodName);
}
@Override
public B split(String beanName, String methodName,
Consumer<SplitterEndpointSpec<MethodInvokingSplitter>> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.split(beanName, methodName, endpointConfigurer);
}
@Override
public B split(MessageProcessorSpec<?> messageProcessorSpec) { // NOSONAR - byte code backward compatibility
return super.split(messageProcessorSpec);
}
@Override
public B split(MessageProcessorSpec<?> messageProcessorSpec,
Consumer<SplitterEndpointSpec<MethodInvokingSplitter>> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.split(messageProcessorSpec, endpointConfigurer);
}
@Override
public <P> B split(Class<P> payloadType, Function<P, ?> splitter) { // NOSONAR - byte code backward compatibility
return super.split(payloadType, splitter);
}
@Override
public <P> B split(Class<P> payloadType, Function<P, ?> splitter,
Consumer<SplitterEndpointSpec<MethodInvokingSplitter>> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.split(payloadType, splitter, endpointConfigurer);
}
@Override
public <S extends AbstractMessageSplitter> B split(MessageHandlerSpec<?, S> splitterMessageHandlerSpec) { // NOSONAR - byte code backward compatibility
return super.split(splitterMessageHandlerSpec);
}
@Override
public <S extends AbstractMessageSplitter> B split(MessageHandlerSpec<?, S> splitterMessageHandlerSpec,
Consumer<SplitterEndpointSpec<S>> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.split(splitterMessageHandlerSpec, endpointConfigurer);
}
@Override
public B split(AbstractMessageSplitter splitter) { // NOSONAR - byte code backward compatibility
return super.split(splitter);
}
@Override
public <S extends AbstractMessageSplitter> B split(S splitter,
Consumer<SplitterEndpointSpec<S>> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.split(splitter, endpointConfigurer);
}
@Override
public B headerFilter(String... headersToRemove) { // NOSONAR - byte code backward compatibility
return super.headerFilter(headersToRemove);
}
@Override
public B headerFilter(String headersToRemove, boolean patternMatch) { // NOSONAR - byte code backward compatibility
return super.headerFilter(headersToRemove, patternMatch);
}
@Override
public B headerFilter(HeaderFilter headerFilter,
Consumer<GenericEndpointSpec<MessageTransformingHandler>> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.headerFilter(headerFilter, endpointConfigurer);
}
@Override
public B claimCheckIn(MessageStore messageStore) { // NOSONAR - byte code backward compatibility
return super.claimCheckIn(messageStore);
}
@Override
public B claimCheckIn(MessageStore messageStore,
Consumer<GenericEndpointSpec<MessageTransformingHandler>> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.claimCheckIn(messageStore, endpointConfigurer);
}
@Override
public B claimCheckOut(MessageStore messageStore) { // NOSONAR - byte code backward compatibility
return super.claimCheckOut(messageStore);
}
@Override
public B claimCheckOut(MessageStore messageStore, boolean removeMessage) { // NOSONAR - byte code backward compatibility
return super.claimCheckOut(messageStore, removeMessage);
}
@Override
public B claimCheckOut(MessageStore messageStore, boolean removeMessage,
Consumer<GenericEndpointSpec<MessageTransformingHandler>> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.claimCheckOut(messageStore, removeMessage, endpointConfigurer);
}
@Override
public B resequence() { // NOSONAR - byte code backward compatibility
return super.resequence();
}
@Override
public B resequence(Consumer<ResequencerSpec> resequencer) { // NOSONAR - byte code backward compatibility
return super.resequence(resequencer);
}
@Override
public B aggregate() { // NOSONAR - byte code backward compatibility
return super.aggregate();
}
@Override
public B aggregate(Consumer<AggregatorSpec> aggregator) { // NOSONAR - byte code backward compatibility
return super.aggregate(aggregator);
}
@Override
public B route(String beanName, String method) { // NOSONAR - byte code backward compatibility
return super.route(beanName, method);
}
@Override
public B route(String beanName, String method,
Consumer<RouterSpec<Object, MethodInvokingRouter>> routerConfigurer) { // NOSONAR - byte code backward compatibility
return super.route(beanName, method, routerConfigurer);
}
@Override
public B route(Object service) { // NOSONAR - byte code backward compatibility
return super.route(service);
}
@Override
public B route(Object service, String methodName) { // NOSONAR - byte code backward compatibility
return super.route(service, methodName);
}
@Override
public B route(Object service, String methodName,
Consumer<RouterSpec<Object, MethodInvokingRouter>> routerConfigurer) { // NOSONAR - byte code backward compatibility
return super.route(service, methodName, routerConfigurer);
}
@Override
public B route(String expression) { // NOSONAR - byte code backward compatibility
return super.route(expression);
}
@Override
public <T> B route(String expression, Consumer<RouterSpec<T, ExpressionEvaluatingRouter>> routerConfigurer) { // NOSONAR - byte code backward compatibility
return super.route(expression, routerConfigurer);
}
@Override
public <S, T> B route(Class<S> payloadType, Function<S, T> router) { // NOSONAR - byte code backward compatibility
return super.route(payloadType, router);
}
@Override
public <P, T> B route(Class<P> payloadType, Function<P, T> router,
Consumer<RouterSpec<T, MethodInvokingRouter>> routerConfigurer) { // NOSONAR - byte code backward compatibility
return super.route(payloadType, router, routerConfigurer);
}
@Override
public B route(MessageProcessorSpec<?> messageProcessorSpec) { // NOSONAR - byte code backward compatibility
return super.route(messageProcessorSpec);
}
@Override
public B route(MessageProcessorSpec<?> messageProcessorSpec,
Consumer<RouterSpec<Object, MethodInvokingRouter>> routerConfigurer) { // NOSONAR - byte code backward compatibility
return super.route(messageProcessorSpec, routerConfigurer);
}
@Override
public B routeToRecipients(Consumer<RecipientListRouterSpec> routerConfigurer) { // NOSONAR - byte code backward compatibility
return super.routeToRecipients(routerConfigurer);
}
@Override
public B routeByException(Consumer<RouterSpec<Class<? extends Throwable>, // NOSONAR - byte code backward compatibility
ErrorMessageExceptionTypeRouter>> routerConfigurer) {
return super.routeByException(routerConfigurer);
}
@Override
public B route(AbstractMessageRouter router) { // NOSONAR - byte code backward compatibility
return super.route(router);
}
@Override
public <R extends AbstractMessageRouter> B route(R router, Consumer<GenericEndpointSpec<R>> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.route(router, endpointConfigurer);
}
@Override
public B gateway(String requestChannel) { // NOSONAR - byte code backward compatibility
return super.gateway(requestChannel);
}
@Override
public B gateway(String requestChannel, Consumer<GatewayEndpointSpec> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.gateway(requestChannel, endpointConfigurer);
}
@Override
public B gateway(MessageChannel requestChannel) { // NOSONAR - byte code backward compatibility
return super.gateway(requestChannel);
}
@Override
public B gateway(MessageChannel requestChannel, Consumer<GatewayEndpointSpec> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.gateway(requestChannel, endpointConfigurer);
}
@Override
public B gateway(IntegrationFlow flow) { // NOSONAR - byte code backward compatibility
return super.gateway(flow);
}
@Override
public B gateway(IntegrationFlow flow, Consumer<GatewayEndpointSpec> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.gateway(flow, endpointConfigurer);
}
@Override
public B log() { // NOSONAR - byte code backward compatibility
return super.log();
}
@Override
public B log(LoggingHandler.Level level) { // NOSONAR - byte code backward compatibility
return super.log(level);
}
@Override
public B log(String category) { // NOSONAR - byte code backward compatibility
return super.log(category);
}
@Override
public B log(LoggingHandler.Level level, String category) { // NOSONAR - byte code backward compatibility
return super.log(level, category);
}
@Override
public B log(LoggingHandler.Level level, String category, String logExpression) { // NOSONAR - byte code backward compatibility
return super.log(level, category, logExpression);
}
@Override
public <P> B log(Function<Message<P>, Object> function) { // NOSONAR - byte code backward compatibility
return super.log(function);
}
@Override
public B log(Expression logExpression) { // NOSONAR - byte code backward compatibility
return super.log(logExpression);
}
@Override
public B log(LoggingHandler.Level level, Expression logExpression) { // NOSONAR - byte code backward compatibility
return super.log(level, logExpression);
}
@Override
public B log(String category, Expression logExpression) { // NOSONAR - byte code backward compatibility
return super.log(category, logExpression);
}
@Override
public <P> B log(LoggingHandler.Level level, Function<Message<P>, Object> function) { // NOSONAR - byte code backward compatibility
return super.log(level, function);
}
@Override
public <P> B log(String category, Function<Message<P>, Object> function) { // NOSONAR - byte code backward compatibility
return super.log(category, function);
}
@Override
public <P> B log(LoggingHandler.Level level, String category, Function<Message<P>, Object> function) { // NOSONAR - byte code backward compatibility
return super.log(level, category, function);
}
@Override
public B log(LoggingHandler.Level level, String category, Expression logExpression) { // NOSONAR - byte code backward compatibility
return super.log(level, category, logExpression);
}
@Override
public IntegrationFlow logAndReply() { // NOSONAR - byte code backward compatibility
return super.logAndReply();
}
@Override
public IntegrationFlow logAndReply(LoggingHandler.Level level) { // NOSONAR - byte code backward compatibility
return super.logAndReply(level);
}
@Override
public IntegrationFlow logAndReply(String category) { // NOSONAR - byte code backward compatibility
return super.logAndReply(category);
}
@Override
public IntegrationFlow logAndReply(LoggingHandler.Level level, String category) { // NOSONAR - byte code backward compatibility
return super.logAndReply(level, category);
}
@Override
public IntegrationFlow logAndReply(LoggingHandler.Level level, String category, String logExpression) { // NOSONAR - byte code backward compatibility
return super.logAndReply(level, category, logExpression);
}
@Override
public <P> IntegrationFlow logAndReply(Function<Message<P>, Object> function) { // NOSONAR - byte code backward compatibility
return super.logAndReply(function);
}
@Override
public IntegrationFlow logAndReply(Expression logExpression) { // NOSONAR - byte code backward compatibility
return super.logAndReply(logExpression);
}
@Override
public IntegrationFlow logAndReply(LoggingHandler.Level level, Expression logExpression) { // NOSONAR - byte code backward compatibility
return super.logAndReply(level, logExpression);
}
@Override
public IntegrationFlow logAndReply(String category, Expression logExpression) { // NOSONAR - byte code backward compatibility
return super.logAndReply(category, logExpression);
}
@Override
public <P> IntegrationFlow logAndReply(LoggingHandler.Level level, Function<Message<P>, Object> function) { // NOSONAR - byte code backward compatibility
return super.logAndReply(level, function);
}
@Override
public <P> IntegrationFlow logAndReply(String category, Function<Message<P>, Object> function) { // NOSONAR - byte code backward compatibility
return super.logAndReply(category, function);
}
@Override
public <P> IntegrationFlow logAndReply(LoggingHandler.Level level, String category,
Function<Message<P>, Object> function) { // NOSONAR - byte code backward compatibility
return super.logAndReply(level, category, function);
}
@Override
public IntegrationFlow logAndReply(LoggingHandler.Level level, String category, Expression logExpression) { // NOSONAR - byte code backward compatibility
return super.logAndReply(level, category, logExpression);
}
@Override
public B scatterGather(MessageChannel scatterChannel) { // NOSONAR - byte code backward compatibility
return super.scatterGather(scatterChannel);
}
@Override
public B scatterGather(MessageChannel scatterChannel, Consumer<AggregatorSpec> gatherer) { // NOSONAR - byte code backward compatibility
return super.scatterGather(scatterChannel, gatherer);
}
@Override
public B scatterGather(MessageChannel scatterChannel, Consumer<AggregatorSpec> gatherer,
Consumer<ScatterGatherSpec> scatterGather) { // NOSONAR - byte code backward compatibility
return super.scatterGather(scatterChannel, gatherer, scatterGather);
}
@Override
public B scatterGather(Consumer<RecipientListRouterSpec> scatterer) { // NOSONAR - byte code backward compatibility
return super.scatterGather(scatterer);
}
@Override
public B scatterGather(Consumer<RecipientListRouterSpec> scatterer, Consumer<AggregatorSpec> gatherer) { // NOSONAR - byte code backward compatibility
return super.scatterGather(scatterer, gatherer);
}
@Override
public B scatterGather(Consumer<RecipientListRouterSpec> scatterer, Consumer<AggregatorSpec> gatherer,
Consumer<ScatterGatherSpec> scatterGather) { // NOSONAR - byte code backward compatibility
return super.scatterGather(scatterer, gatherer, scatterGather);
}
@Override
public B barrier(long timeout) { // NOSONAR - byte code backward compatibility
return super.barrier(timeout);
}
@Override
public B barrier(long timeout, Consumer<BarrierSpec> barrierConfigurer) { // NOSONAR - byte code backward compatibility
return super.barrier(timeout, barrierConfigurer);
}
@Override
public B trigger(String triggerActionId) { // NOSONAR - byte code backward compatibility
return super.trigger(triggerActionId);
}
@Override
public B trigger(String triggerActionId,
Consumer<GenericEndpointSpec<ServiceActivatingHandler>> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.trigger(triggerActionId, endpointConfigurer);
}
@Override
public B trigger(MessageTriggerAction triggerAction) { // NOSONAR - byte code backward compatibility
return super.trigger(triggerAction);
}
@Override
public B trigger(MessageTriggerAction triggerAction,
Consumer<GenericEndpointSpec<ServiceActivatingHandler>> endpointConfigurer) { // NOSONAR - byte code backward compatibility
return super.trigger(triggerAction, endpointConfigurer);
}
@Override
public <I, O> B fluxTransform(Function<? super Flux<Message<I>>, ? extends Publisher<O>> fluxFunction) { // NOSONAR - byte code backward compatibility
return super.fluxTransform(fluxFunction);
}
@Override
public IntegrationFlow nullChannel() { // NOSONAR - byte code backward compatibility
return super.nullChannel();
}
@Override
public B enrichHeaders(Map<String, Object> headers) { // NOSONAR - byte code backward compatibility
return super.enrichHeaders(headers);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2019 the original author or authors.
* Copyright 2016-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -113,7 +113,7 @@ public final class IntegrationFlows {
* @see MessageSourceSpec and its implementations.
*/
public static IntegrationFlowBuilder from(MessageSourceSpec<?, ? extends MessageSource<?>> messageSourceSpec) {
return from(messageSourceSpec, (Consumer<SourcePollingChannelAdapterSpec>) null);
return from(messageSourceSpec, null);
}
/**
@@ -133,20 +133,6 @@ public final class IntegrationFlows {
return from(messageSourceSpec.get(), endpointConfigurer, registerComponents(messageSourceSpec));
}
/**
* Populate the provided {@link MethodInvokingMessageSource} for the method of the provided service.
* The {@link org.springframework.integration.dsl.IntegrationFlow} {@code startMessageSource}.
* @param service the service to use.
* @param methodName the method to invoke.
* @return new {@link IntegrationFlowBuilder}.
* @see MethodInvokingMessageSource
* @deprecated since 5.2 in favor of method reference via {@link #from(Supplier)}
*/
@Deprecated
public static IntegrationFlowBuilder from(Object service, String methodName) {
return from(service, methodName, null);
}
/**
* Provides {@link Supplier} as source of messages to the integration flow which will
* be triggered by the application context's default poller (which must be declared).
@@ -156,7 +142,7 @@ public final class IntegrationFlows {
* @see Supplier
*/
public static <T> IntegrationFlowBuilder from(Supplier<T> messageSource) {
return from(messageSource, (Consumer<SourcePollingChannelAdapterSpec>) null);
return from(messageSource, null);
}
/**
@@ -172,6 +158,7 @@ public final class IntegrationFlows {
*/
public static <T> IntegrationFlowBuilder from(Supplier<T> messageSource,
Consumer<SourcePollingChannelAdapterSpec> endpointConfigurer) {
Assert.notNull(messageSource, "'messageSource' must not be null");
MethodInvokingMessageSource methodInvokingMessageSource = new MethodInvokingMessageSource();
methodInvokingMessageSource.setObject(messageSource);
@@ -179,28 +166,6 @@ public final class IntegrationFlows {
return from(methodInvokingMessageSource, endpointConfigurer);
}
/**
* Populate the provided {@link MethodInvokingMessageSource} for the method of the provided service.
* The {@link org.springframework.integration.dsl.IntegrationFlow} {@code startMessageSource}.
* @param service the service to use.
* @param methodName the method to invoke.
* @param endpointConfigurer the {@link Consumer} to provide more options for the
* {@link org.springframework.integration.config.SourcePollingChannelAdapterFactoryBean}.
* @return new {@link IntegrationFlowBuilder}.
* @see MethodInvokingMessageSource
* @deprecated since 5.2 in favor of method reference via {@link #from(Supplier)}
*/
@Deprecated
public static IntegrationFlowBuilder from(Object service, String methodName,
Consumer<SourcePollingChannelAdapterSpec> endpointConfigurer) {
Assert.notNull(service, "'service' must not be null");
Assert.hasText(methodName, "'methodName' must not be empty");
MethodInvokingMessageSource messageSource = new MethodInvokingMessageSource();
messageSource.setObject(service);
messageSource.setMethodName(methodName);
return from(messageSource, endpointConfigurer);
}
/**
* Populate the provided {@link MessageSource} object to the {@link IntegrationFlowBuilder} chain.
* The {@link org.springframework.integration.dsl.IntegrationFlow} {@code startMessageSource}.
@@ -209,7 +174,7 @@ public final class IntegrationFlows {
* @see MessageSource
*/
public static IntegrationFlowBuilder from(MessageSource<?> messageSource) {
return from(messageSource, (Consumer<SourcePollingChannelAdapterSpec>) null);
return from(messageSource, null);
}
/**
@@ -265,7 +230,7 @@ public final class IntegrationFlows {
* @return new {@link IntegrationFlowBuilder}.
*/
public static IntegrationFlowBuilder from(MessageProducerSupport messageProducer) {
return from(messageProducer, (IntegrationFlowBuilder) null);
return from(messageProducer, null);
}
private static IntegrationFlowBuilder from(MessageProducerSupport messageProducer,
@@ -304,7 +269,7 @@ public final class IntegrationFlows {
* @return new {@link IntegrationFlowBuilder}.
*/
public static IntegrationFlowBuilder from(MessagingGatewaySupport inboundGateway) {
return from(inboundGateway, (IntegrationFlowBuilder) null);
return from(inboundGateway, null);
}
/**
@@ -320,26 +285,7 @@ public final class IntegrationFlows {
* @return new {@link IntegrationFlowBuilder}.
*/
public static IntegrationFlowBuilder from(Class<?> serviceInterface) {
return from(serviceInterface, (Consumer<GatewayProxySpec>) null);
}
/**
* Populate the {@link MessageChannel} to the new {@link IntegrationFlowBuilder}
* chain, which becomes as a {@code requestChannel} for the Messaging Gateway(s) built
* on the provided service interface.
* <p>A gateway proxy bean for provided service interface is registered under a name of
* the provided {@code beanName} if not null, or from the
* {@link org.springframework.integration.annotation.MessagingGateway#name()} if present
* or as a fallback to the {@link IntegrationFlow} bean name plus {@code .gateway} suffix.
* @param serviceInterface the service interface class with an optional
* {@link org.springframework.integration.annotation.MessagingGateway} annotation.
* @param beanName the bean name to be used for registering bean for the gateway proxy
* @return new {@link IntegrationFlowBuilder}.
* @deprecated since 5.2 in favor of {@link #from(Class, Consumer)}
*/
@Deprecated
public static IntegrationFlowBuilder from(Class<?> serviceInterface, @Nullable String beanName) {
return from(serviceInterface, gateway -> gateway.beanName(beanName));
return from(serviceInterface, null);
}
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -109,7 +109,7 @@ public class GatewayProxyFactoryBean extends AbstractEndpoint
private final Map<Method, MethodInvocationGateway> gatewayMap = new HashMap<>();
private Class<?> serviceInterface = RequestReplyExchanger.class;
private final Class<?> serviceInterface;
private MessageChannel defaultRequestChannel;
@@ -161,6 +161,7 @@ public class GatewayProxyFactoryBean extends AbstractEndpoint
* {@link RequestReplyExchanger}, upon initialization.
*/
public GatewayProxyFactoryBean() {
this.serviceInterface = RequestReplyExchanger.class;
}
public GatewayProxyFactoryBean(Class<?> serviceInterface) {
@@ -169,20 +170,6 @@ public class GatewayProxyFactoryBean extends AbstractEndpoint
this.serviceInterface = serviceInterface;
}
/**
* Set the interface class that the generated proxy should implement.
* If none is provided explicitly, the default is {@link RequestReplyExchanger}.
* @param serviceInterface The service interface.
* @deprecated since 5.2.1 in favor of ctor initialization
*/
@Deprecated
public void setServiceInterface(Class<?> serviceInterface) {
Assert.notNull(serviceInterface, "'serviceInterface' must not be null");
Assert.isTrue(serviceInterface.isInterface(), "'serviceInterface' must be an interface");
this.serviceInterface = serviceInterface;
}
/**
* Set the default request channel.
* @param defaultRequestChannel the channel to which request messages will

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -98,17 +98,6 @@ public class ExpressionEvaluatingRequestHandlerAdvice extends AbstractRequestHan
this.onSuccessExpression = onSuccessExpression;
}
/**
* Set the expression to evaluate against the message after a successful
* handler invocation.
* @param onSuccessExpression the SpEL expression.
* @deprecated in favor of {@link #setOnSuccessExpression(Expression)}
*/
@Deprecated
public void setExpressionOnSuccess(Expression onSuccessExpression) {
setOnSuccessExpression(onSuccessExpression);
}
/**
* Set the expression to evaluate against the root message after a failed
* handler invocation. The exception is available as the variable {@code #exception}.
@@ -131,17 +120,6 @@ public class ExpressionEvaluatingRequestHandlerAdvice extends AbstractRequestHan
this.onFailureExpression = onFailureExpression;
}
/**
* Set the expression to evaluate against the root message after a failed
* handler invocation. The exception is available as the variable {@code #exception}
* @param onFailureExpression the SpEL expression.
* @deprecated in favor of {@link #setOnFailureExpression(Expression)}
*/
@Deprecated
public void setExpressionOnFailure(Expression onFailureExpression) {
setOnFailureExpression(onFailureExpression);
}
/**
* Set the channel to which to send the {@link AdviceMessage} after evaluating the
* success expression.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,13 +46,6 @@ public abstract class AbstractKeyValueMessageStore extends AbstractMessageGroupS
protected static final String MESSAGE_GROUP_KEY_PREFIX = "MESSAGE_GROUP_";
/**
* Represents the time when the message has been added to the store.
* @deprecated since 5.0. This constant isn't used any more.
*/
@Deprecated
protected static final String CREATED_DATE = "CREATED_DATE";
private final String messagePrefix;
private final String groupPrefix;

View File

@@ -1,216 +0,0 @@
/*
* Copyright 2014-2019 the original author or authors.
*
* Licensed 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
*
* https://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.springframework.integration.support.json;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.PipedReader;
import java.io.PipedWriter;
import java.io.Reader;
import java.io.Writer;
import java.lang.reflect.Type;
import java.util.Arrays;
import java.util.Collection;
import java.util.Map;
import java.util.concurrent.Executors;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.boon.json.JsonFactory;
import org.boon.json.JsonParserAndMapper;
import org.boon.json.JsonParserFactory;
import org.boon.json.JsonSerializerFactory;
import org.boon.json.JsonSlurper;
import org.boon.json.ObjectMapper;
import org.springframework.beans.factory.BeanClassLoaderAware;
import org.springframework.integration.mapping.support.JsonHeaders;
import org.springframework.util.ClassUtils;
/**
* The Boon (@link https://github.com/RichardHightower/boon) {@link JsonObjectMapper} implementation.
*
* @author Artem Bilan
* @since 4.1
*
* @deprecated since 5.2. Will be removed in the next version.
*/
@Deprecated
public class BoonJsonObjectMapper implements JsonObjectMapper<Map<String, Object>, Object>, BeanClassLoaderAware {
private static final Log logger = LogFactory.getLog(BoonJsonObjectMapper.class);
private static final Collection<Class<?>> supportedJsonTypes =
Arrays.asList(String.class, byte[].class, byte[].class, File.class, InputStream.class, Reader.class);
private final ObjectMapper objectMapper;
private final JsonSlurper slurper = new JsonSlurper();
private volatile ClassLoader classLoader = ClassUtils.getDefaultClassLoader();
public BoonJsonObjectMapper() {
this.objectMapper = JsonFactory.create();
}
public BoonJsonObjectMapper(JsonParserFactory parserFactory, JsonSerializerFactory serializerFactory) {
this.objectMapper = JsonFactory.create(parserFactory, serializerFactory);
}
@Override
public void setBeanClassLoader(ClassLoader classLoader) {
this.classLoader = classLoader;
}
@Override
public String toJson(Object value) {
return this.objectMapper.writeValueAsString(value);
}
@Override
public void toJson(Object value, Writer writer) {
this.objectMapper.toJson(value, writer);
}
@Override
@SuppressWarnings("unchecked")
public Map<String, Object> toJsonNode(final Object value) throws IOException {
PipedReader in = new PipedReader();
final PipedWriter out = new PipedWriter(in);
Executors.newSingleThreadExecutor().execute(() -> toJson(value, out));
return (Map<String, Object>) this.slurper.parse(in);
}
@Override
public <T> T fromJson(Object json, Class<T> type) {
if (json instanceof String) {
return this.objectMapper.readValue((String) json, type);
}
else if (json instanceof byte[]) {
return this.objectMapper.readValue((byte[]) json, type);
}
else if (json instanceof char[]) {
return this.objectMapper.readValue((char[]) json, type);
}
else if (json instanceof File) {
return this.objectMapper.readValue((File) json, type);
}
else if (json instanceof InputStream) {
return this.objectMapper.readValue((InputStream) json, type);
}
else if (json instanceof Reader) {
return this.objectMapper.readValue((Reader) json, type);
}
else {
throw new IllegalArgumentException("'json' argument must be an instance of: " + supportedJsonTypes
+ " , but gotten: " + json.getClass());
}
}
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public <T> T fromJson(Object json, Map<String, Object> javaTypes) throws IOException {
JsonParserAndMapper parser = this.objectMapper.parser();
Class<?> classType = createJavaType(javaTypes, JsonHeaders.TYPE_ID);
Class<?> contentClassType = createJavaType(javaTypes, JsonHeaders.CONTENT_TYPE_ID);
Class<?> keyClassType = createJavaType(javaTypes, JsonHeaders.KEY_TYPE_ID);
if (keyClassType != null) {
logger.warn("Boon doesn't support the Map 'key' conversion. Will be returned raw Map<String, Object>");
if (json instanceof String) {
return (T) parser.parseMap((String) json);
}
else if (json instanceof byte[]) {
return (T) parser.parseMap((byte[]) json);
}
else if (json instanceof char[]) {
return (T) parser.parseMap((char[]) json);
}
else if (json instanceof File) {
return (T) parser.parseMap(new FileReader((File) json));
}
else if (json instanceof InputStream) {
return (T) parser.parseMap((InputStream) json);
}
else if (json instanceof Reader) {
return (T) parser.parseMap((Reader) json);
}
else {
throw new IllegalArgumentException("'json' argument must be an instance of: " + supportedJsonTypes
+ " , but gotten: " + json.getClass());
}
}
if (contentClassType != null) {
if (json instanceof String) {
return (T) this.objectMapper.readValue((String) json, (Class<Collection>) classType, contentClassType);
}
else if (json instanceof byte[]) {
return (T) this.objectMapper.readValue((byte[]) json, (Class<Collection>) classType, contentClassType);
}
else if (json instanceof char[]) {
return (T) this.objectMapper.readValue((char[]) json, (Class<Collection>) classType, contentClassType);
}
else if (json instanceof File) {
return (T) this.objectMapper.readValue((File) json, (Class<Collection>) classType, contentClassType);
}
else if (json instanceof InputStream) {
return (T) this.objectMapper.readValue((InputStream) json, (Class<Collection>) classType,
contentClassType);
}
else if (json instanceof Reader) {
return (T) this.objectMapper.readValue((Reader) json, (Class<Collection>) classType, contentClassType);
}
else {
throw new IllegalArgumentException("'json' argument must be an instance of: " + supportedJsonTypes
+ " , but gotten: " + json.getClass());
}
}
return (T) fromJson(json, classType);
}
protected Class<?> createJavaType(Map<String, Object> javaTypes, String javaTypeKey) {
Object classValue = javaTypes.get(javaTypeKey);
if (classValue instanceof Class<?>) {
return (Class<?>) classValue;
}
else if (classValue != null) {
try {
return ClassUtils.forName(classValue.toString(), this.classLoader);
}
catch (ClassNotFoundException | LinkageError e) {
throw new IllegalStateException(e);
}
}
else {
return null;
}
}
@Override
public <T> T fromJson(Object parser, Type valueType) {
throw new UnsupportedOperationException("Boon doesn't support JSON reader parser abstraction");
}
}

View File

@@ -1,33 +0,0 @@
/*
* Copyright 2013-2019 the original author or authors.
*
* Licensed 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
*
* https://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.springframework.integration.support.json;
/**
* Simple {@linkplain JsonObjectMapper} adapter implementation, if there is no need
* to provide entire operations implementation.
*
* @author Artem Bilan
* @author Gary Russell
*
* @since 3.0
*
* @deprecated since 5.2 in favor of {@code default} methods in the {@link JsonObjectMapper} interface
*/
@Deprecated
public abstract class JsonObjectMapperAdapter<N, P> implements JsonObjectMapper<N, P> {
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,29 +16,21 @@
package org.springframework.integration.support.json;
import org.springframework.util.ClassUtils;
/**
* Simple factory to provide {@linkplain JsonObjectMapper}
* instances dependently of jackson-databind or boon libs in the classpath.
* If there are both libs in the classpath, it prefers Jackson 2 JSON-processor implementation.
* If there is not any of them, {@linkplain IllegalStateException} will be thrown.
* instances based on jackson-databind lib in the classpath.
* If there is no JSON processor in classpath, {@linkplain IllegalStateException} will be thrown.
*
* @author Artem Bilan
* @author Gary Russell
* @author Vikas Prasad
*
* @since 3.0
*
* @see Jackson2JsonObjectMapper
*/
public final class JsonObjectMapperProvider {
private static final ClassLoader classLoader = JsonObjectMapperProvider.class.getClassLoader();
private static final boolean boonPresent =
ClassUtils.isPresent("org.boon.json.ObjectMapper", classLoader);
private JsonObjectMapperProvider() {
}
@@ -47,16 +39,12 @@ public final class JsonObjectMapperProvider {
* @return the mapper.
* @throws IllegalStateException if an implementation is not available.
*/
@SuppressWarnings("deprecation")
public static JsonObjectMapper<?, ?> newInstance() {
if (JacksonPresent.isJackson2Present()) {
return new Jackson2JsonObjectMapper();
}
else if (boonPresent) {
return new org.springframework.integration.support.json.BoonJsonObjectMapper();
}
else {
throw new IllegalStateException("Neither jackson-databind.jar, nor boon.jar is present in the classpath.");
throw new IllegalStateException("No jackson-databind.jar is present in the classpath.");
}
}
@@ -66,7 +54,7 @@ public final class JsonObjectMapperProvider {
* @since 4.2.7
*/
public static boolean jsonAvailable() {
return JacksonPresent.isJackson2Present() || boonPresent;
return JacksonPresent.isJackson2Present();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,23 +57,6 @@ public class DynamicPeriodicTrigger implements Trigger {
this(Duration.ofMillis(period));
}
/**
* Create a trigger with the given period and time unit. The time unit will
* apply not only to the period but also to any 'initialDelay' value, if
* configured on this Trigger later via {@link #setInitialDelay(long)}.
* @param period Must not be negative
* @param timeUnit Must not be null
* @deprecated in favor of {@link #DynamicPeriodicTrigger(Duration)}.
*/
@Deprecated
public DynamicPeriodicTrigger(long period, TimeUnit timeUnit) {
Assert.isTrue(period >= 0, "period must not be negative");
Assert.notNull(timeUnit, "timeUnit must not be null");
this.timeUnit = timeUnit;
this.duration = Duration.ofMillis(this.timeUnit.toMillis(period));
}
/**
* Create a trigger with the provided duration.
* @param duration the duration.
@@ -85,19 +68,6 @@ public class DynamicPeriodicTrigger implements Trigger {
this.duration = duration;
}
/**
* Specify the delay for the initial execution. It will be evaluated in
* terms of this trigger's {@link TimeUnit}. If no time unit was explicitly
* provided upon instantiation, the default is milliseconds.
* @param initialDelay the initial delay in milliseconds.
* @deprecated in favor of {@link #setInitialDuration(Duration)}.
*/
@Deprecated
public void setInitialDelay(long initialDelay) {
Assert.isTrue(initialDelay >= 0, "initialDelay must not be negative");
this.initialDuration = Duration.ofMillis(this.timeUnit.toMillis(initialDelay));
}
/**
* Specify the delay for the initial execution. It will be evaluated in
* terms of this trigger's {@link TimeUnit}. If no time unit was explicitly
@@ -148,60 +118,6 @@ public class DynamicPeriodicTrigger implements Trigger {
this.fixedRate = fixedRate;
}
/**
* Return the period in milliseconds.
* @return the period.
* @deprecated in favor of {@link #getDuration()}.
*/
@Deprecated
public long getPeriod() {
return this.duration.toMillis();
}
/**
* Specify the period of the trigger. It will be evaluated in
* terms of this trigger's {@link TimeUnit}. If no time unit was explicitly
* provided upon instantiation, the default is milliseconds.
* @param period Must not be negative
* @deprecated in favor of {@link #setDuration(Duration)}.
*/
@Deprecated
public void setPeriod(long period) {
Assert.isTrue(period >= 0, "period must not be negative");
this.duration = Duration.ofMillis(this.timeUnit.toMillis(period));
}
/**
* Get the time unit.
* @return the time unit.
* @deprecated - use {@link Duration} instead.
*/
@Deprecated
public TimeUnit getTimeUnit() {
return this.timeUnit;
}
/**
* Set the time unit.
* @param timeUnit the time unit.
* @deprecated - use {@link Duration} instead.
*/
@Deprecated
public void setTimeUnit(TimeUnit timeUnit) {
Assert.notNull(timeUnit, "timeUnit must not be null");
this.timeUnit = timeUnit;
}
/**
* Get the initial delay in milliseconds.
* @return the initial delay.
* @deprecated in favor of {@link #getInitialDuration()}.
*/
@Deprecated
public long getInitialDelay() {
return this.initialDuration.toMillis();
}
/**
* Return whether this trigger is fixed rate.
* @return the fixed rate.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,8 +22,8 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import java.util.HashMap;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.context.support.GenericApplicationContext;
@@ -49,8 +49,7 @@ public class GatewayProxyMessageMappingTests {
private volatile TestGateway gateway = null;
@Before
@BeforeEach
public void initializeGateway() {
GatewayProxyFactoryBean factoryBean = new GatewayProxyFactoryBean(TestGateway.class);
factoryBean.setDefaultRequestChannel(channel);
@@ -64,7 +63,6 @@ public class GatewayProxyMessageMappingTests {
this.gateway = (TestGateway) factoryBean.getObject();
}
@Test
public void payloadAndHeaderMapWithoutAnnotations() {
Map<String, Object> m = new HashMap<>();
@@ -141,7 +139,7 @@ public class GatewayProxyMessageMappingTests {
GenericApplicationContext context = new GenericApplicationContext();
RootBeanDefinition gatewayDefinition = new RootBeanDefinition(GatewayProxyFactoryBean.class);
gatewayDefinition.getPropertyValues().add("defaultRequestChannel", channel);
gatewayDefinition.getPropertyValues().add("serviceInterface", TestGateway.class);
gatewayDefinition.getConstructorArgumentValues().addGenericArgumentValue(TestGateway.class);
context.registerBeanDefinition("testGateway", gatewayDefinition);
context.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
context.registerBeanDefinition(IntegrationContextUtils.INTEGRATION_EVALUATION_CONTEXT_BEAN_NAME,
@@ -168,7 +166,7 @@ public class GatewayProxyMessageMappingTests {
GenericApplicationContext context = new GenericApplicationContext();
RootBeanDefinition gatewayDefinition = new RootBeanDefinition(GatewayProxyFactoryBean.class);
gatewayDefinition.getPropertyValues().add("defaultRequestChannel", channel);
gatewayDefinition.getPropertyValues().add("serviceInterface", TestGateway.class);
gatewayDefinition.getConstructorArgumentValues().addGenericArgumentValue(TestGateway.class);
context.registerBeanDefinition("testGateway", gatewayDefinition);
context.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
context.registerBeanDefinition(IntegrationContextUtils.INTEGRATION_EVALUATION_CONTEXT_BEAN_NAME,

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2019 the original author or authors.
* Copyright 2016-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -309,18 +309,6 @@ public abstract class RemoteFileOutboundGatewaySpec<F, S extends RemoteFileOutbo
return localFilenameExpression(PARSER.parseExpression(localFilenameExpression));
}
/**
* Specify a {@link Function} for local files renaming after downloading.
* @param localFilenameFunction the {@link Function} to use.
* @param <P> the expected payload type.
* @return the Spec.
* @deprecated since 5.2 in favor of {@link #localFilenameFunction(Function)}
*/
@Deprecated
public <P> S localFilename(Function<Message<P>, String> localFilenameFunction) {
return localFilenameFunction(localFilenameFunction);
}
/**
* Specify a {@link Function} for local files renaming after downloading.
* @param localFilenameFunction the {@link Function} to use.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,6 @@ package org.springframework.integration.file.filters;
import java.util.regex.Pattern;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.Assert;
/**
@@ -33,8 +32,7 @@ import org.springframework.util.Assert;
*
* @since 2.0
*/
public abstract class AbstractRegexPatternFileListFilter<F> extends AbstractDirectoryAwareFileListFilter<F>
implements InitializingBean { // TODO Remove in the next version
public abstract class AbstractRegexPatternFileListFilter<F> extends AbstractDirectoryAwareFileListFilter<F> {
private Pattern pattern;
@@ -59,15 +57,6 @@ public abstract class AbstractRegexPatternFileListFilter<F> extends AbstractDire
this.pattern = pattern;
}
/**
* @deprecated since 5.1.3. Will be removed in the next 5.2 version.
*/
@Override
@Deprecated
public void afterPropertiesSet() {
}
@Override
public boolean accept(F file) {
return alwaysAccept(file) || (file != null && this.pattern.matcher(getFilename(file)).matches());
@@ -75,7 +64,6 @@ public abstract class AbstractRegexPatternFileListFilter<F> extends AbstractDire
/**
* Subclasses must implement this method to extract the file's name.
*
* @param file The file.
* @return The file name.
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -78,300 +78,6 @@ public class DefaultHttpHeaderMapper implements HeaderMapper<HttpHeaders>, BeanF
protected final Log logger = LogFactory.getLog(getClass()); // NOSONAR - final
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#ACCEPT}
*/
@Deprecated
public static final String ACCEPT = HttpHeaders.ACCEPT;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#ACCEPT_CHARSET}
*/
@Deprecated
public static final String ACCEPT_CHARSET = HttpHeaders.ACCEPT_CHARSET;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#ACCEPT_ENCODING}
*/
@Deprecated
public static final String ACCEPT_ENCODING = HttpHeaders.ACCEPT_ENCODING;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#ACCEPT_LANGUAGE}
*/
@Deprecated
public static final String ACCEPT_LANGUAGE = HttpHeaders.ACCEPT_LANGUAGE;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#ACCEPT_RANGES}
*/
@Deprecated
public static final String ACCEPT_RANGES = HttpHeaders.ACCEPT_RANGES;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#AGE}
*/
@Deprecated
public static final String AGE = HttpHeaders.AGE;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#ALLOW}
*/
@Deprecated
public static final String ALLOW = HttpHeaders.ALLOW;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#AUTHORIZATION}
*/
@Deprecated
public static final String AUTHORIZATION = HttpHeaders.AUTHORIZATION;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#CACHE_CONTROL}
*/
@Deprecated
public static final String CACHE_CONTROL = HttpHeaders.CACHE_CONTROL;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#CONNECTION}
*/
@Deprecated
public static final String CONNECTION = HttpHeaders.CONNECTION;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#CONTENT_ENCODING}
*/
@Deprecated
public static final String CONTENT_ENCODING = HttpHeaders.CONTENT_ENCODING;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#CONTENT_LANGUAGE}
*/
@Deprecated
public static final String CONTENT_LANGUAGE = HttpHeaders.CONTENT_LANGUAGE;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#CONTENT_LENGTH}
*/
@Deprecated
public static final String CONTENT_LENGTH = HttpHeaders.CONTENT_LENGTH;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#CONTENT_LOCATION}
*/
@Deprecated
public static final String CONTENT_LOCATION = HttpHeaders.CONTENT_LOCATION;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#CONTENT_RANGE}
*/
@Deprecated
public static final String CONTENT_RANGE = HttpHeaders.CONTENT_RANGE;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#CONTENT_TYPE}
*/
@Deprecated
public static final String CONTENT_TYPE = HttpHeaders.CONTENT_TYPE;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#CONTENT_DISPOSITION}
*/
@Deprecated
public static final String CONTENT_DISPOSITION = HttpHeaders.CONTENT_DISPOSITION;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#COOKIE}
*/
@Deprecated
public static final String COOKIE = HttpHeaders.COOKIE;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#DATE}
*/
@Deprecated
public static final String DATE = HttpHeaders.DATE;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#ETAG}
*/
@Deprecated
public static final String ETAG = HttpHeaders.ETAG;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#EXPECT}
*/
@Deprecated
public static final String EXPECT = HttpHeaders.EXPECT;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#EXPIRES}
*/
@Deprecated
public static final String EXPIRES = HttpHeaders.EXPIRES;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#FROM}
*/
@Deprecated
public static final String FROM = HttpHeaders.FROM;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#HOST}
*/
@Deprecated
public static final String HOST = HttpHeaders.HOST;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#IF_MATCH}
*/
@Deprecated
public static final String IF_MATCH = HttpHeaders.IF_MATCH;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#IF_MODIFIED_SINCE}
*/
@Deprecated
public static final String IF_MODIFIED_SINCE = HttpHeaders.IF_MODIFIED_SINCE;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#IF_NONE_MATCH}
*/
@Deprecated
public static final String IF_NONE_MATCH = HttpHeaders.IF_NONE_MATCH;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#IF_RANGE}
*/
@Deprecated
public static final String IF_RANGE = HttpHeaders.IF_RANGE;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#IF_UNMODIFIED_SINCE}
*/
@Deprecated
public static final String IF_UNMODIFIED_SINCE = HttpHeaders.IF_UNMODIFIED_SINCE;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#LAST_MODIFIED}
*/
@Deprecated
public static final String LAST_MODIFIED = HttpHeaders.LAST_MODIFIED;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#LOCATION}
*/
@Deprecated
public static final String LOCATION = HttpHeaders.LOCATION;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#MAX_FORWARDS}
*/
@Deprecated
public static final String MAX_FORWARDS = HttpHeaders.MAX_FORWARDS;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#PRAGMA}
*/
@Deprecated
public static final String PRAGMA = HttpHeaders.PRAGMA;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#PROXY_AUTHENTICATE}
*/
@Deprecated
public static final String PROXY_AUTHENTICATE = HttpHeaders.PROXY_AUTHENTICATE;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#PROXY_AUTHORIZATION}
*/
@Deprecated
public static final String PROXY_AUTHORIZATION = HttpHeaders.PROXY_AUTHORIZATION;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#RANGE}
*/
@Deprecated
public static final String RANGE = HttpHeaders.RANGE;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#REFERER}
*/
@Deprecated
public static final String REFERER = HttpHeaders.REFERER;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#RETRY_AFTER}
*/
@Deprecated
public static final String RETRY_AFTER = HttpHeaders.RETRY_AFTER;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#SERVER}
*/
@Deprecated
public static final String SERVER = HttpHeaders.SERVER;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#SET_COOKIE}
*/
@Deprecated
public static final String SET_COOKIE = HttpHeaders.SET_COOKIE;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#TE}
*/
@Deprecated
public static final String TE = HttpHeaders.TE;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#TRAILER}
*/
@Deprecated
public static final String TRAILER = HttpHeaders.TRAILER;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#UPGRADE}
*/
@Deprecated
public static final String UPGRADE = HttpHeaders.UPGRADE;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#USER_AGENT}
*/
@Deprecated
public static final String USER_AGENT = HttpHeaders.USER_AGENT;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#VARY}
*/
@Deprecated
public static final String VARY = HttpHeaders.VARY;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#VIA}
*/
@Deprecated
public static final String VIA = HttpHeaders.VIA;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#WARNING}
*/
@Deprecated
public static final String WARNING = HttpHeaders.WARNING;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#WWW_AUTHENTICATE}
*/
@Deprecated
public static final String WWW_AUTHENTICATE = HttpHeaders.WWW_AUTHENTICATE;
/**
* @deprecated since 5.2 in favor of {@link HttpHeaders#TRANSFER_ENCODING}
*/
@Deprecated
public static final String TRANSFER_ENCODING = HttpHeaders.TRANSFER_ENCODING;
public static final String CONTENT_MD5 = "Content-MD5";
public static final String REFRESH = "Refresh";

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,6 +31,8 @@ import org.springframework.core.serializer.Serializer;
* reconstruct a byte array from an arbitrary stream.
*
* @author Gary Russell
* @author Artme Bilan
*
* @since 2.0
*
*/
@@ -45,11 +47,10 @@ public abstract class AbstractByteArraySerializer implements
*/
public static final int DEFAULT_MAX_MESSAGE_SIZE = 2048;
@Deprecated
protected int maxMessageSize = DEFAULT_MAX_MESSAGE_SIZE; // NOSONAR - TODO private in 5.2, use getter
protected final Log logger = LogFactory.getLog(this.getClass()); // NOSONAR
private int maxMessageSize = DEFAULT_MAX_MESSAGE_SIZE;
private ApplicationEventPublisher applicationEventPublisher;
/**
@@ -57,7 +58,6 @@ public abstract class AbstractByteArraySerializer implements
* Default 2048.
* @return The max message size.
*/
@SuppressWarnings("deprecation")
public int getMaxMessageSize() {
return this.maxMessageSize;
}
@@ -67,7 +67,6 @@ public abstract class AbstractByteArraySerializer implements
* Default 2048.
* @param maxMessageSize The max message size.
*/
@SuppressWarnings("deprecation")
public void setMaxMessageSize(int maxMessageSize) {
this.maxMessageSize = maxMessageSize;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -86,7 +86,7 @@ public class JdbcMessageHandler extends AbstractMessageHandler {
private final NamedParameterJdbcOperations jdbcOperations;
private String updateSql;
private final String updateSql;
private PreparedStatementCreator generatedKeysStatementCreator;
@@ -128,16 +128,6 @@ public class JdbcMessageHandler extends AbstractMessageHandler {
this.keysGenerated = keysGenerated;
}
/**
* Configure an SQL statement to perform an UPDATE on the target database.
* @param updateSql the SQL statement to perform.
* @deprecated since 5.1.3 in favor of constructor argument.
*/
@Deprecated
public final void setUpdateSql(String updateSql) {
Assert.hasText(updateSql, "'updateSql' must not be empty.");
this.updateSql = updateSql;
}
public void setSqlParameterSourceFactory(SqlParameterSourceFactory sqlParameterSourceFactory) {
this.sqlParameterSourceFactory = sqlParameterSourceFactory;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -147,18 +147,6 @@ public class JdbcPollingChannelAdapter extends AbstractMessageSource<Object> {
this.sqlQueryParameterSource = sqlQueryParameterSource;
}
/**
* The maximum number of rows to pull out of the query results per poll (if
* greater than zero, otherwise all rows will be packed into the outgoing
* message). Default is zero.
* @param maxRows the max rows to set
* @deprecated since 5.1 in favor of {@link #setMaxRows(int)}
*/
@Deprecated
public void setMaxRowsPerPoll(int maxRows) {
setMaxRows(maxRows);
}
/**
* The maximum number of rows to query. Default is zero - select all records.
* @param maxRows the max rows to set

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -475,28 +475,6 @@ public class StoredProcExecutor implements BeanFactoryAware, InitializingBean {
this.returningResultSetRowMappers = returningResultSetRowMappers;
}
/**
* Allows for the retrieval of metrics.
* @return the metrics.
* @deprecated since 5.2
* @throws UnsupportedOperationException since this functionality isn't supported any more.
*/
@Deprecated
public Object getJdbcCallOperationsCacheStatistics() {
throw new UnsupportedOperationException("The Google Guava cache isn't supported any more.");
}
/**
* Allows for the retrieval of metrics.
* @return Map containing metrics of the JdbcCallOperationsCache
* @deprecated since 5.2
* @throws UnsupportedOperationException since this functionality isn't supported any more.
*/
@Deprecated
public Map<String, Object> getJdbcCallOperationsCacheStatisticsAsMap() {
throw new UnsupportedOperationException("The Google Guava cache isn't supported any more.");
}
/**
* Defines the maximum number of {@link SimpleJdbcCallOperations}
* A value of zero will disable the cache. The default is 10.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -114,21 +114,6 @@ public class JdbcChannelMessageStore implements PriorityCapableChannelMessageSto
DELETE_MESSAGE
}
/**
* The name of the message header that stores a flag to indicate that the message has been saved. This is an
* optimization for the put method.
* @deprecated since 5.0. This constant isn't used any more.
*/
@Deprecated
public static final String SAVED_KEY = JdbcChannelMessageStore.class.getSimpleName() + ".SAVED";
/**
* The name of the message header that stores a timestamp for the time the message was inserted.
* @deprecated since 5.0. This constant isn't used any more.
*/
@Deprecated
public static final String CREATED_DATE_KEY = JdbcChannelMessageStore.class.getSimpleName() + ".CREATED_DATE";
private final Set<String> idCache = new HashSet<>();
private final ReadWriteLock idCacheLock = new ReentrantReadWriteLock();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,9 +31,6 @@ import java.util.concurrent.atomic.AtomicReference;
import javax.sql.DataSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.core.serializer.Deserializer;
import org.springframework.core.serializer.Serializer;
import org.springframework.core.serializer.support.SerializingConverter;
@@ -79,8 +76,6 @@ import org.springframework.util.StringUtils;
*/
public class JdbcMessageStore extends AbstractMessageGroupStore implements MessageStore {
private static final Log logger = LogFactory.getLog(JdbcMessageStore.class);
/**
* Default value for the table prefix property.
*/
@@ -95,13 +90,15 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
UPDATE_MESSAGE_GROUP("UPDATE %PREFIX%MESSAGE_GROUP set UPDATED_DATE=? where GROUP_KEY=? and REGION=?"),
REMOVE_MESSAGE_FROM_GROUP("DELETE from %PREFIX%GROUP_TO_MESSAGE where GROUP_KEY=? and MESSAGE_ID=? and REGION=?"),
REMOVE_MESSAGE_FROM_GROUP("DELETE from %PREFIX%GROUP_TO_MESSAGE where GROUP_KEY=? and MESSAGE_ID=? and " +
"REGION=?"),
REMOVE_GROUP_TO_MESSAGE_JOIN("DELETE from %PREFIX%GROUP_TO_MESSAGE where GROUP_KEY=? and REGION=?"),
COUNT_ALL_MESSAGES_IN_GROUPS("SELECT COUNT(MESSAGE_ID) from %PREFIX%GROUP_TO_MESSAGE where REGION=?"),
COUNT_ALL_MESSAGES_IN_GROUP("SELECT COUNT(MESSAGE_ID) from %PREFIX%GROUP_TO_MESSAGE where GROUP_KEY=? and REGION=?"),
COUNT_ALL_MESSAGES_IN_GROUP("SELECT COUNT(MESSAGE_ID) from %PREFIX%GROUP_TO_MESSAGE where GROUP_KEY=? and " +
"REGION=?"),
LIST_MESSAGES_BY_GROUP_KEY("SELECT MESSAGE_ID, MESSAGE_BYTES, CREATED_DATE " +
"from %PREFIX%MESSAGE where MESSAGE_ID in " +
@@ -123,7 +120,8 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
GET_GROUP_INFO("SELECT COMPLETE, LAST_RELEASED_SEQUENCE, CREATED_DATE, UPDATED_DATE" +
" from %PREFIX%MESSAGE_GROUP where GROUP_KEY = ? and REGION=?"),
GET_MESSAGE("SELECT MESSAGE_ID, CREATED_DATE, MESSAGE_BYTES from %PREFIX%MESSAGE where MESSAGE_ID=? and REGION=?"),
GET_MESSAGE("SELECT MESSAGE_ID, CREATED_DATE, MESSAGE_BYTES from %PREFIX%MESSAGE where MESSAGE_ID=? and " +
"REGION=?"),
GET_GROUP_CREATED_DATE("SELECT CREATED_DATE from %PREFIX%MESSAGE_GROUP where GROUP_KEY=? and REGION=?"),
@@ -138,7 +136,8 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
COMPLETE_GROUP("UPDATE %PREFIX%MESSAGE_GROUP set UPDATED_DATE=?, COMPLETE=1 where GROUP_KEY=? and REGION=?"),
UPDATE_LAST_RELEASED_SEQUENCE("UPDATE %PREFIX%MESSAGE_GROUP set UPDATED_DATE=?, LAST_RELEASED_SEQUENCE=? where GROUP_KEY=? and REGION=?"),
UPDATE_LAST_RELEASED_SEQUENCE("UPDATE %PREFIX%MESSAGE_GROUP set UPDATED_DATE=?, LAST_RELEASED_SEQUENCE=? where " +
"GROUP_KEY=? and REGION=?"),
DELETE_MESSAGES_FROM_GROUP("DELETE from %PREFIX%MESSAGE where MESSAGE_ID in " +
"(SELECT MESSAGE_ID from %PREFIX%GROUP_TO_MESSAGE where GROUP_KEY = ? and REGION = ?) and REGION = ?"),
@@ -164,36 +163,21 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
}
}
/**
* The name of the message header that stores a flag to indicate that the message has been saved. This is an
* optimization for the put method.
* @deprecated since 5.0. This constant isn't used any more.
*/
@Deprecated
public static final String SAVED_KEY = JdbcMessageStore.class.getSimpleName() + ".SAVED";
/**
* The name of the message header that stores a timestamp for the time the message was inserted.
* @deprecated since 5.0. This constant isn't used any more.
*/
@Deprecated
public static final String CREATED_DATE_KEY = JdbcMessageStore.class.getSimpleName() + ".CREATED_DATE";
private final MessageMapper mapper = new MessageMapper();
private volatile String region = "DEFAULT";
private volatile String tablePrefix = DEFAULT_TABLE_PREFIX;
private final JdbcOperations jdbcTemplate;
private volatile WhiteListDeserializingConverter deserializer;
private final Map<Query, String> queryCache = new HashMap<>();
private volatile SerializingConverter serializer;
private String region = "DEFAULT";
private volatile LobHandler lobHandler = new DefaultLobHandler();
private String tablePrefix = DEFAULT_TABLE_PREFIX;
private volatile Map<Query, String> queryCache = new HashMap<Query, String>();
private WhiteListDeserializingConverter deserializer;
private SerializingConverter serializer;
private LobHandler lobHandler = new DefaultLobHandler();
/**
* Create a {@link MessageStore} with all mandatory properties.
@@ -357,8 +341,9 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
@Override
public void addMessagesToGroup(Object groupId, Message<?>... messages) {
final String groupKey = getKey(groupId);
boolean groupNotExist = this.jdbcTemplate.queryForObject(this.getQuery(Query.GROUP_EXISTS), // NOSONAR query never returns null
Integer.class, groupKey, this.region) < 1;
boolean groupNotExist = this.jdbcTemplate
.queryForObject(this.getQuery(Query.GROUP_EXISTS), // NOSONAR query never returns null
Integer.class, groupKey, this.region) < 1;
final Timestamp updatedDate = new Timestamp(System.currentTimeMillis());
@@ -408,16 +393,18 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
@Override
@ManagedAttribute
public int getMessageCountForAllMessageGroups() {
return this.jdbcTemplate.queryForObject(getQuery(Query.COUNT_ALL_MESSAGES_IN_GROUPS), // NOSONAR query never returns null
Integer.class, this.region);
return this.jdbcTemplate
.queryForObject(getQuery(Query.COUNT_ALL_MESSAGES_IN_GROUPS), // NOSONAR query never returns null
Integer.class, this.region);
}
@Override
@ManagedAttribute
public int messageGroupSize(Object groupId) {
String key = getKey(groupId);
return this.jdbcTemplate.queryForObject(getQuery(Query.COUNT_ALL_MESSAGES_IN_GROUP), // NOSONAR query never returns null
Integer.class, key, this.region);
return this.jdbcTemplate
.queryForObject(getQuery(Query.COUNT_ALL_MESSAGES_IN_GROUP), // NOSONAR query never returns null
Integer.class, key, this.region);
}
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -66,20 +66,4 @@ public class ImapMailInboundChannelAdapterSpec
return this;
}
/**
* How often to recycle the idle task (in case of a silently dropped connection).
* Seconds; default 120 (2 minutes).
* @param interval the interval.
* @return the spec.
* @see ImapMailReceiver#setCancelIdleInterval(long)
* @since 5.0.10
* @deprecated since 5.2: there is no idle task started for polling channel adapter.
*/
@Deprecated
public ImapMailInboundChannelAdapterSpec cancelIdleInterval(long interval) {
assertReceiver();
this.receiver.setCancelIdleInterval(interval);
return this;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2019 the original author or authors.
* Copyright 2016-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,7 +29,9 @@ import org.springframework.util.StringUtils;
/**
* Parser for MongoDb outbound gateways
*
* @author Xavier Padr?
* @author Xavier Padro
* @author Artem Bilan
*
* @since 5.0
*/
public class MongoDbOutboundGatewayParser extends AbstractConsumerEndpointParser {
@@ -50,11 +52,11 @@ public class MongoDbOutboundGatewayParser extends AbstractConsumerEndpointParser
if (StringUtils.hasText(element.getAttribute("query")) ||
StringUtils.hasText(element.getAttribute("query-expression"))) {
parserContext.getReaderContext().error("'collection-callback' is not allowed with " +
"'query' or 'query-expression'", element);
parserContext.getReaderContext()
.error("'collection-callback' is not allowed with 'query' or 'query-expression'", element);
}
builder.addPropertyReference("collectionCallback", collectionCallback);
builder.addPropertyReference("messageCollectionCallback", collectionCallback);
}
else {
BeanDefinition queryExpressionDef =

View File

@@ -19,7 +19,6 @@ package org.springframework.integration.mongodb.outbound;
import org.bson.Document;
import org.springframework.data.mongodb.MongoDbFactory;
import org.springframework.data.mongodb.core.CollectionCallback;
import org.springframework.data.mongodb.core.MongoOperations;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.convert.DefaultDbRefResolver;
@@ -40,7 +39,7 @@ import org.springframework.util.Assert;
/**
* Makes outbound operations to query a MongoDb database using a {@link MongoOperations}
*
* @author Xavier Padr?
* @author Xavier Padro
* @author Artem Bilan
*
* @since 5.0
@@ -92,21 +91,6 @@ public class MongoDbOutboundGateway extends AbstractReplyProducingMessageHandler
this.queryExpression = EXPRESSION_PARSER.parseExpression(queryExpressionString);
}
/**
* Specify a {@link CollectionCallback} to perform against MongoDB collection.
* @param collectionCallback the callback to perform against MongoDB collection.
* @deprecated in favor of {@link #setMessageCollectionCallback(MessageCollectionCallback)}.
* Will be removed in 5.2
*/
@Deprecated
public void setCollectionCallback(CollectionCallback<?> collectionCallback) {
Assert.notNull(collectionCallback, "'collectionCallback' must not be null.");
this.collectionCallback =
collectionCallback instanceof MessageCollectionCallback
? (MessageCollectionCallback) collectionCallback
: (collection, requestMessage) -> collectionCallback.doInCollection(collection);
}
/**
* Specify a {@link MessageCollectionCallback} to perform against MongoDB collection
* in the request message context.
@@ -171,21 +155,21 @@ public class MongoDbOutboundGateway extends AbstractReplyProducingMessageHandler
protected Object handleRequestMessage(Message<?> requestMessage) {
String collectionName =
this.collectionNameExpression.getValue(this.evaluationContext, requestMessage, String.class);
// TODO: 5.2 assert not null
Assert.notNull(collectionName, "'collectionNameExpression' cannot evaluate to null");
Object result;
if (this.collectionCallback != null) {
result = this.mongoTemplate.execute(collectionName, // NOSONAR
result = this.mongoTemplate.execute(collectionName,
collection -> this.collectionCallback.doInCollection(collection, requestMessage));
}
else {
Query query = buildQuery(requestMessage);
if (this.expectSingleResult) {
result = this.mongoTemplate.findOne(query, this.entityClass, collectionName); // NOSONAR
result = this.mongoTemplate.findOne(query, this.entityClass, collectionName);
}
else {
result = this.mongoTemplate.find(query, this.entityClass, collectionName); // NOSONAR
result = this.mongoTemplate.find(query, this.entityClass, collectionName);
}
}

View File

@@ -1,83 +0,0 @@
/*
* Copyright 2016-2019 the original author or authors.
*
* Licensed 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
*
* https://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.springframework.integration.mongodb.support;
import java.util.HashSet;
import java.util.Set;
import org.bson.types.Binary;
import org.springframework.core.convert.TypeDescriptor;
import org.springframework.core.convert.converter.Converter;
import org.springframework.core.convert.converter.GenericConverter;
import org.springframework.core.serializer.support.SerializingConverter;
import org.springframework.data.convert.ReadingConverter;
import org.springframework.data.convert.WritingConverter;
import org.springframework.integration.support.converter.WhiteListDeserializingConverter;
import org.springframework.messaging.Message;
/**
* A {@link GenericConverter} implementation to convert {@link Message} to
* serialized {@link byte[]} to store {@link Message} to the MongoDB.
* And vice versa - to convert {@link byte[]} from the MongoDB to the {@link Message}.
* @author Artem Bilan
* @author Gary Russell
* @since 4.2.10
* @deprecated since 5.0 in favor of {@link MessageToBinaryConverter} and {@link BinaryToMessageConverter}
*/
@WritingConverter
@ReadingConverter
@Deprecated
public class MongoDbMessageBytesConverter implements GenericConverter {
private final Converter<Object, byte[]> serializingConverter = new SerializingConverter();
private final WhiteListDeserializingConverter deserializingConverter = new WhiteListDeserializingConverter();
@Override
public Set<ConvertiblePair> getConvertibleTypes() {
Set<ConvertiblePair> convertiblePairs = new HashSet<>();
convertiblePairs.add(new ConvertiblePair(Message.class, Binary.class));
convertiblePairs.add(new ConvertiblePair(Binary.class, Message.class));
return convertiblePairs;
}
@Override
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
if (source == null) {
return null;
}
if (Message.class.isAssignableFrom(sourceType.getObjectType())) {
return new Binary(this.serializingConverter.convert(source));
}
else {
return this.deserializingConverter.convert(((Binary) source).getData());
}
}
/**
* Add patterns for packages/classes that are allowed to be deserialized. A class can
* be fully qualified or a wildcard '*' is allowed at the beginning or end of the
* class name. Examples: {@code com.foo.*}, {@code *.MyClass}.
* @param patterns the patterns.
*/
public void addWhiteListPatterns(String... patterns) {
this.deserializingConverter.addWhiteListPatterns(patterns);
}
}

View File

@@ -251,8 +251,6 @@
<xsd:appinfo>
<xsd:documentation>
Reference to an instance of
org.springframework.data.mongodb.core.CollectionCallback, preferable an
instance of
org.springframework.integration.mongodb.outbound.MessageCollectionCallback
with the request message context.
</xsd:documentation>

View File

@@ -58,7 +58,7 @@
<bean id="mockCollectionCallback" class="org.mockito.Mockito" factory-method="mock">
<constructor-arg value="org.springframework.data.mongodb.core.CollectionCallback"/>
<constructor-arg value="org.springframework.integration.mongodb.outbound.MessageCollectionCallback"/>
</bean>
<bean id="mongoDbFactory" class="org.mockito.Mockito" factory-method="mock">

View File

@@ -17,11 +17,11 @@
package org.springframework.integration.mongodb.config;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
@@ -39,17 +39,15 @@ import org.springframework.integration.mongodb.outbound.MongoDbOutboundGateway;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.messaging.MessageHandler;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
/**
* @author Xavier Padr?
* @author Xavier Padro
* @author Artem Bilan
*
* @since 5.0
*/
@ContextConfiguration
@RunWith(SpringRunner.class)
@SpringJUnitConfig
@DirtiesContext
public class MongoDbOutboundGatewayParserTests {
@@ -139,22 +137,28 @@ public class MongoDbOutboundGatewayParserTests {
.isInstanceOf(MessageCollectionCallback.class);
}
@Test(expected = BeanDefinitionParsingException.class)
@Test
public void templateAndFactoryFail() {
new ClassPathXmlApplicationContext("outbound-gateway-fail-template-factory-config.xml", this.getClass())
.close();
assertThatExceptionOfType(BeanDefinitionParsingException.class)
.isThrownBy(() ->
new ClassPathXmlApplicationContext("outbound-gateway-fail-template-factory-config.xml",
getClass()));
}
@Test(expected = BeanDefinitionParsingException.class)
@Test
public void templateAndConverterFail() {
new ClassPathXmlApplicationContext("outbound-gateway-fail-template-converter-config.xml",
this.getClass()).close();
assertThatExceptionOfType(BeanDefinitionParsingException.class)
.isThrownBy(() ->
new ClassPathXmlApplicationContext("outbound-gateway-fail-template-converter-config.xml",
this.getClass()));
}
@Test(expected = BeanDefinitionParsingException.class)
@Test
public void collectionCallbackAndQueryFail() {
new ClassPathXmlApplicationContext("outbound-gateway-fail-collection-callback-config.xml",
this.getClass()).close();
assertThatExceptionOfType(BeanDefinitionParsingException.class)
.isThrownBy(() ->
new ClassPathXmlApplicationContext("outbound-gateway-fail-collection-callback-config.xml",
this.getClass()));
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,11 +16,6 @@
package org.springframework.integration.mqtt.core;
import java.util.Arrays;
import java.util.Properties;
import javax.net.SocketFactory;
import org.eclipse.paho.client.mqttv3.IMqttAsyncClient;
import org.eclipse.paho.client.mqttv3.IMqttClient;
import org.eclipse.paho.client.mqttv3.MqttAsyncClient;
@@ -36,6 +31,7 @@ import org.springframework.util.Assert;
*
* @author Gary Russell
* @author Gunnar Hillert
*
* @since 4.0
*
*/
@@ -47,87 +43,6 @@ public class DefaultMqttPahoClientFactory implements MqttPahoClientFactory {
private ConsumerStopAction consumerStopAction = ConsumerStopAction.UNSUBSCRIBE_CLEAN;
/**
* Set the cleanSession.
* @param cleanSession the cleanSession to set.
* @deprecated use {@link #setConnectionOptions(MqttConnectOptions)} instead.
*/
@Deprecated
public void setCleanSession(Boolean cleanSession) {
this.options.setCleanSession(cleanSession);
}
/**
* Set the connectionTimeout.
* @param connectionTimeout the connectionTimeout to set.
* @deprecated use {@link #setConnectionOptions(MqttConnectOptions)} instead.
*/
@Deprecated
public void setConnectionTimeout(Integer connectionTimeout) {
this.options.setConnectionTimeout(connectionTimeout);
}
/**
* Set the keepAliveInterval.
* @param keepAliveInterval the keepAliveInterval to set.
* @deprecated use {@link #setConnectionOptions(MqttConnectOptions)} instead.
*/
@Deprecated
public void setKeepAliveInterval(Integer keepAliveInterval) {
this.options.setKeepAliveInterval(keepAliveInterval);
}
/**
* Set the password.
* @param password the password to set.
* @deprecated use {@link #setConnectionOptions(MqttConnectOptions)} instead.
*/
@Deprecated
public void setPassword(String password) {
this.options.setPassword(password.toCharArray());
}
/**
* Set the socketFactory.
* @param socketFactory the socketFactory to set.
* @deprecated use {@link #setConnectionOptions(MqttConnectOptions)} instead.
*/
@Deprecated
public void setSocketFactory(SocketFactory socketFactory) {
this.options.setSocketFactory(socketFactory);
}
/**
* Set the sslProperties.
* @param sslProperties the sslProperties to set.
* @deprecated use {@link #setConnectionOptions(MqttConnectOptions)} instead.
*/
@Deprecated
public void setSslProperties(Properties sslProperties) {
this.options.setSSLProperties(sslProperties);
}
/**
* Set the userName.
* @param userName the userName to set.
* @deprecated use {@link #setConnectionOptions(MqttConnectOptions)} instead.
*/
@Deprecated
public void setUserName(String userName) {
this.options.setUserName(userName);
}
/**
* Will be used to set the "Last Will and Testament" (LWT) for the connection.
* @param will The will.
* @see MqttConnectOptions#setWill
* @deprecated use {@link #setConnectionOptions(MqttConnectOptions)} instead.
*/
@Deprecated
public void setWill(Will will) {
this.options.setWill(will.getTopic(), will.getPayload(), will.getQos(), will.isRetained());
}
/**
* Set the persistence to pass into the client constructor.
* @param persistence the persistence to set.
@@ -136,19 +51,6 @@ public class DefaultMqttPahoClientFactory implements MqttPahoClientFactory {
this.persistence = persistence;
}
/**
* Use this when using multiple server instances, for example when using HA.
* @param serverURIs The URIs.
* @see MqttConnectOptions#setServerURIs(String[])
* @since 4.1
* @deprecated use {@link #setConnectionOptions(MqttConnectOptions)} instead.
*/
@Deprecated
public void setServerURIs(String... serverURIs) {
Assert.notNull(serverURIs, "'serverURIs' must not be null.");
this.options.setServerURIs(Arrays.copyOf(serverURIs, serverURIs.length));
}
/**
* Get the consumer stop action.
* @return the consumer stop action.

View File

@@ -1,88 +0,0 @@
/*
* Copyright 2018-2019 the original author or authors.
*
* Licensed 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
*
* https://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.springframework.integration.redis.util;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import org.springframework.data.redis.core.RedisCallback;
import org.springframework.data.redis.core.RedisOperations;
import org.springframework.util.StringUtils;
/**
* A set of utility methods for common Redis functions.
*
* @author Artem Bilan
* @author Gary Russell
*
* @since 5.1
*/
public final class RedisUtils {
private static final String SECTION = "server";
private static final String VERSION_PROPERTY = "redis_version";
@SuppressWarnings("serial")
private static final Map<RedisOperations<?, ?>, Boolean> unlinkAvailable =
Collections.synchronizedMap(new LinkedHashMap<RedisOperations<?, ?>, Boolean>() {
@Override
protected boolean removeEldestEntry(Entry<RedisOperations<?, ?>, Boolean> eldest) {
return size() > 100;
}
});
/**
* Perform an {@code INFO} command on the provided {@link RedisOperations} to check
* the Redis server version to be sure that {@code UNLINK} is available or not.
* @param redisOperations the {@link RedisOperations} to perform {@code INFO} command.
* @return true or false if {@code UNLINK} Redis command is available or not.
* @throws IllegalStateException when {@code INFO} returns null from the Redis.
* @deprecated since 5.1.8 in favor of explicit trials in the target code.
* The INFO command might not be available on the server, but UNLINK might.
* Will be removed in version 5.3.
*/
@Deprecated
public static boolean isUnlinkAvailable(RedisOperations<?, ?> redisOperations) {
return unlinkAvailable.computeIfAbsent(redisOperations, key -> {
Properties info = redisOperations.execute(
(RedisCallback<Properties>) connection -> connection.serverCommands().info(SECTION));
if (info != null) {
String version = info.getProperty(VERSION_PROPERTY);
if (StringUtils.hasText(version)) {
int majorVersion = Integer.parseInt(version.split("\\.")[0]);
return majorVersion >= 4;
}
else {
return false;
}
}
else {
throw new IllegalStateException("The INFO command cannot be used in pipeline/transaction.");
}
});
}
private RedisUtils() {
}
}

View File

@@ -29,7 +29,7 @@
</int:channel>
<bean id="port" class="java.lang.Integer">
<constructor-arg value="#{T(org.springframework.integration.test.util.SocketUtils).findAvailableServerSocket()}" />
<constructor-arg value="#{T(org.springframework.util.SocketUtils).findAvailableTcpPort()}" />
</bean>
<!-- Bad -->

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2019 the original author or authors.
* Copyright 2019-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -58,18 +58,6 @@ public class RSocketOutboundGatewaySpec extends MessageHandlerSpec<RSocketOutbou
return this;
}
/**
* Configure an {@link RSocketOutboundGateway.Command} for the RSocket request type.
* @param command the {@link RSocketOutboundGateway.Command} to use.
* @return the spec
* @see RSocketOutboundGateway#setCommand(RSocketOutboundGateway.Command)
* @deprecated in favor of {@link #interactionModel(RSocketInteractionModel)}
*/
@Deprecated
public RSocketOutboundGatewaySpec command(RSocketOutboundGateway.Command command) {
return interactionModel(new ValueExpression<>(command));
}
/**
* Configure an {@link RSocketInteractionModel} for the RSocket request type.
* @param interactionModel the {@link RSocketInteractionModel} to use.
@@ -81,20 +69,6 @@ public class RSocketOutboundGatewaySpec extends MessageHandlerSpec<RSocketOutbou
return interactionModel(new ValueExpression<>(interactionModel));
}
/**
* Configure a {@link Function} to evaluate an {@link RSocketOutboundGateway.Command}
* for the RSocket request type at runtime against a request message.
* @param commandFunction the {@code Function} to use.
* @param <P> the expected request message payload type.
* @return the spec
* @see RSocketOutboundGateway#setInteractionModelExpression(Expression)
* @deprecated in favor of {@link #interactionModel(Function)}
*/
@Deprecated
public <P> RSocketOutboundGatewaySpec command(Function<Message<P>, ?> commandFunction) {
return interactionModel(commandFunction);
}
/**
* Configure a {@link Function} to evaluate an {@link RSocketInteractionModel}
* for the RSocket request type at runtime against a request message.
@@ -108,19 +82,6 @@ public class RSocketOutboundGatewaySpec extends MessageHandlerSpec<RSocketOutbou
return interactionModel(new FunctionExpression<>(interactionModelFunction));
}
/**
* Configure a SpEL expression to evaluate an {@link RSocketOutboundGateway.Command}
* for the RSocket request type at runtime against a request message.
* @param commandExpression the SpEL expression to use.
* @return the spec
* @see RSocketOutboundGateway#setInteractionModelExpression(Expression)
* @deprecated in favor of {@link #interactionModel(String)}
*/
@Deprecated
public RSocketOutboundGatewaySpec command(String commandExpression) {
return interactionModel(commandExpression);
}
/**
* Configure a SpEL expression to evaluate an {@link RSocketInteractionModel}
* for the RSocket request type at runtime against a request message.
@@ -133,19 +94,6 @@ public class RSocketOutboundGatewaySpec extends MessageHandlerSpec<RSocketOutbou
return interactionModel(PARSER.parseExpression(interactionModelExpression));
}
/**
* Configure a SpEL expression to evaluate an {@link RSocketOutboundGateway.Command}
* for the RSocket request type at runtime against a request message.
* @param commandExpression the SpEL expression to use.
* @return the spec
* @see RSocketOutboundGateway#setInteractionModelExpression(Expression)
* @deprecated in favor of {@link #interactionModel(Expression)}
*/
@Deprecated
public RSocketOutboundGatewaySpec command(Expression commandExpression) {
return interactionModel(commandExpression);
}
/**
* Configure a SpEL expression to evaluate an {@link RSocketInteractionModel}
* for the RSocket request type at runtime against a request message.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2019 the original author or authors.
* Copyright 2019-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -130,16 +130,6 @@ public class RSocketOutboundGateway extends AbstractReplyProducingMessageHandler
this.clientRSocketConnector = clientRSocketConnector;
}
/**
* Configure a {@link Command} for the RSocket request type.
* @param command the {@link Command} to use.
* @deprecated in favor of {@link #setInteractionModel(RSocketInteractionModel)}
*/
@Deprecated
public void setCommand(Command command) {
setInteractionModelExpression(new ValueExpression<>(command.interactionModel));
}
/**
* Configure an {@link RSocketInteractionModel} for the RSocket request type.
* @param interactionModel the {@link RSocketInteractionModel} to use.
@@ -149,17 +139,6 @@ public class RSocketOutboundGateway extends AbstractReplyProducingMessageHandler
setInteractionModelExpression(new ValueExpression<>(interactionModel));
}
/**
* Configure a SpEL expression to evaluate a {@link Command} for the RSocket request type at runtime
* against a request message.
* @param commandExpression the SpEL expression to use.
* @deprecated in favor of {@link #setInteractionModelExpression(Expression)}
*/
@Deprecated
public void setCommandExpression(Expression commandExpression) {
setInteractionModelExpression(commandExpression);
}
/**
* Configure a SpEL expression to evaluate an {@link RSocketInteractionModel}
* for the RSocket request type at runtime against a request message.
@@ -337,9 +316,6 @@ public class RSocketOutboundGateway extends AbstractReplyProducingMessageHandler
if (value instanceof RSocketInteractionModel) {
return (RSocketInteractionModel) value;
}
else if (value instanceof Command) {
return ((Command) value).interactionModel;
}
else if (value instanceof String) {
return RSocketInteractionModel.valueOf((String) value);
}
@@ -372,39 +348,4 @@ public class RSocketOutboundGateway extends AbstractReplyProducingMessageHandler
}
}
/**
* Enumeration of commands supported by the gateways.
* @deprecated in favor of {@link RSocketInteractionModel}
*/
@Deprecated
public enum Command {
/**
* Perform {@link io.rsocket.RSocket#fireAndForget fireAndForget}.
* @see RSocketRequester.RequestSpec#send()
*/
fireAndForget(RSocketInteractionModel.fireAndForget),
/**
* Perform {@link io.rsocket.RSocket#requestResponse requestResponse}.
* @see RSocketRequester.RequestSpec#retrieveMono
*/
requestResponse(RSocketInteractionModel.requestResponse),
/**
* Perform {@link io.rsocket.RSocket#requestStream requestStream} or
* {@link io.rsocket.RSocket#requestChannel requestChannel} depending on whether
* the request input consists of a single or multiple payloads.
* @see RSocketRequester.RequestSpec#retrieveFlux
*/
requestStreamOrChannel(RSocketInteractionModel.requestStream);
private final RSocketInteractionModel interactionModel;
Command(RSocketInteractionModel interactionModel) {
this.interactionModel = interactionModel;
}
}
}

View File

@@ -9,9 +9,9 @@
http://www.springframework.org/schema/integration https://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="socketUtils" class="org.springframework.integration.test.util.SocketUtils" />
<bean id="socketUtils" class="org.springframework.util.SocketUtils" />
<int-syslog:inbound-channel-adapter id="foo" port="#{socketUtils.findAvailableUdpSocket(1514)}" />
<int-syslog:inbound-channel-adapter id="foo" port="#{socketUtils.findAvailableUdpPort(1514)}" />
<int-syslog:inbound-channel-adapter id="foobar" channel="foo" port="1514" auto-startup="false" />
@@ -23,7 +23,7 @@
<int:queue/>
</int:channel>
<int-syslog:inbound-channel-adapter id="explicitUdp" protocol="udp" port="1514" auto-startup="false" />
<int-syslog:inbound-channel-adapter id="explicitUdp" port="1514" auto-startup="false" />
<int:channel id="explicitUdp">
<int:queue/>
@@ -42,7 +42,7 @@
<bean id="converter"
class="org.springframework.integration.syslog.config.SyslogReceivingChannelAdapterParserTests$PassThruConverter" />
<int-syslog:inbound-channel-adapter id="bar" protocol="tcp" port="#{socketUtils.findAvailableServerSocket(1514)}" />
<int-syslog:inbound-channel-adapter id="bar" protocol="tcp" port="#{socketUtils.findAvailableTcpPort(1514)}" />
<int:channel id="bar">
<int:queue/>
@@ -58,10 +58,10 @@
send-timeout="456"
error-channel="errors" />
<int-ip:tcp-connection-factory id="cf"
<int-ip:tcp-connection-factory id="cf"
using-nio="true"
type="server"
port="1514"
port="1514"
deserializer="rfc6587" />
<bean id="rfc5424" class="org.springframework.integration.syslog.RFC5424MessageConverter" />

View File

@@ -1,93 +0,0 @@
/*
* Copyright 2013-2019 the original author or authors.
*
* Licensed 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
*
* https://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.springframework.integration.test.matcher;
import org.hamcrest.Description;
import org.hamcrest.DiagnosingMatcher;
import org.hamcrest.Matcher;
/**
* A matcher that will evaluate another matcher repeatedly until it matches, or fail after some number of attempts.
*
* @param <U> the type the wrapped matcher operates on
*
* @author Eric Bottard
* @author Artem Bilan
*
* @since 4.2
*
* @deprecated since 5.2 in favor of <a href="https://github.com/awaitility/awaitility">Awaitility</a>
*/
@Deprecated
public class EventuallyMatcher<U> extends DiagnosingMatcher<U> {
private final Matcher<U> delegate;
private int nbAttempts;
private int pause;
public EventuallyMatcher(Matcher<U> delegate) {
this(delegate, 20, 100);
}
public EventuallyMatcher(Matcher<U> delegate, int nbAttempts, int pause) {
this.delegate = delegate;
this.nbAttempts = nbAttempts;
this.pause = pause;
}
public static <U> Matcher<U> eventually(int nbAttempts, int pause, Matcher<U> delegate) {
return new EventuallyMatcher<>(delegate, nbAttempts, pause);
}
public static <U> Matcher<U> eventually(Matcher<U> delegate) {
return new EventuallyMatcher<>(delegate);
}
@Override
public void describeTo(Description description) {
description.appendDescriptionOf(this.delegate)
.appendText(String.format(", trying at most %d times", this.nbAttempts));
}
@Override
protected boolean matches(Object item, Description mismatchDescription) {
mismatchDescription.appendText(
String.format("failed after %d*%d=%dms:%n", this.nbAttempts, this.pause,
this.nbAttempts * this.pause));
for (int i = 0; i < this.nbAttempts; i++) {
boolean result = this.delegate.matches(item);
if (result) {
return true;
}
this.delegate.describeMismatch(item, mismatchDescription);
mismatchDescription.appendText(", ");
try {
Thread.sleep(this.pause);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
break;
}
}
return false;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -92,48 +92,8 @@ public final class MapContentMatchers<T, V> extends TypeSafeMatcher<Map<? super
}
/**
* Create {@link Matcher} for map entry.
* @param key the key to check.
* @param value the value to check.
* @param <K> the key type.
* @param <V> the value type.
* @return the {@link Matcher} for map entry.
* @deprecated since 5.2 in favor of {@link Matchers#hasEntry(Object, Object)}.
*/
@Deprecated
public static <K, V> Matcher<Map<? extends K, ? extends V>> hasEntry(K key, V value) {
return Matchers.hasEntry(key, value);
}
/**
* Create {@link Matcher} for map entry.
* @param key the key to check.
* @param valueMatcher the {@link Matcher} for value.
* @param <T> the key type.
* @param <V> the value type.
* @return the {@link Matcher} for map entry.
* @deprecated since 5.2 in favor of {@link Matchers#hasEntry(Matcher, Matcher)}.
*/
@Deprecated
public static <T, V> Matcher<Map<? extends T, ? extends V>> hasEntry(T key, Matcher<V> valueMatcher) {
return Matchers.hasEntry(Matchers.is(key), valueMatcher);
}
/**
* Create {@link Matcher} for map key.
* @param key the key to check.
* @param <T> the key type.
* @return {@link Matcher} for map key.
* @deprecated since 5.2 in favor of {@link Matchers#hasKey}.
*/
@Deprecated
public static <T> Matcher<Map<? extends T, ?>> hasKey(T key) {
return Matchers.hasKey(key);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
public static <T, V> Matcher<Map<? extends T, ? extends V>> hasAllEntries(Map<T, V> entries) {
@SuppressWarnings("unchecked")
public static <T, V> Matcher<Map<T, V>> hasAllEntries(Map<T, V> entries) {
List<Matcher<? super Map<T, V>>> matchers = new ArrayList<>(entries.size());
for (Map.Entry<T, V> entry : entries.entrySet()) {
final V value = entry.getValue();
@@ -144,8 +104,7 @@ public final class MapContentMatchers<T, V> extends TypeSafeMatcher<Map<? super
matchers.add(Matchers.hasEntry(entry.getKey(), value));
}
}
//return AllOf.allOf(matchers); //Does not work with Hamcrest 1.3
return new AllOf(matchers);
return AllOf.allOf(matchers);
}
}

View File

@@ -1,210 +0,0 @@
/*
* Copyright 2002-2019 the original author or authors.
*
* Licensed 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
*
* https://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.springframework.integration.test.util;
import java.io.IOException;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import javax.net.ServerSocketFactory;
import org.springframework.util.Assert;
/**
* Contains several socket-specific utility methods. For example, you may have test cases
* that require an open port. Rather than hard-coding the relevant port, it will be better
* to use methods from this utility class to automatically select an open port, therefore
* improving the portability of your test-cases across systems.
*
* @deprecated - it's generally better to set the server port to 0; let the operating
* system choose a port; wait until the server starts (see TestingUtilities in the ip
* module for an example), then set the port on the client factory.
*
* @author Gunnar Hillert
* @author Gary Russell
* @since 2.2
*/
@Deprecated
public final class SocketUtils {
public static final int DEFAULT_PORT_RANGE_MIN = 10000;
public static final int DEFAULT_PORT_RANGE_MAX = 60000;
/**
* The constructor is intentionally public. In several test cases you may have
* the need to use the methods of this class multiple times from within your
* Spring Application Context XML file using SpEL. Of course you can do:
* <pre class="code">
* {@code
* ...port="#{T(org.springframework.integration.test.util.SocketUtils).findAvailableServerSocket(12000)}"
* }
* </pre>
* But unfortunately, you would need to repeat the package for each usage.
* This will be acceptable for single use, but if you need to invoke the
* methods numerous time, you may instead want to do this:
* <pre class="code">
* {@code
* <bean id="tcpIpUtils" class="org.springframework.integration.test.util.SocketUtils" />
*
* ...port="#{tcpIpUtils.findAvailableServerSocket(12000)}"
* }
* </pre>
*/
private SocketUtils() {
}
/**
* Determines a free available server socket (port) using the 'seed' value as
* the starting port. The utility methods will probe for 200 sockets but will
* return as soon an open port is found.
* @param seed The starting port, which must not be negative.
* @return An available port number
* @throws IllegalStateException when no open port was found.
*/
public static int findAvailableServerSocket(int seed) {
final List<Integer> openPorts = findAvailableServerSockets(seed, 1);
return openPorts.get(0);
}
/**
* Determines a free available server socket (port) using the 'seed' value as
* the starting port. The utility methods will probe for 200 sockets but will
* return as soon an open port is found.
* @param seed The starting port, which must not be negative.
* @param numberOfRequestedPorts How many open ports shall be retrieved?
* @return A list containing the requested number of open ports
* @throws IllegalStateException when no open port was found.
*/
public static List<Integer> findAvailableServerSockets(int seed, int numberOfRequestedPorts) {
Assert.isTrue(seed >= 0, "'seed' must not be negative");
Assert.isTrue(numberOfRequestedPorts > 0, "'numberOfRequestedPorts' must not be negative");
final List<Integer> openPorts = new ArrayList<Integer>(numberOfRequestedPorts);
for (int i = seed; i < seed + 200; i = i == 0 ? i : i + 1) {
try {
ServerSocket sock = ServerSocketFactory.getDefault()
.createServerSocket(i, 1, InetAddress.getByName("localhost"));
sock.close();
openPorts.add(i == 0 ? sock.getLocalPort() : i);
if (openPorts.size() == numberOfRequestedPorts) {
return openPorts;
}
}
catch (@SuppressWarnings("unused") IOException e) {
// empty
}
}
throw new IllegalStateException(String.format("Cannot find a free server socket (%s requested)",
numberOfRequestedPorts));
}
/**
* Determines a free available server socket (port) using an automatically
* chosen start seed port.
* @return An available port number
* @throws IllegalStateException when no open port was found.
*/
public static int findAvailableServerSocket() {
int seed = getRandomSeedPort();
return findAvailableServerSocket(seed);
}
/**
* Determines a free available Udp socket (port) using the 'seed' value as
* the starting port. The utility methods will probe for 200 sockets but will
* return as soon an open port is found.
* @param seed The starting port, which must not be negative.
* @return An available port number
* @throws IllegalStateException when no open port was found.
*/
public static int findAvailableUdpSocket(int seed) {
final List<Integer> openPorts = findAvailableUdpSockets(seed, 1);
return openPorts.get(0);
}
/**
* Determines free available udp socket(s) (port) using the 'seed' value as
* the starting port. The utility methods will probe for 200 sockets but will
* return as soon an open port is found.
* @param seed The starting port, which must not be negative.
* @param numberOfRequestedPorts How many open ports shall be retrieved?
* @return A list containing the requested number of open ports
* @throws IllegalStateException when no open port was found.
*/
public static List<Integer> findAvailableUdpSockets(int seed, int numberOfRequestedPorts) {
Assert.isTrue(seed >= 0, "'seed' must not be negative");
Assert.isTrue(numberOfRequestedPorts > 0, "'numberOfRequestedPorts' must not be negative");
final List<Integer> openPorts = new ArrayList<Integer>(numberOfRequestedPorts);
for (int i = seed; i < seed + 200; i++) {
try {
DatagramSocket sock = new DatagramSocket(i, InetAddress.getByName("localhost"));
sock.close();
Thread.sleep(100);
openPorts.add(i);
if (openPorts.size() == numberOfRequestedPorts) {
return openPorts;
}
}
catch (@SuppressWarnings("unused") IOException e) {
// empty
}
catch (@SuppressWarnings("unused") InterruptedException e) {
Thread.currentThread().interrupt();
}
}
throw new IllegalStateException(String.format("Cannot find a free server socket (%s requested)",
numberOfRequestedPorts));
}
/**
* Determines a free available Udp socket using an automatically
* chosen start seed port.
* @return An available port number
* @throws IllegalStateException when no open port was found.
*/
public static int findAvailableUdpSocket() {
int seed = getRandomSeedPort();
return findAvailableUdpSocket(seed);
}
/**
* Determines a random seed port number within the port range
* {@value #DEFAULT_PORT_RANGE_MIN} and {@value #DEFAULT_PORT_RANGE_MAX}.
* @return A number with the the specified range
*/
public static int getRandomSeedPort() {
return new Random().nextInt(DEFAULT_PORT_RANGE_MAX - DEFAULT_PORT_RANGE_MIN + 1) + DEFAULT_PORT_RANGE_MIN;
}
}

View File

@@ -968,7 +968,7 @@ public class MyFlowAdapter extends IntegrationFlowAdapter {
@Override
protected IntegrationFlowDefinition<?> buildFlow() {
return from(this, "messageSource",
return from(this::messageSource,
e -> e.poller(p -> p.trigger(this::nextExecutionTime)))
.split(this)
.transform(this)
@@ -1174,7 +1174,7 @@ By default a `GatewayProxyFactoryBean` gets a conventional bean name, such as `[
You can change that ID by using the `@MessagingGateway.name()` attribute or the overloaded `IntegrationFlows.from(Class<?> serviceInterface, Consumer<GatewayProxySpec> endpointConfigurer)` factory method.
Also all the attributes from the `@MessagingGateway` annotation on the interface are applied to the target `GatewayProxyFactoryBean`.
When annotation configuration is not applicable, the `Consumer<GatewayProxySpec>` variant can be used for providing appropriate option for the target proxy.
This DSL method is available starting with version 5.2; the method `IntegrationFlows.from(Class<?> serviceInterface, String beanName)` is deprecated in favor of `GatewayProxySpec.beanName()` option.
This DSL method is available starting with version 5.2.
With Java 8, you can even create an integration gateway with the `java.util.function` interfaces, as the following example shows:

View File

@@ -70,16 +70,16 @@ See the https://docs.spring.io/spring-integration/api/org/springframework/integr
==== Using the `SocketUtils` Class
The https://docs.spring.io/spring-integration/api/org/springframework/integration/test/util/SocketUtils.html[`SocketUtils` class] provides several methods that select one or more random ports for exposing server-side components without conflicts, as the following example shows:
The https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/util/SocketUtils.html[`SocketUtils` class] provides several methods that select one or more random ports for exposing server-side components without conflicts, as the following example shows:
====
[source,xml]
----
<bean id="socketUtils" class="org.springframework.integration.test.util.SocketUtils" />
<bean id="socketUtils" class="org.springframework.util.SocketUtils" />
<int-syslog:inbound-channel-adapter id="syslog"
channel="sysLogs"
port="#{socketUtils.findAvailableUdpSocket(1514)}" />
port="#{socketUtils.findAvailableUdpPort(1514)}" />
<int:channel id="sysLogs">
<int:queue/>

View File

@@ -359,14 +359,10 @@ To avoid unexpected issues with JSON mapping features when you use annotations,
[source,java]
----
@org.codehaus.jackson.annotate.JsonIgnoreProperties(ignoreUnknown=true)
@com.fasterxml.jackson.annotation.JsonIgnoreProperties(ignoreUnknown=true)
@org.boon.json.annotations.JsonIgnoreProperties("thing1")
public class Thing1 {
@org.codehaus.jackson.annotate.JsonProperty("thing1Thing2")
@com.fasterxml.jackson.annotation.JsonProperty("thing1Thing2")
@org.boon.json.annotations.JsonProperty("thing1Thing2")
public Object thing2;
}