Commit Graph

369 Commits

Author SHA1 Message Date
Gary Russell
099ab8a6ae Fix Sporadic Test Failure
https://build.spring.io/browse/INT-MJATS41-925/
2017-03-03 09:49:58 -05:00
Artem Bilan
6e7653f18f 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**
2017-01-30 22:47:16 -05:00
Artem Bilan
626466bac8 Compatibility with previous SF versions
https://build.spring.io/browse/INT-MJATS41-872
2017-01-09 10:34:57 -05:00
Artem Bilan
a39c8bef41 Fix compatibility with the latest SF
https://build.spring.io/browse/INT-MJATS41-869

* Revert to `B-S` versions for SA
* Since `MessagingException.toString()` now includes and `failedMessage` as well, a comparision with `TcpConnectionExceptionEvent.toString()` should be a bit different

See https://jira.spring.io/browse/SPR-15091
2017-01-06 10:38:01 -05:00
Gary Russell
6cd0845cfa INT-4198: TCP: Add Hook to Customize SSLEngine
JIRA: https://jira.spring.io/browse/INT-4198

Enable setting properties like `needClientAuth` on the `SSLEngine` - when not using
NIO, this can be set on the server socket with a socket support implementation.

Add `nio-connection-support` to namespace.

Improved "Advanced Techniques" documentation, using this use case as an example.

Fail fast with NIO when SSL handshaking fails.

Polishing - PR Comments

More Polishing

* Final polishing
- fix several typos in log messages
- clean up `TcpConnectionFactoryFactoryBean` JavaDocs from redundant imports
- remove redundant `InitializationBean` functionality from the `DefaultTcpNetSSLSocketFactorySupport` as well

Conflicts:
	spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/SocketSupportTests.java

* Resolve Java 8 code style and revert `afterPropertiesSet()` with `@Deprecated`
2016-12-29 18:15:18 -05:00
Artem Bilan
ea2b5df573 TcpNioConnectionReadTests: One more error message
https://build.spring.io/browse/INT-MJATS41

**Cherry-pick to 4.3.x**

(cherry picked from commit 168d91c)
2016-12-22 11:07:29 -05:00
Artem Bilan
176be69b0f Fix expected messages for the TcpNioConnReadTests
https://build.spring.io/browse/INT-MASTER-475/
https://build.spring.io/browse/INT-MJATS41-850/

**Cherry-pick to 4.3.x**

(cherry picked from commit 44ad811)
2016-12-19 11:09:57 -05:00
Artem Bilan
21d355c538 Assert for another exception in TcpNioConReadTests
https://build.spring.io/browse/INT-MJATS41-847/

**Cherry-pick to 4.3.x**

(cherry picked from commit 968812c)
2016-12-16 12:59:15 -05:00
Artem Bilan
3127f25bfe Fix Race Conditions in TcpNioConnectionReadTests
https://build.spring.io/browse/INT-SI43X-60

After introduction the `sendErrorToListener()` function for the `TcpConnectionSupport`, all the tests in the `TcpNioConnectionReadTests` have flaw to be affected by the race condition to release semaphore in the `onMessage()` and don't get a connection as closed yet.

* Fix the tests adding `CountDownLatch` for the `ErrorMessage` and `AtomicReference` to assert an Exception message afterwards.

**Cherry-pick to 4.3.x**

Add Travis diagnostic to determine what is the difference if that

Revert Travis diagnostic

Looks like would be better to wait for CI failure to determine the root of sporadic cause

Conflicts:
	spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/TcpNioConnectionReadTests.java
2016-12-15 16:47:18 -05:00
Gary Russell
e8eecc7d8f INT-4183: Add SSL Handshake Timeout for TCP
JIRA: https://jira.spring.io/browse/INT-4183

Previously, this was hard-coded to 30 seconds.

* Fix typos according PR comments

Conflicts:
	spring-integration-ip/src/main/java/org/springframework/integration/ip/config/IpAdapterParserUtils.java
	spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/SocketSupportTests.java

* Resolve conflicts for the  `SocketSupportTests` where `ApplicationEventPublisher` isn't `@FunctionalInterface` yet in SF-4.3.x
2016-12-13 18:54:38 -05:00
Artem Bilan
67332ad93a Fix One More Address already in use Issue
https://build.spring.io/browse/INT-MASTER-350

There are so much other similar `SocketUtils` usage and it doesn't look so quickly to fix them all
Let's do that on demand!
Or just live with rebuild forever to believe that it was just a bad luck...

Fix race condition when we assign the `port` for client before server actually has obtained the real port from OS
2016-12-01 09:27:47 -05:00
Gary Russell
166a732447 INT-4124: ByteBuffer.array() with Direct Buffers
JIRA: https://jira.spring.io/browse/INT-4124

`ByteBuffer.array()` returns null when Direct.

Change `ChannelInputStream` to use the `ByteBuffer` directly instead of
the underlying `byte[]`.

Conflicts:
	spring-integration-ip/src/test/java/org/springframework/integration/ip/util/SocketTestUtils.java

* Change Lambda for `EventPublisher` to `Mock`
2016-09-26 22:30:04 -04:00
Artem Bilan
9101b6a6ef INT-4108: Fix idempotency for some Lifecycles
JIRA: https://jira.spring.io/browse/INT-4108

Some `Lifecycle.start()/stop()` usage doesn't ensure robustness for components causing unexpected and difficulty tracing issues

* Fix `Lifecycle.start()/stop()` for `FileReadingMessageSource`, `FileWritingMessageHandler`, `AbstractMqttMessageHandler`
* In the `DefaultHeaderChannelRegistry`, `LockRegistryLeaderInitiator`, `MqttPahoMessageHandler` rework logic for shared variables to avoid `NPE`
* Increase receive timeouts in the `PayloadDeserializingTransformerParserTests` and `UdpChannelAdapterTests`
* Prove with the `WatchServiceDirectoryScannerTests` changes that several invocation for `FileReadingMessageSource.start()` are idempotent

**Cherry-pick to 4.3.x**
2016-09-13 15:16:48 -04:00
Artem Bilan
28216013dd Fix some typos in IP module (JavaDocs, comments) 2016-08-11 21:39:59 -04:00
Gary Russell
2a66f39df1 TCP/UDP: Use OS to Select Test Ports
https://build.spring.io/browse/INT-AT42SIO-228/
2016-07-29 16:32:38 -04:00
Gary Russell
6eba49c625 INT-4080: Add TcpConnectionFailedEvent
JIRA: https://jira.spring.io/browse/INT-4080
2016-07-26 12:02:14 -04:00
Artem Bilan
a7dc7c3912 INT-4057: Router: don't use convert for Class key
JIRA: https://jira.spring.io/browse/INT-4057

When general router `channelKey` returns just a `Class<?>` result, we end up with the
`unsupported return type for router [class java.lang.Class]` and forced to to call its `getName()` in the target application code before returning to router.

* Change the `AbstractMappingMessageRouter` logic to treat `Class<?>` as a special String-aware case, use its `getName()` and don't go to the `ConversionService`
* Increase receive timeout for replies in the `TcpInboundGatewayTests`
2016-07-11 06:36:21 -04:00
Gary Russell
08718d1919 INT-4047: TCP: Add contentType Header
JIRA: https://jira.spring.io/browse/INT-4047

Polishing - PR Comments
2016-06-07 12:19:26 -04:00
Gary Russell
8e3622757d File Cleanup - Event to JMX 2016-06-04 11:39:43 -04:00
Gary Russell
06a1d503be INT-4029: TCP: Add Buffer Pooling to Deserializers
JIRA: https://jira.spring.io/browse/INT-4029

Support the use of buffer pools in the deserializer code to
allow buffer reuse.
2016-05-11 15:01:17 -04:00
Gary Russell
9e51ba4ea4 INT-4024: TcpNetConnection Do Not Cache Listener
JIRA; https://jira.spring.io/browse/INT-4024

When the `FailOverClientConnectionFactory` is used on top of a
`CachingClientConnectionFactory`, the underlying connection's listener
is changed to the new `CachedConnection` which in turn has its
listener set to the new `FailoverTcpConnection`.

Since the caching connection factory implies single-use (so the connection
is "closed" - returned to the cache), the `FOCCF`
is also forced to have single-use = true - hence the new ultimate listener.

The `TcpNetConnection` obtained its listener (`getListner()`) in the outer
block of its read loop and hence did not detect the listener change.

This caused the old listener (cached connection) to be invoked and when
the result was ultimately passed back to the `TcpOutboundGateway`, the
connection id did not match and the reply eventually timed out.

Change the `TcpNetConnection` to call `getListener()` for every message.

This was already the case in `TcpNioConnection`.
2016-05-10 19:07:08 -04:00
Gary Russell
f0079cefd5 Fix Final "Available Socket" Tests
https://build.spring.io/browse/INT-AT42SIO-141/

Also fix sftp .gitignore
2016-05-03 11:55:55 -04:00
Artem Bilan
818387f0a4 INT-3982: Fix XSD declaration ambiguity
JIRA: https://jira.spring.io/browse/INT-3982

Also fix some sporadic, timing issues in tests
2016-04-19 08:18:14 -04:00
Gary Russell
4027b38da8 Remove System.out/.err Calls From All Tests 2016-04-14 16:22:45 -04:00
Gary Russell
57f96bb759 checkstyle Misc Rules
checkstyle Nesting

checkstyle GenericWhitespace

checkstyle MethodParamPad

checkstyle NoWhiteSpace

checkstyle ParenPad Script

checkstyle ParenPad
2016-04-05 17:21:29 -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
4ac3a79df7 checkstyle FinalClassCheck
fixes

fixModifiers after fixFinal

Revert CachingSessionFactory

Class is spied in tests.

checkstyle - Import Rules

checkstyle InterfaceIsType

checkstyle InnerTypeLast

checkstyle OneStatementPerLine

CovariantEquals
OneTopLevelClass

* Revert `'\n'` -> `System.lineSeparator()` in the Gradle scripts to meet Git `autocrlf = true` on Windows
* Fix timing issue with the `LastModifiedFileListFilterTests`, when the `age = 1` might not be enough for the file object when we have some delay before checking
2016-04-04 13:49:56 -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
0fd72d2d18 TCP Connection Factory FactoryBean Improvements
Add ctor argument so that early `getObjectType()` calls can return
a narrower type (server Vs. client CF).
2016-03-25 14:00:00 -04:00
Artem Bilan
2b0598291c RequireThis rule and fixThis Gradle task
* `gradlew clean check -x test --parallel --continue` - to collect reports
* `gradlew fixThis --parallel` - to fix all possible vulnerabilities. With `-Dfile.encoding=UTF-8` on Windows

Since the `RequireThisCheck` doesn't see parents for anonymous classes (e.g. `Runnable` callback), its report doesn't contains the outer class name with `this.`,
therefore we still have to fix those cases manually.
Thanks to the wrong `replacer` just with `this.` we have uncompilable code enough easy to find problems.
Not so easy to fix for good readability though...

* Upgrade to Grade 2.12
* Upgrade to SonarQube native plugin

The fix contains at about 300 files. So, will be done on merge.

Fix `fixThis.gradle` according PR comments

Apply `fixThis` and also `fixModifiers` for test classes.
 Fix some `this.` inner issues manually.
 Make code polishing for long lines after `fixThis`

Fix conflicts and vulnerabilities after the rebase
2016-03-22 20:18:27 -04:00
Artem Bilan
66cd92a6e7 INT-3964: More @EnableIntegration Documentation
JIRA: https://jira.spring.io/browse/INT-3964

Doc Polish

XSD: document classes for element implementations

Fix Redis XSD typo for CDATA
2016-03-22 10:41:07 -04:00
Artem Bilan
c2954881ad Enable RedundantModifier checkstyle, add fixer
Add `fixModifiers.gradle` to run after `check` task.

The `RedundantModifierChecker` doesn't catch all errors at once.
We need run `check -> fixModifiers` pair several times to reach `SUCCESSFUL`.

The `fixThis` has been ported from the SA, but without applying.

* Polishing for `fixModifiers.gradle`
* Fix all redundant modifier with the `fixModifiers.gradle`

NOTE: Since all these task modify files on Windows we have to run them with the `-Dfile.encoding=UTF-8`.
Otherwise they are read and write with the Windows default `cp1251` making them incompatible with Unix system.
2016-03-17 13:10:05 -04:00
Artem Bilan
ef40a939cf Add check header rule and fixHeaders task
Add "new line" in the header end

* Optimization for the `fixHeaders.gradle`
* Apply the `fixHeaders` for the affected classes
2016-03-07 15:08:51 -05:00
Gary Russell
d48597f41b Fix TCP Cache Race Condition
On a gateway remote timeout, there's a race between the reader and writer
thread to close the connection.

Change the `released` boolean to an `AtomicBoolean` to avoid the unexpected
exception when the other thread attempts to return a non-existent connection
to the pool.
2016-02-16 15:51:54 -05:00
Gary Russell
91387147c9 INT-3952: Local IP Address Header and SocketInfo
JIRA: https://jira.spring.io/browse/INT-3952
2016-02-11 11:43:28 -05:00
Gary Russell
d8ad38d8ea INT-3869: Fix MBeanServer Detection
JIRA: https://jira.spring.io/browse/INT-3869

When using `@EnableIntegrationMBeanExport` with no `server` property,
the `IntegrationMBeanExportConfiguration` incorrectly created a new
`MBeanServer` instead of attempting to locate an existing one.

Use the `SpecificPlatform` logic from `MBeanExportConfiguration` to locate
a specific server on `WebSphere` and `WebLogic`; otherwise defer to
`JmxUtils.locateMBeanServer()` in the exporter's initialization method.

Add a test to verify the same server is used in multiple contexts.

* Fix `ConnectionFactoryTests` regarding new `MessageProducerSupport` logic
2016-01-12 15:58:21 -05:00
Artem Bilan
74cbc58698 INT-3926: Add <poller> for all outbound tags
JIRA: https://jira.spring.io/browse/INT-3926

* Add `<poller>` for all `<outbound-adapter(gateway)>`
* Add/modify tests for `<queue>` as an input channel and particular `<poller>`
* Move XSD from the `xml` package to the `config` level to achieve the consistency throughout the project.
2016-01-07 12:16:40 -05:00
Marcin Pilaczynski
8bf8caa22e INT-3883: UDP: destination and socket expressions
JIRA: https://jira.spring.io/browse/INT-3883

UDP Outbound Channel Adapter is able to use given UDP Inbound Adapters
server socket (outgoing packets will have source port same as incoming
packets destination port).

* Introduce `destinationExpression` instead of hard-coded `host/port` logic in the `DatagramPacketMessageMapper`
* Make `UnicastSendingMessageHandler.destinationExpression` mutually exclusive with `host/port` pair
* Move `socketExpression` to the setter as it is absolutely different option from the `destination`
* Make `UnicastSendingMessageHandler` expressions logic based on the `requestMessage`

INT-3883 Code review fixes.

Further polishing

Polishing according PR comments

Rework the String socket address logic just to the expected `URI` style.
Accept `2016` for changed classes.
2016-01-04 14:31:40 -05:00
Artem Bilan
287173bc67 Fix TCP tests to use 0 port
https://build.spring.io/browse/INT-MJATS41-495
https://build.spring.io/browse/INT-AT42SIO-16

Can be backported to `4.2.x` on demand
2015-12-28 18:22:07 -05:00
Gary Russell
ed874ea84a TCP ConnectionFactoryTests Race Condition
Wait for events.
2015-12-21 11:38:55 -05:00
Gary Russell
0458220756 TCP ConnectionFactoryTests Diagnostics
https://build.spring.io/browse/INT-SONAR-1582/
2015-12-20 16:07:01 -05:00
Gary Russell
180ada63b0 INT-3912: TCP Server Listening Event
JIRA: https://jira.spring.io/browse/INT-3912

Polishing - PR Comments
2015-12-15 10:15:13 -05:00
Artem Bilan
471d08250d Add MulticastRule to Check the NIC for Tests
Add `skip` variable

Polishing

Tests failed after installing VirtualBox.

Further polishing to skip `vboxnet` NICs.

Also explicitly set the multicast socket `interface` (instead of `networkInterface`)
to address a specic IPAddress if a NIC has multiple bindings.

Add `@MulticastRule` to `DatagramPacketMulticastSendingHandlerTests` (separate into
new test file).

Fix tests to use the rule's NIC.
2015-12-14 18:17:27 -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
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
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
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
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