INT-789
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:p="http://www.springframework.org/schema/p">
|
||||
|
||||
<int:channel id="inputA">
|
||||
<int:interceptors>
|
||||
<bean class="org.springframework.integration.channel.interceptor.GlobalChannelInterceptorTests$SampleInterceptor" p:testIdentifier="eight"/>
|
||||
</int:interceptors>
|
||||
</int:channel>
|
||||
|
||||
<int:channel id="inputB"/>
|
||||
|
||||
<int:channel id="inputC"/>
|
||||
|
||||
<int:channel-interceptor-chain channel-name-pattern="*" order="3">
|
||||
<bean class="org.springframework.integration.channel.interceptor.GlobalChannelInterceptorTests$SampleInterceptor" p:testIdentifier="six"/>
|
||||
</int:channel-interceptor-chain>
|
||||
|
||||
</beans>
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
<int:channel id="inputB">
|
||||
<int:queue capacity="1"/>
|
||||
</int:channel>
|
||||
</int:channel>
|
||||
|
||||
<int:publish-subscribe-channel id="foo"/>
|
||||
|
||||
@@ -28,27 +28,36 @@
|
||||
|
||||
<int:channel id="baz"/>
|
||||
|
||||
<int:channel-interceptor-chain channel-name-pattern="input*, foo, object" order="3">
|
||||
<bean class="org.springframework.integration.channel.interceptor.GlobalChannelInterceptorTests$SampleInterceptor" p:testIdentifier="six"/>
|
||||
<ref bean="channelInterceptor"/>
|
||||
</int:channel-interceptor-chain>
|
||||
<int:channel-interceptor-chain channel-name-pattern="input*, fooA" order="1">
|
||||
<int:channel-interceptor pattern="input*, foo" order="3">
|
||||
<bean class="org.springframework.integration.channel.interceptor.GlobalChannelInterceptorTests$SampleInterceptor" p:testIdentifier="one"/>
|
||||
<ref bean="channelInterceptor"/>
|
||||
<bean class="org.springframework.integration.channel.interceptor.GlobalChannelInterceptorTests$SampleInterceptor" p:testIdentifier="two"/>
|
||||
<bean class="org.springframework.integration.channel.interceptor.GlobalChannelInterceptorTests$SampleInterceptor" p:testIdentifier="three"/>
|
||||
<ref bean="channelInterceptor"/>
|
||||
</int:channel-interceptor-chain>
|
||||
<int:channel-interceptor-chain channel-name-pattern="input*, foo, object" order="-1">
|
||||
</int:channel-interceptor>
|
||||
<int:channel-interceptor pattern="input*, foo, object" order="1">
|
||||
<bean class="org.springframework.integration.channel.interceptor.GlobalChannelInterceptorTests$SampleInterceptor" p:testIdentifier="four"/>
|
||||
<ref bean="channelInterceptor"/>
|
||||
</int:channel-interceptor-chain>
|
||||
<int:channel-interceptor-chain channel-name-pattern="input*, foo, object" order="-5">
|
||||
<bean class="org.springframework.integration.channel.interceptor.GlobalChannelInterceptorTests$SampleInterceptor" p:testIdentifier="five"/>
|
||||
<ref bean="channelInterceptor"/>
|
||||
</int:channel-interceptor-chain>
|
||||
</int:channel-interceptor>
|
||||
|
||||
<int:channel-interceptor pattern="inputA, foo">
|
||||
<bean class="org.springframework.integration.channel.interceptor.GlobalChannelInterceptorTests$SampleInterceptor" p:testIdentifier="five"/>
|
||||
</int:channel-interceptor>
|
||||
<int:channel-interceptor pattern="inputA">
|
||||
<bean class="org.springframework.integration.channel.interceptor.GlobalChannelInterceptorTests$SampleInterceptor" p:testIdentifier="six"/>
|
||||
</int:channel-interceptor>
|
||||
|
||||
<int:channel-interceptor>
|
||||
<bean class="org.springframework.integration.channel.interceptor.GlobalChannelInterceptorTests$SampleInterceptor" p:testIdentifier="ten"/>
|
||||
</int:channel-interceptor>
|
||||
|
||||
<int:channel-interceptor pattern="*" ref="eleven"/>
|
||||
|
||||
<bean id="eleven" class="org.springframework.integration.channel.interceptor.GlobalChannelInterceptorTests$SampleInterceptor" p:testIdentifier="eleven"/>
|
||||
|
||||
<int:channel-interceptor pattern="input*, foo" order="-3">
|
||||
<bean class="org.springframework.integration.channel.interceptor.GlobalChannelInterceptorTests$SampleInterceptor" p:testIdentifier="two"/>
|
||||
</int:channel-interceptor>
|
||||
<int:channel-interceptor pattern="input*" order="-4">
|
||||
<bean class="org.springframework.integration.channel.interceptor.GlobalChannelInterceptorTests$SampleInterceptor" p:testIdentifier="three"/>
|
||||
</int:channel-interceptor>
|
||||
|
||||
|
||||
<bean id="channelInterceptor" class="org.springframework.integration.channel.interceptor.GlobalChannelInterceptorTests$SampleInterceptor" p:testIdentifier="seven"/>
|
||||
<!-- <bean id="object" class="java.lang.Object"/>-->
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:p="http://www.springframework.org/schema/p">
|
||||
|
||||
|
||||
|
||||
|
||||
<int:channel-interceptor-chain channel-name-pattern="input*, foo, object" order="3">
|
||||
<bean class="org.springframework.integration.channel.interceptor.GlobalChannelInterceptorTests$SampleInterceptor" p:testIdentifier="six"/>
|
||||
</int:channel-interceptor-chain>
|
||||
|
||||
<bean id="object" class="java.lang.Object"/>
|
||||
</beans>
|
||||
@@ -1,40 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:p="http://www.springframework.org/schema/p">
|
||||
|
||||
<int:channel id="inputA">
|
||||
<int:interceptors>
|
||||
<bean class="org.springframework.integration.channel.interceptor.GlobalChannelInterceptorTests$SampleOrderedInterceptor"
|
||||
p:testIdentifier="eight"
|
||||
p:order="5"/>
|
||||
<ref bean="unorderedChannelInterceptor"/>
|
||||
<ref bean="orderedChannelInterceptor"/>
|
||||
<bean class="org.springframework.integration.channel.interceptor.GlobalChannelInterceptorTests$SampleInterceptor" p:testIdentifier="five"/>
|
||||
</int:interceptors>
|
||||
</int:channel>
|
||||
|
||||
<int:channel-interceptor-chain channel-name-pattern="input*, foo, object" order="3">
|
||||
<bean class="org.springframework.integration.channel.interceptor.GlobalChannelInterceptorTests$SampleInterceptor" p:testIdentifier="six"/>
|
||||
<ref bean="unorderedChannelInterceptor"/>
|
||||
</int:channel-interceptor-chain>
|
||||
<int:channel-interceptor-chain channel-name-pattern="input*" order="1">
|
||||
<bean class="org.springframework.integration.channel.interceptor.GlobalChannelInterceptorTests$SampleInterceptor" p:testIdentifier="one"/>
|
||||
<ref bean="orderedChannelInterceptor"/>
|
||||
</int:channel-interceptor-chain>
|
||||
<int:channel-interceptor-chain channel-name-pattern="input*, foo, object" order="-1">
|
||||
<bean class="org.springframework.integration.channel.interceptor.GlobalChannelInterceptorTests$SampleOrderedInterceptor"
|
||||
p:testIdentifier="four"
|
||||
p:order="7"/>
|
||||
<ref bean="orderedChannelInterceptor"/>
|
||||
</int:channel-interceptor-chain>
|
||||
|
||||
<bean id="unorderedChannelInterceptor" class="org.springframework.integration.channel.interceptor.GlobalChannelInterceptorTests$SampleInterceptor"
|
||||
p:testIdentifier="seven"/>
|
||||
<bean id="orderedChannelInterceptor" class="org.springframework.integration.channel.interceptor.GlobalChannelInterceptorTests$SampleOrderedInterceptor"
|
||||
p:testIdentifier="ten"
|
||||
p:order="4"/>
|
||||
</beans>
|
||||
@@ -1,34 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:p="http://www.springframework.org/schema/p">
|
||||
|
||||
<int:channel id="inputA">
|
||||
<int:interceptors>
|
||||
<bean class="org.springframework.integration.channel.interceptor.GlobalChannelInterceptorTests$SampleInterceptor"
|
||||
p:testIdentifier="eight"/>
|
||||
<ref bean="unorderedChannelInterceptor"/>
|
||||
<bean class="org.springframework.integration.channel.interceptor.GlobalChannelInterceptorTests$SampleInterceptor"
|
||||
p:testIdentifier="five"/>
|
||||
</int:interceptors>
|
||||
</int:channel>
|
||||
|
||||
<int:channel-interceptor-chain channel-name-pattern="input*, foo, object">
|
||||
<bean class="org.springframework.integration.channel.interceptor.GlobalChannelInterceptorTests$SampleInterceptor"
|
||||
p:testIdentifier="six"/>
|
||||
<ref bean="unorderedChannelInterceptor"/>
|
||||
</int:channel-interceptor-chain>
|
||||
<int:channel-interceptor-chain channel-name-pattern="input*">
|
||||
<ref bean="unorderedChannelInterceptor"/>
|
||||
<bean class="org.springframework.integration.channel.interceptor.GlobalChannelInterceptorTests$SampleInterceptor"
|
||||
p:testIdentifier="one"/>
|
||||
</int:channel-interceptor-chain>
|
||||
|
||||
|
||||
<bean id="unorderedChannelInterceptor" class="org.springframework.integration.channel.interceptor.GlobalChannelInterceptorTests$SampleInterceptor"
|
||||
p:testIdentifier="seven"/>
|
||||
|
||||
</beans>
|
||||
@@ -33,8 +33,9 @@ import org.springframework.integration.core.MessageChannel;
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public class GlobalChannelInterceptorTests {
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@Test
|
||||
public void validateGlobalInterceptor(){
|
||||
ApplicationContext applicationContext =
|
||||
@@ -46,149 +47,61 @@ public class GlobalChannelInterceptorTests {
|
||||
Object iList = cAccessor.getPropertyValue("interceptors");
|
||||
DirectFieldAccessor iAccessor = new DirectFieldAccessor(iList);
|
||||
List<SampleInterceptor> interceptoList = (List<SampleInterceptor>) iAccessor.getPropertyValue("interceptors");
|
||||
if (channelName.equals("inputA")){
|
||||
SampleInterceptor[] inter = interceptoList.toArray(new SampleInterceptor[]{});
|
||||
Assert.assertTrue(inter.length == 13);
|
||||
Assert.assertEquals("four", inter[0].getTestIdentifier());
|
||||
Assert.assertEquals("seven", inter[1].getTestIdentifier());
|
||||
Assert.assertEquals("five", inter[2].getTestIdentifier());
|
||||
Assert.assertEquals("seven", inter[3].getTestIdentifier());
|
||||
Assert.assertEquals("eight", inter[4].getTestIdentifier());
|
||||
Assert.assertEquals("seven", inter[5].getTestIdentifier());
|
||||
Assert.assertEquals("one", inter[6].getTestIdentifier());
|
||||
Assert.assertEquals("seven", inter[7].getTestIdentifier());
|
||||
Assert.assertEquals("two", inter[8].getTestIdentifier());
|
||||
Assert.assertEquals("three", inter[9].getTestIdentifier());
|
||||
Assert.assertEquals("seven", inter[10].getTestIdentifier());
|
||||
Assert.assertEquals("six", inter[11].getTestIdentifier());
|
||||
Assert.assertEquals("seven", inter[12].getTestIdentifier());
|
||||
if (channelName.equals("inputA")){ // 328741
|
||||
ChannelInterceptor[] inter = interceptoList.toArray(new ChannelInterceptor[]{});
|
||||
Assert.assertTrue(inter.length ==10);
|
||||
Assert.assertEquals("interceptor-three", inter[0].toString());
|
||||
Assert.assertEquals("interceptor-two", inter[1].toString());
|
||||
Assert.assertEquals("interceptor-eight", inter[2].toString());
|
||||
Assert.assertEquals("interceptor-seven", inter[3].toString());
|
||||
Assert.assertEquals("interceptor-five", inter[4].toString());
|
||||
Assert.assertEquals("interceptor-six", inter[5].toString());
|
||||
Assert.assertEquals("interceptor-ten", inter[6].toString());
|
||||
Assert.assertEquals("interceptor-eleven", inter[7].toString());
|
||||
Assert.assertEquals("interceptor-four", inter[8].toString());
|
||||
Assert.assertEquals("interceptor-one", inter[9].toString());
|
||||
}
|
||||
else
|
||||
if (channelName.equals("inputB")){
|
||||
SampleInterceptor[] inter = interceptoList.toArray(new SampleInterceptor[]{});
|
||||
Assert.assertTrue(inter.length == 11);
|
||||
Assert.assertEquals("four", inter[0].getTestIdentifier());
|
||||
Assert.assertEquals("seven", inter[1].getTestIdentifier());
|
||||
Assert.assertEquals("five", inter[2].getTestIdentifier());
|
||||
Assert.assertEquals("seven", inter[3].getTestIdentifier());
|
||||
Assert.assertEquals("one", inter[4].getTestIdentifier());
|
||||
Assert.assertEquals("seven", inter[5].getTestIdentifier());
|
||||
Assert.assertEquals("two", inter[6].getTestIdentifier());
|
||||
Assert.assertEquals("three", inter[7].getTestIdentifier());
|
||||
Assert.assertEquals("seven", inter[8].getTestIdentifier());
|
||||
Assert.assertEquals("six", inter[9].getTestIdentifier());
|
||||
Assert.assertEquals("seven", inter[10].getTestIdentifier());
|
||||
ChannelInterceptor[] inter = interceptoList.toArray(new ChannelInterceptor[]{});
|
||||
Assert.assertTrue(inter.length == 6);
|
||||
Assert.assertEquals("interceptor-three", inter[0].toString());
|
||||
Assert.assertEquals("interceptor-two", inter[1].toString());
|
||||
Assert.assertEquals("interceptor-ten", inter[2].toString());
|
||||
Assert.assertEquals("interceptor-eleven", inter[3].toString());
|
||||
Assert.assertEquals("interceptor-four", inter[4].toString());
|
||||
Assert.assertEquals("interceptor-one", inter[5].toString());
|
||||
}
|
||||
else
|
||||
if (channelName.equals("foo")){
|
||||
SampleInterceptor[] inter = interceptoList.toArray(new SampleInterceptor[]{});
|
||||
ChannelInterceptor[] inter = interceptoList.toArray(new ChannelInterceptor[]{});
|
||||
Assert.assertTrue(inter.length == 6);
|
||||
Assert.assertEquals("four", inter[0].getTestIdentifier());
|
||||
Assert.assertEquals("seven", inter[1].getTestIdentifier());
|
||||
Assert.assertEquals("five", inter[2].getTestIdentifier());
|
||||
Assert.assertEquals("seven", inter[3].getTestIdentifier());
|
||||
Assert.assertEquals("six", inter[4].getTestIdentifier());
|
||||
Assert.assertEquals("seven", inter[5].getTestIdentifier());
|
||||
Assert.assertEquals("interceptor-two", inter[0].toString());
|
||||
Assert.assertEquals("interceptor-five", inter[1].toString());
|
||||
Assert.assertEquals("interceptor-ten", inter[2].toString());
|
||||
Assert.assertEquals("interceptor-eleven", inter[3].toString());
|
||||
Assert.assertEquals("interceptor-four", inter[4].toString());
|
||||
Assert.assertEquals("interceptor-one", inter[5].toString());
|
||||
}
|
||||
else
|
||||
if (channelName.equals("bar")){
|
||||
SampleInterceptor[] inter = interceptoList.toArray(new SampleInterceptor[]{});
|
||||
Assert.assertTrue(inter.length == 2);
|
||||
Assert.assertEquals("eight", inter[0].getTestIdentifier());
|
||||
Assert.assertEquals("seven", inter[1].getTestIdentifier());
|
||||
ChannelInterceptor[] inter = interceptoList.toArray(new ChannelInterceptor[]{});
|
||||
Assert.assertTrue(inter.length == 4);
|
||||
Assert.assertEquals("interceptor-eight", inter[0].toString());
|
||||
Assert.assertEquals("interceptor-seven", inter[1].toString());
|
||||
Assert.assertEquals("interceptor-ten", inter[2].toString());
|
||||
Assert.assertEquals("interceptor-eleven", inter[3].toString());
|
||||
}
|
||||
else
|
||||
if (channelName.equals("baz")){
|
||||
SampleInterceptor[] inter = interceptoList.toArray(new SampleInterceptor[]{});
|
||||
Assert.assertTrue(inter.length == 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Will test mix of Ordered and un-Ordered ChannelInterceptors
|
||||
* Individual interceptors will only be sorted within groups they are defined.
|
||||
* For example: interceptors defined inside of channels will be sorted according to Ordered implementation
|
||||
* If global interceptors were added BEFORE (negative order) or AFTER (ppositive order) the global stack will be sorted
|
||||
* and added before/after the existing stack
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void validateGlobalInterceptorsOrdered(){
|
||||
ApplicationContext applicationContext =
|
||||
new ClassPathXmlApplicationContext("GlobalChannelInterceptorTests-ordered-context.xml", GlobalChannelInterceptorTests.class);
|
||||
Map<String, AbstractMessageChannel> channels = applicationContext.getBeansOfType(AbstractMessageChannel.class);
|
||||
for (String channelName : channels.keySet()) {
|
||||
AbstractMessageChannel channel = channels.get(channelName);
|
||||
DirectFieldAccessor cAccessor = new DirectFieldAccessor(channel);
|
||||
Object iList = cAccessor.getPropertyValue("interceptors");
|
||||
DirectFieldAccessor iAccessor = new DirectFieldAccessor(iList);
|
||||
List<SampleInterceptor> interceptoList = (List<SampleInterceptor>) iAccessor.getPropertyValue("interceptors");
|
||||
if (channelName.equals("inputA")){
|
||||
SampleInterceptor[] inter = interceptoList.toArray(new SampleInterceptor[]{});
|
||||
Assert.assertTrue(inter.length == 10);
|
||||
Assert.assertEquals("ten", inter[0].getTestIdentifier());
|
||||
Assert.assertEquals("four", inter[1].getTestIdentifier());
|
||||
Assert.assertEquals("ten", inter[2].getTestIdentifier());
|
||||
Assert.assertEquals("eight", inter[3].getTestIdentifier());
|
||||
Assert.assertEquals("seven", inter[4].getTestIdentifier());
|
||||
Assert.assertEquals("five", inter[5].getTestIdentifier());
|
||||
Assert.assertEquals("ten", inter[6].getTestIdentifier());
|
||||
Assert.assertEquals("one", inter[7].getTestIdentifier());
|
||||
Assert.assertEquals("six", inter[8].getTestIdentifier());
|
||||
Assert.assertEquals("seven", inter[9].getTestIdentifier());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void validateGlobalInterceptorsUnOrdered(){
|
||||
ApplicationContext applicationContext =
|
||||
new ClassPathXmlApplicationContext("GlobalChannelInterceptorTests-unordered-context.xml", GlobalChannelInterceptorTests.class);
|
||||
Map<String, AbstractMessageChannel> channels = applicationContext.getBeansOfType(AbstractMessageChannel.class);
|
||||
for (String channelName : channels.keySet()) {
|
||||
AbstractMessageChannel channel = channels.get(channelName);
|
||||
DirectFieldAccessor cAccessor = new DirectFieldAccessor(channel);
|
||||
Object iList = cAccessor.getPropertyValue("interceptors");
|
||||
DirectFieldAccessor iAccessor = new DirectFieldAccessor(iList);
|
||||
List<SampleInterceptor> interceptoList = (List<SampleInterceptor>) iAccessor.getPropertyValue("interceptors");
|
||||
if (channelName.equals("inputA")){
|
||||
SampleInterceptor[] inter = interceptoList.toArray(new SampleInterceptor[]{});
|
||||
Assert.assertTrue(inter.length == 7);
|
||||
Assert.assertEquals("eight", inter[0].getTestIdentifier());
|
||||
Assert.assertEquals("seven", inter[1].getTestIdentifier());
|
||||
Assert.assertEquals("five", inter[2].getTestIdentifier());
|
||||
Assert.assertEquals("six", inter[3].getTestIdentifier());
|
||||
Assert.assertEquals("seven", inter[4].getTestIdentifier());
|
||||
Assert.assertEquals("seven", inter[5].getTestIdentifier());
|
||||
Assert.assertEquals("one", inter[6].getTestIdentifier());
|
||||
}
|
||||
}
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void validateGlobalInterceptorsAllPattern(){
|
||||
ApplicationContext applicationContext =
|
||||
new ClassPathXmlApplicationContext("GlobalChannelInterceptorTests-all-context.xml", GlobalChannelInterceptorTests.class);
|
||||
Map<String, AbstractMessageChannel> channels = applicationContext.getBeansOfType(AbstractMessageChannel.class);
|
||||
for (String channelName : channels.keySet()) {
|
||||
AbstractMessageChannel channel = channels.get(channelName);
|
||||
DirectFieldAccessor cAccessor = new DirectFieldAccessor(channel);
|
||||
Object iList = cAccessor.getPropertyValue("interceptors");
|
||||
DirectFieldAccessor iAccessor = new DirectFieldAccessor(iList);
|
||||
List<SampleInterceptor> interceptoList = (List<SampleInterceptor>) iAccessor.getPropertyValue("interceptors");
|
||||
if (channelName.equals("inputA")){
|
||||
SampleInterceptor[] inter = interceptoList.toArray(new SampleInterceptor[]{});
|
||||
ChannelInterceptor[] inter = interceptoList.toArray(new ChannelInterceptor[]{});
|
||||
Assert.assertTrue(inter.length == 2);
|
||||
} else if (channelName.equals("inputB")){
|
||||
SampleInterceptor[] inter = interceptoList.toArray(new SampleInterceptor[]{});
|
||||
Assert.assertTrue(inter.length == 1);
|
||||
} else if (channelName.equals("inputC")){
|
||||
SampleInterceptor[] inter = interceptoList.toArray(new SampleInterceptor[]{});
|
||||
Assert.assertTrue(inter.length == 1);
|
||||
Assert.assertEquals("interceptor-ten", inter[0].toString());
|
||||
Assert.assertEquals("interceptor-eleven", inter[1].toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class SampleInterceptor implements ChannelInterceptor {
|
||||
private String testIdentifier;
|
||||
@@ -210,6 +123,10 @@ public class GlobalChannelInterceptorTests {
|
||||
public Message<?> preSend(Message<?> message, MessageChannel channel) {
|
||||
return null;
|
||||
}
|
||||
public String toString(){
|
||||
return "interceptor-" + testIdentifier;
|
||||
}
|
||||
|
||||
}
|
||||
public static class SampleOrderedInterceptor extends SampleInterceptor implements Ordered {
|
||||
private int order;
|
||||
|
||||
Reference in New Issue
Block a user