JIRA: https://jira.spring.io/browse/INT-4182
To avoid extra allocation for the `SimpleDateFormat` use a new Java 8 `DateTimeFormatter` based on new `Temporal` abstraction
Leave test-cases as is to save some time for other tasks
Fix RedisLockRegistry for the proper formatter and ZoneId
JIRA: https://jira.spring.io/browse/INT-4172
The `SerializingHttpMessageConverter` which can be customized via `setSupportedMediaTypes()`, but at the same time `canWrite(Class<?> clazz, MediaType mediaType)` consult only default `APPLICATION_JAVA_SERIALIZED_OBJECT`
The target application really may face different media types for the `Serialized` objects not just built-in `application/x-java-serialized-object`
Since we can customize `SerializingHttpMessageConverter` via `setSupportedMediaTypes()` that will be fully consistent to consult `canWrite(mediaType)`
https://sonar.spring.io/component_issues?id=org.springframework.integration%3Aspring-integration%3Amaster#resolved=false|types=BUG
In `IntegrationFlowRegistration` double check locking is ok for `inputChannel`
because we're assigning an existing object, but `MessagingTemplate` constructs
a new object for which double check locking doesn't work.
In any case, for both these items, the chance of concurrent access is extremely low
and is idempotent anyway, so remove double check locking.
Several inner classes can be static.
Other minor fixes.
JIRA: https://jira.spring.io/browse/INT-4156
* Copy `Http` Java DSL from with some fixes to the `HttpMessageHandlerSpec` and Java 8 style
* Port `HttpDslTests` and "de-Boot" it with the Mock MVC
* Upgrade to Spring Security 4.2.0
* Make `spring-integration-security` as a dependency for HTTP module for better test coverage for Security from SI Web perspective
No need in `AuthenticationManager` bean
JavaDocs for HTTP DSL components and some JavaDocs improvements for `HttpRequestHandlingEndpointSupport` and `HttpRequestExecutingMessageHandler`
Restore optional ROME dependency for proper HTTP module compilation
Add missed JavaDoc and mark all HTTP tests with `@DirtiesContext`
Add JavaDocs for `Http` factory methods
JIRA: https://jira.spring.io/browse/INT-3770,
https://jira.spring.io/browse/INT-4107
Having `TransactionHandleMessageAdvice` we can start TX from any `MessageHandler.handleMessage()`
* Add `<transactional>` alongside with the `<request-handler-advice-chain>` for those components which produce reply
* Merge `<transactional>` and `<request-handler-advice-chain>` configuration to a single `ManagedList`
* Rework JPA `<transactional>` in favor of common solution
* Some polishing and refactoring
AbstractPollingEndpoint: avoid `new ArrayList` if we don't have `receiveOnlyAdvice`s
JIRA: https://jira.spring.io/browse/INT-3903
According to RFC-6648, the "X-" prefix has been deprecated and now any use-specific headers can be mapped without any prefix
* Fix `DefaultHttpHeaderMapper` for the `""` as a `userDefinedHeaderPrefix` by default
Document `X-` changes
JIRA: https://jira.spring.io/browse/INT-4135
The incoming `Content-Type` HTTP header can be in any arbitrary case.
Fix `DefaultHttpHeaderMapper` `Content-Type` header re-mapping to the `MessageHeaders.CONTENT_TYPE` via `equalsIgnoreCase()` comparison
**Cherry-pick to 4.3.x**
* Upgrade to Checkstyle `7.1`
* Relax `RequireThis` rule a bit. Right now it does the effort only in case of overlapping. See https://github.com/checkstyle/checkstyle/issues/2362 for more info
* Enable some annotation rules and provide fixes for violations
* Enable `tabs indents` rule. This was the biggest fix in this PR
* Resolve `TODO` in the `MessagingMethodInvokerHelper` and fix tests to meet `IllegalStateException` now
Remain Checkstyle version `6.16.1` and reinstate `RequireThis` rule
The latest Checkstyle has a bug with local scope variables if they have the same names as property.
Revert some literals splitting
Fix some line length exceeding and code style
* Upgrade to SA and SF snapshots
* Address TODOs regarding those upgrades
* Resolve some other TODOs
* Replace `PropertyPlaceholderConfigurer` beans with the `<context:property-placeholder>`
* Upgrade to Spring Social Twitter 1.1.2 and resolve deprecations via mocks (https://github.com/spring-projects/spring-social-twitter/issues/91)
* Upgrade to Curator `3.1.0` and resolve deprecation in the `ZookeeperMetadataStore`
JIRA: https://jira.spring.io/browse/INT-3991
* Add `IntegrationGraphController` `@RestController` over `IntegrationGraphServer` bean
* Add `@EnableIntegrationGraphController` and `<int-http:graph-controller>` to register
`IntegrationGraphController` if the `DispatcherServlet` is in classpath.
* Also register the `IntegrationGraphServer` bean from the same place, if that isn't presented in the application context yet.
* Allow to configure the "root" `path` for the `IntegrationGraphController` as a placeholder value via
`spring.integration.graph.controller.request.mapping.path` property
* Add tests for both `@EnableIntegrationGraphController` and `<int-http:graph-controller>` cases based on the `MockMvc`
checkstyle EmptyBlock
checkstyle fixRightCurly Script
checkstyle EmptyStatement
checkstyle RightCurly
checkstyle TailingWhite
checkstyle NeedBraces
Fix the line separator in the `fixRightCurly.gradle`
* `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
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.
The latest SF changes relies on the `request.getRequestURL()`.
We end up with the `NPE` if mock `ServletRequest`isn't supplied with `requestURL`.
* Add the Mockito answer for the `request.getRequestURL()` in the `MultipartAsRawByteArrayTests`
**Cherry-pick to 4.2.x**
JIRA: https://jira.spring.io/browse/INT-3933
Previously the HTTP and WS Inbound Endpoint haven't handled the `stopped` state properly.
* Add `lifecycle` parsing to the `HttpInboundEndpointParser`
* Handle `!isRunning()` state and throw an appropriate `503 Service Unavailable` HTTP response
* Expose `lifecycle` options for the `<int-ws:inbound-gateway>`
* Introduce `ServiceUnavailableException` `WebServiceException` to indicate `stopped` state for the WS Inbound Endpoint
* Fix tests for the new logic
INT-3933: PR comments: `OrderlyShutdownCapable` for `AbstractWebServiceInboundGateway`
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`
JIRA: https://jira.spring.io/browse/INT-3778
* Add Namespace support for STOMP adapters
* Document the STOMP module
* Fix race condition in the `AbstractStompSessionManager`
* Add `handleTransportError` to the `StompInboundChannelAdapter` and `StompMessageHandler` to log errors during STOMP interactions
* Fix `StompMessageHandler` to handle `RECEIPT` in case of `RECEIPT` header existence, not the common `autoReceipt` option
which can be disable, but the `RECEIPT` header may be present in the message to send
* Increase logging level for the STOMP tests to trace sporadic failures on the CI Server
* Fix several typos
INT-3778: Doc Polishing
JIRA: https://jira.spring.io/browse/INT-3781
- Add mechanisms to set status code on an inbound gateway timeout.
- Send a message to the error channel if configured.
Polishing - Add failedMessage to MTE
Fix Schema Docs; Timeout Detection on Error Flow
Add Zookeeper Leadership Logs
Fix typo in the `SmartLifecycleRoleController`
JIRA: https://jira.spring.io/browse/INT-3683
* In addition fix `inputs` for the Gradle `generateSql` task and regenerate all SQLs
to apply the typo fix.
The previous way to generate sql scripts doesn't work properly. It is always as `UP-TO-DATE`.
Adding `inputs` to the `generateSql` show the correct behaviour.
From other side that makes `cleanSql` task as redundant.
* Applying the Travis config fix to this commit as well.
Fix HTTP test timeout
https://build.spring.io/browse/INT-B41-346
Fix `ProducerAndConsumerAutoStartupTests`
https://build.spring.io/browse/INT-B41-346
Fix `DelayerUsageTests` `time` bean scope bug
https://build.spring.io/browse/INT-B41-347
Fix `HttpInboundGatewayParserTests.java` generics Java < 8 compiler warnings
Increase Tomcat response timeout for WebSocket tests
https://build.spring.io/browse/INT-B41-349
Increase timeout in the `AsyncMessagingTemplateTests#executionException()`
Fix `ClassCastException` for the `StandardWebSocketClient#userProperties`
Increase Delay to 2 Seconds in DelayHandlerTests
JIRA: https://jira.spring.io/browse/INT-3723
Since `RequestMappingHandlerMapping` has reverted to `@RequestMapping` parsing,
restore the previous logic with `@RequestMapping` generation in the `IntegrationRequestMappingHandlerMapping`
Use `AnnotationUtils.synthesizeAnnotation` instead of direct annotation creation through the inline impl
JIRA: https://jira.spring.io/browse/INT-3687
* Change `master` to use IO 2.0 BOM for versions
* Upgrade `jsonPath` to `2.0.0`
* Fix `IntegrationRequestMappingHandlerMapping` according the latest MVC changes around CORS:
https://jira.spring.io/browse/SPR-12933.
* No yet any tests for `Global CORS`: waiting for Namespace support in MVC
Test this with:
```
./gradlew clean springIoCheck -PplatformVersion=2.0.0.BUILD-SNAPSHOT -PJDK8_HOME=<jdk8-home>
```
JIRA: https://jira.spring.io/browse/INT-3698
The `HttpRequestExecutingMessageHandler` added two internal `Converters` to the `ConversionService` before.
In case of parent-child environment it causes memory leak: closing of child context doesn't release
`HttpRequestExecutingMessageHandler` instances, because those internal `Converters` aren't `static`, hence bounded to outer instance.
Actually after introduction since `4.0` version to the `HttpRequestExecutingMessageHandler` the code like:
```
Assert.isTrue(expectedResponseType instanceof Class<?>
|| expectedResponseType instanceof String
|| expectedResponseType instanceof ParameterizedTypeReference,
"'expectedResponseType' can be an instance of 'Class<?>', 'String' or 'ParameterizedTypeReference<?>'.");
if (expectedResponseType instanceof String && StringUtils.hasText((String) expectedResponseType)){
expectedResponseType = ClassUtils.forName((String) expectedResponseType, ClassUtils.getDefaultClassLoader());
}
```
These converters are redundant.
In addition remove the `expected type` for the `uriVariablesExpression` evaluation to avoid `MapToMapConverter`.
**Cherry-pick to 4.1.x, 4.0.x**
INT-3698: Provide robust logic for the `uriExpression` and `httpMethodExpression`
Make some polishing around `Assert`s, when `IllegalStateException` must be presented instead of `IllegalArgumentException`
for the expression evaluation results.
Polishing