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
This commit is contained in:
committed by
Artem Bilan
parent
ce594d437e
commit
884aebcb07
@@ -2337,7 +2337,7 @@
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="pattern-match" type="xsd:boolean" default="true">
|
||||
<xsd:attribute name="pattern-match" default="true">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
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.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:union memberTypes="xsd:boolean xsd:string" />
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="id" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
|
||||
@@ -2,23 +2,31 @@
|
||||
<beans:beans xmlns="http://www.springframework.org/schema/integration"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd">
|
||||
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">
|
||||
|
||||
<context:property-placeholder properties-ref="props"/>
|
||||
|
||||
<util:properties id="props">
|
||||
<beans:prop key="nope">false</beans:prop>
|
||||
</util:properties>
|
||||
|
||||
<header-filter input-channel="inputA" header-names="a,d, c"/>
|
||||
|
||||
|
||||
|
||||
|
||||
<header-filter input-channel="inputB" header-names="*"/>
|
||||
|
||||
|
||||
|
||||
|
||||
<header-filter input-channel="inputC" header-names="ba*, *oo"/>
|
||||
|
||||
|
||||
|
||||
|
||||
<header-filter input-channel="inputD" header-names="bar*, *oo"/>
|
||||
|
||||
|
||||
<header-filter input-channel="inputE" pattern-match="false" header-names="bar*, foo"/>
|
||||
|
||||
|
||||
<header-filter input-channel="inputE" pattern-match="${nope}" header-names="bar*, foo"/>
|
||||
|
||||
</beans:beans>
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user