Add code formatting guidelines
Add 'eclipse' folder containing Eclipse code formatter configuration and instructions how to use it. Update rule for join_wrapped_lines - Set to `false` Resolves #930 Update README Address review comments
This commit is contained in:
committed by
Marius Bogoevici
parent
9632546f03
commit
bd002e4aaf
@@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Ilayaperumal Gopinathan
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringBootTest(classes = {ContentTypeOutboundSourceTests.TestSource.class})
|
||||
@SpringBootTest(classes = { ContentTypeOutboundSourceTests.TestSource.class })
|
||||
public class ContentTypeOutboundSourceTests {
|
||||
|
||||
@Autowired
|
||||
@@ -54,8 +54,9 @@ public class ContentTypeOutboundSourceTests {
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testMessageHeaderWhenNoExplicitContentTypeOnMessage() throws Exception {
|
||||
testSource.output().send(MessageBuilder.withPayload("{\"message\":\"Hi\"}").build());
|
||||
Message<String> received = (Message<String>) ((TestSupportBinder) binderFactory.getBinder(null, MessageChannel.class))
|
||||
.messageCollector().forChannel(testSource.output()).poll();
|
||||
Message<String> received = (Message<String>) ((TestSupportBinder) binderFactory.getBinder(null,
|
||||
MessageChannel.class))
|
||||
.messageCollector().forChannel(testSource.output()).poll();
|
||||
assertThat(received.getHeaders().get(MessageHeaders.CONTENT_TYPE).toString()).isEqualTo("application/json");
|
||||
assertThat(received).hasFieldOrPropertyWithValue("payload", "{\"message\":\"Hi\"}");
|
||||
}
|
||||
@@ -67,4 +68,3 @@ public class ContentTypeOutboundSourceTests {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -71,8 +71,9 @@ public class CustomMessageConverterTests {
|
||||
BarConverter.class, DefaultDatatypeChannelMessageConverter.class);
|
||||
testSource.output().send(MessageBuilder.withPayload(new Foo("hi")).build());
|
||||
@SuppressWarnings("unchecked")
|
||||
Message<String> received = (Message<String>) ((TestSupportBinder) binderFactory.getBinder(null, MessageChannel.class))
|
||||
.messageCollector().forChannel(testSource.output()).poll(1, TimeUnit.SECONDS);
|
||||
Message<String> received = (Message<String>) ((TestSupportBinder) binderFactory.getBinder(null,
|
||||
MessageChannel.class))
|
||||
.messageCollector().forChannel(testSource.output()).poll(1, TimeUnit.SECONDS);
|
||||
Assert.assertThat(received, notNullValue());
|
||||
assertThat(received.getHeaders().get(MessageHeaders.CONTENT_TYPE)).isEqualTo(MimeType.valueOf("test/foo"));
|
||||
}
|
||||
@@ -128,7 +129,6 @@ public class CustomMessageConverterTests {
|
||||
super(MimeType.valueOf("test/bar"));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected boolean supports(Class<?> clazz) {
|
||||
return clazz.equals(Bar.class);
|
||||
|
||||
@@ -58,7 +58,8 @@ public class DeserializeJSONToJavaTypeTests {
|
||||
|
||||
@Test
|
||||
public void testMessageDeserialized() throws Exception {
|
||||
testProcessor.input().send(MessageBuilder.withPayload("{\"name\":\"Bar\"}").setHeader("contentType", "application/json").build());
|
||||
testProcessor.input().send(
|
||||
MessageBuilder.withPayload("{\"name\":\"Bar\"}").setHeader("contentType", "application/json").build());
|
||||
@SuppressWarnings("unchecked")
|
||||
Message<?> received = ((TestSupportBinder) binderFactory.getBinder(null, MessageChannel.class))
|
||||
.messageCollector().forChannel(testProcessor.output()).poll(1, TimeUnit.SECONDS);
|
||||
|
||||
@@ -56,7 +56,8 @@ public class ErrorChannelTests {
|
||||
|
||||
@Test
|
||||
public void testErrorChannelBinding() throws Exception {
|
||||
Message<?> message = ((TestSupportBinder) binderFactory.getBinder(null, MessageChannel.class)).messageCollector().forChannel(errorChannel).poll(10, TimeUnit.SECONDS);
|
||||
Message<?> message = ((TestSupportBinder) binderFactory.getBinder(null, MessageChannel.class))
|
||||
.messageCollector().forChannel(errorChannel).poll(10, TimeUnit.SECONDS);
|
||||
Assert.isTrue(message instanceof ErrorMessage, "Message should be an instance of ErrorMessage");
|
||||
Assert.isTrue(message.getPayload() instanceof MessagingException, "Message payload should be an instance" +
|
||||
"of MessagingException");
|
||||
@@ -81,4 +82,3 @@ public class ErrorChannelTests {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,10 +61,9 @@ public class InboundJsonToTupleConversionTest {
|
||||
Message<?> received = ((TestSupportBinder) binderFactory.getBinder(null, MessageChannel.class))
|
||||
.messageCollector().forChannel(testProcessor.output()).poll(1, TimeUnit.SECONDS);
|
||||
assertThat(received).isNotNull();
|
||||
assertThat(received.getPayload()).isEqualTo(TupleBuilder.tuple().of("name","foo"));
|
||||
assertThat(received.getPayload()).isEqualTo(TupleBuilder.tuple().of("name", "foo"));
|
||||
}
|
||||
|
||||
|
||||
@EnableBinding(Processor.class)
|
||||
@EnableAutoConfiguration
|
||||
@PropertySource("classpath:/org/springframework/cloud/stream/config/inboundjsontuple/inbound-json-tuple.properties")
|
||||
|
||||
@@ -21,7 +21,6 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@@ -54,7 +53,8 @@ import static org.junit.Assert.assertNull;
|
||||
* @author Gary Russell
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringBootTest(classes = {MessageChannelConfigurerTests.TestSink.class, MessageChannelConfigurerTests.TestSource.class})
|
||||
@SpringBootTest(classes = { MessageChannelConfigurerTests.TestSink.class,
|
||||
MessageChannelConfigurerTests.TestSource.class })
|
||||
public class MessageChannelConfigurerTests {
|
||||
|
||||
@Autowired
|
||||
@@ -92,12 +92,13 @@ public class MessageChannelConfigurerTests {
|
||||
|
||||
@Test
|
||||
public void testObjectMapperConfig() throws Exception {
|
||||
CompositeMessageConverter converters = (CompositeMessageConverter) messageConverterFactory.getMessageConverterForType(MimeTypeUtils
|
||||
.APPLICATION_JSON);
|
||||
CompositeMessageConverter converters = (CompositeMessageConverter) messageConverterFactory
|
||||
.getMessageConverterForType(MimeTypeUtils.APPLICATION_JSON);
|
||||
for (MessageConverter converter : converters.getConverters()) {
|
||||
DirectFieldAccessor converterAccessor = new DirectFieldAccessor(converter);
|
||||
ObjectMapper objectMapper = (ObjectMapper) converterAccessor.getPropertyValue("objectMapper");
|
||||
// assert that the ObjectMapper used by the converters is compliant with the Boot configuration
|
||||
// assert that the ObjectMapper used by the converters is compliant with the
|
||||
// Boot configuration
|
||||
assertThat(!objectMapper.getSerializationConfig().isEnabled(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS))
|
||||
.withFailMessage("SerializationFeature 'WRITE_DATES_AS_TIMESTAMPS' should be disabled");
|
||||
// assert that the globally set bean is used by the converters
|
||||
|
||||
@@ -61,7 +61,8 @@ public class StreamListenerAnnotatedMethodArgumentsTests {
|
||||
sink.input().send(MessageBuilder.withPayload("{\"foo\":\"barbar" + id + "\"}")
|
||||
.setHeader("contentType", "application/json").setHeader("testHeader", "testValue").build());
|
||||
assertThat(testPojoWithAnnotatedArguments.receivedArguments).hasSize(3);
|
||||
assertThat(testPojoWithAnnotatedArguments.receivedArguments.get(0)).isInstanceOf(StreamListenerTestUtils.FooPojo.class);
|
||||
assertThat(testPojoWithAnnotatedArguments.receivedArguments.get(0))
|
||||
.isInstanceOf(StreamListenerTestUtils.FooPojo.class);
|
||||
assertThat(testPojoWithAnnotatedArguments.receivedArguments.get(0)).hasFieldOrPropertyWithValue("foo",
|
||||
"barbar" + id);
|
||||
assertThat(testPojoWithAnnotatedArguments.receivedArguments.get(1)).isInstanceOf(Map.class);
|
||||
@@ -77,7 +78,7 @@ public class StreamListenerAnnotatedMethodArgumentsTests {
|
||||
public void testInputAnnotationAtMethodParameter() throws Exception {
|
||||
try {
|
||||
SpringApplication.run(TestPojoWithInvalidInputAnnotatedArgument.class, "--server.port=0");
|
||||
fail("Exception expected: "+ INVALID_DECLARATIVE_METHOD_PARAMETERS);
|
||||
fail("Exception expected: " + INVALID_DECLARATIVE_METHOD_PARAMETERS);
|
||||
}
|
||||
catch (BeanCreationException e) {
|
||||
assertThat(e.getCause().getMessage()).contains(INVALID_DECLARATIVE_METHOD_PARAMETERS);
|
||||
|
||||
@@ -73,11 +73,6 @@ public class StreamListenerAnnotationBeanPostProcessorOverrideTest {
|
||||
public static class TestPojoWithAnnotatedArguments {
|
||||
|
||||
List<StreamListenerTestUtils.FooPojo> receivedFoo = new ArrayList<>();
|
||||
|
||||
@StreamListener(value = Sink.INPUT, condition = "foo")
|
||||
public void receive(@Payload StreamListenerTestUtils.FooPojo fooPojo) {
|
||||
this.receivedFoo.add(fooPojo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the default {@link StreamListenerAnnotationBeanPostProcessor}.
|
||||
@@ -86,12 +81,19 @@ public class StreamListenerAnnotationBeanPostProcessorOverrideTest {
|
||||
public static BeanPostProcessor streamListenerAnnotationBeanPostProcessor() {
|
||||
return new StreamListenerAnnotationBeanPostProcessor() {
|
||||
@Override
|
||||
protected StreamListener postProcessAnnotation(StreamListener originalAnnotation, Method annotatedMethod) {
|
||||
Map<String,Object> attributes = new HashMap<>(AnnotationUtils.getAnnotationAttributes(originalAnnotation));
|
||||
protected StreamListener postProcessAnnotation(StreamListener originalAnnotation,
|
||||
Method annotatedMethod) {
|
||||
Map<String, Object> attributes = new HashMap<>(
|
||||
AnnotationUtils.getAnnotationAttributes(originalAnnotation));
|
||||
attributes.put("condition", "headers['type']=='" + originalAnnotation.condition() + "'");
|
||||
return AnnotationUtils.synthesizeAnnotation(attributes, StreamListener.class, annotatedMethod);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@StreamListener(value = Sink.INPUT, condition = "foo")
|
||||
public void receive(@Payload StreamListenerTestUtils.FooPojo fooPojo) {
|
||||
this.receivedFoo.add(fooPojo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,11 +40,40 @@ import org.springframework.messaging.handler.annotation.Payload;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@MessageMapping
|
||||
@Documented
|
||||
@StreamListener
|
||||
@interface EventHandler {
|
||||
/**
|
||||
* The name of the binding target (e.g. channel) that the method subscribes to.
|
||||
* @return the name of the binding target.
|
||||
*/
|
||||
@AliasFor(annotation = StreamListener.class, attribute = "target")
|
||||
String value() default "";
|
||||
|
||||
/**
|
||||
* The name of the binding target (e.g. channel) that the method subscribes to.
|
||||
* @return the name of the binding target.
|
||||
*/
|
||||
@AliasFor(annotation = StreamListener.class, attribute = "target")
|
||||
String target() default "";
|
||||
|
||||
/**
|
||||
* A condition that must be met by all items that are dispatched to this method.
|
||||
* @return a SpEL expression that must evaluate to a {@code boolean} value.
|
||||
*/
|
||||
@AliasFor(annotation = StreamListener.class, attribute = "condition")
|
||||
String condition() default "";
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author David Turanski
|
||||
*/
|
||||
public class StreamListenerAsMetaAnnotationTests {
|
||||
|
||||
|
||||
@Test
|
||||
public void testCustomAnnotation() {
|
||||
ConfigurableApplicationContext context = SpringApplication.run(TestPojoWithCustomAnnotatedArguments.class,
|
||||
@@ -62,7 +91,7 @@ public class StreamListenerAsMetaAnnotationTests {
|
||||
"barbar" + id);
|
||||
context.close();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testAnnotation() {
|
||||
ConfigurableApplicationContext context = SpringApplication.run(TestPojoWithAnnotatedArguments.class,
|
||||
@@ -80,7 +109,7 @@ public class StreamListenerAsMetaAnnotationTests {
|
||||
"barbar" + id);
|
||||
context.close();
|
||||
}
|
||||
|
||||
|
||||
@EnableBinding(Sink.class)
|
||||
@EnableAutoConfiguration
|
||||
public static class TestPojoWithCustomAnnotatedArguments {
|
||||
@@ -94,7 +123,7 @@ public class StreamListenerAsMetaAnnotationTests {
|
||||
this.receivedFoo.add(fooPojo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EnableBinding(Sink.class)
|
||||
@EnableAutoConfiguration
|
||||
public static class TestPojoWithAnnotatedArguments {
|
||||
@@ -109,32 +138,3 @@ public class StreamListenerAsMetaAnnotationTests {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@MessageMapping
|
||||
@Documented
|
||||
@StreamListener
|
||||
@interface EventHandler {
|
||||
/**
|
||||
* The name of the binding target (e.g. channel) that the method subscribes to.
|
||||
* @return the name of the binding target.
|
||||
*/
|
||||
@AliasFor(annotation=StreamListener.class, attribute="target")
|
||||
String value() default "";
|
||||
|
||||
/**
|
||||
* The name of the binding target (e.g. channel) that the method subscribes to.
|
||||
* @return the name of the binding target.
|
||||
*/
|
||||
@AliasFor(annotation=StreamListener.class, attribute="target")
|
||||
String target() default "";
|
||||
|
||||
/**
|
||||
* A condition that must be met by all items that are dispatched to this method.
|
||||
* @return a SpEL expression that must evaluate to a {@code boolean} value.
|
||||
*/
|
||||
@AliasFor(annotation=StreamListener.class, attribute="condition")
|
||||
String condition() default "";
|
||||
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ public class StreamListenerContentTypeConversionTests {
|
||||
public static class TestSinkWithContentTypeConversion {
|
||||
|
||||
List<StreamListenerTestUtils.FooPojo> receivedArguments = new ArrayList<>();
|
||||
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
@StreamListener(Sink.INPUT)
|
||||
|
||||
@@ -64,8 +64,8 @@ public class StreamListenerDuplicateMappingTests {
|
||||
context = SpringApplication.run(TestDuplicateMappingFromAbstractMethod.class, "--server.port=0");
|
||||
}
|
||||
catch (BeanCreationException e) {
|
||||
String errorMessage = e.getCause().getMessage().startsWith("Duplicate @StreamListener mapping") ?
|
||||
"Duplicate mapping exception is not expected" : "Test failed with exception";
|
||||
String errorMessage = e.getCause().getMessage().startsWith("Duplicate @StreamListener mapping")
|
||||
? "Duplicate mapping exception is not expected" : "Test failed with exception";
|
||||
fail(errorMessage + ": " + e.getMessage());
|
||||
}
|
||||
finally {
|
||||
@@ -75,6 +75,14 @@ public class StreamListenerDuplicateMappingTests {
|
||||
}
|
||||
}
|
||||
|
||||
public interface GenericSink<T extends Base> {
|
||||
void testMethod(T msg);
|
||||
}
|
||||
|
||||
public interface Base {
|
||||
|
||||
}
|
||||
|
||||
@EnableBinding(Processor.class)
|
||||
@EnableAutoConfiguration
|
||||
public static class TestMultipleMappingsWithReturnValue {
|
||||
@@ -102,14 +110,6 @@ public class StreamListenerDuplicateMappingTests {
|
||||
}
|
||||
}
|
||||
|
||||
public interface GenericSink<T extends Base> {
|
||||
void testMethod(T msg);
|
||||
}
|
||||
|
||||
public interface Base {
|
||||
|
||||
}
|
||||
|
||||
public class TestBase implements Base {
|
||||
|
||||
}
|
||||
|
||||
@@ -79,7 +79,8 @@ public class StreamListenerHandlerMethodTests {
|
||||
|
||||
@Test
|
||||
public void testMethodWithObjectAsMethodArgument() throws Exception {
|
||||
ConfigurableApplicationContext context = SpringApplication.run(TestMethodWithObjectAsMethodArgument.class, "--server.port=0");
|
||||
ConfigurableApplicationContext context = SpringApplication.run(TestMethodWithObjectAsMethodArgument.class,
|
||||
"--server.port=0");
|
||||
Processor processor = context.getBean(Processor.class);
|
||||
String id = UUID.randomUUID().toString();
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
@@ -94,11 +95,13 @@ public class StreamListenerHandlerMethodTests {
|
||||
|
||||
@Test
|
||||
public void testStreamListenerMethodWithTargetBeanFromOutside() throws Exception {
|
||||
ConfigurableApplicationContext context = SpringApplication.run(TestStreamListenerMethodWithTargetBeanFromOutside.class, "--server.port=0");
|
||||
ConfigurableApplicationContext context = SpringApplication
|
||||
.run(TestStreamListenerMethodWithTargetBeanFromOutside.class, "--server.port=0");
|
||||
Sink sink = context.getBean(Sink.class);
|
||||
final String testMessageToSend = "testing";
|
||||
sink.input().send(MessageBuilder.withPayload(testMessageToSend).build());
|
||||
DirectChannel directChannel = (DirectChannel) context.getBean(testMessageToSend.toUpperCase(), MessageChannel.class);
|
||||
DirectChannel directChannel = (DirectChannel) context.getBean(testMessageToSend.toUpperCase(),
|
||||
MessageChannel.class);
|
||||
MessageCollector messageCollector = context.getBean(MessageCollector.class);
|
||||
Message<?> result = messageCollector.forChannel(directChannel).poll(1000, TimeUnit.MILLISECONDS);
|
||||
sink.input().send(MessageBuilder.withPayload(testMessageToSend).build());
|
||||
@@ -159,7 +162,8 @@ public class StreamListenerHandlerMethodTests {
|
||||
}
|
||||
catch (BeanCreationException e) {
|
||||
assertThat(e.getCause()).isInstanceOf(IllegalArgumentException.class);
|
||||
assertThat(e.getCause()).hasMessageContaining(StreamListenerErrorMessages.INVALID_DECLARATIVE_METHOD_PARAMETERS);
|
||||
assertThat(e.getCause())
|
||||
.hasMessageContaining(StreamListenerErrorMessages.INVALID_DECLARATIVE_METHOD_PARAMETERS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,9 +236,11 @@ public class StreamListenerHandlerMethodTests {
|
||||
|
||||
@Test
|
||||
public void testMethodWithMultipleInputParameters() throws Exception {
|
||||
ConfigurableApplicationContext context = SpringApplication.run(TestMethodWithMultipleInputParameters.class, "--server.port=0");
|
||||
ConfigurableApplicationContext context = SpringApplication.run(TestMethodWithMultipleInputParameters.class,
|
||||
"--server.port=0");
|
||||
Processor processor = context.getBean(Processor.class);
|
||||
StreamListenerTestUtils.FooInboundChannel1 inboundChannel2 = context.getBean(StreamListenerTestUtils.FooInboundChannel1.class);
|
||||
StreamListenerTestUtils.FooInboundChannel1 inboundChannel2 = context
|
||||
.getBean(StreamListenerTestUtils.FooInboundChannel1.class);
|
||||
String id = UUID.randomUUID().toString();
|
||||
final CountDownLatch latch = new CountDownLatch(2);
|
||||
((SubscribableChannel) processor.output()).subscribe(new MessageHandler() {
|
||||
@@ -254,10 +260,12 @@ public class StreamListenerHandlerMethodTests {
|
||||
|
||||
@Test
|
||||
public void testMethodWithMultipleOutputParameters() throws Exception {
|
||||
ConfigurableApplicationContext context = SpringApplication.run(TestMethodWithMultipleOutputParameters.class, "--server.port=0");
|
||||
ConfigurableApplicationContext context = SpringApplication.run(TestMethodWithMultipleOutputParameters.class,
|
||||
"--server.port=0");
|
||||
Processor processor = context.getBean(Processor.class);
|
||||
String id = UUID.randomUUID().toString();
|
||||
StreamListenerTestUtils.FooOutboundChannel1 source2 = context.getBean(StreamListenerTestUtils.FooOutboundChannel1.class);
|
||||
StreamListenerTestUtils.FooOutboundChannel1 source2 = context
|
||||
.getBean(StreamListenerTestUtils.FooOutboundChannel1.class);
|
||||
final CountDownLatch latch = new CountDownLatch(2);
|
||||
((SubscribableChannel) processor.output()).subscribe(new MessageHandler() {
|
||||
@Override
|
||||
@@ -281,28 +289,31 @@ public class StreamListenerHandlerMethodTests {
|
||||
context.close();
|
||||
}
|
||||
|
||||
@EnableBinding({Processor.class, StreamListenerTestUtils.FooOutboundChannel1.class})
|
||||
@EnableBinding({ Processor.class, StreamListenerTestUtils.FooOutboundChannel1.class })
|
||||
@EnableAutoConfiguration
|
||||
public static class TestMethodWithMultipleOutputParameters {
|
||||
|
||||
@StreamListener
|
||||
public void receive(@Input(Processor.INPUT) SubscribableChannel input, @Output(Processor.OUTPUT) final MessageChannel output1,
|
||||
public void receive(@Input(Processor.INPUT) SubscribableChannel input,
|
||||
@Output(Processor.OUTPUT) final MessageChannel output1,
|
||||
@Output(StreamListenerTestUtils.FooOutboundChannel1.OUTPUT) final MessageChannel output2) {
|
||||
input.subscribe(new MessageHandler() {
|
||||
@Override
|
||||
public void handleMessage(Message<?> message) throws MessagingException {
|
||||
if (message.getHeaders().get("output").equals("output1")) {
|
||||
output1.send(org.springframework.messaging.support.MessageBuilder.withPayload(message.getPayload().toString().toUpperCase()).build());
|
||||
output1.send(org.springframework.messaging.support.MessageBuilder
|
||||
.withPayload(message.getPayload().toString().toUpperCase()).build());
|
||||
}
|
||||
else if (message.getHeaders().get("output").equals("output2")) {
|
||||
output2.send(org.springframework.messaging.support.MessageBuilder.withPayload(message.getPayload().toString().toLowerCase()).build());
|
||||
output2.send(org.springframework.messaging.support.MessageBuilder
|
||||
.withPayload(message.getPayload().toString().toLowerCase()).build());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@EnableBinding({Sink.class})
|
||||
@EnableBinding({ Sink.class })
|
||||
@EnableAutoConfiguration
|
||||
public static class TestMethodWithoutInput {
|
||||
|
||||
@@ -311,7 +322,7 @@ public class StreamListenerHandlerMethodTests {
|
||||
}
|
||||
}
|
||||
|
||||
@EnableBinding({Processor.class})
|
||||
@EnableBinding({ Processor.class })
|
||||
@EnableAutoConfiguration
|
||||
public static class TestMethodWithObjectAsMethodArgument {
|
||||
|
||||
@@ -340,7 +351,7 @@ public class StreamListenerHandlerMethodTests {
|
||||
}
|
||||
}
|
||||
|
||||
@EnableBinding({Sink.class})
|
||||
@EnableBinding({ Sink.class })
|
||||
@EnableAutoConfiguration
|
||||
public static class TestInvalidInputOnMethod {
|
||||
|
||||
@@ -350,7 +361,7 @@ public class StreamListenerHandlerMethodTests {
|
||||
}
|
||||
}
|
||||
|
||||
@EnableBinding({Sink.class})
|
||||
@EnableBinding({ Sink.class })
|
||||
@EnableAutoConfiguration
|
||||
public static class TestAmbiguousMethodArguments1 {
|
||||
|
||||
@@ -359,27 +370,29 @@ public class StreamListenerHandlerMethodTests {
|
||||
}
|
||||
}
|
||||
|
||||
@EnableBinding({Sink.class})
|
||||
@EnableBinding({ Sink.class })
|
||||
@EnableAutoConfiguration
|
||||
public static class TestAmbiguousMethodArguments2 {
|
||||
|
||||
@StreamListener(Processor.INPUT)
|
||||
public void receive(@Payload StreamListenerTestUtils.FooPojo fooPojo, @Payload StreamListenerTestUtils.BarPojo barPojo) {
|
||||
public void receive(@Payload StreamListenerTestUtils.FooPojo fooPojo,
|
||||
@Payload StreamListenerTestUtils.BarPojo barPojo) {
|
||||
}
|
||||
}
|
||||
|
||||
@EnableBinding({Processor.class, StreamListenerTestUtils.FooOutboundChannel1.class})
|
||||
@EnableBinding({ Processor.class, StreamListenerTestUtils.FooOutboundChannel1.class })
|
||||
@EnableAutoConfiguration
|
||||
public static class TestReturnTypeWithMultipleOutput {
|
||||
|
||||
@StreamListener
|
||||
public String receive(@Input(Processor.INPUT) SubscribableChannel input1, @Output(Processor.OUTPUT) MessageChannel output1,
|
||||
public String receive(@Input(Processor.INPUT) SubscribableChannel input1,
|
||||
@Output(Processor.OUTPUT) MessageChannel output1,
|
||||
@Output(StreamListenerTestUtils.FooOutboundChannel1.OUTPUT) MessageChannel output2) {
|
||||
return "foo";
|
||||
}
|
||||
}
|
||||
|
||||
@EnableBinding({Processor.class, StreamListenerTestUtils.FooOutboundChannel1.class})
|
||||
@EnableBinding({ Processor.class, StreamListenerTestUtils.FooOutboundChannel1.class })
|
||||
@EnableAutoConfiguration
|
||||
public static class TestInvalidReturnTypeWithNoOutput {
|
||||
|
||||
@@ -389,7 +402,7 @@ public class StreamListenerHandlerMethodTests {
|
||||
}
|
||||
}
|
||||
|
||||
@EnableBinding({Processor.class})
|
||||
@EnableBinding({ Processor.class })
|
||||
@EnableAutoConfiguration
|
||||
public static class TestInvalidInputAnnotationWithNoValue {
|
||||
|
||||
@@ -398,7 +411,7 @@ public class StreamListenerHandlerMethodTests {
|
||||
}
|
||||
}
|
||||
|
||||
@EnableBinding({Processor.class})
|
||||
@EnableBinding({ Processor.class })
|
||||
@EnableAutoConfiguration
|
||||
public static class TestInvalidOutputAnnotationWithNoValue {
|
||||
|
||||
@@ -407,7 +420,7 @@ public class StreamListenerHandlerMethodTests {
|
||||
}
|
||||
}
|
||||
|
||||
@EnableBinding({Sink.class})
|
||||
@EnableBinding({ Sink.class })
|
||||
@EnableAutoConfiguration
|
||||
public static class TestMethodInvalidInboundName {
|
||||
|
||||
@@ -416,16 +429,17 @@ public class StreamListenerHandlerMethodTests {
|
||||
}
|
||||
}
|
||||
|
||||
@EnableBinding({Processor.class})
|
||||
@EnableBinding({ Processor.class })
|
||||
@EnableAutoConfiguration
|
||||
public static class TestMethodInvalidOutboundName {
|
||||
|
||||
@StreamListener
|
||||
public void receive(@Input(Processor.INPUT) SubscribableChannel input, @Output("invalid") MessageChannel output) {
|
||||
public void receive(@Input(Processor.INPUT) SubscribableChannel input,
|
||||
@Output("invalid") MessageChannel output) {
|
||||
}
|
||||
}
|
||||
|
||||
@EnableBinding({Sink.class})
|
||||
@EnableBinding({ Sink.class })
|
||||
@EnableAutoConfiguration
|
||||
public static class TestMethodWithInputAsMethodAndParameter {
|
||||
|
||||
@@ -434,39 +448,44 @@ public class StreamListenerHandlerMethodTests {
|
||||
}
|
||||
}
|
||||
|
||||
@EnableBinding({Processor.class, StreamListenerTestUtils.FooOutboundChannel1.class})
|
||||
@EnableBinding({ Processor.class, StreamListenerTestUtils.FooOutboundChannel1.class })
|
||||
@EnableAutoConfiguration
|
||||
public static class TestMethodWithOutputAsMethodAndParameter {
|
||||
|
||||
@StreamListener
|
||||
@Output(StreamListenerTestUtils.FooOutboundChannel1.OUTPUT)
|
||||
public void receive(@Input(Processor.INPUT) SubscribableChannel input, @Output(Processor.OUTPUT) final MessageChannel output1) {
|
||||
public void receive(@Input(Processor.INPUT) SubscribableChannel input,
|
||||
@Output(Processor.OUTPUT) final MessageChannel output1) {
|
||||
input.subscribe(new MessageHandler() {
|
||||
@Override
|
||||
public void handleMessage(Message<?> message) throws MessagingException {
|
||||
output1.send(org.springframework.messaging.support.MessageBuilder.withPayload(message.getPayload().toString().toUpperCase()).build());
|
||||
output1.send(org.springframework.messaging.support.MessageBuilder
|
||||
.withPayload(message.getPayload().toString().toUpperCase()).build());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@EnableBinding({Processor.class, StreamListenerTestUtils.FooInboundChannel1.class})
|
||||
@EnableBinding({ Processor.class, StreamListenerTestUtils.FooInboundChannel1.class })
|
||||
@EnableAutoConfiguration
|
||||
public static class TestMethodWithMultipleInputParameters {
|
||||
|
||||
@StreamListener
|
||||
public void receive(@Input(Processor.INPUT) SubscribableChannel input1, @Input(StreamListenerTestUtils.FooInboundChannel1.INPUT) SubscribableChannel input2,
|
||||
public void receive(@Input(Processor.INPUT) SubscribableChannel input1,
|
||||
@Input(StreamListenerTestUtils.FooInboundChannel1.INPUT) SubscribableChannel input2,
|
||||
final @Output(Processor.OUTPUT) MessageChannel output) {
|
||||
input1.subscribe(new MessageHandler() {
|
||||
@Override
|
||||
public void handleMessage(Message<?> message) throws MessagingException {
|
||||
output.send(org.springframework.messaging.support.MessageBuilder.withPayload(message.getPayload().toString().toUpperCase()).build());
|
||||
output.send(org.springframework.messaging.support.MessageBuilder
|
||||
.withPayload(message.getPayload().toString().toUpperCase()).build());
|
||||
}
|
||||
});
|
||||
input2.subscribe(new MessageHandler() {
|
||||
@Override
|
||||
public void handleMessage(Message<?> message) throws MessagingException {
|
||||
output.send(org.springframework.messaging.support.MessageBuilder.withPayload(message.getPayload().toString().toUpperCase()).build());
|
||||
output.send(org.springframework.messaging.support.MessageBuilder
|
||||
.withPayload(message.getPayload().toString().toUpperCase()).build());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class StreamListenerMessageArgumentTests {
|
||||
|
||||
@Parameterized.Parameters
|
||||
public static Collection InputConfigs() {
|
||||
return Arrays.asList(new Class[] {TestPojoWithMessageArgument1.class, TestPojoWithMessageArgument2.class});
|
||||
return Arrays.asList(new Class[] { TestPojoWithMessageArgument1.class, TestPojoWithMessageArgument2.class });
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -52,11 +52,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Ilayaperumal Gopinathan
|
||||
*/
|
||||
@RunWith(StreamListenerMethodReturnWithConversionTests.class)
|
||||
@Suite.SuiteClasses({StreamListenerMethodReturnWithConversionTests.TestReturnConversion.class,
|
||||
StreamListenerMethodReturnWithConversionTests.TestReturnNoConversion.class})
|
||||
@Suite.SuiteClasses({ StreamListenerMethodReturnWithConversionTests.TestReturnConversion.class,
|
||||
StreamListenerMethodReturnWithConversionTests.TestReturnNoConversion.class })
|
||||
public class StreamListenerMethodReturnWithConversionTests extends Suite {
|
||||
|
||||
public StreamListenerMethodReturnWithConversionTests(Class<?> klass, RunnerBuilder builder) throws InitializationError {
|
||||
public StreamListenerMethodReturnWithConversionTests(Class<?> klass, RunnerBuilder builder)
|
||||
throws InitializationError {
|
||||
super(klass, builder);
|
||||
}
|
||||
|
||||
@@ -71,7 +72,7 @@ public class StreamListenerMethodReturnWithConversionTests extends Suite {
|
||||
|
||||
@Parameterized.Parameters
|
||||
public static Collection InputConfigs() {
|
||||
return Arrays.asList(new Class[] {TestPojoWithMimeType1.class, TestPojoWithMimeType2.class});
|
||||
return Arrays.asList(new Class[] { TestPojoWithMimeType1.class, TestPojoWithMimeType2.class });
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -87,10 +88,12 @@ public class StreamListenerMethodReturnWithConversionTests extends Suite {
|
||||
TestPojoWithMimeType testPojoWithMimeType = context.getBean(TestPojoWithMimeType.class);
|
||||
assertThat(testPojoWithMimeType.receivedPojos).hasSize(1);
|
||||
assertThat(testPojoWithMimeType.receivedPojos.get(0)).hasFieldOrPropertyWithValue("foo", "barbar" + id);
|
||||
Message<String> message = (Message<String>) collector.forChannel(processor.output()).poll(1, TimeUnit.SECONDS);
|
||||
Message<String> message = (Message<String>) collector.forChannel(processor.output()).poll(1,
|
||||
TimeUnit.SECONDS);
|
||||
assertThat(message).isNotNull();
|
||||
assertThat(message.getPayload()).isEqualTo("{\"bar\":\"barbar" + id + "\"}");
|
||||
assertThat(message.getHeaders().get(MessageHeaders.CONTENT_TYPE, MimeType.class).includes(MimeTypeUtils.APPLICATION_JSON));
|
||||
assertThat(message.getHeaders().get(MessageHeaders.CONTENT_TYPE, MimeType.class)
|
||||
.includes(MimeTypeUtils.APPLICATION_JSON));
|
||||
context.close();
|
||||
}
|
||||
}
|
||||
@@ -106,7 +109,7 @@ public class StreamListenerMethodReturnWithConversionTests extends Suite {
|
||||
|
||||
@Parameterized.Parameters
|
||||
public static Collection InputConfigs() {
|
||||
return Arrays.asList(new Class[] {TestPojoWithMimeType1.class, TestPojoWithMimeType2.class});
|
||||
return Arrays.asList(new Class[] { TestPojoWithMimeType1.class, TestPojoWithMimeType2.class });
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -121,8 +124,9 @@ public class StreamListenerMethodReturnWithConversionTests extends Suite {
|
||||
TestPojoWithMimeType testPojoWithMimeType = context.getBean(TestPojoWithMimeType.class);
|
||||
assertThat(testPojoWithMimeType.receivedPojos).hasSize(1);
|
||||
assertThat(testPojoWithMimeType.receivedPojos.get(0)).hasFieldOrPropertyWithValue("foo", "barbar" + id);
|
||||
Message<StreamListenerTestUtils.BarPojo> message = (Message<StreamListenerTestUtils.BarPojo>) collector.forChannel(processor.output()).poll(1,
|
||||
TimeUnit.SECONDS);
|
||||
Message<StreamListenerTestUtils.BarPojo> message = (Message<StreamListenerTestUtils.BarPojo>) collector
|
||||
.forChannel(processor.output()).poll(1,
|
||||
TimeUnit.SECONDS);
|
||||
assertThat(message).isNotNull();
|
||||
assertThat(message.getPayload().getBar()).isEqualTo("barbar" + id);
|
||||
assertThat(message.getHeaders().get(MessageHeaders.CONTENT_TYPE, MimeType.class) == null);
|
||||
|
||||
@@ -56,7 +56,7 @@ public class StreamListenerMethodWithReturnMessageTests {
|
||||
|
||||
@Parameterized.Parameters
|
||||
public static Collection InputConfigs() {
|
||||
return Arrays.asList(new Class[]{TestPojoWithMessageReturn1.class, TestPojoWithMessageReturn2.class});
|
||||
return Arrays.asList(new Class[] { TestPojoWithMessageReturn1.class, TestPojoWithMessageReturn2.class });
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -56,7 +56,7 @@ public class StreamListenerMethodWithReturnValueTests {
|
||||
|
||||
@Parameterized.Parameters
|
||||
public static Collection InputConfigs() {
|
||||
return Arrays.asList(new Class[]{TestStringProcessor1.class, TestStringProcessor2.class});
|
||||
return Arrays.asList(new Class[] { TestStringProcessor1.class, TestStringProcessor2.class });
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -26,6 +26,24 @@ import org.springframework.messaging.SubscribableChannel;
|
||||
*/
|
||||
public class StreamListenerTestUtils {
|
||||
|
||||
public interface FooInboundChannel1 {
|
||||
|
||||
String INPUT = "foo1-input";
|
||||
|
||||
@Input(FooInboundChannel1.INPUT)
|
||||
SubscribableChannel input();
|
||||
|
||||
}
|
||||
|
||||
public interface FooOutboundChannel1 {
|
||||
|
||||
String OUTPUT = "foo1-output";
|
||||
|
||||
@Output(FooOutboundChannel1.OUTPUT)
|
||||
MessageChannel output();
|
||||
|
||||
}
|
||||
|
||||
public static class FooPojo {
|
||||
|
||||
private String foo;
|
||||
@@ -51,22 +69,4 @@ public class StreamListenerTestUtils {
|
||||
this.bar = bar;
|
||||
}
|
||||
}
|
||||
|
||||
public interface FooInboundChannel1 {
|
||||
|
||||
String INPUT = "foo1-input";
|
||||
|
||||
@Input(FooInboundChannel1.INPUT)
|
||||
SubscribableChannel input();
|
||||
|
||||
}
|
||||
|
||||
public interface FooOutboundChannel1 {
|
||||
|
||||
String OUTPUT = "foo1-output";
|
||||
|
||||
@Output(FooOutboundChannel1.OUTPUT)
|
||||
MessageChannel output();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,13 +73,15 @@ public class StreamListenerWithAnnotatedInputOutputArgsTests {
|
||||
}
|
||||
catch (BeanCreationException e) {
|
||||
assertThat(e.getCause()).isInstanceOf(IllegalArgumentException.class);
|
||||
assertThat(e.getCause()).hasMessageContaining(StreamListenerErrorMessages.INVALID_DECLARATIVE_METHOD_PARAMETERS);
|
||||
assertThat(e.getCause())
|
||||
.hasMessageContaining(StreamListenerErrorMessages.INVALID_DECLARATIVE_METHOD_PARAMETERS);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInputOutputArgsWithParameterOrderChanged() throws Exception {
|
||||
ConfigurableApplicationContext context = SpringApplication.run(TestInputOutputArgsWithParameterOrderChanged.class, "--server.port=0");
|
||||
ConfigurableApplicationContext context = SpringApplication
|
||||
.run(TestInputOutputArgsWithParameterOrderChanged.class, "--server.port=0");
|
||||
sendMessageAndValidate(context);
|
||||
}
|
||||
|
||||
@@ -94,13 +96,13 @@ public class StreamListenerWithAnnotatedInputOutputArgsTests {
|
||||
context.close();
|
||||
}
|
||||
|
||||
|
||||
@EnableBinding(Processor.class)
|
||||
@EnableAutoConfiguration
|
||||
public static class TestInputOutputArgs {
|
||||
|
||||
@StreamListener
|
||||
public void receive(@Input(Processor.INPUT) SubscribableChannel input, @Output(Processor.OUTPUT) final MessageChannel output) {
|
||||
public void receive(@Input(Processor.INPUT) SubscribableChannel input,
|
||||
@Output(Processor.OUTPUT) final MessageChannel output) {
|
||||
input.subscribe(new MessageHandler() {
|
||||
@Override
|
||||
public void handleMessage(Message<?> message) throws MessagingException {
|
||||
@@ -115,7 +117,8 @@ public class StreamListenerWithAnnotatedInputOutputArgsTests {
|
||||
public static class TestInputOutputArgsWithMoreParameters {
|
||||
|
||||
@StreamListener
|
||||
public void receive(@Input(Processor.INPUT) SubscribableChannel input, @Output(Processor.OUTPUT) final MessageChannel output,
|
||||
public void receive(@Input(Processor.INPUT) SubscribableChannel input,
|
||||
@Output(Processor.OUTPUT) final MessageChannel output,
|
||||
String someArg) {
|
||||
input.subscribe(new MessageHandler() {
|
||||
@Override
|
||||
@@ -131,7 +134,8 @@ public class StreamListenerWithAnnotatedInputOutputArgsTests {
|
||||
public static class TestInputOutputArgsWithInvalidBindableTarget {
|
||||
|
||||
@StreamListener
|
||||
public void receive(@Input("invalid") SubscribableChannel input, @Output(Processor.OUTPUT) final MessageChannel output) {
|
||||
public void receive(@Input("invalid") SubscribableChannel input,
|
||||
@Output(Processor.OUTPUT) final MessageChannel output) {
|
||||
input.subscribe(new MessageHandler() {
|
||||
@Override
|
||||
public void handleMessage(Message<?> message) throws MessagingException {
|
||||
@@ -146,7 +150,8 @@ public class StreamListenerWithAnnotatedInputOutputArgsTests {
|
||||
public static class TestInputOutputArgsWithParameterOrderChanged {
|
||||
|
||||
@StreamListener
|
||||
public void receive(@Output(Processor.OUTPUT) final MessageChannel output, @Input("input") SubscribableChannel input) {
|
||||
public void receive(@Output(Processor.OUTPUT) final MessageChannel output,
|
||||
@Input("input") SubscribableChannel input) {
|
||||
input.subscribe(new MessageHandler() {
|
||||
@Override
|
||||
public void handleMessage(Message<?> message) throws MessagingException {
|
||||
|
||||
@@ -75,13 +75,16 @@ public class StreamListenerWithConditionsTest {
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testConditionalFailsWithReturnValue() throws Exception {
|
||||
try {
|
||||
ConfigurableApplicationContext context = SpringApplication.run(TestConditionalOnMethodWithReturnValueFails.class,
|
||||
ConfigurableApplicationContext context = SpringApplication.run(
|
||||
TestConditionalOnMethodWithReturnValueFails.class,
|
||||
"--server.port=0");
|
||||
context.close();
|
||||
fail("Context creation failure expected");
|
||||
} catch (BeanCreationException e) {
|
||||
}
|
||||
catch (BeanCreationException e) {
|
||||
assertThat(e).hasRootCauseInstanceOf(IllegalArgumentException.class);
|
||||
assertThat(e.getCause()).hasMessageContaining(StreamListenerErrorMessages.CONDITION_ON_METHOD_RETURNING_VALUE);
|
||||
assertThat(e.getCause())
|
||||
.hasMessageContaining(StreamListenerErrorMessages.CONDITION_ON_METHOD_RETURNING_VALUE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,11 +92,13 @@ public class StreamListenerWithConditionsTest {
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testConditionalFailsWithDeclarativeMethod() throws Exception {
|
||||
try {
|
||||
ConfigurableApplicationContext context = SpringApplication.run(TestConditionalOnDeclarativeMethodFails.class,
|
||||
ConfigurableApplicationContext context = SpringApplication.run(
|
||||
TestConditionalOnDeclarativeMethodFails.class,
|
||||
"--server.port=0");
|
||||
context.close();
|
||||
fail("Context creation failure expected");
|
||||
} catch (BeanCreationException e) {
|
||||
}
|
||||
catch (BeanCreationException e) {
|
||||
assertThat(e).hasRootCauseInstanceOf(IllegalArgumentException.class);
|
||||
assertThat(e.getCause()).hasMessageContaining(StreamListenerErrorMessages.CONDITION_ON_DECLARATIVE_METHOD);
|
||||
}
|
||||
|
||||
@@ -43,8 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @since 1.2
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringBootTest(classes = TextPlainConversionTest.FooProcessor.class,
|
||||
webEnvironment = SpringBootTest.WebEnvironment.NONE)
|
||||
@SpringBootTest(classes = TextPlainConversionTest.FooProcessor.class, webEnvironment = SpringBootTest.WebEnvironment.NONE)
|
||||
public class TextPlainConversionTest {
|
||||
|
||||
@Autowired
|
||||
@@ -83,7 +82,6 @@ public class TextPlainConversionTest {
|
||||
assertThat(received.getPayload()).isEqualTo("Foo{name='Foo{name='Bar'}'}");
|
||||
}
|
||||
|
||||
|
||||
@EnableBinding(Processor.class)
|
||||
@EnableAutoConfiguration
|
||||
@PropertySource("classpath:/org/springframework/cloud/stream/config/textplain/text-plain.properties")
|
||||
|
||||
@@ -44,10 +44,13 @@ public class AggregateApplicationTests {
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testAggregateApplication() throws Exception {
|
||||
ConfigurableApplicationContext context = new AggregateApplicationBuilder(TestSupportBinderAutoConfiguration.class).from(TestSource.class).to(TestProcessor.class).run();
|
||||
TestSupportBinder testSupportBinder = (TestSupportBinder) context.getBean(BinderFactory.class).getBinder(null, MessageChannel.class);
|
||||
ConfigurableApplicationContext context = new AggregateApplicationBuilder(
|
||||
TestSupportBinderAutoConfiguration.class).from(TestSource.class).to(TestProcessor.class).run();
|
||||
TestSupportBinder testSupportBinder = (TestSupportBinder) context.getBean(BinderFactory.class).getBinder(null,
|
||||
MessageChannel.class);
|
||||
MessageChannel processorOutput = testSupportBinder.getChannelForName("output");
|
||||
Message<String> received = (Message<String>) (testSupportBinder.messageCollector().forChannel(processorOutput).poll(5, TimeUnit.SECONDS));
|
||||
Message<String> received = (Message<String>) (testSupportBinder.messageCollector().forChannel(processorOutput)
|
||||
.poll(5, TimeUnit.SECONDS));
|
||||
Assert.assertThat(received, notNullValue());
|
||||
Assert.assertTrue(received.getPayload().endsWith("processed"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user