INT-3926: Add <poller> for all outbound tags

JIRA: https://jira.spring.io/browse/INT-3926

* Add `<poller>` for all `<outbound-adapter(gateway)>`
* Add/modify tests for `<queue>` as an input channel and particular `<poller>`
* Move XSD from the `xml` package to the `config` level to achieve the consistency throughout the project.
This commit is contained in:
Artem Bilan
2016-01-06 19:06:03 -05:00
committed by Gary Russell
parent afc286a66a
commit 74cbc58698
29 changed files with 149 additions and 83 deletions

View File

@@ -370,6 +370,7 @@
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element ref="integration:poller" minOccurs="0" maxOccurs="1"/>
<xsd:element name="request-handler-advice-chain" type="integration:handlerAdviceChainType" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
<xsd:attribute name="exchange-name" type="xsd:string">

View File

@@ -17,7 +17,9 @@
amqp-template="amqpTemplate"
auto-startup="false"
order="5"
return-channel="returnChannel"/>
return-channel="returnChannel">
<int:poller fixed-delay="100"/>
</amqp:outbound-gateway>
<rabbit:template id="amqpTemplate" connection-factory="connectionFactory"/>
@@ -25,7 +27,9 @@
<constructor-arg value="org.springframework.amqp.rabbit.connection.ConnectionFactory"/>
</bean>
<int:channel id="toRabbit0"/>
<int:channel id="toRabbit0">
<int:queue/>
</int:channel>
<int:channel id="toRabbit1"/>
<int:channel id="toRabbit2"/>
<int:channel id="toRabbit3"/>

View File

@@ -55,9 +55,13 @@
mapped-request-headers="foo*"
amqp-template="amqpTemplateConfirmsAdapter"
confirm-correlation-expression="headers['amqp_confirmCorrelationData']"
confirm-ack-channel="ackChannel" />
confirm-ack-channel="ackChannel" >
<int:poller fixed-delay="100"/>
</amqp:outbound-channel-adapter>
<int:channel id="pcRequestChannelForAdapter"/>
<int:channel id="pcRequestChannelForAdapter">
<int:queue/>
</int:channel>
<rabbit:template id="amqpTemplateReturns" connection-factory="connectionFactory" mandatory="true" />

View File

@@ -1,2 +1,2 @@
http\://www.springframework.org/schema/integration/spring-integration-4.3.xsd=org/springframework/integration/config/xml/spring-integration-4.3.xsd
http\://www.springframework.org/schema/integration/spring-integration.xsd=org/springframework/integration/config/xml/spring-integration-4.3.xsd
http\://www.springframework.org/schema/integration/spring-integration-4.3.xsd=org/springframework/integration/config/spring-integration-4.3.xsd
http\://www.springframework.org/schema/integration/spring-integration.xsd=org/springframework/integration/config/spring-integration-4.3.xsd

View File

@@ -24,6 +24,7 @@
<xsd:complexContent>
<xsd:extension base="base-ftp-adapter-type">
<xsd:all>
<xsd:element ref="integration:poller" minOccurs="0" maxOccurs="1"/>
<xsd:element name="request-handler-advice-chain" type="integration:handlerAdviceChainType" minOccurs="0" maxOccurs="1" />
</xsd:all>
<xsd:attribute name="channel" type="xsd:string">

View File

@@ -15,7 +15,7 @@
<property name="clientMode" value="0"/>
<property name="fileType" value="2"/>
</bean>
<bean id="cachingSessionFactory" class="org.springframework.integration.file.remote.session.CachingSessionFactory">
<constructor-arg ref="ftpSessionFactory"/>
<constructor-arg value="10"/>
@@ -23,7 +23,7 @@
</bean>
<int-ftp:outbound-channel-adapter id="ftpOutbound"
channel="ftpChannel"
channel="ftpChannel"
session-factory="ftpSessionFactory"
remote-directory="foo/bar"
temporary-remote-directory="baz/abc"
@@ -34,9 +34,9 @@
mode="APPEND"
remote-filename-generator="fileNameGenerator"
order="23"/>
<int-ftp:outbound-channel-adapter id="ftpOutbound2"
channel="ftpChannel"
channel="ftpChannel"
session-factory="cachingSessionFactory"
remote-directory="foo/bar"
charset="UTF-8"
@@ -44,7 +44,7 @@
temporary-file-suffix=".foo"
remote-filename-generator="fileNameGenerator"
order="12"/>
<int-ftp:outbound-channel-adapter id="ftpOutbound3"
channel="anotherFtpChannel"
session-factory="cachingSessionFactory"
@@ -52,11 +52,13 @@
charset="UTF-8"
remote-file-separator="."
use-temporary-file-name="false"
remote-filename-generator="fileNameGenerator"/>
remote-filename-generator="fileNameGenerator">
<int:poller fixed-delay="100"/>
</int-ftp:outbound-channel-adapter>
<int-ftp:outbound-channel-adapter id="simpleAdapter"
channel="ftpChannel"
channel="ftpChannel"
session-factory="cachingSessionFactory"
remote-directory="foo/bar"/>
@@ -69,7 +71,9 @@
</int-ftp:request-handler-advice-chain>
</int-ftp:outbound-channel-adapter>
<int:channel id="anotherFtpChannel"/>
<int:channel id="anotherFtpChannel">
<int:queue/>
</int:channel>
<int:publish-subscribe-channel id="ftpChannel"/>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,6 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.channel.PublishSubscribeChannel;
import org.springframework.integration.endpoint.EventDrivenConsumer;
import org.springframework.integration.endpoint.PollingConsumer;
import org.springframework.integration.file.DefaultFileNameGenerator;
import org.springframework.integration.file.FileNameGenerator;
import org.springframework.integration.file.remote.handler.FileTransferringMessageHandler;
@@ -53,6 +54,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
* @author Oleg Zhurakousky
* @author Gary Russell
* @author Gunnar Hillert
* @author Artem Bilan
* @since 2.0
*/
@ContextConfiguration
@@ -78,7 +80,7 @@ public class FtpOutboundChannelAdapterParserTests {
private EventDrivenConsumer ftpOutbound2;
@Autowired
private EventDrivenConsumer ftpOutbound3;
private PollingConsumer ftpOutbound3;
@Autowired
private PublishSubscribeChannel ftpChannel;
@@ -87,10 +89,11 @@ public class FtpOutboundChannelAdapterParserTests {
private FileNameGenerator fileNameGenerator;
@Test
public void testFtpOutboundChannelAdapterComplete() throws Exception{
public void testFtpOutboundChannelAdapterComplete() throws Exception {
assertEquals(ftpChannel, TestUtils.getPropertyValue(ftpOutbound, "inputChannel"));
assertEquals("ftpOutbound", ftpOutbound.getComponentName());
FileTransferringMessageHandler<?> handler = TestUtils.getPropertyValue(ftpOutbound, "handler", FileTransferringMessageHandler.class);
FileTransferringMessageHandler<?> handler =
TestUtils.getPropertyValue(ftpOutbound, "handler", FileTransferringMessageHandler.class);
String remoteFileSeparator = (String) TestUtils.getPropertyValue(handler, "remoteFileTemplate.remoteFileSeparator");
assertNotNull(remoteFileSeparator);
assertEquals(".foo", TestUtils.getPropertyValue(handler, "remoteFileTemplate.temporaryFileSuffix", String.class));
@@ -106,21 +109,18 @@ public class FtpOutboundChannelAdapterParserTests {
assertEquals(22, TestUtils.getPropertyValue(sessionFactory, "port"));
assertEquals(23, TestUtils.getPropertyValue(handler, "order"));
//verify subscription order
Object dispatcher = TestUtils.getPropertyValue(ftpChannel, "dispatcher");
@SuppressWarnings("unchecked")
Set<MessageHandler> handlers = (Set<MessageHandler>) TestUtils
.getPropertyValue(
TestUtils.getPropertyValue(ftpChannel, "dispatcher"),
"handlers");
Set<MessageHandler> handlers = (Set<MessageHandler>) TestUtils.getPropertyValue(dispatcher, "handlers");
Iterator<MessageHandler> iterator = handlers.iterator();
assertSame(TestUtils.getPropertyValue(this.ftpOutbound2, "handler"), iterator.next());
assertSame(handler, iterator.next());
assertEquals(FileExistsMode.APPEND, TestUtils.getPropertyValue(ftpOutbound, "handler.mode"));
}
@SuppressWarnings("resource")
@Test(expected=BeanCreationException.class)
public void testFailWithEmptyRfsAndAcdTrue() throws Exception{
new ClassPathXmlApplicationContext("FtpOutboundChannelAdapterParserTests-fail.xml", this.getClass());
@Test(expected = BeanCreationException.class)
public void testFailWithEmptyRfsAndAcdTrue() throws Exception {
new ClassPathXmlApplicationContext("FtpOutboundChannelAdapterParserTests-fail.xml", this.getClass()).close();
}
@Test
@@ -142,13 +142,14 @@ public class FtpOutboundChannelAdapterParserTests {
@Test
public void testTemporaryFileSuffix() {
FileTransferringMessageHandler<?> handler =
(FileTransferringMessageHandler<?>)TestUtils.getPropertyValue(ftpOutbound3, "handler");
assertFalse((Boolean)TestUtils.getPropertyValue(handler,"remoteFileTemplate.useTemporaryFileName"));
(FileTransferringMessageHandler<?>) TestUtils.getPropertyValue(ftpOutbound3, "handler");
assertFalse(TestUtils.getPropertyValue(handler, "remoteFileTemplate.useTemporaryFileName", Boolean.class));
}
@Test
public void testBeanExpressions() throws Exception{
FileTransferringMessageHandler<?> handler = TestUtils.getPropertyValue(withBeanExpressions, "handler", FileTransferringMessageHandler.class);
public void testBeanExpressions() throws Exception {
FileTransferringMessageHandler<?> handler =
TestUtils.getPropertyValue(withBeanExpressions, "handler", FileTransferringMessageHandler.class);
ExpressionEvaluatingMessageProcessor<?> dirExpProc = TestUtils.getPropertyValue(handler,
"remoteFileTemplate.directoryExpressionProcessor", ExpressionEvaluatingMessageProcessor.class);
assertNotNull(dirExpProc);
@@ -173,4 +174,5 @@ public class FtpOutboundChannelAdapterParserTests {
}
}
}

View File

@@ -134,7 +134,7 @@
writes Message to a Gemfire cache
</xsd:documentation>
</xsd:annotation>
<xsd:choice minOccurs="0" maxOccurs="2">
<xsd:choice minOccurs="0" maxOccurs="3">
<xsd:element name="cache-entries" type="beans:mapType"
minOccurs="0" maxOccurs="1">
<xsd:annotation>
@@ -144,6 +144,7 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element ref="integration:poller" minOccurs="0" maxOccurs="1"/>
<xsd:element name="request-handler-advice-chain" type="integration:handlerAdviceChainType" minOccurs="0"
maxOccurs="1"/>
</xsd:choice>

View File

@@ -10,9 +10,12 @@
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<int:channel id="input"/>
<int:channel id="input">
<int:queue/>
</int:channel>
<int-gfe:outbound-channel-adapter id="adapter" region="region" channel="input" auto-startup="false" phase="2">
<int:poller fixed-delay="100"/>
<int-gfe:request-handler-advice-chain>
<bean class="org.springframework.integration.gemfire.config.xml.GemfireOutboundChannelAdapterParserTests$FooAdvice"/>
</int-gfe:request-handler-advice-chain>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
@@ -14,9 +14,13 @@
package org.springframework.integration.gemfire.config.xml;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.springframework.integration.gemfire.config.xml.ParserTestUtil.createFakeParserContext;
import static org.springframework.integration.gemfire.config.xml.ParserTestUtil.loadXMLFrom;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.w3c.dom.Element;
@@ -30,20 +34,23 @@ import org.springframework.integration.handler.advice.AbstractRequestHandlerAdvi
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* @author Dan Oxlade
* @author Liujiong
* @author Artem Bilan
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
@DirtiesContext
public class GemfireOutboundChannelAdapterParserTests {
private GemfireOutboundChannelAdapterParser underTest = new GemfireOutboundChannelAdapterParser();
private volatile static int adviceCalled;
private static final CountDownLatch adviceCalled = new CountDownLatch(1);
@Autowired
@Qualifier("adapter")
@@ -60,11 +67,11 @@ public class GemfireOutboundChannelAdapterParserTests {
}
@Test
public void withAdvice() {
public void withAdvice() throws InterruptedException {
adapter1.start();
MessageChannel channel = ctx.getBean("input", MessageChannel.class);
channel.send(new GenericMessage<String>("foo"));
assertEquals(1, adviceCalled);
assertTrue(adviceCalled.await(10, TimeUnit.SECONDS));
}
@Test
@@ -81,7 +88,7 @@ public class GemfireOutboundChannelAdapterParserTests {
@Override
protected Object doInvoke(ExecutionCallback callback, Object target, Message<?> message) throws Exception {
adviceCalled++;
adviceCalled.countDown();
return null;
}

View File

@@ -68,6 +68,7 @@
<xsd:complexContent>
<xsd:extension base="udpAdapterType">
<xsd:all>
<xsd:element ref="integration:poller" minOccurs="0" maxOccurs="1"/>
<xsd:element name="request-handler-advice-chain" type="integration:handlerAdviceChainType"
minOccurs="0" maxOccurs="1" />
</xsd:all>
@@ -203,6 +204,7 @@
<xsd:element name="tcp-outbound-channel-adapter">
<xsd:complexType>
<xsd:all>
<xsd:element ref="integration:poller" minOccurs="0" maxOccurs="1"/>
<xsd:element name="request-handler-advice-chain" type="integration:handlerAdviceChainType"
minOccurs="0" maxOccurs="1" />
</xsd:all>
@@ -343,6 +345,7 @@
<xsd:element name="tcp-outbound-gateway">
<xsd:complexType>
<xsd:all>
<xsd:element ref="integration:poller" minOccurs="0" maxOccurs="1"/>
<xsd:element name="request-handler-advice-chain" type="integration:handlerAdviceChainType"
minOccurs="0" maxOccurs="1" />
</xsd:all>

View File

@@ -143,9 +143,12 @@
order="12"
/>
<int:channel id="udpAdviceChannel" />
<int:channel id="udpAdviceChannel" >
<int:queue/>
</int:channel>
<ip:udp-outbound-channel-adapter channel="udpAdviceChannel" host="localhost" port="0">
<int:poller fixed-delay="100"/>
<ip:request-handler-advice-chain>
<bean class="org.springframework.integration.ip.config.ParserUnitTests$FooAdvice" />
</ip:request-handler-advice-chain>
@@ -173,12 +176,15 @@
<constructor-arg value="org.springframework.integration.ip.tcp.connection.AbstractClientConnectionFactory" />
</bean>
<int:channel id="tcpAdviceChannel" />
<int:channel id="tcpAdviceChannel">
<int:queue/>
</int:channel>
<ip:tcp-outbound-channel-adapter id="tcpOutAdvice"
channel="tcpAdviceChannel"
connection-factory="mockClientCf"
phase="125">
<int:poller fixed-delay="100"/>
<ip:request-handler-advice-chain>
<bean class="org.springframework.integration.ip.config.ParserUnitTests$FooAdvice" />
</ip:request-handler-advice-chain>
@@ -229,13 +235,16 @@
phase="127"
/>
<int:channel id="tcpAdviceGateChannel" />
<int:channel id="tcpAdviceGateChannel">
<int:queue/>
</int:channel>
<ip:tcp-outbound-gateway id="outAdviceGateway"
request-channel="tcpAdviceGateChannel"
reply-channel="replyChannel"
remote-timeout-expression="4000"
connection-factory="mockClientCf">
<int:poller fixed-delay="100"/>
<ip:request-handler-advice-chain>
<bean class="org.springframework.integration.ip.config.ParserUnitTests$FooAdvice" />
</ip:request-handler-advice-chain>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +27,8 @@ import static org.mockito.Mockito.mock;
import java.util.Iterator;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -76,16 +78,19 @@ import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* @author Gary Russell
* @author Oleg Zhurakousky
* @author Artem Bilan
* @since 2.0
*/
@ContextConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
@DirtiesContext
public class ParserUnitTests {
@Autowired
@@ -213,19 +218,19 @@ public class ParserUnitTests {
private MessageChannel errorChannel;
@Autowired
private DirectChannel udpChannel;
private MessageChannel udpChannel;
@Autowired
private DirectChannel udpAdviceChannel;
private MessageChannel udpAdviceChannel;
@Autowired
private DirectChannel tcpAdviceChannel;
private MessageChannel tcpAdviceChannel;
@Autowired
private DirectChannel tcpAdviceGateChannel;
private MessageChannel tcpAdviceGateChannel;
@Autowired
private DirectChannel tcpChannel;
private MessageChannel tcpChannel;
@Autowired
TcpReceivingChannelAdapter tcpInClientMode;
@@ -274,7 +279,7 @@ public class ParserUnitTests {
@Autowired
QueueChannel eventChannel;
private static volatile int adviceCalled;
private static CountDownLatch adviceCalled = new CountDownLatch(1);
@Test
public void testInUdp() {
@@ -409,24 +414,24 @@ public class ParserUnitTests {
}
@Test
public void udpAdvice() {
adviceCalled = 0;
public void udpAdvice() throws InterruptedException {
adviceCalled = new CountDownLatch(1);
this.udpAdviceChannel.send(new GenericMessage<String>("foo"));
assertEquals(1, adviceCalled);
assertTrue(adviceCalled.await(10, TimeUnit.SECONDS));
}
@Test
public void tcpAdvice() {
adviceCalled = 0;
public void tcpAdvice() throws InterruptedException {
adviceCalled = new CountDownLatch(1);
this.tcpAdviceChannel.send(new GenericMessage<String>("foo"));
assertEquals(1, adviceCalled);
assertTrue(adviceCalled.await(10, TimeUnit.SECONDS));
}
@Test
public void tcpGatewayAdvice() {
adviceCalled = 0;
public void tcpGatewayAdvice() throws InterruptedException {
adviceCalled = new CountDownLatch(1);
this.tcpAdviceGateChannel.send(new GenericMessage<String>("foo"));
assertEquals(1, adviceCalled);
assertTrue(adviceCalled.await(10, TimeUnit.SECONDS));
}
@Test
@@ -693,7 +698,7 @@ public class ParserUnitTests {
@Override
protected Object doInvoke(ExecutionCallback callback, Object target, Message<?> message) throws Exception {
adviceCalled++;
adviceCalled.countDown();
return null;
}

View File

@@ -721,6 +721,7 @@
<xsd:complexType>
<xsd:sequence>
<xsd:sequence>
<xsd:element ref="integration:poller" minOccurs="0" maxOccurs="1" />
<xsd:element name="sql-parameter-definition" minOccurs="0"
maxOccurs="unbounded" type="sqlParameterDefinitionType">
<xsd:annotation>

View File

@@ -18,7 +18,13 @@
<int:poller id="defaultPoller" default="true" fixed-rate="5000"/>
<int:channel id="startChannel"/>
<int:channel id="startChannel">
<int:queue/>
</int:channel>
<int:channel id="startErrorsChannel">
<int:queue/>
</int:channel>
<int-jdbc:stored-proc-outbound-gateway request-channel="startChannel"
data-source="dataSource"
@@ -29,6 +35,7 @@
is-function="false"
expect-single-result="true"
reply-channel="outputChannel">
<int:poller fixed-delay="100" error-channel="startErrorsChannel"/>
<int-jdbc:parameter name="username" expression="payload.username"/>
<int-jdbc:parameter name="password" expression="payload.password"/>
<int-jdbc:parameter name="email" expression="payload.email"/>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,8 +16,10 @@
package org.springframework.integration.jdbc;
import static org.hamcrest.Matchers.instanceOf;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import java.sql.CallableStatement;
@@ -48,8 +50,10 @@ import org.springframework.integration.support.json.JsonOutboundMessageMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.SqlReturnType;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessageHandlingException;
import org.springframework.messaging.PollableChannel;
import org.springframework.messaging.support.ErrorMessage;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
@@ -73,10 +77,14 @@ public class StoredProcOutboundGatewayWithSpelIntegrationTests {
@Autowired
@Qualifier("startChannel")
DirectChannel channel;
MessageChannel channel;
@Autowired
DirectChannel getMessageChannel;
@Qualifier("startErrorsChannel")
PollableChannel startErrorsChannel;
@Autowired
MessageChannel getMessageChannel;
@Autowired
PollableChannel output2Channel;
@@ -95,8 +103,8 @@ public class StoredProcOutboundGatewayWithSpelIntegrationTests {
User user2 = new User("Second User", "my second password", "email2");
Message<User> user1Message = MessageBuilder.withPayload(user1)
.setHeader("my_stored_procedure", "CREATE_USER")
.build();
.setHeader("my_stored_procedure", "CREATE_USER")
.build();
Message<User> user2Message = MessageBuilder.withPayload(user2)
.setHeader("my_stored_procedure", "CREATE_USER_RETURN_ALL")
.build();
@@ -132,19 +140,18 @@ public class StoredProcOutboundGatewayWithSpelIntegrationTests {
Message<User> user1Message = MessageBuilder.withPayload(user1).build();
try {
channel.send(user1Message);
} catch (MessageHandlingException e) {
this.channel.send(user1Message);
String expectedMessage = "Unable to resolve Stored Procedure/Function name " +
"for the provided Expression 'headers['my_stored_procedure']'.";
String actualMessage = e.getCause().getMessage();
Assert.assertEquals(expectedMessage, actualMessage);
return;
}
Message<?> receive = this.startErrorsChannel.receive(1000);
assertNotNull(receive);
assertThat(receive, instanceOf(ErrorMessage.class));
Assert.fail("Expected a MessageHandlingException to be thrown.");
MessageHandlingException exception = (MessageHandlingException) receive.getPayload();
String expectedMessage = "Unable to resolve Stored Procedure/Function name " +
"for the provided Expression 'headers['my_stored_procedure']'.";
String actualMessage = exception.getCause().getMessage();
Assert.assertEquals(expectedMessage, actualMessage);
}
@Test
@@ -161,7 +168,8 @@ public class StoredProcOutboundGatewayWithSpelIntegrationTests {
assertNotNull(resultMessage);
Object resultPayload = resultMessage.getPayload();
assertTrue(resultPayload instanceof String);
Message<?> message = new JsonInboundMessageMapper(String.class, new Jackson2JsonMessageParser()).toMessage((String) resultPayload);
Message<?> message = new JsonInboundMessageMapper(String.class, new Jackson2JsonMessageParser())
.toMessage((String) resultPayload);
assertEquals(testMessage.getPayload(), message.getPayload());
assertEquals(testMessage.getHeaders().get("FOO"), message.getHeaders().get("FOO"));
Mockito.verify(clobSqlReturnType).getTypeValue(Mockito.any(CallableStatement.class),
@@ -173,11 +181,11 @@ public class StoredProcOutboundGatewayWithSpelIntegrationTests {
private final AtomicInteger count = new AtomicInteger();
public Integer next() throws InterruptedException {
if (count.get()>2){
if (count.get() > 2) {
//prevent message overload
return null;
}
return Integer.valueOf(count.incrementAndGet());
return count.incrementAndGet();
}
}
@@ -200,4 +208,5 @@ public class StoredProcOutboundGatewayWithSpelIntegrationTests {
}
}
}

View File

@@ -72,6 +72,7 @@
<xsd:complexContent>
<xsd:extension base="operationInvokingType">
<xsd:all>
<xsd:element ref="integration:poller" minOccurs="0" maxOccurs="1" />
<xsd:element name="request-handler-advice-chain" type="integration:handlerAdviceChainType" minOccurs="0" maxOccurs="1" />
</xsd:all>
<xsd:attribute name="request-channel" type="xsd:string" />
@@ -100,6 +101,7 @@
<xsd:complexContent>
<xsd:extension base="operationInvokingType">
<xsd:all>
<xsd:element ref="integration:poller" minOccurs="0" maxOccurs="1" />
<xsd:element name="request-handler-advice-chain" type="integration:handlerAdviceChainType" minOccurs="0" maxOccurs="1" />
</xsd:all>
<xsd:attribute name="channel" type="xsd:string" use="optional" />

View File

@@ -16,7 +16,9 @@
<context:mbean-export/>
<context:mbean-server/>
<si:channel id="withReplyChannel"/>
<si:channel id="withReplyChannel">
<si:queue/>
</si:channel>
<si:channel id="withReplyChannelOutput">
<si:queue/>
@@ -28,6 +30,7 @@
reply-channel="withReplyChannelOutput"
object-name="org.springframework.integration.jmx.config:type=TestBean,name=testBeanGateway"
operation-name="testWithReturn">
<si:poller fixed-delay="100"/>
<jmx:request-handler-advice-chain>
<bean class="org.springframework.integration.jmx.config.OperationInvokingOutboundGatewayTests.FooAdvice" />
</jmx:request-handler-advice-chain>

View File

@@ -1,2 +1,2 @@
http\://www.springframework.org/schema/integration/jpa/spring-integration-jpa-4.3.xsd=org/springframework/integration/jpa/config/xml/spring-integration-jpa-4.3.xsd
http\://www.springframework.org/schema/integration/jpa/spring-integration-jpa.xsd=org/springframework/integration/jpa/config/xml/spring-integration-jpa-4.3.xsd
http\://www.springframework.org/schema/integration/jpa/spring-integration-jpa-4.3.xsd=org/springframework/integration/jpa/config/spring-integration-jpa-4.3.xsd
http\://www.springframework.org/schema/integration/jpa/spring-integration-jpa.xsd=org/springframework/integration/jpa/config/spring-integration-jpa-4.3.xsd

View File

@@ -1,2 +1,2 @@
http\://www.springframework.org/schema/integration/mqtt/spring-integration-mqtt-4.3.xsd=org/springframework/integration/mqtt/config/xml/spring-integration-mqtt-4.3.xsd
http\://www.springframework.org/schema/integration/mqtt/spring-integration-mqtt.xsd=org/springframework/integration/mqtt/config/xml/spring-integration-mqtt-4.3.xsd
http\://www.springframework.org/schema/integration/mqtt/spring-integration-mqtt-4.3.xsd=org/springframework/integration/mqtt/config/spring-integration-mqtt-4.3.xsd
http\://www.springframework.org/schema/integration/mqtt/spring-integration-mqtt.xsd=org/springframework/integration/mqtt/config/spring-integration-mqtt-4.3.xsd

View File

@@ -1,2 +1,2 @@
http\://www.springframework.org/schema/integration/zookeeper/spring-integration-zookeeper-4.3.xsd=org/springframework/integration/zookeeper/config/xml/spring-integration-zookeeper-4.3.xsd
http\://www.springframework.org/schema/integration/zookeeper/spring-integration-zookeeper.xsd=org/springframework/integration/zookeeper/config/xml/spring-integration-zookeeper-4.3.xsd
http\://www.springframework.org/schema/integration/zookeeper/spring-integration-zookeeper-4.3.xsd=org/springframework/integration/zookeeper/config/spring-integration-zookeeper-4.3.xsd
http\://www.springframework.org/schema/integration/zookeeper/spring-integration-zookeeper.xsd=org/springframework/integration/zookeeper/config/spring-integration-zookeeper-4.3.xsd