INT-3027: Headers Enrichment for <enricher>

* Add `<header>` sub-element to `<enricher>`
* Refactoring of `EnricherParser`
* Add Headers Enrichment logic to `ContentEnricher`
* Add tests
* What's new and Content Enricher's `<header>` note

JIRA: https://jira.springsource.org/browse/INT-3027

INT-3027: Addressing PR comments

INT-3027: add NPE asserts to map properties

INT-3027: add overwrite & type to enricher header

Move `HeaderValueMessageProcessor` hierarchy to 'transformer.support' package

INT-3027: Make header's overwrite=true by default

Doc Polishing
This commit is contained in:
Artem Bilan
2013-09-16 18:51:36 +03:00
committed by Gary Russell
parent 7c0c9e92fc
commit 7517963be2
17 changed files with 433 additions and 162 deletions

View File

@@ -32,7 +32,7 @@ import org.springframework.integration.endpoint.EventDrivenConsumer;
import org.springframework.integration.groovy.GroovyScriptExecutingMessageProcessor;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.integration.transformer.HeaderEnricher;
import org.springframework.integration.transformer.support.HeaderValueMessageProcessor;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -71,11 +71,11 @@ public class GroovyHeaderEnricherTests {
@SuppressWarnings("unchecked")
@Test
public void inlineScript() throws Exception{
Map<String, HeaderEnricher.HeaderValueMessageProcessor<?>> headers =
Map<String, HeaderValueMessageProcessor<?>> headers =
TestUtils.getPropertyValue(headerEnricherWithInlineGroovyScript, "handler.transformer.headersToAdd", Map.class);
assertEquals(1, headers.size());
HeaderEnricher.HeaderValueMessageProcessor<?> headerValueMessageProcessor = headers.get("TEST_HEADER");
assertThat(headerValueMessageProcessor.getClass().getName(), Matchers.containsString("HeaderEnricher$MessageProcessingHeaderValueMessageProcessor"));
HeaderValueMessageProcessor<?> headerValueMessageProcessor = headers.get("TEST_HEADER");
assertThat(headerValueMessageProcessor.getClass().getName(), Matchers.containsString("MessageProcessingHeaderValueMessageProcessor"));
Object targetProcessor = TestUtils.getPropertyValue(headerValueMessageProcessor, "targetProcessor");
assertEquals(GroovyScriptExecutingMessageProcessor.class, targetProcessor.getClass());