From def3647c80bb886e7fdc2d3e692ff763b75f0dcd Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Tue, 3 May 2011 16:52:53 -0400 Subject: [PATCH] INT-1853 changed default max-messages-per-poll to be Integer.MIN_VALUE --- spring-integration-core/.springBeans | 3 +- ...ourcePollingChannelAdapterFactoryBean.java | 2 +- .../scheduling/PollerMetadata.java | 2 +- .../endpoint/PollingLifecycleTests.java | 42 +++++++++++++++++++ 4 files changed, 46 insertions(+), 3 deletions(-) diff --git a/spring-integration-core/.springBeans b/spring-integration-core/.springBeans index 5505ed4aa2..041e617c24 100644 --- a/spring-integration-core/.springBeans +++ b/spring-integration-core/.springBeans @@ -1,7 +1,7 @@ 1 - + @@ -10,6 +10,7 @@ src/test/java/org/springframework/integration/gateway/GatewayInterfaceTest-context.xml src/test/java/org/springframework/integration/gateway/InnerGatewayWithChainTests-context.xml src/test/java/org/springframework/integration/history/annotated-config.xml + src/test/java/vfabric/uk/si-config.xml diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/SourcePollingChannelAdapterFactoryBean.java b/spring-integration-core/src/main/java/org/springframework/integration/config/SourcePollingChannelAdapterFactoryBean.java index 0eb8304df0..9435800762 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/SourcePollingChannelAdapterFactoryBean.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/SourcePollingChannelAdapterFactoryBean.java @@ -130,7 +130,7 @@ public class SourcePollingChannelAdapterFactoryBean implements FactoryBean source = new MessageSource() { + public Message receive() { + + try { + for (int i = 0; i < 10; i++) { + runnable.run(); + latch.countDown(); + Thread.sleep(1000); + } + } catch (InterruptedException e) { + coughtInterrupted.run(); + } + + return new GenericMessage("hello"); + } + }; + adapterFactory.setSource(source); + adapterFactory.setOutputChannel(channel); + adapterFactory.setBeanFactory(mock(ConfigurableBeanFactory.class)); + SourcePollingChannelAdapter adapter = adapterFactory.getObject(); + adapter.setTaskScheduler(taskScheduler); + adapter.afterPropertiesSet(); + adapter.start(); + assertTrue(latch.await(3000, TimeUnit.SECONDS)); + // + adapter.stop(); + Mockito.verify(runnable, times(2)).run(); + Mockito.verify(coughtInterrupted, times(1)).run(); + } }