Added support for defining a poller on the service activator element INT-402

This commit is contained in:
Jonas Partner
2008-10-08 10:02:13 +00:00
parent 22bd5f1b3e
commit ae5974ff82
3 changed files with 36 additions and 1 deletions

View File

@@ -3,12 +3,14 @@
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:tool="http://www.springframework.org/schema/tool"
xmlns:integration="http://www.springframework.org/schema/integration"
targetNamespace="http://www.springframework.org/schema/integration/ws"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xsd:import namespace="http://www.springframework.org/schema/beans"/>
<xsd:import namespace="http://www.springframework.org/schema/tool"/>
<xsd:import namespace="http://www.springframework.org/schema/integration"/>
<xsd:annotation>
<xsd:documentation><![CDATA[
@@ -23,6 +25,9 @@
Defines a Web Service based Service Activator endpoint.
</xsd:documentation>
</xsd:annotation>
<xsd:all>
<xsd:element ref="integration:poller" minOccurs="0" maxOccurs="1" />
</xsd:all>
<xsd:attribute name="id" type="xsd:string"/>
<xsd:attribute name="input-channel" type="xsd:string" use="required"/>
<xsd:attribute name="output-channel" type="xsd:string"/>

View File

@@ -24,7 +24,9 @@ import org.springframework.beans.DirectFieldAccessor;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.endpoint.MessageEndpoint;
import org.springframework.integration.endpoint.PollingConsumerEndpoint;
import org.springframework.integration.endpoint.SubscribingConsumerEndpoint;
import org.springframework.integration.scheduling.IntervalTrigger;
import org.springframework.integration.ws.handler.MarshallingWebServiceHandler;
import org.springframework.integration.ws.handler.SimpleWebServiceHandler;
import org.springframework.oxm.Marshaller;
@@ -150,6 +152,23 @@ public class WebServiceHandlerParserTests {
assertEquals(messageSender, ((WebServiceMessageSender[])accessor.getPropertyValue("messageSenders"))[0]);
assertEquals("Wrong number of message senders " ,2 , ((WebServiceMessageSender[])accessor.getPropertyValue("messageSenders")).length);
}
@Test
public void testSimpleWebServiceHandlerWithPoller() {
ApplicationContext context = new ClassPathXmlApplicationContext(
"simpleWebServiceHandlerParserTests.xml", this.getClass());
MessageEndpoint endpoint = (MessageEndpoint) context.getBean("handlerWithPoller");
assertEquals(PollingConsumerEndpoint.class, endpoint.getClass());
Object obj = new DirectFieldAccessor(endpoint).getPropertyValue("trigger");
assertEquals(IntervalTrigger.class, obj.getClass());
IntervalTrigger trigger = (IntervalTrigger)obj;
DirectFieldAccessor accessor = new DirectFieldAccessor(trigger);
accessor = new DirectFieldAccessor(trigger);
assertEquals("IntervalTrigger had wrong itnerval" , 5000, ((Long)accessor.getPropertyValue("interval")).longValue());
}
@Test
public void testWebServiceHandlerWithAllInOneMarshaller() {

View File

@@ -14,6 +14,10 @@
http://www.springframework.org/schema/util/spring-util.xsd">
<si:channel id="inputChannel"/>
<si:channel id="pollableInputChannel">
<si:queue capacity="10"/>
</si:channel>
<ws:service-activator id="handlerWithDefaultSourceExtractor"
input-channel="inputChannel"
@@ -53,7 +57,14 @@
<ws:service-activator id="handlerWithCustomMessageSenderList"
input-channel="inputChannel"
uri="http://example.org"
message-senders="messageSenders"/>
message-senders="messageSenders">
</ws:service-activator>
<ws:service-activator id="handlerWithPoller"
input-channel="pollableInputChannel"
uri="http://example.org">
<si:poller interval="5000"/>
</ws:service-activator>
<bean id="sourceExtractor" class="org.springframework.integration.ws.config.StubSourceExtractor"/>