Search in sources :

Example 1 with BindingTargetFactory

use of org.springframework.cloud.stream.binding.BindingTargetFactory in project spring-cloud-stream by spring-cloud.

the class AggregationTest method testModuleAggregationUsingSharedChannelRegistry.

@Test
public void testModuleAggregationUsingSharedChannelRegistry() {
    // test backward compatibility
    aggregatedApplicationContext = new AggregateApplicationBuilder(MockBinderRegistryConfiguration.class, "--server.port=0").web(false).from(TestSource.class).to(TestProcessor.class).run();
    SharedBindingTargetRegistry sharedChannelRegistry = aggregatedApplicationContext.getBean(SharedBindingTargetRegistry.class);
    BindingTargetFactory channelFactory = aggregatedApplicationContext.getBean(SubscribableChannelBindingTargetFactory.class);
    assertThat(channelFactory).isNotNull();
    assertThat(sharedChannelRegistry.getAll().keySet()).hasSize(2);
    aggregatedApplicationContext.close();
}
Also used : AggregateApplicationBuilder(org.springframework.cloud.stream.aggregate.AggregateApplicationBuilder) MockBinderRegistryConfiguration(org.springframework.cloud.stream.utils.MockBinderRegistryConfiguration) SharedBindingTargetRegistry(org.springframework.cloud.stream.aggregate.SharedBindingTargetRegistry) BindingTargetFactory(org.springframework.cloud.stream.binding.BindingTargetFactory) SubscribableChannelBindingTargetFactory(org.springframework.cloud.stream.binding.SubscribableChannelBindingTargetFactory) Test(org.junit.Test)

Example 2 with BindingTargetFactory

use of org.springframework.cloud.stream.binding.BindingTargetFactory in project spring-cloud-stream by spring-cloud.

the class AggregationTest method aggregation.

@Test
public void aggregation() {
    aggregatedApplicationContext = new AggregateApplicationBuilder(MockBinderRegistryConfiguration.class, "--server.port=0", "--debug=true").web(false).from(TestSource.class).to(TestProcessor.class).run();
    SharedBindingTargetRegistry sharedBindingTargetRegistry = aggregatedApplicationContext.getBean(SharedBindingTargetRegistry.class);
    BindingTargetFactory channelFactory = aggregatedApplicationContext.getBean(SubscribableChannelBindingTargetFactory.class);
    assertThat(channelFactory).isNotNull();
    assertThat(sharedBindingTargetRegistry.getAll().keySet()).hasSize(2);
    aggregatedApplicationContext.close();
}
Also used : AggregateApplicationBuilder(org.springframework.cloud.stream.aggregate.AggregateApplicationBuilder) MockBinderRegistryConfiguration(org.springframework.cloud.stream.utils.MockBinderRegistryConfiguration) SharedBindingTargetRegistry(org.springframework.cloud.stream.aggregate.SharedBindingTargetRegistry) BindingTargetFactory(org.springframework.cloud.stream.binding.BindingTargetFactory) SubscribableChannelBindingTargetFactory(org.springframework.cloud.stream.binding.SubscribableChannelBindingTargetFactory) Test(org.junit.Test)

Example 3 with BindingTargetFactory

use of org.springframework.cloud.stream.binding.BindingTargetFactory in project spring-cloud-stream by spring-cloud.

the class AggregationTest method testNamespaces.

@Test
public void testNamespaces() {
    aggregatedApplicationContext = new AggregateApplicationBuilder(MockBinderRegistryConfiguration.class, "--server.port=0").web(false).from(TestSource.class).namespace("foo").to(TestProcessor.class).namespace("bar").run();
    SharedBindingTargetRegistry sharedChannelRegistry = aggregatedApplicationContext.getBean(SharedBindingTargetRegistry.class);
    BindingTargetFactory channelFactory = aggregatedApplicationContext.getBean(SubscribableChannelBindingTargetFactory.class);
    MessageChannel fooOutput = sharedChannelRegistry.get("foo.output", MessageChannel.class);
    assertThat(fooOutput).isNotNull();
    Object barInput = sharedChannelRegistry.get("bar.input", MessageChannel.class);
    assertThat(barInput).isNotNull();
    assertThat(channelFactory).isNotNull();
    assertThat(sharedChannelRegistry.getAll().keySet()).hasSize(2);
    aggregatedApplicationContext.close();
}
Also used : MessageChannel(org.springframework.messaging.MessageChannel) AggregateApplicationBuilder(org.springframework.cloud.stream.aggregate.AggregateApplicationBuilder) MockBinderRegistryConfiguration(org.springframework.cloud.stream.utils.MockBinderRegistryConfiguration) SharedBindingTargetRegistry(org.springframework.cloud.stream.aggregate.SharedBindingTargetRegistry) BindingTargetFactory(org.springframework.cloud.stream.binding.BindingTargetFactory) SubscribableChannelBindingTargetFactory(org.springframework.cloud.stream.binding.SubscribableChannelBindingTargetFactory) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 AggregateApplicationBuilder (org.springframework.cloud.stream.aggregate.AggregateApplicationBuilder)3 SharedBindingTargetRegistry (org.springframework.cloud.stream.aggregate.SharedBindingTargetRegistry)3 BindingTargetFactory (org.springframework.cloud.stream.binding.BindingTargetFactory)3 SubscribableChannelBindingTargetFactory (org.springframework.cloud.stream.binding.SubscribableChannelBindingTargetFactory)3 MockBinderRegistryConfiguration (org.springframework.cloud.stream.utils.MockBinderRegistryConfiguration)3 MessageChannel (org.springframework.messaging.MessageChannel)1