Added support for the 'throw-exception-on-rejection' attribute for the 'filter' element.
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
|
||||
<filter ref="selectorImpl" input-channel="implementationInput" output-channel="implementationOutput"/>
|
||||
|
||||
<filter ref="selectorImpl" input-channel="exceptionInput" output-channel="implementationOutput" throw-exception-on-rejection="true"/>
|
||||
|
||||
<beans:bean id="selectorImpl"
|
||||
class="org.springframework.integration.config.FilterParserTests$TestSelectorImpl"/>
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.integration.channel.PollableChannel;
|
||||
import org.springframework.integration.core.Message;
|
||||
import org.springframework.integration.core.MessageChannel;
|
||||
import org.springframework.integration.message.MessageRejectedException;
|
||||
import org.springframework.integration.message.StringMessage;
|
||||
import org.springframework.integration.selector.MessageSelector;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -53,6 +54,9 @@ public class FilterParserTests {
|
||||
@Autowired @Qualifier("implementationOutput")
|
||||
PollableChannel implementationOutput;
|
||||
|
||||
@Autowired @Qualifier("exceptionInput")
|
||||
MessageChannel exceptionInput;
|
||||
|
||||
|
||||
@Test
|
||||
public void filterWithSelectorAdapterAccepts() {
|
||||
@@ -84,6 +88,18 @@ public class FilterParserTests {
|
||||
assertNull(reply);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exceptionThrowingFilterAccepts() {
|
||||
exceptionInput.send(new StringMessage("test"));
|
||||
Message<?> reply = implementationOutput.receive(0);
|
||||
assertNotNull(reply);
|
||||
}
|
||||
|
||||
@Test(expected = MessageRejectedException.class)
|
||||
public void exceptionThrowingFilterRejects() {
|
||||
exceptionInput.send(new StringMessage(""));
|
||||
}
|
||||
|
||||
|
||||
public static class TestSelectorBean {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user