Fix Mixed Header Mode Tests

Resolves spring-cloud/spring-cloud-stream#1159

- interceptor was missing

* Fix import order

* Add eclipse import order prefs
This commit is contained in:
Gary Russell
2017-12-22 09:48:11 -05:00
committed by Artem Bilan
parent 50b8955dfc
commit a7fe39fef5
4 changed files with 28 additions and 7 deletions

View File

@@ -0,0 +1,5 @@
eclipse.preferences.version=1
org.eclipse.jdt.ui.ignorelowercasenames=true
org.eclipse.jdt.ui.importorder=java;javax;com;org;org.springframework;ch.qos;\#;
org.eclipse.jdt.ui.ondemandthreshold=99
org.eclipse.jdt.ui.staticondemandthreshold=99

View File

@@ -0,0 +1,5 @@
eclipse.preferences.version=1
org.eclipse.jdt.ui.ignorelowercasenames=true
org.eclipse.jdt.ui.importorder=java;javax;com;org;org.springframework;ch.qos;\#;
org.eclipse.jdt.ui.ondemandthreshold=99
org.eclipse.jdt.ui.staticondemandthreshold=99

View File

@@ -87,6 +87,7 @@ import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.context.IntegrationContextUtils;
import org.springframework.integration.handler.BridgeHandler;
import org.springframework.integration.kafka.inbound.KafkaMessageDrivenChannelAdapter;
import org.springframework.integration.kafka.outbound.KafkaProducerMessageHandler;
import org.springframework.integration.kafka.support.KafkaSendFailureException;
@@ -2324,7 +2325,6 @@ public class KafkaBinderTests extends
KafkaBinderConfigurationProperties binderConfiguration = createConfigurationProperties();
binderConfiguration.setHeaders("foo");
Binder binder = getBinder(binderConfiguration);
QueueChannel moduleInputChannel = new QueueChannel();
DirectChannel moduleOutputChannel1 = new DirectChannel();
ExtendedProducerProperties<KafkaProducerProperties> producerProperties1 = createProducerProperties();
producerProperties1.setHeaderMode(HeaderMode.embeddedHeaders);
@@ -2345,6 +2345,12 @@ public class KafkaBinderTests extends
ExtendedConsumerProperties<KafkaConsumerProperties> consumerProperties = createConsumerProperties();
consumerProperties.setHeaderMode(HeaderMode.embeddedHeaders);
DirectChannel moduleInputChannel = createBindableChannel("input",
createConsumerBindingProperties(consumerProperties));
QueueChannel bridged = new QueueChannel();
BridgeHandler bridge = new BridgeHandler();
bridge.setOutputChannel(bridged);
moduleInputChannel.subscribe(bridge);
Binding<MessageChannel> consumerBinding = binder.bindConsumer("mixed.0", "test", moduleInputChannel,
consumerProperties);
Message<?> message = org.springframework.integration.support.MessageBuilder
@@ -2356,19 +2362,19 @@ public class KafkaBinderTests extends
moduleOutputChannel1.send(message);
moduleOutputChannel2.send(message);
moduleOutputChannel3.send(message);
Message<?> inbound = receive(moduleInputChannel, 10_000);
Message<?> inbound = receive(bridged, 10_000);
assertThat(inbound).isNotNull();
assertThat(new String((byte[]) inbound.getPayload(), StandardCharsets.UTF_8)).isEqualTo("testSendAndReceiveWithMixedMode");
assertThat(inbound.getPayload()).isEqualTo("testSendAndReceiveWithMixedMode");
assertThat(inbound.getHeaders().get("foo")).isEqualTo("bar");
assertThat(inbound.getHeaders().get(BinderHeaders.NATIVE_HEADERS_PRESENT)).isNull();
inbound = receive(moduleInputChannel);
inbound = receive(bridged);
assertThat(inbound).isNotNull();
assertThat(new String((byte[]) inbound.getPayload(), StandardCharsets.UTF_8)).isEqualTo("testSendAndReceiveWithMixedMode");
assertThat(inbound.getPayload()).isEqualTo("testSendAndReceiveWithMixedMode");
assertThat(inbound.getHeaders().get("foo")).isEqualTo("bar");
assertThat(inbound.getHeaders().get(BinderHeaders.NATIVE_HEADERS_PRESENT)).isEqualTo(Boolean.TRUE);
inbound = receive(moduleInputChannel);
inbound = receive(bridged);
assertThat(inbound).isNotNull();
assertThat(new String((byte[]) inbound.getPayload(), StandardCharsets.UTF_8)).isEqualTo("testSendAndReceiveWithMixedMode");
assertThat(inbound.getPayload()).isEqualTo("testSendAndReceiveWithMixedMode");
assertThat(inbound.getHeaders().get("foo")).isNull();
assertThat(inbound.getHeaders().get(BinderHeaders.NATIVE_HEADERS_PRESENT)).isNull();

View File

@@ -0,0 +1,5 @@
eclipse.preferences.version=1
org.eclipse.jdt.ui.ignorelowercasenames=true
org.eclipse.jdt.ui.importorder=java;javax;com;org;org.springframework;ch.qos;\#;
org.eclipse.jdt.ui.ondemandthreshold=99
org.eclipse.jdt.ui.staticondemandthreshold=99