Search in sources :

Example 26 with Processor

use of org.springframework.cloud.stream.messaging.Processor in project spring-cloud-stream by spring-cloud.

the class InputOutputBindingOrderTest method testInputOutputBindingOrder.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testInputOutputBindingOrder() {
    ConfigurableApplicationContext applicationContext = SpringApplication.run(TestSource.class, "--server.port=-1");
    @SuppressWarnings("rawtypes") Binder binder = applicationContext.getBean(BinderFactory.class).getBinder(null, MessageChannel.class);
    Processor processor = applicationContext.getBean(Processor.class);
    // input is bound after the context has been started
    verify(binder).bindConsumer(eq("input"), isNull(), eq(processor.input()), Mockito.any());
    SomeLifecycle someLifecycle = applicationContext.getBean(SomeLifecycle.class);
    assertThat(someLifecycle.isRunning());
    applicationContext.close();
    assertThat(someLifecycle.isRunning()).isFalse();
    applicationContext.close();
}
Also used : ConfigurableApplicationContext(org.springframework.context.ConfigurableApplicationContext) Processor(org.springframework.cloud.stream.messaging.Processor) Test(org.junit.Test)

Aggregations

Processor (org.springframework.cloud.stream.messaging.Processor)26 Message (org.springframework.messaging.Message)20 MessageCollector (org.springframework.cloud.stream.test.binder.MessageCollector)19 Test (org.junit.Test)14 ConfigurableApplicationContext (org.springframework.context.ConfigurableApplicationContext)12 CountDownLatch (java.util.concurrent.CountDownLatch)2 MessageHandler (org.springframework.messaging.MessageHandler)2 MessagingException (org.springframework.messaging.MessagingException)2 SubscribableChannel (org.springframework.messaging.SubscribableChannel)2 Field (java.lang.reflect.Field)1 Map (java.util.Map)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1 AggregateApplication (org.springframework.cloud.stream.aggregate.AggregateApplication)1 AggregateApplicationBuilder (org.springframework.cloud.stream.aggregate.AggregateApplicationBuilder)1 BindableProxyFactory (org.springframework.cloud.stream.binding.BindableProxyFactory)1 Source (org.springframework.cloud.stream.messaging.Source)1 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)1