Commit Graph

8164 Commits

Author SHA1 Message Date
Artem Bilan
ddcca027f1 RedisStoreTest: increase timeouts 2015-12-14 12:02:18 -05:00
Artem Bilan
69c98c4aad INT-3909 @Ignore ClientWebSocketContainerTests
https://jira.spring.io/browse/INT-3909
2015-12-14 11:37:28 -05:00
Artem Bilan
7da183f8ed INT-3834: Upgrade to Smack-4.1.5
JIRA: https://jira.spring.io/browse/INT-3834
2015-12-09 12:09:25 -05:00
Gary Russell
0fc1f555e7 Test FTP Server - Let OS Choose Port 2015-12-09 11:29:06 -05:00
Artem Bilan
c810aaae12 INT-3897: Fix deadlock in the StompMessageHandler
JIRA: https://jira.spring.io/browse/INT-3897

The `StompMessageHandler` synchronized on the `sessionHandler` during `connectIfNecessary()`
performing mutually exclusive connect operation in the `StompSessionManager`.
Since the last one synchronizes on all `sessionHandler`s during its own operations, we end up with the deadlock
waiting for the `connectSemaphore`.

Change synchronization monitor object to the `connectSemaphore` accomplishing the same desired mutually exclusive connect logic
in the `StompMessageHandler`.

**Cherry-pick to 4.2.x**
2015-12-09 10:50:53 -05:00
Artem Bilan
5bc3208096 INT-3832: Upgrade to JsonPath-2.1.0
JIRA: https://jira.spring.io/browse/INT-3832
2015-12-08 19:30:44 -05:00
Artem Bilan
cf528c0b5d INT-3665: Remove Deprecations and Resolve Issues
https://jira.spring.io/browse/INT-3665

Fixes according Travis report

Introduce `...ExpressionString(String)` setter

Some further fixes and polishing

Address PR comments
2015-12-08 16:48:29 -05:00
Artem Bilan
84fdd98428 INT-3904: Fix NPE in the JsonPropertyAccessor
JIRA: https://jira.spring.io/browse/INT-3904

When we use the same expression several times, the SpEL engine cache an `accessor` after the first use.
The next evaluation just bypass `canRead()` and in case of JSON that mean that we don't check that the income has the field or not.
For this case the `read()` must return `TypedValue.NULL` instead of just `null`.
2015-12-08 15:55:54 -05:00
Gary Russell
d16cd9748c INT-799: Remove Core Deps from s-i-test
JIRA: https://jira.spring.io/browse/INT-799

Some test classes (e.g. `TestUtils`) were duplicated in core to avoid cyclic
dependency.

Now that core messaging has been moved to spring-messaging, it is possible
to remove the dependencies on `spring-integration-core` from `spring-integration-test`.

A few minor test cases have been moved to `spring-integration-core`.

The simple polishing to the `build.gradle` and `ServiceActivatorOnMockitoMockTests`
2015-12-07 20:39:00 -05:00
Gary Russell
5850022bfe Fix Python Scripting Javadoc 2015-12-07 15:48:57 -05:00
Gary Russell
255247ca9a Code Polishing (Sonar)
- remove redundant modifiers
- overridable methods called from ctors

Polishing - PR Comments
2015-12-07 15:39:13 -05:00
Gary Russell
ddb4321e1d INT-3900: Fix Doc
QOS > 0, not > 1.
2015-12-07 14:23:04 -05:00
Gary Russell
9fff767f71 INT-3900: MQTT: Don't Unsubscribe if !cleanSession
JIRA: https://jira.spring.io/browse/INT-3900

The message-driven adapter should not unsubscribe if `cleanSession` is
`false`.

INT-3900: MQTT: Changes for 4.3 Only

Doc Polishing
2015-12-07 14:10:24 -05:00
Gary Russell
e3d6f3fb6c INT-3884: Javadoc Fixes 2015-11-29 20:39:09 -05:00
Gary Russell
396b9146d2 JMS Test Polishing 2015-11-26 13:29:24 -05:00
Gary Russell
4ff19def3f Router Doc Polishing - Formatting 2015-11-26 12:14:00 -05:00
Artem Bilan
51b161ae4d INT-3534:MethodInvokingMLP Don't Copy Collection
JIRA: https://jira.spring.io/browse/INT-3534

Previously the `MethodInvokingMessageListProcessor` copied `Collection<Message<?>>`
in its `process()` method for the `delegate` to a new `Collection` unconditionally.

To improve performance, the collection is no longer copied unconditionally
in the `ExpressionEvaluatingMessageGroupProcessor`.

Also add an `important` note to the `aggregator.adoc` about the restriction with `unmodifiableCollection`.
2015-11-24 14:45:59 -05:00
Artem Bilan
15e2187fd2 INT-2787: Map correlationId to JMS Property
JIRA: https://jira.spring.io/browse/INT-2787

The `correlationId` is `UUID` object by default Framework behavior.
This type isn't allowed for JMS Message properties mapping.

Add the mapping for the `IntegrationMessageHeaderAccessor.CORRELATION_ID` header as a `String`,
since on the other side it simply can be converted to the `UUID` object back.
For example `AbstractCorrelatingMessageHandler` does that automatically on the correlation function using `UUIDConverter`.

The provided `SplitterAggregatorTests` demonstrates the scenario when we weren't be able to aggregate by the unsupported `UUID` type.

I don't consider this as back-port fix, because the same can be simply achieved with the custom `JmsHeaderMapper`.
From other side this fix maybe like some side-effect breaking change.

I don't consider any `UUID` message header as a candidate to be converted to String and mapped, because to do that unconditionally
may cause some undesired issues. From other side it can be done with the custom `JmsHeaderMapper` in the end-application.
2015-11-24 13:32:19 -05:00
Gary Russell
c0ca5a9b89 INT-3894: Polishing
Remove IPv4 from build.gradle.
Fix race for ackPort.
2015-11-24 11:35:43 -05:00
Gary Russell
b4218982da INT-3984: UDP: OS Selected Server Port
JIRA: https://jira.spring.io/browse/INT-3894

Allow UDP server port (and sender Ack port) to be selected by the operating system.

Also fix multicast tests to run on all platforms.

Change tests to use OS selected port.
2015-11-23 17:16:23 -05:00
Artem Bilan
1cc1b2ef79 INT-3895: Fix MonitorTests Race Condition
JIRA: https://jira.spring.io/browse/INT-3895

* `@Ignore` `DelayerUsageTests.testDelayWithCustomScheduler()` as very weak test. (We can consider it to remove at all: doesn't test anything from our side)
* Add `LogAdjustingTestSupport` diagnostic to the `OutboundGatewayFunctionTests`

Tentative commit to see more logs from Travis

Additional diagnostics

More STOMP Diagnostics
2015-11-23 15:02:10 -05:00
Gary Russell
fc0af2fed6 INT-3896: JMX: Fix Double Router MBean Export
JIRA: https://jira.spring.io/browse/INT-3896

Routers created by the `RouterFactoryBean` were not suppressed from being exported
by the context exporter when an `IMBE` is present.

Move the suppression logic to `postProcessAfterInitialization()` so the annotation on
the bean created by the factory bean is detected. The annotation is not detected on
the factory bean itself in `postProcessBeforeInitialization()`.
2015-11-21 13:07:02 -05:00
Artem Bilan
b621417380 INT-3893: UnicastReceivingChannelAdapter: fix NPE
JIRA: https://jira.spring.io/browse/INT-3893

Polishing

Send on the calling thread if the executor is shut down.
2015-11-20 10:52:07 -05:00
Artem Bilan
350355e362 Fix one more STOMP WebSocket test race condition
https://build.spring.io/browse/INT-B43-JOB1-7

We need to wait for the **real** `UNSUBSCRIBE` from server before go ahead.
2015-11-19 19:23:10 -05:00
Artem Bilan
e55a7b8234 Fix WebSocket tests the same way as STOMP before
See https://jira.spring.io/browse/INT-3888 and its PullRequest

Note: rework `StompIntegrationTests` logic to use SockJS Client (that was enabled on the server side before).
This helps us to use `sessionId` which is as a `user` key on subscription phase.
In case of Standard Tomcat WebSocket Client we end up with the race condition when both client and server uses the same
`static` variable in the `WsSession` class, so we can't determine the server session correctly by the id on the client side.
The subscribe/send/unsubscribe logic works well because we are based on the **web socket** for the session, independently of its id.
2015-11-19 18:11:35 -05:00
Gary Russell
73bc3fedf5 INT-3889: Fix AMQP PubSub Channel Test Race Cond.
JIRA: https://jira.spring.io/browse/INT-3889

The test case `pubSubLostConnectionTest` forces the connection closed and
then sends another message. It is testing recovery.

However, since the pub/sub queue is an auto-delete queue, we need to wait until
the new consumer is established and the queue exists, before sending the message after the test.
Otherwise, since the exchange is fanout, the message is simply dropped.

Also set `@DirtiesContext` on other tests.

Also remove non-tests.

I have __not__ removed the diagnostics because I don't believe this addresses AMQP-543.
2015-11-19 12:03:08 -05:00
Artem Bilan
c67cce1563 INT-3892: Make ExpRatioTests Thread.sleep()-free
JIRA: https://jira.spring.io/browse/INT-3892

 **Cherry-pick to 4.2.x**
2015-11-19 11:49:51 -05:00
Artem Bilan
c0d1277b55 INT-3888: Fix STOMP Test for Race Condition
JIRA: https://jira.spring.io/browse/INT-3888

Note sure yet what race condition we have in the `DefaultSubscriptionRegistry`,
but that looks for me better to follow with the standard `SubscriptionRegistry.findSubscriptions()`
to check subscription present, unless fail during `send()` because of `destinationLookup` early exit.

Fix for the `StompServerIntegrationTests`

Looks like we have to `reconnect()` for any `handleTransportError()` activity,
otherwise we are just hang in the Reactor's TCP reconnect loop without freeing resources
for other activities, e.g. start Embedded STOMP Broker.

Increase `receive` timeout in case of wait for the Broker Start
2015-11-19 08:55:13 -05:00
Gary Russell
f80c0db0df INT-3861: Mail Namespace Support for userFlag
JIRA: https://jira.spring.io/browse/INT-3861

Allow the custom `userFlag` to be configured using the namespace.

Polishing according PR comments
2015-11-18 18:12:00 -05:00
Gary Russell
33a40f6cae INT-3884: Outbound Gateway replyChannel in Chain
JIRA: https://jira.spring.io/browse/INT-3884

Previously, an outbound gateway within a chain allowed a `reply-channel` attribute
but it was ignored. The gateway's output channel is set to send the message to
the next element in the chain, or the chain's output channel if the gateway is
the last element.

Tighten the parser logic to detect and disallow a reply channel within a chain.

Polishing
2015-11-18 17:41:54 -05:00
Gary Russell
051b393ed0 Prepare Master for 4.3
Reference to 4.3

Refactor `what's new` for 4.3
2015-11-17 12:12:49 -05:00
Gary Russell
1fe50138f0 Fix JMX MonitorTests
MessagingTemplate had no timeout and could hang the build.

OnlyOneTrigger could fire before the message is sent; increase
the poller receive timeout so the poller thread blocks until the message is sent.
2015-11-16 16:55:11 -05:00
Gary Russell
dd8b5c2e72 INT-3889: spring-integration-amqp Logs: Add Thread 2015-11-16 15:34:03 -05:00
Spring Buildmaster
e4f1614d11 [artifactory-release] Next development version 2015-11-16 09:06:16 -08:00
Spring Buildmaster
184e888361 [artifactory-release] Release version 4.2.2.RELEASE 2015-11-16 09:06:09 -08:00
Gary Russell
9500d308a0 INT-3823: Fix EnableIntTests Race Condition
JIRA: https://jira.spring.io/browse/INT-3823

The test stops the endpoint.

The previous poller thread can 'steal' the `input` message, but since
it is interrupted, it can't send the message to the `publishedChannel`.

Add logic to wait until the previous poller has been interrupted in `receive()`.

Increase the endpoint `receiveTimeout` to ensure the thread will be interrupted.

Bump SF Version to 4.2.3

Remove `TRACE` logging from the `EnableIntegrationTests` since we have the fix already
Make some optimization around `@DirtiesContext`
2015-11-16 10:49:27 -05:00
Artem Bilan
0327666ca7 Fix RedisMessageGroupStore Tests: clean up DB
https://build.spring.io/browse/INT-B41-JOB1-493
2015-11-14 16:51:01 -05:00
Artem Bilan
9d8e2b61f6 Fixes for Sporadic Test Failures
* `ClientWebSocketContainer`: add some synchronization to avoid race conditions: https://build.spring.io/browse/INT-B41-492
* `TomcatWebSocketTestServer`: convert to `0` port to rely on the OS resolution for `localPort`
* Add `LogAdjustingTestSupport` for STOMP test
* `SftpServerTests`: use `0` port to rely on the OS resolution for `localPort`
* `ImapMailReceiver`, `OutboundGatewayFunctionTests` (JMS), `CachingClientConnectionFactoryTests`,
`AsyncGatewayTests`, `AsyncMessagingTemplateTests`, `GatewayParserTests`, `PriorityChannelTests`, `AggregatorIntegrationTests`: increase timeout
* `EnableIntegrationTests`: use `LogAdjustingTestSupport`
* `FileOutboundChannelAdapterParserTests`: rework `Thread.sleep()` with `CountDownLatch`
* `ConnectionToConnectionTests`: increase timeout and count iteration. Previously with `1sec` we may lose some events. And we can't just rely on the `10sec`,
because the last iteration will be so long
* `TcpOutboundGatewayTests`: `500ms` is so big timeout to wait for the `Exception` that in the high load environment we can yield to other Thread so long.
Like in our case to `server` Thread to send the reply for us. Therefore decrease the Exception timeout to the `50ms` and increase server delay to `2sec`
* `StompInboundChannelAdapterWebSocketIntegrationTests`: remove `@Qualifier("taskScheduler")` as a potential candidate to test against latest SF changes.
We're fine with `SF-4.2.2` and it is just a test-case. So, I don't see reason to wait for their fix here.

STOMP: `session = null` in adapters for any transportError

Polishing
2015-11-14 16:12:23 -05:00
Artem Bilan
e45bb36be2 Upgrade to AMQP-1.5.2
Add `@Qualifier("taskScheduler")` to the `StompInboundChannelAdapterWebSocketIntegrationTests`:
https://build.spring.io/browse/INT-B41-JOB1-491
2015-11-13 15:17:08 -05:00
Artem Bilan
b9730cd183 INT-3882: StompSession Reconnection Logic
JIRA: https://jira.spring.io/browse/INT-3882

Add reconnect support for the StompSession:
* Introduce `recoveryInterval` for the `AbstractStompSessionManager`
* Add reconnect scheduled task
* Add handling of the `ConnectionLostException` into the `AbstractStompSessionManager`,
as well as for the `StompInboundChannelAdapter` and `StompMessageHandler`
* Cover adapters reconnection feature with tests
* Documentation polishing

Rework logic according PR comments

* Make `StompMessageHandler` as a "lazy-load" for the connection
* Add "direct" connect interaction for the `AbstractStompSessionManager`
* Polishing tests

Polishing

Fix `StompAdaptersParserTests#testStompSessionManagerReconnect()` to use "fake" server port

Address PR comments

The further polishing

Some further polishing

* `AbstractStompSessionManager`: `reconnectFuture.cancel(true)` on each `scheduleReconnect()` to avoid something like "DDoS attack"
* Add reconnect feature test for the `StompInboundChannelAdapterWebSocketIntegrationTests`, closing and then refreshing again the `serverContext`
2015-11-13 14:19:18 -05:00
Gary Russell
f1bd6e3bac INT-3885: Fix JMS Outbound Gateway Concurrency
JIRA: https://jira.spring.io/browse/INT-3885

Possible dropped reply, causing timeout.

WARN org.springframework.integration.jms.JmsOutboundGateway#1.replyListener-1 jms.JmsOutboundGateway:1202
    - Failed to consume reply with correlationId 164a49bf-c41d-4c0b-b012-55deecf001d1_2
      java.lang.RuntimeException: No sender waiting for reply

- Reproduced by running the test in a loop
- Cleaned up test to aid debugging - capture a unique message at each stage
- Added additional debug logging to th gateway

Polishing
2015-11-13 10:56:11 -05:00
Gary Russell
e5269bb265 INT-3886: TCP Fix Socket Timeout: Raw Deserializer
JIRA: https://jira.spring.io/browse/INT-3886

An SO user reported a short message delivery when an NIO connection was timed out.

See JIRA for link.

We could not produce the problem with his deserializer but it did identify a problem
with the standard `ByteArrayRawSerializer`.

With NIO, socket timeouts were reported to the deserializer as a normal EOF (-1). This
caused the raw serializer to emit a short message - it's signal for end of message is the
socket closure.

We can't treat a timeout as a normal EOF.

If the socket is forcibly timed out due to no recent data, throw a `SocketTimeoutException` to
the deserializer.

Just in case the old behavior is being relied upon, a boolean has been added to restore that
behavior. This is not recommended, as using timeout to delimit messages is not reliable.

* Fix typos
* Increase `MongoDbInboundChannelAdapterIntegrationTests` timeouts
* Some code polishing
2015-11-12 21:35:03 -05:00
Artem Bilan
f0d0772397 Increase timeouts for DelayHandlerTests
https://build.spring.io/browse/INT-B41-487
2015-11-12 19:18:11 -05:00
Artem Bilan
febea4fe40 MQTT: Document Java Config
http://stackoverflow.com/questions/33655970/eclipse-paho-mqtt-spring-java-configuration
2015-11-12 12:12:12 -05:00
Gary Russell
79745c8b08 Add Debug for Amqp Channel Tests 2015-11-10 12:58:50 -05:00
Gary Russell
81cd1e1ad9 Increase File Test Timeouts 2015-11-10 12:57:49 -05:00
Artem Bilan
f6b95630c4 INT-3871: Fix NPE in the JsonPropertyAccessor
JIRA: https://jira.spring.io/browse/INT-3871

**Cherry-pick to 4.1.x, 4.0.x, 3.0.x**
2015-11-10 11:27:57 -05:00
Gary Russell
1107bfacb4 Fix Stomp Test Race Condition
Message producers are started in phase `Integer.MAX_INT / 2`.

The test case has a stomp inbound adapter and an event producer.

Since they are both in the same phase, the event producer can miss the `StompReceiptEvent`.

Change the phase of the event producer to ensure it is started before other message producers.
2015-11-10 09:47:51 -05:00
Gary Russell
f5fa979681 MQTT: Possible NPE
Examining the code revealed a possible (but improbable) NPE.

Checking the connection was disjoint from the publish; encapsulate the check within publish.
Synchronize the connectionLost method so it can't null the client while it is being checked.

Add `@SuppressWarnings("deprecation")` on the deprecated `connectIfNeeded()` usage.
2015-11-09 18:29:14 -05:00
Gary Russell
90a485e6a9 Fix Race Condition in BarrierMessageHandlerTests
Main thread waited for map.size() to go to zero, which is the initial state; use a latch instead.
2015-11-09 11:37:15 -05:00