Commit Graph

9461 Commits

Author SHA1 Message Date
Artem Bilan
0d09bdccd4 Replace xmlunit dependecy with AssertJ methods 2018-12-21 09:10:23 -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
Gary Russell
a01d09f0f1 Sonar Fixes
Final critical smells.
2018-12-20 11:58:32 -05:00
Artem Bilan
761af2730c * Fix Sonar issues for Sec., STOMP, SFTP, WebFlux 2018-12-19 16:51:22 -05:00
Gary Russell
7790f9e550 Sonar fixes
Critical issues `o.s.i.t*`, `o.s.i.u*`.

* Polishing - PR Comments.
2018-12-19 14:49:27 -05:00
Artem Bilan
8ce8bf9d73 Fix code smell in websocket and webflux modules (#2669)
* * Fix code smell in websocket and webflux modules

* * More fixes

* * Fix NPE in the `IntegrationHandlerResultHandler`
2018-12-19 12:33:47 -05:00
Gary Russell
e8bd31cc37 Sonar fixes
Critical smells `0.s.i.r*`

* Polishing - PR Comments.
2018-12-19 09:47:57 -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
Artem Bilan
12dd73d219 Fix code smell for PayloadTypeConvertTransformers 2018-12-18 15:27:34 -05:00
Artem Bilan
3dd8b63576 INT-4569: Disallow beans override in DSL (#2664)
* INT-4569: Disallow beans override in DSL

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

* Thorw `BeanDefinitionOverrideException` from the
`IntegrationFlowBeanPostProcessor` when it detects existing bean and it
is not the same object we try to register from the DSL
* Document limitations about `prototype` beans
* Some polishing in the DSL chapter of the docs

* * Fix algorithm in the `IntegrationFlowBeanPostProcessor.noBeanPresentForComponent()`

* * Polishing dsl.adoc
* Call `BeanFactory.initializeBean()` for existing beans if they are
`prototype`

* * Code formatting in the `ManualFlowTests`
2018-12-18 14:22:17 -05:00
Gary Russell
65df35bfd1 Sonar fixes
Critical smells `o.s.i.m*`.
2018-12-18 13:28:59 -05:00
Artem Bilan
3f48d2043b ImapMailReceiver: Check folder.isOpen before idle
Increase wait timeout for message in the ImapMailReceiverTests

https://build.spring.io/browse/INT-MASTERSPRING40-556/
2018-12-15 14:30:59 -05:00
Gary Russell
355479f935 Sonar false positive polishing
Reported on next line.
2018-12-14 22:26:23 -05:00
Gary Russell
7efe79f457 Sonar fixes
Critical issues for `o.s.i.j*` (except `jdbc`).
2018-12-14 16:12:04 -05:00
Artem Bilan
89fdb938de Increase expire period for testExpireTwoRegistries
https://build.spring.io/browse/INT-MASTER-1313/

**Cherry-pick to 5.0.x**
2018-12-14 11:52:21 -05:00
Artem Bilan
c5f29fc6ef 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:38:38 -05:00
Gary Russell
3f522f7efe Fix "new" Sonar issues
Reported as new due to touched source file.
2018-12-13 23:21:42 -05:00
Artem Bilan
d7356aa85d Use Context CL wherever it is applicable (#2656)
* Use Context CL wherever it is applicable

* Use `ClassUtils.getDefaultClassLoader()` in the `IntegrationManagementConfigurer`
for checking a Micrometer presence from the `afterSingletonsInstantiated()`
* Use `ClassUtils.getDefaultClassLoader()` in the `ScatterGatherHandler`
to load required class
* Refactor `HeaderEnricherParserSupport` do not use CL at all.
The `TypedStringValue` will resolve a target type later by the
`BeanFactory`.
This way we honor a property placeholder behavior for the `type` XML
attribute

* * Use `ClassUtils.getDefaultClassLoader()` in the ScatterGatherHandler ctor
2018-12-13 16:14:37 -05:00
Artem Bilan
33e52486cf More fixes for IMAP channel adapter and its tests
https://build.spring.io/browse/INT-MASTERSPRING40-553

The `ImapMailReceiverTests` fails sporadically according some race
condition or wrong logic.

* Fix `ImapIdleChannelAdapter` to check for folder not null before
performing logic in the `IdleTask`
* Polishing for logs which are based on constant strings
* Remove `volatile` from configuration properties in the
`ImapIdleChannelAdapter` and `AbstractMailReceiver`
* Refactor some smells into the `protected` getters instead of direct
access to the property
* Stop channel adapters in the `ImapMailReceiverTests`
* Also destroy task schedulers in the `ImapMailReceiverTests`
2018-12-12 13:06:16 -05:00
Gary Russell
ca2e70f236 Sonar Fixes
Critical smells for `o.s.i.jdbc`.

Fix new smell in TCP.
2018-12-10 14:31:17 -05:00
Gary Russell
579a72265c Fix Broken TCP OG Test
Default timeout expression is now a `ValueExpression`.
2018-12-09 20:47:17 -05:00
Gary Russell
563f526ddc Sonar Fixes
Critical smells for packages `o.s.i.i*`.

* Polishing

* Polishing

* Missed saving a file.

* Polishing - PR Comments

* More PR comments.
2018-12-07 14:59:27 -05:00
Gary Russell
4760c54097 Sonar Fixes
Critical smells `o.s.i.h*`.
2018-12-07 12:39:19 -05:00
Artem Bilan
536b6b1786 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
2018-12-06 15:41:40 -05:00
Gary Russell
2cde493fbf Sonar Fixes
Packages `o.s.i.g*`

* Polishing - PR comments
2018-12-06 15:23:54 -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
29b4a296be INT-4563: Add JMX test for MQTT
JIRA: https://jira.spring.io/browse/INT-4563

* Add a `MqttDslTests` with the JMX configured to be sure that SI
managed components are registered in JMX properly.
* Also this test covers a Java DSL configuration for MQTT channel adapters
* Some polishing for `AbstractMqttMessageHandler`
* Document Java DSL configuration for the MQTT channel adapters
2018-12-04 15:31:22 -05:00
Gary Russell
9832f61d2a 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.
2018-12-04 15:13:49 -05:00
Gary Russell
62fc7df693 Sonar Fixes
Critical smells, packages `o.s.i.a*` to `f*`.

Plus new smells caused by these changes.
2018-12-03 10:44:26 -05:00
Artem Bilan
4ade0ceaf4 INT-4385: Clarify <jms> namespace in jms.adoc
JIRA: https://jira.spring.io/browse/INT-4385

It is slightly unclear for end-users that `<jms:listener-container/>`
is just a syntax sugar and the real JMS container is created by the
`<jms:listener>` sub-element

* Add a NOTE to the `jms.adoc` to explain such a confuse and what and
how is going to happen if the intention to use a `<jms:listener-container/>`
for Spring Integration channel adapters.
2018-11-30 13:29:19 -05:00
Gary Russell
7135d0603c 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**
2018-11-30 13:07:59 -05:00
Spring Buildmaster
cfa439d0d4 [artifactory-release] Next development version 2018-11-28 20:00:11 +00:00
Spring Buildmaster
b047b8d9bb [artifactory-release] Release version 5.1.1.RELEASE 2018-11-28 20:00:03 +00:00
Artem Bilan
9d21bf29f6 Upgrade dependencies and fix tests for them 2018-11-28 14:31:04 -05:00
Gary Russell
39fef2c70a 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**
2018-11-28 14:18:09 -05:00
Gary Russell
a4746f79ae Sonar fix 2018-11-27 23:01:47 -05:00
Gary Russell
26ce65deef More Sonar fixes 2018-11-27 22:41:00 -05:00
Gary Russell
9488fdf667 Fix new Sonar issues 2018-11-27 22:09:34 -05:00
Artem Bilan
0ef8dc569f Upgrade versions and fix deprecated in AMQP test 2018-11-27 13:13:24 -05:00
Artem Bilan
d981171972 Fix ambiguity in the JpaExecutor (#2640)
* Fix ambiguity in the `JpaExecutor`

Since we can't mutate a provided `ParameterSourceFactory` with the
provided `jpaParameters`, we have to reject such a combined
configuration in favor of the advice to configure params on the
provided `ParameterSourceFactory`

* Throw `IllegalStateException` when `ParameterSourceFactory` and
`jpaParameters` are configured together on the `JpaExecutor`
* Some refactoring for `JpaExecutor` to have a consistent code style
* Fix tests according new logic
* Document such an ambiguity configuration to avoid confusion

**Cherry-pick to 5.0.x**

* * Use `assertThatThrownBy()` in the `JpaExecutorTests`
* Fix "No BeanFactory" warning in the `JpaExecutorTests`

* * Resolve potential NPE and add `@NonNullApi` with `@Nullable` on the `poll()`
2018-11-27 11:00:40 -05:00
Gary Russell
f6e9e6649a Fix Resequencer test wait time
https://build.spring.io/browse/INT-MASTERSPRING40-534/

Since we are expecting a message, a large wait time is no detriment
to test runtime and provides a more reliable test on a busy CI server.
2018-11-24 11:11:35 -05:00
Gary Russell
9e6e60e6a7 TCP Doc Polishing 2018-11-23 16:18:21 -05:00
Gary Russell
c3f8c4af27 More Sonar resolutions 2018-11-20 14:15:59 -05:00
Gary Russell
aa8068a71b Sonar Address new issues in LambdaMessageProcessor 2018-11-20 11:27:18 -05:00
Gary Russell
c9ae6c794f Sonar: AMQP Fixes
- critical smells
- also import in IMHA

* Polishing
2018-11-20 09:38:15 -05:00
Gary Russell
0c33591676 Log error for class cast exception on lambda
**cherry-pick to 5.0.x**

* Fix test

* Polish log message.

* Polishing - docs and javadocs.
2018-11-19 16:56:35 -05:00
Gary Russell
852ec1ee25 INT-4557 Improve query cache in JDBC channel store
JIRA: https://jira.spring.io/browse/INT-4557

- Avoid hashing the query String on each call.
- Use a concurrent map.

* Polishing - PR Comments
2018-11-19 14:17:37 -05:00
Artem Bilan
b3cf864675 Fix LambdaMessageProcessor for conversion
SO: https://stackoverflow.com/questions/53378821

There is no need to jump into the `MessageConverter` if payload type
is assignable to the target type
2018-11-19 13:39:36 -05:00
Artem Bilan
e9c554534a 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:01:52 -05:00