Commit Graph

40 Commits

Author SHA1 Message Date
Artem Bilan
30450c48be INT-4376: Upgage to Log4J 2 (#2321)
* INT-4376: Upgage to Log4J 2

JIRA: https://jira.spring.io/browse/INT-4376

* Deprecate Log4J 1.x components in favor of newly added
a `Log4j2LevelAdjuster` JUnit `@Rule`
* Update all the logging configuration to Log4J 2

* Polishing after testing
2018-01-11 10:59:55 -05:00
Artem Bilan
c65584a007 INT-4349: Allow Number type for int headers
JIRA: https://jira.spring.io/browse/INT-4349

When headers come from the external system there is no guarantee
that special headers (e.g. `sequenceNumber`, `priority` etc.) in the
expected (`Integer`) type.

* Widen `int` headers setting value to the `Number` type
* Return primitive `int` for the `sequenceNumber` and `sequenceSize`
headers since for them `IntegrationMessageHeaderAccessor` never return
null for them
* Remove `SequenceNumberComparator` in favor of `MessageSequenceComparator`
since they are essentially duplicate each other
* Fix tests to deal with primitive `int` already
2017-10-30 11:34:34 -04:00
Gary Russell
572467b1c4 INT-4260: MessagePublishingErrorHandler Orig. Msg
JIRA: https://jira.spring.io/browse/INT-4260

MPEH: Populate the `ErrorMessage.originalMessage`,
if available and not the same as the `failedMessage`.

Polishing - rename exception to `MessagingExceptionWrapper`;
 make `MPEH` a subclass of `ErrorMessagePublisher`

PR Comments

Polishing - PR Comments
2017-05-03 16:32:49 -04:00
Artem Bilan
d58b94fb9e Improve Security and Control Bus Docs
Fixes https://github.com/spring-projects/spring-integration-samples/issues/189

Also see http://stackoverflow.com/questions/41403174/how-to-propagate-spring-security-context-in-spring-integration-async-messaging-g

* Add Control Bus Java DSL and Annotation configuration sample to the Docs
* Mention Spring Security  `DelegatingSecurityContextAsyncTaskExecutor` in Docs and add test-case to demonstrate Security Context propagation via `@MessagingGateway`

Reflect reality for STOMP Docs

Doc Polishing
2017-01-03 15:21:16 -05:00
Artem Bilan
999644a530 INT-4072 Fix applySequence with State Propagation
JIRA: https://jira.spring.io/browse/INT-4072

When `publishSubscribeChannel` is with `applySequence = true`, a `messageToSend` is overridden with `sequenceDetails` using `MessageBuilder`, therefore a new fresh `Message`.
In case of state propagation, e.g. `SecurityContextPropagationChannelInterceptor`, we just lost the state from the `ThreadStatePropagationChannelInterceptor.MessageWithThreadState` because of new `Message<?>`

* Add into `BroadcastingDispatcher` the logic to delegate `pushSequenceDetails` into `MessageWithThreadState` directly do not lose the `state`
* Make `ThreadStatePropagationChannelInterceptor` as `MessageBuilderFactory`-aware and use it to rebuild an `original` `Message<?>` in the `MessageWithThreadState` to populate `SequenceDetails`

**Cherry-pick to 4.2.x**

Provide an explicit order for `publishSubscribeChannel` subscribers

Fixes GH-1847 (https://github.com/spring-projects/spring-integration/issues/1847)

Fix mutation in the `ThreadStatePropagationChannelInterceptor`

Since `BroadcastingDispatcher` invokes `pushSequenceDetails` for each subscribed handler,
make `MessageWithThreadState` as immutable and return a new instance via `cloneWithSequenceDetails()` method with particular `sequenceDetails`.
Previous mutable solution ended up with the issue of concurrent modification.

* Introduce `CloneableMessage` abstraction to let any custom `Message` to return `MessageBuilder` with desired context.
* Introduce `DelegatingMessageBuilder` as an extension of the `MessageBuilder` to let custom `CloneableMessage` to return desired customization.
* Add into `MessageBuilder#fromMessage()` `if` for the `CloneableMessage`
* Add into `MutableMessageBuilder` a `warn` about `CloneableMessage`
* Revert changes in the `BroadcastingDispatcher` in favor of `CloneableMessage` in the `MessageBuilder`
* Redo `ThreadStatePropagationChannelInterceptor#MessageWithThreadState` logic to be based on the `CloneableMessage` and `DelegatingMessageBuilder` extension.

Introduce `MessageDecorator` contract

Remove `CloneableMessage` aspect and everything around
`MessageWithThreadState` is now `MessageDecorator` and `BroadcastingDispatcher` check if incoming `message` is `MessageDecorator` and performs its `decorateMessage` after `builder`
2016-07-21 11:04:47 -04:00
Artem Bilan
5975a34106 Increase security test receive timeout
https://build.spring.io/browse/INT-B41-555/

**Cheery-pick to 4.2.x**
2016-05-03 14:18:14 -04:00
Artem Bilan
b469e62c8a INT-3984: Fix the BFPPs order
JIRA: https://jira.spring.io/browse/INT-3984

The `PropertySourcesPlaceholderConfigurer implements BeanFactoryPostProcessor, PriorityOrdered`
meaning that it is run before any other regular `BeanFactoryPostProcessor`,
like the `IntegrationConfigurationBeanFactoryPostProcessor` has been before.
With such an order any `BeanDefinition` declaration from the `IntegrationConfigurationBeanFactoryPostProcessor` process
ended up without `PP` resolutions.

* Rework `IntegrationConfigurationBeanFactoryPostProcessor` to the `BeanDefinitionRegistryPostProcessor`,
which makes it be loaded as early as possible. See `PostProcessorRegistrationDelegate`:
````java
// Now, invoke the postProcessBeanFactory callback of all processors handled so far.
invokeBeanFactoryPostProcessors(registryPostProcessors, beanFactory);
invokeBeanFactoryPostProcessors(regularPostProcessors, beanFactory);
````

* Modify `EnableIntegrationTests` and `ChannelSecurityInterceptorSecuredChannelAnnotationTests` to ensure that the change
meets the `PP` and `SpEL` resolutions during bean definition phase.
* Fix the timing issue in the `JdbcMessageStoreChannelIntegrationTests`
2016-04-12 11:00:53 -04:00
Gary Russell
05cc7be644 checkstyle WhiteAround
WhiteAroundCheck script
2016-04-05 13:50:11 -04:00
Gary Russell
842aded9a4 checkstyle MutableException
checkstyle EmptyBlock

checkstyle fixRightCurly Script

checkstyle EmptyStatement

checkstyle RightCurly

checkstyle TailingWhite

checkstyle NeedBraces

Fix the line separator in the `fixRightCurly.gradle`
2016-04-05 13:10:33 -04:00
Gary Russell
43af472c3a checkstyle HideUtilityClassConstructor
https://sonar.spring.io/issues/search#componentRoots=org.springframework.integration%3Aspring-integration|createdAt=2016-04-01T10%3A00%3A36%2B0000|sort=UPDATE_DATE|asc=false
2016-04-01 16:18:28 -04:00
Gary Russell
5fe827a3dd Checkstyle - Phase I - Unused Imports
I copied the checkstyle config from spring-boot and commented
out most of the rules.

Over time, we should uncomment each rule and fix violations.
2016-03-04 15:50:08 -05:00
Artem Bilan
09fb4f78c9 INT-2166: Add SecurityContext Propagation
JIRA: https://jira.spring.io/browse/INT-2166

* Introduce `ThreadStatePropagationChannelInterceptor` based on the `ExecutorChannelInterceptor`
* Add `SecurityContextPropagationChannelInterceptor`,`SecurityContextCleanupChannelInterceptor`
* Introduce `AbstractExecutorChannel` to utilize `ExecutorChannelInterceptor` logic
* Introduce `MessageHandlingTaskDecorator` to avoid package tangle from `dispatcher` and `channel`
* Introduce `SecurityContextCleanupAdvice` for those cases when we don't get deal with `MessageChannel`s already, but want to have proper way to cleanup `SecurityContext`
* Make `GlobalChannelInterceptorProcessor` as `SmartInitializingSingleton` to avoid `phase` conflicts.
* Fix `MessagingAnnotationPostProcessor` to use `beanFactory.initializeBean(endpoint, endpointBeanName);` instead of manual `start()` invocation bypassing the `phase` logic, hence having a bug, when endpoints have been started very early
* Optimise `AbstractPollableChannel` to use `size` field from `ChannelInterceptorList` instead of `size()` from `Collection<?>`
* Fix `AnnotatedEndpointActivationTests` extracting separate component for annotation configuration instead of using test class directly. This caused very late Messaging Annotations process on that class
* Fix typo in the `spring-integration-jdbc-4.2.xsd`
* Remove some `SOUT`s throughout the project

TODO Docs

PR Comments:

* Remove redundant `AbstractExecutorChannel#executorInterceptors` and make logic based on the `super.interceptors`
 * Fix wrong imports order
 * JavaDocs for `ThreadStatePropagationChannelInterceptor`
 * Docs for `SecurityContext` propagation

INT-3593: Fix FTP PartialSuccess Tests

JIRA: https://jira.spring.io/browse/INT-3593

Sort the files for the MPUT tests.

INT-2166: Add SecurityContext Propagation

JIRA: https://jira.spring.io/browse/INT-2166

* Introduce `ThreadStatePropagationChannelInterceptor` based on the `ExecutorChannelInterceptor`
* Add `SecurityContextPropagationChannelInterceptor`,`SecurityContextCleanupChannelInterceptor`
* Introduce `AbstractExecutorChannel` to utilize `ExecutorChannelInterceptor` logic
* Introduce `MessageHandlingTaskDecorator` to avoid package tangle from `dispatcher` and `channel`
* Introduce `SecurityContextCleanupAdvice` for those cases when we don't get deal with `MessageChannel`s already, but want to have proper way to cleanup `SecurityContext`
* Make `GlobalChannelInterceptorProcessor` as `SmartInitializingSingleton` to avoid `phase` conflicts.
* Fix `MessagingAnnotationPostProcessor` to use `beanFactory.initializeBean(endpoint, endpointBeanName);` instead of manual `start()` invocation bypassing the `phase` logic, hence having a bug, when endpoints have been started very early
* Optimise `AbstractPollableChannel` to use `size` field from `ChannelInterceptorList` instead of `size()` from `Collection<?>`
* Fix `AnnotatedEndpointActivationTests` extracting separate component for annotation configuration instead of using test class directly. This caused very late Messaging Annotations process on that class
* Fix typo in the `spring-integration-jdbc-4.2.xsd`
* Remove some `SOUT`s throughout the project

TODO Docs

PR Comments:

* Remove redundant `AbstractExecutorChannel#executorInterceptors` and make logic based on the `super.interceptors`
 * Fix wrong imports order
 * JavaDocs for `ThreadStatePropagationChannelInterceptor`
 * Docs for `SecurityContext` propagation

Doc Polishing

Address PR comments

Address PR comments

* Extract `ExecutorChannelInterceptor` logic in the `PollingConsumer`
to have an ability to invoke `afterMessageHandled()` on the TaskScheduler's Thread
for example for the `SecurityContext` clean up
* Get rid of all that redundant "clean up" stuff
* Docs polishing

Fix `NPE` in the `PollingConsumer`

Introduce `ExecutorChannelInterceptorAware` to avoid iterators on each message

Polishing; Docs, Sonar
2015-08-03 09:33:23 -04:00
Artem Bilan
aa43109009 INT-3702: Compatibility with Spring Security 4.0
JIRA: https://jira.spring.io/browse/INT-3702
2015-04-17 16:32:44 +01:00
Artem Bilan
b6cfd4fa76 INT-3663: Fix Early BF Access for Security Module
JIRA: https://jira.spring.io/browse/INT-3663

Previously the `ChannelSecurityInterceptorBeanPostProcessor` was populated with direct `BeanDefinition`s for `ChannelSecurityInterceptor`s.
It caused an `early access to BeanFactory`.
The issue has been introduced by the `ChannelSecurityInterceptorFactoryBean`

* Rework `SecurityIntegrationConfigurationInitializer` do not populate `BeanDefinition`s to the `ChannelSecurityInterceptorBeanPostProcessor`, but just `bean names`
* Redesign `ChannelSecurityInterceptorBeanPostProcessor` to the `AbstractAutoProxyCreator`
* Introduce `SecuredChannel` annotation to be used on the `@Bean` level for `MessageChannel` definition
* Move `access policy` mapping to the `SecuredChannel` annotation

Address PR comments

Document `@SecuredChannel` annotation
2015-04-16 14:24:35 +01:00
Artem Bilan
542fc4fb5e INT-3539: Fix ChannelSecurityInterceptorBPP
JIRA: https://jira.spring.io/browse/INT-3539

Previously the `ChannelSecurityInterceptorBeanPostProcessor` eagerly loaded all beans from its `afterPropertiesSet`
to retrieve the `ChannelSecurityInterceptor`s. According to the `BeanPostProcessor` nature the `afterPropertiesSet` hook isn't legitimate.
It may cause some bad side-effects for other beans, which might not been initialized yet.

Rework `ChannelSecurityInterceptorBeanPostProcessor` to accept `Collection<ChannelSecurityInterceptor>` in the ctor.
Rework `SecurityIntegrationConfigurationInitializer` to iterate over `BeanDefinition`s to determine those of them, which
are `ChannelSecurityInterceptor` or `ChannelSecurityInterceptorFactoryBean`.

**Cherry-pick to 4.0.x**
2014-10-29 11:02:38 +02:00
Artem Bilan
e3f8ef534b INT-3331: Add ChannelSecurityInterceptorFB
JIRA: https://jira.spring.io/browse/INT-3331

INT-3331: PR comments and others

* Register `ChannelSecurityInterceptorBeanPostProcessor` as a `BeanDefinition` (not `BPP`)
* Get `ChannelSecurityInterceptor`s from `ChannelSecurityInterceptorBeanPostProcessor#afterPropertiesSet()`
* Make `ChannelSecurityInterceptor` `final` to disallow to subclass it for unexpected issues
* Provide more convenience to the `ChannelSecurityInterceptorFactoryBean` - to allow to use it from xml configuration

Doc Polishing
2014-03-27 14:06:35 -04:00
Artem Bilan
97c270c0e2 INT-3330 EnableIntegrationMBeanExport Annotation
JIRA: https://jira.spring.io/browse/INT-3330

INT-3330: Enable SpEL evaluation

INT-3330: Polishing for `MBeanExporterHelper`

INT-3330: Fix `errorChannel` early access

INT-3330: Polishing according PR comments

Polishing - copyrights, author, docs
2014-03-27 12:53:20 -04:00
Artem Bilan
ea080e8a9b INT-3284: Add 'spring.factories' Infrastructure
JIRA: https://jira.springsource.org/browse/INT-3284

* Introduce `IntegrationConfigurationBeanFactoryPostProcessor`, `IntegrationConfigurationInitializer`
* Apply `IntegrationConfigurationInitializer` and 'spring.factories' for HTTP and Security modules

INT-3284: Address PR's comments

JIRA: https://jira.springsource.org/browse/INT-3287

* Fix package tangle (INT-3287)
* Apply `IntegrationConfigurationInitializer` for `MBeanExporterHelper`
* Previously, there was a separate `ChannelSecurityInterceptorBeanPostProcessor`
for each `ChannelSecurityInterceptor` whereas now, there is one `ChannelSecurityInterceptorBeanPostProcessor`
that processes all interceptors

INT-3284 Refactoring around config package tangle
2014-02-06 11:58:23 -05:00
Gary Russell
ca0bddffbd INT-3245 Remove SI ChannelInterceptor
Replace with the same class from spring-messaging.

JIRA: https://jira.springsource.org/browse/INT-3245
2013-12-17 16:52:12 -05:00
Gary Russell
feec3eaf84 Merge remote-tracking branch 'upstream/master' into 4.0.0-WIP
Conflicts:
	build.gradle
	spring-integration-amqp/src/main/java/org/springframework/integration/amqp/channel/AbstractSubscribableAmqpChannel.java
	spring-integration-core/src/main/java/org/springframework/integration/channel/ExecutorChannel.java
	spring-integration-event/src/main/java/org/springframework/integration/event/inbound/ApplicationEventListeningMessageProducer.java
	spring-integration-file/src/test/java/org/springframework/integration/file/recursive/FileInboundChannelAdapterWithRecursiveDirectoryTests.java
	spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpConnectionEventListeningMessageProducer.java
	spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcOutboundGatewayWithNamespaceIntegrationTests.java
	spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcOutboundGatewayParserTests.java
	spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/StoredProcInvalidConfigsTests.java
	spring-integration-jms/src/main/java/org/springframework/integration/jms/SubscribableJmsChannel.java
	spring-integration-jpa/src/test/java/org/springframework/integration/jpa/outbound/JpaOutboundGatewayIntegrationTests.java
	spring-integration-redis/src/main/java/org/springframework/integration/redis/channel/SubscribableRedisChannel.java
	spring-integration-security/src/test/java/org/springframework/integration/security/SecurityTestUtils.java
	spring-integration-xml/src/main/java/org/springframework/integration/xml/selector/XmlValidatingMessageSelector.java

Resolved.
2013-12-06 14:23:23 -05:00
Gary Russell
5f555e31b3 INT-3218 Spring 4 Compatibility
Use `Arrays.asList()` instead of `Collections.arrayToList()` in
places where a generic type needs to be supplied by the caller.

This maintains compile-time compatibility with both Spring 3 and 4,
where Spring 4 added the generic type to the utility class.

The four occurrences where this was needed are not impacted
by the fact that `Arrays.asList()` returns an unmodifiable list.
2013-11-26 17:32:20 -05:00
Gary Russell
6fd8d1dba7 Update to Spring 4 Build Snapshot
- IdGenerator package change
- Generics added to CollectionUtils.arrayToList()
2013-11-26 09:28:41 -05:00
Gary Russell
7dcd2b5fe9 Remove SI GenericMessage
- Deprecate for now to ease XD migration.
2013-10-24 09:46:30 -04:00
Andy Wilkinson
28ab8394de Build on top of Spring 4's new messaging types
This commit updates Spring Integration to depend upon Spring 4, making
use of the message types that have moved from Spring Integration into
Spring's new spring-messaging module.

The default message converter no longer supports conversion of a
message that is null, throwing an IllegalArgumentException if an
attempt is made to convert null. Furthermore, GenericMessagingTemplate
does not support sending null, again throwing an
IllegalArgumentException. Previously, MessagingTemplate had no-oped an
attempt to send null.

ConcurrentAggregatorTests and AggregatorTests both had a single test
that was specifically testing the behaviour of an aggregator that
returns null for its message. These tests have been removed.

CorrelatingMessageHandlerTests have been updated to specify some
additional behaviour for its mocks so that null messages are not
returned.

These are the only functional changes that have been made. All other
changes are simply for moving to the repackaged and/or renamed types.

In the move to being part of core Spring, a number of constants and
header accessor methods have moved from MessageHeaders to
MessageHeaderAccessor. This commit continues this pattern for
the enterprise integration headers that are specific to Spring
Integration. A new class, EiMessageHeaderAccessor, has been created.
This class provides constants and methods for working with SI-specific
headers. The main code and tests have been updated to use this new
class.
2013-10-08 16:42:22 -04:00
Mark Fisher
2b5957a45c avoiding deprecation warnings in test code 2011-12-13 22:17:07 -05:00
Mark Fisher
2fc4abfaed refactored test code for compatibility with Spring Security 3.1
updated pom
2011-12-12 16:12:44 -05:00
Mark Fisher
423c6c860d versionless schemas for security module 2011-10-10 13:43:09 -04:00
Mark Fisher
7a16548f50 updating names to match refactoring: securityMetadataSource instead of objectDefinitionSource 2010-11-15 18:19:57 -05:00
Oleg Zhurakousky
3f390274db INT-1408, added changes based on Luke's comments 2010-09-03 13:32:15 +00:00
Oleg Zhurakousky
84b00a2862 INT-1408 fixed the issue with ConfigAttributes related to upgrading to Spring Security 3 2010-09-02 18:52:59 +00:00
Mark Fisher
3b15a0dd38 INT-1390 moved MessageBuilder into the 'support' package, moved GenericMessage and ErrorMessage into the 'message' package 2010-08-31 02:51:27 +00:00
Mark Fisher
7c1ab04cd5 INT-1390 Refactoring: moved MessageChannel to the root package, and moved ChannelResolver and BeanFactoryChannelResolver into a new 'suport.channel' package 2010-08-31 01:53:45 +00:00
Mark Fisher
9ca348da6c INT-1389 removed all dependencies on StringMessage from unit tests in spring-integration-security 2010-08-30 18:59:49 +00:00
Mark Fisher
3f00c75740 INT-1129 moved StringMessage from 'message' to 'core' (we might remove it before 2.0...) 2010-07-28 15:22:33 +00:00
Mark Fisher
4de9a23357 INT-1129 moved Message and MessageHeaders from 'core' to the root (org.springframework.integration) 2010-07-28 15:05:50 +00:00
Mark Fisher
94938a2746 INT-1129 moved MessageHandler from 'message' to 'core' 2010-07-28 14:54:09 +00:00
Mark Fisher
b3b4f58ec8 INT-1129 moved MessageSelector from 'selector' to 'core' 2010-07-28 14:45:03 +00:00
Oleg Zhurakousky
aed4b3bc26 INT-1115 upgraded si-security module to use Spring Security 3.0.2 2010-07-20 21:12:01 +00:00
Chris Beams
e5219dfe8f eliminated all compiler warnings throughout all projects
updated pom to emit compiler warnings so that any new ones become obvious
added serialVersionUID to classes that could reasonably need to be serialized (GenericMessage, MessageHeaders, etc)
@SuppressWarnings("serial") on all others
@SuppressWarnings("unused") on private static classes used as spring beans for testing (their methods never get called from java)
eliminated all redundant casting
introducted generics metadata where raw types were still being used
changed public API on several FactoryBeans (by adding <Type> information to 'implements FactoryBean' clause)
2010-05-25 23:18:25 +00:00
Chris Beams
c08a7a657e renamed modules org.springframework.integration.* -> spring-integration-*
@Ignore'd SimpleTcpNetOutboundGatewayTests#testOutboundClose() to avoid failure; this failure is correlated to the module name change, but hard to understand how it would be caused by it
2010-05-25 13:21:25 +00:00