Commit Graph

2293 Commits

Author SHA1 Message Date
Gary Russell
43b83bec53 INT-4038: Add GPFB Gateways to Graph
JIRA: https://jira.spring.io/browse/INT-4038

General format for node name: bean.method#n

The #n is needed to disambiguate methods with the same name.

Polishing according PR comments

* Fix generic type for `Collections.unmodifiableMap` usage
* Change the gateway method logic in the `IntegrationGraphServer` to include the method signature in the node name to distinguish them as unique
* Move `MutableMessageBuilderFactoryTests` into the separate nested `mutable` package since `@IntegrationComponentScan` sees a new `@MessagingGateway` in the `IntegrationGraphServerTests`.
See https://jira.spring.io/browse/INT-4040
* Document the `@MessagingGateway` representation in the `graph.adoc`
2016-05-26 11:16:28 -04:00
Artem Bilan
49985df858 Fix AbstractKeyValueMessageStore create time
The `RedisMessageGroupStoreTests.testMessageGroupUpdatedDateChangesWithEachAddedMessage()` can fail
 sporadically because there is no guaranty the several calls to the `System.getCurrentTimeMillis()` return the same value.

 * Fix `AbstractKeyValueMessageStore` to reuse `MessageGroup.timestamp` for the `lastModified` in case of a new group
2016-05-18 13:35:30 -04:00
Gary Russell
a5ee9bb7f9 INT-4032: Annotation Javadoc Fixes
JIRA: https://jira.spring.io/browse/INT-4032

Polishing according PR comments
2016-05-13 16:53:16 -04:00
Artem Bilan
6c01056806 Fix timing issue in AdvisedMessageHandlerTests
https://build.spring.io/browse/INT-B43-199/

The `circuitBreakerTests()` relied on the enough short `Thread.sleep(100)`,
which may not be enough in the heavy-load environment like CI Server.
Therefor the time in between thread switching really can be much bigger than expected.

* Fix the test via timeout "emulation" using reflection to set the `lastFailure` somewhere in the past
to overcome `RequestHandlerCircuitBreakerAdvice.halfOpenAfter` barrier
2016-05-10 18:26:28 -04:00
Gary Russell
29fc5e6380 Fix Call Overridable Method From Ctor
https://sonar.spring.io/issues/search#componentRoots=org.springframework.integration%3Aspring-integration|createdAt=2016-05-03T02%3A58%3A49%2B0000|sort=UPDATE_DATE|asc=false
2016-05-03 09:10:13 -04:00
Artem Bilan
6c774638cc INT-4021: SimpleMessageStore: Disable lazy-load
JIRA: https://jira.spring.io/browse/INT-4021

Previously the `SimpleMessageStore` unconditionally followed with the super class options
and provided the `lazy-load` functionality by default.

* Since `persistent` and `lazy-load` logic does not make sense for the `in-memory` store, disable it in the `SimpleMessageStore`
* Fir `AggregatorTests` for better coverage.
* NOTE: The same message can't be persisted in the Persistent `MessageStore`. The store key is fully based on the `messageId`.
And also we provide the header which indicates that the messages has been stored before. See `JdbcMessageStore.addMessage()` for example:
```
if (message.getHeaders().containsKey(SAVED_KEY)) {
      Message<T> saved = (Message<T>) getMessage(message.getHeaders().getId());
      if (saved != null) {
		if (saved.equals(message)) {
			return message;
		} // We need to save it under its own id
	}
}
```
* Fix (S)FTP Streaming tests to use `AbstractPersistentAcceptOnceFileListFilter` instead of raw `AcceptOnceFileListFilter`,
which relies on the object identity, but neither `FtpFile`, nor  `ChannelSftp.LsEntry` provides good `equals()` and `hashCode()` implementations.
* Make `StompIntegrationTests` as `DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD` because the sporadic failure on the Travis around wrong value from the queue isn't clear (yet).
Looks like some interim event is generated by the Websocket Container on the Tomcat.
2016-05-02 15:11:20 -04:00
Artem Bilan
aa9a3ffc25 INT-4020: Fix Unnamed Global Wire-Taps
JIRA: https://jira.spring.io/browse/INT-4020

The fix for `named` global `wire-tap`s (INT-2230) didn't covered testing for `unnamed`.
Therefore the fix unconditionally didn't picked up the issue that we used a wrong `BeanDefinition` to determine the current `id`

* Fix `WireTapParser` to use `wireTapBeanName` from the `resolveId()` when the `GlobalChannelInterceptorParser` invokes it.
* Add tests to demonstrate the issue and confirm the fix

**Cherry-pick to 4.2.x**
2016-04-30 10:31:05 -04:00
Manuel Jordan
8cfb7414ad INT-4005: Fix channels' capacity with store
JIRA: https://jira.spring.io/browse/INT-4005

* The `<int:queue>` lets declare the `capacity` attribute together
with either `message-store` or `ref` attributes, which it is not
correct

* The `<int:queue>` lets declare the `capacity` attribute together
with either `message-store` or `ref` attributes, which it is not
correct
* The `priority-queue` lets declare the `capacity` attribute
together with the `message-store` attribute, which it is not
correct
* Reference documentation fixed for `channel.adoc` and `jdbc.adoc`,
doing mention about these restrictions

* Minor changes about conventions and formats applied.

Code polishing
2016-04-29 15:34:24 -04:00
Gary Russell
287d924fc0 INT-4015: Streaming Remote File Inbound Adapter
JIRA: https://jira.spring.io/browse/INT-4015
      https://jira.spring.io/browse/INT-3854

Initial commit.

Reworked to emit an input stream and use the file splitter.

Add StreamTransformer.

Add CLOSABLE_RESOURCE header so we can close the session automatically.

Implement INT-3854, FTP, SFTP

(S)FTP Namespace Changes

Docs - also fixes a PDF overflow

Polishing - PR Comments

checkstyle fixes

Polishing - Add Namespace for StreamParser

Polishing - PR Comments
2016-04-29 13:24:23 -04:00
Gary Russell
6a9a42562c INT-4009: Support Composite Handler in Graph
JIRA: https://jira.spring.io/browse/INT-4009

Adds:

    ...
    "handlers" : [ {
      "name" : "polledChain$child#0",
      "type" : "transformer"
    }, {
      "name" : "polledChain$child#1",
      "type" : "service-activator"
    } ],
    ...

to a chain node.

INT-4010: Add Discard Flows to Object Model

JIRA: https://jira.spring.io/browse/INT-4010
2016-04-26 12:31:39 -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
Gary Russell
564eb165d1 INT-3993: Add Error Flow Logic to Object Map
JIRA: https://jira.spring.io/browse/INT-3993

Does not include "standard" `errorChannel` routing from pollers,
this is implied.
2016-04-25 13:12:27 -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
286c421c1a INT-3387: MessageGroupStore Improvements
JIRA: https://jira.spring.io/browse/INT-3387,
https://jira.spring.io/browse/INT-3806

* Introduce
```
MessageGroupStore

void addMessagesToGroup(Object groupId, Message<?>... messages);
```
And implement it in all stores.

* Use new `addMessagesToGroup` where it is reasonable, e.g. `DelayHandler`
* Optimize test-case to use a new store method (where it is possible)
* Fix timing delays in the `JdbcMessageStoreTests`
* Introduce `PersistentMessageGroup`
* Add `AbstractMessageGroupStore#proxyMessageGroupForLazyLoad` to wrap the raw `MessageGroup` to the `PersistentMessageGroup` for lazy-load
* Rework `MessageGroupMetadata` do not be `immutable` and allow to store/restore in the `AbstractKeyValueMessageStore` only the `MessageGroupMetadata`
* Refactor `ResequencingMessageHandler` and `SequenceSizeReleaseStrategy` a bit for better performance when interact with the `MessageGroup`
* Add `AbstractMessageGroupStore#setLazyLoadMessageGroups` to switch off the `lazy-load` behavior and restore the previous full `MessageGroup` logic
* Add `What's New` note and `message-store.adoc` paragraph for the lazy-load functionality

`GroupType.PERSISTENT` and not lazy by default

PR Comments

Fix `JdbcMessageStoreTests` timing issues

Address PR comments

* Add performance test to the `ConfigurableMongoDbMessageGroupStoreTests`
* Add JavaDocs for the `MessageGroupFactory` methods
* Add `log4j.properties` into the `test` MongoDB module for better traceability
* Fix `JdbcMessageStore#getOneMessageFromGroup()` over the `doPollForMessage()` delegation.
The `jdbcTemplate.queryForObject()` requires exactly one and only one raw in `resultSet`
* Add performance test results into the `message-store.adoc`
2016-04-21 17:47:20 -04:00
Artem Bilan
1dc4ebe4d1 INT-4001 Disable some Jackson features by default
JIRA: https://jira.spring.io/browse/INT-4001

Since all other Spring Framework components use the Jackson's `ObjectMapper` configuration by default as:
```
this.objectMapper.configure(MapperFeature.DEFAULT_VIEW_INCLUSION, false);
this.objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
```
It would be better to be consistent in Spring Integration, too.

* Add mention options to the `Jackson2JsonObjectMapper` default's `ObjectMapper`
* Add on more constructor into the `Jackson2JsonMessageParser` to allow to inject customized `Jackson2JsonObjectMapper`
* Modify a couple tests to reflect the change
* Reformat code style in the `AbstractJsonInboundMessageMapperTests` for better readability

**The Migration Guide note follows up**
2016-04-20 17:09:55 -04:00
Artem Bilan
256a7292ef INT-3999: Avoid "hard" References from Futures
JIRA: https://jira.spring.io/browse/INT-3999

Since the scheduled tasks may live for a long time it can finish
with the `OutOfMemory` if we use the direct reference to big objects, like `Message<?>`.

* Fix `AbstractCorrelatingMessageHandler` to deal only with the `groupId`
from the `scheduleGroupToForceComplete()` when we `schedule` `Runnable` for the `forceRelease` logic.
* Fix `DelayHandler` to deal only with `messageId` in the `releaseMessageAfterDelay()`, when we
`schedule` `Runnable` for the `releaseMessageAfterDelay`.
* Since the logic hasn't been changed for those components, there is no any new test.
There is just enough to be sure that all existing tests are fine.

**Cherry-pick to 4.0.x, 4.1.x, 4.2.x**

Optimise the release task for the `SimpleMessageStore` case
2016-04-20 15:55:44 -04:00
Artem Bilan
882f4c017e INT-3998: Channel Late-Binding for WireTap
JIRA: https://jira.spring.io/browse/INT-3998

Do not modify interceptors from the `AbstractMessageChannel`.

They must be declared as beans, too.

Fix [UnusedImport] in the `EnableIntegrationTests`

Doc Polishing
2016-04-20 15:12:42 -04:00
Artem Bilan
818387f0a4 INT-3982: Fix XSD declaration ambiguity
JIRA: https://jira.spring.io/browse/INT-3982

Also fix some sporadic, timing issues in tests
2016-04-19 08:18:14 -04:00
Gary Russell
ae9cfc3ea5 INT-3967: Sonar Issues
https://sonar.spring.io/issues/search#componentRoots=org.springframework.integration%3Aspring-integration|createdAt=2016-04-16T02%3A56%3A21%2B0000|sort=UPDATE_DATE|asc=false
2016-04-16 10:03:33 -04:00
Gary Russell
ed40582121 INT-3967: Expose Object Model
JIRA: https://jira.spring.io/browse/INT-3967,
https://jira.spring.io/browse/INT-3987

Based on the XD FLO object model, each node represents an endpoint or channel.
The graph contains nodes and links where the links represent a connection (publish
or consume) to/from a channel.

From the test case...

```
{
  "nodes" : [ {
    "name" : "three",
    "output" : null,
    "input" : null,
    "stats" : {
      "countsEnabled" : true,
      "statsEnabled" : true,
      "loggingEnabled" : true,
      "sendCount" : 0,
      "sendErrorCount" : 0,
      "timeSinceLastSend" : 0.0,
      "meanSendRate" : 0.0,
      "meanErrorRate" : 0.0,
      "meanErrorRatio" : 0.0,
      "meanSendDuration" : 0.0,
      "minSendDuration" : 0.0,
      "maxSendDuration" : 0.0,
      "standardDeviationSendDuration" : 0.0,
      "sendDuration" : {
        "count" : 0,
        "min" : 0.0,
        "max" : 0.0,
        "mean" : 0.0,
        "standardDeviation" : 0.0,
        "countLong" : 0
      },
      "sendRate" : {
        "count" : 0,
        "min" : 0.0,
        "max" : 0.0,
        "mean" : 0.0,
        "standardDeviation" : 0.0,
        "countLong" : 0
      },
      "errorRate" : {
        "count" : 0,
        "min" : 0.0,
        "max" : 0.0,
        "mean" : 0.0,
        "standardDeviation" : 0.0,
        "countLong" : 0
      },
      "available" : true
    },
    "componentType" : "channel",
    "componentName" : "three",
    "nodeId" : 1
  }, {
    "name" : "four",
    "output" : null,
    "input" : null,
    "stats" : {
      "countsEnabled" : true,
      "statsEnabled" : true,
      "loggingEnabled" : true,
      "sendCount" : 0,
      "sendErrorCount" : 0,
      "timeSinceLastSend" : 0.0,
      "meanSendRate" : 0.0,
      "meanErrorRate" : 0.0,
      "meanErrorRatio" : 0.0,
      "meanSendDuration" : 0.0,
      "minSendDuration" : 0.0,
      "maxSendDuration" : 0.0,
      "standardDeviationSendDuration" : 0.0,
      "sendDuration" : {
        "count" : 0,
        "min" : 0.0,
        "max" : 0.0,
        "mean" : 0.0,
        "standardDeviation" : 0.0,
        "countLong" : 0
      },
      "sendRate" : {
        "count" : 0,
        "min" : 0.0,
        "max" : 0.0,
        "mean" : 0.0,
        "standardDeviation" : 0.0,
        "countLong" : 0
      },
      "errorRate" : {
        "count" : 0,
        "min" : 0.0,
        "max" : 0.0,
        "mean" : 0.0,
        "standardDeviation" : 0.0,
        "countLong" : 0
      },
      "available" : true
    },
    "componentType" : "channel",
    "componentName" : "four",
    "nodeId" : 2
  }, {
    "name" : "nullChannel",
    "output" : null,
    "input" : null,
    "stats" : {
      "countsEnabled" : true,
      "statsEnabled" : true,
      "loggingEnabled" : true,
      "sendCount" : 0,
      "sendErrorCount" : 0,
      "timeSinceLastSend" : 0.0,
      "meanSendRate" : 0.0,
      "meanErrorRate" : 0.0,
      "meanErrorRatio" : 0.0,
      "meanSendDuration" : 0.0,
      "minSendDuration" : 0.0,
      "maxSendDuration" : 0.0,
      "standardDeviationSendDuration" : 0.0,
      "sendDuration" : {
        "count" : 0,
        "min" : 0.0,
        "max" : 0.0,
        "mean" : 0.0,
        "standardDeviation" : 0.0,
        "countLong" : 0
      },
      "sendRate" : {
        "count" : 0,
        "min" : 0.0,
        "max" : 0.0,
        "mean" : 0.0,
        "standardDeviation" : 0.0,
        "countLong" : 0
      },
      "errorRate" : {
        "count" : 0,
        "min" : 0.0,
        "max" : 0.0,
        "mean" : 0.0,
        "standardDeviation" : 0.0,
        "countLong" : 0
      },
      "available" : true
    },
    "componentType" : "channel",
    "componentName" : "nullChannel",
    "nodeId" : 3
  }, {
    "name" : "errorChannel",
    "output" : null,
    "input" : null,
    "stats" : {
      "countsEnabled" : true,
      "statsEnabled" : true,
      "loggingEnabled" : true,
      "sendCount" : 0,
      "sendErrorCount" : 0,
      "timeSinceLastSend" : 0.0,
      "meanSendRate" : 0.0,
      "meanErrorRate" : 0.0,
      "meanErrorRatio" : 0.0,
      "meanSendDuration" : 0.0,
      "minSendDuration" : 0.0,
      "maxSendDuration" : 0.0,
      "standardDeviationSendDuration" : 0.0,
      "sendDuration" : {
        "count" : 0,
        "min" : 0.0,
        "max" : 0.0,
        "mean" : 0.0,
        "standardDeviation" : 0.0,
        "countLong" : 0
      },
      "sendRate" : {
        "count" : 0,
        "min" : 0.0,
        "max" : 0.0,
        "mean" : 0.0,
        "standardDeviation" : 0.0,
        "countLong" : 0
      },
      "errorRate" : {
        "count" : 0,
        "min" : 0.0,
        "max" : 0.0,
        "mean" : 0.0,
        "standardDeviation" : 0.0,
        "countLong" : 0
      },
      "available" : true
    },
    "componentType" : "publish-subscribe-channel",
    "componentName" : "errorChannel",
    "nodeId" : 4
  }, {
    "name" : "one",
    "output" : null,
    "input" : null,
    "stats" : {
      "countsEnabled" : true,
      "statsEnabled" : true,
      "loggingEnabled" : true,
      "sendCount" : 0,
      "sendErrorCount" : 0,
      "timeSinceLastSend" : 0.0,
      "meanSendRate" : 0.0,
      "meanErrorRate" : 0.0,
      "meanErrorRatio" : 0.0,
      "meanSendDuration" : 0.0,
      "minSendDuration" : 0.0,
      "maxSendDuration" : 0.0,
      "standardDeviationSendDuration" : 0.0,
      "sendDuration" : {
        "count" : 0,
        "min" : 0.0,
        "max" : 0.0,
        "mean" : 0.0,
        "standardDeviation" : 0.0,
        "countLong" : 0
      },
      "sendRate" : {
        "count" : 0,
        "min" : 0.0,
        "max" : 0.0,
        "mean" : 0.0,
        "standardDeviation" : 0.0,
        "countLong" : 0
      },
      "errorRate" : {
        "count" : 0,
        "min" : 0.0,
        "max" : 0.0,
        "mean" : 0.0,
        "standardDeviation" : 0.0,
        "countLong" : 0
      },
      "available" : true
    },
    "componentType" : "channel",
    "componentName" : "one",
    "nodeId" : 5
  }, {
    "name" : "two",
    "output" : null,
    "input" : null,
    "stats" : {
      "countsEnabled" : true,
      "statsEnabled" : true,
      "loggingEnabled" : true,
      "sendCount" : 0,
      "sendErrorCount" : 0,
      "timeSinceLastSend" : 0.0,
      "meanSendRate" : 0.0,
      "meanErrorRate" : 0.0,
      "meanErrorRatio" : 0.0,
      "meanSendDuration" : 0.0,
      "minSendDuration" : 0.0,
      "maxSendDuration" : 0.0,
      "standardDeviationSendDuration" : 0.0,
      "sendDuration" : {
        "count" : 0,
        "min" : 0.0,
        "max" : 0.0,
        "mean" : 0.0,
        "standardDeviation" : 0.0,
        "countLong" : 0
      },
      "sendRate" : {
        "count" : 0,
        "min" : 0.0,
        "max" : 0.0,
        "mean" : 0.0,
        "standardDeviation" : 0.0,
        "countLong" : 0
      },
      "errorRate" : {
        "count" : 0,
        "min" : 0.0,
        "max" : 0.0,
        "mean" : 0.0,
        "standardDeviation" : 0.0,
        "countLong" : 0
      },
      "available" : true
    },
    "componentType" : "channel",
    "componentName" : "two",
    "nodeId" : 6
  }, {
    "name" : "producer",
    "output" : "one",
    "input" : null,
    "stats" : null,
    "componentType" : "test-producer",
    "componentName" : "producer",
    "nodeId" : 7
  }, {
    "name" : "polling",
    "output" : null,
    "input" : "four",
    "stats" : null,
    "componentType" : "unknown",
    "componentName" : "unknown",
    "nodeId" : 8
  }, {
    "name" : "foreignMessageHandlerNoStats",
    "output" : null,
    "input" : "three",
    "stats" : null,
    "componentType" : "unknown",
    "componentName" : "unknown",
    "nodeId" : 9
  }, {
    "name" : "_org.springframework.integration.errorLogger",
    "output" : null,
    "input" : "errorChannel",
    "stats" : {
      "countsEnabled" : true,
      "statsEnabled" : true,
      "loggingEnabled" : true,
      "handleCount" : 0,
      "errorCount" : 0,
      "meanDuration" : 0.0,
      "minDuration" : 0.0,
      "maxDuration" : 0.0,
      "standardDeviationDuration" : 0.0,
      "activeCount" : 0,
      "available" : true,
      "duration" : {
        "count" : 0,
        "min" : 0.0,
        "max" : 0.0,
        "mean" : 0.0,
        "standardDeviation" : 0.0,
        "countLong" : 0
      }
    },
    "componentType" : "logging-channel-adapter",
    "componentName" : "_org.springframework.integration.errorLogger",
    "nodeId" : 10
  }, {
    "name" : "services.foo.serviceActivator",
    "output" : "two",
    "input" : "one",
    "stats" : {
      "countsEnabled" : true,
      "statsEnabled" : true,
      "loggingEnabled" : true,
      "handleCount" : 0,
      "errorCount" : 0,
      "meanDuration" : 0.0,
      "minDuration" : 0.0,
      "maxDuration" : 0.0,
      "standardDeviationDuration" : 0.0,
      "activeCount" : 0,
      "available" : true,
      "duration" : {
        "count" : 0,
        "min" : 0.0,
        "max" : 0.0,
        "mean" : 0.0,
        "standardDeviation" : 0.0,
        "countLong" : 0
      }
    },
    "componentType" : "service-activator",
    "componentName" : "services.foo.serviceActivator.handler",
    "nodeId" : 11
  }, {
    "name" : "services.bar.serviceActivator",
    "output" : null,
    "input" : "two",
    "stats" : {
      "countsEnabled" : true,
      "statsEnabled" : true,
      "loggingEnabled" : true,
      "handleCount" : 0,
      "errorCount" : 0,
      "meanDuration" : 0.0,
      "minDuration" : 0.0,
      "maxDuration" : 0.0,
      "standardDeviationDuration" : 0.0,
      "activeCount" : 0,
      "available" : true,
      "duration" : {
        "count" : 0,
        "min" : 0.0,
        "max" : 0.0,
        "mean" : 0.0,
        "standardDeviation" : 0.0,
        "countLong" : 0
      }
    },
    "componentType" : "service-activator",
    "componentName" : "services.bar.serviceActivator.handler",
    "nodeId" : 12
  } ],
  "links" : [ {
    "from" : 7,
    "to" : 5
  }, {
    "from" : 2,
    "to" : 8
  }, {
    "from" : 1,
    "to" : 9
  }, {
    "from" : 4,
    "to" : 10
  }, {
    "from" : 5,
    "to" : 11
  }, {
    "from" : 11,
    "to" : 6
  }, {
    "from" : 6,
    "to" : 12
  } ]
}
```

Polishing

Only include stats if at least counts are enabled.

More Polishing

Polishing

Polishing - PR Comments; isAvailable()->protected

Make isAvailable protected so it doesn't appear in the JSON.

More Polishing - PR Comments

Yet More Polishing

buildGraph() -> private, rebuild() returns graph
2016-04-15 12:57:46 -04:00
Gary Russell
4027b38da8 Remove System.out/.err Calls From All Tests 2016-04-14 16:22:45 -04:00
Artem Bilan
e5bf0187eb INT-3980: Don't Require @Component for Messaging
JIRA: https://jira.spring.io/browse/INT-3980

When we declare our components via `@Bean` (or `<bean>`) the requirements for
the `@Component` (`@MessageEndpoint`) looks redundant and sometimes even dangerous,
when we use `@ComponentScan`, too.

* Remove the `@Component` restriction logic from the `MessagingAnnotationPostProcessor`
* Ensure that tests pass

(We may consider to backport afterwards)

Add `requireComponentAnnotation` logic

* Introduce `spring.integration.messagingAnnotations.require.componentAnnotation` property for `spring.integration.properties` as `false` by default
* Add `MessagingAnnotationPostProcessor#setRequireComponentAnnotation()` to accept the value from the `spring.integration.messagingAnnotations.require.componentAnnotation`
 * Fix `integraton` typo everywhere
 * Document the change in the `What's New` and in the `configuration.adoc`
 * Ensure that logic works properly (no messaging endpoints populated) with the `spring.integration.messagingAnnotations.require.componentAnnotation = true` and "unannotated" `AnnotatedEndpoint2` in the `AnnotatedEndpointActivationTests`

This PR also fixes: https://jira.spring.io/browse/INT-3962

Fix issues according Travis report

Doc Polishing
2016-04-12 14:35:03 -04:00
Artem Bilan
40a9d28667 INT-3979: Properly Handle MBuilder in Splitter
JIRA: https://jira.spring.io/browse/INT-3979

Previously we had a to instantiate all messages from the `MessageBuilder`
if we would like to return messages as splitted items.
For example to populate some item-specific headers.

From other hand the `MessageBuilder` as an item incorrectly remained as a `payload`.

* Add condition logic to the `AbstractMessageSplitter` to properly handle `AbstractIntegrationMessageBuilder`
and don't create an extra `Message`

* Apply the same logic to the `AbstractAggregatingMessageGroupProcessor`

(We may consider to backport it later)
2016-04-12 11:05:19 -04:00
Artem Bilan
b469e62c8a INT-3984: Fix the BFPPs order
JIRA: https://jira.spring.io/browse/INT-3984

The `PropertySourcesPlaceholderConfigurer implements BeanFactoryPostProcessor, PriorityOrdered`
meaning that it is run before any other regular `BeanFactoryPostProcessor`,
like the `IntegrationConfigurationBeanFactoryPostProcessor` has been before.
With such an order any `BeanDefinition` declaration from the `IntegrationConfigurationBeanFactoryPostProcessor` process
ended up without `PP` resolutions.

* Rework `IntegrationConfigurationBeanFactoryPostProcessor` to the `BeanDefinitionRegistryPostProcessor`,
which makes it be loaded as early as possible. See `PostProcessorRegistrationDelegate`:
````java
// Now, invoke the postProcessBeanFactory callback of all processors handled so far.
invokeBeanFactoryPostProcessors(registryPostProcessors, beanFactory);
invokeBeanFactoryPostProcessors(regularPostProcessors, beanFactory);
````

* Modify `EnableIntegrationTests` and `ChannelSecurityInterceptorSecuredChannelAnnotationTests` to ensure that the change
meets the `PP` and `SpEL` resolutions during bean definition phase.
* Fix the timing issue in the `JdbcMessageStoreChannelIntegrationTests`
2016-04-12 11:00:53 -04:00
Artem Bilan
1df7815148 INT-3978 Fix MessageHistory for Message Types
JIRA: https://jira.spring.io/browse/INT-3978

Previously the `MessageHistory.write()` always used `MessageBuilder` to populated the `history` header.
Since the `MessageBuilder` doesn't care about the `source` message type, we might lose some important information,
like `AdviceMessage.inputMessage`

* Add conditional logic into the `MessageHistory` for all known `Message<?>` implementations
* Provide appropriate tests in the `MessageHistoryTests` for known `Message<?>` implementations
* Make `AdviceMessage` generic and fix all affected code on the matter
* Since `MutableMessage` is public already, fix `MongoDbMessageStore.DBObjectToMutableMessageConverter` to use
`MutableMessage` type directly.

Add WARN for non-standard `Message` type
2016-04-12 10:31:25 -04:00
Artem Bilan
13d11e5035 Upgrade to SD-Hopper and other fixes
Fixes https://build.spring.io/browse/INT-MJATS41-593

* Fix `LoggingHandler` JavaDoc
* Fix `JdbcOutboundGatewayParserTests` timing and race condition issues
* Add `mock(BeanFactory.class)` to the `JpaOutboundChannelAdapterTests` for `JpaExecutor`
* Fix `JpaOutboundChannelAdapterTests` for the incorrect transaction usage
2016-04-11 14:55:27 -04:00
Artem Bilan
ba2a713c75 INT-3981: Add a couple <chain> tests
JIRA: https://jira.spring.io/browse/INT-3981

Since the `MessageHandlerChain` uses a `ReplyForwardingMessageChannel` in the end of invocation,
we don't need to have add an extra `<bridge>` for shifting just populated `replyChannel` header.

* Add a couple tests to prove that
* Fix the typos in the `ChainParserTests`
* Remove unnecessary `DirectFieldAccessor` usage in the `MessageHandlerChain`
2016-04-11 14:55:27 -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
Artem Bilan
c0b19e61b5 INT-3977: Improve LoggingHandler for JavaConfig
JIRA: https://jira.spring.io/browse/INT-3977

* Add `Level` ctor
* Add `setLogExpression(Expression)` and `setLogExpressionString(String)`
* Deprecate existing `setExpression(String)` in favor of those new
* Some refactor for redundant code around `evaluationContext`
* Fix tests according a new `LoggingHandler` logic
* Add JavaConfig sample to the Reference Manual
2016-04-05 12:19:27 -04:00
Gary Russell
4ac3a79df7 checkstyle FinalClassCheck
fixes

fixModifiers after fixFinal

Revert CachingSessionFactory

Class is spied in tests.

checkstyle - Import Rules

checkstyle InterfaceIsType

checkstyle InnerTypeLast

checkstyle OneStatementPerLine

CovariantEquals
OneTopLevelClass

* Revert `'\n'` -> `System.lineSeparator()` in the Gradle scripts to meet Git `autocrlf = true` on Windows
* Fix timing issue with the `LastModifiedFileListFilterTests`, when the `age = 1` might not be enough for the file object when we have some delay before checking
2016-04-04 13:49:56 -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
b5745af148 INT-3937: Deprecate Reactor Environment usage
JIRA: https://jira.spring.io/browse/INT-3937
2016-03-28 11:38:06 -04:00
Gary Russell
4bfcdb9dfa INT-3944: Async JMS Outbound Gateway
JIRA: https://jira.spring.io/browse/INT-3944

Polishing (PR comments) and Doc Polish

Polishing - PR Comments

Remove custom `async` boolean in favor of the now public setter.

Add exception to `JmsException` hierarchy.

INT-3944: Polishing

* Rename `asyncReplySupported` just to `async`. As well as its getter and setter. Plus fix docs on the matter
* Polishing for the `JmsOutboundGateway` according PR comments
* Rework `JmsOutboundGateway` to return `AbstractIntegrationMessageBuilder` instead of `Message`
since `AbstractMessageProducingHandler` rebuilds `Message` for a new one to copy headers from request
* Add `getPayload()` and `getHeaders()` to the `AbstractIntegrationMessageBuilder` to make the `Routing Slip`
users happy, when the `AbstractIntegrationMessageBuilder` is pushed to the `Routing Slip path` function
* Fix race condition in the `ChatMessageListeningEndpointTests`: the `stanza` parsing is done in the different Thread.

Doc Polishing (Routing Slip)

Fix timing issue in the `LastModifiedFileListFilterTests`:
`Thread.sleep()` not always reflects the reality.
Switch to the "past simulation" via explicit `File.setLastModified()`
2016-03-25 16:44:35 -04:00
Artem Bilan
f660b6df2f INT-3959: Make Certain JMX Classes Top Level
JIRA: https://jira.spring.io/browse/INT-3959

Also add `LifecycleMessageHandlerMetrics.getDelegate()` and `LifecycleMessageSourceMetrics.getDelegate()`
to avoid reflection on each `extractManagedBean()`
2016-03-24 16:58:55 -04:00
Gary Russell
8db0ad3ae6 INT-3945: Async Service Activator
JIRA: https://jira.spring.io/browse/INT-3945

Polishing

Send errors to the default `errorChannel` (if available) and no `errorChannel`
header present.

Fix Test; Javadoc Polishing

Fix Test; Javadoc Polishing
2016-03-24 15:02:13 -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
Gary Russell
d4e6615f82 INT-3943: AMQP Async Outbound Gateway
JIRA: https://jira.spring.io/browse/INT-3943

Initial commit.

Polishing; Address PR Comments; Docs

Doc Polishing

Async GW - Support requiresReply

Polishing.

Avoid extra `requiresReply` in the `AsyncAmqpOutboundGateway`
2016-03-15 17:58:18 -04:00
Gary Russell
78aaa6dac6 INT-3965: AMQP Header Mapping Changes
JIRA: https://jira.spring.io/browse/INT-3965

Rework According to AMQP-589
2016-03-15 12:35:26 -04:00
Artem Bilan
1d93702b23 INT-3961: Add Channel Late Binding for @ICA
JIRA: https://jira.spring.io/browse/INT-3961

The `@InboundChannelAdapter` may be initialized by its `MessagingAnnotationPostProcessor` a bit earlier than the
provided channel is created and registered in the context - via some other more late `BPP`, e.g. `IntegrationFlowBeanPostProcessor` from Java DSL.

* Add channel late-binding logic to the `InboundChannelAdapterAnnotationPostProcessor` and `SourcePollingChannelAdapter` by the provided `outputChannelName` option.
* Add the `channel` alias for the `value` annotation attribute in the `@InboundChannelAdapter`
* Add the `@InboundChannelAdapter` configuration into the `EnableIntegrationTests` without the channel declaration to be sure that the fix provide the expected results without `DestinationResolutionException`
* Mention both changes in the `configuration.adoc` and `whats-new.adoc`
2016-03-08 16:33:29 -05:00
Artem Bilan
732990ee66 Fix non-UTF-8 symbols
https://build.spring.io/browse/INT-B43-113/
2016-03-07 15:21:46 -05: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
Steve Swor
bfb31a1361 INT-3956: peekLast for timeSinceLastSend
JIRA: https://jira.spring.io/browse/INT-3956

Use reflection in tests to access private members

fix assertion imports

Polishing author rights.
Make tests `Threas.sleep()` free.
2016-02-18 17:46:12 -05:00
Gary Russell
edb30efcd5 INT-3811: Support Negative Matches on Header Map
JIRA: https://jira.spring.io/browse/INT-3811

Polishing - PR Comments
2016-02-16 12:09:47 -05:00
Gary Russell
ae2e1b0a8d INT-3947: Support Async Message Handlers
JIRA: https://jira.spring.io/browse/INT-3947

Async Message Handler

If `asyncReplySupported` and the handler returns a `ListenableFuture<?>`,
defer the send to the reply channel until the future is satisfied.

First candidate would be the `AmqpOutboundGateway` wired with an
`AsyncRabbitTemplate`.

Polishing - Use errorChannel Header for Exceptions

Add more tests.

Polishing - ListenableFuture Callback Exceptions

Polishing - send error if error on async output

Cover `onFailure()` from `onSuccess()` with the `errorChannel`
2016-02-11 17:12:00 -05:00