Commit Graph

44 Commits

Author SHA1 Message Date
Artem Bilan
715e9a2042 Upgrade dependencies including Gradle 6.1
* Add `org.gradle.caching=true` and `org.gradle.parallel=true` into a `gradle.properties`
* Fix `Matcher` tests in the `spring-integration-test-support` for the latest JUnit 4
2020-01-16 16:13:06 -05:00
Artem Bilan
370e943428 Remove deprecations from previous versions
* Remove Boon dependency and its usage
* Remove overloaded methods from the `IntegrationFlowDefinition`
- we can simply rely now on the super class
* Remove (or rework) deprecated entities in the docs
* Fix tests for removed deprecated APIs
* Rework affected tests to JUnit 5
2020-01-09 15:54:04 -05:00
Artem Bilan
5ac262f866 GH-3132: Remove usage of super();
Fixes https://github.com/spring-projects/spring-integration/issues/3132

It turns out that Checkstyle EmptyBlock doesn't complain about
empty default ctor.
Plus a new check for `super();` call treats it as a violation

* Remove `super();` from all the no-arg ctors
* Code style clean up in the affected classes according
IDEA suggestions

* Fix new Sonar smells
2019-12-27 15:13:00 -05:00
Artem Bilan
3ca291c7c4 Fix new Sonar smell 2019-09-25 08:26:52 -04:00
Gary Russell
12e5a306f8 GH-3062: Polishing
- avoid log noise when test server stopped
2019-09-24 18:11:30 -04:00
Gary Russell
8ad802cdfe GH-3062: Fix Mail Tests Hang
Resolves https://github.com/spring-projects/spring-integration/issues/3062

Reliably stop the test mail servers before the test context is destroyed.
2019-09-24 16:55:32 -04:00
Artem Bilan
35dd0c2c8a Remove unused imports in the Log4j2LevelAdjuster 2019-08-18 10:53:33 -04:00
Artem Bilan
b01982de41 Fix new Sonar smells 2019-08-18 10:49:24 -04:00
Gary Russell
69dd180d0c JUnit 5 Log Level Adjuster
* Fix copyright, javadoc.
2019-08-16 10:36:23 -04:00
Gary Russell
096087073d Fix javadoc (previous commit) 2019-07-30 13:01:37 -04:00
Andreas Gebhardt
d2dc9c5dba fix JavaDoc code snippet on PayloadMatcher 2019-07-30 12:47:12 -04:00
Artem Bilan
09c4f03d7c Upgrade to JUnit 5.5, Mockito 2.28.2
* Fix `LongRunningTest` to rely on the `@EnabledIf` from Spring Test
Framework instead of deprecated now in JUnit 5
* Remove unnecessary stubbing in the `FileReadingMessageSourceTest`
2019-07-01 17:04:00 -04:00
Artem Bilan
315f0e711f Fix Sonar vulnerabilities for varargs
* Fix smell for static `AmqpInboundGateway.attributesHolder`

* Fix readOnlyHeaders in the `MessageBuilder`
2019-05-30 15:41:53 -04:00
Gary Russell
6d7bc1fc39 Sonar: repeated literals
* Polishing - PR Comments

* GatewayParser: Restore suppress warnings; remove size from `toArray()`.

* Merge conflict resolution
2019-05-03 12:39:02 -04:00
Gary Russell
ebbcb9df48 Sonar fixes
* exposing internal objects
* boolean complexity
* names, methods with _
* missing `default` in switch
* lost stack trace
* unnecessary null check before instanceof
* unused parameter

* Fix method name
2019-05-01 14:13:43 -04:00
Gary Russell
19b9944dd8 Sonar fixes
* use equals
* inner assignment
* local before return
* unnecessary locals
* catch and throw
* uninstantiable with no statics
* implement `Serializable` in `Comparator` to enable `TreeMap` serialization
* exceptions as flow control
2019-04-30 18:47:43 -04:00
Gary Russell
0bb901b286 Sonar fixes
- printStackTrace in test mail server
- Illegal throws
- Large anon. classes

* - indexOf char
- stored external object

* - ignored exceptional return values

* - checkstyle
2019-04-30 13:57:12 -04:00
Gary Russell
36c33bb5ab Sonar fixes
- a few complexities
- final method calls from ctor
- raw exception throwing
- useless overrides
- loss of stack trace
2019-04-29 18:20:40 -04:00
Artem Bilan
06d3213e08 Upgrade dependencies 2019-04-11 11:32:38 -04:00
Artem Bilan
d21e8f0349 URL Cleanup
This commit updates URLs to prefer the https protocol.
Redirects are not followed to avoid accidentally expanding intentionally
shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed Success
These URLs were switched to an https URL with a 2xx status.
While the status was successful, your review is still recommended.

* [ ] http://www.apache.org/licenses/ with 1 occurrences migrated to:
  https://www.apache.org/licenses/ ([https](https://www.apache.org/licenses/) result 200).
* [ ] http://www.apache.org/licenses/LICENSE-2.0 with 2638 occurrences migrated to:
  https://www.apache.org/licenses/LICENSE-2.0 ([https](https://www.apache.org/licenses/LICENSE-2.0) result 200).
2019-03-21 19:22:26 -04:00
Artem Bilan
d2e974a6de Fix new Sonar smells (#2768)
* Fix new Sonar smells

* Fix some old Sonar smells as well
* Fix Micrometer leaks in the `PollableChannel` when we register
meters, but don't remove them.

* * Fix NPE around `MetricsCaptor` in channels

* * Fix new smells according test report

* * Further Sonar smell fixes

* * More smell fixes for `MessagingMethodInvokerHelper`
* Remove `throws Exception` from `AbstractMessageHandler.destroy()`

* * Fix complexity in the `MessagingMethodInvokerHelper.processInvokeExceptionAndFallbackToExpressionIfAny()`
2019-02-27 15:17:51 -05:00
Artem Bilan
622d42c71a Migrate tests to AssertJ
Mostly thanks to IDEA's plugin: https://plugins.jetbrains.com/plugin/10345-assertions2assertj
There is still a lot of work to do when complex and composite matchers are used.

* Add `awaitility` dependency and deprecate `EventuallyMatcher` in favor
of `awaitility`
* Remove Hamcrest from dependencies and disable JUnit & Hamcrest
static imports to encourage to use only AssertJ
* Migrate JUnit assumptions in rules to AssertJ's assumptions
* Deprecate some custom matchers in favor of existing in Hamcrest
after upgrading the last to version `2.1`
* Replace `ExpectedException` rules with `assertThatThrownBy()`
* Mention `MessagePredicate` in the `testing.adoc`
2019-02-21 10:20:45 -05:00
Artem Bilan
eed16f02ca Fix BeanFactory propagation for MMInvokerHelper (#2694)
* Fix BeanFactory propagation for MMInvokerHelper

* Remove check for `null` in the
`MessagingMethodInvokerHelper.isProvidedMessageHandlerFactoryBean()`
* Fix `RecipientListRouter` for `BeanFactory` propagation to the
`Recipient.selector`
* Fix tests for `BeanFactory` population and propagation
* Add `errorChannel` into the `TestUtils.createTestApplicationContext()`
* Fix some Sonar smell, including new reported

* * Restore NPE check for the `BeanFactory` in the
`MessagingMethodInvokerHelper` to avoid breaking changes in the current
point release
* Some other polishing and optimizations in the
`MessagingMethodInvokerHelper`
2019-01-15 15:16:33 -05:00
Gary Russell
2766707547 Sonar fixes
- remaining hidden fields

* Fix copyright
2019-01-09 13:30:08 -05:00
Gary Russell
53e3248d73 Make Test IMAP Server fields volatile
`resetServer()` runs on a different thread.
2019-01-07 12:42:55 -05:00
Gary Russell
1bafe89d49 Sonar Fixes
- avoid parameter assignments
2019-01-07 11:35:58 -05:00
Gary Russell
e8df546b04 Sonar Fixes - Javadoc-only imports 2019-01-02 12:26:22 -05:00
Artem Bilan
81b4ea1bef Sonar fixes according latest report (#2676)
* Sonar fixes according latest report

* Fix initialization order in the `GatewayMethodInboundMessageMapper`

* Fix mock in the `DelegatingSessionFactoryTests`

* Fix `AbstractRemoteFileOutboundGateway.listFilesInRemoteDir`

* * PR comments

* * Fix `AbstractRemoteFileOutboundGateway.listFilesInRemoteDir` complexity
2018-12-22 11:57:35 -05:00
Artem Bilan
93d7c58b64 Enable ModifierOrderCheck Checkstyle rule (#2673)
* Enable ModifierOrderCheck Checkstyle rule

* Fix violations for `static` and `abstract` modifier
* Remove redundant code in the `TcpNioConnection`
* Mark `connectionFactoryName` as `@Nullable` in the `TcpConnectionSupport`
ctor and its inheritors
* Fix some smells according IDEA suggestions in the affected classes
* This should fix some Sonar smells as well

* * Fix `HeaderMapperTests`

* * Polishing `TcpConnection` code style and fix Javdocs
2018-12-20 19:19:47 -05:00
Artem Bilan
271181247d Fix code smell in test and syslog modules (#2667)
* Fix code smell in test and syslog modules

* * Fix code smell in the scripting module
2018-12-18 15:58:40 -05:00
Gary Russell
687e6d5004 INT-4150: Sonar Fixes
"New" issues for previous commit; Sonar reports as "new" issues in
changed files.
2018-12-06 12:21:16 -05:00
Artem Bilan
992c0ce6a7 INT-4150: Make ImapMailReceiverTests much faster
JIRA: https://jira.spring.io/browse/INT-4150

* Fix internal `taskScheduler` for destroy in the `ImapMailReceiver`
* Some code style polishing in the `ImapIdleChannelAdapter`
2018-12-06 09:08:48 -05:00
Artem Bilan
8305c6fec3 INT-4322: Log merged global properties on startup (#2612)
* INT-4322: Log merged global properties on startup

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

Now we have DEBUG message in logs like this:
```
Spring Integration global properties:

spring.integration.endpoints.noAutoStartup=fooService*
spring.integration.taskScheduler.poolSize=20
spring.integration.channels.maxUnicastSubscribers=0x7fffffff
spring.integration.channels.autoCreate=true
spring.integration.channels.maxBroadcastSubscribers=0x7fffffff
spring.integration.readOnly.headers=
spring.integration.messagingTemplate.throwExceptionOnLateReply=true
```

* Also register a `mergedIntegrationGlobalProperties` bean on a first
`IntegrationContextUtils.getIntegrationProperties()` call to avoid a
new `Properties` object on each call

* * Fix `TestUtils` to register a `BeanDefinition` instead of `registerSingleton()`
and an explicit `afterPropertiesSet()` call

* * Document mentioned changes
* Some polishing for `whats-new.adoc`
2018-10-25 15:30:32 -04:00
Artem Bilan
1595462ce7 Add @LongRunningTest JUnit 5 condition
* Add docs about `@LongRunningTest`
2018-10-10 13:05:48 -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
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
e46fc9b738 INT-4407: Add merge option to Log4j2LevelAdjuster
JIRA: https://jira.spring.io/browse/INT-4407

To make a `Log4j2LevelAdjuster` more builder friendly, add a `merge`
option to the overloaded `classes()` and `categories()` methods.
This way the existing (or previously configured) `categories` and
`classes` are merged with the provided values and default
`org.springframework.integration` category can be reuse.

Note: this behavior can be reconsidered as default one in the `5.1`
2018-02-20 15:05:46 -05:00
Yilin Wei
e6ec86c505 INT-3945: Add async to the @ServiceActivator
JIRA: https://jira.spring.io/browse/INT-3945

Adding test for async annotated ServiceActivator

fix whitespace

Address comments

Change copyright and author

* Some code style polishing
* Rename `Log4j2LevelAdjuster.level()` to more friendly `forLevel()`
factory method name.
* Add `@param level` to the `Log4j2LevelAdjuster.forLevel()` to fix
JavaDoc warning
2018-01-18 09:48:22 -05:00
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
Gary Russell
4207f36a17 INT-4364 Deprecate SocketUtils and remove all use
JIRA: https://jira.spring.io/browse/INT-4364

Always let the OS choose the ports for tests.

Just one test remains (RMI) because there appears to be no way to obtain
the port after creating a registry with a 0 port.

This test has been switched to use the Spring utility.

Polishing - PR Comments
2017-11-13 16:47:42 -05:00
Artem Bilan
a5d30b9f66 Some polishing for test-support module
* Remove `TypeSafeMatcher` in favor of the same class in Hamcrest
* Resolve `serial` warning with `OnFailedToAcquireMutexEvent`
2017-10-13 20:38:31 -04:00
Artem Bilan
079ccb84e2 Add MockMessageHandler to the Testing Framework
Fix PayloadMatcherTests for generics

Address PR comments and other improvements

* Revert `rawtypes` mode for the `PayloadMatcher`
* Make `HeaderMatcher` as `rawtypes` as well
* Make `MockMessageHandler` expect `rawtypes` for `Matcher`s.
This way we can just support `Matcher`s like `notNullValue(Message.class)`
* Rename `expect()` to `assertNext()`
* Rename `andReply()` to `thenReply()`
* Track replies are supplied in the `MockMessageHandler`
* Distinguish simple `MH` from the `MP` types in the
`MockIntegrationContext#instead()` do not let to replace simple `MH`
with fully configured `MockMessageHandler` or any other `MP` implementation.
Fail replace if types mismatch; wrap `MockMessageHandler` to simple `MH`
if it doesn't have replies when we are going to replace simple `MH`
* Wrap `MockMessageHandler` to the `Mockito.spy()` in the
`MockIntegration#mockMessageHandler()` to allow to `verify()` interaction
in the test-case

Remove wrapping `MockMH` to raw `MH` when no reply supported.
If `MockMH` isn't supplied with replies ti's safe to use it as is - no harm to target endpoint
which supposed to be last one in the flow

Some polishing and JavaDocs

More JavaDocs

Add docs for the `MockMessageHandler` and fix some JavaDocs

Make the `MockMessageHandler` with an API like:
```
MockIntegration.mockMessageHandler()
             .handleNext(Consumer<Message<?>>)
             .handleNext(Consumer<Message<?>>)
             .handleNextAndReply(Function<Message<?>, Object>)
             .handleNext(Consumer<Message<?>>)
             .handleNextAndReply(Function<Message<?>, Object>)
             .handleNextAndReply(Function<Message<?>, Object>);
```

Doc Polishing
2017-05-18 11:25:43 -04:00
Gary Russell
4bf266be50 Test Mail Server Add CC: and BCC: Headers
Allow assertions of proper population in tests.

Also set Github tab size to 4.

Fix BODYSTRUCTURE metadata to match actual body (1 line, 5 octets).

Fix RFC822.SIZE to match actual message.
2017-05-15 14:48:34 -04:00
Artem Bilan
2862c449c5 INT-4251: Add Initial Testing Framwork and Docs
JIRA: https://jira.spring.io/browse/INT-4251

MockIntegration PoC

Demonstrate how `MockIntegration.mockMessageSource()` can be used.
Even from the XML Config!
The same semantics can be applied for any other our mocking features we will add to the `MockIntegration`

Add `testMockMessageSourceDynamicFlow()`

Improve `MockIntegration.Context.instead()` for target bean type assertion

Some refactoring, improvements and JavaDocs

* Move `MockIntegration.Context` to its own `MockIntegrationContext` class
* Rename `@MockIntegrationTest` to `@SpringIntegrationTest` since we talk there not only about mocks, but any other possible testing feature for integration
* Add `@SpringIntegrationTest#stopEndpoints()` attribute for endpoints bean names patterns
* Add `IntegrationEndpointsInitializer` to customize `AbstractEndpoint`s according options from the `@SpringIntegrationTest`
Right now it is only about making them `autoStartup = false`

* Rename `SI-test` to `SI-test-support`
* Rename `SI-mock` to `SI-test`
* Rename `@SpringIntegrationTest#stopEndpoints()` to `noAutoStartup()`
* Fix JavaDocs according PR comments
* Increase timeouts in some sporadically failed tests
* Draft for the `testing.adoc`

Fixes spring-projects/spring-integration-java-dsl#23

Fix `testing.adoc` a bit

* Document Testing Support
* Fix a couple typos in the `xml.adoc`
* Add `package-info.java` files to `/test/` sub-packages

Improve docs according PR comments

Fix typos in `TestUtils` JavaDocs

Add `What's New` note about Java DSL and Testing support

Doc Polishing
2017-03-31 14:39:08 -04:00