From 884aebcb0759187cf7e2c6fa841f2cb4cafe6771 Mon Sep 17 00:00:00 2001 From: Gary Russell Date: Tue, 12 Jan 2016 17:29:05 -0500 Subject: [PATCH] JIRA: INT-3856 HeaderFilter pattern-match JIRA: https://jira.spring.io/browse/INT-3856 Allow a property placeholder in the header filter `pattern-match` attribute. See https://github.com/spring-projects/spring-xd/issues/1804#issuecomment-148845883 Remove versions from spring XSD references --- .../config/spring-integration-4.3.xsd | 5 ++- .../xml/HeaderFilterParserTests-context.xml | 34 ++++++++++++------- .../config/xml/HeaderFilterParserTests.java | 25 ++++++++------ 3 files changed, 39 insertions(+), 25 deletions(-) diff --git a/spring-integration-core/src/main/resources/org/springframework/integration/config/spring-integration-4.3.xsd b/spring-integration-core/src/main/resources/org/springframework/integration/config/spring-integration-4.3.xsd index 10e887ac39..d5caa61022 100644 --- a/spring-integration-core/src/main/resources/org/springframework/integration/config/spring-integration-4.3.xsd +++ b/spring-integration-core/src/main/resources/org/springframework/integration/config/spring-integration-4.3.xsd @@ -2337,7 +2337,7 @@ - + Boolean flag that specifies whether values provided in 'header-names' should be treated as @@ -2347,6 +2347,9 @@ the only header that will be removed is the one that is an exact match. + + + diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderFilterParserTests-context.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderFilterParserTests-context.xml index e54bf83177..fbbc68f9d5 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderFilterParserTests-context.xml +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderFilterParserTests-context.xml @@ -2,23 +2,31 @@ + xmlns:context="http://www.springframework.org/schema/context" + xmlns:util="http://www.springframework.org/schema/util" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd + http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd + http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> + + + + + false + - - + + - - + + - - + + - - - + + + diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderFilterParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderFilterParserTests.java index ffc8b03d5d..0de456702d 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderFilterParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderFilterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,33 +24,36 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.messaging.Message; -import org.springframework.messaging.MessageChannel; import org.springframework.integration.channel.QueueChannel; import org.springframework.integration.support.MessageBuilder; +import org.springframework.messaging.Message; +import org.springframework.messaging.MessageChannel; +import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; /** * @author Mark Fisher + * @author Gary Russell * @since 2.0 */ @ContextConfiguration @RunWith(SpringJUnit4ClassRunner.class) +@DirtiesContext public class HeaderFilterParserTests { @Autowired private MessageChannel inputA; - + @Autowired private MessageChannel inputB; - + @Autowired private MessageChannel inputC; - + @Autowired private MessageChannel inputD; - + @Autowired private MessageChannel inputE; @@ -75,7 +78,7 @@ public class HeaderFilterParserTests { assertNotNull(result.getHeaders().get("b")); assertNotNull(result.getHeaders().get("e")); } - + @Test public void verifyHeadersRemovedWithSingleWildcard() { QueueChannel replyChannel = new QueueChannel(); @@ -97,7 +100,7 @@ public class HeaderFilterParserTests { assertNull(result.getHeaders().get("b")); assertNull(result.getHeaders().get("e")); } - + @Test public void verifyHeadersRemovedWithNamePatterns() { QueueChannel replyChannel = new QueueChannel(); @@ -119,7 +122,7 @@ public class HeaderFilterParserTests { assertNull(result.getHeaders().get("goo")); assertNotNull(result.getHeaders().get("e")); } - + @Test public void verifyHeadersRemovedWhereHeaderNameContainsWildCard() { QueueChannel replyChannel = new QueueChannel(); @@ -141,7 +144,7 @@ public class HeaderFilterParserTests { assertNull(result.getHeaders().get("goo")); assertNotNull(result.getHeaders().get("e")); } - + @Test public void verifyHeadersRemovedWhereHeaderNameIsLiteral() { QueueChannel replyChannel = new QueueChannel();