This commit is contained in:
Mark Fisher
2009-03-11 20:13:24 +00:00
parent 5bcbc6a896
commit c1040cec61
2 changed files with 6 additions and 7 deletions

View File

@@ -36,9 +36,11 @@ import org.mockito.Mock;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.runners.MockitoJUnit44Runner;
import org.mockito.stubbing.Answer;
import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.core.Message;
import org.springframework.integration.core.MessageChannel;
import org.springframework.integration.message.MessageDeliveryException;
import org.springframework.ws.WebServiceMessage;
import org.springframework.ws.context.MessageContext;
@@ -47,7 +49,6 @@ import org.springframework.ws.context.MessageContext;
* @author Iwein Fuld
*
*/
@RunWith(MockitoJUnit44Runner.class)
public class SimpleWebServiceInboundGatewayTests {
@@ -94,19 +95,16 @@ public class SimpleWebServiceInboundGatewayTests {
assertTrue(output.toString().endsWith(input));
}
@Test(timeout = 5000)
@Test(expected = MessageDeliveryException.class)
public void invokePoxSourceTimeout() throws Exception {
//this is tells the story of a message silently dropped on timeout see INT-593
gateway.setRequestTimeout(10);
gateway.setReplyTimeout(10);
when(requestChannel.send(isA(Message.class), anyLong())).thenReturn(false);
when(request.getPayloadSource()).thenReturn(payloadSource);
gateway.invoke(context);
verify(requestChannel).send(messageWithPayload(payloadSource),
anyLong());
verify(requestChannel, never()).send(isA(Message.class));
}
private Message<?> messageWithPayload(final Object payload) {
return argThat(new BaseMatcher<Message<?>>() {

View File

@@ -27,6 +27,7 @@ import org.springframework.beans.factory.InitializingBean;
import org.springframework.integration.core.Message;
import org.springframework.integration.core.MessageChannel;
import org.springframework.integration.message.MessageBuilder;
import org.springframework.integration.message.MessageDeliveryException;
import org.springframework.integration.selector.MessageSelector;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionStatus;
@@ -245,7 +246,7 @@ public class MessageChannelTemplate implements InitializingBean {
.setErrorChannel(replyChannel)
.build();
if (!this.doSend(request, channel)) {
return null;
throw new MessageDeliveryException(request, "failed to send message to channel");
}
return this.doReceive(replyChannel);
}