INT-3470: SF 4.1 Compatibility #2
JIRA: https://jira.spring.io/browse/INT-3470 * Apply the last `ChannelInterceptor` changes - just `extends ChannelInterceptorAdapter` * Change some tests to check content according to the new changes to the `GenericMessage#toString()` **Cherry-pick to 4.0.x**
This commit is contained in:
committed by
Gary Russell
parent
e8898821ae
commit
f0eeb3b2b9
@@ -55,8 +55,8 @@ public class AnnotationAggregatorTests {
|
||||
@SuppressWarnings("unchecked")
|
||||
Message<String> result = (Message<String>) output.receive();
|
||||
String payload = result.getPayload();
|
||||
assertTrue("Wrong payload: "+payload, payload.contains("Payload String content=a"));
|
||||
assertTrue("Wrong payload: "+payload, payload.contains("Payload String content=b"));
|
||||
assertTrue("Wrong payload: "+payload, payload.matches(".*Payload.*?=a.*"));
|
||||
assertTrue("Wrong payload: "+payload, payload.matches(".*Payload.*?=b.*"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
|
||||
@@ -30,11 +30,11 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.integration.channel.AbstractMessageChannel;
|
||||
import org.springframework.integration.channel.ChannelInterceptorAware;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.support.ChannelInterceptor;
|
||||
import org.springframework.messaging.support.ChannelInterceptorAdapter;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@@ -127,7 +127,7 @@ public class GlobalChannelInterceptorTests {
|
||||
}
|
||||
|
||||
|
||||
public static class SampleInterceptor implements ChannelInterceptor {
|
||||
public static class SampleInterceptor extends ChannelInterceptorAdapter {
|
||||
|
||||
private String testIdentifier;
|
||||
|
||||
|
||||
@@ -15,10 +15,8 @@
|
||||
*/
|
||||
package org.springframework.integration.channel.interceptor;
|
||||
|
||||
import static org.hamcrest.Matchers.anyOf;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -31,6 +29,7 @@ import org.springframework.integration.channel.ChannelInterceptorAware;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.support.ChannelInterceptor;
|
||||
import org.springframework.messaging.support.ChannelInterceptorAdapter;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@@ -69,7 +68,7 @@ public class ImplicitConsumerChannelTests {
|
||||
assertThat(bazInterceptors.get(1), anyOf(instanceOf(WireTap.class), instanceOf(Interceptor1.class)));
|
||||
}
|
||||
|
||||
public static class Interceptor1 implements ChannelInterceptor, VetoCapableInterceptor {
|
||||
public static class Interceptor1 extends ChannelInterceptorAdapter implements VetoCapableInterceptor {
|
||||
|
||||
private MessageChannel channel;
|
||||
|
||||
@@ -107,7 +106,7 @@ public class ImplicitConsumerChannelTests {
|
||||
|
||||
}
|
||||
|
||||
public static class Interceptor2 implements ChannelInterceptor, VetoCapableInterceptor {
|
||||
public static class Interceptor2 extends ChannelInterceptorAdapter implements VetoCapableInterceptor {
|
||||
|
||||
private MessageChannel channel;
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ import org.springframework.jms.core.MessageCreator;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.support.ChannelInterceptor;
|
||||
import org.springframework.messaging.support.ChannelInterceptorAdapter;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
|
||||
/**
|
||||
@@ -266,8 +267,10 @@ public class PollableJmsChannelTests {
|
||||
assertEquals("bar", result2.getPayload());
|
||||
}
|
||||
|
||||
public static class SampleInterceptor implements ChannelInterceptor {
|
||||
public static class SampleInterceptor extends ChannelInterceptorAdapter {
|
||||
|
||||
private final boolean preReceiveFlag;
|
||||
|
||||
public SampleInterceptor(boolean preReceiveFlag){
|
||||
this.preReceiveFlag = preReceiveFlag;
|
||||
}
|
||||
|
||||
@@ -266,7 +266,6 @@ public class WebServiceOutboundGatewayParserTests {
|
||||
assertEquals(PeriodicTrigger.class, triggerObject.getClass());
|
||||
PeriodicTrigger trigger = (PeriodicTrigger) triggerObject;
|
||||
DirectFieldAccessor accessor = new DirectFieldAccessor(trigger);
|
||||
accessor = new DirectFieldAccessor(trigger);
|
||||
assertEquals("PeriodicTrigger had wrong period",
|
||||
5000, ((Long)accessor.getPropertyValue("period")).longValue());
|
||||
}
|
||||
@@ -397,6 +396,7 @@ public class WebServiceOutboundGatewayParserTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void jmsUri() {
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"simpleWebServiceOutboundGatewayParserTests.xml", this.getClass());
|
||||
|
||||
@@ -113,9 +113,9 @@ public class MarshallingTransformerParserTests {
|
||||
Message<?> result = output.receive(0);
|
||||
assertTrue("Wrong payload type", result.getPayload() instanceof DOMResult);
|
||||
Document doc = (Document) ((DOMResult) result.getPayload()).getNode();
|
||||
String expected = "[Payload String content=hello]";
|
||||
String actual = doc.getDocumentElement().getTextContent();
|
||||
assertThat(actual, Matchers.containsString(expected));
|
||||
assertThat(actual, Matchers.containsString("[Payload"));
|
||||
assertThat(actual, Matchers.containsString("=hello]"));
|
||||
assertThat(actual, Matchers.containsString("[Headers="));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user