GH-1707 Initial removal of 2.0.0 deprecated classes and methods
This commit is contained in:
@@ -39,8 +39,6 @@ import org.springframework.cloud.stream.binding.StreamListenerMessageHandler;
|
||||
import org.springframework.cloud.stream.config.BindingProperties;
|
||||
import org.springframework.cloud.stream.config.BindingServiceProperties;
|
||||
import org.springframework.cloud.stream.converter.CompositeMessageConverterFactory;
|
||||
import org.springframework.cloud.stream.converter.JavaSerializationMessageConverter;
|
||||
import org.springframework.cloud.stream.converter.KryoMessageConverter;
|
||||
import org.springframework.cloud.stream.converter.MessageConverterUtils;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.Lifecycle;
|
||||
@@ -217,114 +215,6 @@ public abstract class AbstractBinderTests<B extends AbstractTestBinder<? extends
|
||||
consumerBinding.unbind();
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({ "rawtypes", "deprecation" })
|
||||
public void testSendAndReceiveKryo() throws Exception {
|
||||
Binder binder = getBinder();
|
||||
BindingProperties outputBindingProperties = createProducerBindingProperties(
|
||||
createProducerProperties());
|
||||
DirectChannel moduleOutputChannel = createBindableChannel("output",
|
||||
outputBindingProperties);
|
||||
|
||||
BindingProperties inputBindingProperties = createConsumerBindingProperties(
|
||||
createConsumerProperties());
|
||||
DirectChannel moduleInputChannel = createBindableChannel("input",
|
||||
inputBindingProperties);
|
||||
|
||||
Binding<MessageChannel> producerBinding = binder.bindProducer(
|
||||
String.format("foo%s0x", getDestinationNameDelimiter()),
|
||||
moduleOutputChannel, outputBindingProperties.getProducer());
|
||||
Binding<MessageChannel> consumerBinding = binder.bindConsumer(
|
||||
String.format("foo%s0x", getDestinationNameDelimiter()),
|
||||
"testSendAndReceiveKryo", moduleInputChannel,
|
||||
inputBindingProperties.getConsumer());
|
||||
Foo foo = new Foo();
|
||||
foo.setName("Bill");
|
||||
Message<?> message = MessageBuilder.withPayload(foo).setHeader(
|
||||
MessageHeaders.CONTENT_TYPE, MessageConverterUtils.X_JAVA_OBJECT).build();
|
||||
// Let the consumer actually bind to the producer before sending a msg
|
||||
binderBindUnbindLatency();
|
||||
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
AtomicReference<Message<Foo>> inboundMessageRef = new AtomicReference<Message<Foo>>();
|
||||
moduleInputChannel.subscribe(message1 -> {
|
||||
try {
|
||||
inboundMessageRef.set((Message<Foo>) message1);
|
||||
}
|
||||
finally {
|
||||
latch.countDown();
|
||||
}
|
||||
});
|
||||
|
||||
moduleOutputChannel.send(message);
|
||||
Assert.isTrue(latch.await(5, TimeUnit.SECONDS), "Failed to receive message");
|
||||
|
||||
KryoMessageConverter kryo = new KryoMessageConverter(null, true);
|
||||
Foo fooPayload = (Foo) kryo.fromMessage(inboundMessageRef.get(), Foo.class);
|
||||
assertThat(fooPayload).isNotNull();
|
||||
assertThat(inboundMessageRef.get().getHeaders()
|
||||
.get(BinderHeaders.BINDER_ORIGINAL_CONTENT_TYPE)).isNull();
|
||||
producerBinding.unbind();
|
||||
consumerBinding.unbind();
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({ "rawtypes", "deprecation" })
|
||||
public void testSendAndReceiveJavaSerialization() throws Exception {
|
||||
Binder binder = getBinder();
|
||||
BindingProperties outputBindingProperties = createProducerBindingProperties(
|
||||
createProducerProperties());
|
||||
|
||||
DirectChannel moduleOutputChannel = createBindableChannel("output",
|
||||
outputBindingProperties);
|
||||
|
||||
BindingProperties inputBindingProperties = createConsumerBindingProperties(
|
||||
createConsumerProperties());
|
||||
DirectChannel moduleInputChannel = createBindableChannel("input",
|
||||
inputBindingProperties);
|
||||
|
||||
Binding<MessageChannel> producerBinding = binder.bindProducer(
|
||||
String.format("foo%s0y", getDestinationNameDelimiter()),
|
||||
moduleOutputChannel, outputBindingProperties.getProducer());
|
||||
|
||||
Binding<MessageChannel> consumerBinding = binder.bindConsumer(
|
||||
String.format("foo%s0y", getDestinationNameDelimiter()),
|
||||
"testSendAndReceiveJavaSerialization", moduleInputChannel,
|
||||
inputBindingProperties.getConsumer());
|
||||
SerializableFoo foo = new SerializableFoo();
|
||||
Message<?> message = MessageBuilder.withPayload(foo)
|
||||
.setHeader(MessageHeaders.CONTENT_TYPE,
|
||||
MessageConverterUtils.X_JAVA_SERIALIZED_OBJECT)
|
||||
.build();
|
||||
// Let the consumer actually bind to the producer before sending a msg
|
||||
binderBindUnbindLatency();
|
||||
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
AtomicReference<Message<byte[]>> inboundMessageRef = new AtomicReference<Message<byte[]>>();
|
||||
moduleInputChannel.subscribe(message1 -> {
|
||||
try {
|
||||
inboundMessageRef.set((Message<byte[]>) message1);
|
||||
}
|
||||
finally {
|
||||
latch.countDown();
|
||||
}
|
||||
});
|
||||
|
||||
moduleOutputChannel.send(message);
|
||||
Assert.isTrue(latch.await(5, TimeUnit.SECONDS), "Failed to receive message");
|
||||
|
||||
JavaSerializationMessageConverter converter = new JavaSerializationMessageConverter();
|
||||
SerializableFoo serializableFoo = (SerializableFoo) converter.convertFromInternal(
|
||||
inboundMessageRef.get(), SerializableFoo.class, null);
|
||||
assertThat(serializableFoo).isNotNull();
|
||||
assertThat(inboundMessageRef.get().getHeaders()
|
||||
.get(BinderHeaders.BINDER_ORIGINAL_CONTENT_TYPE)).isNull();
|
||||
assertThat(inboundMessageRef.get().getHeaders().get(MessageHeaders.CONTENT_TYPE))
|
||||
.isEqualTo(MessageConverterUtils.X_JAVA_SERIALIZED_OBJECT);
|
||||
producerBinding.unbind();
|
||||
consumerBinding.unbind();
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void testSendAndReceiveMultipleTopics() throws Exception {
|
||||
@@ -888,19 +778,4 @@ public abstract class AbstractBinderTests<B extends AbstractTestBinder<? extends
|
||||
|
||||
}
|
||||
|
||||
private class Foo {
|
||||
|
||||
private String name;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -306,7 +306,6 @@ public abstract class PartitionCapableBinderTests<B extends AbstractTestBinder<?
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testPartitionedModuleJava() throws Exception {
|
||||
B binder = getBinder();
|
||||
|
||||
@@ -334,8 +333,6 @@ public abstract class PartitionCapableBinderTests<B extends AbstractTestBinder<?
|
||||
"testPartitionedModuleJava", input2, consumerProperties);
|
||||
|
||||
PP producerProperties = createProducerProperties();
|
||||
producerProperties.setPartitionKeyExtractorClass(PartitionTestSupport.class);
|
||||
producerProperties.setPartitionSelectorClass(PartitionTestSupport.class);
|
||||
producerProperties.setPartitionCount(3);
|
||||
DirectChannel output = createBindableChannel("output",
|
||||
createProducerBindingProperties(producerProperties));
|
||||
|
||||
Reference in New Issue
Block a user