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:
committed by
Artem Bilan
parent
50b8955dfc
commit
a7fe39fef5
@@ -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
|
||||
@@ -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
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user