use of org.springframework.integration.endpoint.AbstractMessageSource in project spring-integration by spring-projects.
the class IntegrationManagementConfigurerTests method testDefaults.
@Test
public void testDefaults() {
DirectChannel channel = new DirectChannel();
AbstractMessageHandler handler = new RecipientListRouter();
AbstractMessageSource<?> source = new AbstractMessageSource<Object>() {
@Override
public String getComponentType() {
return null;
}
@Override
protected Object doReceive() {
return null;
}
};
assertTrue(channel.isLoggingEnabled());
assertTrue(handler.isLoggingEnabled());
assertTrue(source.isLoggingEnabled());
channel.setCountsEnabled(true);
channel.setStatsEnabled(true);
ApplicationContext ctx = mock(ApplicationContext.class);
Map<String, IntegrationManagement> beans = new HashMap<String, IntegrationManagement>();
beans.put("foo", channel);
beans.put("bar", handler);
beans.put("baz", source);
when(ctx.getBeansOfType(IntegrationManagement.class)).thenReturn(beans);
IntegrationManagementConfigurer configurer = new IntegrationManagementConfigurer();
configurer.setBeanName(IntegrationManagementConfigurer.MANAGEMENT_CONFIGURER_NAME);
configurer.setApplicationContext(ctx);
configurer.setDefaultLoggingEnabled(false);
configurer.afterSingletonsInstantiated();
assertFalse(channel.isLoggingEnabled());
assertFalse(handler.isLoggingEnabled());
assertFalse(source.isLoggingEnabled());
assertTrue(channel.isCountsEnabled());
assertTrue(channel.isStatsEnabled());
}
Aggregations