Skip to content

Commit 3890e89

Browse files
Artem Bilangaryrussell
authored andcommitted
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**
1 parent 84e3d4e commit 3890e89

File tree

6 files changed

+16
-14
lines changed

6 files changed

+16
-14
lines changed

spring-integration-core/src/test/java/org/springframework/integration/aggregator/integration/AnnotationAggregatorTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ public void testAggregationWithAnnotationStrategies() {
5555
@SuppressWarnings("unchecked")
5656
Message<String> result = (Message<String>) output.receive();
5757
String payload = result.getPayload();
58-
assertTrue("Wrong payload: "+payload, payload.contains("Payload String content=a"));
59-
assertTrue("Wrong payload: "+payload, payload.contains("Payload String content=b"));
58+
assertTrue("Wrong payload: "+payload, payload.matches(".*Payload.*?=a.*"));
59+
assertTrue("Wrong payload: "+payload, payload.matches(".*Payload.*?=b.*"));
6060
}
6161

6262
@SuppressWarnings("unused")

spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@
3030
import org.springframework.beans.factory.annotation.Qualifier;
3131
import org.springframework.context.ApplicationContext;
3232
import org.springframework.core.Ordered;
33-
import org.springframework.integration.channel.AbstractMessageChannel;
3433
import org.springframework.integration.channel.ChannelInterceptorAware;
3534
import org.springframework.messaging.Message;
3635
import org.springframework.messaging.MessageChannel;
3736
import org.springframework.messaging.support.ChannelInterceptor;
37+
import org.springframework.messaging.support.ChannelInterceptorAdapter;
3838
import org.springframework.test.context.ContextConfiguration;
3939
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
4040

@@ -127,7 +127,7 @@ public void testWildCardPatternMatch() {
127127
}
128128

129129

130-
public static class SampleInterceptor implements ChannelInterceptor {
130+
public static class SampleInterceptor extends ChannelInterceptorAdapter {
131131

132132
private String testIdentifier;
133133

spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/ImplicitConsumerChannelTests.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@
1515
*/
1616
package org.springframework.integration.channel.interceptor;
1717

18-
import static org.hamcrest.Matchers.anyOf;
19-
import static org.hamcrest.Matchers.instanceOf;
20-
import static org.junit.Assert.assertEquals;
21-
import static org.junit.Assert.assertThat;
18+
import static org.hamcrest.Matchers.*;
19+
import static org.junit.Assert.*;
2220

2321
import java.util.List;
2422

@@ -31,6 +29,7 @@
3129
import org.springframework.messaging.Message;
3230
import org.springframework.messaging.MessageChannel;
3331
import org.springframework.messaging.support.ChannelInterceptor;
32+
import org.springframework.messaging.support.ChannelInterceptorAdapter;
3433
import org.springframework.test.context.ContextConfiguration;
3534
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
3635

@@ -69,7 +68,7 @@ public void testImplicit() {
6968
assertThat(bazInterceptors.get(1), anyOf(instanceOf(WireTap.class), instanceOf(Interceptor1.class)));
7069
}
7170

72-
public static class Interceptor1 implements ChannelInterceptor, VetoCapableInterceptor {
71+
public static class Interceptor1 extends ChannelInterceptorAdapter implements VetoCapableInterceptor {
7372

7473
private MessageChannel channel;
7574

@@ -107,7 +106,7 @@ public boolean shouldIntercept(String beanName, ChannelInterceptorAware channel)
107106

108107
}
109108

110-
public static class Interceptor2 implements ChannelInterceptor, VetoCapableInterceptor {
109+
public static class Interceptor2 extends ChannelInterceptorAdapter implements VetoCapableInterceptor {
111110

112111
private MessageChannel channel;
113112

spring-integration-jms/src/test/java/org/springframework/integration/jms/PollableJmsChannelTests.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
import org.springframework.messaging.Message;
5353
import org.springframework.messaging.MessageChannel;
5454
import org.springframework.messaging.support.ChannelInterceptor;
55+
import org.springframework.messaging.support.ChannelInterceptorAdapter;
5556
import org.springframework.messaging.support.GenericMessage;
5657

5758
/**
@@ -266,8 +267,10 @@ public javax.jms.Message createMessage(Session session) throws JMSException {
266267
assertEquals("bar", result2.getPayload());
267268
}
268269

269-
public static class SampleInterceptor implements ChannelInterceptor {
270+
public static class SampleInterceptor extends ChannelInterceptorAdapter {
271+
270272
private final boolean preReceiveFlag;
273+
271274
public SampleInterceptor(boolean preReceiveFlag){
272275
this.preReceiveFlag = preReceiveFlag;
273276
}

spring-integration-ws/src/test/java/org/springframework/integration/ws/config/WebServiceOutboundGatewayParserTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@ public void simpleGatewayWithPoller() {
265265
assertEquals(PeriodicTrigger.class, triggerObject.getClass());
266266
PeriodicTrigger trigger = (PeriodicTrigger) triggerObject;
267267
DirectFieldAccessor accessor = new DirectFieldAccessor(trigger);
268-
accessor = new DirectFieldAccessor(trigger);
269268
assertEquals("PeriodicTrigger had wrong period",
270269
5000, ((Long)accessor.getPropertyValue("period")).longValue());
271270
}
@@ -396,6 +395,7 @@ public void testInt2718AdvisedInsideAChain() {
396395
}
397396

398397
@Test
398+
@SuppressWarnings("unchecked")
399399
public void jmsUri() {
400400
ApplicationContext context = new ClassPathXmlApplicationContext(
401401
"simpleWebServiceOutboundGatewayParserTests.xml", this.getClass());

spring-integration-xml/src/test/java/org/springframework/integration/xml/config/MarshallingTransformerParserTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ public void testFullMessage() throws Exception {
113113
Message<?> result = output.receive(0);
114114
assertTrue("Wrong payload type", result.getPayload() instanceof DOMResult);
115115
Document doc = (Document) ((DOMResult) result.getPayload()).getNode();
116-
String expected = "[Payload String content=hello]";
117116
String actual = doc.getDocumentElement().getTextContent();
118-
assertThat(actual, Matchers.containsString(expected));
117+
assertThat(actual, Matchers.containsString("[Payload"));
118+
assertThat(actual, Matchers.containsString("=hello]"));
119119
assertThat(actual, Matchers.containsString("[Headers="));
120120
}
121121

0 commit comments

Comments
 (0)