use of org.springframework.integration.channel.DefaultHeaderChannelRegistry in project spring-integration by spring-projects.
the class HeaderChannelRegistryTests method testExpire.
@Test
public void testExpire() throws Exception {
DefaultHeaderChannelRegistry registry = new DefaultHeaderChannelRegistry(50);
registry.setTaskScheduler(this.taskScheduler);
String id = (String) registry.channelToChannelName(new DirectChannel());
int n = 0;
while (n++ < 100 && registry.channelNameToChannel(id) != null) {
Thread.sleep(100);
}
assertNull(registry.channelNameToChannel(id));
registry.stop();
}
use of org.springframework.integration.channel.DefaultHeaderChannelRegistry in project spring-integration by spring-projects.
the class HeaderChannelRegistryTests method testRemoveOnGet.
@Test
public void testRemoveOnGet() {
DefaultHeaderChannelRegistry registry = new DefaultHeaderChannelRegistry();
MessageChannel channel = new DirectChannel();
String foo = (String) registry.channelToChannelName(channel);
Map<?, ?> map = TestUtils.getPropertyValue(registry, "channels", Map.class);
assertEquals(1, map.size());
assertSame(channel, registry.channelNameToChannel(foo));
assertEquals(1, map.size());
registry.setRemoveOnGet(true);
assertSame(channel, registry.channelNameToChannel(foo));
assertEquals(0, map.size());
}
Aggregations