INT-4221: Properly use Spring's Assert class
JIRA: https://jira.spring.io/browse/INT-4221 * Upgrade to those versions of Spring project dependencies which potentially will provide similar fix **Cherry-pick to 4.3.x**
This commit is contained in:
10
build.gradle
10
build.gradle
@@ -131,13 +131,13 @@ subprojects { subproject ->
|
||||
slf4jVersion = "1.7.21"
|
||||
smackVersion = '4.1.7'
|
||||
springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '2.0.0.BUILD-SNAPSHOT'
|
||||
springDataJpaVersion = '2.0.0.M1'
|
||||
springDataMongoVersion = '2.0.0.M1'
|
||||
springDataRedisVersion = '2.0.0.M1'
|
||||
springDataJpaVersion = '2.0.0.BUILD-SNAPSHOT'
|
||||
springDataMongoVersion = '2.0.0.BUILD-SNAPSHOT'
|
||||
springDataRedisVersion = '2.0.0.BUILD-SNAPSHOT'
|
||||
springGemfireVersion = '2.0.0.BUILD-SNAPSHOT'
|
||||
springSecurityVersion = '4.2.0.RELEASE'
|
||||
springSecurityVersion = '4.2.2.BUILD-SNAPSHOT'
|
||||
springSocialTwitterVersion = '2.0.0.M1'
|
||||
springRetryVersion = '1.2.0.RC1'
|
||||
springRetryVersion = '1.2.0.RELEASE'
|
||||
springVersion = project.hasProperty('springVersion') ? project.springVersion : '5.0.0.BUILD-SNAPSHOT'
|
||||
springWsVersion = '2.4.0.RELEASE'
|
||||
tomcatVersion = "8.5.9"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 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.
|
||||
@@ -61,8 +61,8 @@ public class BrokerRunning extends TestWatcher {
|
||||
* @return a new rule that assumes an existing running broker
|
||||
*/
|
||||
public static BrokerRunning isRunningWithEmptyQueues(Queue... queues) {
|
||||
Assert.notNull(queues);
|
||||
Assert.noNullElements(queues);
|
||||
Assert.notNull(queues, "'queues' must not be null");
|
||||
Assert.noNullElements(queues, "'queues' must not contain null elements");
|
||||
return new BrokerRunning(queues);
|
||||
}
|
||||
|
||||
@@ -72,8 +72,8 @@ public class BrokerRunning extends TestWatcher {
|
||||
* @return a new rule that assumes an existing running broker
|
||||
*/
|
||||
public static BrokerRunning isRunningWithEmptyQueues(String... queues) {
|
||||
Assert.notNull(queues);
|
||||
Assert.noNullElements(queues);
|
||||
Assert.notNull(queues, "'queues' must not be null");
|
||||
Assert.noNullElements(queues, "'queues' must not contain null elements");
|
||||
return new BrokerRunning(queues);
|
||||
}
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ public abstract class AbstractCorrelatingMessageHandler extends AbstractMessageP
|
||||
|
||||
public void setLockRegistry(LockRegistry lockRegistry) {
|
||||
Assert.isTrue(!this.lockRegistrySet, "'this.lockRegistry' can not be reset once its been set");
|
||||
Assert.notNull("'lockRegistry' must not be null");
|
||||
Assert.notNull(lockRegistry, "'lockRegistry' must not be null");
|
||||
this.lockRegistry = lockRegistry;
|
||||
this.lockRegistrySet = true;
|
||||
}
|
||||
@@ -170,12 +170,12 @@ public abstract class AbstractCorrelatingMessageHandler extends AbstractMessageP
|
||||
}
|
||||
|
||||
public void setCorrelationStrategy(CorrelationStrategy correlationStrategy) {
|
||||
Assert.notNull(correlationStrategy);
|
||||
Assert.notNull(correlationStrategy, "'correlationStrategy' must not be null");
|
||||
this.correlationStrategy = correlationStrategy;
|
||||
}
|
||||
|
||||
public void setReleaseStrategy(ReleaseStrategy releaseStrategy) {
|
||||
Assert.notNull(releaseStrategy);
|
||||
Assert.notNull(releaseStrategy, "'releaseStrategy' must not be null");
|
||||
this.releaseStrategy = releaseStrategy;
|
||||
this.sequenceAware = this.releaseStrategy instanceof SequenceSizeReleaseStrategy;
|
||||
this.releaseStrategySet = true;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 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.
|
||||
@@ -48,7 +48,7 @@ class IdempotentReceiverAutoProxyCreator extends AbstractAutoProxyCreator {
|
||||
private volatile Map<String, List<String>> idempotentEndpoints; // double check locking requires volatile
|
||||
|
||||
public void setIdempotentEndpointsMapping(List<Map<String, String>> idempotentEndpointsMapping) {
|
||||
Assert.notEmpty(idempotentEndpointsMapping);
|
||||
Assert.notEmpty(idempotentEndpointsMapping, "'idempotentEndpointsMapping' must not be empty");
|
||||
this.idempotentEndpointsMapping = idempotentEndpointsMapping; //NOSONAR (inconsistent sync)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -97,7 +97,7 @@ public class AbstractRouterSpec<S extends AbstractRouterSpec<S, R>, R extends Ab
|
||||
* @since 1.2
|
||||
*/
|
||||
public S defaultSubFlowMapping(IntegrationFlow subFlow) {
|
||||
Assert.notNull(subFlow);
|
||||
Assert.notNull(subFlow, "'subFlow' must not be null");
|
||||
DirectChannel channel = new DirectChannel();
|
||||
IntegrationFlowBuilder flowBuilder = IntegrationFlows.from(channel);
|
||||
subFlow.configure(flowBuilder);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -164,7 +164,7 @@ public class EnricherSpec extends MessageHandlerSpec<EnricherSpec, ContentEnrich
|
||||
* @see ContentEnricher#setPropertyExpressions(Map)
|
||||
*/
|
||||
public EnricherSpec propertyExpression(String key, String expression) {
|
||||
Assert.notNull(key);
|
||||
Assert.notNull(key, "'key' must not be null");
|
||||
this.propertyExpressions.put(key, PARSER.parseExpression(expression));
|
||||
return _this();
|
||||
}
|
||||
@@ -228,7 +228,7 @@ public class EnricherSpec extends MessageHandlerSpec<EnricherSpec, ContentEnrich
|
||||
* @see ContentEnricher#setHeaderExpressions(Map)
|
||||
*/
|
||||
public EnricherSpec headerExpression(String name, String expression, Boolean overwrite) {
|
||||
Assert.hasText(expression);
|
||||
Assert.hasText(expression, "'expression' must not be empty");
|
||||
return headerExpression(name, PARSER.parseExpression(expression), overwrite);
|
||||
}
|
||||
|
||||
@@ -267,15 +267,15 @@ public class EnricherSpec extends MessageHandlerSpec<EnricherSpec, ContentEnrich
|
||||
|
||||
/**
|
||||
* Set a header value using an explicit {@link HeaderValueMessageProcessor}.
|
||||
* @param name the header name.
|
||||
* @param headerName the header name.
|
||||
* @param headerValueMessageProcessor the headerValueMessageProcessor.
|
||||
* @param <V> the value type.
|
||||
* @return the enricher spec.
|
||||
* @see ContentEnricher#setHeaderExpressions(Map)
|
||||
*/
|
||||
public <V> EnricherSpec header(String name, HeaderValueMessageProcessor<V> headerValueMessageProcessor) {
|
||||
Assert.hasText(name);
|
||||
this.headerExpressions.put(name, headerValueMessageProcessor);
|
||||
public <V> EnricherSpec header(String headerName, HeaderValueMessageProcessor<V> headerValueMessageProcessor) {
|
||||
Assert.hasText(headerName, "'headerName' must not be empty");
|
||||
this.headerExpressions.put(headerName, headerValueMessageProcessor);
|
||||
return _this();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -87,7 +87,7 @@ public final class FilterEndpointSpec extends ConsumerEndpointSpec<FilterEndpoin
|
||||
* @return the endpoint spec.
|
||||
*/
|
||||
public FilterEndpointSpec discardFlow(IntegrationFlow discardFlow) {
|
||||
Assert.notNull(discardFlow);
|
||||
Assert.notNull(discardFlow, "'discardFlow' must not be null");
|
||||
DirectChannel channel = new DirectChannel();
|
||||
IntegrationFlowBuilder flowBuilder = IntegrationFlows.from(channel);
|
||||
discardFlow.configure(flowBuilder);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -145,7 +145,7 @@ public class HeaderEnricherSpec extends IntegrationComponentSpec<HeaderEnricherS
|
||||
* @return the header enricher spec.
|
||||
*/
|
||||
public HeaderEnricherSpec headers(MapBuilder<?, String, Object> headers, Boolean overwrite) {
|
||||
Assert.notNull(headers);
|
||||
Assert.notNull(headers, "'headers' must not be null");
|
||||
return headers(headers.get(), overwrite);
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ public class HeaderEnricherSpec extends IntegrationComponentSpec<HeaderEnricherS
|
||||
* @return the header enricher spec.
|
||||
*/
|
||||
public HeaderEnricherSpec headers(Map<String, Object> headers, Boolean overwrite) {
|
||||
Assert.notNull(headers);
|
||||
Assert.notNull(headers, "'headers' must not be null");
|
||||
for (Entry<String, Object> entry : headers.entrySet()) {
|
||||
String name = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
@@ -209,7 +209,7 @@ public class HeaderEnricherSpec extends IntegrationComponentSpec<HeaderEnricherS
|
||||
* @return the header enricher spec.
|
||||
*/
|
||||
public HeaderEnricherSpec headerExpressions(MapBuilder<?, String, String> headers, Boolean overwrite) {
|
||||
Assert.notNull(headers);
|
||||
Assert.notNull(headers, "'headers' must not be null");
|
||||
return headerExpressions(headers.get(), overwrite);
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ public class HeaderEnricherSpec extends IntegrationComponentSpec<HeaderEnricherS
|
||||
* @return the header enricher spec.
|
||||
*/
|
||||
public HeaderEnricherSpec headerExpressions(Consumer<StringStringMapBuilder> configurer, Boolean overwrite) {
|
||||
Assert.notNull(configurer);
|
||||
Assert.notNull(configurer, "'configurer' must not be null");
|
||||
StringStringMapBuilder builder = new StringStringMapBuilder();
|
||||
configurer.accept(builder);
|
||||
return headerExpressions(builder.get(), overwrite);
|
||||
@@ -278,7 +278,7 @@ public class HeaderEnricherSpec extends IntegrationComponentSpec<HeaderEnricherS
|
||||
* @return the header enricher spec.
|
||||
*/
|
||||
public HeaderEnricherSpec headerExpressions(Map<String, String> headers, Boolean overwrite) {
|
||||
Assert.notNull(headers);
|
||||
Assert.notNull(headers, "'headers' must not be null");
|
||||
for (Entry<String, String> entry : headers.entrySet()) {
|
||||
AbstractHeaderValueMessageProcessor<Object> processor =
|
||||
new ExpressionEvaluatingHeaderValueMessageProcessor<Object>(entry.getValue(), null);
|
||||
@@ -336,7 +336,7 @@ public class HeaderEnricherSpec extends IntegrationComponentSpec<HeaderEnricherS
|
||||
* @return the header enricher spec.
|
||||
*/
|
||||
public HeaderEnricherSpec headerExpression(String name, String expression, Boolean overwrite) {
|
||||
Assert.hasText(expression);
|
||||
Assert.hasText(expression, "'expression' must not be empty");
|
||||
return headerExpression(name, PARSER.parseExpression(expression), overwrite);
|
||||
}
|
||||
|
||||
@@ -379,14 +379,15 @@ public class HeaderEnricherSpec extends IntegrationComponentSpec<HeaderEnricherS
|
||||
/**
|
||||
* Add a single header specification where the value is obtained by calling the
|
||||
* {@link HeaderValueMessageProcessor}.
|
||||
* @param name the header name.
|
||||
* @param headerName the header name.
|
||||
* @param headerValueMessageProcessor the message processor.
|
||||
* @param <V> the value type.
|
||||
* @return the header enricher spec.
|
||||
*/
|
||||
public <V> HeaderEnricherSpec header(String name, HeaderValueMessageProcessor<V> headerValueMessageProcessor) {
|
||||
Assert.hasText(name);
|
||||
this.headerToAdd.put(name, headerValueMessageProcessor);
|
||||
public <V> HeaderEnricherSpec header(String headerName,
|
||||
HeaderValueMessageProcessor<V> headerValueMessageProcessor) {
|
||||
Assert.hasText(headerName, "'headerName' must not be empty");
|
||||
this.headerToAdd.put(headerName, headerValueMessageProcessor);
|
||||
return _this();
|
||||
}
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ public abstract class IntegrationFlowDefinition<B extends IntegrationFlowDefinit
|
||||
* @see org.springframework.integration.dsl.channel.MessageChannels
|
||||
*/
|
||||
public B channel(MessageChannelSpec<?, ?> messageChannelSpec) {
|
||||
Assert.notNull(messageChannelSpec);
|
||||
Assert.notNull(messageChannelSpec, "'messageChannelSpec' must not be null");
|
||||
return channel(messageChannelSpec.get());
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ public abstract class IntegrationFlowDefinition<B extends IntegrationFlowDefinit
|
||||
* @return the current {@link IntegrationFlowDefinition}.
|
||||
*/
|
||||
public B channel(MessageChannel messageChannel) {
|
||||
Assert.notNull(messageChannel);
|
||||
Assert.notNull(messageChannel, "'messageChannel' must not be null");
|
||||
if (this.currentMessageChannel != null) {
|
||||
bridge(null);
|
||||
}
|
||||
@@ -224,7 +224,7 @@ public abstract class IntegrationFlowDefinition<B extends IntegrationFlowDefinit
|
||||
* @return the current {@link IntegrationFlowDefinition}.
|
||||
*/
|
||||
public B channel(Function<Channels, MessageChannelSpec<?, ?>> channels) {
|
||||
Assert.notNull(channels);
|
||||
Assert.notNull(channels, "'channels' must not be null");
|
||||
return channel(channels.apply(new Channels()));
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ public abstract class IntegrationFlowDefinition<B extends IntegrationFlowDefinit
|
||||
*/
|
||||
public B publishSubscribeChannel(Executor executor,
|
||||
Consumer<PublishSubscribeSpec> publishSubscribeChannelConfigurer) {
|
||||
Assert.notNull(publishSubscribeChannelConfigurer);
|
||||
Assert.notNull(publishSubscribeChannelConfigurer, "'publishSubscribeChannelConfigurer' must not be null");
|
||||
PublishSubscribeSpec spec = new PublishSubscribeSpec(executor);
|
||||
publishSubscribeChannelConfigurer.accept(spec);
|
||||
return addComponents(spec.getComponentsToRegister()).channel(spec);
|
||||
@@ -468,7 +468,7 @@ public abstract class IntegrationFlowDefinition<B extends IntegrationFlowDefinit
|
||||
* @see ExpressionEvaluatingTransformer
|
||||
*/
|
||||
public B transform(String expression, Consumer<GenericEndpointSpec<MessageTransformingHandler>> endpointConfigurer) {
|
||||
Assert.hasText(expression);
|
||||
Assert.hasText(expression, "'expression' must not be empty");
|
||||
return transform(new ExpressionEvaluatingTransformer(PARSER.parseExpression(expression)),
|
||||
endpointConfigurer);
|
||||
}
|
||||
@@ -564,7 +564,7 @@ public abstract class IntegrationFlowDefinition<B extends IntegrationFlowDefinit
|
||||
*/
|
||||
public B transform(MessageProcessorSpec<?> messageProcessorSpec,
|
||||
Consumer<GenericEndpointSpec<MessageTransformingHandler>> endpointConfigurer) {
|
||||
Assert.notNull(messageProcessorSpec);
|
||||
Assert.notNull(messageProcessorSpec, "'messageProcessorSpec' must not be null");
|
||||
MessageProcessor<?> processor = messageProcessorSpec.get();
|
||||
return addComponent(processor)
|
||||
.transform(new MethodInvokingTransformer(processor), endpointConfigurer);
|
||||
@@ -618,7 +618,7 @@ public abstract class IntegrationFlowDefinition<B extends IntegrationFlowDefinit
|
||||
*/
|
||||
public <P, T> B transform(Class<P> payloadType, GenericTransformer<P, T> genericTransformer,
|
||||
Consumer<GenericEndpointSpec<MessageTransformingHandler>> endpointConfigurer) {
|
||||
Assert.notNull(genericTransformer);
|
||||
Assert.notNull(genericTransformer, "'genericTransformer' must not be null");
|
||||
Transformer transformer = genericTransformer instanceof Transformer ? (Transformer) genericTransformer :
|
||||
(isLambda(genericTransformer)
|
||||
? new MethodInvokingTransformer(new LambdaMessageProcessor(genericTransformer, payloadType))
|
||||
@@ -650,7 +650,7 @@ public abstract class IntegrationFlowDefinition<B extends IntegrationFlowDefinit
|
||||
* @see FilterEndpointSpec
|
||||
*/
|
||||
public B filter(String expression, Consumer<FilterEndpointSpec> endpointConfigurer) {
|
||||
Assert.hasText(expression);
|
||||
Assert.hasText(expression, "'expression' must not be empty");
|
||||
return filter(new ExpressionEvaluatingSelector(expression), endpointConfigurer);
|
||||
}
|
||||
|
||||
@@ -746,7 +746,7 @@ public abstract class IntegrationFlowDefinition<B extends IntegrationFlowDefinit
|
||||
* @return the current {@link IntegrationFlowDefinition}.
|
||||
*/
|
||||
public B filter(MessageProcessorSpec<?> messageProcessorSpec, Consumer<FilterEndpointSpec> endpointConfigurer) {
|
||||
Assert.notNull(messageProcessorSpec);
|
||||
Assert.notNull(messageProcessorSpec, "'messageProcessorSpec' must not be null");
|
||||
MessageProcessor<?> processor = messageProcessorSpec.get();
|
||||
return addComponent(processor)
|
||||
.filter(new MethodInvokingSelector(processor), endpointConfigurer);
|
||||
@@ -811,7 +811,7 @@ public abstract class IntegrationFlowDefinition<B extends IntegrationFlowDefinit
|
||||
*/
|
||||
public <P> B filter(Class<P> payloadType, GenericSelector<P> genericSelector,
|
||||
Consumer<FilterEndpointSpec> endpointConfigurer) {
|
||||
Assert.notNull(genericSelector);
|
||||
Assert.notNull(genericSelector, "'genericSelector' must not be null");
|
||||
MessageSelector selector = genericSelector instanceof MessageSelector ? (MessageSelector) genericSelector :
|
||||
(isLambda(genericSelector)
|
||||
? new MethodInvokingSelector(new LambdaMessageProcessor(genericSelector, payloadType))
|
||||
@@ -1053,7 +1053,7 @@ public abstract class IntegrationFlowDefinition<B extends IntegrationFlowDefinit
|
||||
*/
|
||||
public B handle(MessageProcessorSpec<?> messageProcessorSpec,
|
||||
Consumer<GenericEndpointSpec<ServiceActivatingHandler>> endpointConfigurer) {
|
||||
Assert.notNull(messageProcessorSpec);
|
||||
Assert.notNull(messageProcessorSpec, "'messageProcessorSpec' must not be null");
|
||||
MessageProcessor<?> processor = messageProcessorSpec.get();
|
||||
return addComponent(processor)
|
||||
.handle(new ServiceActivatingHandler(processor), endpointConfigurer);
|
||||
@@ -1078,7 +1078,7 @@ public abstract class IntegrationFlowDefinition<B extends IntegrationFlowDefinit
|
||||
*/
|
||||
public <H extends MessageHandler> B handle(MessageHandlerSpec<?, H> messageHandlerSpec,
|
||||
Consumer<GenericEndpointSpec<H>> endpointConfigurer) {
|
||||
Assert.notNull(messageHandlerSpec);
|
||||
Assert.notNull(messageHandlerSpec, "'messageHandlerSpec' must not be null");
|
||||
if (messageHandlerSpec instanceof ComponentsRegistration) {
|
||||
addComponents(((ComponentsRegistration) messageHandlerSpec).getComponentsToRegister());
|
||||
}
|
||||
@@ -1188,7 +1188,7 @@ public abstract class IntegrationFlowDefinition<B extends IntegrationFlowDefinit
|
||||
*/
|
||||
public B enrich(Consumer<EnricherSpec> enricherConfigurer,
|
||||
Consumer<GenericEndpointSpec<ContentEnricher>> endpointConfigurer) {
|
||||
Assert.notNull(enricherConfigurer);
|
||||
Assert.notNull(enricherConfigurer, "'enricherConfigurer' must not be null");
|
||||
EnricherSpec enricherSpec = new EnricherSpec();
|
||||
enricherConfigurer.accept(enricherSpec);
|
||||
return this.handle(enricherSpec.get(), endpointConfigurer);
|
||||
@@ -1315,7 +1315,7 @@ public abstract class IntegrationFlowDefinition<B extends IntegrationFlowDefinit
|
||||
*/
|
||||
public B enrichHeaders(Consumer<HeaderEnricherSpec> headerEnricherConfigurer,
|
||||
Consumer<GenericEndpointSpec<MessageTransformingHandler>> endpointConfigurer) {
|
||||
Assert.notNull(headerEnricherConfigurer);
|
||||
Assert.notNull(headerEnricherConfigurer, "'headerEnricherConfigurer' must not be null");
|
||||
HeaderEnricherSpec headerEnricherSpec = new HeaderEnricherSpec();
|
||||
headerEnricherConfigurer.accept(headerEnricherSpec);
|
||||
return transform(headerEnricherSpec.get(), endpointConfigurer);
|
||||
@@ -1370,7 +1370,7 @@ public abstract class IntegrationFlowDefinition<B extends IntegrationFlowDefinit
|
||||
* @see SplitterEndpointSpec
|
||||
*/
|
||||
public B split(String expression, Consumer<SplitterEndpointSpec<ExpressionEvaluatingSplitter>> endpointConfigurer) {
|
||||
Assert.hasText(expression);
|
||||
Assert.hasText(expression, "'expression' must not be empty");
|
||||
return split(new ExpressionEvaluatingSplitter(PARSER.parseExpression(expression)), endpointConfigurer);
|
||||
}
|
||||
|
||||
@@ -1485,7 +1485,7 @@ public abstract class IntegrationFlowDefinition<B extends IntegrationFlowDefinit
|
||||
*/
|
||||
public B split(MessageProcessorSpec<?> messageProcessorSpec,
|
||||
Consumer<SplitterEndpointSpec<MethodInvokingSplitter>> endpointConfigurer) {
|
||||
Assert.notNull(messageProcessorSpec);
|
||||
Assert.notNull(messageProcessorSpec, "'messageProcessorSpec' must not be null");
|
||||
MessageProcessor<?> processor = messageProcessorSpec.get();
|
||||
return addComponent(processor)
|
||||
.split(new MethodInvokingSplitter(processor), endpointConfigurer);
|
||||
@@ -1598,7 +1598,7 @@ public abstract class IntegrationFlowDefinition<B extends IntegrationFlowDefinit
|
||||
*/
|
||||
public <S extends AbstractMessageSplitter> B split(MessageHandlerSpec<?, S> splitterMessageHandlerSpec,
|
||||
Consumer<SplitterEndpointSpec<S>> endpointConfigurer) {
|
||||
Assert.notNull(splitterMessageHandlerSpec);
|
||||
Assert.notNull(splitterMessageHandlerSpec, "'splitterMessageHandlerSpec' must not be null");
|
||||
return split(splitterMessageHandlerSpec.get(), endpointConfigurer);
|
||||
}
|
||||
|
||||
@@ -1624,7 +1624,7 @@ public abstract class IntegrationFlowDefinition<B extends IntegrationFlowDefinit
|
||||
*/
|
||||
public <S extends AbstractMessageSplitter> B split(S splitter,
|
||||
Consumer<SplitterEndpointSpec<S>> endpointConfigurer) {
|
||||
Assert.notNull(splitter);
|
||||
Assert.notNull(splitter, "'splitter' must not be null");
|
||||
return this.register(new SplitterEndpointSpec<>(splitter), endpointConfigurer);
|
||||
}
|
||||
|
||||
@@ -2128,7 +2128,7 @@ public abstract class IntegrationFlowDefinition<B extends IntegrationFlowDefinit
|
||||
public B route(MessageProcessorSpec<?> messageProcessorSpec,
|
||||
Consumer<RouterSpec<Object, MethodInvokingRouter>> routerConfigurer,
|
||||
Consumer<GenericEndpointSpec<MethodInvokingRouter>> endpointConfigurer) {
|
||||
Assert.notNull(messageProcessorSpec);
|
||||
Assert.notNull(messageProcessorSpec, "'messageProcessorSpec' must not be null");
|
||||
MessageProcessor<?> processor = messageProcessorSpec.get();
|
||||
return addComponent(processor)
|
||||
.route(new MethodInvokingRouter(processor), routerConfigurer, endpointConfigurer);
|
||||
@@ -2354,7 +2354,7 @@ public abstract class IntegrationFlowDefinition<B extends IntegrationFlowDefinit
|
||||
* @return the current {@link IntegrationFlowDefinition}.
|
||||
*/
|
||||
public B gateway(IntegrationFlow flow, Consumer<GatewayEndpointSpec> endpointConfigurer) {
|
||||
Assert.notNull(flow);
|
||||
Assert.notNull(flow, "'flow' must not be null");
|
||||
final DirectChannel requestChannel = new DirectChannel();
|
||||
IntegrationFlowBuilder flowBuilder = IntegrationFlows.from(requestChannel);
|
||||
flow.configure(flowBuilder);
|
||||
@@ -2429,7 +2429,7 @@ public abstract class IntegrationFlowDefinition<B extends IntegrationFlowDefinit
|
||||
* @see #wireTap(WireTapSpec)
|
||||
*/
|
||||
public B log(LoggingHandler.Level level, String category, String logExpression) {
|
||||
Assert.hasText(logExpression);
|
||||
Assert.hasText(logExpression, "'logExpression' must not be empty");
|
||||
return log(level, category, PARSER.parseExpression(logExpression));
|
||||
}
|
||||
|
||||
@@ -2445,7 +2445,7 @@ public abstract class IntegrationFlowDefinition<B extends IntegrationFlowDefinit
|
||||
* @see #wireTap(WireTapSpec)
|
||||
*/
|
||||
public <P> B log(Function<Message<P>, Object> function) {
|
||||
Assert.notNull(function);
|
||||
Assert.notNull(function, "'function' must not be null");
|
||||
return log(new FunctionExpression<>(function));
|
||||
}
|
||||
|
||||
@@ -2545,7 +2545,7 @@ public abstract class IntegrationFlowDefinition<B extends IntegrationFlowDefinit
|
||||
* @see #wireTap(WireTapSpec)
|
||||
*/
|
||||
public <P> B log(LoggingHandler.Level level, String category, Function<Message<P>, Object> function) {
|
||||
Assert.notNull(function);
|
||||
Assert.notNull(function, "'function' must not be null");
|
||||
return log(level, category, new FunctionExpression<>(function));
|
||||
}
|
||||
|
||||
@@ -2665,7 +2665,7 @@ public abstract class IntegrationFlowDefinition<B extends IntegrationFlowDefinit
|
||||
*/
|
||||
public B scatterGather(Consumer<RecipientListRouterSpec> scatterer, Consumer<AggregatorSpec> gatherer,
|
||||
Consumer<ScatterGatherSpec> scatterGather) {
|
||||
Assert.notNull(scatterer);
|
||||
Assert.notNull(scatterer, "'scatterer' must not be null");
|
||||
RecipientListRouterSpec recipientListRouterSpec = new RecipientListRouterSpec();
|
||||
scatterer.accept(recipientListRouterSpec);
|
||||
AggregatorSpec aggregatorSpec = new AggregatorSpec();
|
||||
|
||||
@@ -89,7 +89,7 @@ public final class IntegrationFlows {
|
||||
* @see org.springframework.integration.dsl.channel.MessageChannels
|
||||
*/
|
||||
public static IntegrationFlowBuilder from(MessageChannelSpec<?, ?> messageChannelSpec) {
|
||||
Assert.notNull(messageChannelSpec);
|
||||
Assert.notNull(messageChannelSpec, "'messageChannelSpec' must not be null");
|
||||
return from(messageChannelSpec.get());
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public final class IntegrationFlows {
|
||||
*/
|
||||
public static IntegrationFlowBuilder from(MessageSourceSpec<?, ? extends MessageSource<?>> messageSourceSpec,
|
||||
Consumer<SourcePollingChannelAdapterSpec> endpointConfigurer) {
|
||||
Assert.notNull(messageSourceSpec);
|
||||
Assert.notNull(messageSourceSpec, "'messageSourceSpec' must not be null");
|
||||
return from(messageSourceSpec.get(), endpointConfigurer, registerComponents(messageSourceSpec));
|
||||
}
|
||||
|
||||
@@ -158,8 +158,8 @@ public final class IntegrationFlows {
|
||||
*/
|
||||
public static IntegrationFlowBuilder from(Object service, String methodName,
|
||||
Consumer<SourcePollingChannelAdapterSpec> endpointConfigurer) {
|
||||
Assert.notNull(service);
|
||||
Assert.hasText(methodName);
|
||||
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);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -204,7 +204,7 @@ public class RecipientListRouterSpec extends AbstractRouterSpec<RecipientListRou
|
||||
* @return the router spec.
|
||||
*/
|
||||
public <P> RecipientListRouterSpec recipientFlow(GenericSelector<P> selector, IntegrationFlow subFlow) {
|
||||
Assert.notNull(subFlow);
|
||||
Assert.notNull(subFlow, "'subFlow' must not be null");
|
||||
DirectChannel channel = populateSubFlow(subFlow);
|
||||
return recipient(channel, selector);
|
||||
}
|
||||
@@ -238,7 +238,7 @@ public class RecipientListRouterSpec extends AbstractRouterSpec<RecipientListRou
|
||||
* @since 1.2
|
||||
*/
|
||||
public RecipientListRouterSpec recipientFlow(Expression expression, IntegrationFlow subFlow) {
|
||||
Assert.notNull(subFlow);
|
||||
Assert.notNull(subFlow, "'subFlow' must not be null");
|
||||
DirectChannel channel = populateSubFlow(subFlow);
|
||||
return recipient(channel, expression);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -99,8 +99,8 @@ public final class RouterSpec<K, R extends AbstractMappingMessageRouter>
|
||||
* @see AbstractMappingMessageRouter#setChannelMapping(String, String)
|
||||
*/
|
||||
public RouterSpec<K, R> channelMapping(K key, final String channelName) {
|
||||
Assert.notNull(key);
|
||||
Assert.hasText(channelName);
|
||||
Assert.notNull(key, "'key' must not be null");
|
||||
Assert.hasText(channelName, "'channelName' must not be null");
|
||||
if (key instanceof String) {
|
||||
this.target.setChannelMapping((String) key, channelName);
|
||||
}
|
||||
@@ -131,8 +131,8 @@ public final class RouterSpec<K, R extends AbstractMappingMessageRouter>
|
||||
* @return the router spec.
|
||||
*/
|
||||
public RouterSpec<K, R> subFlowMapping(K key, IntegrationFlow subFlow) {
|
||||
Assert.notNull(key);
|
||||
Assert.notNull(subFlow);
|
||||
Assert.notNull(key, "'key' must not be null");
|
||||
Assert.notNull(subFlow, "'subFlow' must not be null");
|
||||
Assert.state(!(StringUtils.hasText(this.prefix) || StringUtils.hasText(this.suffix)),
|
||||
"The 'prefix'('suffix') and 'subFlowMapping' are mutually exclusive");
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -64,13 +64,15 @@ public abstract class MessageChannelSpec<S extends MessageChannelSpec<S, C>, C e
|
||||
}
|
||||
|
||||
public S datatype(Class<?>... datatypes) {
|
||||
Assert.noNullElements(datatypes);
|
||||
Assert.notNull(datatypes, "'datatypes' must not be null");
|
||||
Assert.noNullElements(datatypes, "'datatypes' must not contain null elements");
|
||||
this.datatypes.addAll(Arrays.asList(datatypes));
|
||||
return _this();
|
||||
}
|
||||
|
||||
public S interceptor(ChannelInterceptor... interceptors) {
|
||||
Assert.noNullElements(interceptors);
|
||||
Assert.notNull(interceptors, "'interceptors' must not be null");
|
||||
Assert.noNullElements(interceptors, "'interceptors' must not contain null elements");
|
||||
this.interceptors.addAll(Arrays.asList(interceptors));
|
||||
return _this();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -36,7 +36,7 @@ public class MessageChannelReference implements MessageChannel {
|
||||
private final String name;
|
||||
|
||||
public MessageChannelReference(String name) {
|
||||
Assert.notNull(name);
|
||||
Assert.notNull(name, "'name' must not be null");
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,8 +63,8 @@ public class ReactiveConsumer extends AbstractEndpoint {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public ReactiveConsumer(MessageChannel inputChannel, Subscriber<Message<?>> subscriber) {
|
||||
Assert.notNull(inputChannel);
|
||||
Assert.notNull(subscriber);
|
||||
Assert.notNull(inputChannel, "'inputChannel' must not be null");
|
||||
Assert.notNull(subscriber, "'subscriber' must not be null");
|
||||
|
||||
Publisher<?> messagePublisher = MessageChannelReactiveUtils.toPublisher(inputChannel);
|
||||
this.publisher = (Publisher<Message<?>>) messagePublisher;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014 the original author or authors.
|
||||
* Copyright 2014-2017 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.
|
||||
@@ -45,7 +45,7 @@ public class ValueExpression<V> implements Expression {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public ValueExpression(V value) {
|
||||
Assert.notNull(value);
|
||||
Assert.notNull(value, "'value' must not be null");
|
||||
this.value = value;
|
||||
this.aClass = (Class<V>) this.value.getClass();
|
||||
this.typedResultValue = new TypedValue(this.value);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -48,7 +48,7 @@ public class BeanNameMessageProcessor<T> implements MessageProcessor<T>, BeanFac
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||
Assert.notNull(beanFactory);
|
||||
Assert.notNull(beanFactory, "'beanFactory' must not be null");
|
||||
this.beanFactory = beanFactory;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -55,7 +55,7 @@ public class LambdaMessageProcessor implements MessageProcessor<Object>, BeanFac
|
||||
private ConversionService conversionService;
|
||||
|
||||
public LambdaMessageProcessor(Object target, Class<?> payloadType) {
|
||||
Assert.notNull(target);
|
||||
Assert.notNull(target, "'target' must not be null");
|
||||
this.target = target;
|
||||
final AtomicReference<Method> methodValue = new AtomicReference<>();
|
||||
ReflectionUtils.doWithMethods(target.getClass(),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 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.
|
||||
@@ -72,7 +72,7 @@ public class IdempotentReceiverInterceptor extends AbstractHandleMessageAdvice i
|
||||
private BeanFactory beanFactory;
|
||||
|
||||
public IdempotentReceiverInterceptor(MessageSelector messageSelector) {
|
||||
Assert.notNull(messageSelector);
|
||||
Assert.notNull(messageSelector, "'messageSelector' must not be null");
|
||||
this.messageSelector = messageSelector;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 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.
|
||||
@@ -63,8 +63,8 @@ public class ScatterGatherHandler extends AbstractReplyProducingMessageHandler i
|
||||
|
||||
|
||||
public ScatterGatherHandler(MessageChannel scatterChannel, MessageHandler gatherer) {
|
||||
Assert.notNull(scatterChannel);
|
||||
Assert.notNull(gatherer);
|
||||
Assert.notNull(scatterChannel, "'scatterChannel' must not be null");
|
||||
Assert.notNull(gatherer, "'gatherer' must not be null");
|
||||
Class<?> gathererClass = AopUtils.getTargetClass(gatherer);
|
||||
checkClass(gathererClass, "org.springframework.integration.aggregator.AggregatingMessageHandler", "gatherer");
|
||||
this.scatterChannel = scatterChannel;
|
||||
@@ -73,7 +73,7 @@ public class ScatterGatherHandler extends AbstractReplyProducingMessageHandler i
|
||||
|
||||
public ScatterGatherHandler(MessageHandler scatterer, MessageHandler gatherer) {
|
||||
this(new FixedSubscriberChannel(scatterer), gatherer);
|
||||
Assert.notNull(scatterer);
|
||||
Assert.notNull(scatterer, "'scatterer' must not be null");
|
||||
Class<?> scattererClass = AopUtils.getTargetClass(scatterer);
|
||||
checkClass(scattererClass, "org.springframework.integration.router.RecipientListRouter", "scatterer");
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014 the original author or authors.
|
||||
* Copyright 2014-2017 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.
|
||||
@@ -70,8 +70,8 @@ public class MetadataStoreSelector implements MessageSelector {
|
||||
|
||||
public MetadataStoreSelector(MessageProcessor<String> keyStrategy, MessageProcessor<String> valueStrategy,
|
||||
ConcurrentMetadataStore metadataStore) {
|
||||
Assert.notNull(keyStrategy);
|
||||
Assert.notNull(metadataStore);
|
||||
Assert.notNull(keyStrategy, "'keyStrategy' must not be null");
|
||||
Assert.notNull(metadataStore, "'metadataStore' must not be null");
|
||||
this.metadataStore = metadataStore;
|
||||
this.keyStrategy = keyStrategy;
|
||||
this.valueStrategy = valueStrategy;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 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.
|
||||
@@ -72,7 +72,7 @@ public final class MutableMessageBuilder<T> extends AbstractIntegrationMessageBu
|
||||
* @return A MutableMessageBuilder.
|
||||
*/
|
||||
public static <T> MutableMessageBuilder<T> fromMessage(Message<T> message) {
|
||||
Assert.notNull(message, "message must not be null");
|
||||
Assert.notNull(message, "'message' must not be null");
|
||||
return new MutableMessageBuilder<T>(message);
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public final class MutableMessageBuilder<T> extends AbstractIntegrationMessageBu
|
||||
|
||||
@Override
|
||||
public AbstractIntegrationMessageBuilder<T> setHeader(String headerName, Object headerValue) {
|
||||
Assert.notNull(headerName);
|
||||
Assert.notNull(headerName, "'headerName' must not be null");
|
||||
if (headerValue == null) {
|
||||
this.removeHeader(headerName);
|
||||
}
|
||||
|
||||
@@ -54,8 +54,8 @@ public class RoutingSlipHeaderValueMessageProcessor
|
||||
private BeanFactory beanFactory;
|
||||
|
||||
public RoutingSlipHeaderValueMessageProcessor(Object... routingSlipPath) {
|
||||
Assert.notNull(routingSlipPath);
|
||||
Assert.noNullElements(routingSlipPath);
|
||||
Assert.notNull(routingSlipPath, "'routingSlipPath' must not be null");
|
||||
Assert.noNullElements(routingSlipPath, "'routingSlipPath' must not contain null elements");
|
||||
for (Object entry : routingSlipPath) {
|
||||
if (!(entry instanceof String
|
||||
|| entry instanceof MessageChannel
|
||||
|
||||
@@ -14,4 +14,5 @@
|
||||
</int:converter>
|
||||
|
||||
<bean id="integrationConversionService" class="org.springframework.context.support.ConversionServiceFactoryBean"/>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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,6 +16,8 @@
|
||||
|
||||
package org.springframework.integration.config.xml;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@@ -30,16 +32,17 @@ import org.springframework.core.convert.support.GenericConversionService;
|
||||
import org.springframework.integration.support.utils.IntegrationUtils;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Artem Bilan
|
||||
*
|
||||
*/
|
||||
@ContextConfiguration
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
public class ConverterParserWithExistingConversionServiceTests {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@@ -49,9 +52,10 @@ public class ConverterParserWithExistingConversionServiceTests {
|
||||
|
||||
@Test
|
||||
public void testConversionServiceAvailability() {
|
||||
Assert.isTrue(applicationContext.getBean(IntegrationUtils.INTEGRATION_CONVERSION_SERVICE_BEAN_NAME).equals(conversionService));
|
||||
Assert.isTrue(conversionService.canConvert(TestBean1.class, TestBean2.class));
|
||||
Assert.isTrue(conversionService.canConvert(TestBean1.class, TestBean3.class));
|
||||
assertTrue(applicationContext.getBean(IntegrationUtils.INTEGRATION_CONVERSION_SERVICE_BEAN_NAME)
|
||||
.equals(conversionService));
|
||||
assertTrue(conversionService.canConvert(TestBean1.class, TestBean2.class));
|
||||
assertTrue(conversionService.canConvert(TestBean1.class, TestBean3.class));
|
||||
}
|
||||
@Test
|
||||
public void testParentConversionServiceAvailability() {
|
||||
@@ -63,13 +67,17 @@ public class ConverterParserWithExistingConversionServiceTests {
|
||||
|
||||
childContext.refresh();
|
||||
|
||||
GenericConversionService conversionServiceParent = parentContext.getBean(IntegrationUtils.INTEGRATION_CONVERSION_SERVICE_BEAN_NAME, GenericConversionService.class);
|
||||
GenericConversionService conversionServiceChild = childContext.getBean(IntegrationUtils.INTEGRATION_CONVERSION_SERVICE_BEAN_NAME, GenericConversionService.class);
|
||||
Assert.isTrue(conversionServiceParent == conversionServiceChild); // validating that they are pointing to the same object
|
||||
GenericConversionService conversionServiceParent =
|
||||
parentContext.getBean(IntegrationUtils.INTEGRATION_CONVERSION_SERVICE_BEAN_NAME,
|
||||
GenericConversionService.class);
|
||||
GenericConversionService conversionServiceChild =
|
||||
childContext.getBean(IntegrationUtils.INTEGRATION_CONVERSION_SERVICE_BEAN_NAME,
|
||||
GenericConversionService.class);
|
||||
assertTrue(conversionServiceParent == conversionServiceChild); // validating that they are pointing to the same object
|
||||
conversionServiceChild.addConverter(new TestConverter());
|
||||
conversionServiceChild.addConverter(new TestConverter3());
|
||||
Assert.isTrue(conversionServiceChild.canConvert(TestBean1.class, TestBean2.class));
|
||||
Assert.isTrue(conversionServiceChild.canConvert(TestBean1.class, TestBean3.class));
|
||||
assertTrue(conversionServiceChild.canConvert(TestBean1.class, TestBean2.class));
|
||||
assertTrue(conversionServiceChild.canConvert(TestBean1.class, TestBean3.class));
|
||||
childContext.close();
|
||||
parentContext.close();
|
||||
}
|
||||
|
||||
@@ -642,6 +642,8 @@ public class AdvisedMessageHandlerTests {
|
||||
RetryTemplate retryTemplate = new RetryTemplate();
|
||||
retryTemplate.setRetryPolicy(new SimpleRetryPolicy() {
|
||||
|
||||
static final long serialVersionUID = -1;
|
||||
|
||||
@Override
|
||||
public boolean canRetry(RetryContext context) {
|
||||
return false;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -49,7 +49,7 @@ public class TailAdapterSpec extends MessageProducerSpec<TailAdapterSpec, FileTa
|
||||
}
|
||||
|
||||
TailAdapterSpec file(File file) {
|
||||
Assert.notNull(file);
|
||||
Assert.notNull(file, "'file' cannot be null");
|
||||
this.factoryBean.setFile(file);
|
||||
return _this();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -68,7 +68,7 @@ public abstract class FileTailingMessageProducerSupport extends MessageProducerS
|
||||
* @param file The absolute path of the file.
|
||||
*/
|
||||
public void setFile(File file) {
|
||||
Assert.notNull("'file' cannot be null");
|
||||
Assert.notNull(file, "'file' cannot be null");
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public abstract class FileTailingMessageProducerSupport extends MessageProducerS
|
||||
* @param taskExecutor The task executor.
|
||||
*/
|
||||
public void setTaskExecutor(TaskExecutor taskExecutor) {
|
||||
Assert.notNull("'taskExecutor' cannot be null");
|
||||
Assert.notNull(taskExecutor, "'taskExecutor' cannot be null");
|
||||
this.taskExecutor = taskExecutor;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -82,12 +82,12 @@ public abstract class AbstractFtpSessionFactory<T extends FTPClient> implements
|
||||
}
|
||||
|
||||
public void setControlEncoding(String controlEncoding) {
|
||||
Assert.hasText(controlEncoding);
|
||||
Assert.hasText(controlEncoding, "'controlEncoding' must not be empty");
|
||||
this.controlEncoding = controlEncoding;
|
||||
}
|
||||
|
||||
public void setConfig(FTPClientConfig config) {
|
||||
Assert.notNull(config);
|
||||
Assert.notNull(config, "'config' must not be null");
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ public abstract class AbstractFtpSessionFactory<T extends FTPClient> implements
|
||||
}
|
||||
|
||||
public void setHost(String host) {
|
||||
Assert.hasText(host);
|
||||
Assert.hasText(host, "'host' must not be empty");
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -38,6 +38,7 @@ import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHeaders;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Message Mapper for converting to and from UDP DatagramPackets. When
|
||||
@@ -149,7 +150,7 @@ public class DatagramPacketMessageMapper implements InboundMessageMapper<Datagra
|
||||
* Prefix raw byte[] from message with 'acknowledge to' and 'message id' "headers".
|
||||
*/
|
||||
private DatagramPacket fromMessageWithAck(Message<?> message) throws Exception {
|
||||
Assert.hasLength(this.ackAddress);
|
||||
Assert.state(StringUtils.hasText(this.ackAddress), "'ackAddress' must not be empty");
|
||||
byte[] bytes = getPayloadAsBytes(message);
|
||||
ByteBuffer buffer = ByteBuffer.allocate(100 + bytes.length);
|
||||
if (this.lengthCheck) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2016 the original author or authors.
|
||||
* Copyright 2001-2017 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.
|
||||
@@ -44,6 +44,7 @@ import org.springframework.messaging.MessageDeliveryException;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.messaging.MessagingException;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* A {@link org.springframework.messaging.MessageHandler} implementation that maps a Message into
|
||||
@@ -213,7 +214,7 @@ public class UnicastSendingMessageHandler extends
|
||||
}
|
||||
this.acknowledge = acknowledge;
|
||||
if (this.acknowledge) {
|
||||
Assert.hasLength(ackHost);
|
||||
Assert.state(StringUtils.hasText(ackHost), "'ackHost' must not be empty");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2017 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.
|
||||
@@ -47,7 +47,7 @@ public class MulticastRule extends TestWatcher {
|
||||
}
|
||||
|
||||
public MulticastRule(String group) {
|
||||
Assert.hasText(group);
|
||||
Assert.hasText(group, "'group' must not be empty");
|
||||
this.group = group;
|
||||
System.setProperty("java.net.preferIPv4Stack", "true");
|
||||
System.setProperty("multicast.group", this.group);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -106,7 +106,7 @@ public class JmsInboundChannelAdapterSpec<S extends JmsInboundChannelAdapterSpec
|
||||
* @return the spec.
|
||||
*/
|
||||
public JmsInboundChannelSpecTemplateAware configureJmsTemplate(Consumer<JmsTemplateSpec> configurer) {
|
||||
Assert.notNull(configurer);
|
||||
Assert.notNull(configurer, "'configurer' must not be null");
|
||||
configurer.accept(this.jmsTemplateSpec);
|
||||
return _this();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -214,7 +214,7 @@ public class JmsInboundGatewaySpec<S extends JmsInboundGatewaySpec<S>>
|
||||
|
||||
public JmsInboundGatewayListenerContainerSpec<S, C> configureListenerContainer(
|
||||
Consumer<JmsListenerContainerSpec<S, C>> configurer) {
|
||||
Assert.notNull(configurer);
|
||||
Assert.notNull(configurer, "'configurer' must not be null");
|
||||
configurer.accept(this.spec);
|
||||
return _this();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -120,7 +120,7 @@ public class JmsMessageDrivenChannelAdapterSpec<S extends JmsMessageDrivenChanne
|
||||
*/
|
||||
public JmsMessageDrivenChannelAdapterListenerContainerSpec<S, C> configureListenerContainer(
|
||||
Consumer<JmsListenerContainerSpec<S, C>> configurer) {
|
||||
Assert.notNull(configurer);
|
||||
Assert.notNull(configurer, "'configurer' must not be null");
|
||||
configurer.accept(this.spec);
|
||||
return _this();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -135,7 +135,7 @@ public class JmsOutboundChannelAdapterSpec<S extends JmsOutboundChannelAdapterSp
|
||||
}
|
||||
|
||||
public JmsOutboundChannelSpecTemplateAware configureJmsTemplate(Consumer<JmsTemplateSpec> configurer) {
|
||||
Assert.notNull(configurer);
|
||||
Assert.notNull(configurer, "'configurer' must not be null");
|
||||
configurer.accept(this.jmsTemplateSpec);
|
||||
return _this();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -293,7 +293,7 @@ public class JmsOutboundGatewaySpec extends MessageHandlerSpec<JmsOutboundGatewa
|
||||
* @return the current {@link JmsOutboundGatewaySpec}.
|
||||
*/
|
||||
public JmsOutboundGatewaySpec replyContainer(Consumer<ReplyContainerSpec> configurer) {
|
||||
Assert.notNull(configurer);
|
||||
Assert.notNull(configurer, "'configurer' must not be null");
|
||||
ReplyContainerSpec spec = new ReplyContainerSpec();
|
||||
configurer.accept(spec);
|
||||
this.target.setReplyContainerProperties(spec.get());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -103,10 +103,9 @@ public final class JpaUtils {
|
||||
*
|
||||
*/
|
||||
public static <T> Query applyAndBind(String queryString, Iterable<T> entities, EntityManager entityManager) {
|
||||
|
||||
Assert.notNull(queryString);
|
||||
Assert.notNull(entities);
|
||||
Assert.notNull(entityManager);
|
||||
Assert.hasText(queryString, "'queryString' must not be empty");
|
||||
Assert.notNull(entities, "'entities' must not be null");
|
||||
Assert.notNull(entityManager, "'entityManager' must not be null");
|
||||
|
||||
Iterator<T> iterator = entities.iterator();
|
||||
|
||||
|
||||
@@ -99,8 +99,8 @@ public abstract class AbstractConfigurableMongoDbMessageStore extends AbstractMe
|
||||
protected MessageBuilderFactory messageBuilderFactory = new DefaultMessageBuilderFactory();
|
||||
|
||||
public AbstractConfigurableMongoDbMessageStore(MongoTemplate mongoTemplate, String collectionName) {
|
||||
Assert.notNull("'mongoTemplate' must not be null");
|
||||
Assert.hasText("'collectionName' must not be empty");
|
||||
Assert.notNull(mongoTemplate, "'mongoTemplate' must not be null");
|
||||
Assert.hasText(collectionName, "'collectionName' must not be empty");
|
||||
this.collectionName = collectionName;
|
||||
this.mongoTemplate = mongoTemplate;
|
||||
this.mongoDbFactory = null;
|
||||
@@ -112,8 +112,8 @@ public abstract class AbstractConfigurableMongoDbMessageStore extends AbstractMe
|
||||
|
||||
public AbstractConfigurableMongoDbMessageStore(MongoDbFactory mongoDbFactory,
|
||||
MappingMongoConverter mappingMongoConverter, String collectionName) {
|
||||
Assert.notNull("'mongoDbFactory' must not be null");
|
||||
Assert.hasText("'collectionName' must not be empty");
|
||||
Assert.notNull(mongoDbFactory, "'mongoDbFactory' must not be null");
|
||||
Assert.hasText(collectionName, "'collectionName' must not be empty");
|
||||
this.collectionName = collectionName;
|
||||
this.mongoDbFactory = mongoDbFactory;
|
||||
this.mappingMongoConverter = mappingMongoConverter;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -43,12 +43,12 @@ public class ScriptSpec extends MessageProcessorSpec<ScriptSpec> {
|
||||
private Map<String, Object> variables = new HashMap<String, Object>();
|
||||
|
||||
ScriptSpec(Resource scriptResource) {
|
||||
Assert.notNull(scriptResource);
|
||||
Assert.notNull(scriptResource, "'scriptResource' must not be null");
|
||||
this.processor = new DslScriptExecutingMessageProcessor(scriptResource);
|
||||
}
|
||||
|
||||
ScriptSpec(String scriptLocation) {
|
||||
Assert.hasText(scriptLocation);
|
||||
Assert.hasText(scriptLocation, "'scriptLocation' must not be empty");
|
||||
this.processor = new DslScriptExecutingMessageProcessor(scriptLocation);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class ScriptSpec extends MessageProcessorSpec<ScriptSpec> {
|
||||
* @see DslScriptExecutingMessageProcessor#setLang
|
||||
*/
|
||||
public ScriptSpec lang(String lang) {
|
||||
Assert.hasText(lang);
|
||||
Assert.hasText(lang, "'lang' must not be empty");
|
||||
this.processor.setLang(lang);
|
||||
return this;
|
||||
}
|
||||
@@ -82,7 +82,7 @@ public class ScriptSpec extends MessageProcessorSpec<ScriptSpec> {
|
||||
* @see org.springframework.integration.scripting.AbstractScriptExecutingMessageProcessor
|
||||
*/
|
||||
public ScriptSpec variableGenerator(ScriptVariableGenerator variableGenerator) {
|
||||
Assert.notNull(variableGenerator);
|
||||
Assert.notNull(variableGenerator, "'variableGenerator' must not be null");
|
||||
Assert.state(this.variables.isEmpty(), "'variableGenerator' and 'variables' are mutually exclusive");
|
||||
this.variableGenerator = variableGenerator;
|
||||
return this;
|
||||
@@ -105,7 +105,7 @@ public class ScriptSpec extends MessageProcessorSpec<ScriptSpec> {
|
||||
* @see DefaultScriptVariableGenerator
|
||||
*/
|
||||
public ScriptSpec variables(Map<String, Object> variables) {
|
||||
Assert.notEmpty(variables);
|
||||
Assert.notEmpty(variables, "'variables' must not be empty");
|
||||
Assert.state(this.variableGenerator == null, "'variableGenerator' and 'variables' are mutually exclusive");
|
||||
this.variables.putAll(variables);
|
||||
return this;
|
||||
@@ -119,7 +119,7 @@ public class ScriptSpec extends MessageProcessorSpec<ScriptSpec> {
|
||||
* @see DefaultScriptVariableGenerator
|
||||
*/
|
||||
public ScriptSpec variable(String name, Object value) {
|
||||
Assert.hasText(name);
|
||||
Assert.hasText(name, "'name' must not be empty");
|
||||
Assert.state(this.variableGenerator == null, "'variableGenerator' and 'variables' are mutually exclusive");
|
||||
this.variables.put(name, value);
|
||||
return this;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -37,7 +37,7 @@ public class SftpFileInfo extends AbstractFileInfo<LsEntry> {
|
||||
|
||||
|
||||
public SftpFileInfo(LsEntry lsEntry) {
|
||||
Assert.notNull("LsEntry must not be null");
|
||||
Assert.notNull(lsEntry, "'lsEntry' must not be null");
|
||||
this.lsEntry = lsEntry;
|
||||
this.attrs = lsEntry.getAttrs();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 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.
|
||||
@@ -76,7 +76,7 @@ public final class ClientWebSocketContainer extends IntegrationWebSocketContaine
|
||||
}
|
||||
|
||||
public void setHeadersMap(Map<String, String> headers) {
|
||||
Assert.notNull(headers);
|
||||
Assert.notNull(headers, "'headers' must not be null");
|
||||
HttpHeaders httpHeaders = new HttpHeaders();
|
||||
for (Map.Entry<String, String> entry : headers.entrySet()) {
|
||||
String[] values = StringUtils.commaDelimitedListToStringArray(entry.getValue());
|
||||
|
||||
Reference in New Issue
Block a user