Commit Graph

9288 Commits

Author SHA1 Message Date
Spring Buildmaster
173daaec61 [artifactory-release] Release version 5.0.11.RELEASE 2019-01-10 22:00:56 +00:00
Artem Bilan
27aafae01b Prepare for release; upgrade dependencies 2019-01-10 16:32:22 -05:00
Artem Bilan
270fd78cea Allow XML components injection
**Cherry-pick to 5.0.x & 4.3.x**

* Polishing after rebase
* Copyright to 2019

* Rebase and update according upstream deps
* Do not rely on `spring-web` in classpath: use `ClassUtils.forName()`
to load `ServletContextResource` class for checking

# Conflicts:
#	build.gradle
#	spring-integration-xml/src/main/java/org/springframework/integration/xml/selector/XmlValidatingMessageSelector.java
#	spring-integration-xml/src/main/java/org/springframework/integration/xml/transformer/XsltPayloadTransformer.java
#	spring-integration-xml/src/main/java/org/springframework/integration/xml/xpath/XPathUtils.java
#	spring-integration-xml/src/test/java/org/springframework/integration/xml/transformer/XsltPayloadTransformerTests.java
2019-01-10 15:13:22 -05:00
Artem Bilan
565578b392 RemoteFileTemplate: Fix Checkstyle violation
* Add `if (session != null)` in the `RemoteFileTemplate` around `dirty()`

(cherry picked from commit 1d5e66b0ee)
2019-01-10 11:05:55 -05:00
Alen Turkovic
f63abc161a Custom Session dirty logic
Fixes spring-projects/spring-integration#2687

Allows any session to implement its dirty logic.

* License year was not updated

**Cherry-pick to 5.0.x**

# Conflicts:
#	spring-integration-file/src/main/java/org/springframework/integration/file/remote/session/Session.java
2019-01-10 10:55:27 -05:00
Gary Russell
23fb52cd20 Upgrade Spring Framework to 5.0.12 2019-01-09 12:07:23 -05:00
Gary Russell
8f34d04dcc Upgrade Jackson version 2019-01-04 16:04:12 -05:00
Artem Bilan
d5dd0a1240 INT-4570: Add MessageCollectionCallback for Mongo (#2675)
* INT-4570: Add MessageCollectionCallback for Mongo

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

The `MongoDbOutboundGateway` is intended to be used with the
`requestMessage` context, however using a plain `CollectionCallback`
we don't have access to the `requestMessage`

* Deprecate `CollectionCallback` usage in favor of newly introduced
`MessageCollectionCallback` and `message-collection-callback` for XML

**Cherry-pick to 5.0.x**

* * Remove `message-collection-callback` in favor of
`MessageCollectionCallback<T> extends CollectionCallback<T>`

* * Rename a new setter to `setMessageCollectionCallback()` to avoid
reflection collision

# Conflicts:
#	spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/outbound/MongoDbOutboundGateway.java
#	spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbOutboundGatewayParserTests.java
#	spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/dsl/MongoDbTests.java
#	spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/outbound/MongoDbOutboundGatewayTests.java
#	spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/rules/MongoDbAvailableTests.java
#	src/reference/asciidoc/mongodb.adoc
2018-12-21 17:28:56 -05:00
Artem Bilan
ae4b3fffb2 Increase expire period for testExpireTwoRegistries
https://build.spring.io/browse/INT-MASTER-1313/

**Cherry-pick to 5.0.x**

(cherry picked from commit 89fdb938de)
2018-12-14 11:53:49 -05:00
Artem Bilan
0199741d29 RedisLock: Throw exception from unlock on expire (#2661)
* RedisLock: Throw exception from unlock on expire

The lock might be expired in target Redis store in between `lock()` and
`unlock()`.
So, throw an `IllegalStateException` when lock is expired during
unlocking.
At the same time the lock lock is unlocked anyway.

**Cherry-pick to 5.0.x**

* * Create a new test for exception
* Add more info into the exception
2018-12-14 11:39:13 -05:00
Artem Bilan
a3dc10b405 Fix Javadocs in the MessageGroupQueue 2018-12-06 16:45:00 -05:00
Artem Bilan
15024858d4 INT-4565: Fix IntComponentScan for profiles (#2652)
* INT-4565: Fix IntComponentScan for profiles

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

* Propagate an `Environment` to the internal `ClassPathScanningCandidateComponentProvider`
in the `IntegrationComponentScanRegistrar` for proper profiles activation
* Ensure the logic works in the `GatewayInterfaceTests`
* Some polishing and performance improvement for the `GatewayInterfaceTests`
* Add a note about `@Profile` in the `gateway.adoc`
* Polishing for the `gateway.adoc`

**Cherry-pick to 5.0.x & 4.3.x**

* * Add not activated by profile gateway interface into the `GatewayInterfaceTests`
* More `GatewayInterfaceTests` polishing
* Fix typo in the `gateway.adoc`

* Fix Checkstyle violation

# Conflicts:
#	spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayInterfaceTests.java
#	src/reference/asciidoc/gateway.adoc
2018-12-06 16:10:24 -05:00
Gary Russell
7a2547f601 INT-4564: ACMH: Fix erroneous error log
JIRA: https://jira.spring.io/browse/INT-4564

INT-4550 added an error log when multiple ACMHs were registered with the
same store; the error log logic was incorrect and the error was logged
when the first ACMH was registered.

(cherry picked from commit 9832f61d2a)
2018-12-04 15:16:20 -05:00
Gary Russell
be6498008f INT-4553: Store-backed QueueChannel improvements
JIRA: https://jira.spring.io/browse/INT-4553
Fixes https://github.com/spring-projects/spring-integration/issues/2628
Fixes https://github.com/spring-projects/spring-integration/issues/2629

- Avoid `size()` calls on the MGS, use `poll()` instead.
- Optimize the indexes for the `INT_CHANNEL_MESSAGE` table.

Avoid size call when no timeout too.

Polishing - PR Comments

Missed a doc fix

Another missed %PREFIX%

Fix underscores

Polishing; PR comments; make MGQ extendable.

Fix version in doc.

* Polishing `@since`
* Use diamonds whenever it is possible

**Cherry-pick to 5.0.x**

# Conflicts:
#	src/reference/asciidoc/jdbc.adoc
#	src/reference/asciidoc/whats-new.adoc
2018-11-30 13:16:39 -05:00
Spring Buildmaster
7f8a81b22f [artifactory-release] Next development version 2018-11-28 20:10:36 +00:00
Spring Buildmaster
0fd9321ec8 [artifactory-release] Release version 5.0.10.RELEASE 2018-11-28 20:10:33 +00:00
Gary Russell
3e0a3fa317 INT-4560: Fix Race in FileSystemPersistentAOFLF
JIRA: https://jira.spring.io/browse/INT-4560

Reproduced and tested with

```java
@SpringBootApplication
public class So53521593Application {

	private static final Logger logger = LoggerFactory.getLogger(So53521593Application.class);

	public static void main(String[] args) {
		SpringApplication.run(So53521593Application.class, args);
	}

	@Bean
	public IntegrationFlow flow() {
		ExecutorService exec = Executors.newFixedThreadPool(10);
		return IntegrationFlows.from(Files.inboundAdapter(new File("/tmp/foo")).filter(
					new MyFilter(new SimpleMetadataStore(), "foo")),
						e -> e.poller(Pollers.fixedDelay(5, TimeUnit.SECONDS)
								.maxMessagesPerPoll(10)))
				.channel(MessageChannels.executor(exec))
				.<File>handle((p, h) -> {
					try {
						p.delete();
						logger.info(p.toString());
						Thread.sleep(10_000);
					}
					catch (InterruptedException e1) {
						Thread.currentThread().interrupt();
					}
					return null;
				})
				.get();
	}
}

class MyFilter extends FileSystemPersistentAcceptOnceFileListFilter {

	public MyFilter(ConcurrentMetadataStore store, String prefix) {
		super(store, prefix);
	}

	@Override
	protected long modified(File file) {
		long modified = super.modified(file);
		System.out.println(modified);
		return modified;
	}

}
```

**cherry-pick to 5.0.x, 4.3.x**

(cherry picked from commit 39fef2c70a)

* Upgrade to Spring Security `5.0.10`
2018-11-28 14:27:06 -05:00
Artem Bilan
9d276ce95d Upgrade versions 2018-11-27 13:22:01 -05:00
Gary Russell
8f5154f88e Upgrade to SF 5.0.11.BS 2018-11-25 18:26:44 -05:00
Artem Bilan
20ed93a8d8 Optimize type conversion in LambdaMessageProcessor 2018-11-20 16:11:26 -05:00
Gary Russell
ffaa4ee780 Log error for class cast exception on lambda
**cherry-pick to 5.0.x**

* Fix test

* Polish log message.

* Polishing - docs and javadocs.

# Conflicts:
#	spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowDefinition.java
2018-11-19 16:58:51 -05:00
Artem Bilan
47a4b28f1f INT-4556: Fix messaging anns for FactoryBeans
JIRA: https://jira.spring.io/browse/INT-4556

We definitely need to resolve a `@Bean` method to the target object to
be sure do not create a new `MessageHandler` bean.

**Cherry-pick to 5.0.x**
2018-11-19 13:41:37 -05:00
Artem Bilan
d1b3046638 INT-4550: Disallow multi aggregators on same MGS (#2622)
* INT-4550: Disallow multi aggregators on same MGS

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

**Cherry-pick to 5.0.x**

* * Introduce `UniqueExpiryCallback`
* Use `UniqueExpiryCallback` in the `AbstractCorrelatingMessageHandler`
* Check for uniqueness in the `AbstractMessageGroupStore`
* Remove duplicate code in the `ConfigurableMongoDbMessageStore`

* * Fix tests according a new logic

* * Address PR review

* Change `Assert.isTrue` to the `logger.error` for backward compatibility
* Revert changes in tests since we don't throw exception anymore
* Fix language on doc

* * Fix Checkstyle violation in the `AbstractMessageGroupStore`

* * Ignore `testDontReapMessageOfOtherHandler()`
2018-11-15 15:02:28 -05:00
Gary Russell
1e8da3a940 INT-4552: UDP: Catch and log async send exceptions
JIRA: https://jira.spring.io/browse/INT-4552

**Cherry-pick to 5.0.x**

(cherry picked from commit ce3ac36dcd)
2018-11-13 12:05:29 -05:00
Artem Bilan
5dff882f5e INT-4551: Fix exception msg from previous commit
JIRA: https://jira.spring.io/browse/INT-4551

**Cherry-pick to 5.0.x**

(cherry picked from commit 1dca553850)
2018-11-08 14:53:52 -05:00
Artem Bilan
ce42e56d7e INT-4551: Fail if old Java DSL jar is present
JIRA: https://jira.spring.io/browse/INT-4551

**Cherry-pick to 5.0.x**
2018-11-08 13:53:52 -05:00
Artem Bilan
6d523e2a70 Fix RotatingServersTests concurrency
https://build.spring.io/browse/INT-FATS5IC-685/

Even if we stop `SourcePollingChannelAdapter`, the task on the fly is
still going to be executed.
This way we may have extra calls to our logic.

* Use `CopyOnWriteArrayList` for the `sessionSources` to avoid
`ConcurrentModificationException` during this collection read in the
tests

**Cherry-pick to 5.0.x**

(cherry picked from commit 76c670075b)
2018-11-07 10:47:05 -05:00
Artem Bilan
0418b7cbdc INT-4545: Fix RPMHWrapper registration for `@SA
JIRA: https://jira.spring.io/browse/INT-4545

Improve the logic in the `AbstractMethodAnnotationPostProcessor` to
check for existing `MessageHandler` and be sure that we need to register
a `ReplyProducingMessageHandlerWrapper` bean

**Cherry-pick to 5.0.x**
2018-10-19 09:11:30 -04:00
Gary Russell
e3c4175187 INT-4546: Expose IMAP cancel interval via DSL
JIRA: https://jira.spring.io/browse/INT-4546

(cherry picked from commit 743afafa97)
2018-10-16 13:16:59 -04:00
Spring Buildmaster
ce78a26789 [artifactory-release] Next development version 2018-10-15 17:53:18 +00:00
Spring Buildmaster
95eda8c3d7 [artifactory-release] Release version 5.0.9.RELEASE 2018-10-15 17:53:13 +00:00
Artem Bilan
d50cdcd741 Upgrade Spring Security 5.0.8
(Mostly to bring fresh build for release process)
2018-10-15 13:06:52 -04:00
Artem Bilan
a598b6d4a2 Prepare for release 2018-10-15 12:08:43 -04:00
Gary Russell
32e221d499 SPR-17307: Fix event listener tests
JIRA: https://jira.spring.io/browse/SPR-17307

The event multicaster now saves singletons in `applicationListeners`
instead of adding the bean name to `applicationListenerBeans`.

**cherry-pick to 5.0.x**

# Conflicts:
#	build.gradle
2018-10-11 11:18:28 -04:00
Artem Bilan
490ae1b49b Some various polishing
* Add `RotatingServerAdvice.StandardRotationPolicy.getCurrent()` method
for better end-user experience when this class is extended
* Add NPE protection into the MQTT Channel Adapters.
Some code style polishing for them

**Cherry-pick to 5.0.x**
2018-10-10 15:27:14 -04:00
Artem Bilan
74f6c75884 INT-4535: Fix @SpringIntegrationTest for caching
JIRA: https://jira.spring.io/browse/INT-4535

For the proper Spring Test Context caching support, the `ContextCustomizer`
must implement `hashCode()` and `equals()` methods

* Add `hashCode()` and `equals()` into the `MockIntegrationContextCustomizer`
* Ensure that caching works as excepted with the
`CachedSpringIntegrationTestAnnotationTests` its two sub-classes

**Cherry-pick to 5.0.x**
2018-10-10 13:01:42 -04:00
Artem Bilan
5874ae8ec4 INT-4543: JacksonJsonObjectMapper: fix toJsonNode (#2592)
* INT-4543: JacksonJsonObjectMapper: fix toJsonNode

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

When inbound payload is type of `String`, `byte[]`, `File`, `URL`,
`InputStream` or `Reader`, we have to use an `ObjectMapper.readTree()`
function.
For all other types the `valueToTree()` should be used as a fallback

**Cherry-pick to 5.0.x**

* * Fallback to the `valueToTree()` if not valid JSON

* * Fallback to `valueToTree()` only for `String` and `byte[]`
2018-10-10 12:24:06 -04:00
Gary Russell
993c6edc57 GH-2471: Close client on outbound adapter
Resolves https://github.com/spring-projects/spring-integration/issues/2471
2018-10-10 11:51:07 -04:00
Gary Russell
c111e1be6a JMX: Quote object name values if not identifiers
https://www.oracle.com/technetwork/java/javase/tech/best-practices-jsp-136021.html

The set of characters in a value is also limited. If special characters may
occur, it is recommended that the value be quoted, using ObjectName.quote. If
the value for a given key is sometimes quoted, then it should always be quoted.
By default, if a value is a string (rather than a number, say), then it should
be quoted unless you are sure that it will never contain special characters.

Practically, some special characters are allowed, but we will standardize on
allowed characters in java identifiers.

In 5.0.x, this is enabled using `spring.integration.properties`.
2018-10-09 16:15:47 -04:00
Gary Russell
7403e36c1e INT-4541: Fix Reactive MessagingGateway Errors
JIRA: https://jira.spring.io/browse/INT-4541

Add test case to reproduce.

The gateway correctly sets up the `errorChannel` header so that a downstream
`MPEH` will send exceptions back to the gateway, but the `map()` function
did not check for an error message.

Check for an error message and throw the payload so that the `onErrorResume`
will route to the error channel.

# Conflicts:
#	spring-integration-webflux/src/test/java/org/springframework/integration/webflux/dsl/WebFluxDslTests.java
2018-10-08 17:50:55 -04:00
Artem Bilan
7faeee849d INT-4538: Fix Splitter for ArrayNode.size()
JIRA: https://jira.spring.io/browse/INT-4538

* Add support for Jackson `TreeNode.size()` in the `AbstractMessageSplitter`
* Add overloaded `Transformers.toJson(ObjectToJsonTransformer.ResultType)`
* Modify test to verify Jackson `ArrayNode` use-case with the splitter
and aggregator

**Cherry-pick to 5.0.x**
2018-10-08 10:10:00 -04:00
Artem Bilan
3a7a14140b INT-4539: Fix Java DSL for prototype beans
JIRA: https://jira.spring.io/browse/INT-4539

The `IntegrationFlowBeanPostProcessor` doesn't check for prototype beans
and just override them in the application context with the singletons

* Since we can't in the DSL understand if provided object is a prototype
or not, we try to check for its bean definition by possible bean name.
Use `NamedComponent` for possible bean name to check.
* Remove `final` from the `IntegrationComponentSpec.get()` since its
result is not visible for CGI proxies when it is declared as a `@Bean`
and subsequent `getObject()` produces a new internal object
* Verify prototype beans with new test in the `IntegrationFlowTests`

**Cherry-pick to 5.0.x**
2018-10-06 19:35:53 -04:00
Artem Bilan
11fcda4728 INT-4537: Fix RSConsumer for MockIntegrationCtx
JIRA: https://jira.spring.io/browse/INT-4537

Fixes spring-projects/spring-integration#2582

* Rename `ReactiveStreamsConsumer.messageHandler` property to the
`handler` for consistency with other `IntegrationConsumer` s
* Do not wrap `Subscriber` into the `MessageHandler` if that one is
already a `MessageHandler`
* Fix `MockIntegrationContext` for the logic around `ReactiveStreamsConsumer`
where it is not enough just replace a `handler`, but we also need to do
that with the `subscriber`.
Luckily the `MockMessageHandler` is also a Reactive `Subscriber`
* Clean up `MockIntegrationContext.beans` in the end of `resetBeans()`
* Improve `testing.adoc`

**Cherry-pick to 5.0.x**
2018-10-05 14:42:29 -04:00
Artem Bilan
3644c058fa RemoteFTempl: InputStream.close() in the finally
If exception happens in the `callback.doWithInputStream(inputStream)`,
we don't close the `inputStream = session.readRaw(remotePath)`.

* Move the `InputStream.close()` to the `finally` block of the
`SessionCallback` action in the `RemoteFileTemplate.get()`

**Cherry-pick to 5.0.x and 4.3.x**
2018-10-05 12:18:35 -04:00
Michael Forstner
d9f0672df2 INT-4531: Use Object type KeyDirectory.key
JIRA: https://jira.spring.io/browse/INT-4531

The `DelegatingSessionFactory` uses plain `Object` as key type
whereas the default `RotatingServerAdvice` does not.

* Change the type from `String` to `Object` in the `RotatingServerAdvice.KeyDirectory`
* Fix typos in the (s)ftp.adoc

**Cherry-pick to 5.0.x**

(cherry picked from commit 5bfd6971db)
2018-09-14 12:50:51 -04:00
Spring Buildmaster
35bb705ae5 [artifactory-release] Next development version 2018-09-10 17:48:53 +00:00
Spring Buildmaster
777eb730b8 [artifactory-release] Release version 5.0.8.RELEASE 2018-09-10 17:48:46 +00:00
Gary Russell
04fb209489 Upgrade to SF 5.0.9.RELEASE 2018-09-10 13:12:35 -04:00
Artem Bilan
382c5dfe6c Fix RotatingServersTests race condition
https://build.spring.io/browse/INT-MASTERSPRING40-458/

We need to stop Inbound Channel Adapter first and only then wait for
the latch.
Otherwise there is a chance that new item is added to the collection
in between `latch.await()` and `stop()`

**Cherry-pick to 5.0.x**

(cherry picked from commit 21338d1934)
2018-09-08 17:45:12 -04:00
Manuel Jordan Elera
cbfadcdf61 GH-2559: Fix InboundChannelAdapter's javadoc
Resolves https://github.com/spring-projects/spring-integration/issues/2559

* Fixed minor typo that does not let generate the expected javadoc
for a attribute/method

**Cherry-pick to 5.0.x**

(cherry picked from commit cdf2ced153)
2018-09-06 14:08:45 -04:00