diff --git a/bom/spring-cloud-stream-dependencies/pom.xml b/bom/spring-cloud-stream-dependencies/pom.xml
index 6bef901ec..720f60246 100644
--- a/bom/spring-cloud-stream-dependencies/pom.xml
+++ b/bom/spring-cloud-stream-dependencies/pom.xml
@@ -25,11 +25,8 @@
org.springframework.cloud
- spring-cloud-stream
+ spring-cloud-stream-test-binder
${project.version}
- test-jar
- test
- test-binder
org.springframework.cloud
diff --git a/core/pom.xml b/core/pom.xml
index d9c219839..1d2199f83 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -16,7 +16,9 @@
spring-cloud-stream
+ spring-cloud-stream-test-binder
spring-cloud-stream-binder-test
+ spring-cloud-stream-integration-tests
diff --git a/core/spring-cloud-stream-integration-tests/pom.xml b/core/spring-cloud-stream-integration-tests/pom.xml
new file mode 100644
index 000000000..16b0f4df9
--- /dev/null
+++ b/core/spring-cloud-stream-integration-tests/pom.xml
@@ -0,0 +1,90 @@
+
+
+ 4.0.0
+
+ spring-cloud-stream-integration-tests
+ jar
+ spring-cloud-stream-integration-tests
+ Spring Cloud Stream Integration Tests using Test Binder
+
+
+ org.springframework.cloud
+ spring-cloud-stream-core
+ 4.0.0-SNAPSHOT
+
+
+
+ 1.7.20-Beta
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-stream
+
+
+ org.springframework.cloud
+ spring-cloud-stream-test-binder
+ test
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.springframework.integration
+ spring-integration-test
+ test
+
+
+ org.springframework.kafka
+ spring-kafka
+ test
+
+
+ org.jetbrains.kotlin
+ kotlin-test
+ ${kotlin.version}
+ test
+
+
+
+
+
+
+ org.jetbrains.kotlin
+ kotlin-maven-plugin
+ ${kotlin.version}
+
+
+ compile
+ compile
+
+ compile
+
+
+
+ src/main/java
+ src/test/kotlin
+
+
+
+
+ test-compile
+ test-compile
+
+ test-compile
+
+
+
+
+ 1.8
+
+
+
+
+
+
diff --git a/core/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/binder/AbstractMessageChannelBinderTests.java b/core/spring-cloud-stream-integration-tests/src/test/java/org/springframework/cloud/stream/binder/BasicAbstractMessageChannelBinderTests.java
similarity index 84%
rename from core/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/binder/AbstractMessageChannelBinderTests.java
rename to core/spring-cloud-stream-integration-tests/src/test/java/org/springframework/cloud/stream/binder/BasicAbstractMessageChannelBinderTests.java
index 617b8f0eb..658e32e85 100644
--- a/core/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/binder/AbstractMessageChannelBinderTests.java
+++ b/core/spring-cloud-stream-integration-tests/src/test/java/org/springframework/cloud/stream/binder/BasicAbstractMessageChannelBinderTests.java
@@ -19,8 +19,9 @@ package org.springframework.cloud.stream.binder;
import java.util.Iterator;
import java.util.Set;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.boot.WebApplicationType;
@@ -46,42 +47,43 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Oleg Zhurakousky
* @since 1.2.2
*/
-public class AbstractMessageChannelBinderTests {
+@Disabled("This test has issues that needs to be looked into")
+public class BasicAbstractMessageChannelBinderTests {
- private ApplicationContext context;
+ private static ApplicationContext context;
- @Before
- public void prepare() {
- this.context = new SpringApplicationBuilder(
- TestChannelBinderConfiguration.getCompleteConfiguration())
- .web(WebApplicationType.NONE).run();
+ @BeforeAll
+ public static void prepare() {
+ context = new SpringApplicationBuilder(
+ TestChannelBinderConfiguration.getCompleteConfiguration())
+ .web(WebApplicationType.NONE).run();
}
@Test
@SuppressWarnings("unchecked")
public void testEndpointLifecycle() throws Exception {
// @checkstyle:off
- AbstractMessageChannelBinder> binder = this.context
- .getBean(AbstractMessageChannelBinder.class);
+ AbstractMessageChannelBinder> binder = context
+ .getBean(AbstractMessageChannelBinder.class);
// @checkstyle:on
ConsumerProperties consumerProperties = new ConsumerProperties();
consumerProperties.setMaxAttempts(1); // to force error infrastructure creation
Binding consumerBinding = binder.bindConsumer("foo", "fooGroup",
- new DirectChannel(), consumerProperties);
+ new DirectChannel(), consumerProperties);
DirectFieldAccessor consumerBindingAccessor = new DirectFieldAccessor(
- consumerBinding);
+ consumerBinding);
MessageProducer messageProducer = (MessageProducer) consumerBindingAccessor
- .getPropertyValue("lifecycle");
+ .getPropertyValue("lifecycle");
assertThat(((Lifecycle) messageProducer).isRunning()).isTrue();
assertThat(messageProducer.getOutputChannel()).isNotNull();
SubscribableChannel errorChannel = (SubscribableChannel) consumerBindingAccessor
- .getPropertyValue("lifecycle.errorChannel");
+ .getPropertyValue("lifecycle.errorChannel");
assertThat(errorChannel).isNotNull();
Set handlers = TestUtils.getPropertyValue(errorChannel,
- "dispatcher.handlers", Set.class);
+ "dispatcher.handlers", Set.class);
assertThat(handlers.size()).isEqualTo(2);
Iterator iterator = handlers.iterator();
assertThat(iterator.next()).isInstanceOf(BridgeHandler.class);
@@ -101,7 +103,7 @@ public class AbstractMessageChannelBinderTests {
ProducerProperties producerProps = new ProducerProperties();
producerProps.setErrorChannelEnabled(true);
Binding producerBinding = binder.bindProducer("bar",
- new DirectChannel(), producerProps);
+ new DirectChannel(), producerProps);
assertThat(this.context.containsBean("bar.errors")).isTrue();
assertThat(this.context.containsBean("bar.errors.bridge")).isTrue();
producerBinding.unbind();
@@ -114,25 +116,25 @@ public class AbstractMessageChannelBinderTests {
public void testEndpointBinderHasRecoverer() throws Exception {
// @checkstyle:off
ConfigurableApplicationContext context = new SpringApplicationBuilder(
- TestChannelBinderConfiguration.getCompleteConfiguration())
- .web(WebApplicationType.NONE).run();
+ TestChannelBinderConfiguration.getCompleteConfiguration())
+ .web(WebApplicationType.NONE).run();
AbstractMessageChannelBinder> binder = context
- .getBean(AbstractMessageChannelBinder.class);
+ .getBean(AbstractMessageChannelBinder.class);
// @checkstyle:on
Binding consumerBinding = binder.bindConsumer("foo", "fooGroup",
- new DirectChannel(), new ConsumerProperties());
+ new DirectChannel(), new ConsumerProperties());
DirectFieldAccessor consumerBindingAccessor = new DirectFieldAccessor(
- consumerBinding);
+ consumerBinding);
SubscribableChannel errorChannel = (SubscribableChannel) consumerBindingAccessor
- .getPropertyValue("lifecycle.errorChannel");
+ .getPropertyValue("lifecycle.errorChannel");
assertThat(errorChannel).isNull();
errorChannel = (SubscribableChannel) consumerBindingAccessor
- .getPropertyValue("lifecycle.recoveryCallback.channel");
+ .getPropertyValue("lifecycle.recoveryCallback.channel");
assertThat(errorChannel).isNotNull();
Set handlers = TestUtils.getPropertyValue(errorChannel,
- "dispatcher.handlers", Set.class);
+ "dispatcher.handlers", Set.class);
assertThat(handlers.size()).isEqualTo(2);
Iterator iterator = handlers.iterator();
assertThat(iterator.next()).isInstanceOf(BridgeHandler.class);
diff --git a/core/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/binder/BinderErrorChannelTests.java b/core/spring-cloud-stream-integration-tests/src/test/java/org/springframework/cloud/stream/binder/BinderErrorChannelTests.java
similarity index 98%
rename from core/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/binder/BinderErrorChannelTests.java
rename to core/spring-cloud-stream-integration-tests/src/test/java/org/springframework/cloud/stream/binder/BinderErrorChannelTests.java
index becdcdeb4..727b46186 100644
--- a/core/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/binder/BinderErrorChannelTests.java
+++ b/core/spring-cloud-stream-integration-tests/src/test/java/org/springframework/cloud/stream/binder/BinderErrorChannelTests.java
@@ -57,7 +57,7 @@ public class BinderErrorChannelTests {
BinderErrorChannel channel = new BinderErrorChannel();
DirectFieldAccessor fieldAccessor = new DirectFieldAccessor(channel);
AbstractDispatcher dispatcher = (AbstractDispatcher) fieldAccessor
- .getPropertyValue("dispatcher");
+ .getPropertyValue("dispatcher");
assertThat(dispatcher).isNotNull();
assertThat(channel.subscribers()).isEqualTo(0);
diff --git a/core/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/binder/ErrorBindingTests.java b/core/spring-cloud-stream-integration-tests/src/test/java/org/springframework/cloud/stream/binder/ErrorBindingTests.java
similarity index 77%
rename from core/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/binder/ErrorBindingTests.java
rename to core/spring-cloud-stream-integration-tests/src/test/java/org/springframework/cloud/stream/binder/ErrorBindingTests.java
index d8f12e185..d8653982d 100644
--- a/core/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/binder/ErrorBindingTests.java
+++ b/core/spring-cloud-stream-integration-tests/src/test/java/org/springframework/cloud/stream/binder/ErrorBindingTests.java
@@ -41,13 +41,13 @@ public class ErrorBindingTests {
@Test
public void testConfigurationWithDefaultErrorHandler() {
ApplicationContext context = new SpringApplicationBuilder(
- TestChannelBinderConfiguration.getCompleteConfiguration(
- ErrorBindingTests.ErrorConfigurationDefault.class))
- .web(WebApplicationType.NONE)
- .run("--spring.cloud.stream.bindings.handle-in-0.consumer.max-attempts=1",
- "--spring.cloud.function.definition=handle",
- "--spring.cloud.stream.default.error-handler-definition=errorHandler",
- "--spring.jmx.enabled=false");
+ TestChannelBinderConfiguration.getCompleteConfiguration(
+ ErrorBindingTests.ErrorConfigurationDefault.class))
+ .web(WebApplicationType.NONE)
+ .run("--spring.cloud.stream.bindings.handle-in-0.consumer.max-attempts=1",
+ "--spring.cloud.function.definition=handle",
+ "--spring.cloud.stream.default.error-handler-definition=errorHandler",
+ "--spring.jmx.enabled=false");
InputDestination source = context.getBean(InputDestination.class);
source.send(new GenericMessage("Hello".getBytes()));
@@ -55,20 +55,20 @@ public class ErrorBindingTests {
source.send(new GenericMessage("Hello".getBytes()));
ErrorConfigurationDefault errorConfiguration = context
- .getBean(ErrorConfigurationDefault.class);
+ .getBean(ErrorConfigurationDefault.class);
assertThat(errorConfiguration.counter).isEqualTo(6);
}
@Test
void testConfigurationWithBindingSpecificErrorHandler() {
ApplicationContext context = new SpringApplicationBuilder(
- TestChannelBinderConfiguration.getCompleteConfiguration(
- ErrorBindingTests.ErrorConfigurationWithCustomErrorHandler.class))
- .web(WebApplicationType.NONE)
- .run("--spring.cloud.stream.bindings.handle-in-0.consumer.max-attempts=1",
- "--spring.cloud.function.definition=handle",
- "--spring.cloud.stream.bindings.handle-in-0.error-handler-definition=errorHandler",
- "--spring.jmx.enabled=false");
+ TestChannelBinderConfiguration.getCompleteConfiguration(
+ ErrorBindingTests.ErrorConfigurationWithCustomErrorHandler.class))
+ .web(WebApplicationType.NONE)
+ .run("--spring.cloud.stream.bindings.handle-in-0.consumer.max-attempts=1",
+ "--spring.cloud.function.definition=handle",
+ "--spring.cloud.stream.bindings.handle-in-0.error-handler-definition=errorHandler",
+ "--spring.jmx.enabled=false");
InputDestination source = context.getBean(InputDestination.class);
source.send(new GenericMessage("Hello".getBytes()));
@@ -76,7 +76,7 @@ public class ErrorBindingTests {
source.send(new GenericMessage("Hello".getBytes()));
ErrorConfigurationWithCustomErrorHandler errorConfiguration = context
- .getBean(ErrorConfigurationWithCustomErrorHandler.class);
+ .getBean(ErrorConfigurationWithCustomErrorHandler.class);
assertThat(errorConfiguration.counter).isEqualTo(6);
}
diff --git a/core/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/binder/PollableConsumerTests.java b/core/spring-cloud-stream-integration-tests/src/test/java/org/springframework/cloud/stream/binder/PollableConsumerTests.java
similarity index 86%
rename from core/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/binder/PollableConsumerTests.java
rename to core/spring-cloud-stream-integration-tests/src/test/java/org/springframework/cloud/stream/binder/PollableConsumerTests.java
index 5a469fb2d..2f08fabf5 100644
--- a/core/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/binder/PollableConsumerTests.java
+++ b/core/spring-cloud-stream-integration-tests/src/test/java/org/springframework/cloud/stream/binder/PollableConsumerTests.java
@@ -77,20 +77,20 @@ public class PollableConsumerTests {
@BeforeAll
public void before() {
this.messageConverter = new CompositeMessageConverterFactory()
- .getMessageConverterForAllRegistered();
+ .getMessageConverterForAllRegistered();
}
@Test
void testDefaultMessageSource() {
TestChannelBinder binder = createBinder();
MessageConverterConfigurer configurer = this.context
- .getBean(MessageConverterConfigurer.class);
+ .getBean(MessageConverterConfigurer.class);
DefaultPollableMessageSource pollableSource = new DefaultPollableMessageSource(
- this.messageConverter);
+ this.messageConverter);
configurer.configurePolledMessageSource(pollableSource, "foo");
ExtendedConsumerProperties
-
org.springframework.integration
spring-integration-http
@@ -80,43 +79,15 @@
spring-boot-starter-web
test
-
- org.springframework.kafka
- spring-kafka
- test
-
org.jetbrains.kotlin
kotlin-stdlib-jdk8
${kotlin.version}
-
- org.jetbrains.kotlin
- kotlin-test
- ${kotlin.version}
- test
-
-
- org.apache.maven.plugins
- maven-jar-plugin
-
-
-
-
- **/test/*
-
- test-binder
-
-
- test-jar
-
-
-
-
org.jetbrains.kotlin
kotlin-maven-plugin
@@ -147,26 +118,6 @@
1.8
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
-
- compile
- compile
-
- compile
-
-
-
- testCompile
- test-compile
-
- testCompile
-
-
-
-
diff --git a/core/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/binder/test/package-info.java b/core/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/binder/test/package-info.java
deleted file mode 100644
index 763c01707..000000000
--- a/core/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/binder/test/package-info.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2017-2019 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
- *
- * https://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;
diff --git a/core/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/function/FunctionBatchingTests.java b/core/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/function/FunctionBatchingTests.java
deleted file mode 100644
index c83ec89d1..000000000
--- a/core/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/function/FunctionBatchingTests.java
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
- * Copyright 2019-2022 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
- *
- * https://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.
- */
-
-package org.springframework.cloud.stream.function;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.function.Function;
-
-import org.assertj.core.util.Arrays;
-import org.junit.jupiter.api.Test;
-
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.cloud.stream.binder.test.InputDestination;
-import org.springframework.cloud.stream.binder.test.OutputDestination;
-import org.springframework.cloud.stream.binder.test.TestChannelBinderConfiguration;
-import org.springframework.context.annotation.Bean;
-import org.springframework.integration.support.MessageBuilder;
-import org.springframework.kafka.support.KafkaNull;
-import org.springframework.messaging.Message;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- *
- * @author Gary Russel
- * @author Oleg Zhurakousky
- * @author David Turanski
- *
- * @since 3.0
- */
-public class FunctionBatchingTests {
-
- @Test
- void testMessageBatchConfigurationWithKafkaNull() {
- TestChannelBinderConfiguration.applicationContextRunner(MessageBatchConfiguration.class)
- .withPropertyValues("spring.jmx.enabled=false",
- "spring.cloud.stream.function.definition=func",
- "spring.cloud.stream.bindings.input.consumer.batch-mode=true")
- .run(context -> {
- InputDestination inputDestination = context.getBean(InputDestination.class);
- OutputDestination outputDestination = context
- .getBean(OutputDestination.class);
-
- List list = new ArrayList<>();
- list.add("{\"name\":\"bob\"}".getBytes());
- list.add("{\"name\":\"jill\"}".getBytes());
- list.add(KafkaNull.INSTANCE);
- list.add("{\"name\":\"steve\"}".getBytes());
- Message> inputMessage = MessageBuilder
- .withPayload(list)
- .build();
- inputDestination.send(inputMessage);
-
- Message outputMessage = outputDestination.receive();
- assertThat(outputMessage).isNotNull();
- assertThat(outputMessage.getPayload())
- .isEqualTo("{\"name\":\"bob\"}".getBytes());
-
- context.stop();
- });
- }
-
- @Test
- void testListPayloadConfiguration() {
- TestChannelBinderConfiguration.applicationContextRunner(ListPayloadNotBatchConfiguration.class)
- .withPropertyValues("spring.jmx.enabled=false",
- "spring.cloud.stream.function.definition=func")
- .run(context -> {
- InputDestination inputDestination = context.getBean(InputDestination.class);
- OutputDestination outputDestination = context
- .getBean(OutputDestination.class);
-
- Message inputMessage = MessageBuilder
- .withPayload("[{\"name\":\"bob\"},{\"name\":\"jill\"}]".getBytes())
- .build();
- inputDestination.send(inputMessage);
-
- Message outputMessage = outputDestination.receive();
- assertThat(outputMessage).isNotNull();
- assertThat(outputMessage.getPayload())
- .isEqualTo("{\"name\":\"bob\"}".getBytes());
-
- context.stop();
- });
- }
-
- @Test
- void testListStringPayloadConfigurationTextPlain() {
- TestChannelBinderConfiguration.applicationContextRunner(ListStringPayloadConfiguration.class)
- .withPropertyValues("spring.jmx.enabled=false",
- "spring.cloud.stream.function.definition=func",
- "spring.cloud.stream.bindings.func-in-0.content-type=text/plain")
- .run(context -> {
- InputDestination inputDestination = context.getBean(InputDestination.class);
- OutputDestination outputDestination = context
- .getBean(OutputDestination.class);
-
- List bytes = Arrays.asList(new Object[] {"abc".getBytes(), "xyz".getBytes()});
- Message inputMessage = MessageBuilder.withPayload(bytes).build();
- inputDestination.send(inputMessage);
-
- Message outputMessage = outputDestination.receive();
- assertThat(new String(outputMessage.getPayload())).isEqualTo("[abc, xyz]");
- context.stop();
- });
- }
-
- @Test
- void testListObjectPayloadObjectConfigurationTextPlain() {
- TestChannelBinderConfiguration.applicationContextRunner(ListObjectPayloadConfiguration.class)
- .withPropertyValues("spring.jmx.enabled=false",
- "spring.cloud.stream.function.definition=func",
- "spring.cloud.stream.bindings.func-in-0.content-type=text/plain")
- .run(context -> {
- InputDestination inputDestination = context.getBean(InputDestination.class);
- OutputDestination outputDestination = context
- .getBean(OutputDestination.class);
-
- List bytes = Arrays.asList(new Object[] {"abc".getBytes(), "xyz".getBytes()});
- Message inputMessage = MessageBuilder.withPayload(bytes).build();
- inputDestination.send(inputMessage);
-
- Message outputMessage = outputDestination.receive();
- assertThat(new String(outputMessage.getPayload())).isEqualTo("[abc, xyz]");
- context.stop();
- });
- }
-
- @Test
- void testSimpleBatchConfiguration() {
- TestChannelBinderConfiguration.applicationContextRunner(SimpleBatchConfiguration.class)
- .withPropertyValues(
- "spring.jmx.enabled=false",
- "spring.cloud.stream.function.definition=func",
- "spring.cloud.stream.bindings.input.consumer.batch-mode=true")
- .run(context -> {
- InputDestination inputDestination = context.getBean(InputDestination.class);
- OutputDestination outputDestination = context
- .getBean(OutputDestination.class);
-
- List list = new ArrayList<>();
- list.add("{\"name\":\"bob\"}".getBytes());
- list.add("{\"name\":\"jill\"}".getBytes());
- Message> inputMessage = MessageBuilder
- .withPayload(list)
- .build();
- inputDestination.send(inputMessage);
-
- Message outputMessage = outputDestination.receive();
- assertThat(outputMessage).isNotNull();
- assertThat(outputMessage.getPayload())
- .isEqualTo("{\"name\":\"bob\"}".getBytes());
- context.stop();
- });
- }
-
- @Test
- void testNestedBatchConfiguration() {
- TestChannelBinderConfiguration.applicationContextRunner(NestedBatchConfiguration.class)
- .withPropertyValues("spring.jmx.enabled=false",
- "spring.cloud.stream.function.definition=func",
- "spring.cloud.stream.bindings.input.consumer.batch-mode=true")
- .run(context -> {
- InputDestination inputDestination = context.getBean(InputDestination.class);
- OutputDestination outputDestination = context
- .getBean(OutputDestination.class);
-
- List list = new ArrayList<>();
- list.add("[{\"name\":\"bob\"},{\"name\":\"jill\"}]".getBytes());
- Message> inputMessage = MessageBuilder
- .withPayload(list)
- .build();
- inputDestination.send(inputMessage);
-
- Message outputMessage = outputDestination.receive();
- assertThat(outputMessage).isNotNull();
- assertThat(outputMessage.getPayload())
- .isEqualTo("{\"name\":\"bob\"}".getBytes());
- context.stop();
- });
- }
-
- @EnableAutoConfiguration
- public static class SimpleBatchConfiguration {
-
- @Bean
- public Function, Person> func() {
- return x -> x.get(0);
- }
-
- public static class Person {
-
- private String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- }
-
- }
-
- @EnableAutoConfiguration
- public static class ListStringPayloadConfiguration {
- @Bean
- public Function, String> func() {
- return x -> x.toString();
- }
- }
-
- @EnableAutoConfiguration
- public static class ListObjectPayloadConfiguration {
- @Bean
- public Function, String> func() {
- return x -> x.toString();
- }
- }
-
- @EnableAutoConfiguration
- public static class ListPayloadNotBatchConfiguration {
-
- @Bean
- public Function, Person> func() {
- return x -> x.get(0);
- }
-
- public static class Person {
-
- private String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
- }
- }
-
- @EnableAutoConfiguration
- public static class NestedBatchConfiguration {
-
- @Bean
- public Function>, Person> func() {
- return x -> x.get(0).get(0);
- }
-
- public static class Person {
-
- private String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- }
-
- }
-
- @EnableAutoConfiguration
- public static class MessageBatchConfiguration {
-
- @Bean
- public Function>, Person> func() {
- return x -> {
- Object o = x.getPayload().get(2);
- assertThat(o).isNull();
- return (Person) x.getPayload().get(0);
- };
- }
-
- public static class Person {
-
- private String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- }
-
- }
-
-}
diff --git a/core/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/utils/MockBinderConfiguration.java b/core/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/utils/MockBinderConfiguration.java
index b642052d4..b013f2302 100644
--- a/core/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/utils/MockBinderConfiguration.java
+++ b/core/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/utils/MockBinderConfiguration.java
@@ -31,7 +31,7 @@ public class MockBinderConfiguration {
@Bean
public Binder, ?, ?> binder() {
return Mockito.mock(Binder.class,
- Mockito.withSettings().defaultAnswer(Mockito.RETURNS_MOCKS));
+ Mockito.withSettings().defaultAnswer(Mockito.RETURNS_MOCKS));
}
}
diff --git a/pom.xml b/pom.xml
index 983452374..7aa031012 100644
--- a/pom.xml
+++ b/pom.xml
@@ -58,7 +58,6 @@
jackson-databind
2.13.4.1
-
org.springframework.cloud
spring-cloud-function-context
@@ -87,17 +86,9 @@
${objenesis.version}
- com.fasterxml.jackson.core
- jackson-core
- 2.13.4
-
-
- org.springframework.cloud
- spring-cloud-stream
- ${project.version}
- test-jar
- test
- test-binder
+ com.fasterxml.jackson.core
+ jackson-core
+ 2.13.4
diff --git a/schema-registry/spring-cloud-stream-schema-registry-client/pom.xml b/schema-registry/spring-cloud-stream-schema-registry-client/pom.xml
index 1b7452eb3..29134a4d7 100644
--- a/schema-registry/spring-cloud-stream-schema-registry-client/pom.xml
+++ b/schema-registry/spring-cloud-stream-schema-registry-client/pom.xml
@@ -47,11 +47,8 @@
org.springframework.cloud
- spring-cloud-stream
- ${project.version}
- test-jar
+ spring-cloud-stream-test-binder
test
- test-binder
org.springframework.cloud