INT-845 added StartupMode enum since polling consumers must not start as eagerly as event-driven consumers subscribe to their input channels

This commit is contained in:
Mark Fisher
2009-10-13 00:39:30 +00:00
parent 78da00302e
commit 2064939c84
23 changed files with 259 additions and 41 deletions

View File

@@ -37,6 +37,8 @@ import org.mockito.invocation.InvocationOnMock;
import org.mockito.runners.MockitoJUnit44Runner;
import org.mockito.stubbing.Answer;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.support.StaticApplicationContext;
import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.core.Message;
import org.springframework.integration.core.MessageChannel;
@@ -90,6 +92,7 @@ public class SimpleWebServiceInboundGatewayTests {
when(requestChannel.send(isA(Message.class))).thenAnswer(
withReplyTo(replyChannel));
when(request.getPayloadSource()).thenReturn(payloadSource);
gateway.onApplicationEvent(new ContextRefreshedEvent(new StaticApplicationContext()));
gateway.invoke(context);
verify(requestChannel).send(messageWithPayload(payloadSource));
assertTrue(output.toString().endsWith(input));

View File

@@ -27,6 +27,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.endpoint.AbstractEndpoint;
import org.springframework.integration.endpoint.EventDrivenConsumer;
import org.springframework.integration.endpoint.PollingConsumer;
import org.springframework.integration.endpoint.AbstractEndpoint.StartupMode;
import org.springframework.integration.ws.MarshallingWebServiceOutboundGateway;
import org.springframework.integration.ws.SimpleWebServiceOutboundGateway;
import org.springframework.oxm.Marshaller;
@@ -221,7 +222,7 @@ public class WebServiceOutboundGatewayParserTests {
ApplicationContext context = new ClassPathXmlApplicationContext(
"simpleWebServiceOutboundGatewayParserTests.xml", this.getClass());
AbstractEndpoint endpoint = (AbstractEndpoint) context.getBean("gatewayWithOrderAndAutoStartupFalse");
assertEquals(Boolean.FALSE, new DirectFieldAccessor(endpoint).getPropertyValue("autoStartup"));
assertEquals(StartupMode.MANUAL, new DirectFieldAccessor(endpoint).getPropertyValue("startupMode"));
}
@Test