Polish SI test binder after maven publishing
- Renamed classes and package to be consistent with the intentions of this binder (e.g., TestChannelBinder, TestChannelBinderConfiguration etc) - Added package-info.java Resolves #1241
This commit is contained in:
@@ -38,5 +38,11 @@
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-stream</artifactId>
|
||||
<type>test-jar</type>
|
||||
<classifier>test-binder</classifier>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>spring-cloud-stream-integration-tests</artifactId>
|
||||
@@ -23,6 +24,12 @@
|
||||
<artifactId>spring-cloud-stream-test-support</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-stream</artifactId>
|
||||
<type>test-jar</type>
|
||||
<classifier>test-binder</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-stream-test-support-internal</artifactId>
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
<execution>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>**/integration/*</include>
|
||||
<include>**/test/*</include>
|
||||
</includes>
|
||||
<classifier>test-binder</classifier>
|
||||
</configuration>
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.junit.Test;
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.boot.WebApplicationType;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.cloud.stream.binder.integration.SpringIntegrationBinderConfiguration;
|
||||
import org.springframework.cloud.stream.binder.test.TestChannelBinderConfiguration;
|
||||
import org.springframework.cloud.stream.provisioning.ProvisioningProvider;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
@@ -56,7 +56,7 @@ public class AbstractMessageChannelBinderTests {
|
||||
|
||||
@Before
|
||||
public void prepare() {
|
||||
this.context = new SpringApplicationBuilder(SpringIntegrationBinderConfiguration.getCompleteConfiguration())
|
||||
this.context = new SpringApplicationBuilder(TestChannelBinderConfiguration.getCompleteConfiguration())
|
||||
.web(WebApplicationType.NONE)
|
||||
.run();
|
||||
}
|
||||
@@ -107,7 +107,7 @@ public class AbstractMessageChannelBinderTests {
|
||||
@Test
|
||||
public void testEndpointBinderHasRecoverer() throws Exception {
|
||||
ConfigurableApplicationContext context =
|
||||
new SpringApplicationBuilder(SpringIntegrationBinderConfiguration.getCompleteConfiguration()).web(WebApplicationType.NONE).run();
|
||||
new SpringApplicationBuilder(TestChannelBinderConfiguration.getCompleteConfiguration()).web(WebApplicationType.NONE).run();
|
||||
|
||||
AbstractMessageChannelBinder<ConsumerProperties, ProducerProperties, ProvisioningProvider<ConsumerProperties, ProducerProperties>> binder =
|
||||
context.getBean(AbstractMessageChannelBinder.class);
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.mockito.Mockito;
|
||||
|
||||
import org.springframework.boot.WebApplicationType;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.cloud.stream.binder.integration.SpringIntegrationBinderConfiguration;
|
||||
import org.springframework.cloud.stream.binder.test.TestChannelBinderConfiguration;
|
||||
import org.springframework.cloud.stream.binding.Bindable;
|
||||
import org.springframework.cloud.stream.binding.BinderAwareChannelResolver;
|
||||
import org.springframework.cloud.stream.binding.BindingService;
|
||||
@@ -94,7 +94,7 @@ public class BinderAwareChannelResolverTests {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Before
|
||||
public void setupContext() throws Exception {
|
||||
this.context = new SpringApplicationBuilder(SpringIntegrationBinderConfiguration.getCompleteConfiguration(BinderAwareChannelResolverTests.InterceptorConfiguration.class))
|
||||
this.context = new SpringApplicationBuilder(TestChannelBinderConfiguration.getCompleteConfiguration(BinderAwareChannelResolverTests.InterceptorConfiguration.class))
|
||||
.web(WebApplicationType.NONE).run();
|
||||
|
||||
this.resolver = context.getBean(BinderAwareChannelResolver.class);
|
||||
|
||||
@@ -27,8 +27,8 @@ import org.junit.Test;
|
||||
|
||||
import org.springframework.boot.WebApplicationType;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.cloud.stream.binder.integration.SpringIntegrationBinderConfiguration;
|
||||
import org.springframework.cloud.stream.binder.integration.SpringIntegrationChannelBinder;
|
||||
import org.springframework.cloud.stream.binder.test.TestChannelBinder;
|
||||
import org.springframework.cloud.stream.binder.test.TestChannelBinderConfiguration;
|
||||
import org.springframework.cloud.stream.binding.MessageConverterConfigurer;
|
||||
import org.springframework.cloud.stream.converter.CompositeMessageConverterFactory;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
@@ -66,7 +66,7 @@ public class PollableConsumerTests {
|
||||
|
||||
@Test
|
||||
public void testSimple() {
|
||||
SpringIntegrationChannelBinder binder = createBinder();
|
||||
TestChannelBinder binder = createBinder();
|
||||
MessageConverterConfigurer configurer = context.getBean(MessageConverterConfigurer.class);
|
||||
|
||||
DefaultPollableMessageSource pollableSource = new DefaultPollableMessageSource(this.messageConverter);
|
||||
@@ -98,7 +98,7 @@ public class PollableConsumerTests {
|
||||
|
||||
@Test
|
||||
public void testConvertSimple() {
|
||||
SpringIntegrationChannelBinder binder = createBinder();
|
||||
TestChannelBinder binder = createBinder();
|
||||
MessageConverterConfigurer configurer = context.getBean(MessageConverterConfigurer.class);
|
||||
|
||||
binder.setMessageSourceDelegate(() -> new GenericMessage<>("{\"foo\":\"bar\"}".getBytes()));
|
||||
@@ -125,7 +125,7 @@ public class PollableConsumerTests {
|
||||
|
||||
@Test
|
||||
public void testConvertList() {
|
||||
SpringIntegrationChannelBinder binder = createBinder();
|
||||
TestChannelBinder binder = createBinder();
|
||||
MessageConverterConfigurer configurer = context.getBean(MessageConverterConfigurer.class);
|
||||
|
||||
binder.setMessageSourceDelegate(() -> new GenericMessage<>("[{\"foo\":\"bar\"},{\"foo\":\"baz\"}]".getBytes()));
|
||||
@@ -153,7 +153,7 @@ public class PollableConsumerTests {
|
||||
|
||||
@Test
|
||||
public void testConvertMap() {
|
||||
SpringIntegrationChannelBinder binder = createBinder();
|
||||
TestChannelBinder binder = createBinder();
|
||||
MessageConverterConfigurer configurer = context.getBean(MessageConverterConfigurer.class);
|
||||
|
||||
binder.setMessageSourceDelegate(() -> new GenericMessage<>("{\"qux\":{\"foo\":\"bar\"}}".getBytes()));
|
||||
@@ -176,7 +176,7 @@ public class PollableConsumerTests {
|
||||
|
||||
@Test
|
||||
public void testEmbedded() {
|
||||
SpringIntegrationChannelBinder binder = createBinder();
|
||||
TestChannelBinder binder = createBinder();
|
||||
MessageConverterConfigurer configurer = context.getBean(MessageConverterConfigurer.class);
|
||||
|
||||
binder.setMessageSourceDelegate(() -> {
|
||||
@@ -214,7 +214,7 @@ public class PollableConsumerTests {
|
||||
|
||||
@Test
|
||||
public void testErrors() {
|
||||
SpringIntegrationChannelBinder binder = createBinder();
|
||||
TestChannelBinder binder = createBinder();
|
||||
MessageConverterConfigurer configurer = context.getBean(MessageConverterConfigurer.class);
|
||||
|
||||
DefaultPollableMessageSource pollableSource = new DefaultPollableMessageSource(this.messageConverter);
|
||||
@@ -250,7 +250,7 @@ public class PollableConsumerTests {
|
||||
|
||||
@Test
|
||||
public void testErrorsNoRetry() {
|
||||
SpringIntegrationChannelBinder binder = createBinder();
|
||||
TestChannelBinder binder = createBinder();
|
||||
MessageConverterConfigurer configurer = context.getBean(MessageConverterConfigurer.class);
|
||||
|
||||
DefaultPollableMessageSource pollableSource = new DefaultPollableMessageSource(this.messageConverter);
|
||||
@@ -280,10 +280,10 @@ public class PollableConsumerTests {
|
||||
assertThat(count.get()).isEqualTo(1);
|
||||
}
|
||||
|
||||
private SpringIntegrationChannelBinder createBinder() {
|
||||
this.context = new SpringApplicationBuilder(SpringIntegrationBinderConfiguration.getCompleteConfiguration())
|
||||
private TestChannelBinder createBinder() {
|
||||
this.context = new SpringApplicationBuilder(TestChannelBinderConfiguration.getCompleteConfiguration())
|
||||
.web(WebApplicationType.NONE).run();
|
||||
SpringIntegrationChannelBinder binder = context.getBean(SpringIntegrationChannelBinder.class);
|
||||
TestChannelBinder binder = context.getBean(TestChannelBinder.class);
|
||||
return binder;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.stream.annotation.EnableBinding;
|
||||
import org.springframework.cloud.stream.binder.integration.SpringIntegrationBinderConfiguration;
|
||||
import org.springframework.cloud.stream.binder.test.TestChannelBinderConfiguration;
|
||||
import org.springframework.cloud.stream.config.BindingProperties;
|
||||
import org.springframework.cloud.stream.config.BindingServiceProperties;
|
||||
import org.springframework.cloud.stream.messaging.Source;
|
||||
@@ -35,7 +35,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
* @author Ilayaperumal Gopinathan
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringBootTest(classes = {SpringIntegrationBinderConfiguration.class, SourceBindingWithGlobalPropertiesOnlyTest.TestSource.class}, properties = {
|
||||
@SpringBootTest(classes = {TestChannelBinderConfiguration.class, SourceBindingWithGlobalPropertiesOnlyTest.TestSource.class}, properties = {
|
||||
"spring.cloud.stream.default.contentType=application/json",
|
||||
"spring.cloud.stream.default.producer.partitionKeyExpression=key" })
|
||||
public class SourceBindingWithGlobalPropertiesOnlyTest {
|
||||
|
||||
@@ -29,10 +29,10 @@ import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.cloud.stream.annotation.EnableBinding;
|
||||
import org.springframework.cloud.stream.annotation.StreamListener;
|
||||
import org.springframework.cloud.stream.annotation.StreamMessageConverter;
|
||||
import org.springframework.cloud.stream.binder.integration.SourceDestination;
|
||||
import org.springframework.cloud.stream.binder.integration.SpringIntegrationBinderConfiguration;
|
||||
import org.springframework.cloud.stream.binder.integration.SpringIntegrationChannelBinder;
|
||||
import org.springframework.cloud.stream.binder.integration.TargetDestination;
|
||||
import org.springframework.cloud.stream.binder.test.InputDestination;
|
||||
import org.springframework.cloud.stream.binder.test.OutputDestination;
|
||||
import org.springframework.cloud.stream.binder.test.TestChannelBinder;
|
||||
import org.springframework.cloud.stream.binder.test.TestChannelBinderConfiguration;
|
||||
import org.springframework.cloud.stream.converter.KryoMessageConverter;
|
||||
import org.springframework.cloud.stream.converter.MessageConverterUtils;
|
||||
import org.springframework.cloud.stream.messaging.Processor;
|
||||
@@ -74,8 +74,8 @@ public class ContentTypeTckTests {
|
||||
ApplicationContext context = new SpringApplicationBuilder(PojoToPojoStreamListener.class)
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.jmx.enabled=false");
|
||||
SourceDestination source = context.getBean(SourceDestination.class);
|
||||
TargetDestination target = context.getBean(TargetDestination.class);
|
||||
InputDestination source = context.getBean(InputDestination.class);
|
||||
OutputDestination target = context.getBean(OutputDestination.class);
|
||||
String jsonPayload = "{\"name\":\"oleg\"}";
|
||||
source.send(new GenericMessage<byte[]>(jsonPayload.getBytes()));
|
||||
Message<byte[]> outputMessage = target.receive();
|
||||
@@ -88,8 +88,8 @@ public class ContentTypeTckTests {
|
||||
ApplicationContext context = new SpringApplicationBuilder(PojoToStringStreamListener.class)
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.jmx.enabled=false");
|
||||
SourceDestination source = context.getBean(SourceDestination.class);
|
||||
TargetDestination target = context.getBean(TargetDestination.class);
|
||||
InputDestination source = context.getBean(InputDestination.class);
|
||||
OutputDestination target = context.getBean(OutputDestination.class);
|
||||
String jsonPayload = "{\"name\":\"oleg\"}";
|
||||
source.send(new GenericMessage<byte[]>(jsonPayload.getBytes()));
|
||||
Message<byte[]> outputMessage = target.receive();
|
||||
@@ -102,8 +102,8 @@ public class ContentTypeTckTests {
|
||||
ApplicationContext context = new SpringApplicationBuilder(PojoToStringStreamListener.class)
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.cloud.stream.bindings.output.contentType=text/plain", "--spring.jmx.enabled=false");
|
||||
SourceDestination source = context.getBean(SourceDestination.class);
|
||||
TargetDestination target = context.getBean(TargetDestination.class);
|
||||
InputDestination source = context.getBean(InputDestination.class);
|
||||
OutputDestination target = context.getBean(OutputDestination.class);
|
||||
String jsonPayload = "{\"name\":\"oleg\"}";
|
||||
source.send(new GenericMessage<byte[]>(jsonPayload.getBytes()));
|
||||
Message<byte[]> outputMessage = target.receive();
|
||||
@@ -116,8 +116,8 @@ public class ContentTypeTckTests {
|
||||
ApplicationContext context = new SpringApplicationBuilder(PojoToByteArrayStreamListener.class)
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.jmx.enabled=false");
|
||||
SourceDestination source = context.getBean(SourceDestination.class);
|
||||
TargetDestination target = context.getBean(TargetDestination.class);
|
||||
InputDestination source = context.getBean(InputDestination.class);
|
||||
OutputDestination target = context.getBean(OutputDestination.class);
|
||||
String jsonPayload = "{\"name\":\"oleg\"}";
|
||||
source.send(new GenericMessage<byte[]>(jsonPayload.getBytes()));
|
||||
Message<byte[]> outputMessage = target.receive();
|
||||
@@ -130,8 +130,8 @@ public class ContentTypeTckTests {
|
||||
ApplicationContext context = new SpringApplicationBuilder(PojoToByteArrayStreamListener.class)
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.cloud.stream.bindings.output.contentType=text/plain", "--spring.jmx.enabled=false");
|
||||
SourceDestination source = context.getBean(SourceDestination.class);
|
||||
TargetDestination target = context.getBean(TargetDestination.class);
|
||||
InputDestination source = context.getBean(InputDestination.class);
|
||||
OutputDestination target = context.getBean(OutputDestination.class);
|
||||
String jsonPayload = "{\"name\":\"oleg\"}";
|
||||
source.send(new GenericMessage<byte[]>(jsonPayload.getBytes()));
|
||||
Message<byte[]> outputMessage = target.receive();
|
||||
@@ -144,8 +144,8 @@ public class ContentTypeTckTests {
|
||||
ApplicationContext context = new SpringApplicationBuilder(StringToPojoStreamListener.class)
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.cloud.stream.bindings.input.contentType=text/plain", "--spring.jmx.enabled=false");
|
||||
SourceDestination source = context.getBean(SourceDestination.class);
|
||||
TargetDestination target = context.getBean(TargetDestination.class);
|
||||
InputDestination source = context.getBean(InputDestination.class);
|
||||
OutputDestination target = context.getBean(OutputDestination.class);
|
||||
String jsonPayload = "{\"name\":\"oleg\"}";
|
||||
source.send(new GenericMessage<byte[]>(jsonPayload.getBytes()));
|
||||
Message<byte[]> outputMessage = target.receive();
|
||||
@@ -158,8 +158,8 @@ public class ContentTypeTckTests {
|
||||
ApplicationContext context = new SpringApplicationBuilder(StringToPojoStreamListener.class)
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.jmx.enabled=false");
|
||||
SourceDestination source = context.getBean(SourceDestination.class);
|
||||
TargetDestination target = context.getBean(TargetDestination.class);
|
||||
InputDestination source = context.getBean(InputDestination.class);
|
||||
OutputDestination target = context.getBean(OutputDestination.class);
|
||||
String jsonPayload = "{\"name\":\"oleg\"}";
|
||||
source.send(new GenericMessage<byte[]>(jsonPayload.getBytes(), new MessageHeaders(Collections.singletonMap(MessageHeaders.CONTENT_TYPE, MimeTypeUtils.TEXT_PLAIN))));
|
||||
Message<byte[]> outputMessage = target.receive();
|
||||
@@ -172,8 +172,8 @@ public class ContentTypeTckTests {
|
||||
ApplicationContext context = new SpringApplicationBuilder(ByteArrayToPojoStreamListener.class)
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.cloud.stream.bindings.input.contentType=text/plain", "--spring.jmx.enabled=false");
|
||||
SourceDestination source = context.getBean(SourceDestination.class);
|
||||
TargetDestination target = context.getBean(TargetDestination.class);
|
||||
InputDestination source = context.getBean(InputDestination.class);
|
||||
OutputDestination target = context.getBean(OutputDestination.class);
|
||||
String jsonPayload = "{\"name\":\"oleg\"}";
|
||||
source.send(new GenericMessage<byte[]>(jsonPayload.getBytes()));
|
||||
Message<byte[]> outputMessage = target.receive();
|
||||
@@ -186,8 +186,8 @@ public class ContentTypeTckTests {
|
||||
ApplicationContext context = new SpringApplicationBuilder(StringToPojoStreamListener.class)
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.jmx.enabled=false");
|
||||
SourceDestination source = context.getBean(SourceDestination.class);
|
||||
TargetDestination target = context.getBean(TargetDestination.class);
|
||||
InputDestination source = context.getBean(InputDestination.class);
|
||||
OutputDestination target = context.getBean(OutputDestination.class);
|
||||
String jsonPayload = "{\"name\":\"oleg\"}";
|
||||
source.send(new GenericMessage<byte[]>(jsonPayload.getBytes(), new MessageHeaders(Collections.singletonMap(MessageHeaders.CONTENT_TYPE, MimeTypeUtils.TEXT_PLAIN))));
|
||||
Message<byte[]> outputMessage = target.receive();
|
||||
@@ -200,8 +200,8 @@ public class ContentTypeTckTests {
|
||||
ApplicationContext context = new SpringApplicationBuilder(ByteArrayToByteArrayStreamListener.class)
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.jmx.enabled=false");
|
||||
SourceDestination source = context.getBean(SourceDestination.class);
|
||||
TargetDestination target = context.getBean(TargetDestination.class);
|
||||
InputDestination source = context.getBean(InputDestination.class);
|
||||
OutputDestination target = context.getBean(OutputDestination.class);
|
||||
String jsonPayload = "{\"name\":\"oleg\"}";
|
||||
source.send(new GenericMessage<byte[]>(jsonPayload.getBytes()));
|
||||
Message<byte[]> outputMessage = target.receive();
|
||||
@@ -214,8 +214,8 @@ public class ContentTypeTckTests {
|
||||
ApplicationContext context = new SpringApplicationBuilder(ByteArrayToByteArrayStreamListener.class)
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.cloud.stream.bindings.input.contentType=text/plain", "--spring.cloud.stream.bindings.output.contentType=text/plain", "--spring.jmx.enabled=false");
|
||||
SourceDestination source = context.getBean(SourceDestination.class);
|
||||
TargetDestination target = context.getBean(TargetDestination.class);
|
||||
InputDestination source = context.getBean(InputDestination.class);
|
||||
OutputDestination target = context.getBean(OutputDestination.class);
|
||||
String jsonPayload = "{\"name\":\"oleg\"}";
|
||||
source.send(new GenericMessage<byte[]>(jsonPayload.getBytes()));
|
||||
Message<byte[]> outputMessage = target.receive();
|
||||
@@ -229,8 +229,8 @@ public class ContentTypeTckTests {
|
||||
ApplicationContext context = new SpringApplicationBuilder(PojoMessageToStringMessageStreamListener.class)
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.jmx.enabled=false");
|
||||
SourceDestination source = context.getBean(SourceDestination.class);
|
||||
TargetDestination target = context.getBean(TargetDestination.class);
|
||||
InputDestination source = context.getBean(InputDestination.class);
|
||||
OutputDestination target = context.getBean(OutputDestination.class);
|
||||
String jsonPayload = "{\"name\":\"oleg\"}";
|
||||
source.send(new GenericMessage<byte[]>(jsonPayload.getBytes()));
|
||||
Message<byte[]> outputMessage = target.receive();
|
||||
@@ -243,8 +243,8 @@ public class ContentTypeTckTests {
|
||||
ApplicationContext context = new SpringApplicationBuilder(PojoMessageToStringMessageServiceActivator.class)
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.jmx.enabled=false");
|
||||
SourceDestination source = context.getBean(SourceDestination.class);
|
||||
TargetDestination target = context.getBean(TargetDestination.class);
|
||||
InputDestination source = context.getBean(InputDestination.class);
|
||||
OutputDestination target = context.getBean(OutputDestination.class);
|
||||
String jsonPayload = "{\"name\":\"oleg\"}";
|
||||
source.send(new GenericMessage<byte[]>(jsonPayload.getBytes()));
|
||||
Message<byte[]> outputMessage = target.receive();
|
||||
@@ -257,8 +257,8 @@ public class ContentTypeTckTests {
|
||||
ApplicationContext context = new SpringApplicationBuilder(ByteArrayMessageToStringJsonMessageStreamListener.class)
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.jmx.enabled=false");
|
||||
SourceDestination source = context.getBean(SourceDestination.class);
|
||||
TargetDestination target = context.getBean(TargetDestination.class);
|
||||
InputDestination source = context.getBean(InputDestination.class);
|
||||
OutputDestination target = context.getBean(OutputDestination.class);
|
||||
String jsonPayload = "{\"name\":\"oleg\"}";
|
||||
source.send(new GenericMessage<byte[]>(jsonPayload.getBytes()));
|
||||
Message<byte[]> outputMessage = target.receive();
|
||||
@@ -271,8 +271,8 @@ public class ContentTypeTckTests {
|
||||
ApplicationContext context = new SpringApplicationBuilder(StringMessageToStringMessageStreamListener.class)
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.jmx.enabled=false");
|
||||
SourceDestination source = context.getBean(SourceDestination.class);
|
||||
TargetDestination target = context.getBean(TargetDestination.class);
|
||||
InputDestination source = context.getBean(InputDestination.class);
|
||||
OutputDestination target = context.getBean(OutputDestination.class);
|
||||
String jsonPayload = "{\"name\":\"oleg\"}";
|
||||
source.send(new GenericMessage<byte[]>(jsonPayload.getBytes()));
|
||||
Message<byte[]> outputMessage = target.receive();
|
||||
@@ -285,8 +285,8 @@ public class ContentTypeTckTests {
|
||||
ApplicationContext context = new SpringApplicationBuilder(PojoToPojoStreamListener.class)
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.cloud.stream.default.contentType=application/x-java-object", "--spring.jmx.enabled=false");
|
||||
SourceDestination source = context.getBean(SourceDestination.class);
|
||||
TargetDestination target = context.getBean(TargetDestination.class);
|
||||
InputDestination source = context.getBean(InputDestination.class);
|
||||
OutputDestination target = context.getBean(OutputDestination.class);
|
||||
|
||||
KryoMessageConverter converter = new KryoMessageConverter(null, true);
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -306,8 +306,8 @@ public class ContentTypeTckTests {
|
||||
ApplicationContext context = new SpringApplicationBuilder(PojoToPojoStreamListener.class)
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.jmx.enabled=false", "--spring.cloud.stream.bindings.output.contentType=application/x-java-object");
|
||||
SourceDestination source = context.getBean(SourceDestination.class);
|
||||
TargetDestination target = context.getBean(TargetDestination.class);
|
||||
InputDestination source = context.getBean(InputDestination.class);
|
||||
OutputDestination target = context.getBean(OutputDestination.class);
|
||||
|
||||
KryoMessageConverter converter = new KryoMessageConverter(null, true);
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -330,8 +330,8 @@ public class ContentTypeTckTests {
|
||||
ApplicationContext context = new SpringApplicationBuilder(StringToStringStreamListener.class, CustomConverters.class)
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.cloud.stream.default.contentType=application/x-java-object", "--spring.jmx.enabled=false");
|
||||
SourceDestination source = context.getBean(SourceDestination.class);
|
||||
TargetDestination target = context.getBean(TargetDestination.class);
|
||||
InputDestination source = context.getBean(InputDestination.class);
|
||||
OutputDestination target = context.getBean(OutputDestination.class);
|
||||
String jsonPayload = "{\"name\":\"oleg\"}";
|
||||
source.send(new GenericMessage<byte[]>(jsonPayload.getBytes()));
|
||||
Message<byte[]> outputMessage = target.receive();
|
||||
@@ -346,8 +346,8 @@ public class ContentTypeTckTests {
|
||||
ApplicationContext context = new SpringApplicationBuilder(StringToStringStreamListener.class, CustomConverters.class)
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.cloud.stream.default.contentType=foo/bar", "--spring.jmx.enabled=false");
|
||||
SourceDestination source = context.getBean(SourceDestination.class);
|
||||
TargetDestination target = context.getBean(TargetDestination.class);
|
||||
InputDestination source = context.getBean(InputDestination.class);
|
||||
OutputDestination target = context.getBean(OutputDestination.class);
|
||||
String jsonPayload = "{\"name\":\"oleg\"}";
|
||||
source.send(new GenericMessage<byte[]>(jsonPayload.getBytes()));
|
||||
Message<byte[]> outputMessage = target.receive();
|
||||
@@ -364,8 +364,8 @@ public class ContentTypeTckTests {
|
||||
ApplicationContext context = new SpringApplicationBuilder(PojoToPojoStreamListener.class)
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.cloud.stream.default.contentType=text/plain", "--spring.jmx.enabled=false");
|
||||
SourceDestination source = context.getBean(SourceDestination.class);
|
||||
SpringIntegrationChannelBinder binder = context.getBean(SpringIntegrationChannelBinder.class);
|
||||
InputDestination source = context.getBean(InputDestination.class);
|
||||
TestChannelBinder binder = context.getBean(TestChannelBinder.class);
|
||||
String jsonPayload = "{\"name\":\"oleg\"}";
|
||||
source.send(new GenericMessage<byte[]>(jsonPayload.getBytes()));
|
||||
assertTrue(binder.getLastError().getPayload() instanceof MessageConversionException);
|
||||
@@ -376,8 +376,8 @@ public class ContentTypeTckTests {
|
||||
ApplicationContext context = new SpringApplicationBuilder(StringToStringStreamListener.class)
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.cloud.stream.default.contentType=foo/bar", "--spring.jmx.enabled=false");
|
||||
SourceDestination source = context.getBean(SourceDestination.class);
|
||||
SpringIntegrationChannelBinder binder = context.getBean(SpringIntegrationChannelBinder.class);
|
||||
InputDestination source = context.getBean(InputDestination.class);
|
||||
TestChannelBinder binder = context.getBean(TestChannelBinder.class);
|
||||
String jsonPayload = "{\"name\":\"oleg\"}";
|
||||
source.send(new GenericMessage<byte[]>(jsonPayload.getBytes()));
|
||||
assertTrue(binder.getLastError().getPayload() instanceof MessageConversionException);
|
||||
@@ -389,8 +389,8 @@ public class ContentTypeTckTests {
|
||||
ApplicationContext context = new SpringApplicationBuilder(CollectionWithParameterizedTypes.class)
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.jmx.enabled=false");
|
||||
SourceDestination source = context.getBean(SourceDestination.class);
|
||||
TargetDestination target = context.getBean(TargetDestination.class);
|
||||
InputDestination source = context.getBean(InputDestination.class);
|
||||
OutputDestination target = context.getBean(OutputDestination.class);
|
||||
String jsonPayload = "[{\"person\":{\"name\":\"jon\"},\"id\":123},{\"person\":{\"name\":\"jane\"},\"id\":456}]";
|
||||
source.send(new GenericMessage<byte[]>(jsonPayload.getBytes()));
|
||||
Message<byte[]> outputMessage = target.receive();
|
||||
@@ -398,7 +398,7 @@ public class ContentTypeTckTests {
|
||||
}
|
||||
|
||||
@EnableBinding(Processor.class)
|
||||
@Import(SpringIntegrationBinderConfiguration.class)
|
||||
@Import(TestChannelBinderConfiguration.class)
|
||||
public static class CollectionWithParameterizedTypes {
|
||||
@StreamListener(Processor.INPUT)
|
||||
@SendTo(Processor.OUTPUT)
|
||||
@@ -409,7 +409,7 @@ public class ContentTypeTckTests {
|
||||
}
|
||||
|
||||
@EnableBinding(Processor.class)
|
||||
@Import(SpringIntegrationBinderConfiguration.class)
|
||||
@Import(TestChannelBinderConfiguration.class)
|
||||
public static class TextInJsonOutListener {
|
||||
@StreamListener(Processor.INPUT)
|
||||
@SendTo(Processor.OUTPUT)
|
||||
@@ -419,7 +419,7 @@ public class ContentTypeTckTests {
|
||||
}
|
||||
|
||||
@EnableBinding(Processor.class)
|
||||
@Import(SpringIntegrationBinderConfiguration.class)
|
||||
@Import(TestChannelBinderConfiguration.class)
|
||||
public static class PojoToPojoStreamListener {
|
||||
@StreamListener(Processor.INPUT)
|
||||
@SendTo(Processor.OUTPUT)
|
||||
@@ -429,7 +429,7 @@ public class ContentTypeTckTests {
|
||||
}
|
||||
|
||||
@EnableBinding(Processor.class)
|
||||
@Import(SpringIntegrationBinderConfiguration.class)
|
||||
@Import(TestChannelBinderConfiguration.class)
|
||||
public static class PojoToStringStreamListener {
|
||||
@StreamListener(Processor.INPUT)
|
||||
@SendTo(Processor.OUTPUT)
|
||||
@@ -439,7 +439,7 @@ public class ContentTypeTckTests {
|
||||
}
|
||||
|
||||
@EnableBinding(Processor.class)
|
||||
@Import(SpringIntegrationBinderConfiguration.class)
|
||||
@Import(TestChannelBinderConfiguration.class)
|
||||
public static class PojoToByteArrayStreamListener {
|
||||
@StreamListener(Processor.INPUT)
|
||||
@SendTo(Processor.OUTPUT)
|
||||
@@ -449,7 +449,7 @@ public class ContentTypeTckTests {
|
||||
}
|
||||
|
||||
@EnableBinding(Processor.class)
|
||||
@Import(SpringIntegrationBinderConfiguration.class)
|
||||
@Import(TestChannelBinderConfiguration.class)
|
||||
public static class ByteArrayToPojoStreamListener {
|
||||
@StreamListener(Processor.INPUT)
|
||||
@SendTo(Processor.OUTPUT)
|
||||
@@ -460,7 +460,7 @@ public class ContentTypeTckTests {
|
||||
}
|
||||
|
||||
@EnableBinding(Processor.class)
|
||||
@Import(SpringIntegrationBinderConfiguration.class)
|
||||
@Import(TestChannelBinderConfiguration.class)
|
||||
public static class StringToPojoStreamListener {
|
||||
@StreamListener(Processor.INPUT)
|
||||
@SendTo(Processor.OUTPUT)
|
||||
@@ -471,7 +471,7 @@ public class ContentTypeTckTests {
|
||||
}
|
||||
|
||||
@EnableBinding(Processor.class)
|
||||
@Import(SpringIntegrationBinderConfiguration.class)
|
||||
@Import(TestChannelBinderConfiguration.class)
|
||||
public static class ByteArrayToByteArrayStreamListener {
|
||||
@StreamListener(Processor.INPUT)
|
||||
@SendTo(Processor.OUTPUT)
|
||||
@@ -481,7 +481,7 @@ public class ContentTypeTckTests {
|
||||
}
|
||||
|
||||
@EnableBinding(Processor.class)
|
||||
@Import(SpringIntegrationBinderConfiguration.class)
|
||||
@Import(TestChannelBinderConfiguration.class)
|
||||
public static class StringToStringStreamListener {
|
||||
@StreamListener(Processor.INPUT)
|
||||
@SendTo(Processor.OUTPUT)
|
||||
@@ -491,7 +491,7 @@ public class ContentTypeTckTests {
|
||||
}
|
||||
|
||||
@EnableBinding(Processor.class)
|
||||
@Import(SpringIntegrationBinderConfiguration.class)
|
||||
@Import(TestChannelBinderConfiguration.class)
|
||||
public static class PojoMessageToStringMessageStreamListener {
|
||||
@StreamListener(Processor.INPUT)
|
||||
@SendTo(Processor.OUTPUT)
|
||||
@@ -501,7 +501,7 @@ public class ContentTypeTckTests {
|
||||
}
|
||||
|
||||
@EnableBinding(Processor.class)
|
||||
@Import(SpringIntegrationBinderConfiguration.class)
|
||||
@Import(TestChannelBinderConfiguration.class)
|
||||
public static class PojoMessageToStringMessageServiceActivator {
|
||||
@ServiceActivator(inputChannel=Processor.INPUT, outputChannel=Processor.OUTPUT)
|
||||
public Message<String> echo(Message<Person> value) {
|
||||
@@ -510,7 +510,7 @@ public class ContentTypeTckTests {
|
||||
}
|
||||
|
||||
@EnableBinding(Processor.class)
|
||||
@Import(SpringIntegrationBinderConfiguration.class)
|
||||
@Import(TestChannelBinderConfiguration.class)
|
||||
public static class StringMessageToStringMessageStreamListener {
|
||||
@ServiceActivator(inputChannel=Processor.INPUT, outputChannel=Processor.OUTPUT)
|
||||
public Message<String> echo(Message<String> value) throws Exception {
|
||||
@@ -521,7 +521,7 @@ public class ContentTypeTckTests {
|
||||
}
|
||||
|
||||
@EnableBinding(Processor.class)
|
||||
@Import(SpringIntegrationBinderConfiguration.class)
|
||||
@Import(TestChannelBinderConfiguration.class)
|
||||
public static class ByteArrayMessageToStringJsonMessageStreamListener {
|
||||
@ServiceActivator(inputChannel=Processor.INPUT, outputChannel=Processor.OUTPUT)
|
||||
public Message<String> echo(Message<byte[]> value) throws Exception {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.stream.binder.integration;
|
||||
package org.springframework.cloud.stream.binder.test;
|
||||
|
||||
import org.springframework.messaging.SubscribableChannel;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.stream.binder.integration;
|
||||
package org.springframework.cloud.stream.binder.test;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.messaging.Message;
|
||||
* @author Oleg Zhurakousky
|
||||
*
|
||||
*/
|
||||
public class SourceDestination extends AbstractDestination {
|
||||
public class InputDestination extends AbstractDestination {
|
||||
|
||||
/**
|
||||
* Allows the {@link Message} to be sent to a Binder to be delegated
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.stream.binder.integration;
|
||||
package org.springframework.cloud.stream.binder.test;
|
||||
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.LinkedTransferQueue;
|
||||
@@ -31,12 +31,12 @@ import org.springframework.messaging.Message;
|
||||
* @author Oleg Zhurakousky
|
||||
*
|
||||
*/
|
||||
public class TargetDestination extends AbstractDestination {
|
||||
public class OutputDestination extends AbstractDestination {
|
||||
|
||||
private BlockingQueue<Message<?>> messages;
|
||||
|
||||
/**
|
||||
* Allows to access {@link Message}s received by this {@link TargetDestination}.
|
||||
* Allows to access {@link Message}s received by this {@link OutputDestination}.
|
||||
* @param timeout how long to wait before giving up
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -51,7 +51,7 @@ public class TargetDestination extends AbstractDestination {
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows to access {@link Message}s received by this {@link TargetDestination}.
|
||||
* Allows to access {@link Message}s received by this {@link OutputDestination}.
|
||||
*/
|
||||
public Message<byte[]> receive() {
|
||||
return this.receive(0);
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.stream.binder.integration;
|
||||
package org.springframework.cloud.stream.binder.test;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
@@ -38,7 +38,7 @@ import org.springframework.messaging.support.GenericMessage;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Sample spring cloud stream application that demonstrates the usage of {@link SpringIntegrationChannelBinder}.
|
||||
* Sample spring cloud stream application that demonstrates the usage of {@link TestChannelBinder}.
|
||||
*
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Gary Russell
|
||||
@@ -46,14 +46,14 @@ import static org.junit.Assert.assertEquals;
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableBinding(SampleStreamApp.PolledConsumer.class)
|
||||
@Import(SpringIntegrationBinderConfiguration.class)
|
||||
@Import(TestChannelBinderConfiguration.class)
|
||||
public class SampleStreamApp {
|
||||
|
||||
public static void main(String[] args) {
|
||||
ApplicationContext context = new SpringApplicationBuilder(SampleStreamApp.class).web(WebApplicationType.NONE)
|
||||
.run("--server.port=0");
|
||||
SourceDestination source = context.getBean(SourceDestination.class);
|
||||
TargetDestination target = context.getBean(TargetDestination.class);
|
||||
InputDestination source = context.getBean(InputDestination.class);
|
||||
OutputDestination target = context.getBean(OutputDestination.class);
|
||||
source.send(new GenericMessage<byte[]>("Hello".getBytes()));
|
||||
|
||||
Message<?> message = target.receive();
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.stream.binder.integration;
|
||||
package org.springframework.cloud.stream.binder.test;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.function.Consumer;
|
||||
@@ -25,8 +25,8 @@ import org.springframework.cloud.stream.binder.AbstractMessageChannelBinder;
|
||||
import org.springframework.cloud.stream.binder.Binder;
|
||||
import org.springframework.cloud.stream.binder.ConsumerProperties;
|
||||
import org.springframework.cloud.stream.binder.ProducerProperties;
|
||||
import org.springframework.cloud.stream.binder.integration.SpringIntegrationProvisioner.SpringIntegrationConsumerDestination;
|
||||
import org.springframework.cloud.stream.binder.integration.SpringIntegrationProvisioner.SpringIntegrationProducerDestination;
|
||||
import org.springframework.cloud.stream.binder.test.TestChannelBinderProvisioner.SpringIntegrationConsumerDestination;
|
||||
import org.springframework.cloud.stream.binder.test.TestChannelBinderProvisioner.SpringIntegrationProducerDestination;
|
||||
import org.springframework.cloud.stream.provisioning.ConsumerDestination;
|
||||
import org.springframework.cloud.stream.provisioning.ProducerDestination;
|
||||
import org.springframework.core.AttributeAccessor;
|
||||
@@ -61,12 +61,12 @@ import org.springframework.util.StringUtils;
|
||||
* <br>
|
||||
* The destination classes are
|
||||
* <ul>
|
||||
* <li>{@link SourceDestination}</li>
|
||||
* <li>{@link TargetDestination}</li>
|
||||
* <li>{@link InputDestination}</li>
|
||||
* <li>{@link OutputDestination}</li>
|
||||
* </ul>
|
||||
* Simply autowire them in your your application and send/receive messages.
|
||||
* </p>
|
||||
* You must also add {@link SpringIntegrationBinderConfiguration} to your configuration.
|
||||
* You must also add {@link TestChannelBinderConfiguration} to your configuration.
|
||||
* Below is the example using Spring Boot test.
|
||||
* <pre class="code">
|
||||
*
|
||||
@@ -101,8 +101,8 @@ import org.springframework.util.StringUtils;
|
||||
* @author Gary Russell
|
||||
*
|
||||
*/
|
||||
public class SpringIntegrationChannelBinder extends AbstractMessageChannelBinder<ConsumerProperties,
|
||||
ProducerProperties, SpringIntegrationProvisioner> {
|
||||
public class TestChannelBinder extends AbstractMessageChannelBinder<ConsumerProperties,
|
||||
ProducerProperties, TestChannelBinderProvisioner> {
|
||||
|
||||
@Autowired
|
||||
private BeanFactory beanFactory;
|
||||
@@ -112,7 +112,7 @@ public class SpringIntegrationChannelBinder extends AbstractMessageChannelBinder
|
||||
private MessageSource<?> messageSourceDelegate = () -> new GenericMessage<>("polled data",
|
||||
Collections.singletonMap(MessageHeaders.CONTENT_TYPE, "text/plain"));
|
||||
|
||||
public SpringIntegrationChannelBinder(SpringIntegrationProvisioner provisioningProvider) {
|
||||
public TestChannelBinder(TestChannelBinderProvisioner provisioningProvider) {
|
||||
super(new String[] {}, provisioningProvider);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.stream.binder.integration;
|
||||
package org.springframework.cloud.stream.binder.test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -39,16 +39,16 @@ import org.springframework.integration.config.EnableIntegration;
|
||||
/**
|
||||
* {@link Binder} configuration backed by Spring Integration.
|
||||
*
|
||||
* Please see {@link SpringIntegrationChannelBinder} for more details.
|
||||
* Please see {@link TestChannelBinder} for more details.
|
||||
*
|
||||
* @author Oleg Zhurakousky
|
||||
*
|
||||
* @see SpringIntegrationChannelBinder
|
||||
* @see TestChannelBinder
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnMissingBean(Binder.class)
|
||||
@EnableIntegration
|
||||
public class SpringIntegrationBinderConfiguration<T> {
|
||||
public class TestChannelBinderConfiguration<T> {
|
||||
|
||||
public static final String NAME = "integration";
|
||||
|
||||
@@ -61,7 +61,7 @@ public class SpringIntegrationBinderConfiguration<T> {
|
||||
*/
|
||||
public static Class<?>[] getCompleteConfiguration(Class<?>... additionalConfigurationClasses) {
|
||||
List<Class<?>> configClasses = new ArrayList<>();
|
||||
configClasses.add(SpringIntegrationBinderConfiguration.class);
|
||||
configClasses.add(TestChannelBinderConfiguration.class);
|
||||
Import annotation = AnnotationUtils.getAnnotation(EnableBinding.class, Import.class);
|
||||
Map<String, Object> annotationAttributes = AnnotationUtils.getAnnotationAttributes(annotation);
|
||||
configClasses.addAll(Arrays.asList((Class<?>[])annotationAttributes.get("value")));
|
||||
@@ -73,30 +73,30 @@ public class SpringIntegrationBinderConfiguration<T> {
|
||||
|
||||
@Bean
|
||||
public BinderTypeRegistry binderTypeRegistry() {
|
||||
BinderType binderType = new BinderType(NAME, new Class[] {SpringIntegrationBinderConfiguration.class});
|
||||
BinderType binderType = new BinderType(NAME, new Class[] {TestChannelBinderConfiguration.class});
|
||||
BinderTypeRegistry btr = new DefaultBinderTypeRegistry(Collections.singletonMap(NAME, binderType));
|
||||
return btr;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SourceDestination sourceDestination() {
|
||||
return new SourceDestination();
|
||||
public InputDestination sourceDestination() {
|
||||
return new InputDestination();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TargetDestination targetDestination() {
|
||||
return new TargetDestination();
|
||||
public OutputDestination targetDestination() {
|
||||
return new OutputDestination();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Bean
|
||||
public Binder<T, ? extends ConsumerProperties, ? extends ProducerProperties> springIntegrationChannelBinder(SpringIntegrationProvisioner provisioner) {
|
||||
return (Binder<T, ? extends ConsumerProperties, ? extends ProducerProperties>) new SpringIntegrationChannelBinder(provisioner);
|
||||
public Binder<T, ? extends ConsumerProperties, ? extends ProducerProperties> springIntegrationChannelBinder(TestChannelBinderProvisioner provisioner) {
|
||||
return (Binder<T, ? extends ConsumerProperties, ? extends ProducerProperties>) new TestChannelBinder(provisioner);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SpringIntegrationProvisioner springIntegrationProvisioner() {
|
||||
return new SpringIntegrationProvisioner();
|
||||
public TestChannelBinderProvisioner springIntegrationProvisioner() {
|
||||
return new TestChannelBinderProvisioner();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.stream.binder.integration;
|
||||
package org.springframework.cloud.stream.binder.test;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -34,7 +34,7 @@ import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.SubscribableChannel;
|
||||
|
||||
/**
|
||||
* {@link ProvisioningProvider} to support {@link SpringIntegrationChannelBinder}. It
|
||||
* {@link ProvisioningProvider} to support {@link TestChannelBinder}. It
|
||||
* exists primarily to support {@link AbstractMessageChannel} semantics for creating
|
||||
* {@link ConsumerDestination} and {@link ProducerDestination}, to interact with this
|
||||
* {@link Binder}.
|
||||
@@ -42,21 +42,21 @@ import org.springframework.messaging.SubscribableChannel;
|
||||
* @author Oleg Zhurakousky
|
||||
*
|
||||
*/
|
||||
public class SpringIntegrationProvisioner implements ProvisioningProvider<ConsumerProperties, ProducerProperties> {
|
||||
public class TestChannelBinderProvisioner implements ProvisioningProvider<ConsumerProperties, ProducerProperties> {
|
||||
|
||||
private final Map<String, SubscribableChannel> provisionedDestinations = new HashMap<>();
|
||||
|
||||
@Autowired
|
||||
private SourceDestination source;
|
||||
private InputDestination source;
|
||||
|
||||
@Autowired
|
||||
private TargetDestination target;
|
||||
private OutputDestination target;
|
||||
|
||||
/**
|
||||
* Will provision producer destination as an SI {@link PublishSubscribeChannel}.
|
||||
* <br>
|
||||
* This provides convenience of registering additional subscriber (handler in the test method)
|
||||
* along side of being able to call {@link TargetDestination#receive()} to get a
|
||||
* along side of being able to call {@link OutputDestination#receive()} to get a
|
||||
* {@link Message} for additional assertions.
|
||||
*/
|
||||
@Override
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides test channel binder and supporting classes
|
||||
*
|
||||
* THe test binder is backed by Spring Integration framework and is not intended
|
||||
* for uses outside of local testing.
|
||||
*
|
||||
* The test binder implementation - {@link org.springframework.cloud.stream.binder.test.TestChannelBinder}
|
||||
* The test binder configuration - {@link org.springframework.cloud.stream.binder.test.TestChannelBinderConfiguration}
|
||||
* The example that shows how to use it - {@link org.springframework.cloud.stream.binder.test.SampleStreamApp}
|
||||
*
|
||||
*/
|
||||
package org.springframework.cloud.stream.binder.test;
|
||||
@@ -22,7 +22,7 @@ import org.junit.Test;
|
||||
|
||||
import org.springframework.boot.WebApplicationType;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.cloud.stream.binder.integration.SpringIntegrationBinderConfiguration;
|
||||
import org.springframework.cloud.stream.binder.test.TestChannelBinderConfiguration;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
@@ -40,7 +40,7 @@ public class BindingServiceConfigurationTests {
|
||||
|
||||
@Test
|
||||
public void valdateImportedConfiguartionHandlerPostProcessing() {
|
||||
ApplicationContext context = new SpringApplicationBuilder(SpringIntegrationBinderConfiguration.getCompleteConfiguration(RootConfiguration.class)).web(WebApplicationType.NONE).run();
|
||||
ApplicationContext context = new SpringApplicationBuilder(TestChannelBinderConfiguration.getCompleteConfiguration(RootConfiguration.class)).web(WebApplicationType.NONE).run();
|
||||
Map<String, AbstractReplyProducingMessageHandler> beansOfType = context.getBeansOfType(AbstractReplyProducingMessageHandler.class);
|
||||
for (AbstractReplyProducingMessageHandler handler : beansOfType.values()) {
|
||||
assertTrue(handler.getNotPropagatedHeaders().contains("contentType"));
|
||||
|
||||
Reference in New Issue
Block a user