Commit Graph

9169 Commits

Author SHA1 Message Date
Artem Bilan
97b00a065b INT-4389: Default to SimpleSeqSizeReleaseStrategy (#2444)
* INT-4389: Default to SimpleSeqSizeReleaseStrategy

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

An `AbstractCorrelatingMessageHandler` fallback to the
`SimpleSequenceSizeReleaseStrategy` when `releaseStrategy` isn't
provided.

* Make `ReleaseStrategyFactoryBean` to fallback to the
`SimpleSequenceSizeReleaseStrategy` for consistency.

* * Fix `ResequencerParser` to fallback to the null `releaseStrategy`.
This way a subsequent `releasePartialSequences` will set a
`SequenceSizeReleaseStrategy` as a default one

* * Fix `BarrierMessageHandler` to populate a default `CorrelationStrategy`

* * More polishing to `BarrierMessageHandler`
2018-05-15 16:31:16 -04:00
Artem Bilan
1b46224e41 INT-4398: Replace Gemfire dependency with Geode (#2426)
* INT-4398: Replace Gemfire dependency with Geode

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

* Polishing `gemfire.adoc` and mention the procedure for an
exclusion/inclusion appropriate dependency

* More Docs polishing

* * Fix tests to be based on SD Geode XML namespace
* Fix Docs according PR comments

* Polishing Docs according PR comments
2018-05-15 11:18:14 -04:00
Artem Bilan
9d66861e27 INT-4466: Do not force release groups if no match
JIRA: https://jira.spring.io/browse/INT-4466

When we schedule group for force complete in the
`AbstractCorrelatingMessageHandler`, we don't track a group `timestamp`
and its `lastModified` before the scheduled task.
This way, in the cluster environment, we may schedule several tasks
for different messages and the first started may release the group too
early.
Just because we extract a `MessageGroup` from the store already in the
task per se.

* Propagate the actual `timestamp` and `lastModified` from group before
scheduling task.
Compare these value with the actual group metadata in the
`processForceRelease()` before performing real `forceRelease()`.
This way we restore behavior before fixing memory leak, when we
propagated full `MessageGroup` to the scheduled task
* Implement `ResequencingMessageHandler.getComponentType()` for
consistency
* Remove unnecessary overhead with the `volatile` on many
`AbstractCorrelatingMessageHandler` properties, which hardly ever can be
changed at runtime

**Cherry-pick to 5.0.x and 4.3.x**
2018-05-15 10:31:53 -04:00
Artem Bilan
5e7391936e Fix ContentEnricherTests for dangling threads
https://build.spring.io/browse/INT-MJATS41-1353/

**Cherry-pick to 5.0.x and 4.3.x**
2018-05-15 09:53:14 -04:00
Artem Bilan
4be60552d0 INT-4467: Fix transformer-util package tangles
JIRA: https://jira.spring.io/browse/INT-4467

The package tangles is caused by the explicit classes declarations.

* Since we use only method definitions from those classes, there is just
enough to use class names and use reflection to get class objects and
then get methods from them

_The fix is fully compatible for back-porting_

**Cherry-pick to 5.0.x**
2018-05-11 17:09:46 -04:00
Artem Bilan
61b272dd5b Wrap non-StandardIntegrationFlow into Proxy (#2440)
* Wrap non-`StandardIntegrationFlow` into Proxy

In previous version all the `IntegrationFlow` beans have been replaced
by the `StandardIntegrationFlow` i the `IntegrationFlowBeanPostProcessor`
if they are lambda.
That works for Java, but doesn't with Kotlin, since lambdas i last one
are not synthetic classes.
Therefore some Java DSL definitions (especially `.subFlowMapping()`)
don't work consistently in two languages.

* Introduce `IntegrationFlowLifecycleAdvice` to wrap all the
non-`StandardIntegrationFlow`s (excluding `IntegrationFlowAdapter`)
into the `Proxy` to expose `SmartLifecycle` and `getInputChannel()`
operations and delegate them to the internal `StandardIntegrationFlow`
created by the `IntegrationFlowBeanPostProcessor`.
* This way any custom `IntegrationFlow` implementations can be used
for manual flow registration via `IntegrationFlowContext`
* Polish `RouterDslTests.kt` for the `@Bean`s for sub-flows.
* Document in the `dsl.adoc` a request-reply approach for the case
when `.subFlowMapping()` refers to an `IntegrationFlow` `@Bean`.
* Polishing for the `FlowServiceTests` since all the
non-`StandardIntegrationFlow`s and not-`IntegrationFlowAdapter`s are
wrapped now to the Proxy.
* Add missing `from()` delegations into the `IntegrationFlowAdapter`
* Polishing for the `ManualFlowTests` since all the `IntegrationFlow`
now are `Lifecycle` after wrapping to the Proxy.

* Add JavaDocs to the IntegrationFlowLifecycleAdvice and polishing for the dsl.adoc

* * Add JavaDocs for the `IntegrationFlowBeanPostProcessor.processIntegrationFlowImpl()`
* Improve JavaDoc for the `RouterSpec.subFlowMapping()`
* Assert in the `FlowServiceTests` that proxied custom flow implements
all the expected interfaces
2018-05-11 12:53:33 -04:00
Gary Russell
8fa1ea76b4 INT-4422: Fix TCP Pool tests 2018-05-10 15:52:02 -04:00
Gary Russell
52c5b822df INT-4422: Fix FTP Pool tests 2018-05-10 15:43:34 -04:00
Gary Russell
c2895f67cc INT-4422: No MessagingException in SimplePool
JIRA: https://jira.spring.io/browse/INT-4422

Inappropriate exception type, there is no message in the context of the pool.

Add a new exception.
2018-05-10 15:14:03 -04:00
Gary Russell
d9186f1b4a INT-4465: Fix delay in close propagation with NIO
JIRA: https://jira.spring.io/browse/INT-4465

There is a one second delay before a socket close is propagated if there is an active
assembler. This is generally only a problem with deserializers that use EOF to signal
message end (such as the `ByteArrayElasticRawDeserializer`).

Attempt to insert an EOF marker into the buffer queue so that the `getNextBuffer()` will
exit immediately on `close()` if it is blocked awaiting a buffer.

**cherry-pick to 5.0.x, 4.3.x**
2018-05-09 11:14:56 -04:00
Artem Bilan
081d0d160b Fix one more race condition in RedisLeaderTests
https://build.spring.io/browse/INT-SI50X-JOB1-56

We can't wait for the latch in the interruptable code flow;
we can't have a round-robing election guarantees.

* Add `Thread.sleep(LockRegistryLeaderInitiator.this.busyWaitMillis)`
to the `LockRegistryLeaderInitiator` when we restart the main task
* Remove latches waiting and thread shifting from the
`RedisLockRegistryLeaderInitiatorTests`
* Use long `busyWaitMillis` for yielding initiator to let the second
candidate to be elected

**Cherry-pick to 5.0.x**
2018-05-08 19:02:14 -04:00
Artem Bilan
51c49519dc Fix RedisLockRegLeaderInitTests race condition
https://build.spring.io/browse/INT-FATS5IC-501/

When we try to wait for the `Latch` in the interruptable code flow,
it is a fact that we step away from the waiting and end up with the
race condition downstream.

* Wrap `Latch` in the interruptable `publishOnRevoked()` code to the
`Executor.execute()`
* Remove `deleteTimeoutMillis` option from the `RedisLockRegistry`
since it doesn't make sense in the interruptable code.
* Add `RedisLockRegistry.setExecutor()` to allow to inject an external
`Executor`
* Add more debug logging into the `LockRegistryLeaderInitiator`

**Cherry-pick to 5.0.x**
2018-05-08 16:17:58 -04:00
Artem Bilan
3c1b547b26 Fix MQTT clientFactory bean definition in Docs
**Cherry-pick to 5.0.x and 4.3.x**
2018-05-07 14:13:55 -04:00
Artem Bilan
fc47952459 Fix LockRegLeaderInitiator for interrupted Thread
https://build.spring.io/browse/INT-MASTER-1024

When the Lettuce Redis client catches an `InterruptedException`, it is
wrapped to the `RedisCommandInterruptedException`, therefore when we
catch an exception on our code level it is not an `InterruptedException`
anymore and we can't proceed in the loop because the tread is
`interrupted` already.

* Check the `interrupted` alongside with the `InterruptedException`
to restart a loop from a fresh thread.

**Cherry-pick to 5.0.x**
2018-05-07 14:09:36 -04:00
Artem Bilan
a14514ada0 INT-4462: WebFluxInbound: cope with empty body
JIRA: https://jira.spring.io/browse/INT-4462

When the HTTP request body is empty, the `HttpMessageReader` ends up
with the empty `Mono` which can't be evaluated to any reasonable value.

* Add fallback to `requestParams` when `Mono` for body is empty and
also when `payloadExpression` returns null

**Cherry-pick to 5.0.x**
2018-05-07 12:46:08 -04:00
Gary Russell
07141302bb INT-4463: Full access to MqttConnectOptions
JIRA: https://jira.spring.io/browse/INT-4463

Certain options, such as `maxInFlight` were not exposed.

Deprecate the setters on the factory and allow the user to inject a pre-configured
`MqttConnectOptions`, thus making all (and any new) properties available to be
configured.
2018-05-07 12:39:15 -04:00
Artem Bilan
d985eeb75a Fix compatibility with the latest SD Gemfire
https://build.spring.io/browse/INT-MASTER-1021
2018-05-07 12:27:28 -04:00
Artem Bilan
4bf8379d23 INT-4464 Check ZKMetadataStore.running before use
JIRA: https://jira.spring.io/browse/INT-4464

A `ZookeeperMetadataStore.get()` is based on the `this.cache` variable.
This one is initialized in the `start()`.

* Assert `isRunning()` in the `get()` before using.

**Cherry-pick to 5.0.x and 4.3.x**
2018-05-07 11:33:04 -04:00
Artem Bilan
b8d4e6b0de Use Lettuce Redis client; Redis module fixes (#2435)
* Use Lettuce Redis client; Redis module fixes

The Lettuce client is based on the Netty and more stable, than Jedis
therefore we get a performance improvement for tests
(it saves us at about 30 seconds).
Also this client doesn't fail for me on Windows sporadically (very often)
 with the `ConnectionClosedException`

* After switching to the Netty-based client, we expose the interrupted
Thread issue in the `LockRegistryLeaderInitiator`.
If we interrupted (expected behavior), we try to unlock calling
`RedisLockRegistry`, but Netty client reject our request because the
thread is interrupted, therefore we never delete the lock when we yield
our leadership.
Fix the issue with shifting a `RedisTemplate.delete()` operation to the
`ExecutorService` when the current thread is interrupted
* Allow to configure such an `ExecutorService` and timeout to wait for
the `submit()` result
* Refactor `RedisAvailableRule` and all the Redis tests do not expose
the target `RedisConnectionFactory` implementation.
* Make all the test-cases based on the `connectionFactory` created by
the `RedisAvailableTests.setupConnectionFactory()`
* Tweak some unnecessary timeouts and sleeps for better tests task
throughput

* Add a `Log4j2LevelAdjuster` into the `RedisLockRegistryLeaderInitiatorTests`
2018-05-04 14:13:51 -04:00
Artem Bilan
664d67f9bb Add small sleep between adding message to group
https://build.spring.io/browse/INT-FATS5IC-497

Fixes `JdbcMessageStoreTests` sporadic failure where there is no
guarantee that message are going to be polled from the group the same
order they've been inserted

Cherry-pick to `5.0.x`
2018-05-04 13:06:09 -04:00
Artem Bilan
4fd638e321 Wrap LinkedList manipulations into synchronized
https://build.spring.io/browse/INT-MASTER-1017

Looks like non-`volatile` `size` property in the `LinkedList` is not
updated properly for the `contains()` assertion, therefore we end up
with the `ConcurrentModificationException`

* Move `assertThat()` into the `synchronized (overridePresent)` block
to enforce CPU cache flushing and, therefore, have an actual value
for the `LinkedList.size` during iteration
2018-05-04 12:50:37 -04:00
Gary Russell
e98738788d INT-4461: Support byte[] in #jsonPath
JIRA: https://jira.spring.io/browse/INT-4461

Convert `byte[]` to `String` using `URF-8` by default.

Add optional evaluate methods to JsonPathUtils with a Charset to use when
converting `byte[]` to `String`.

This is not currently exposed using SpEL. It can be done, but probably not worth
the effort until somebody asks for it.

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

* Use `BAIS`
2018-05-04 12:09:00 -04:00
Artem Bilan
b547c923d1 Use Flux.handle() instead of doOnNext() in FluxMC
For better back-pressure handling do not perform active operations
directly on the current `Flux` (e.g. via `doOnNext()`).
It's better to postpone such a handling to back-pressure ready operators
Like in this `FluxMessageChannel` case, the `.handle()` operator is
wrapping the "hard" `send()` operation.

Also include `.errorStrategyContinue()` do not stop during message
processing
2018-05-01 15:50:10 -04:00
Artem Bilan
a62832c707 INT-4458: Do not expose recursive generics API (#2432)
* INT-4458: Do not expose recursive generics API

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

According Kotlin generics system restrictions we can't expose API
based on the recursive generics, like we have with Java DSL for JMS

* Replace explicit recursive generics on factory method with the wildcard (`?`).
This way both Kotlin and Java are able to instantiate target object and perform
the proper chain API auto-completion
* Fix `JmsInboundChannelAdapterSpec` to deal with provided `S` type for the
`configureListenerContainer()` - the way we can configure a `JmsDefaultListenerContainerSpec`
* Add `kotlin-spring` Gradle plugin to avoid extra `open` modificator on `@Bean` methods
* Add `JmsDslKotlinTests.kt`

**Cherry-pick to 5.0.x excluding Kotlin support**

* Fix `Amqp` DSL factory for recursive generics

* Polishing for Kotlin tests
2018-05-01 08:47:07 -04:00
Artem Bilan
f970bf0332 Remove SQL scripts generation
We don't change JDBC scripts too often and even if we do that, it's not
so hard to copy/paste the script throughout all the supported platforms
instead of rely on the pretty old VPP tool and suffer from performance
degradation during regular day-to-day development.
Plus there is some bug in the VPP when it generates a script for the
Derby, so we end up with erroneous braces in the sentence:
```
MESSAGE_SEQUENCE BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
```
I have to remove them manually each time I switch between Gradle versions
2018-04-27 17:49:19 -04:00
Artem Bilan
0c1423e78a INT-4456: Explicit methods for Kotlin lambdas
JIRA: https://jira.spring.io/browse/INT-4456

Since Kotlin compiles lambdas different way than Java, they are not
synthetic classes at runtime anymore.
Therefore we fallback to the method invocation logic, but since Java 8
interfaces has `default` methods as well the `MessagingMethodInvokerHelper`
can't select the target method for invocation

* Use explicit `Function.apply()` for non-synthetic implementations
* Add `RouterDslTests` Kotlin-based test-case

**Cherry-pick to 5.0.x**

* Add more explicit methods for invokers
2018-04-27 14:45:55 -04:00
Artem Bilan
000f2972f4 Fix logic in the PollingTransactionTests
The `transactionWithCommitAndAdvices()` uses `SimpleRepeatAdvice`
which essentially performs `doPoll()` twice.
In this case we don't have enough messages in the `goodInputWithAdvice`
queue

* Add one more message to the `goodInputWithAdvice` queue during testing
* Increase all the timeouts
* Increase capacity in queues for the `transactionWithCommitAndAdvices()`

**Cherry-pick to 5.0.x and 4.3.x**
2018-04-26 09:22:00 -04:00
Artem Bilan
0ef659b8a7 INT-4351: Add DiscardAwareFileListFilter
JIRA: https://jira.spring.io/browse/INT-4351

The `WatchService` reacts to the events in the file system and keep
track ove the events until we poll them, e.g. via `listEligibleFiles()`
in the `WatchServiceDirectoryScanner`.
On the other hand the `SourcePollingChannelAdapter` calls the mentioned
`listEligibleFiles()` according its polling period.
At this moment the `FileListFilter` is applied to the polled files.
It may happen that `LastModifiedFileListFilter` can't accept too young
files yet and they are lost for the future consideration.

* To allow, for example, to retain young files by the
`LastModifiedFileListFilter` judgment for the future cycles add
`DiscardAwareFileListFilter` with the `DiscardCallback` support.
The `WatchServiceDirectoryScanner` now registers such a callback into
the filter and stores discarded files into the `filesToPoll` queue
for the future poll cycle.

**Cherry-pick to 5.0**

Fix compilation warnings

* Replace `DiscardCallback` with the plain `Consumer`
* Ensure uniqueness in the `WatchServiceDirectoryScanner` internal
queue via a `Set` implementation, since discard callback may be called
several times for the same file from the `CompositeFileListFilter`
according to its nature
* Add JavaDocs and Docs

Change `@since` to `5.0.5`
2018-04-24 14:10:15 -04:00
Gary Russell
acd78a7f48 INT-4455: Fix NPE in Exception router
JIRA: https://jira.spring.io/browse/INT-4455

When using java config, `setChannelMapping` NPEs due to no AC.

**cherry-pick to 4.3.x, and to master, removing AC check**

* Polishing - PR comment

* Resolve TODO in the `ErrorMessageExceptionTypeRouter`
2018-04-24 12:43:49 -04:00
Artem Bilan
6dfe96d220 Fix JdbcMessageStoreTests to use H2, not Derby
Looks like Derby is much slower than H2, plus it doesn't look so stable
having so much sporadic failures.

Looks like moving to H2 here saves for us `500 ms` test working time

**Cherry-pick to 5.0.x**
2018-04-23 12:54:32 -04:00
Artem Bilan
0c35310f34 INT-4451: ObjectToJsonTrans: add ResultType.BYTES
JIRA: https://jira.spring.io/browse/INT-4451
2018-04-20 15:26:42 -04:00
Artem Bilan
2f1b55f48c Upgrade to Gradle 4.7 and others, polishing build (#2423)
* Upgrade to Gradle 4.7 and others, polishing build

* Fix `MqttAdapterTests` according requirement of the latest Mockito
* Move `int-derby.properties` to the `/resources` from `/java`

* Fix Checkstyle violations
2018-04-20 11:11:05 -04:00
Artem Bilan
e4e4ee092d Fix JdbcMessageStoreChannelTests race condition
The message in the `QueueChannel` appears for consuming a bit earlier
than TX is committed

* Introduce `afterCommitLatch` into the test verify the state
when TX is really committed and data is removed from DB

**Cherry-pick to 5.0.x and 4.3.x**
2018-04-20 09:40:25 -04:00
Artem Bilan
1f6f70b4ef Fix some sporadic tests failures
https://build.spring.io/browse/INT-MASTER-1004/
2018-04-19 17:35:50 -04:00
Artem Bilan
82cbafaaa4 Downgrade to Derby-10.13.1.1
Looks like we have started to fail much often
since upgrade to the `Derby-10.14.1.0`:
cb0d43db6b

That is also related to this https://jira.spring.io/browse/INT-4445

* Remove all the `drop` mentioning for Derby scripts -
it just doesn't support `IF EXISTS`.
More over we don't need to worry about drops since each test now starts
its own fresh embedded DB

**Cherry-pick to 5.0.x**
2018-04-19 15:00:55 -04:00
Artem Bilan
7bcf6a040a INT-4446 Improve EmbeddedJsonHeadersMessageMapper (#2422)
* INT-4446 Improve EmbeddedJsonHeadersMessageMapper

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

* Do not recreate message if not necessarily
* Do not let to generate `id` and `timestamp` if they are not mapped
* Use `smartMatch` to allow to configure negative patterns
* Introduce `PatternMatchUtils.smartMatchIgnoreCase()` for convenience

**Cherry-pick to 5.0.x**

* * Polishing `EmbeddedJsonHeadersMessageMapper`
2018-04-19 13:22:40 -04:00
Artem Bilan
15fc23c2fa INT-4447: LockRegLeaderInit: Catch unlock errors
JIRA: https://jira.spring.io/browse/INT-4447

When we get an exception during `this.lock.unlock()`, we don't revoke
leadership.
In case of external resource (e.g. JDBC) this may cause a race condition
when the second candidate is selected as leader when connection comes back

* Catch `this.lock.unlock()` exceptions and log them under DEBUG.
This way we proceed to the `handleRevoked()` logic

**Cherry-pick to 5.0.x and 4.3.x**
2018-04-18 17:07:07 -04:00
Artem Bilan
4e157725b9 INT-4448, INT-4449: Fix Gateway for no-arg method (#2420)
* INT-4448, INT-4449: Fix Gateway for no-arg method

JIRA: https://jira.spring.io/browse/INT-4448
JIRA: https://jira.spring.io/browse/INT-4449

When we are not interested in the `payload` to send, we use a gateway
method without any args, but in this case for send operation (or
send-and-receive) we should specify a default `payloadExpression`

The `MessagingGatewayRegistrar` fails with `NPE` if we don't have a
any global headers and have `defaultPayloadExpression`

Also in this case the `GatewayProxyFactoryBean` fails to send
and fallbacks to receive with the meaning "no args, not payloadExpression"

* Fix `MessagingGatewayRegistrar` to check `hasDefaultHeaders` before
processing them
* Fix `GatewayProxyFactoryBean` to consult `this.globalMethodMetadata`
if there is no `payloadExpression` for the method specific metadata

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

* Remove `oracle-java8-installer` since it looks like the resource
is not available anymore:

```
Location: http://download.oracle.com/otn-pub/java/jdk/8u161-b12/2f38c3b165be4555a1fa6e98c45e0808/jdk-8u161-linux-x64.tar.gz?AuthParam=1523990114_ee8c82cbe67bc87d192cb79d3b902d2f [following]
--2018-04-17 18:33:14--  http://download.oracle.com/otn-pub/java/jdk/8u161-b12/2f38c3b165be4555a1fa6e98c45e0808/jdk-8u161-linux-x64.tar.gz?AuthParam=1523990114_ee8c82cbe67bc87d192cb79d3b902d2f
Connecting to download.oracle.com (download.oracle.com)|23.53.120.105|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2018-04-17 18:35:15 ERROR 404: Not Found.
```
2018-04-18 13:48:44 -04:00
Artem Bilan
82e4679495 Increase some tests performance
https://build.spring.io/browse/INT-MASTER-999/

Since `BeanFactoryTypeConverterTests` and `CallerBlocksPolicyTests`
uses too long `Thread.sleep()` there is no guarantee that they are going
to be performed after expected 10 seconds

* Decrease `Thread.sleep()` in those tests
2018-04-10 21:08:34 -04:00
Gary Russell
6216075619 Deprecation doc polishing
Channel interceptors.
2018-04-10 19:02:07 -04:00
Artem Bilan
d807fc3692 Fix some sporadic tests failures
* Increase timeouts in the `RoundRobinDispatcherConcurrentTests` and
`ManualFlowTests`
* Fix `PollerAdviceTests` to re-use `TaskScheduler` from the ctx
instead of local, not closed instance
* Use `OnlyOnceTrigger` instead of local implementations
* Change the `primary` `Trigger` bean to the `PeriodicTrigger` as well.
The minimum interval for the `CronTrigger` is 1 seconds - it doesn't
matter for this test-case
2018-04-10 18:49:45 -04:00
Gary Russell
b940e3872b Upgrade to SF 5.1; Remove Deprecated Code
Polishing - PR Comments

Remove direct log4j usage in tests

- hazelcast depends on it; retain the dependency just in jmx

Fix hazelcast logger type
2018-04-10 18:49:42 -04:00
Artem Bilan
27318c7ee5 INT-4445: Fix JDBC tests for Derby
JIRA: https://jira.spring.io/browse/INT-4445

Looks like `/dataSource` temporary directory is busy in between different
tests.
The thought is like a high-frequently polling endpoint keeps DB resource
from removing.

* Explicitly `stop()` endpoint in the `JdbcMessageStoreChannelTests`
* Optimize
`JdbcMessageStoreChannelTests.testSendAndActivateTransactionalSend()`
to rely on the short `1` millisecond TX timeout.
This safes for us 10 seconds of the tests executions.
* Configure all the embedded DB beans for the `ignore-failures="ALL"`
as a fallback option if polling endpoint is not a cause of the concurrent
resource access.

**Cherry-pick to 5.0.x**
2018-04-09 14:41:53 -04:00
Gary Russell
af58fa4417 Upgrade to micrometer 1.0.3 2018-04-05 11:05:48 -04:00
Artem Bilan
8b3198dc36 INT-4438: No lifecycle twice in the same role
JIRA: https://jira.spring.io/browse/INT-4438

The `SmartLifecycleRoleController` is based on the `MultiValueMap`
which used internally a `List` for the values.
With such an architecture we can add the same value several times.
On the other hand we are iterating over `Lifecycle`s in the role and
build a `Map` for their running status.
In this case when `NamesComponent`s return the same name the Java
`Collectors.toMap()` fails with a duplicate key error.

In any cases it would be better do not allow to add the same lifecylce
several time to the role or different with the same name.

* Add search logic to the `addLifecycleToRole()` to fail fast with the
`IllegalArgumentException` because a lifecycle with the same name is
already present in the role

**Cherry-pick to 5.0.x**

* Remove redundant `this.initialized = false` from the
`AbstractPollingEndpoint.doStop()`

Add `allEndpointsRunning()` verification to the `EndpointRoleParserTests`

Polishing
2018-04-02 17:17:47 -04:00
Artem Bilan
a65d05cdbf Increase timeout for PollingConsumerEndpointTests
https://build.spring.io/browse/INT-SI50X-20

Looks like 5 seconds is not enough to wait for the test completion,
especially on CI server

* Refactor `PollingConsumerEndpointTests` to use `OnlyOnceTrigger`
from the test-support module instead of local `Trigger` implementation
* Increase timeout for latch in the `OnlyOnceTrigger` to 10 seconds

**Cherry-pick to 5.0.x**
2018-04-02 14:44:56 -04:00
Artem Bilan
5cdcd81444 Fix NPE in the TcpNetServerConnectionFactory
https://build.spring.io/browse/INTSAMPLES-NIGHTLY-2413

When we fail with the
`java.net.BindException: Address already in use (Bind failed)` in the
`TcpNetServerConnectionFactory.run()`, the `serverSocket` property
remains `null` and we get `NPE` in the `catch` block trying to `close()`
the socket.

* Call `stop()` instead which has all the required protections.

**Cherry-pick to 5.0.x and 4.3.x**
2018-04-02 13:36:02 -04:00
Gary Russell
544de6bf5f Add BoundRabbitChannelAdvice
Polishing and docs

Polishing - DEBUG log for confirms; add integration test

Polishing - PR Comments

Renamed Advice

Verify acks logged.

Polishing - more PR comments

Renamed to BoundRabbitChannelAdvice.

* Extract `ConfirmCallback`s instances for optimization
* Remove unused constant
2018-03-29 15:53:57 -04:00
Artem Bilan
8afdcb4893 Fix Transformers usage in Docs
**Cherry-pick to 5.0.x**
2018-03-27 12:23:05 -04:00
Gary Russell
1cd6c11808 INT-4443: Use SimpleEC for uriVariablesExpression
JIRA: https://jira.spring.io/browse/INT-4443

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

Polishing; use data binding accessor in test evaluation contexts.

Add `.withInstanceMethods()`

See https://jira.spring.io/browse/SPR-16588?focusedCommentId=158041&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-158041

* Polishing according PR comments
2018-03-26 16:48:37 -04:00