use of org.springframework.cloud.stream.aggregate.AggregateApplicationBuilder.SourceConfigurer in project spring-cloud-stream by spring-cloud.
the class AggregationTest method testNamespacePrefixesFromCmdLine.
@Test
@SuppressWarnings("unchecked")
public void testNamespacePrefixesFromCmdLine() {
AggregateApplicationBuilder aggregateApplicationBuilder = new AggregateApplicationBuilder(MockBinderRegistryConfiguration.class);
aggregatedApplicationContext = aggregateApplicationBuilder.parent(DummyConfig.class).web(false).from(TestSource.class).namespace("a").via(TestProcessor.class).namespace("b").via(TestProcessor.class).namespace("c").run("--a.foo1=bar1", "--b.foo1=bar2", "--c.foo1=bar3");
DirectFieldAccessor aggregateApplicationBuilderAccessor = new DirectFieldAccessor(aggregateApplicationBuilder);
assertTrue(Arrays.equals(((SourceConfigurer) aggregateApplicationBuilderAccessor.getPropertyValue("sourceConfigurer")).getArgs(), new String[] { "--foo1=bar1" }));
final List<AggregateApplicationBuilder.ProcessorConfigurer> processorConfigurers = (List<AggregateApplicationBuilder.ProcessorConfigurer>) aggregateApplicationBuilderAccessor.getPropertyValue("processorConfigurers");
for (AggregateApplicationBuilder.ProcessorConfigurer processorConfigurer : processorConfigurers) {
if (processorConfigurer.getNamespace().equals("b")) {
assertTrue(Arrays.equals(processorConfigurer.getArgs(), new String[] { "--foo1=bar2" }));
}
if (processorConfigurer.getNamespace().equals("c")) {
assertTrue(Arrays.equals(processorConfigurer.getArgs(), new String[] { "--foo1=bar3" }));
}
}
aggregatedApplicationContext.close();
}
Aggregations