Commit Graph

328 Commits

Author SHA1 Message Date
Gary Russell
51b659b6d6 INT-4139: Add CORS Config to Graph Annotation
JIRA: https://jira.spring.io/browse/INT-4139

Doc Polishing

Polishing - Fix CORS Test and Revert XML

- Use standard CORS configuration with XML.

(cherry picked from commit 3c28487)
2016-10-17 14:50:54 -04:00
Gary Russell
c4908426fc Revert "INT-4135: Ignore case check for HTTP Content-Type"
This reverts commit a82bca653b.

Backporting causes some breaking changes.

The work around is to use a header enricher/filter to move the
content-type header to contentType.
2016-10-10 14:57:48 -04:00
Artem Bilan
a82bca653b INT-4135: Ignore case check for HTTP Content-Type
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**
2016-10-10 12:59:38 -04:00
Gary Russell
8e3622757d File Cleanup - Event to JMX 2016-06-04 11:39:43 -04:00
Artem Bilan
d57db56a39 INT-4035, INT-4008: Docs for Integration Graph
JIRA: https://jira.spring.io/browse/INT-4035, https://jira.spring.io/browse/INT-4008

Polishing
2016-05-25 09:29:00 -04:00
Artem Bilan
6b6a38f8cb INT-4017: Fix If-None-Match HTTP header tests
JIRA: https://jira.spring.io/browse/INT-4017

According RFC 7232 (https://tools.ietf.org/html/rfc7232#section-2.3) the ETag headers must be in the pattern:
```
ETag       = entity-tag

     entity-tag = [ weak ] opaque-tag
     weak       = %x57.2F ; "W/", case-sensitive
     opaque-tag = DQUOTE *etagc DQUOTE
     etagc      = %x21 / %x23-7E / obs-text
                ; VCHAR except double quotes, plus obs-text
```
Therefore the regexp like `HttpHeaders.ETAG_HEADER_VALUE_PATTERN`
2016-04-28 20:00:06 -04:00
Artem Bilan
47d7a67bda Some various upgrades, fixes and refactoring
* 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`
2016-04-25 23:32:14 -04:00
Artem Bilan
854a504a95 Revert S-AMQP and SF to the latest Milestones
See TODOs in the code of this change
2016-04-25 14:37:24 -04:00
Gary Russell
2370296b95 INT-3967: Add contentDescriptor to Object Model
JIRA: https://jira.spring.io/browse/INT-3967

Polishing

Polishing

Polishing - remove componentName
2016-04-25 13:11:22 -04:00
Artem Bilan
8df487c96f INT-3991: Add IntegrationGraphController
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`
2016-04-22 17:34:21 -04:00
Artem Bilan
4e4763d24f Fix JavaDos and Compiler warnings
https://build.spring.io/browse/INT-B43-162
2016-04-21 10:25:08 -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
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
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
5fe827a3dd Checkstyle - Phase I - Unused Imports
I copied the checkstyle config from spring-boot and commented
out most of the rules.

Over time, we should uncomment each rule and fix violations.
2016-03-04 15:50:08 -05:00
Artem Bilan
c66632a3a0 Fix CrossOriginTestsfor SF-4.3 compatibility
https://build.spring.io/browse/INT-MJATS41-524

Since SF-4.3 (see https://jira.spring.io/browse/SPR-13130) the
`OPTIONS` request, which isn't CORS one (without `HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD`),
is handled by new internal `HttpOptionsHandler`, which just responds with `Allow` header.
2016-01-25 15:00:54 -05:00
Artem Bilan
f4cb9e8e46 Fix HTTP test: provide URL for mock Request
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**
2016-01-21 09:57:52 -05:00
Artem Bilan
c0784bf6ef INT-3933: HTTP & WS Inbound Lifecycle Handling
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`
2016-01-19 14:23:21 -05:00
Gary Russell
c97afe92fe INT-3934: HTTP Requests Without Content-Type
JIRA: https://jira.spring.io/browse/INT-3934

Coerce a missing Content-Type to `application/octet-stream`.
2016-01-18 11:28:05 -05:00
Artem Bilan
f5781bfff8 INT-3918: Use MockMvc instead of Sun HttpServer
JIRA: https://jira.spring.io/browse/INT-3918
2016-01-04 15:21:03 -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
051b393ed0 Prepare Master for 4.3
Reference to 4.3

Refactor `what's new` for 4.3
2015-11-17 12:12:49 -05:00
Gary Russell
4f648a7e4f INT-3818: Multipart Pass Through Converter
JIRA: https://jira.spring.io/browse/INT-3818

INT-3818: Fix Pre JDK8 Syntax

Polishing - PR Comments

Add author name
2015-09-03 21:00:56 -04:00
Artem Bilan
c86141cff7 INT-3813: HTTP module improvements
JIRA: https://jira.spring.io/browse/INT-3813
2015-09-01 12:50:44 -04:00
Artem Bilan
d89dabe72f INT-3778: STOMP Namespace and Documentation
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
2015-08-11 09:17:05 -04:00
Artem Bilan
0f689558ab INT-3792: Fix Some SONAR Vulnerabilities
JIRA: https://jira.spring.io/browse/INT-3792

* Remove `Serializable` requirement for `ThreadStatePropagationChannelInterceptor` generic type
* Increase `PriorityChannelTests` timeout
2015-08-05 14:20:08 -04:00
Gary Russell
9944e54ce5 INT-3781: Configure HTTP GW Timeout Status Code
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`
2015-07-24 18:37:26 -04:00
Artem Bilan
178c86faa4 INT-3683: Fix typo in schema.sql.vpp
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
2015-07-24 16:10:05 -04:00
Artem Bilan
0fdc63007a INT-3723: Fix HTTP Module for Recent SF Changes
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
2015-06-01 12:43:18 -04:00
Artem Bilan
acaf357d72 INT-3687: Fix CORS & upgrade to IO 2.0
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>
```
2015-05-18 08:58:22 +03:00
Artem Bilan
580ecddcc0 INT-3714: Add HTTP CORS Support
JIRA: https://jira.spring.io/browse/INT-3714

Docs and change Reactor dependency to `RELEASE`

AMQP -> `1.5.0.M1` and rebase

Doc Polishing
2015-05-08 11:31:41 +01:00
Artem Bilan
8f09a88f3c INT-3713: Fix HTTP Inbound with the latest MVC
JIRA: https://jira.spring.io/browse/INT-3713
2015-05-05 15:02:18 +01:00
Artem Bilan
6302c86fb8 INT-3709: Fix HTTP module according SF changes
JIRA: https://jira.spring.io/browse/INT-3709
2015-04-27 09:42:17 +01:00
Artem Bilan
2aac4414df INT-3698: HTTP MH: Remove Internal Converters
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
2015-04-16 15:26:23 +01:00
Artem Bilan
3e851d2e1b INT-3697: Map contentType to HTTP Response
JIRA: https://jira.spring.io/browse/INT-3697

Since Spring Integration 4.0 the `MessageHeaders` had been moved to the Spring Messaging module
and `MessageHeaders.CONTENT_TYPE` had been changed from `content-type` name to the `contentType`.

Previously the automatic mapping of `contentType` to the HTTP Request `Content-Type` has been introduced
for the `HttpRequestExecutingMessageHandler`.

This fix do the same for the HTTP Response in case of HTTP Inbound Endpoint.
This allows to transfer HTTP headers automatically from underlying HTTP Outbound Endpoint for HTTP Proxy scenario.
The response from that external HTTP service maybe changed during a downstream flow before sending HTTP Response from the HTTP Inbound Endpoint.
Before this we was forced to map `contentType` to `Content-Type` manually or just rely on the `HttpMessageConverter`s.

**Cherry-pick to 4.1.x**
2015-04-13 13:58:26 +03:00
Gary Russell
632740d2cf INT-3626: More Sonar Fixes
JIRA: https://jira.spring.io/browse/INT-3626

Remove Direct Array Usages.

With the increased use of java configuration and DSL, it
is no longer safe to directly use array arguments.

(Except in simple wrapper objects).

Avoid (or mark //NOSONAR) catch Throwable.

Remove unused field.
2015-02-11 18:12:48 -05:00
Gary Russell
195ee70568 INT-3632: Sonar Improvements
JIRA: https://jira.spring.io/browse/INT-3632

- Use Map.entrySet()
- Double check locking only works when the field(s) are volatile
- Remove unnecessary instanceof tests
2015-02-10 18:00:07 -05:00
Gary Russell
15eb01169d INT-3581: Support selector-expression on WireTap
JIRA: https://jira.spring.io/browse/INT-3581

Move schemas to 4.2.

Add `selector-expression` to `<wire-tap/>`.

INT-3781: Fix What's New

Bump Namespace Version to 4.2
2015-01-13 15:32:06 -05:00
Gary Russell
113716effd INT-3526 Used Expanded URI In Exception Message
JIRA: https://jira.spring.io/browse/INT-3526

Previously, the URI in the exception message is the raw
URI with placeholders, if present.

Use the expanded URI in the message instead.
2014-10-04 10:11:59 +01:00
Gary Russell
a7b5158f4a INT-3524 Fix Tooling MessageChannel References
JIRA: https://jira.spring.io/browse/INT-3524

A number of references (expected-type) still referred to
the Spring Integration 3.0 MessageChanel.
2014-10-03 07:55:23 +01:00
Artem Bilan
2587ed6bd0 INT-3518: Upgrade versions and some cleanup
JIRA: https://jira.spring.io/browse/INT-3518
2014-09-25 14:35:21 +01:00
Artem Bilan
b413239a83 INT-1198: WebSockets: Server Side
JIRA: https://jira.spring.io/browse/INT-1198

INT-1198: WebSocket: Add namespace support

Polishing components according to the namespace support experience

Parser for `<server-container>` and tests

INT-1198: Add parser tests for `<int-websocket:outbound-channel-adapter>`

Introduce `use-broker` on server side

Polishing according PR comments

`What's New` note
2014-09-04 17:27:31 -04:00
Artem Bilan
054f473287 INT-3508: HTTP: Map MessageHeaders.CONTENT_TYPE
JIRA: https://jira.spring.io/browse/INT-3508

Before SI 4.0 and moving `MessageHeaders` to the Spring Messaging the `MessageHeaders.CONTENT_TYPE` had a value as `content-type`,
which was mapped to the HTTP Header `Content-Type` well.
Starting with SF 4.0 `MessageHeaders.CONTENT_TYPE` has a value `contentType`. It doesn't allow to map HTTP headers properly.

* Add `contentType` mapping logic to the `DefaultHttpHeaderMapper`, to map to the `Content-Type` HTTP header and vice versa.
* Fix bug in the `DefaultHttpHeaderMapper#toHeaders`: `ObjectUtils.containsElement` -> `containsElementIgnoreCase`.
Some HTTP servers can return `Content-Type` as `Content-type` or even `content-type`, although it is `Content-Type` anyway.
* Add test-case with `<int:object-to-json-transformer/>`, when the `application/json` value from `MessageHeaders.CONTENT_TYPE` is properly
mapped to the HTTP `Content-Type`. Prior to this fix we had to remap `MessageHeaders.CONTENT_TYPE` to the `Content-Type` manually using `<header-enricher>`

Reformat code

Use only `MessageHeaders.CONTENT_TYPE` for mapping to/from SI

Move `MessageHeaders.CONTENT_TYPE` logic to the `fromHeaders`

Performance Improvements

Remove toLowerCase() calls within loop of `shouldMapHeader()`.

Pre-build lower case versions of arrays.
2014-09-03 14:38:36 -04:00
Artem Bilan
d0cf1a8080 INT-3488: Map Content-Disposition HTTP header
JIRA: https://jira.spring.io/browse/INT-3488

The `Transfer-Encoding` has been remained as unmapped for the `DefaultHttpHeaderMapper.inboundMapper()`
2014-08-19 14:15:53 -04:00