Commit Graph

9992 Commits

Author SHA1 Message Date
Artem Bilan
7e52f35ef1 GH-3238: Fix Unmarshaller to close File resource
Fixes https://github.com/spring-projects/spring-integration/issues/3238

* Extract an `InputStream` from a `File` payload in the `UnmarshallingTransformer`
before parsing an XML.
Close this `InputStream` in the `finally` block to release the file resource

**Cherry-pick to 5.2.x, 5.1.x & 4.3.x**
2020-04-02 17:27:37 -04:00
Gary Russell
9f892e3fce GH-3230: MMIH: Fix Pausable/Lifecycle Methods
Resolves https://github.com/spring-projects/spring-integration/issues/3230

Previously, methods with the same name as `Lifecycle` methods were unconditionally ignored.

- Use logic similar to `ControlBusMethodFilter` to explicitly compare the candidate Method
  to those on `Paused` and `Lifecycle` and only ignore those.
- Explicitly disallow these methods when named - previously the check was only performed
  if no method name was supplied.

* - reinstate `Pausable/Lifecycle` methods if explicitly requested.
- log `Pausable` methods that are not candidates.

* - Fix typo in test method.

**Cherry-pick to 5.2.x**
2020-04-01 12:20:27 -04:00
Artem Bilan
96629e4d59 Fix JsonToObjectTransformer for ClassNotFoundEx (#3228)
* Fix JsonToObjectTransformer for ClassNotFoundEx

Related to https://github.com/spring-projects/spring-integration/issues/3223

The `JsonToObjectTransformer` consults `JsonHeaders` first and tries to build
a `ResolvableType` from other type headers which may be just a string identifications.
In this case a `ClassNotFoundException` could be thrown if a `ResolvableType` cannot
be build against non-class identificators

* Add `valueTypeExpression` option to the `JsonToObjectTransformer` to let to
build a `ResolvableType` using any possible custom logic, e.g. resolving
target classes from some registry using their ids from the mentioned headers

**Cherry-pick to 5.2.x**

* * Fix English language mistakes
2020-03-27 15:45:54 -04:00
Spring Buildmaster
0dab086e4a [artifactory-release] Next development version 2020-03-25 18:09:05 +00:00
Spring Buildmaster
6d2932f5ee [artifactory-release] Release version 5.2.5.RELEASE 2020-03-25 18:09:00 +00:00
Artem Bilan
98765fe9f8 Fix deprecation for TX; fix JMS tests; Moore-SR6
* Upgrade to Spring Data Moore-SR6
* Fix `TransactionHandleMessageAdvice` and `TransactionInterceptorBuilder`
for deprecations in the `TransactionInterceptor`
* Fix `TransactionHandleMessageAdvice` and `TransactionInterceptorBuilder`
consumers to expose new `TransactionManager`-based options and
deprecate `PlatformTransactionManager`-based
* Fix failing JMS tests to reuse an ActiveMQ Connection Factory with a
`trustedPackaged(*)`

**Cherry-pick to master**
2020-03-25 12:51:00 -04:00
Artem Bilan
9dc55fd8e4 Fix ActiveMQMultiContextTest for trustAllPackages 2020-03-24 17:20:04 -04:00
Artem Bilan
175908023e Upgrade dependencies 2020-03-24 16:17:30 -04:00
Artem Bilan
9a6849740f GH- 3223: Build ResolvableType after mapping
Fixes https://github.com/spring-projects/spring-integration/issues/3223

The `json__TypeId__` header may have a value which cannot be resolved to the `Class` in the current classpath
So, skip `ResolvableType` building logic until we really sure that end-user wants to map JSON headers
* WARN a build exception that we can't load a class for the `json__TypeId__` when we try to build a `ResolvableType`
in the  `DefaultAmqpHeaderMapper`
* Document the negation feature for JSON headers

**Cherry-pick to 5.2.x**
2020-03-19 14:52:12 -04:00
Gary Russell
070667adc4 GH-3215: MQTT Event for failed connection outbound
Resolves https://github.com/spring-projects/spring-integration/issues/3215

* Add docs; publish an event for an initial connection failure too.

**Cherry-pick to 5.2.x**
2020-03-17 15:10:35 -04:00
Gary Russell
438e2215b3 GH-3199: Fix fail back with Long.MAX_VALUE
Resolves https://github.com/spring-projects/spring-integration/issues/3199

Wheen the `refreshSharedInterval` was `Long.MAX_VALUE` the test for whether
the interval was exceeded always returned true.

Use a boolean instead (already in place on master).

I will backport to 5.1.x, 4.3.x after merge.
2020-03-05 10:33:50 -05:00
Gary Russell
44609d3b13 GH-3199: Fix typo; move capture of creation time 2020-02-28 16:39:20 -05:00
Gary Russell
ac7441ae9b GH-3199: FailoverClientCF - Fail Back Option
Resolves: https://github.com/spring-projects/spring-integration/issues/3199

Previously, the FCCF did not cache a shared connection; if server 1 is down
and server 2 is up, this caused an attempt to connect to server 1 every time
we got the connection.

Add 2 options: `refreshSharedInterval` and `closeOnRefresh`, defaulting to
0 and false respectively, to maintain the same behavior as before the options
existed.

Disallow caching of the single shared connection if the delegate factories are
`CachingClientConnectionFactory` instances.

**cherry-pick to 5.2.x**

I will backport to 5.1.x, 4.3.x after review/merge.

* Polish javadocs and fix typo in docs
2020-02-28 16:08:43 -05:00
Gary Russell
32c81d10a0 disconnectCompletionTimeout Polishing
- rename from `stopCompletionTimeout`
- add to outbound adapter
- use in both places we disconnect on inbound

**cherry-pick forward to 5.2.x, master**

# Conflicts:
#	spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/outbound/MqttPahoMessageHandler.java
2020-02-27 17:29:59 -05:00
Gary Russell
0de2b1b461 Upgrade to MQTT Paho 1.2.2
- fix mock tests for internal client changes
- reduce stop wait for completion time

**cherry-pick to 5.2.x**

* Remove stack trace from test and convert to assertJ

# Conflicts:
#	build.gradle
2020-02-27 16:40:55 -05:00
Spring Buildmaster
ca4c85baed [artifactory-release] Next development version 2020-02-26 18:16:57 +00:00
Spring Buildmaster
d6d23a95a0 [artifactory-release] Release version 5.2.4.RELEASE 2020-02-26 18:16:53 +00:00
Artem Bilan
72a3708312 Upgrade dependencies; prepare for release 2020-02-26 12:38:18 -05:00
Artem Bilan
4e4e8db174 GH-3182: Properly reset bean in the MockIntCtx (#3190)
* GH-3182: Properly reset bean in the MockIntCtx

Fixes https://github.com/spring-projects/spring-integration/issues/3182

The `MockIntegrationContext.resetBeans()` doesn't really restore a state
of endpoint beans: the handle/source is applied only after start for that endpoint

* Stop endpoints in the `MockIntegrationContext.resetBeans()` is they are running currently
* Start them back only if their `autoStartup == true`
* Clear only those beans which names are provided for the `resetBeans()`

**Cherry-pick to 5.2.x**

* * Ensure that only provided beans are reset
2020-02-21 08:50:30 -05:00
Gary Russell
2e409aa599 GH-3175: Add .scanner() to inbound file sync spec
Resolves https://github.com/spring-projects/spring-integration/issues/3175

* Fix `@since` for backport

**Cherry-pick to `5.2.x`**

(cherry picked from commit 1ff69d4d24)
2020-02-11 12:57:59 -05:00
Artem Bilan
23b1a9fb7e GH-3168: Fix FtpSession warning on logout
Fixes https://github.com/spring-projects/spring-integration/issues/3168

* Call `this.client.noop()` instead of `this.client.isConnected()` to really
check that client has a live connection with the server before calling a `this.client.logout()`
* Wrap `this.client.logout()` into a `try..catch` to be sure that we wil call a
`this.client.disconnect()` even if `logout()` fails for some reason.
* Change `WARN` logs about `Session.close()` into a `DEBUG` level -
when we have a problem with closing session because of server disconnect reason
we have no any control to do with a situation

**Cherry-pick to 5.2.x**
2020-02-11 12:06:48 -05:00
Artem Bilan
1bd9954a76 Fix NPE in the DefaultSessionFactoryLocator
**Cherry-pick to 5.2.x**

(cherry picked from commit 00b771d8a8)
2020-02-07 10:51:43 -05:00
Andrey Kezhevatov
b75170403b GH-3169: DSFL: addSessionFactory based on Object
Fixes https://github.com/spring-projects/spring-integration/issues/3169

All other `DefaultSessionFactoryLocator` contracts are based on the `Object`,
so this `addSessionFactor`y has to be on `Object` as well.

* Add `DefaultSessionFactoryLocator.addSessionFactory(Object key, SessionFactory<F> factory)`
* Deprecate existing one based on `String`
* Fix tests do no use a deprecated API
* Some other code style clean up in the affected classes

**Cherry-pick to 5.2.x**

(cherry picked from commit edf84a393d)
2020-02-07 10:39:34 -05:00
Artem Bilan
75476bd365 Populate a JsonHeaders.RESOLVABLE_TYPE on reply (#3163)
* Populate a JsonHeaders.RESOLVABLE_TYPE on reply

Fixes https://github.com/spring-projects/spring-integration-samples/issues/277

In the `AbstractAmqpOutboundEndpoint` the `JsonHeaders.RESOLVABLE_TYPE`
from request message is copied to reply message making inconsistency downstream.
The `JsonToObjectTransformer` consults first a `JsonHeaders.RESOLVABLE_TYPE`
and deserialize payload to wrong type

* Fix `DefaultAmqpHeaderMapper` to populate a `JsonHeaders.RESOLVABLE_TYPE`
alongside with other `JsonHeaders` populated from the reply AMQP message.
This way a `JsonHeaders.RESOLVABLE_TYPE` from request message won't have effect
* To get access to classes, supply `AbstractHeaderMapper` with a bean factory `ClassLoader`
* Introduce a couple utility methods into `JsonHeaders` for building a `ResolvableType`

**Cherry-pick to 5.2.x**

* * Fix code formatting for arguments wrapping
2020-01-31 14:17:56 -05:00
Jayadev Sirimamilla
c2c44c257c GH-3152: Fix for nested Scatter Gather
Fixes https://github.com/spring-projects/spring-integration/issues/3152

The upstream `gatherResultChannel` header has been missed when we produced a reply from nested scatter-gather

Added Test Case for Nested Scatter Gather test

Simplified the the test cases and added author in changed cases

Corrected codestyle issue in Travis CI

Removed additional OriginalReplyChannel and originalErrorChannel in Headers.
Added additional not to be executed line of code in test case.

Restored OriginalErrorChannel Header and removed error handling related fixes

* Clean up code style and improve readability

**Cherry-pick to 5.1.x & master**
2020-01-27 14:57:57 -05:00
sergebg
3850c7ee0c GH-3143: Fix simple pool resizing
Resolves https://github.com/spring-projects/spring-amqp/issues/1142

Resize down does not work when not enough already allocated to match the reduction.

Improved SimplePool test cases and fixed code style

Fixed code style

GH-3143: Test Polishing

- use preferred assertJ expected exception checking
- add a test for reducing a partially allocated pool
- check active counts
2020-01-16 13:15:30 -05:00
Spring Buildmaster
9acad9b4b4 [artifactory-release] Next development version 2020-01-15 16:53:04 +00:00
Spring Buildmaster
e9cfb0289a [artifactory-release] Release version 5.2.3.RELEASE 2020-01-15 16:52:59 +00:00
Artem Bilan
fac8bf17c8 Upgrade dependencies; prepare for release 2020-01-15 11:15:10 -05:00
Artem Bilan
1a9fb83199 GH-3129: Use VARCHAR2 for non-fixed strings (#3133)
Fixes https://github.com/spring-projects/spring-integration/issues/3129

The `CHAR` type in Oracle is for fixed length values.
If the value is not of expected length it is padded with whitespaces.
This causes wrong assumptions when we perform queries against tables.

* Change the `CHAR` into a `VARCHAR2` in those tables for Oracle
where we don't have values with a fixed length.
In fact only `MESSAGE_ID` comes with always fixed length as `36`
because it is fully based on the `UUID`
2019-12-26 13:04:17 -05:00
Gary Russell
939e49cd60 Fix argument type in JMS OCA Spec javadoc 2019-12-24 12:17:23 -05:00
Gary Russell
6ba19823ff Fix javadoc copy/paste typos in JMS OCA Spec 2019-12-24 12:10:31 -05:00
div
c6358a93d4 GH-3123: Don't logout FtpSession if not connected
Fixes https://github.com/spring-projects/spring-integration/issues/3123
2019-12-20 12:14:45 -05:00
Artem Bilan
1334c75147 Fix new Sonar smell 2019-12-20 11:55:26 -05:00
Artem Bilan
5455ccb8dc Fix AbstractMethodAnnPP.postProcess() complexity 2019-12-19 10:55:17 -05:00
Artem Bilan
a9ab4827a9 Fix tests for the previous commit - new behavior 2019-12-18 17:06:59 -05:00
Artem Bilan
887a0896ef Fix Messaging Annotations for ReplyProdMHWrapper
To ensure advice-chain applicability the provided plain
`MessageHandler` is wrapped into a `ReplyProducingMessageHandlerWrapper`
with its particular `.wrapper` bean name.
When we build a graph for integration components, we use a
`componentName` from the `IntegrationObjectSupport` to represent a
node for endpoint in the graph.
In most cases the component name is an endpoint id around a `MessageHandler`

* Populate the missed component name in a `ReplyProducingMessageHandlerWrapper`
in the `AbstractMethodAnnotationPostProcessor` so nodes in the graph has
a proper name for their endpoint in the application context
2019-12-18 16:14:51 -05:00
Artem Bilan
cf7f2df920 Fix link for message-transformation in index.adoc 2019-12-12 12:49:59 -05:00
Gary Russell
34c4554adf Fix UUID import in test 2019-12-12 10:30:30 -05:00
Artem Bilan
54aeaff0f0 Add mavenLocal project property for Gradle
Related to https://github.com/checkstyle/checkstyle/issues/7322

To be able to build the project against `mavenLocal()`, add a
`mavenLocal` project property which can be specified as command line arg
`-PmavenLocal`, so a `mavenLocal()` is added into `repositories`
conditionally
2019-12-06 14:29:44 -05:00
Artem Bilan
71adc5d111 Remove sonar.projectKey & sonar.projectName yet
It turns out that these properties have some reasonable defaults, but
Sonar plugin on Bamboo can't read them anyway.
So, we have to modify CI plan for respective values for the project
2019-12-05 11:39:00 -05:00
Artem Bilan
492aaf91d6 Revert "Remove sonar.projectKey & sonar.projectName"
This reverts commit 66731169c3.
2019-12-05 11:10:00 -05:00
Artem Bilan
66731169c3 Remove sonar.projectKey & sonar.projectName
Remove `sonar.projectKey` & `sonar.projectName` properties from the
`sonarqube` task since they have a reasonable defaults according
plugin docs: https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-gradle/

It looks like the feature to override these properties in the Bamboo
plugin doesn't work properly
2019-12-05 10:53:56 -05:00
Artem Bilan
2e10cc8e9c Add checkstyleVersion Gradle CLI property
Related to https://github.com/checkstyle/checkstyle/issues/7306

According to discussion with Checkstyle team, we agreed to give us
project for testing their latest changes for regressions to avoid
situation like in the mentioned issue with `RequireThis`

* We expose a `checkstyleVersion` for Gradle command line to let to
provide a Checkstyle version externally.
This feature is going to be used on Checkstyle CI to run check in our
project against their SNAPSHOT

The command to run checks against external version is like this:
`./gradlew clean check --parallel -x test -PcheckstyleVersion=[CHECKSTYLE_VERSION]`
Where `[CHECKSTYLE_VERSION]` is a placeholder which should be replaced
with environment-specific variable or an explicit version.
2019-12-05 10:26:30 -05:00
Artem Bilan
2d13032847 Add sonar.projectName property for SonarQube 2019-12-04 18:18:40 -05:00
Artem Bilan
9a3f5b1a51 Revert "Attempt to remove Sonar and Jacoco plugins"
This reverts commit 6400f59194.
2019-12-04 17:54:35 -05:00
Artem Bilan
6400f59194 Attempt to remove Sonar and Jacoco plugins
* It seems all the SonarQube and Jacoco work is done by the
appropriate plugin on Bamboo.
Let's check it!
We always can revert such a change
2019-12-04 17:50:57 -05:00
Artem Bilan
837eda30a9 Populate sonar.projectKey property
* Change deprecated `sonar.jacoco.reportPath` to a new recommended one -
`sonar.coverage.jacoco.xmlReportPaths`
2019-12-04 17:35:12 -05:00
Spring Buildmaster
c8befb268d [artifactory-release] Next development version 2019-12-04 18:51:13 +00:00
Spring Buildmaster
d233288a8b [artifactory-release] Release version 5.2.2.RELEASE 2019-12-04 18:51:09 +00:00